Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-05-28 06:26:50 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-05-28 06:36:43 +0300
commit2e22cfd08a0d589e8894e322ed29d5c3227ca04d (patch)
tree1dea3f566ce6ee8bdefaa5ca78cec1844662d2b8 /source/blender/editors/interface/interface_region_tooltip.c
parent219e6a98c66a00673395d5c420ff35ad86eef846 (diff)
Gizmo: changes to internal drag logic
Minor changes to recent gizmo click/drag logic 08dff7b40bc6a Changing the gizmos highlighted part in the invoke_prepare callback is too error prone since it needs to run before it's known which operator will execute. Add back 'drag_part', since it simplifies click-drag use. While this isn't essential with custom keymaps per gizmo it avoids having to define a keymap in the case a drag event needs a different action.
Diffstat (limited to 'source/blender/editors/interface/interface_region_tooltip.c')
-rw-r--r--source/blender/editors/interface/interface_region_tooltip.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/source/blender/editors/interface/interface_region_tooltip.c b/source/blender/editors/interface/interface_region_tooltip.c
index c47f35c8edd..6c780482777 100644
--- a/source/blender/editors/interface/interface_region_tooltip.c
+++ b/source/blender/editors/interface/interface_region_tooltip.c
@@ -883,25 +883,19 @@ static uiTooltipData *ui_tooltip_data_from_gizmo(bContext *C, wmGizmo *gz)
/* Operator Actions */
{
+ const bool use_drag = gz->drag_part != -1 && gz->highlight_part != gz->drag_part;
const struct {
int part;
const char *prefix;
} gzop_actions[] = {
-#if 0
- {
- .part = gz->highlight_part,
- .prefix = use_drag ? CTX_TIP_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Click") : NULL,
- },
- {
- .part = use_drag ? gz->drag_part : -1,
- .prefix = use_drag ? CTX_TIP_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Drag") : NULL,
- },
-#else
- {
- .part = gz->highlight_part,
- .prefix = NULL,
- },
-#endif
+ {
+ .part = gz->highlight_part,
+ .prefix = use_drag ? CTX_TIP_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Click") : NULL,
+ },
+ {
+ .part = use_drag ? gz->drag_part : -1,
+ .prefix = use_drag ? CTX_TIP_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Drag") : NULL,
+ },
};
for (int i = 0; i < ARRAY_SIZE(gzop_actions); i++) {