== Multires ==
authorNicholas Bishop <nicholasbishop@gmail.com>
Sun, 3 Jun 2007 20:24:09 +0000 (20:24 +0000)
committerNicholas Bishop <nicholasbishop@gmail.com>
Sun, 3 Jun 2007 20:24:09 +0000 (20:24 +0000)
Fixed bug [#6798] Multires eventually destroys Meshes with Shapekys

* Moved the check for multires on adding shapekeys into insert_shapekeys rather than on the "Add Shape" button click

source/blender/src/buttons_editing.c
source/blender/src/editkey.c

index ec2b7b3b2745581b9f7479506460b22ef2a0b13f..e593f9c5409208dc7de58dfad4b170c04d794476 100644 (file)
@@ -602,11 +602,7 @@ void do_common_editbuts(unsigned short event) // old name, is a mix of object an
                break;
        
        case B_ADDKEY:
-               if(get_mesh(ob) && get_mesh(ob)->mr) {
-                       error("Cannot create shape keys on a multires mesh.");
-               } else {
-                       insert_shapekey(ob);
-               }
+               insert_shapekey(ob);
                break;
        case B_SETKEY:
                ob->shapeflag |= OB_SHAPE_TEMPLOCK;
index 85dac9ee3c54a1d39e5d553d68912c16b2453c59..975f792d2b96f540b942f151eb7367e537599900 100644 (file)
@@ -67,6 +67,7 @@
 #include "BKE_key.h"
 #include "BKE_library.h"
 #include "BKE_main.h"
+#include "BKE_mesh.h"
 #include "BKE_object.h"
 #include "BKE_utildefines.h"
 
@@ -599,21 +600,26 @@ void insert_curvekey(Curve *cu, short rel)
 
 void insert_shapekey(Object *ob)
 {
-       Key *key;
+       if(get_mesh(ob) && get_mesh(ob)->mr) {
+               error("Cannot create shape keys on a multires mesh.");
+       }
+       else {
+               Key *key;
        
-       if(ob->type==OB_MESH) insert_meshkey(ob->data, 1);
-       else if ELEM(ob->type, OB_CURVE, OB_SURF) insert_curvekey(ob->data, 1);
-       else if(ob->type==OB_LATTICE) insert_lattkey(ob->data, 1);
+               if(ob->type==OB_MESH) insert_meshkey(ob->data, 1);
+               else if ELEM(ob->type, OB_CURVE, OB_SURF) insert_curvekey(ob->data, 1);
+               else if(ob->type==OB_LATTICE) insert_lattkey(ob->data, 1);
        
-       key= ob_get_key(ob);
-       ob->shapenr= BLI_countlist(&key->block);
+               key= ob_get_key(ob);
+               ob->shapenr= BLI_countlist(&key->block);
        
-       allspace(REMAKEIPO, 0);
-       allqueue(REDRAWIPO, 0);
-       allqueue(REDRAWACTION, 0);
-       allqueue(REDRAWNLA, 0);
-       allqueue(REDRAWBUTSOBJECT, 0);
-       allqueue(REDRAWBUTSEDIT, 0);
+               allspace(REMAKEIPO, 0);
+               allqueue(REDRAWIPO, 0);
+               allqueue(REDRAWACTION, 0);
+               allqueue(REDRAWNLA, 0);
+               allqueue(REDRAWBUTSOBJECT, 0);
+               allqueue(REDRAWBUTSEDIT, 0);
+       }
 }
 
 void delete_key(Object *ob)