Commit: 90a06259eeb6101673160ca7bce591e0c272e303
Author: Campbell Barton
Date:   Mon Apr 29 15:40:50 2019 +1000
Branches: master
https://developer.blender.org/rB90a06259eeb6101673160ca7bce591e0c272e303

Fix T63503: Set parent menu shown twice

When the 'type' property is set,
execute the operation instead of showing the menu.

===================================================================

M       source/blender/editors/object/object_relations.c

===================================================================

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)

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to