Fix: Editor related RNA paths incomplete/wrong #125365

Merged
Philipp Oeser merged 2 commits from lichtwerk/blender:124527 into main 2024-08-05 16:54:53 +02:00
Member

The RNA path that is generated for Editor properties were mostly
incomplete (e.g. the viewport overlay settings).

  • in python tooltips
  • from the Copy (Full) Data Path operator
  • python methods path_from_id, path_resolve returned incomplete paths

Since a space (editor) is ultimately owned by the screen, we now add the
missing "areas[x].spaces[x]" subpath to any editor.
Nested structs (like the viewport overlay) also need to include this
subpath.

Some editor related structs are not tied to a single space though (and
these cases are therefor not resolved yet):

  • Dopesheet is referenced from SpaceGraph, SpaceAction and SpaceNla
  • View3DShading is referenced from SpaceView3D but render engines as
    well
  • FileSelectParams / FileAssetSelectParams / FileAssetSelectIDFilter
    need more investigation

NOTE: in case of the VSE, to make this work this also changes the
overlays to be tied to SpaceSeq (the only editor using them)
NOTE: since the above is now in place, adding VSE overlay props to Quick
favourites is now made possible as well (was a leftover from !116604)

Fixes #124527, #113489

The RNA path that is generated for Editor properties were mostly incomplete (e.g. the viewport overlay settings). - in python tooltips - from the `Copy (Full) Data Path` operator - python methods `path_from_id`, `path_resolve` returned incomplete paths Since a space (editor) is ultimately owned by the screen, we now add the missing "areas[x].spaces[x]" subpath to any editor. Nested structs (like the viewport overlay) also need to include this subpath. Some editor related structs are not tied to a single space though (and these cases are therefor not resolved yet): - Dopesheet is referenced from SpaceGraph, SpaceAction and SpaceNla - View3DShading is referenced from SpaceView3D but render engines as well - FileSelectParams / FileAssetSelectParams / FileAssetSelectIDFilter need more investigation NOTE: in case of the VSE, to make this work this also changes the overlays to be tied to SpaceSeq (the only editor using them) NOTE: since the above is now in place, adding VSE overlay props to Quick favourites is now made possible as well (was a leftover from !116604) Fixes #124527, #113489
Philipp Oeser added 1 commit 2024-07-24 12:22:40 +02:00
Fix: Editor related RNA paths incomplete
All checks were successful
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
318f85c33a
The RNA path that is generated for Editor properties were mostly
incomplete (e.g. the viewport overlay settings).
- in python tooltips
- from the Copy (Full) Data Path operator
- python methods path_from_id, path_resolve returned incomplete paths

Since a space (editor) is ultimately owned by the screen, we now add the
missing "areas[x].spaces[x]" subpath to any editor.
Nested structs (like the viewport overlay) also need to include this
subpath.

Some editor related structs are not tied to a single space though (and
these cases are therefor not resolved yet):
- Dopesheet is referenced from SpaceGraph, SpaceAction and SpaceNla
- View3DShading is referenced from SpaceView3D but render engines as
well
- FileSelectParams / FileAssetSelectParams / FileAssetSelectIDFilter
need more investigation

NOTE: in case of the VSE, to make this work this also changes the
overlays to be tied to SpaceSeq (the only editor using them)
NOTE: since the above is now in place, adding VSE overlay props to Quick
favourites is now made possible as well (was a leftover from !116604)

Fixes #124527, #113489
Philipp Oeser changed title from Fix: Editor related RNA paths incomplete to Fix: Editor related RNA paths incomplete/wrong 2024-07-24 12:23:03 +02:00
Philipp Oeser added this to the User Interface project 2024-07-24 12:23:10 +02:00
Philipp Oeser added the
Interest
Core
Interest
Python API
labels 2024-07-24 12:23:24 +02:00
Philipp Oeser requested review from Bastien Montagne 2024-07-24 12:25:48 +02:00
Philipp Oeser requested review from Julian Eisel 2024-07-24 12:25:58 +02:00
Author
Member

@blender-bot build

@blender-bot build
Philipp Oeser requested review from Campbell Barton 2024-07-24 12:27:44 +02:00
Member

Would like to hear from @mont29 first since he's working on a new design for RNA paths, so there's a chance this could end up being redundant work.

Would like to hear from @mont29 first since he's working on a new design for RNA paths, so there's a chance this could end up being redundant work.
Bastien Montagne approved these changes 2024-07-24 14:55:12 +02:00
Bastien Montagne left a comment
Owner

LGTM from general approach and quick code check perspectives.

Indeed the on-going work on #122431 should make such code deprecated pretty soon - but 'pretty soon' is an unclear measurement here. Adding 'self path knowledge' to PointerRNA requires large and fairly complex refactors, which will take time. So I think this relatively simple patch is fine to address the issue for the time being.

LGTM from general approach and quick code check perspectives. Indeed the on-going work on #122431 should make such code deprecated pretty soon - but 'pretty soon' is an unclear measurement here. Adding 'self path knowledge' to `PointerRNA` requires large and fairly complex refactors, which will take time. So I think this relatively simple patch is fine to address the issue for the time being.
Author
Member

@blender-bot build

@blender-bot build
Julian Eisel requested changes 2024-07-25 16:50:38 +02:00
Dismissed
Julian Eisel left a comment
Member

Looks mostly good to me then, small changes requested.

Looks mostly good to me then, small changes requested.
@ -870,1 +872,4 @@
std::optional<std::string> BKE_screen_path_from_screen_to_space(const PointerRNA *ptr)
{
bScreen *screen = (bScreen *)ptr->owner_id;
Member

Let's not do completely unprotected casting of the owner. Would suggest returning an empty value when owner_id is not of type ID_SCR, and add a BLI_assert_unreachable() to find potential errors.

Also, don't use C-style casts, they are unsafe and hide issues. reinterpret_cast should work here.

Let's not do completely unprotected casting of the owner. Would suggest returning an empty value when `owner_id` is not of type `ID_SCR`, and add a `BLI_assert_unreachable()` to find potential errors. Also, don't use C-style casts, they are unsafe and hide issues. `reinterpret_cast` should work here.
@ -871,0 +873,4 @@
std::optional<std::string> BKE_screen_path_from_screen_to_space(const PointerRNA *ptr)
{
bScreen *screen = (bScreen *)ptr->owner_id;
SpaceLink *link = (SpaceLink *)ptr->data;
Member

static_cast

`static_cast`
Philipp Oeser added 1 commit 2024-07-25 17:20:01 +02:00
address review comments (check owner ID being a screen, casts, assert)
All checks were successful
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
683d3307bf
Julian Eisel approved these changes 2024-07-26 15:57:26 +02:00
Author
Member

@ideasman42 : still want to review this?

@ideasman42 : still want to review this?

@lichtwerk just go and commit!

@lichtwerk just go and commit!
Author
Member

@blender-bot build

@blender-bot build
Philipp Oeser merged commit f53b6b89f8 into main 2024-08-05 16:54:53 +02:00
Philipp Oeser deleted branch 124527 2024-08-05 16:54:56 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
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
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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
3 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#125365
No description provided.