diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-29 08:40:50 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-29 08:42:36 +0300 |
commit | 90a06259eeb6101673160ca7bce591e0c272e303 (patch) | |
tree | 3515c5dd5b83e593982c84a009cc83500259acfa /source/blender/editors/object | |
parent | d2859237fa108f77814a6270d592b55a2b63c255 (diff) |
Fix T63503: Set parent menu shown twice
When the 'type' property is set,
execute the operation instead of showing the menu.
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r-- | source/blender/editors/object/object_relations.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index bf74c17c361..a62c0add521 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -994,15 +994,13 @@ static int parent_set_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event)) +static int parent_set_invoke_menu(bContext *C, wmOperatorType *ot) { Object *parent = ED_object_active_context(C); uiPopupMenu *pup = UI_popup_menu_begin(C, IFACE_("Set Parent To"), ICON_NONE); uiLayout *layout = UI_popup_menu_layout(pup); - wmOperatorType *ot = WM_operatortype_find("OBJECT_OT_parent_set", true); PointerRNA opptr; - #if 0 uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_OBJECT); #else @@ -1072,6 +1070,14 @@ static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent return OPERATOR_INTERFACE; } +static int parent_set_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) +{ + if (RNA_property_is_set(op->ptr, op->type->prop)) { + return parent_set_exec(C, op); + } + return parent_set_invoke_menu(C, op->type); +} + static bool parent_set_poll_property(const bContext *UNUSED(C), wmOperator *op, const PropertyRNA *prop) |