diff options
author | Brecht Van Lommel <brecht@blender.org> | 2021-01-29 17:55:41 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-01-29 18:06:11 +0300 |
commit | c7d75a66163635ec7629eda2d4aa39b9e197ef6a (patch) | |
tree | 0adf3a02e1d6d8762f8e62f81eccca7d4044c32f /source/blender/depsgraph | |
parent | bc94036a76b63254181788ce5814fb946f52a287 (diff) | |
parent | b3fc88554468eb91fac3c2afb9387e599e6db507 (diff) |
Merge branch 'blender-v2.92-release'
Diffstat (limited to 'source/blender/depsgraph')
5 files changed, 82 insertions, 13 deletions
diff --git a/source/blender/depsgraph/DEG_depsgraph.h b/source/blender/depsgraph/DEG_depsgraph.h index 0ded511b8f8..567916fdebe 100644 --- a/source/blender/depsgraph/DEG_depsgraph.h +++ b/source/blender/depsgraph/DEG_depsgraph.h @@ -175,7 +175,8 @@ typedef struct DEGEditorUpdateContext { } DEGEditorUpdateContext; typedef void (*DEG_EditorUpdateIDCb)(const DEGEditorUpdateContext *update_ctx, struct ID *id); -typedef void (*DEG_EditorUpdateSceneCb)(const DEGEditorUpdateContext *update_ctx, int updated); +typedef void (*DEG_EditorUpdateSceneCb)(const DEGEditorUpdateContext *update_ctx, + const bool updated); /* Set callbacks which are being called when depsgraph changes. */ void DEG_editors_set_update_cb(DEG_EditorUpdateIDCb id_func, DEG_EditorUpdateSceneCb scene_func); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index 2edd4ddf853..c3304cd80ff 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -155,6 +155,7 @@ IDNode *DepsgraphNodeBuilder::add_id_node(ID *id) { BLI_assert(id->session_uuid != MAIN_ID_SESSION_UUID_UNSET); + const ID_Type id_type = GS(id->name); IDNode *id_node = nullptr; ID *id_cow = nullptr; IDComponentsMask previously_visible_components_mask = 0; @@ -173,10 +174,8 @@ IDNode *DepsgraphNodeBuilder::add_id_node(ID *id) id_node->previously_visible_components_mask = previously_visible_components_mask; id_node->previous_eval_flags = previous_eval_flags; id_node->previous_customdata_masks = previous_customdata_masks; - /* Currently all ID nodes are supposed to have copy-on-write logic. - * - * NOTE: Zero number of components indicates that ID node was just created. */ - if (id_node->components.is_empty()) { + /* NOTE: Zero number of components indicates that ID node was just created. */ + if (id_node->components.is_empty() && deg_copy_on_write_is_needed(id_type)) { ComponentNode *comp_cow = id_node->add_component(NodeType::COPY_ON_WRITE); OperationNode *op_cow = comp_cow->add_operation( function_bind(deg_evaluate_copy_on_write, _1, id_node), @@ -388,7 +387,9 @@ void DepsgraphNodeBuilder::build_id(ID *id) if (id == nullptr) { return; } - switch (GS(id->name)) { + + const ID_Type id_type = GS(id->name); + switch (id_type) { case ID_AC: build_action((bAction *)id); break; @@ -478,13 +479,39 @@ void DepsgraphNodeBuilder::build_id(ID *id) case ID_SIM: build_simulation((Simulation *)id); break; - default: - fprintf(stderr, "Unhandled ID %s\n", id->name); - BLI_assert(!"Should never happen"); + case ID_PA: + build_particle_settings((ParticleSettings *)id); + break; + case ID_GD: + build_gpencil((bGPdata *)id); + break; + + case ID_LI: + case ID_IP: + case ID_SCR: + case ID_VF: + case ID_BR: + case ID_WM: + case ID_PAL: + case ID_PC: + case ID_WS: + BLI_assert(!deg_copy_on_write_is_needed(id_type)); + build_generic_id(id); break; } } +void DepsgraphNodeBuilder::build_generic_id(ID *id) +{ + if (built_map_.checkIsBuiltAndTag(id)) { + return; + } + + build_idproperties(id->properties); + build_animdata(id); + build_parameters(id); +} + static void build_idproperties_callback(IDProperty *id_property, void *user_data) { DepsgraphNodeBuilder *builder = reinterpret_cast<DepsgraphNodeBuilder *>(user_data); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h index 174f9b129f9..a7033c8c8f3 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h @@ -152,6 +152,9 @@ class DepsgraphNodeBuilder : public DepsgraphBuilder { virtual void build_id(ID *id); + /* Build function for ID types that do not need their own build_xxx() function. */ + virtual void build_generic_id(ID *id); + virtual void build_idproperties(IDProperty *id_property); virtual void build_scene_render(Scene *scene, ViewLayer *view_layer); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index e8cf5c99c37..ffddb196ae4 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -491,7 +491,9 @@ void DepsgraphRelationBuilder::build_id(ID *id) if (id == nullptr) { return; } - switch (GS(id->name)) { + + const ID_Type id_type = GS(id->name); + switch (id_type) { case ID_AC: build_action((bAction *)id); break; @@ -567,11 +569,38 @@ void DepsgraphRelationBuilder::build_id(ID *id) case ID_SIM: build_simulation((Simulation *)id); break; - default: - fprintf(stderr, "Unhandled ID %s\n", id->name); - BLI_assert(!"Should never happen"); + case ID_PA: + build_particle_settings((ParticleSettings *)id); break; + case ID_GD: + build_gpencil((bGPdata *)id); + break; + + case ID_LI: + case ID_IP: + case ID_SCR: + case ID_VF: + case ID_BR: + case ID_WM: + case ID_PAL: + case ID_PC: + case ID_WS: + BLI_assert(!deg_copy_on_write_is_needed(id_type)); + build_generic_id(id); + break; + } +} + +void DepsgraphRelationBuilder::build_generic_id(ID *id) +{ + + if (built_map_.checkIsBuiltAndTag(id)) { + return; } + + build_idproperties(id->properties); + build_animdata(id); + build_parameters(id); } static void build_idproperties_callback(IDProperty *id_property, void *user_data) @@ -2805,7 +2834,13 @@ void DepsgraphRelationBuilder::build_nested_shapekey(ID *owner, Key *key) void DepsgraphRelationBuilder::build_copy_on_write_relations(IDNode *id_node) { ID *id_orig = id_node->id_orig; + const ID_Type id_type = GS(id_orig->name); + + if (!deg_copy_on_write_is_needed(id_type)) { + return; + } + TimeSourceKey time_source_key; OperationKey copy_on_write_key(id_orig, NodeType::COPY_ON_WRITE, OperationCode::COPY_ON_WRITE); /* XXX: This is a quick hack to make Alt-A to work. */ diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h b/source/blender/depsgraph/intern/builder/deg_builder_relations.h index 5587379089c..21d1d4b6268 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h @@ -198,6 +198,9 @@ class DepsgraphRelationBuilder : public DepsgraphBuilder { virtual void build_id(ID *id); + /* Build function for ID types that do not need their own build_xxx() function. */ + virtual void build_generic_id(ID *id); + virtual void build_idproperties(IDProperty *id_property); virtual void build_scene_render(Scene *scene, ViewLayer *view_layer); |