diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2012-03-19 09:13:41 +0400 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2012-03-19 09:13:41 +0400 |
commit | e508c2d9e1151a75926937cfdfb2799d2959bca1 (patch) | |
tree | 6394e4900fe8a77506716477797bf27dca8eda86 /source/blender/editors/object | |
parent | 753056d4e82094fe8993c0efade081600b14359b (diff) |
Add a multires function to delete MDisps.
The code was duplicated in various places, replaced with calls to
a new function, multires_customdata_delete().
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r-- | source/blender/editors/object/object_modifier.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index dea9c1a3b6c..c420b214a7a 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -203,10 +203,9 @@ static int object_modifier_remove(Object *ob, ModifierData *md, int *sort_depsgr } else if(md->type == eModifierType_Multires) { int ok= 1; - Mesh *me= ob->data; ModifierData *tmpmd; - /* ensure MDISPS CustomData layer is't used by another multires modifiers */ + /* ensure MDISPS CustomData layer isn't used by another multires modifiers */ for(tmpmd= ob->modifiers.first; tmpmd; tmpmd= tmpmd->next) if(tmpmd!=md && tmpmd->type == eModifierType_Multires) { ok= 0; @@ -214,16 +213,7 @@ static int object_modifier_remove(Object *ob, ModifierData *md, int *sort_depsgr } if(ok) { - if(me->edit_btmesh) { - BMEditMesh *em= me->edit_btmesh; - /* CustomData_external_remove is used here only to mark layer as non-external - * for further free-ing, so zero element count looks safer than em->totface */ - CustomData_external_remove(&em->bm->ldata, &me->id, CD_MDISPS, 0); - BM_data_layer_free(em->bm, &em->bm->ldata, CD_MDISPS); - } else { - CustomData_external_remove(&me->ldata, &me->id, CD_MDISPS, me->totloop); - CustomData_free_layer_active(&me->ldata, CD_MDISPS, me->totloop); - } + multires_customdata_delete(ob->data); } } @@ -536,10 +526,8 @@ static int modifier_apply_obdata(ReportList *reports, Scene *scene, Object *ob, dm->release(dm); - if(md->type == eModifierType_Multires) { - CustomData_external_remove(&me->ldata, &me->id, CD_MDISPS, me->totloop); - CustomData_free_layer_active(&me->ldata, CD_MDISPS, me->totloop); - } + if(md->type == eModifierType_Multires) + multires_customdata_delete(me); } } else if (ELEM(ob->type, OB_CURVE, OB_SURF)) { |