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:
authorSergey Sharybin <sergey.vfx@gmail.com>2011-05-15 17:13:51 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2011-05-15 17:13:51 +0400
commit19eb07c63db33793fdf778d9b0b8a3c0d7f9fc57 (patch)
tree66c08f3bda600956ba74824bb3d5c4f1a7dcaf3b /source/blender/editors/object
parentd05b26c6354a0a77f7f128d0726d85b95f3511ff (diff)
Do not remove MDISPS customdata layer when removing multires modifier
and there are still another multires modifiers in the stack. Helps to prevent loosing sculpt data when you occasionally added another multires and reomved it with "X" button.
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r--source/blender/editors/object/object_modifier.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index ff1b693d0e1..6e2eb5e8adc 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -204,17 +204,28 @@ int ED_object_modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Ob
ob->dt = OB_TEXTURE;
}
else if(md->type == eModifierType_Multires) {
+ int ok= 1;
Mesh *me= ob->data;
+ ModifierData *tmpmd;
- if(me->edit_mesh) {
- EditMesh *em= me->edit_mesh;
- /* 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->fdata, &me->id, CD_MDISPS, 0);
- EM_free_data_layer(em, &em->fdata, CD_MDISPS);
- } else {
- CustomData_external_remove(&me->fdata, &me->id, CD_MDISPS, me->totface);
- CustomData_free_layer_active(&me->fdata, CD_MDISPS, me->totface);
+ /* ensure MDISPS CustomData layer is't used by another multires modifiers */
+ for(tmpmd= ob->modifiers.first; tmpmd; tmpmd= tmpmd->next)
+ if(tmpmd!=md && tmpmd->type == eModifierType_Multires) {
+ ok= 0;
+ break;
+ }
+
+ if(ok) {
+ if(me->edit_mesh) {
+ EditMesh *em= me->edit_mesh;
+ /* 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->fdata, &me->id, CD_MDISPS, 0);
+ EM_free_data_layer(em, &em->fdata, CD_MDISPS);
+ } else {
+ CustomData_external_remove(&me->fdata, &me->id, CD_MDISPS, me->totface);
+ CustomData_free_layer_active(&me->fdata, CD_MDISPS, me->totface);
+ }
}
}