diff options
author | Bastien Montagne <bastien@blender.org> | 2021-05-21 11:14:58 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2021-05-21 13:43:32 +0300 |
commit | cf42586737554a5902796324a3b8c2f38c9a29f5 (patch) | |
tree | 946decf7bac8eda54eadf74e60e6a1b3cb5bd1d3 /source/blender/depsgraph/intern/builder/deg_builder_nodes.h | |
parent | ff51c2e89a0951d043a843435b4c25ba7a15e8e2 (diff) |
Fix T85752: Collection Instance Crash when instancing collections with disabled subcollections
Root of the issue was actually hidden deep in depsgraph itself: it would
not properly update all of its COW IDs using a datablock when depsgraph
decides to evaluate or un-evaluate it.
This would lead to evaluated IDs pointing to either:
- orig IDs when there was an evaluated version of those (annoying bug,
but not a crashing one).
- old address of previously evaluated IDs that no longer exists in the
depsgraph (causing the crash from the report e.g.).
This commit adds an extra step at the end of nodes building, that goes
over all of already existing IDs in the depsgraph to check whether they
do one of the two things above, and tag them for COW update if so.
NOTE: This only affects depsgraph (re-)building, not its evaluation.
This remains consistent with the fact that operations that may change
the depsgraph content (like Collection exclusion etc.) need to trigger a
rebuild.
NOTE: Performances: Worst case scenarii, like (un-)excluding a whole
character collection in a production file, lead to 5% to 10% extra
processing time in depsgraph building. Most of it comming from extra COW
processing (in depsgraph's update in `build_step_finalize`), the detection
loop itself only accounts for 1% to 2% of the whole building time.
Maniphest Tasks: T85752
Differential Revision: https://developer.blender.org/D10907
Diffstat (limited to 'source/blender/depsgraph/intern/builder/deg_builder_nodes.h')
-rw-r--r-- | source/blender/depsgraph/intern/builder/deg_builder_nodes.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h index a7033c8c8f3..151e0d844b6 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h @@ -101,6 +101,8 @@ class DepsgraphNodeBuilder : public DepsgraphBuilder { virtual void begin_build(); virtual void end_build(); + int foreach_id_cow_detect_need_for_update_callback(ID *id_cow_self, ID *id_pointer); + IDNode *add_id_node(ID *id); IDNode *find_id_node(ID *id); TimeSourceNode *add_time_source(); @@ -276,6 +278,9 @@ class DepsgraphNodeBuilder : public DepsgraphBuilder { bool is_reference, void *user_data); + void tag_previously_tagged_nodes(); + void update_invalid_cow_pointers(); + /* State which demotes currently built entities. */ Scene *scene_; ViewLayer *view_layer_; |