From e36003e8e73e42e7b559d4cec19b9004d14fefa6 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 12 Oct 2009 12:54:08 +0000 Subject: macro's can set options for the operators they execute changed extrude, rip and duplicate to disable proportional editing however this gives a different problem now. Commented in transform.c // XXX If modal, save settings back in scene this changes disables the option whenever the macro used used. --- source/blender/editors/include/ED_mesh.h | 1 + source/blender/editors/include/ED_object.h | 1 + source/blender/editors/mesh/mesh_ops.c | 18 +++++++++++------- source/blender/editors/object/object_ops.c | 6 +++++- source/blender/editors/space_api/spacetypes.c | 6 ++++++ 5 files changed, 24 insertions(+), 8 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index cf0e6eb01c3..3bceeb9340e 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -85,6 +85,7 @@ int join_mesh_exec(struct bContext *C, struct wmOperator *op); /* mesh_ops.c */ void ED_operatortypes_mesh(void); +void ED_operatormacros_mesh(void); void ED_keymap_mesh(struct wmKeyConfig *keyconf); diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index 7ea882b765b..e19fc806404 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -44,6 +44,7 @@ struct ModifierData; /* object_edit.c */ void ED_operatortypes_object(void); +void ED_operatormacros_object(void); void ED_keymap_object(struct wmKeyConfig *keyconf); /* send your own notifier for select! */ diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index 0865455b3b9..9e74c5717c6 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -235,8 +235,6 @@ static void MESH_OT_specials(wmOperatorType *ot) void ED_operatortypes_mesh(void) { - wmOperatorType *ot; - WM_operatortype_append(MESH_OT_select_all_toggle); WM_operatortype_append(MESH_OT_select_more); WM_operatortype_append(MESH_OT_select_less); @@ -323,8 +321,12 @@ void ED_operatortypes_mesh(void) WM_operatortype_append(MESH_OT_edgering_select); WM_operatortype_append(MESH_OT_loopcut); +} - /* macros */ +void ED_operatormacros_mesh(void) +{ + wmOperatorType *ot; + wmOperatorTypeMacro *otmacro; /*combining operators with invoke and exec portions doesn't work yet. @@ -335,16 +337,18 @@ void ED_operatortypes_mesh(void) ot= WM_operatortype_append_macro("MESH_OT_duplicate_move", "Add Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER); WM_operatortype_macro_define(ot, "MESH_OT_duplicate"); - WM_operatortype_macro_define(ot, "TFM_OT_translate"); + otmacro= WM_operatortype_macro_define(ot, "TFM_OT_translate"); + RNA_enum_set(otmacro->ptr, "proportional", 0); ot= WM_operatortype_append_macro("MESH_OT_rip_move", "Rip", OPTYPE_UNDO|OPTYPE_REGISTER); WM_operatortype_macro_define(ot, "MESH_OT_rip"); - WM_operatortype_macro_define(ot, "TFM_OT_translate"); + otmacro= WM_operatortype_macro_define(ot, "TFM_OT_translate"); + RNA_enum_set(otmacro->ptr, "proportional", 0); ot= WM_operatortype_append_macro("MESH_OT_extrude_move", "Extrude", OPTYPE_UNDO|OPTYPE_REGISTER); WM_operatortype_macro_define(ot, "MESH_OT_extrude"); - WM_operatortype_macro_define(ot, "TFM_OT_translate"); - + otmacro= WM_operatortype_macro_define(ot, "TFM_OT_translate"); + RNA_enum_set(otmacro->ptr, "proportional", 0); } /* note mesh keymap also for other space? */ diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index 2b010f5b6bc..9869d15a69c 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -178,8 +178,12 @@ void ED_operatortypes_object(void) WM_operatortype_append(OBJECT_OT_group_add); WM_operatortype_append(OBJECT_OT_group_remove); +} + +void ED_operatormacros_object(void) +{ + wmOperatorType *ot; - /* macros */ ot= WM_operatortype_append_macro("OBJECT_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER); if(ot) { WM_operatortype_macro_define(ot, "OBJECT_OT_duplicate"); diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c index 397da005543..60b9c5a6da7 100644 --- a/source/blender/editors/space_api/spacetypes.c +++ b/source/blender/editors/space_api/spacetypes.c @@ -105,6 +105,12 @@ void ED_spacetypes_init(void) spacetypes = BKE_spacetypes_list(); for(type=spacetypes->first; type; type=type->next) type->operatortypes(); + + + /* Macros's must go last since they reference other operators + * maybe we'll need to have them go after python operators too? */ + ED_operatormacros_mesh(); + ED_operatormacros_object(); } /* called in wm.c */ -- cgit v1.2.3