diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenlib/BLI_editVert.h | 2 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_templates.c | 17 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh.c | 4 | ||||
-rw-r--r-- | source/blender/editors/object/object_edit.c | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object.c | 17 |
5 files changed, 31 insertions, 10 deletions
diff --git a/source/blender/blenlib/BLI_editVert.h b/source/blender/blenlib/BLI_editVert.h index 56a20d8462a..35081086783 100644 --- a/source/blender/blenlib/BLI_editVert.h +++ b/source/blender/blenlib/BLI_editVert.h @@ -173,6 +173,8 @@ typedef struct EditMesh short mat_nr; /* stats */ int totvert, totedge, totface, totvertsel, totedgesel, totfacesel; + /* shape key being edited */ + int shapenr; struct DerivedMesh *derivedCage, *derivedFinal; /* the custom data layer mask that was last used to calculate diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 75ae475435a..06735badebf 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -1960,7 +1960,7 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe Object *ob; uiBlock *block= uiLayoutGetBlock(layout); uiBut *but; - uiLayout *split, *overlap, *sub; + uiLayout *split, *overlap, *sub, *row; char *name, *namebuf; int icon; @@ -1971,7 +1971,8 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe if(itemptr->type == &RNA_ShapeKey) { ob= (Object*)activeptr->data; - uiLayoutSetEnabled(sub, ob->mode != OB_MODE_EDIT); + if(ob->mode == OB_MODE_EDIT && !(ob->type == OB_MESH)) + uiLayoutSetEnabled(sub, 0); } but= uiDefButR(block, LISTROW, 0, "", 0,0, UI_UNIT_X*10,UI_UNIT_Y, activeptr, activepropname, 0, 0, i, 0, 0, ""); @@ -2005,11 +2006,13 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe uiItemL(split, name, icon); - if(i == 0) uiItemL(split, "", 0); - else uiItemR(split, "", 0, itemptr, "value", 0); - if(ob->mode == OB_MODE_EDIT && !(ob->shapeflag & OB_SHAPE_EDIT_MODE)) - uiLayoutSetEnabled(split, 0); - //uiItemR(split, "", ICON_MUTE_IPO_OFF, itemptr, "mute", 0); + row= uiLayoutRow(split, 1); + if(i == 0) uiItemL(row, "", 0); + else uiItemR(row, "", 0, itemptr, "value", 0); + + if(ob->mode == OB_MODE_EDIT && !((ob->shapeflag & OB_SHAPE_EDIT_MODE) && ob->type == OB_MESH)) + uiLayoutSetActive(row, 0); + //uiItemR(row, "", ICON_MUTE_IPO_OFF, itemptr, "mute", 0); } else uiItemL(sub, name, icon); diff --git a/source/blender/editors/mesh/editmesh.c b/source/blender/editors/mesh/editmesh.c index 408c793751b..8b9de0f6348 100644 --- a/source/blender/editors/mesh/editmesh.c +++ b/source/blender/editors/mesh/editmesh.c @@ -785,6 +785,7 @@ void make_editMesh(Scene *scene, Object *ob) /* undo-ing in past for previous editmode sessions gives corrupt 'keyindex' values */ undo_editmode_clear(); keyco= actkey->data; + em->shapenr= ob->shapenr; } /* make editverts */ @@ -1184,7 +1185,8 @@ void load_editMesh(Scene *scene, Object *ob) /* are there keys? */ if(me->key) { - KeyBlock *currkey, *actkey = ob_get_keyblock(ob); + KeyBlock *currkey; + KeyBlock *actkey= BLI_findlink(&me->key->block, em->shapenr-1); /* Lets reorder the key data so that things line up roughly * with the way things were before editmode */ diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index bd8b865a6c9..3c332fa3953 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -480,7 +480,6 @@ void ED_object_enter_editmode(bContext *C, int flag) static int editmode_toggle_exec(bContext *C, wmOperator *op) { - if(!CTX_data_edit_object(C)) ED_object_enter_editmode(C, EM_WAITCURSOR); else diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index f81e3d5d665..13ecfd91114 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -121,6 +121,21 @@ void rna_Object_update_data(bContext *C, PointerRNA *ptr) WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ptr->id.data); } +void rna_Object_active_shape_update(bContext *C, PointerRNA *ptr) +{ + Object *ob= ptr->id.data; + Scene *scene= CTX_data_scene(C); + int editmode= (scene->obedit == ob && ob->type == OB_MESH); + + if(editmode) { + /* exit/enter editmode to get new shape */ + ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO); + ED_object_enter_editmode(C, EM_WAITCURSOR); + } + + rna_Object_update_data(C, ptr); +} + static void rna_Object_dependency_update(bContext *C, PointerRNA *ptr) { DAG_id_flush_update(ptr->id.data, OB_RECALC_OB); @@ -1657,7 +1672,7 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "shapenr"); RNA_def_property_int_funcs(prop, "rna_Object_active_shape_key_index_get", "rna_Object_active_shape_key_index_set", "rna_Object_active_shape_key_index_range"); RNA_def_property_ui_text(prop, "Active Shape Key Index", "Current shape key index."); - RNA_def_property_update(prop, 0, "rna_Object_update_data"); + RNA_def_property_update(prop, 0, "rna_Object_active_shape_update"); RNA_api_object(srna); } |