Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-05-15 10:47:54 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-05-15 10:47:54 +0300
commit656692913beb0d47f41a21db53fc4c310e2fb203 (patch)
treef07f50b826da946801d7efa3491dc70eaaad03eb /source/blender/blenkernel/intern/paint_toolslots.c
parent191c562f98ed8c12d505c1c625b577628ef9a804 (diff)
parentc361f911f9c459364fceea5de5b9d0ea2f91c9e9 (diff)
Merge branch 'blender-v2.83-release'
Diffstat (limited to 'source/blender/blenkernel/intern/paint_toolslots.c')
-rw-r--r--source/blender/blenkernel/intern/paint_toolslots.c41
1 files changed, 32 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/paint_toolslots.c b/source/blender/blenkernel/intern/paint_toolslots.c
index df7feed3a53..0ea0173f8a3 100644
--- a/source/blender/blenkernel/intern/paint_toolslots.c
+++ b/source/blender/blenkernel/intern/paint_toolslots.c
@@ -33,6 +33,13 @@
#include "BKE_main.h"
#include "BKE_paint.h"
+/* -------------------------------------------------------------------- */
+/** \name Tool Slot Initialization / Versioning
+ *
+ * These functions run to update old files (while versioning),
+ * take care only to perform low-level functions here.
+ * \{ */
+
void BKE_paint_toolslots_len_ensure(Paint *paint, int len)
{
/* Tool slots are 'uchar'. */
@@ -62,38 +69,54 @@ static void paint_toolslots_init(Main *bmain, Paint *paint)
}
}
+/**
+ * Initialize runtime since this is called from versioning code.
+ */
+static void paint_toolslots_init_with_runtime(Main *bmain, ToolSettings *ts, Paint *paint)
+{
+ if (paint == NULL) {
+ return;
+ }
+
+ /* Needed so #Paint_Runtime is updated when versioning. */
+ BKE_paint_runtime_init(ts, paint);
+ paint_toolslots_init(bmain, paint);
+}
+
void BKE_paint_toolslots_init_from_main(struct Main *bmain)
{
for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
ToolSettings *ts = scene->toolsettings;
- paint_toolslots_init(bmain, &ts->imapaint.paint);
+ paint_toolslots_init_with_runtime(bmain, ts, &ts->imapaint.paint);
if (ts->sculpt) {
- paint_toolslots_init(bmain, &ts->sculpt->paint);
+ paint_toolslots_init_with_runtime(bmain, ts, &ts->sculpt->paint);
}
if (ts->vpaint) {
- paint_toolslots_init(bmain, &ts->vpaint->paint);
+ paint_toolslots_init_with_runtime(bmain, ts, &ts->vpaint->paint);
}
if (ts->wpaint) {
- paint_toolslots_init(bmain, &ts->wpaint->paint);
+ paint_toolslots_init_with_runtime(bmain, ts, &ts->wpaint->paint);
}
if (ts->uvsculpt) {
- paint_toolslots_init(bmain, &ts->uvsculpt->paint);
+ paint_toolslots_init_with_runtime(bmain, ts, &ts->uvsculpt->paint);
}
if (ts->gp_paint) {
- paint_toolslots_init(bmain, &ts->gp_paint->paint);
+ paint_toolslots_init_with_runtime(bmain, ts, &ts->gp_paint->paint);
}
if (ts->gp_vertexpaint) {
- paint_toolslots_init(bmain, &ts->gp_vertexpaint->paint);
+ paint_toolslots_init_with_runtime(bmain, ts, &ts->gp_vertexpaint->paint);
}
if (ts->gp_sculptpaint) {
- paint_toolslots_init(bmain, &ts->gp_sculptpaint->paint);
+ paint_toolslots_init_with_runtime(bmain, ts, &ts->gp_sculptpaint->paint);
}
if (ts->gp_weightpaint) {
- paint_toolslots_init(bmain, &ts->gp_weightpaint->paint);
+ paint_toolslots_init_with_runtime(bmain, ts, &ts->gp_weightpaint->paint);
}
}
}
+/** \} */
+
void BKE_paint_toolslots_brush_update_ex(Paint *paint, Brush *brush)
{
const uint tool_offset = paint->runtime.tool_offset;