diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2020-11-10 14:23:48 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2020-11-11 12:18:47 +0300 |
commit | 7ba971d6d855034d5a8f0e8dab1bcd892b5aabd3 (patch) | |
tree | 97221a9e81bfd9a76edd37f58022308c8fc4a78b /source | |
parent | 2d48f3e445ad4294cfe1a354629bf335117ba40d (diff) |
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
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_edit.c | 13 |
1 files changed, 13 insertions, 0 deletions
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; |