diff options
Diffstat (limited to 'source/blender/blenkernel/intern/paint.c')
-rw-r--r-- | source/blender/blenkernel/intern/paint.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index eb3f47760fc..5fd7984ea90 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -1511,6 +1511,8 @@ void BKE_sculptsession_free(Object *ob) BKE_sculptsession_free_vwpaint_data(ob->sculpt); + MEM_SAFE_FREE(ss->last_paint_canvas_key); + MEM_freeN(ss); ob->sculpt = NULL; @@ -1771,6 +1773,24 @@ static void sculpt_update_object(Depsgraph *depsgraph, } } + /* + * We should rebuild the PBVH_pixels when painting canvas changes. + * + * The relevant changes are stored/encoded in the paint canvas key. + * These include the active uv map, and resolutions. + */ + if (U.experimental.use_sculpt_texture_paint && ss->pbvh) { + char *paint_canvas_key = BKE_paint_canvas_key_get(&scene->toolsettings->paint_mode, ob); + if (ss->last_paint_canvas_key == NULL || !STREQ(paint_canvas_key, ss->last_paint_canvas_key)) { + MEM_SAFE_FREE(ss->last_paint_canvas_key); + ss->last_paint_canvas_key = paint_canvas_key; + BKE_pbvh_mark_rebuild_pixels(ss->pbvh); + } + else { + MEM_freeN(paint_canvas_key); + } + } + /* We could be more precise when we have access to the active tool. */ const bool use_paint_slots = (ob->mode & OB_MODE_SCULPT) != 0; if (use_paint_slots) { @@ -1849,6 +1869,10 @@ void BKE_sculpt_color_layer_create_if_needed(struct Object *object) BKE_id_attributes_active_color_set(&orig_me->id, layer); DEG_id_tag_update(&orig_me->id, ID_RECALC_GEOMETRY_ALL_MODES); + + if (object->sculpt && object->sculpt->pbvh) { + BKE_pbvh_update_active_vcol(object->sculpt->pbvh, orig_me); + } } void BKE_sculpt_update_object_for_edit( |