UI: Attempt to restore region for redo from Adjust Last Operation panel #108892

Merged
Julian Eisel merged 4 commits from JulianEisel/blender:temp-hud-restore-region into main 2023-07-25 12:42:48 +02:00
Member

The Adjust Last Operation panel would attempt to use the main region,
even when the operator was initially executed in a different region.
This becomes an issue when the operator relies on context of the region.
For example the pose library gets the active asset from context, which
is only available in the region (e.g. asset shelf) displaying the
assets. In general it seems like redo should restore the region of
invocation.

This uses the region type from the initial operator call context to
lookup a region to restore on redo. While not completely bullet proof
(multiple regions of the same type may be present), this should mitigate
the issue quite a bit.

Required for #104831.

The Adjust Last Operation panel would attempt to use the main region, even when the operator was initially executed in a different region. This becomes an issue when the operator relies on context of the region. For example the pose library gets the active asset from context, which is only available in the region (e.g. asset shelf) displaying the assets. In general it seems like redo should restore the region of invocation. This uses the region type from the initial operator call context to lookup a region to restore on redo. While not completely bullet proof (multiple regions of the same type may be present), this should mitigate the issue quite a bit. Required for #104831.
Julian Eisel added the
Module
User Interface
Interest
Animation & Rigging
labels 2023-06-12 14:23:43 +02:00
Julian Eisel added 1 commit 2023-06-12 14:23:55 +02:00
64cae3d650 UI: Attempt to restore region for redo from Adjust Last Operation panel
The Adjust Last Operation panel would attempt to use the main region,
even when the operator was initially executed in a different region.
This becomes an issue when the operator relies on context of the region.
For example the pose library gets the active asset from context, which
is only available in the region (e.g. asset shelf) displaying the
assets. In general it seems like redo should restore the region of
invokation.

This uses the region type from the initial operator call context to
lookup a region to restore on redo. While not completely bullet proof
(multiple regions of the same type may be present), this should mitigate
the issue quite a bit.
Julian Eisel requested review from Campbell Barton 2023-06-12 14:24:07 +02:00
Campbell Barton approved these changes 2023-07-18 10:11:55 +02:00
@ -697,6 +697,11 @@ ARegion *ED_area_find_region_xy_visual(const ScrArea *area, int regiontype, cons
struct ARegionType *ED_area_type_hud(int space_type);
void ED_area_type_hud_clear(struct wmWindowManager *wm, ScrArea *area_keep);
void ED_area_type_hud_ensure(struct bContext *C, struct ScrArea *area);
/** Lookup the region the operation was executed in, and which should be used to redo the

picky use more common style doc-strings.

/**
 *  Lookup ... etc.
 */
*picky* use more common style doc-strings. ``` /** * Lookup ... etc. */ ```
JulianEisel marked this conversation as resolved
@ -679,0 +680,4 @@
nullptr;
ARegion *region_repeat = redo_region_from_hud ?
redo_region_from_hud :
BKE_area_find_region_active_win(CTX_wm_area(C));

minor CTX_wm_area(C) can be replaced with area.

*minor* `CTX_wm_area(C)` can be replaced with `area`.
JulianEisel marked this conversation as resolved
Julian Eisel added 2 commits 2023-07-25 12:27:01 +02:00
Julian Eisel added 1 commit 2023-07-25 12:39:17 +02:00
Julian Eisel merged commit db0b804a0a into main 2023-07-25 12:42:48 +02:00
Julian Eisel deleted branch temp-hud-restore-region 2023-07-25 12:42:49 +02:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#108892
No description provided.