[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48097] branches/soc-2012-bratwurst/source /blender/editors: Add the listbox X for shape keys.
Jorge Rodriguez
bs.vino at gmail.com
Tue Jun 19 23:01:21 CEST 2012
Revision: 48097
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48097
Author: vino
Date: 2012-06-19 21:01:20 +0000 (Tue, 19 Jun 2012)
Log Message:
-----------
Add the listbox X for shape keys.
Modified Paths:
--------------
branches/soc-2012-bratwurst/source/blender/editors/interface/interface_templates.c
branches/soc-2012-bratwurst/source/blender/editors/object/object_shapekey.c
Modified: branches/soc-2012-bratwurst/source/blender/editors/interface/interface_templates.c
===================================================================
--- branches/soc-2012-bratwurst/source/blender/editors/interface/interface_templates.c 2012-06-19 19:37:59 UTC (rev 48096)
+++ branches/soc-2012-bratwurst/source/blender/editors/interface/interface_templates.c 2012-06-19 21:01:20 UTC (rev 48097)
@@ -2190,6 +2190,7 @@
Object *ob = (Object *)activeptr->data;
Key *key = (Key *)itemptr->id.data;
KeyBlock *kb = (KeyBlock *)itemptr->data;
+ PointerRNA remove_rna;
split = uiLayoutSplit(sub, 0.66f, 0);
@@ -2207,6 +2208,10 @@
uiLayoutSetActive(row, 0);
}
uiBlockSetEmboss(block, UI_EMBOSS);
+
+ WM_operator_properties_create(&remove_rna, "OBJECT_OT_shape_key_remove");
+ RNA_int_set(&remove_rna, "index", i);
+ uiItemFullO(sub, "object.shape_key_remove", "", ICON_X, remove_rna.data, uiLayoutGetOperatorContext(layout), UI_ITEM_O_RETURN_PROPS|UI_ITEM_R_NO_BG);
}
else if (itemptr->type == &RNA_VertexGroup) {
PointerRNA remove_rna;
Modified: branches/soc-2012-bratwurst/source/blender/editors/object/object_shapekey.c
===================================================================
--- branches/soc-2012-bratwurst/source/blender/editors/object/object_shapekey.c 2012-06-19 19:37:59 UTC (rev 48096)
+++ branches/soc-2012-bratwurst/source/blender/editors/object/object_shapekey.c 2012-06-19 21:01:20 UTC (rev 48097)
@@ -88,22 +88,26 @@
/*********************** remove shape key ***********************/
-static int ED_object_shape_key_remove(bContext *C, Object *ob)
+static int ED_object_shape_key_remove(bContext *C, Object *ob, int index)
{
Main *bmain = CTX_data_main(C);
KeyBlock *kb, *rkb;
Key *key;
+ int delete_index = index;
//IpoCurve *icu;
key = ob_get_key(ob);
if (key == NULL)
return 0;
+
+ if (delete_index < 0)
+ delete_index = ob->shapenr - 1;
- kb = BLI_findlink(&key->block, ob->shapenr - 1);
+ kb = BLI_findlink(&key->block, delete_index);
if (kb) {
for (rkb = key->block.first; rkb; rkb = rkb->next)
- if (rkb->relative == ob->shapenr - 1)
+ if (rkb->relative == delete_index)
rkb->relative = 0;
BLI_remlink(&key->block, kb);
@@ -131,7 +135,7 @@
if (kb->data) MEM_freeN(kb->data);
MEM_freeN(kb);
- if (ob->shapenr > 1) {
+ if (index < 0 && ob->shapenr > 1) {
ob->shapenr--;
}
}
@@ -295,11 +299,11 @@
RNA_def_boolean(ot->srna, "from_mix", 1, "From Mix", "Create the new shape key from the existing mix of keys");
}
-static int shape_key_remove_exec(bContext *C, wmOperator *UNUSED(op))
+static int shape_key_remove_exec(bContext *C, wmOperator *op)
{
Object *ob = ED_object_context(C);
- if (!ED_object_shape_key_remove(C, ob))
+ if (!ED_object_shape_key_remove(C, ob, RNA_int_get(op->ptr, "index")))
return OPERATOR_CANCELLED;
return OPERATOR_FINISHED;
@@ -318,6 +322,8 @@
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ RNA_def_int(ot->srna, "index", -1, INT_MIN, INT_MAX, "Index to remove", "< 0 means selection", INT_MIN, INT_MAX);
}
static int shape_key_clear_exec(bContext *C, wmOperator *UNUSED(op))
More information about the Bf-blender-cvs
mailing list