Fix T63503: Set parent menu shown twice

When the 'type' property is set,
execute the operation instead of showing the menu.
This commit is contained in:
Campbell Barton
2019-04-29 15:40:50 +10:00
parent d2859237fa
commit 90a06259ee

View File

@@ -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)