diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-05-06 16:49:50 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-05-06 16:49:50 +0400 |
commit | 45b4506c0dc6e1acdd40e03be3e4fe50128ed928 (patch) | |
tree | f1734ce7a624c130b78ce4103633e52120801b5b /source/blender/editors/sculpt_paint/sculpt.c | |
parent | 35380cdcad60a30d51a6fb6ae4e9f3606067aa5b (diff) |
Cleanup a bit of the locked shape keys painting
It's still gives some slowdown when painting a locked
key in the solid view, but since shape key is now longer
being re-used by DM.
but this change should still give some degree of speedup
propagating delta onto the keyblock if i remember the
code correct.
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index df7477e9583..b75387d5551 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -198,7 +198,8 @@ static bool sculpt_modifiers_active(Scene *scene, Sculpt *sd, Object *ob) if (mmd || ob->sculpt->bm) return 0; - if (me->key && ob->shapenr) + /* non-locked shape keys could be handled in the same way as deformed mesh */ + if ((ob->shapeflag & OB_SHAPE_LOCK) == 0 && me->key && ob->shapenr) return 1; md = modifiers_getVirtualModifierList(ob, &virtualModifierData); @@ -3423,7 +3424,7 @@ static void sculpt_flush_stroke_deform(Sculpt *sd, Object *ob) MEM_freeN(nodes); /* Modifiers could depend on mesh normals, so we should update them/ - * Note, then if sculpting happens on key, normals should be re-calculated + * Note, then if sculpting happens on locked key, normals should be re-calculated * after applying coords from keyblock on base mesh */ BKE_mesh_calc_normals(me); } @@ -4465,7 +4466,7 @@ static void sculpt_flush_update(bContext *C) if (ob->derivedFinal) /* VBO no longer valid */ GPU_drawobject_free(ob->derivedFinal); - if (ss->modifiers_active) { + if (ss->kb || ss->modifiers_active) { DAG_id_tag_update(&ob->id, OB_RECALC_DATA); ED_region_tag_redraw(ar); } @@ -4566,8 +4567,19 @@ static void sculpt_stroke_update_step(bContext *C, struct PaintStroke *UNUSED(st /* hack to fix noise texture tearing mesh */ sculpt_fix_noise_tear(sd, ob); - if (ss->modifiers_active) + /* TODO(sergey): This is not really needed for the solid shading, + * which does use pBVH drawing anyway, but texture and wireframe + * requires this. + * + * Could be optimized later, but currently don't think it's so + * much common scenario. + ** + ** Same applies to the DAG_id_tag_update() invoked from + * sculpt_flush_update(). + */ + if (ss->kb || ss->modifiers_active) { sculpt_flush_stroke_deform(sd, ob); + } ss->cache->first_time = false; |