Solve the reversed-dependency logic in Object parenting. #107949

Open
opened 2023-05-15 20:15:30 +02:00 by Bastien Montagne · 0 comments

Current relationship between an object and its child at data-block level is reversed compared to the user-level one: the child points to its parent, which means that at ID management level the child is the 'owner' of its parent.

This is fully reversed compared to (expected) user understanding, where the child should be a dependency of its parent. This is illustrated e.g. in the Outliner tree view, where the child is shown as part of its parent hierarchy.

This reversed order of dependency between the user-level and data-level representations has always been a source of issues (e.g. complex weird code in Outliner tree building code, weird behavior in ID linking, e.g. when linking a parent object, it would not automatically link its children, and more recently more complex code in liboverride hierarchies handling).

The proposal to address this issue is to add a list of children objects to the parent one. Most likely implemented in a similar way as with e.g. collections children (i.e. a listbase of wrapper struct around object pointers). These new relationships would be come the 'main' ones between parents and children.

The current 'parent' pointer would be kept, but would become a 'loopback' pointer from ID management perspective (similar e.g. to the 'from' pointer of embedded IDs and shapekeys, or the 'parent' pointers of a collection).

That way, only the code setting a parent needs to be updated (and some versioning to initialize the list of children of course), and there should be no forward or backward compatibility breakage at all, since the existing parent pointer remain in use and keep the same meaning.

The only unknown consequences may come from moving that 'parent' pointer into the 'loopback' category in the lib_query foreach_id processing. It will certainly fix issues (or make existing code simpler by removing needs for special case handling), but it may also cause unexpected changes.

Current relationship between an object and its child at data-block level is reversed compared to the user-level one: the child points to its parent, which means that at ID management level the child is the 'owner' of its parent. This is fully reversed compared to (expected) user understanding, where the child should be a dependency of its parent. This is illustrated e.g. in the Outliner tree view, where the child is shown as part of its parent hierarchy. This reversed order of dependency between the user-level and data-level representations has always been a source of issues (e.g. complex weird code in Outliner tree building code, weird behavior in ID linking, e.g. when linking a parent object, it would not automatically link its children, and more recently more complex code in liboverride hierarchies handling). The proposal to address this issue is to add a list of children objects to the parent one. Most likely implemented in a similar way as with e.g. collections children (i.e. a listbase of wrapper struct around object pointers). These new relationships would be come the 'main' ones between parents and children. The current 'parent' pointer would be kept, but would become a 'loopback' pointer from ID management perspective (similar e.g. to the 'from' pointer of embedded IDs and shapekeys, or the 'parent' pointers of a collection). That way, only the code setting a parent needs to be updated (and some versioning to initialize the list of children of course), and there should be no forward or backward compatibility breakage at all, since the existing parent pointer remain in use and keep the same meaning. The only unknown consequences may come from moving that 'parent' pointer into the 'loopback' category in the `lib_query` foreach_id processing. It will certainly fix issues (or make existing code simpler by removing needs for special case handling), but it may also cause unexpected changes.
Bastien Montagne added the
Type
Design
Module
Core
Status
Confirmed
labels 2023-05-15 20:15:30 +02:00
Bastien Montagne added this to the Core project 2023-05-15 20:15:32 +02:00
Sign in to join this conversation.
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
1 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#107949
No description provided.