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
This commit is contained in:
parent
2d48f3e445
commit
7ba971d6d8
Notes:
blender-bot
2023-02-13 20:35:11 +01:00
Referenced by issue #82553, Outliner F2 renaiming problem
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue