bmesh: corrected fix for svulpting on non-multires mesh

Previous fix wasn't correct. It made things working, but it removed
advantage of using PBVH for speed because derivedMesh used to be
recreated on each stroke step.

This commit fixes non-multires sculpting for Solid shading,
wireframe and render wouldn't work correct -- it'll require
a bit more tricky things because DM created for base mesh
doesn't points to mesh->mverts anymore, so sculpting and
drawing modules are using different verts arrays.
This commit is contained in:
Sergey Sharybin 2011-09-07 12:16:20 +00:00
parent 05bde0b0f0
commit 3b891aea5c
3 changed files with 5 additions and 10 deletions

@ -239,7 +239,7 @@ static int can_pbvh_draw(Object *ob, DerivedMesh *dm)
if(deformed) if(deformed)
return 0; return 0;
return (cddm->mvert == me->mvert) || ob->sculpt->kb; return dm->deformedOnly || ob->sculpt->kb;
} }
static struct PBVH *cdDM_getPBVH(Object *ob, DerivedMesh *dm) static struct PBVH *cdDM_getPBVH(Object *ob, DerivedMesh *dm)

@ -3382,18 +3382,13 @@ static void sculpt_flush_update(bContext *C)
ARegion *ar = CTX_wm_region(C); ARegion *ar = CTX_wm_region(C);
MultiresModifierData *mmd = ss->multires; MultiresModifierData *mmd = ss->multires;
if (!ss->cache) { if(mmd)
if(mmd) multires_mark_as_modified(ob);
multires_mark_as_modified(ob);
}
if(ob->derivedFinal) /* VBO no longer valid */ if(ob->derivedFinal) /* VBO no longer valid */
GPU_drawobject_free(ob->derivedFinal); GPU_drawobject_free(ob->derivedFinal);
if (!ss->cache || !mmd)
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
if(ss->modifiers_active) { if(ss->modifiers_active) {
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
ED_region_tag_redraw(ar); ED_region_tag_redraw(ar);
} }
else { else {

@ -193,7 +193,7 @@ static void sculpt_undo_restore(bContext *C, ListBase *lb)
if((mmd=sculpt_multires_active(scene, ob))) if((mmd=sculpt_multires_active(scene, ob)))
multires_mark_as_modified(ob); multires_mark_as_modified(ob);
tag_update= ((Mesh*)ob->data)->id.us > 1 || !mmd; tag_update= ((Mesh*)ob->data)->id.us > 1;
if(ss->modifiers_active) { if(ss->modifiers_active) {
Mesh *mesh= ob->data; Mesh *mesh= ob->data;