diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-03-01 03:03:51 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-03-01 03:03:51 +0300 |
commit | fbb8672da459a027a7dd3ccb798b2f5db1c73c59 (patch) | |
tree | 1478a36908c3afb614e75ef7fac605589b7c753b /source | |
parent | c4f562476806f06a67b807cd03a9419082ae03e3 (diff) |
replace operator options bl_undo and bl_register with bl_options
eg.
bl_options = {'REGISTER', 'UNDO', 'BLOCKING', 'GRAB_POINTER'}
This didnt exist when operators were originally wrapped.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/makesrna/intern/rna_wm.c | 32 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna_callback.c | 2 |
2 files changed, 19 insertions, 15 deletions
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index a76030d9960..7164e894b3c 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -252,6 +252,14 @@ EnumPropertyItem keymap_modifiers_items[] = { {2, "SECOND", 0, "Second", ""}, {0, NULL, 0, NULL, NULL}}; +EnumPropertyItem operator_flag_items[] = { + {OPTYPE_REGISTER, "REGISTER", 0, "Register", ""}, + {OPTYPE_UNDO, "UNDO", 0, "Undo", ""}, + {OPTYPE_BLOCKING, "BLOCKING", 0, "Finished", ""}, + {OPTYPE_MACRO, "MACRO", 0, "Macro", ""}, + {OPTYPE_GRAB_POINTER, "GRAB_POINTER", 0, "Grab Pointer", ""}, + {0, NULL, 0, NULL, NULL}}; + EnumPropertyItem operator_return_items[] = { {OPERATOR_RUNNING_MODAL, "RUNNING_MODAL", 0, "Running Modal", ""}, {OPERATOR_CANCELLED, "CANCELLED", 0, "Cancelled", ""}, @@ -924,13 +932,11 @@ static void rna_def_operator(BlenderRNA *brna) RNA_def_property_string_maxlength(prop, 1024); /* else it uses the pointer size! */ RNA_def_property_flag(prop, PROP_REGISTER); - prop= RNA_def_property(srna, "bl_register", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "type->flag", OPTYPE_REGISTER); - RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); - - prop= RNA_def_property(srna, "bl_undo", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "type->flag", OPTYPE_UNDO); - RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); + prop= RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "type->flag"); + RNA_def_property_enum_items(prop, operator_flag_items); + RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL|PROP_ENUM_FLAG); + RNA_def_property_ui_text(prop, "Options", "Options for this operator type"); RNA_api_operator(srna); @@ -981,13 +987,11 @@ static void rna_def_macro_operator(BlenderRNA *brna) RNA_def_property_string_maxlength(prop, 1024); /* else it uses the pointer size! */ RNA_def_property_flag(prop, PROP_REGISTER); - prop= RNA_def_property(srna, "bl_register", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "type->flag", OPTYPE_REGISTER); - RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); - - prop= RNA_def_property(srna, "bl_undo", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "type->flag", OPTYPE_UNDO); - RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); + prop= RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "type->flag"); + RNA_def_property_enum_items(prop, operator_flag_items); + RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL|PROP_ENUM_FLAG); + RNA_def_property_ui_text(prop, "Options", "Options for this operator type"); RNA_api_macro(srna); } diff --git a/source/blender/python/intern/bpy_rna_callback.c b/source/blender/python/intern/bpy_rna_callback.c index ab97d7c3446..c71429a76af 100644 --- a/source/blender/python/intern/bpy_rna_callback.c +++ b/source/blender/python/intern/bpy_rna_callback.c @@ -71,7 +71,7 @@ PyObject *pyrna_callback_add(BPy_StructRNA *self, PyObject *args) if(RNA_struct_is_a(self->ptr.type, &RNA_Region)) { - EnumPropertyItem region_draw_mode_items[] = { + static EnumPropertyItem region_draw_mode_items[] = { {REGION_DRAW_POST_VIEW, "POST_VIEW", 0, "Pose View", ""}, {REGION_DRAW_POST_PIXEL, "POST_PIXEL", 0, "Post Pixel", ""}, {REGION_DRAW_PRE_VIEW, "PRE_VIEW", 0, "Pre View", ""}, |