From 4287796f61e1b741d4205d5970d56997742032a6 Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Sun, 3 Jun 2007 20:24:09 +0000 Subject: [PATCH] == Multires == 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 | 6 +----- source/blender/src/editkey.c | 30 +++++++++++++++++----------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c index ec2b7b3b274..e593f9c5409 100644 --- a/source/blender/src/buttons_editing.c +++ b/source/blender/src/buttons_editing.c @@ -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; diff --git a/source/blender/src/editkey.c b/source/blender/src/editkey.c index 85dac9ee3c5..975f792d2b9 100644 --- a/source/blender/src/editkey.c +++ b/source/blender/src/editkey.c @@ -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)