BKE: Rework ID swap code to properly handle embedded ID pointers. #107044

Merged
Bastien Montagne merged 1 commits from mont29/blender:F-swap-embedded-id into main 2023-04-18 11:09:47 +02:00

While embedded IDs are usually considered as private local data of their
owner ID, some areas of code, like the depsgraph, can consider them as
regular IDs in some aspects.

So when swapping IDs, also properly 'counter-swap' their potential
embedded IDs, such that the pointers to the embedded IDs remain as before
swapping, even though the data of the embedded IDs is swapped.

The main target of this change is memfile undo code. There, newly read
IDs are swapped with their older version, so that the old address
contains the new data. This allows to avoid rebuilding some of the
depsgraph. Doing the same thing for embedded IDs should reduce even
further the needs for depsgrah rebuilds on undo steps.

This commit also gives more control over the remapping of 'self' ID
pointers inside themselves.

While embedded IDs are usually considered as private local data of their owner ID, some areas of code, like the depsgraph, can consider them as regular IDs in some aspects. So when swapping IDs, also properly 'counter-swap' their potential embedded IDs, such that the pointers to the embedded IDs remain as before swapping, even though the data of the embedded IDs is swapped. The main target of this change is memfile undo code. There, newly read IDs are swapped with their older version, so that the old address contains the new data. This allows to avoid rebuilding some of the depsgraph. Doing the same thing for embedded IDs should reduce even further the needs for depsgrah rebuilds on undo steps. This commit also gives more control over the remapping of 'self' ID pointers inside themselves.
Bastien Montagne added this to the Module: Core project 2023-04-17 17:29:46 +02:00
Bastien Montagne requested review from Brecht Van Lommel 2023-04-17 17:29:54 +02:00
Brecht Van Lommel approved these changes 2023-04-17 19:01:56 +02:00
Bastien Montagne force-pushed F-swap-embedded-id from 74e63f7861 to 2a042b4133 2023-04-18 11:05:49 +02:00 Compare
Bastien Montagne force-pushed F-swap-embedded-id from 2a042b4133 to e615947d6a 2023-04-18 11:09:25 +02:00 Compare
Bastien Montagne merged commit 6e75581e65 into main 2023-04-18 11:09:46 +02:00
Bastien Montagne deleted branch F-swap-embedded-id 2023-04-18 11:09:47 +02:00
Bastien Montagne removed this from the Module: Core project 2023-07-03 12:46:46 +02:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
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 & 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
Asset System
Module
Asset System
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline & 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
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#107044
No description provided.