[Bf-blender-cvs] [7ba971d6d85] blender-v2.91-release: Fix T82553: Outliner F2 renaming issue when item is out of view
Philipp Oeser
noreply at git.blender.org
Wed Nov 11 10:26:48 CET 2020
Commit: 7ba971d6d855034d5a8f0e8dab1bcd892b5aabd3
Author: Philipp Oeser
Date: Tue Nov 10 12:23:48 2020 +0100
Branches: blender-v2.91-release
https://developer.blender.org/rB7ba971d6d855034d5a8f0e8dab1bcd892b5aabd3
Fix T82553: Outliner F2 renaming issue when item is out of view
- scrolling would be restricted (usually, if the object to be renamed is
in view, this prevents scrolling away without finishing the rename
operation)
- renaming by typing and confirming with Enter was not possible (you
would have to escape, scroll to the object and use F2 again)
- other shortcuts like A and H are still active instead of being handled
as text input
Avoid all these issue by forcing the item into view using
outliner_show_active / outliner_scroll_view.
Maniphest Tasks: T82553
Differential Revision: https://developer.blender.org/D9521
===================================================================
M source/blender/editors/space_outliner/outliner_edit.c
===================================================================
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c
index 165d7bb2aa2..c1add28b1e4 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -83,6 +83,11 @@
#include "outliner_intern.h"
+static void outliner_show_active(SpaceOutliner *space_outliner,
+ ARegion *region,
+ TreeElement *te,
+ ID *id);
+
/** \} */
/* -------------------------------------------------------------------- */
@@ -394,6 +399,7 @@ static TreeElement *outliner_item_rename_find_hovered(const SpaceOutliner *space
static int outliner_item_rename(bContext *C, wmOperator *op, const wmEvent *event)
{
ARegion *region = CTX_wm_region(C);
+ View2D *v2d = ®ion->v2d;
SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
const bool use_active = RNA_boolean_get(op->ptr, "use_active");
@@ -403,6 +409,13 @@ static int outliner_item_rename(bContext *C, wmOperator *op, const wmEvent *even
return OPERATOR_CANCELLED;
}
+ /* Force element into view. */
+ outliner_show_active(space_outliner, region, te, TREESTORE(te)->id);
+ int size_y = BLI_rcti_size_y(&v2d->mask) + 1;
+ int ytop = (te->ys + (size_y / 2));
+ int delta_y = ytop - v2d->cur.ymax;
+ outliner_scroll_view(space_outliner, region, delta_y);
+
do_item_rename(region, te, TREESTORE(te), op->reports);
return OPERATOR_FINISHED;
More information about the Bf-blender-cvs
mailing list