diff options
-rw-r--r-- | source/blender/editors/include/ED_mesh.h | 1 | ||||
-rw-r--r-- | source/blender/editors/include/ED_object.h | 1 | ||||
-rw-r--r-- | source/blender/editors/mesh/mesh_ops.c | 18 | ||||
-rw-r--r-- | source/blender/editors/object/object_ops.c | 6 | ||||
-rw-r--r-- | source/blender/editors/space_api/spacetypes.c | 6 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_windowmanager_types.h | 5 | ||||
-rw-r--r-- | source/blender/windowmanager/WM_api.h | 1 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_keymap.c | 12 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 22 |
9 files changed, 49 insertions, 23 deletions
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 */ diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h index 0292f01fd6d..7a024e35ff0 100644 --- a/source/blender/makesdna/DNA_windowmanager_types.h +++ b/source/blender/makesdna/DNA_windowmanager_types.h @@ -181,6 +181,7 @@ typedef struct wmOperatorTypeMacro { /* operator id */ char idname[MAX_ID_NAME]; /* rna pointer to access properties, like keymap */ + struct IDProperty *properties; /* operator properties, assigned to ptr->data and can be written to a file */ struct PointerRNA *ptr; } wmOperatorTypeMacro; @@ -240,14 +241,14 @@ typedef struct wmKeyMapItem { /* operator */ char idname[64]; /* used to retrieve operator type pointer */ - IDProperty *properties; /* operator properties */ + IDProperty *properties; /* operator properties, assigned to ptr->data and can be written to a file */ /* modal */ short propvalue; /* if used, the item is from modal map */ /* event */ short type; /* event code itself */ - short val; /* 0=any, 1=click, 2=release, or wheelvalue, or... */ + short val; /* KM_ANY, KM_PRESS, KM_NOTHING etc */ short shift, ctrl, alt, oskey; /* oskey is apple or windowskey, value denotes order of pressed */ short keymodifier; /* rawkey modifier */ diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 44e404524f5..958b388f574 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -181,6 +181,7 @@ int WM_operator_repeat (struct bContext *C, struct wmOperator *op); int WM_operator_name_call (struct bContext *C, const char *opstring, int context, struct PointerRNA *properties); int WM_operator_call_py(struct bContext *C, struct wmOperatorType *ot, int context, struct PointerRNA *properties, struct ReportList *reports); +void WM_operator_properties_alloc(struct PointerRNA **ptr, struct IDProperty **properties, const char *opstring); /* used for keymap and macro items */ void WM_operator_properties_create(struct PointerRNA *ptr, const char *opstring); void WM_operator_properties_free(struct PointerRNA *ptr); void WM_operator_properties_filesel(struct wmOperatorType *ot, int filter, short type); diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c index 3d3a6e46fb2..eedacb056b7 100644 --- a/source/blender/windowmanager/intern/wm_keymap.c +++ b/source/blender/windowmanager/intern/wm_keymap.c @@ -57,17 +57,7 @@ static void keymap_properties_set(wmKeyMapItem *kmi) { - if(!kmi->properties) { - IDPropertyTemplate val = {0}; - kmi->properties= IDP_New(IDP_GROUP, val, "wmKeyMapItemProperties"); - } - - if(!kmi->ptr) { - kmi->ptr= MEM_callocN(sizeof(PointerRNA), "wmKeyMapItemPtr"); - WM_operator_properties_create(kmi->ptr, kmi->idname); - } - - kmi->ptr->data= kmi->properties; + WM_operator_properties_alloc(&(kmi->ptr), &(kmi->properties), kmi->idname); } wmKeyConfig *WM_keyconfig_add(wmWindowManager *wm, char *idname) diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 7db6669ca74..99872f92f0f 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -270,8 +270,7 @@ wmOperatorTypeMacro *WM_operatortype_macro_define(wmOperatorType *ot, const char BLI_strncpy(otmacro->idname, idname, OP_MAX_TYPENAME); /* do this on first use, since operatordefinitions might have been not done yet */ -// otmacro->ptr= MEM_callocN(sizeof(PointerRNA), "optype macro ItemPtr"); -// WM_operator_properties_create(otmacro->ptr, idname); + WM_operator_properties_alloc(&(otmacro->ptr), &(otmacro->properties), idname); BLI_addtail(&ot->macro, otmacro); @@ -441,6 +440,25 @@ void WM_operator_properties_create(PointerRNA *ptr, const char *opstring) RNA_pointer_create(NULL, &RNA_OperatorProperties, NULL, ptr); } +/* similar to the function above except its uses ID properties + * used for keymaps and macros */ +void WM_operator_properties_alloc(PointerRNA **ptr, IDProperty **properties, const char *opstring) +{ + if(*properties==NULL) { + IDPropertyTemplate val = {0}; + *properties= IDP_New(IDP_GROUP, val, "wmOpItemProp"); + } + + if(*ptr==NULL) { + *ptr= MEM_callocN(sizeof(PointerRNA), "wmOpItemPtr"); + WM_operator_properties_create(*ptr, opstring); + } + + (*ptr)->data= *properties; + +} + + void WM_operator_properties_free(PointerRNA *ptr) { IDProperty *properties= ptr->data; |