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
path: root/source
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2009-10-27 14:10:30 +0300
committerJoshua Leung <aligorith@gmail.com>2009-10-27 14:10:30 +0300
commit90957ed0dddbfbfa1eb09cc55fbc1b6df4f394c3 (patch)
treea80ffb03797ef50b850c05955a22377783369a6c /source
parent81c17a9fa35a16ec55d6b5869266a3fa6ca5d59e (diff)
A bunch of fixes for macro-type operators - Armatures + Objects
* Extrude and Duplicate for Armatures now use proper macros instead of manually calling transform themselves. This means that repeating these operators now works properly. ** NOTE: there's a bug with macros now which prevents the 'forked' extrude operator working correctly. Bug report filed for this. * Included the proper operators for extrude and duplicate in the toolbar + menus. The operators used there did not activate transform, which meant that users often could not tell that the operation had occurred at all.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/armature/armature_ops.c70
-rw-r--r--source/blender/editors/armature/editarmature.c29
-rw-r--r--source/blender/editors/include/ED_armature.h1
-rw-r--r--source/blender/editors/space_api/spacetypes.c1
4 files changed, 21 insertions, 80 deletions
diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c
index 3a7ad8fc5ec..71b54871be9 100644
--- a/source/blender/editors/armature/armature_ops.c
+++ b/source/blender/editors/armature/armature_ops.c
@@ -59,50 +59,6 @@
#include "armature_intern.h"
-/* ************************** quick tests **********************************/
-
-/* XXX This is a quick test operator to print names of all EditBones in context
- * that should be removed once tool coding starts...
- */
-
-static int armature_test_exec (bContext *C, wmOperator *op)
-{
- printf("EditMode Armature Test: \n");
-
- printf("\tSelected Bones \n");
- CTX_DATA_BEGIN(C, EditBone*, ebone, selected_bones)
- {
- printf("\t\tEditBone '%s' \n", ebone->name);
- }
- CTX_DATA_END;
-
- printf("\tEditable Bones \n");
- CTX_DATA_BEGIN(C, EditBone*, ebone, selected_editable_bones)
- {
- printf("\t\tEditBone '%s' \n", ebone->name);
- }
- CTX_DATA_END;
-
- printf("\tActive Bone \n");
- {
- EditBone *ebone= CTX_data_active_bone(C);
- if (ebone) printf("\t\tEditBone '%s' \n", ebone->name);
- else printf("\t\t<None> \n");
- }
-
- return OPERATOR_FINISHED;
-}
-
-void ARMATURE_OT_test(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name= "Test Context";
- ot->idname= "ARMATURE_OT_test";
-
- /* api callbacks */
- ot->exec= armature_test_exec;
-}
-
/* ************************** registration **********************************/
/* Both operators ARMATURE_OT_xxx and POSE_OT_xxx here */
@@ -200,9 +156,23 @@ void ED_operatortypes_armature(void)
WM_operatortype_append(POSE_OT_push);
WM_operatortype_append(POSE_OT_relax);
WM_operatortype_append(POSE_OT_breakdown);
+}
+
+void ED_operatormacros_armature(void)
+{
+ wmOperatorType *ot;
+ wmOperatorTypeMacro *otmacro;
- /* TESTS */
- WM_operatortype_append(ARMATURE_OT_test); // XXX temp test for context iterators... to be removed
+ ot= WM_operatortype_append_macro("ARMATURE_OT_duplicate_move", "Add Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
+ WM_operatortype_macro_define(ot, "ARMATURE_OT_duplicate");
+ otmacro= WM_operatortype_macro_define(ot, "TFM_OT_translate");
+ RNA_enum_set(otmacro->ptr, "proportional", 0);
+
+ ot= WM_operatortype_append_macro("ARMATURE_OT_extrude_move", "Extrude", OPTYPE_UNDO|OPTYPE_REGISTER);
+ otmacro=WM_operatortype_macro_define(ot, "ARMATURE_OT_extrude");
+ RNA_enum_set(otmacro->ptr, "forked", 0);
+ otmacro= WM_operatortype_macro_define(ot, "TFM_OT_translate");
+ RNA_enum_set(otmacro->ptr, "proportional", 0);
}
void ED_keymap_armature(wmKeyConfig *keyconf)
@@ -247,8 +217,6 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "ARMATURE_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "ARMATURE_OT_select_inverse", IKEY, KM_PRESS, KM_CTRL, 0);
- WM_keymap_add_item(keymap, "ARMATURE_OT_test", TKEY, KM_PRESS, 0, 0); // XXX temp test for context iterators... to be removed
-
kmi= WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, 0, 0);
RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_PARENT);
kmi= WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
@@ -266,9 +234,9 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "ARMATURE_OT_delete", XKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "ARMATURE_OT_delete", DELKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "ARMATURE_OT_duplicate", DKEY, KM_PRESS, KM_SHIFT, 0);
- WM_keymap_add_item(keymap, "ARMATURE_OT_extrude", EKEY, KM_PRESS, 0, 0);
- kmi= WM_keymap_add_item(keymap, "ARMATURE_OT_extrude", EKEY, KM_PRESS, KM_SHIFT, 0);
- RNA_boolean_set(kmi->ptr, "forked", 1);
+ WM_keymap_add_item(keymap, "ARMATURE_OT_extrude_move", EKEY, KM_PRESS, 0, 0);
+ kmi= WM_keymap_add_item(keymap, "ARMATURE_OT_extrude_move", EKEY, KM_PRESS, KM_SHIFT, 0);
+ RNA_boolean_set(kmi->ptr, "forked", 1); // XXX this doesn't work ok for macros it seems...
WM_keymap_add_item(keymap, "ARMATURE_OT_click_extrude", LEFTMOUSE, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "ARMATURE_OT_fill", FKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "ARMATURE_OT_merge", MKEY, KM_PRESS, KM_ALT, 0);
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index f379ff6c395..266e4fbdbb4 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -2713,17 +2713,6 @@ static int armature_duplicate_selected_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int armature_duplicate_selected_invoke(bContext *C, wmOperator *op, wmEvent *event)
-{
- int retv= armature_duplicate_selected_exec(C, op);
-
- if (retv == OPERATOR_FINISHED) {
- RNA_int_set(op->ptr, "mode", TFM_TRANSLATION);
- WM_operator_name_call(C, "TFM_OT_transform", WM_OP_INVOKE_REGION_WIN, op->ptr);
- }
-
- return retv;
-}
void ARMATURE_OT_duplicate(wmOperatorType *ot)
{
@@ -2732,15 +2721,11 @@ void ARMATURE_OT_duplicate(wmOperatorType *ot)
ot->idname= "ARMATURE_OT_duplicate";
/* api callbacks */
- ot->invoke = armature_duplicate_selected_invoke;
ot->exec = armature_duplicate_selected_exec;
ot->poll = ED_operator_editarmature;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-
- /* to give to transform */
- RNA_def_int(ot->srna, "mode", TFM_TRANSLATION, 0, INT_MAX, "Mode", "", 0, INT_MAX);
}
@@ -3385,17 +3370,6 @@ static int armature_extrude_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int armature_extrude_invoke(bContext *C, wmOperator *op, wmEvent *event)
-{
- if (OPERATOR_CANCELLED == armature_extrude_exec(C, op))
- return OPERATOR_CANCELLED;
-
- RNA_int_set(op->ptr, "mode", TFM_TRANSLATION);
- WM_operator_name_call(C, "TFM_OT_transform", WM_OP_INVOKE_REGION_WIN, op->ptr);
-
- return OPERATOR_FINISHED;
-}
-
void ARMATURE_OT_extrude(wmOperatorType *ot)
{
/* identifiers */
@@ -3403,7 +3377,6 @@ void ARMATURE_OT_extrude(wmOperatorType *ot)
ot->idname= "ARMATURE_OT_extrude";
/* api callbacks */
- ot->invoke= armature_extrude_invoke;
ot->exec= armature_extrude_exec;
ot->poll= ED_operator_editarmature;
@@ -3412,8 +3385,6 @@ void ARMATURE_OT_extrude(wmOperatorType *ot)
/* props */
RNA_def_boolean(ot->srna, "forked", 0, "Forked", "");
- /* to give to transform */
- RNA_def_int(ot->srna, "mode", TFM_TRANSLATION, 0, INT_MAX, "Mode", "", 0, INT_MAX);
}
/* ********************** Bone Add ********************/
diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h
index 6479030bcd1..f360fd7a657 100644
--- a/source/blender/editors/include/ED_armature.h
+++ b/source/blender/editors/include/ED_armature.h
@@ -92,6 +92,7 @@ typedef struct EditBone
/* armature_ops.c */
void ED_operatortypes_armature(void);
+void ED_operatormacros_armature(void);
void ED_keymap_armature(struct wmKeyConfig *keyconf);
/* editarmature.c */
diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c
index f3db414099f..da92e450ed5 100644
--- a/source/blender/editors/space_api/spacetypes.c
+++ b/source/blender/editors/space_api/spacetypes.c
@@ -109,6 +109,7 @@ void ED_spacetypes_init(void)
/* Macros's must go last since they reference other operators
* maybe we'll need to have them go after python operators too? */
+ ED_operatormacros_armature();
ED_operatormacros_mesh();
ED_operatormacros_object();
}