Fix ViewLayers cache building #73411
Labels
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
12 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#73411
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Currently, ViewLayers' collection and objects cache is rebuilt way too much (it can be thousands of time during a single edit action in a relatively heavy scene).
Proposal
Use a lazy update approach:
We can stay fairly general (tag a whole cache as dirty, and just fully rebuild it then when required), or be more specific by tagging every ID that changed, and then cache rebuilding code could only update the parts that need it.
Profiling on worst-case scenarii should tell us if high level of granularity is really needed here (worst case would be a viewlayer with many collections and objects).
Another possibility would be to add an API to actually update the needed parts of the caches on the fly (called from code modifying the related IDs relationships), but this is likely more complex to get working.
Note: Thread safety should not be an issue here, at least there is none at all in current code…
Changed status from 'Needs Triage' to: 'Confirmed'
Added subscriber: @mont29
Added subscriber: @rwman
Added subscriber: @SamGreen
Added subscriber: @Moult
Added subscriber: @Imaginer
Added subscriber: @Dangry
Added subscriber: @ahmed.hindy96
Added subscriber: @Jeroen-Bakker
Added subscriber: @monique
Added subscriber: @aras_p
For people who aren't super familiar with blender codebase but might want to try doing this (asking for a friend :)) -- is the idea that all the work currently done by the likes of
BKE_main_collection_sync
,BKE_scene_collection_sync
,BKE_layer_collection_sync
and similar would merely mark something as "yo, this needs a sync at some point", and then the actual resync happens once it's needed (e.g. whenBKE_view_layer_base_find
is called)?And then part of the work would be finding various loops in the codebase that right now do something like
and change them to a pattern like:
since that would turn N heavy operations into 1 heavy operation?
Or am I misunderstanding the issue completely :)
@aras_p that is the idea yes. Most (if not all) of the code in
BKE_main_collection_sync
and similar would then move to the new 'lazy' on-demand syncing code (theensure()
callback in task above).This issue was referenced by
17501c146e
Added subscriber: @AlexeyAdamitsky
This issue was referenced by
23276bcc37
This issue was referenced by
68589a31eb
This issue was referenced by
f017fdecef