diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-01-16 01:40:33 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-01-16 01:40:33 +0300 |
commit | 5272991e8b91c527fbe3923d75ae2c5148dd7177 (patch) | |
tree | 84c871abe7d084a775ff7ffab5033c08d085ed32 /source/blender/editors/object | |
parent | 2b3a6b38b764717878de39a97feeee186e3694ad (diff) |
generic operator menu was searching for "type" and using the first enum property if it wasnt found.
this is too arbitrary and could break if roperty order is changed.
store the property in the operator type that is to be used for menu and enum search func's.
python function for searching operator enums on invoke. (just need dynamic python enums now)
wm.invoke_search_popup(self)
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r-- | source/blender/editors/object/object_add.c | 6 | ||||
-rw-r--r-- | source/blender/editors/object/object_constraint.c | 8 | ||||
-rw-r--r-- | source/blender/editors/object/object_hook.c | 1 | ||||
-rw-r--r-- | source/blender/editors/object/object_modifier.c | 1 | ||||
-rw-r--r-- | source/blender/editors/object/object_relations.c | 17 | ||||
-rw-r--r-- | source/blender/editors/object/object_select.c | 6 | ||||
-rw-r--r-- | source/blender/editors/object/object_transform.c | 3 | ||||
-rw-r--r-- | source/blender/editors/object/object_vgroup.c | 1 |
8 files changed, 23 insertions, 20 deletions
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 9740a1cba01..9e9619a30ea 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -384,7 +384,7 @@ void OBJECT_OT_effector_add(wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - RNA_def_enum(ot->srna, "type", field_type_items, 0, "Type", ""); + ot->prop= RNA_def_enum(ot->srna, "type", field_type_items, 0, "Type", ""); ED_object_add_generic_props(ot, TRUE); } @@ -806,7 +806,7 @@ void OBJECT_OT_lamp_add(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* properties */ - RNA_def_enum(ot->srna, "type", lamp_type_items, 0, "Type", ""); + ot->prop= RNA_def_enum(ot->srna, "type", lamp_type_items, 0, "Type", ""); ED_object_add_generic_props(ot, FALSE); } @@ -1360,7 +1360,7 @@ void OBJECT_OT_convert(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* properties */ - RNA_def_enum(ot->srna, "target", convert_target_items, OB_MESH, "Target", "Type of object to convert to."); + ot->prop= RNA_def_enum(ot->srna, "target", convert_target_items, OB_MESH, "Target", "Type of object to convert to."); RNA_def_boolean(ot->srna, "keep_original", 0, "Keep Original", "Keep original objects instead of replacing them."); } diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index 19ba5f7b32b..497b5e82e26 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -1218,7 +1218,7 @@ void OBJECT_OT_constraint_add(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* properties */ - RNA_def_enum(ot->srna, "type", constraint_type_items, 0, "Type", ""); + ot->prop= RNA_def_enum(ot->srna, "type", constraint_type_items, 0, "Type", ""); } void OBJECT_OT_constraint_add_with_targets(wmOperatorType *ot) @@ -1237,7 +1237,7 @@ void OBJECT_OT_constraint_add_with_targets(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* properties */ - RNA_def_enum(ot->srna, "type", constraint_type_items, 0, "Type", ""); + ot->prop= RNA_def_enum(ot->srna, "type", constraint_type_items, 0, "Type", ""); } void POSE_OT_constraint_add(wmOperatorType *ot) @@ -1256,7 +1256,7 @@ void POSE_OT_constraint_add(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* properties */ - RNA_def_enum(ot->srna, "type", constraint_type_items, 0, "Type", ""); + ot->prop= RNA_def_enum(ot->srna, "type", constraint_type_items, 0, "Type", ""); } void POSE_OT_constraint_add_with_targets(wmOperatorType *ot) @@ -1275,7 +1275,7 @@ void POSE_OT_constraint_add_with_targets(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* properties */ - RNA_def_enum(ot->srna, "type", constraint_type_items, 0, "Type", ""); + ot->prop= RNA_def_enum(ot->srna, "type", constraint_type_items, 0, "Type", ""); } /************************ IK Constraint operators *********************/ diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c index 313ffe79c66..c9730e3490b 100644 --- a/source/blender/editors/object/object_hook.c +++ b/source/blender/editors/object/object_hook.c @@ -612,6 +612,7 @@ void OBJECT_OT_hook_remove(wmOperatorType *ot) /* properties */ prop= RNA_def_enum(ot->srna, "modifier", hook_mod_items, 0, "Modifier", "Modifier number to remove."); RNA_def_enum_funcs(prop, hook_mod_itemf); + ot->prop= prop; } static int object_hook_reset_exec(bContext *C, wmOperator *op) diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index a44ad47b94f..eec8104f29b 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -558,6 +558,7 @@ void OBJECT_OT_modifier_add(wmOperatorType *ot) /* properties */ prop= RNA_def_enum(ot->srna, "type", modifier_type_items, eModifierType_Subsurf, "Type", ""); RNA_def_enum_funcs(prop, modifier_add_itemf); + ot->prop= prop; } /************************ remove modifier operator *********************/ diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 5cf11771004..fbee03e3a30 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -286,7 +286,6 @@ static int make_proxy_invoke (bContext *C, wmOperator *op, wmEvent *evt) /* create operator menu item with relevant properties filled in */ props_ptr= uiItemFullO(layout, op->type->name, 0, op->idname, NULL, WM_OP_EXEC_REGION_WIN, UI_ITEM_O_RETURN_PROPS); - RNA_string_set(&props_ptr, "object", ob->id.name+2); /* present the menu and be done... */ uiPupMenuEnd(C, pup); @@ -337,8 +336,7 @@ static int make_proxy_exec (bContext *C, wmOperator *op) /* depsgraph flushes are needed for the new data */ DAG_scene_sort(scene); DAG_id_flush_update(&newob->id, OB_RECALC); - - WM_event_add_notifier(C, NC_OBJECT, NULL); + WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, newob); } else { BKE_report(op->reports, RPT_ERROR, "No object to make proxy for"); @@ -358,7 +356,7 @@ static EnumPropertyItem *proxy_group_object_itemf(bContext *C, PointerRNA *ptr, GroupObject *go; if(!ob || !ob->dup_group) - return &DummyRNA_NULL_items; + return DummyRNA_NULL_items; memset(&item_tmp, 0, sizeof(item_tmp)); @@ -396,6 +394,7 @@ void OBJECT_OT_proxy_make (wmOperatorType *ot) RNA_def_string(ot->srna, "object", "", 19, "Proxy Object", "Name of lib-linked/grouped object to make a proxy for."); prop= RNA_def_enum(ot->srna, "type", DummyRNA_NULL_items, 0, "Type", "Group object"); /* XXX, relies on hard coded ID at the moment */ RNA_def_enum_funcs(prop, proxy_group_object_itemf); + ot->prop= prop; } /********************** Clear Parent Operator ******************* */ @@ -452,7 +451,7 @@ void OBJECT_OT_parent_clear(wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - RNA_def_enum(ot->srna, "type", prop_clear_parent_types, 0, "Type", ""); + ot->prop= RNA_def_enum(ot->srna, "type", prop_clear_parent_types, 0, "Type", ""); } /* ******************** Make Parent Operator *********************** */ @@ -893,7 +892,7 @@ void OBJECT_OT_track_clear(wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - RNA_def_enum(ot->srna, "type", prop_clear_track_types, 0, "Type", ""); + ot->prop= RNA_def_enum(ot->srna, "type", prop_clear_track_types, 0, "Type", ""); } /************************** Make Track Operator *****************************/ @@ -986,7 +985,7 @@ void OBJECT_OT_track_set(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* properties */ - RNA_def_enum(ot->srna, "type", prop_make_track_types, 0, "Type", ""); + ot->prop= RNA_def_enum(ot->srna, "type", prop_make_track_types, 0, "Type", ""); } /************************** Move to Layer Operator *****************************/ @@ -1768,7 +1767,7 @@ void OBJECT_OT_make_local(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* properties */ - RNA_def_enum(ot->srna, "type", type_items, 0, "Type", ""); + ot->prop= RNA_def_enum(ot->srna, "type", type_items, 0, "Type", ""); } static int make_single_user_exec(bContext *C, wmOperator *op) @@ -1819,7 +1818,7 @@ void OBJECT_OT_make_single_user(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* properties */ - RNA_def_enum(ot->srna, "type", type_items, 0, "Type", ""); + ot->prop= RNA_def_enum(ot->srna, "type", type_items, 0, "Type", ""); RNA_def_boolean(ot->srna, "object", 0, "Object", "Make single user objects"); RNA_def_boolean(ot->srna, "obdata", 0, "Object Data", "Make single user object data"); diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index b3a160dfff4..c671a81bc71 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -157,7 +157,7 @@ void OBJECT_OT_select_by_type(wmOperatorType *ot) /* properties */ RNA_def_boolean(ot->srna, "extend", FALSE, "Extend", "Extend selection instead of deselecting everything first."); - RNA_def_enum(ot->srna, "type", object_type_items, 1, "Type", ""); + ot->prop= RNA_def_enum(ot->srna, "type", object_type_items, 1, "Type", ""); } /*********************** Selection by Links *********************/ @@ -318,7 +318,7 @@ void OBJECT_OT_select_linked(wmOperatorType *ot) /* properties */ RNA_def_boolean(ot->srna, "extend", FALSE, "Extend", "Extend selection instead of deselecting everything first."); - RNA_def_enum(ot->srna, "type", prop_select_linked_types, 0, "Type", ""); + ot->prop= RNA_def_enum(ot->srna, "type", prop_select_linked_types, 0, "Type", ""); } /*********************** Selected Grouped ********************/ @@ -619,7 +619,7 @@ void OBJECT_OT_select_grouped(wmOperatorType *ot) /* properties */ RNA_def_boolean(ot->srna, "extend", FALSE, "Extend", "Extend selection instead of deselecting everything first."); - RNA_def_enum(ot->srna, "type", prop_select_grouped_types, 0, "Type", ""); + ot->prop= RNA_def_enum(ot->srna, "type", prop_select_grouped_types, 0, "Type", ""); } /************************* Select by Layer **********************/ diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index 43382562a8a..9e4cc012171 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -1040,6 +1040,7 @@ void OBJECT_OT_origin_set(wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - RNA_def_enum(ot->srna, "type", prop_set_center_types, 0, "Type", ""); + ot->prop= RNA_def_enum(ot->srna, "type", prop_set_center_types, 0, "Type", ""); + } diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 84b70e0a690..4e31dffd3da 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -1882,5 +1882,6 @@ void OBJECT_OT_vertex_group_set_active(wmOperatorType *ot) /* properties */ prop= RNA_def_enum(ot->srna, "group", vgroup_items, 0, "Group", "Vertex group to set as active."); RNA_def_enum_funcs(prop, vgroup_itemf); + ot->prop= prop; } |