[Bf-blender-cvs] [546fa9a7593] master: Fix T87037: Add tooltip for "Paste Flipped"

Falk David noreply at git.blender.org
Thu Apr 1 11:04:25 CEST 2021


Commit: 546fa9a7593236cb6e387b15a2b7795ac0880271
Author: Falk David
Date:   Thu Apr 1 10:57:55 2021 +0200
Branches: master
https://developer.blender.org/rB546fa9a7593236cb6e387b15a2b7795ac0880271

Fix T87037: Add tooltip for "Paste Flipped"

The "Paste Flipped" operator was missing its own tooltip.

This patch adds the tooltip by implementing the `get_description` callback for
`GRAPH_OT_paste` and `ACTION_OT_paste`.

Reviewed By: sybren

Maniphest Tasks: T87037

Differential Revision: https://developer.blender.org/D10859

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

M	source/blender/editors/space_action/action_edit.c
M	source/blender/editors/space_graph/graph_edit.c

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

diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c
index 5c061518570..fea62f0d9c2 100644
--- a/source/blender/editors/space_action/action_edit.c
+++ b/source/blender/editors/space_action/action_edit.c
@@ -648,6 +648,19 @@ static int actkeys_paste_exec(bContext *C, wmOperator *op)
   return OPERATOR_FINISHED;
 }
 
+static char *actkeys_paste_description(bContext *UNUSED(C),
+                                       wmOperatorType *UNUSED(op),
+                                       PointerRNA *ptr)
+{
+  /* Custom description if the 'flipped' option is used. */
+  if (RNA_boolean_get(ptr, "flipped")) {
+    return BLI_strdup("Paste keyframes from mirrored bones if they exist");
+  }
+
+  /* Use the default description in the other cases. */
+  return NULL;
+}
+
 void ACTION_OT_paste(wmOperatorType *ot)
 {
   PropertyRNA *prop;
@@ -660,6 +673,7 @@ void ACTION_OT_paste(wmOperatorType *ot)
 
   /* api callbacks */
   //  ot->invoke = WM_operator_props_popup; // better wait for action redo panel
+  ot->get_description = actkeys_paste_description;
   ot->exec = actkeys_paste_exec;
   ot->poll = ED_operator_action_active;
 
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index 31f606e515d..a2e812a4ed1 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -578,6 +578,19 @@ static int graphkeys_paste_exec(bContext *C, wmOperator *op)
   return OPERATOR_FINISHED;
 }
 
+static char *graphkeys_paste_description(bContext *UNUSED(C),
+                                         wmOperatorType *UNUSED(op),
+                                         PointerRNA *ptr)
+{
+  /* Custom description if the 'flipped' option is used. */
+  if (RNA_boolean_get(ptr, "flipped")) {
+    return BLI_strdup("Paste keyframes from mirrored bones if they exist");
+  }
+
+  /* Use the default description in the other cases. */
+  return NULL;
+}
+
 void GRAPH_OT_paste(wmOperatorType *ot)
 {
   PropertyRNA *prop;
@@ -592,6 +605,7 @@ void GRAPH_OT_paste(wmOperatorType *ot)
   /* API callbacks */
 
   // ot->invoke = WM_operator_props_popup; /* better wait for graph redo panel */
+  ot->get_description = graphkeys_paste_description;
   ot->exec = graphkeys_paste_exec;
   ot->poll = graphop_editable_keyframes_poll;



More information about the Bf-blender-cvs mailing list