Commit: 2f0bdcb306999ff610ecc6073af27b2311924153
Author: Campbell Barton
Date:   Tue Oct 28 17:51:06 2014 +0100
Branches: master
https://developer.blender.org/rB2f0bdcb306999ff610ecc6073af27b2311924153

Fix T41041: 'Delete keyframe' removes markers too

Operators that trigger UI events (but nothing else)
were using 'CANCELLED' making it impossible to tell if an invoke
function failed, or opened a menu.

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

M       source/blender/editors/animation/anim_markers.c
M       source/blender/editors/animation/keyframing.c
M       source/blender/editors/animation/keyingsets.c
M       source/blender/editors/armature/armature_relations.c
M       source/blender/editors/armature/pose_group.c
M       source/blender/editors/armature/pose_lib.c
M       source/blender/editors/curve/editcurve.c
M       source/blender/editors/include/UI_interface.h
M       source/blender/editors/interface/interface_regions.c
M       source/blender/editors/object/object_constraint.c
M       source/blender/editors/object/object_relations.c
M       source/blender/editors/screen/screen_ops.c
M       source/blender/editors/sculpt_paint/sculpt.c
M       source/blender/editors/space_buttons/buttons_ops.c
M       source/blender/editors/space_image/image_ops.c
M       source/blender/editors/space_info/info_ops.c
M       source/blender/editors/space_nla/nla_edit.c
M       source/blender/editors/space_node/node_group.c
M       source/blender/editors/space_outliner/outliner_edit.c
M       source/blender/editors/space_text/text_ops.c
M       source/blender/editors/transform/transform_ops.c
M       source/blender/makesdna/DNA_windowmanager_types.h
M       source/blender/makesrna/intern/rna_wm.c
M       source/blender/windowmanager/intern/wm_operators.c
M       source/blenderplayer/bad_level_call_stubs/stubs.c

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

diff --git a/source/blender/editors/animation/anim_markers.c 
b/source/blender/editors/animation/anim_markers.c
index 7cd47fa..58db93b 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -503,8 +503,9 @@ static int ed_markers_opwrap_invoke_custom(bContext *C, 
wmOperator *op, const wm
        /* return status modifications - for now, make this spacetype dependent 
as above */
        if (sa->spacetype != SPACE_TIME) {
                /* unless successful, must add "pass-through" to let normal 
operator's have a chance at tackling this event */
-               if (retval != OPERATOR_FINISHED)
+               if ((retval & (OPERATOR_FINISHED | OPERATOR_INTERFACE)) == 0) {
                        retval |= OPERATOR_PASS_THROUGH;
+               }
        }
        
        return retval;
diff --git a/source/blender/editors/animation/keyframing.c 
b/source/blender/editors/animation/keyframing.c
index 4c2d901..c2fabfa 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -1407,7 +1407,7 @@ static int insert_key_menu_invoke(bContext *C, wmOperator 
*op, const wmEvent *UN
                uiItemsEnumO(layout, "ANIM_OT_keyframe_insert_menu", "type");
                uiPupMenuEnd(C, pup);
                
-               return OPERATOR_CANCELLED;
+               return OPERATOR_INTERFACE;
        }
        else {
                /* just call the exec() on the active keyingset */
diff --git a/source/blender/editors/animation/keyingsets.c 
b/source/blender/editors/animation/keyingsets.c
index ad2db0d..8386ead 100644
--- a/source/blender/editors/animation/keyingsets.c
+++ b/source/blender/editors/animation/keyingsets.c
@@ -477,7 +477,7 @@ static int keyingset_active_menu_invoke(bContext *C, 
wmOperator *op, const wmEve
        uiItemsEnumO(layout, "ANIM_OT_keying_set_active_set", "type");
        uiPupMenuEnd(C, pup);
        
-       return OPERATOR_CANCELLED;
+       return OPERATOR_INTERFACE;
 }
 
 static int keyingset_active_menu_exec(bContext *C, wmOperator *op)
diff --git a/source/blender/editors/armature/armature_relations.c 
b/source/blender/editors/armature/armature_relations.c
index 75fa4a5..2218768 100644
--- a/source/blender/editors/armature/armature_relations.c
+++ b/source/blender/editors/armature/armature_relations.c
@@ -693,7 +693,7 @@ static int armature_parent_set_invoke(bContext *C, 
wmOperator *UNUSED(op), const
                
        uiPupMenuEnd(C, pup);
        
-       return OPERATOR_CANCELLED;
+       return OPERATOR_INTERFACE;
 }
 
 void ARMATURE_OT_parent_set(wmOperatorType *ot)
diff --git a/source/blender/editors/armature/pose_group.c 
b/source/blender/editors/armature/pose_group.c
index 50d9d30..4667e09 100644
--- a/source/blender/editors/armature/pose_group.c
+++ b/source/blender/editors/armature/pose_group.c
@@ -162,7 +162,7 @@ static int pose_groups_menu_invoke(bContext *C, wmOperator 
*op, const wmEvent *U
                /* finish building the menu, and process it (should result in 
calling self again) */
                uiPupMenuEnd(C, pup);
                
-               return OPERATOR_CANCELLED;
+               return OPERATOR_INTERFACE;
        }
        else {
                /* just use the active group index, and call the exec callback 
for the calling operator */
diff --git a/source/blender/editors/armature/pose_lib.c 
b/source/blender/editors/armature/pose_lib.c
index 0609fcc..8bb1c58 100644
--- a/source/blender/editors/armature/pose_lib.c
+++ b/source/blender/editors/armature/pose_lib.c
@@ -423,7 +423,7 @@ static int poselib_add_menu_invoke(bContext *C, wmOperator 
*op, const wmEvent *U
        uiPupMenuEnd(C, pup);
        
        /* this operator is only for a menu, not used further */
-       return OPERATOR_CANCELLED;
+       return OPERATOR_INTERFACE;
 }
 
 
diff --git a/source/blender/editors/curve/editcurve.c 
b/source/blender/editors/curve/editcurve.c
index a52b2a6..eed059b 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -5386,7 +5386,7 @@ static int toggle_cyclic_invoke(bContext *C, wmOperator 
*op, const wmEvent *UNUS
                                        layout = uiPupMenuLayout(pup);
                                        uiItemsEnumO(layout, op->type->idname, 
"direction");
                                        uiPupMenuEnd(C, pup);
-                                       return OPERATOR_CANCELLED;
+                                       return OPERATOR_INTERFACE;
                                }
                        }
                }
diff --git a/source/blender/editors/include/UI_interface.h 
b/source/blender/editors/include/UI_interface.h
index bc794bf..3704315 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -359,15 +359,15 @@ void uiPupMenuEnd(struct bContext *C, struct uiPopupMenu 
*head);
 struct uiLayout *uiPupMenuLayout(uiPopupMenu *head);
 
 void uiPupMenuReports(struct bContext *C, struct ReportList *reports) 
ATTR_NONNULL();
-bool uiPupMenuInvoke(struct bContext *C, const char *idname, struct ReportList 
*reports) ATTR_NONNULL(1, 2);
+int uiPupMenuInvoke(struct bContext *C, const char *idname, struct ReportList 
*reports) ATTR_NONNULL(1, 2);
 
 /* Pie menus */
 typedef struct uiPieMenu uiPieMenu;
 
-void uiPieMenuInvoke(struct bContext *C, const char *idname, const struct 
wmEvent *event);
-void uiPieOperatorEnumInvoke(struct bContext *C, const char *title, const char 
*opname,
+int uiPieMenuInvoke(struct bContext *C, const char *idname, const struct 
wmEvent *event);
+int uiPieOperatorEnumInvoke(struct bContext *C, const char *title, const char 
*opname,
                              const char *propname, const struct wmEvent 
*event);
-void uiPieEnumInvoke(struct bContext *C, const char *title, const char *path, 
const struct wmEvent *event);
+int uiPieEnumInvoke(struct bContext *C, const char *title, const char *path, 
const struct wmEvent *event);
 
 struct uiPieMenu *uiPieMenuBegin(struct bContext *C, const char *title, int 
icon, const struct wmEvent *event) ATTR_NONNULL();
 void uiPieMenuEnd(struct bContext *C, uiPieMenu *pie);
diff --git a/source/blender/editors/interface/interface_regions.c 
b/source/blender/editors/interface/interface_regions.c
index 1574cea..db89389 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -2794,7 +2794,7 @@ uiLayout *uiPieMenuLayout(uiPieMenu *pie)
        return pie->layout;
 }
 
-void uiPieMenuInvoke(struct bContext *C, const char *idname, const wmEvent 
*event)
+int uiPieMenuInvoke(struct bContext *C, const char *idname, const wmEvent 
*event)
 {
        uiPieMenu *pie;
        uiLayout *layout;
@@ -2803,11 +2803,11 @@ void uiPieMenuInvoke(struct bContext *C, const char 
*idname, const wmEvent *even
 
        if (mt == NULL) {
                printf("%s: named menu \"%s\" not found\n", __func__, idname);
-               return;
+               return OPERATOR_CANCELLED;
        }
 
        if (mt->poll && mt->poll(C, mt) == 0)
-               return;
+               return OPERATOR_CANCELLED;
 
        pie = uiPieMenuBegin(C, IFACE_(mt->label), ICON_NONE, event);
        layout = uiPieMenuLayout(pie);
@@ -2822,10 +2822,12 @@ void uiPieMenuInvoke(struct bContext *C, const char 
*idname, const wmEvent *even
        mt->draw(C, &menu);
 
        uiPieMenuEnd(C, pie);
+
+       return OPERATOR_INTERFACE;
 }
 
-void uiPieOperatorEnumInvoke(struct bContext *C, const char *title, const char 
*opname,
-                             const char *propname, const wmEvent *event)
+int uiPieOperatorEnumInvoke(struct bContext *C, const char *title, const char 
*opname,
+                            const char *propname, const wmEvent *event)
 {
        uiPieMenu *pie;
        uiLayout *layout;
@@ -2837,10 +2839,12 @@ void uiPieOperatorEnumInvoke(struct bContext *C, const 
char *title, const char *
        uiItemsEnumO(layout, opname, propname);
 
        uiPieMenuEnd(C, pie);
+
+       return OPERATOR_INTERFACE;
 }
 
-void uiPieEnumInvoke(struct bContext *C, const char *title, const char *path,
-                     const wmEvent *event)
+int uiPieEnumInvoke(struct bContext *C, const char *title, const char *path,
+                    const wmEvent *event)
 {
        PointerRNA ctx_ptr;
        PointerRNA r_ptr;
@@ -2851,13 +2855,13 @@ void uiPieEnumInvoke(struct bContext *C, const char 
*title, const char *path,
        RNA_pointer_create(NULL, &RNA_Context, C, &ctx_ptr);
 
        if (!RNA_path_resolve(&ctx_ptr, path, &r_ptr, &r_prop)) {
-               return;
+               return OPERATOR_CANCELLED;
        }
 
        /* invalid property, only accept enums */
        if (RNA_property_type(r_prop) != PROP_ENUM) {
                BLI_assert(0);
-               return;
+               return OPERATOR_CANCELLED;
        }
 
        pie = uiPieMenuBegin(C, IFACE_(title), ICON_NONE, event);
@@ -2868,6 +2872,8 @@ void uiPieEnumInvoke(struct bContext *C, const char 
*title, const char *path,
        uiItemFullR(layout, &r_ptr, r_prop, RNA_NO_INDEX, 0, UI_ITEM_R_EXPAND, 
NULL, 0);
 
        uiPieMenuEnd(C, pie);
+
+       return OPERATOR_INTERFACE;
 }
 
 
@@ -2922,7 +2928,7 @@ void uiPupMenuReports(bContext *C, ReportList *reports)
        }
 }
 
-bool uiPupMenuInvoke(bContext *C, const char *idname, ReportList *reports)
+int uiPupMenuInvoke(bContext *C, const char *idname, ReportList *reports)
 {
        uiPopupMenu *pup;
        uiLayout *layout;
@@ -2931,11 +2937,11 @@ bool uiPupMenuInvoke(bContext *C, const char *idname, 
ReportList *reports)
 
        if (mt == NULL) {
                BKE_reportf(reports, RPT_ERROR, "Menu \"%s\" not found", 
idname);
-               return false;
+               return OPERATOR_CANCELLED;
        }
 
        if (mt->poll && mt->poll(C, mt) == 0)
-               return false;
+               return OPERATOR_CANCELLED;
 
        pup = uiPupMenuBegin(C, IFACE_(mt->label), ICON_NONE);
        layout = uiPupMenuLayout(pup);
@@ -2951,7 +2957,7 @@ bool uiPupMenuInvoke(bContext *C, const char *idname, 
ReportList *reports)
 
        uiPupMenuEnd(C, pup);
 
-       return true;
+       return OPERATOR_INTERFACE;
 }
 
 
diff --git a/source/blender/editors/object/object_constraint.c 
b/source/blender/editors/object/object_constraint.c
index 92ed84b..7c11b3e 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -1911,7 +1911,7 @@ static int pose_ik_add_invoke(bContext *C, wmOperator 
*op, const wmEvent *UNUSED
        /* finish building the menu, and process it (should result in calling 
self again) */
        uiPupMenuEnd(C, pup);
        
-       return OPERATOR_CANCELLED;
+       return OPERATOR_INTERFACE;
 }
 
 /* call constraint_add_exec() to add the IK constraint */
diff --git a/source/blender/editors/object/object_relations.c 
b/source/blender/editors/object/object_relations.c
index 8f74278..798334b 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -309,14 +309,16 @@ static int make_proxy_invoke(bContext *C, wmOperator *op, 
const wmEvent *event)
 
                /* prese

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to