From c1da8e3b28f95188f9e9152383856c95f29586b4 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 31 Jan 2019 12:56:40 +0100 Subject: Depsgraph: Comb code to a better state all over Some summary of changes: - Don't use DEG prefix for types and enumerator values: the code is already inside DEG namespace. - Put code where it locally belongs to: avoid having one single header file with all sort of definitions in it. - Take advantage of modern C++11 enabled by default. --- .../depsgraph/intern/builder/deg_builder.cc | 62 +- .../depsgraph/intern/builder/deg_builder_cycle.cc | 59 +- .../depsgraph/intern/builder/deg_builder_map.h | 6 +- .../depsgraph/intern/builder/deg_builder_nodes.cc | 403 +++++------ .../depsgraph/intern/builder/deg_builder_nodes.h | 124 ++-- .../intern/builder/deg_builder_nodes_rig.cc | 110 ++- .../intern/builder/deg_builder_nodes_view_layer.cc | 22 +- .../intern/builder/deg_builder_pchanmap.cc | 3 +- .../intern/builder/deg_builder_pchanmap.h | 3 +- .../intern/builder/deg_builder_relations.cc | 777 ++++++++++----------- .../intern/builder/deg_builder_relations.h | 129 ++-- .../intern/builder/deg_builder_relations_impl.h | 84 +-- .../intern/builder/deg_builder_relations_keys.cc | 32 +- .../intern/builder/deg_builder_relations_rig.cc | 211 +++--- .../builder/deg_builder_relations_view_layer.cc | 16 +- .../intern/builder/deg_builder_transitive.cc | 37 +- 16 files changed, 976 insertions(+), 1102 deletions(-) (limited to 'source/blender/depsgraph/intern/builder') diff --git a/source/blender/depsgraph/intern/builder/deg_builder.cc b/source/blender/depsgraph/intern/builder/deg_builder.cc index 97e7c8654bd..dd2aec35a3e 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder.cc @@ -43,15 +43,13 @@ extern "C" { } #include "intern/depsgraph.h" -#include "intern/depsgraph_intern.h" -#include "intern/depsgraph_types.h" +#include "intern/depsgraph_tag.h" +#include "intern/depsgraph_type.h" #include "intern/eval/deg_eval_copy_on_write.h" -#include "intern/nodes/deg_node.h" -#include "intern/nodes/deg_node_id.h" -#include "intern/nodes/deg_node_component.h" -#include "intern/nodes/deg_node_operation.h" - -#include "util/deg_util_foreach.h" +#include "intern/node/deg_node.h" +#include "intern/node/deg_node_id.h" +#include "intern/node/deg_node_component.h" +#include "intern/node/deg_node_operation.h" #include "DEG_depsgraph.h" @@ -65,21 +63,21 @@ void deg_graph_build_flush_visibility(Depsgraph *graph) DEG_NODE_VISITED = (1 << 0), }; - BLI_Stack *stack = BLI_stack_new(sizeof(OperationDepsNode *), + BLI_Stack *stack = BLI_stack_new(sizeof(OperationNode *), "DEG flush layers stack"); - foreach (IDDepsNode *id_node, graph->id_nodes) { - GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, id_node->components) + for (IDNode *id_node : graph->id_nodes) { + GHASH_FOREACH_BEGIN(ComponentNode *, comp_node, id_node->components) { comp_node->affects_directly_visible |= id_node->is_directly_visible; } GHASH_FOREACH_END(); } - foreach (OperationDepsNode *op_node, graph->operations) { + for (OperationNode *op_node : graph->operations) { op_node->custom_flags = 0; op_node->num_links_pending = 0; - foreach (DepsRelation *rel, op_node->outlinks) { - if ((rel->from->type == DEG_NODE_TYPE_OPERATION) && - (rel->flag & DEPSREL_FLAG_CYCLIC) == 0) + for (Relation *rel : op_node->outlinks) { + if ((rel->from->type == NodeType::OPERATION) && + (rel->flag & RELATION_FLAG_CYCLIC) == 0) { ++op_node->num_links_pending; } @@ -90,21 +88,21 @@ void deg_graph_build_flush_visibility(Depsgraph *graph) } } while (!BLI_stack_is_empty(stack)) { - OperationDepsNode *op_node; + OperationNode *op_node; BLI_stack_pop(stack, &op_node); /* Flush layers to parents. */ - foreach (DepsRelation *rel, op_node->inlinks) { - if (rel->from->type == DEG_NODE_TYPE_OPERATION) { - OperationDepsNode *op_from = (OperationDepsNode *)rel->from; + for (Relation *rel : op_node->inlinks) { + if (rel->from->type == NodeType::OPERATION) { + OperationNode *op_from = (OperationNode *)rel->from; op_from->owner->affects_directly_visible |= op_node->owner->affects_directly_visible; } } /* Schedule parent nodes. */ - foreach (DepsRelation *rel, op_node->inlinks) { - if (rel->from->type == DEG_NODE_TYPE_OPERATION) { - OperationDepsNode *op_from = (OperationDepsNode *)rel->from; - if ((rel->flag & DEPSREL_FLAG_CYCLIC) == 0) { + for (Relation *rel : op_node->inlinks) { + if (rel->from->type == NodeType::OPERATION) { + OperationNode *op_from = (OperationNode *)rel->from; + if ((rel->flag & RELATION_FLAG_CYCLIC) == 0) { BLI_assert(op_from->num_links_pending > 0); --op_from->num_links_pending; } @@ -127,9 +125,8 @@ void deg_graph_build_finalize(Main *bmain, Depsgraph *graph) /* Make sure dependencies of visible ID datablocks are visible. */ deg_graph_build_flush_visibility(graph); /* Re-tag IDs for update if it was tagged before the relations - * update tag. - */ - foreach (IDDepsNode *id_node, graph->id_nodes) { + * update tag. */ + for (IDNode *id_node : graph->id_nodes) { ID *id = id_node->id_orig; id_node->finalize_build(graph); int flag = 0; @@ -144,18 +141,17 @@ void deg_graph_build_finalize(Main *bmain, Depsgraph *graph) if (!deg_copy_on_write_is_expanded(id_node->id_cow)) { flag |= ID_RECALC_COPY_ON_WRITE; /* This means ID is being added to the dependency graph first - * time, which is similar to "ob-visible-change" - */ + * time, which is similar to "ob-visible-change" */ if (GS(id->name) == ID_OB) { flag |= ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY; } } if (flag != 0) { - deg_graph_id_tag_update(bmain, - graph, - id_node->id_orig, - flag, - DEG_UPDATE_SOURCE_RELATIONS); + graph_id_tag_update(bmain, + graph, + id_node->id_orig, + flag, + DEG_UPDATE_SOURCE_RELATIONS); } } } diff --git a/source/blender/depsgraph/intern/builder/deg_builder_cycle.cc b/source/blender/depsgraph/intern/builder/deg_builder_cycle.cc index a8768c899ad..bfe030f4ab9 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_cycle.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_cycle.cc @@ -36,11 +36,9 @@ #include "BLI_utildefines.h" #include "BLI_stack.h" -#include "util/deg_util_foreach.h" - -#include "intern/nodes/deg_node.h" -#include "intern/nodes/deg_node_component.h" -#include "intern/nodes/deg_node_operation.h" +#include "intern/node/deg_node.h" +#include "intern/node/deg_node_component.h" +#include "intern/node/deg_node_operation.h" #include "intern/depsgraph.h" @@ -48,19 +46,19 @@ namespace DEG { namespace { -typedef enum eCyclicCheckVisitedState { +enum eCyclicCheckVisitedState { /* Not is not visited at all during traversal. */ NODE_NOT_VISITED = 0, /* Node has been visited during traversal and not in current stack. */ NODE_VISITED = 1, /* Node has been visited during traversal and is in current stack. */ NODE_IN_STACK = 2, -} eCyclicCheckVisitedState; +}; struct StackEntry { - OperationDepsNode *node; + OperationNode *node; StackEntry *from; - DepsRelation *via_relation; + Relation *via_relation; }; struct CyclesSolverState { @@ -83,28 +81,28 @@ struct CyclesSolverState { int num_cycles; }; -BLI_INLINE void set_node_visited_state(DepsNode *node, +BLI_INLINE void set_node_visited_state(Node *node, eCyclicCheckVisitedState state) { node->custom_flags = (node->custom_flags & ~0x3) | (int)state; } -BLI_INLINE eCyclicCheckVisitedState get_node_visited_state(DepsNode *node) +BLI_INLINE eCyclicCheckVisitedState get_node_visited_state(Node *node) { return (eCyclicCheckVisitedState)(node->custom_flags & 0x3); } -BLI_INLINE void set_node_num_visited_children(DepsNode *node, int num_children) +BLI_INLINE void set_node_num_visited_children(Node *node, int num_children) { node->custom_flags = (node->custom_flags & 0x3) | (num_children << 2); } -BLI_INLINE int get_node_num_visited_children(DepsNode *node) +BLI_INLINE int get_node_num_visited_children(Node *node) { return node->custom_flags >> 2; } -void schedule_node_to_stack(CyclesSolverState *state, OperationDepsNode *node) +void schedule_node_to_stack(CyclesSolverState *state, OperationNode *node) { StackEntry entry; entry.node = node; @@ -117,10 +115,10 @@ void schedule_node_to_stack(CyclesSolverState *state, OperationDepsNode *node) /* Schedule leaf nodes (node without input links) for traversal. */ void schedule_leaf_nodes(CyclesSolverState *state) { - foreach (OperationDepsNode *node, state->graph->operations) { + for (OperationNode *node : state->graph->operations) { bool has_inlinks = false; - foreach (DepsRelation *rel, node->inlinks) { - if (rel->from->type == DEG_NODE_TYPE_OPERATION) { + for (Relation *rel : node->inlinks) { + if (rel->from->type == NodeType::OPERATION) { has_inlinks = true; } } @@ -139,7 +137,7 @@ void schedule_leaf_nodes(CyclesSolverState *state) */ bool schedule_non_checked_node(CyclesSolverState *state) { - foreach (OperationDepsNode *node, state->graph->operations) { + for (OperationNode *node : state->graph->operations) { if (get_node_visited_state(node) == NODE_NOT_VISITED) { schedule_node_to_stack(state, node); return true; @@ -148,16 +146,16 @@ bool schedule_non_checked_node(CyclesSolverState *state) return false; } -bool check_relation_can_murder(DepsRelation *relation) +bool check_relation_can_murder(Relation *relation) { - if (relation->flag & DEPSREL_FLAG_GODMODE) { + if (relation->flag & RELATION_FLAG_GODMODE) { return false; } return true; } -DepsRelation *select_relation_to_murder(DepsRelation *relation, - StackEntry *cycle_start_entry) +Relation *select_relation_to_murder(Relation *relation, + StackEntry *cycle_start_entry) { /* More or less russian roulette solver, which will make sure only * specially marked relations are kept alive. @@ -167,7 +165,7 @@ DepsRelation *select_relation_to_murder(DepsRelation *relation, return relation; } StackEntry *current = cycle_start_entry; - OperationDepsNode *to_node = (OperationDepsNode *)relation->to; + OperationNode *to_node = (OperationNode *)relation->to; while (current->node != to_node) { if (check_relation_can_murder(current->via_relation)) { return current->via_relation; @@ -183,13 +181,13 @@ void solve_cycles(CyclesSolverState *state) BLI_Stack *traversal_stack = state->traversal_stack; while (!BLI_stack_is_empty(traversal_stack)) { StackEntry *entry = (StackEntry *)BLI_stack_peek(traversal_stack); - OperationDepsNode *node = entry->node; + OperationNode *node = entry->node; bool all_child_traversed = true; const int num_visited = get_node_num_visited_children(node); for (int i = num_visited; i < node->outlinks.size(); ++i) { - DepsRelation *rel = node->outlinks[i]; - if (rel->to->type == DEG_NODE_TYPE_OPERATION) { - OperationDepsNode *to = (OperationDepsNode *)rel->to; + Relation *rel = node->outlinks[i]; + if (rel->to->type == NodeType::OPERATION) { + OperationNode *to = (OperationNode *)rel->to; eCyclicCheckVisitedState to_state = get_node_visited_state(to); if (to_state == NODE_IN_STACK) { printf("Dependency cycle detected:\n"); @@ -206,9 +204,9 @@ void solve_cycles(CyclesSolverState *state) current->via_relation->name); current = current->from; } - DepsRelation *sacrificial_relation = + Relation *sacrificial_relation = select_relation_to_murder(rel, entry); - sacrificial_relation->flag |= DEPSREL_FLAG_CYCLIC; + sacrificial_relation->flag |= RELATION_FLAG_CYCLIC; ++state->num_cycles; } else if (to_state == NODE_NOT_VISITED) { @@ -242,8 +240,7 @@ void deg_graph_detect_cycles(Depsgraph *graph) /* We are not done yet. It is possible to have closed loop cycle, * for example A -> B -> C -> A. These nodes were not scheduled * yet (since they all have inlinks), and were not traversed since - * nobody else points to them. - */ + * nobody else points to them. */ while (schedule_non_checked_node(&state)) { solve_cycles(&state); } diff --git a/source/blender/depsgraph/intern/builder/deg_builder_map.h b/source/blender/depsgraph/intern/builder/deg_builder_map.h index 5ad22a9aa77..3620d7ca3dd 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_map.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_map.h @@ -41,16 +41,14 @@ public: ~BuilderMap(); /* Check whether given ID is already handled by builder (or if it's being - * handled). - */ + * handled). */ bool checkIsBuilt(ID *id); /* Tag given ID as handled/built. */ void tagBuild(ID *id); /* Combination of previous two functions, returns truth if ID was already - * handled, or tags is handled otherwise and return false. - */ + * handled, or tags is handled otherwise and return false. */ bool checkIsBuiltAndTag(ID *id); template bool checkIsBuilt(T *datablock) { diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index 33d047bf674..295303aaeee 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -106,15 +106,13 @@ extern "C" { #include "DEG_depsgraph_build.h" #include "intern/builder/deg_builder.h" +#include "intern/depsgraph.h" #include "intern/eval/deg_eval_copy_on_write.h" -#include "intern/nodes/deg_node.h" -#include "intern/nodes/deg_node_component.h" -#include "intern/nodes/deg_node_id.h" -#include "intern/nodes/deg_node_operation.h" -#include "intern/depsgraph_types.h" -#include "intern/depsgraph_intern.h" - -#include "util/deg_util_foreach.h" +#include "intern/node/deg_node.h" +#include "intern/node/deg_node_component.h" +#include "intern/node/deg_node_id.h" +#include "intern/node/deg_node_operation.h" +#include "intern/depsgraph_type.h" namespace DEG { @@ -157,9 +155,9 @@ DepsgraphNodeBuilder::~DepsgraphNodeBuilder() } } -IDDepsNode *DepsgraphNodeBuilder::add_id_node(ID *id) +IDNode *DepsgraphNodeBuilder::add_id_node(ID *id) { - IDDepsNode *id_node = NULL; + IDNode *id_node = NULL; ID *id_cow = NULL; IDComponentsMask previously_visible_components_mask = 0; uint32_t previous_eval_flags = 0; @@ -181,49 +179,48 @@ IDDepsNode *DepsgraphNodeBuilder::add_id_node(ID *id) id_node->previous_customdata_mask = previous_customdata_mask; /* Currently all ID nodes are supposed to have copy-on-write logic. * - * NOTE: Zero number of components indicates that ID node was just created. - */ + * NOTE: Zero number of components indicates that ID node was just created. */ if (BLI_ghash_len(id_node->components) == 0) { - ComponentDepsNode *comp_cow = - id_node->add_component(DEG_NODE_TYPE_COPY_ON_WRITE); - OperationDepsNode *op_cow = comp_cow->add_operation( + 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), - DEG_OPCODE_COPY_ON_WRITE, + OperationCode::COPY_ON_WRITE, "", -1); graph_->operations.push_back(op_cow); } return id_node; } -IDDepsNode *DepsgraphNodeBuilder::find_id_node(ID *id) +IDNode *DepsgraphNodeBuilder::find_id_node(ID *id) { return graph_->find_id_node(id); } -TimeSourceDepsNode *DepsgraphNodeBuilder::add_time_source() +TimeSourceNode *DepsgraphNodeBuilder::add_time_source() { return graph_->add_time_source(); } -ComponentDepsNode *DepsgraphNodeBuilder::add_component_node( +ComponentNode *DepsgraphNodeBuilder::add_component_node( ID *id, - eDepsNode_Type comp_type, + NodeType comp_type, const char *comp_name) { - IDDepsNode *id_node = add_id_node(id); - ComponentDepsNode *comp_node = id_node->add_component(comp_type, comp_name); + IDNode *id_node = add_id_node(id); + ComponentNode *comp_node = id_node->add_component(comp_type, comp_name); comp_node->owner = id_node; return comp_node; } -OperationDepsNode *DepsgraphNodeBuilder::add_operation_node( - ComponentDepsNode *comp_node, +OperationNode *DepsgraphNodeBuilder::add_operation_node( + ComponentNode *comp_node, const DepsEvalOperationCb& op, - eDepsOperation_Code opcode, + OperationCode opcode, const char *name, int name_tag) { - OperationDepsNode *op_node = comp_node->find_operation(opcode, + OperationNode *op_node = comp_node->find_operation(opcode, name, name_tag); if (op_node == NULL) { @@ -241,24 +238,24 @@ OperationDepsNode *DepsgraphNodeBuilder::add_operation_node( return op_node; } -OperationDepsNode *DepsgraphNodeBuilder::add_operation_node( +OperationNode *DepsgraphNodeBuilder::add_operation_node( ID *id, - eDepsNode_Type comp_type, + NodeType comp_type, const char *comp_name, const DepsEvalOperationCb& op, - eDepsOperation_Code opcode, + OperationCode opcode, const char *name, int name_tag) { - ComponentDepsNode *comp_node = add_component_node(id, comp_type, comp_name); + ComponentNode *comp_node = add_component_node(id, comp_type, comp_name); return add_operation_node(comp_node, op, opcode, name, name_tag); } -OperationDepsNode *DepsgraphNodeBuilder::add_operation_node( +OperationNode *DepsgraphNodeBuilder::add_operation_node( ID *id, - eDepsNode_Type comp_type, + NodeType comp_type, const DepsEvalOperationCb& op, - eDepsOperation_Code opcode, + OperationCode opcode, const char *name, int name_tag) { @@ -271,15 +268,15 @@ OperationDepsNode *DepsgraphNodeBuilder::add_operation_node( name_tag); } -OperationDepsNode *DepsgraphNodeBuilder::ensure_operation_node( +OperationNode *DepsgraphNodeBuilder::ensure_operation_node( ID *id, - eDepsNode_Type comp_type, + NodeType comp_type, const DepsEvalOperationCb& op, - eDepsOperation_Code opcode, + OperationCode opcode, const char *name, int name_tag) { - OperationDepsNode *operation = + OperationNode *operation = find_operation_node(id, comp_type, opcode, name, name_tag); if (operation != NULL) { return operation; @@ -288,9 +285,9 @@ OperationDepsNode *DepsgraphNodeBuilder::ensure_operation_node( } bool DepsgraphNodeBuilder::has_operation_node(ID *id, - eDepsNode_Type comp_type, + NodeType comp_type, const char *comp_name, - eDepsOperation_Code opcode, + OperationCode opcode, const char *name, int name_tag) { @@ -302,22 +299,22 @@ bool DepsgraphNodeBuilder::has_operation_node(ID *id, name_tag) != NULL; } -OperationDepsNode *DepsgraphNodeBuilder::find_operation_node( +OperationNode *DepsgraphNodeBuilder::find_operation_node( ID *id, - eDepsNode_Type comp_type, + NodeType comp_type, const char *comp_name, - eDepsOperation_Code opcode, + OperationCode opcode, const char *name, int name_tag) { - ComponentDepsNode *comp_node = add_component_node(id, comp_type, comp_name); + ComponentNode *comp_node = add_component_node(id, comp_type, comp_name); return comp_node->find_operation(opcode, name, name_tag); } -OperationDepsNode *DepsgraphNodeBuilder::find_operation_node( +OperationNode *DepsgraphNodeBuilder::find_operation_node( ID *id, - eDepsNode_Type comp_type, - eDepsOperation_Code opcode, + NodeType comp_type, + OperationCode opcode, const char *name, int name_tag) { @@ -335,7 +332,7 @@ ID *DepsgraphNodeBuilder::ensure_cow_id(ID *id_orig) /* ID is already remapped to copy-on-write. */ return id_orig; } - IDDepsNode *id_node = add_id_node(id_orig); + IDNode *id_node = add_id_node(id_orig); return id_node->id_cow; } @@ -344,10 +341,9 @@ ID *DepsgraphNodeBuilder::ensure_cow_id(ID *id_orig) void DepsgraphNodeBuilder::begin_build() { /* Store existing copy-on-write versions of datablock, so we can re-use - * them for new ID nodes. - */ + * them for new ID nodes. */ id_info_hash_ = BLI_ghash_ptr_new("Depsgraph id hash"); - foreach (IDDepsNode *id_node, graph_->id_nodes) { + for (IDNode *id_node : graph_->id_nodes) { IDInfo *id_info = (IDInfo *)MEM_mallocN( sizeof(IDInfo), "depsgraph id info"); if (deg_copy_on_write_is_expanded(id_node->id_cow) && @@ -366,10 +362,10 @@ void DepsgraphNodeBuilder::begin_build() id_node->id_cow = NULL; } - GSET_FOREACH_BEGIN(OperationDepsNode *, op_node, graph_->entry_tags) + GSET_FOREACH_BEGIN(OperationNode *, op_node, graph_->entry_tags) { - ComponentDepsNode *comp_node = op_node->owner; - IDDepsNode *id_node = comp_node->owner; + ComponentNode *comp_node = op_node->owner; + IDNode *id_node = comp_node->owner; SavedEntryTag entry_tag; entry_tag.id_orig = id_node->id_orig; @@ -389,23 +385,22 @@ void DepsgraphNodeBuilder::begin_build() void DepsgraphNodeBuilder::end_build() { - foreach (const SavedEntryTag& entry_tag, saved_entry_tags_) { - IDDepsNode *id_node = find_id_node(entry_tag.id_orig); + for (const SavedEntryTag& entry_tag : saved_entry_tags_) { + IDNode *id_node = find_id_node(entry_tag.id_orig); if (id_node == NULL) { continue; } - ComponentDepsNode *comp_node = + ComponentNode *comp_node = id_node->find_component(entry_tag.component_type); if (comp_node == NULL) { continue; } - OperationDepsNode *op_node = comp_node->find_operation(entry_tag.opcode, entry_tag.name, entry_tag.name_tag); + OperationNode *op_node = comp_node->find_operation(entry_tag.opcode, entry_tag.name, entry_tag.name_tag); if (op_node == NULL) { continue; } /* Since the tag is coming from a saved copy of entry tags, this means - * that originally node was explicitly tagged for user update. - */ + * that originally node was explicitly tagged for user update. */ op_node->tag_update(graph_, DEG_UPDATE_SOURCE_USER_EDIT); } } @@ -438,8 +433,7 @@ void DepsgraphNodeBuilder::build_id(ID *id) * * If this happened to be affecting visible object, then it is up to * deg_graph_build_flush_visibility() to ensure visibility of the - * object is true. - */ + * object is true. */ build_object(-1, (Object *)id, DEG_ID_LINKED_INDIRECTLY, false); break; case ID_KE: @@ -479,8 +473,7 @@ void DepsgraphNodeBuilder::build_id(ID *id) /* TODO(sergey): Get visibility from a "parent" somehow. * * NOTE: Similarly to above, we don't want false-positives on - * visibility. - */ + * visibility. */ build_object_data_geometry_datablock(id, false); break; case ID_SPK: @@ -509,7 +502,7 @@ void DepsgraphNodeBuilder::build_collection( const bool is_collection_restricted = (collection->flag & restrict_flag); const bool is_collection_visible = !is_collection_restricted && is_parent_collection_visible_; - IDDepsNode *id_node; + IDNode *id_node; if (built_map_.checkIsBuiltAndTag(collection)) { id_node = find_id_node(&collection->id); if (is_collection_visible && @@ -564,10 +557,9 @@ void DepsgraphNodeBuilder::build_object(int base_index, const bool has_object = built_map_.checkIsBuiltAndTag(object); /* Skip rest of components if the ID node was already there. */ if (has_object) { - IDDepsNode *id_node = find_id_node(&object->id); + IDNode *id_node = find_id_node(&object->id); /* We need to build some extra stuff if object becomes linked - * directly. - */ + * directly. */ if (id_node->linked_state == DEG_ID_LINKED_INDIRECTLY) { build_object_flags(base_index, object, linked_state); } @@ -578,7 +570,7 @@ void DepsgraphNodeBuilder::build_object(int base_index, return; } /* Create ID node for object and begin init. */ - IDDepsNode *id_node = add_id_node(&object->id); + IDNode *id_node = add_id_node(&object->id); Object *object_cow = get_cow_datablock(object); id_node->linked_state = linked_state; if (object == scene_->camera) { @@ -630,12 +622,11 @@ void DepsgraphNodeBuilder::build_object(int base_index, * * Do it now because it's possible object data will affect * on object's level animation, for example in case of rebuilding - * pose for proxy. - */ - OperationDepsNode *op_node = add_operation_node(&object->id, - DEG_NODE_TYPE_PARAMETERS, + * pose for proxy. */ + OperationNode *op_node = add_operation_node(&object->id, + NodeType::PARAMETERS, NULL, - DEG_OPCODE_PARAMETERS_EVAL); + OperationCode::PARAMETERS_EVAL); op_node->set_as_exit(); build_animdata(&object->id); /* Particle systems. */ @@ -659,18 +650,18 @@ void DepsgraphNodeBuilder::build_object(int base_index, build_collection(NULL, object->dup_group); is_parent_collection_visible_ = is_current_parent_collection_visible; add_operation_node(&object->id, - DEG_NODE_TYPE_DUPLI, + NodeType::DUPLI, NULL, - DEG_OPCODE_PLACEHOLDER, + OperationCode::PLACEHOLDER, "Dupli"); } /* Syncronization back to original object. */ add_operation_node(&object->id, - DEG_NODE_TYPE_SYNCHRONIZE, + NodeType::SYNCHRONIZE, function_bind(BKE_object_synchronize_to_original, _1, object_cow), - DEG_OPCODE_SYNCHRONIZE_TO_ORIGINAL); + OperationCode::SYNCHRONIZE_TO_ORIGINAL); } void DepsgraphNodeBuilder::build_object_flags( @@ -686,14 +677,14 @@ void DepsgraphNodeBuilder::build_object_flags( const bool is_from_set = (linked_state == DEG_ID_LINKED_VIA_SET); /* TODO(sergey): Is this really best component to be used? */ add_operation_node(&object->id, - DEG_NODE_TYPE_OBJECT_FROM_LAYER, + NodeType::OBJECT_FROM_LAYER, function_bind(BKE_object_eval_flush_base_flags, _1, scene_cow, view_layer_index_, object_cow, base_index, is_from_set), - DEG_OPCODE_OBJECT_BASE_FLAGS); + OperationCode::OBJECT_BASE_FLAGS); } void DepsgraphNodeBuilder::build_object_data( @@ -761,9 +752,9 @@ void DepsgraphNodeBuilder::build_object_data_lightprobe(Object *object) LightProbe *probe = (LightProbe *)object->data; build_lightprobe(probe); add_operation_node(&object->id, - DEG_NODE_TYPE_PARAMETERS, + NodeType::PARAMETERS, NULL, - DEG_OPCODE_LIGHT_PROBE_EVAL); + OperationCode::LIGHT_PROBE_EVAL); } void DepsgraphNodeBuilder::build_object_data_speaker(Object *object) @@ -771,31 +762,31 @@ void DepsgraphNodeBuilder::build_object_data_speaker(Object *object) Speaker *speaker = (Speaker *)object->data; build_speaker(speaker); add_operation_node(&object->id, - DEG_NODE_TYPE_PARAMETERS, + NodeType::PARAMETERS, NULL, - DEG_OPCODE_SPEAKER_EVAL); + OperationCode::SPEAKER_EVAL); } void DepsgraphNodeBuilder::build_object_transform(Object *object) { - OperationDepsNode *op_node; + OperationNode *op_node; Object *ob_cow = get_cow_datablock(object); /* local transforms (from transform channels - loc/rot/scale + deltas) */ - op_node = add_operation_node(&object->id, DEG_NODE_TYPE_TRANSFORM, + op_node = add_operation_node(&object->id, NodeType::TRANSFORM, function_bind(BKE_object_eval_local_transform, _1, ob_cow), - DEG_OPCODE_TRANSFORM_LOCAL); + OperationCode::TRANSFORM_LOCAL); op_node->set_as_entry(); /* object parent */ if (object->parent != NULL) { - add_operation_node(&object->id, DEG_NODE_TYPE_TRANSFORM, + add_operation_node(&object->id, NodeType::TRANSFORM, function_bind(BKE_object_eval_parent, _1, ob_cow), - DEG_OPCODE_TRANSFORM_PARENT); + OperationCode::TRANSFORM_PARENT); } /* object constraints */ @@ -804,18 +795,18 @@ void DepsgraphNodeBuilder::build_object_transform(Object *object) } /* Rest of transformation update. */ - add_operation_node(&object->id, DEG_NODE_TYPE_TRANSFORM, + add_operation_node(&object->id, NodeType::TRANSFORM, function_bind(BKE_object_eval_uber_transform, _1, ob_cow), - DEG_OPCODE_TRANSFORM_OBJECT_UBEREVAL); + OperationCode::TRANSFORM_OBJECT_UBEREVAL); /* object transform is done */ - op_node = add_operation_node(&object->id, DEG_NODE_TYPE_TRANSFORM, + op_node = add_operation_node(&object->id, NodeType::TRANSFORM, function_bind(BKE_object_eval_transform_final, _1, ob_cow), - DEG_OPCODE_TRANSFORM_FINAL); + OperationCode::TRANSFORM_FINAL); op_node->set_as_exit(); } @@ -839,12 +830,12 @@ void DepsgraphNodeBuilder::build_object_transform(Object *object) void DepsgraphNodeBuilder::build_object_constraints(Object *object) { /* create node for constraint stack */ - add_operation_node(&object->id, DEG_NODE_TYPE_TRANSFORM, + add_operation_node(&object->id, NodeType::TRANSFORM, function_bind(BKE_object_eval_constraints, _1, get_cow_datablock(scene_), get_cow_datablock(object)), - DEG_OPCODE_TRANSFORM_CONSTRAINTS); + OperationCode::TRANSFORM_CONSTRAINTS); } void DepsgraphNodeBuilder::build_object_pointcache(Object *object) @@ -855,12 +846,12 @@ void DepsgraphNodeBuilder::build_object_pointcache(Object *object) Scene *scene_cow = get_cow_datablock(scene_); Object *object_cow = get_cow_datablock(object); add_operation_node(&object->id, - DEG_NODE_TYPE_POINT_CACHE, + NodeType::POINT_CACHE, function_bind(BKE_object_eval_ptcache_reset, _1, scene_cow, object_cow), - DEG_OPCODE_POINT_CACHE_RESET); + OperationCode::POINT_CACHE_RESET); } /** @@ -885,21 +876,19 @@ void DepsgraphNodeBuilder::build_animdata(ID *id) // may need it... /* actions and NLA - as a single unit for now, as it gets complicated to - * schedule otherwise. - */ + * schedule otherwise. */ if ((adt->action) || (adt->nla_tracks.first)) { /* create the node */ - add_operation_node(id, DEG_NODE_TYPE_ANIMATION, + add_operation_node(id, NodeType::ANIMATION, function_bind(BKE_animsys_eval_animdata, _1, id_cow), - DEG_OPCODE_ANIMATION, + OperationCode::ANIMATION, id->name); /* TODO: for each channel affected, we might also want to add some * support for running RNA update callbacks on them - * (which will be needed for proper handling of drivers later) - */ + * (which will be needed for proper handling of drivers later) */ } /* NLA strips contain actions */ @@ -934,9 +923,9 @@ void DepsgraphNodeBuilder::build_action(bAction *action) return; } add_operation_node(&action->id, - DEG_NODE_TYPE_ANIMATION, + NodeType::ANIMATION, NULL, - DEG_OPCODE_ANIMATION); + OperationCode::ANIMATION); } /** @@ -956,9 +945,9 @@ void DepsgraphNodeBuilder::build_driver(ID *id, FCurve *fcurve, int driver_index * the animation systems allocates an array so we can do a fast lookup * with the driver index. */ ensure_operation_node(id, - DEG_NODE_TYPE_PARAMETERS, + NodeType::PARAMETERS, function_bind(BKE_animsys_eval_driver, _1, id_cow, driver_index, driver_orig), - DEG_OPCODE_DRIVER, + OperationCode::DRIVER, fcurve->rna_path ? fcurve->rna_path : "", fcurve->array_index); build_driver_variables(id, fcurve); @@ -1008,9 +997,9 @@ void DepsgraphNodeBuilder::build_driver_id_property(ID *id, } const char *prop_identifier = RNA_property_identifier((PropertyRNA *)prop); ensure_operation_node(id, - DEG_NODE_TYPE_PARAMETERS, + NodeType::PARAMETERS, NULL, - DEG_OPCODE_ID_PROPERTY, + OperationCode::ID_PROPERTY, prop_identifier); } @@ -1025,11 +1014,11 @@ void DepsgraphNodeBuilder::build_world(World *world) World *world_cow = get_cow_datablock(world); /* Shading update. */ add_operation_node(&world->id, - DEG_NODE_TYPE_SHADING, + NodeType::SHADING, function_bind(BKE_world_eval, _1, world_cow), - DEG_OPCODE_WORLD_UPDATE); + OperationCode::WORLD_UPDATE); /* Animation. */ build_animdata(&world->id); /* World's nodetree. */ @@ -1055,8 +1044,7 @@ void DepsgraphNodeBuilder::build_rigidbody(Scene *scene) * and/or not affected by the sim for instance). * * 3) "Pull Results" - grab the specific transforms applied for a specific - * object - performed as part of object's transform-stack building. - */ + * object - performed as part of object's transform-stack building. */ /* Create nodes --------------------------------------------------------- */ @@ -1064,14 +1052,14 @@ void DepsgraphNodeBuilder::build_rigidbody(Scene *scene) * instead? */ /* Init/rebuild operation. */ - add_operation_node(&scene->id, DEG_NODE_TYPE_TRANSFORM, + add_operation_node(&scene->id, NodeType::TRANSFORM, function_bind(BKE_rigidbody_rebuild_sim, _1, scene_cow), - DEG_OPCODE_RIGIDBODY_REBUILD); + OperationCode::RIGIDBODY_REBUILD); /* Do-sim operation. */ - OperationDepsNode *sim_node = add_operation_node( - &scene->id, DEG_NODE_TYPE_TRANSFORM, + OperationNode *sim_node = add_operation_node( + &scene->id, NodeType::TRANSFORM, function_bind(BKE_rigidbody_eval_simulation, _1, scene_cow), - DEG_OPCODE_RIGIDBODY_SIM); + OperationCode::RIGIDBODY_SIM); sim_node->set_as_entry(); sim_node->set_as_exit(); sim_node->owner->entry_operation = sim_node; @@ -1086,13 +1074,13 @@ void DepsgraphNodeBuilder::build_rigidbody(Scene *scene) /* 2) create operation for flushing results */ /* object's transform component - where the rigidbody operation * lives. */ - add_operation_node(&object->id, DEG_NODE_TYPE_TRANSFORM, + add_operation_node(&object->id, NodeType::TRANSFORM, function_bind( BKE_rigidbody_object_sync_transforms, _1, scene_cow, get_cow_datablock(object)), - DEG_OPCODE_RIGIDBODY_TRANSFORM_COPY); + OperationCode::RIGIDBODY_TRANSFORM_COPY); } FOREACH_COLLECTION_OBJECT_RECURSIVE_END; } @@ -1129,19 +1117,18 @@ void DepsgraphNodeBuilder::build_particle_systems(Object *object, * systems. * 2) Particle System Eval Operation - This operation node acts as a * blackbox evaluation step for one particle system referenced by - * the particle systems stack. All dependencies link to this operation. - */ + * the particle systems stack. All dependencies link to this operation. */ /* Component for all particle systems. */ - ComponentDepsNode *psys_comp = - add_component_node(&object->id, DEG_NODE_TYPE_PARTICLE_SYSTEM); + ComponentNode *psys_comp = + add_component_node(&object->id, NodeType::PARTICLE_SYSTEM); Object *ob_cow = get_cow_datablock(object); - OperationDepsNode *op_node; + OperationNode *op_node; op_node = add_operation_node(psys_comp, function_bind(BKE_particle_system_eval_init, _1, ob_cow), - DEG_OPCODE_PARTICLE_SYSTEM_INIT); + OperationCode::PARTICLE_SYSTEM_INIT); op_node->set_as_entry(); /* Build all particle systems. */ LISTBASE_FOREACH (ParticleSystem *, psys, &object->particlesystem) { @@ -1153,7 +1140,7 @@ void DepsgraphNodeBuilder::build_particle_systems(Object *object, /* Particle system evaluation. */ add_operation_node(psys_comp, NULL, - DEG_OPCODE_PARTICLE_SYSTEM_EVAL, + OperationCode::PARTICLE_SYSTEM_EVAL, psys->name); /* Keyed particle targets. */ if (part->phystype == PART_PHYS_KEYED) { @@ -1188,7 +1175,7 @@ void DepsgraphNodeBuilder::build_particle_systems(Object *object, } op_node = add_operation_node(psys_comp, NULL, - DEG_OPCODE_PARTICLE_SYSTEM_DONE); + OperationCode::PARTICLE_SYSTEM_DONE); op_node->set_as_exit(); } @@ -1204,22 +1191,22 @@ void DepsgraphNodeBuilder::build_particle_settings( /* Animation data. */ build_animdata(&particle_settings->id); /* Parameters change. */ - OperationDepsNode *op_node; + OperationNode *op_node; op_node = add_operation_node(&particle_settings->id, - DEG_NODE_TYPE_PARTICLE_SETTINGS, + NodeType::PARTICLE_SETTINGS, NULL, - DEG_OPCODE_PARTICLE_SETTINGS_INIT); + OperationCode::PARTICLE_SETTINGS_INIT); op_node->set_as_entry(); add_operation_node(&particle_settings->id, - DEG_NODE_TYPE_PARTICLE_SETTINGS, + NodeType::PARTICLE_SETTINGS, function_bind(BKE_particle_settings_eval_reset, _1, particle_settings_cow), - DEG_OPCODE_PARTICLE_SETTINGS_RESET); + OperationCode::PARTICLE_SETTINGS_RESET); op_node = add_operation_node(&particle_settings->id, - DEG_NODE_TYPE_PARTICLE_SETTINGS, + NodeType::PARTICLE_SETTINGS, NULL, - DEG_OPCODE_PARTICLE_SETTINGS_EVAL); + OperationCode::PARTICLE_SETTINGS_EVAL); op_node->set_as_exit(); /* Texture slots. */ for (int mtex_index = 0; mtex_index < MAX_MTEX; ++mtex_index) { @@ -1241,16 +1228,16 @@ void DepsgraphNodeBuilder::build_shapekeys(Key *key) /* This is an exit operation for the entire key datablock, is what is used * as dependency for modifiers evaluation. */ add_operation_node(&key->id, - DEG_NODE_TYPE_GEOMETRY, + NodeType::GEOMETRY, NULL, - DEG_OPCODE_GEOMETRY_SHAPEKEY); + OperationCode::GEOMETRY_SHAPEKEY); /* Create per-key block properties, allowing tricky inter-dependnecies for * drivers evaluation. */ LISTBASE_FOREACH (KeyBlock *, key_block, &key->block) { add_operation_node(&key->id, - DEG_NODE_TYPE_PARAMETERS, + NodeType::PARAMETERS, NULL, - DEG_OPCODE_PARAMETERS_EVAL, + OperationCode::PARAMETERS_EVAL, key_block->name); } } @@ -1261,7 +1248,7 @@ void DepsgraphNodeBuilder::build_object_data_geometry( Object *object, bool is_object_visible) { - OperationDepsNode *op_node; + OperationNode *op_node; Scene *scene_cow = get_cow_datablock(scene_); Object *object_cow = get_cow_datablock(object); /* Temporary uber-update node, which does everything. @@ -1269,32 +1256,31 @@ void DepsgraphNodeBuilder::build_object_data_geometry( * We'll get rid of this node as soon as all the granular update functions * are filled in. * - * TODO(sergey): Get rid of this node. - */ + * TODO(sergey): Get rid of this node. */ op_node = add_operation_node(&object->id, - DEG_NODE_TYPE_GEOMETRY, + NodeType::GEOMETRY, function_bind(BKE_object_eval_uber_data, _1, scene_cow, object_cow), - DEG_OPCODE_GEOMETRY_UBEREVAL); + OperationCode::GEOMETRY_UBEREVAL); op_node->set_as_exit(); op_node = add_operation_node(&object->id, - DEG_NODE_TYPE_GEOMETRY, + NodeType::GEOMETRY, NULL, - DEG_OPCODE_PLACEHOLDER, + OperationCode::PLACEHOLDER, "Eval Init"); op_node->set_as_entry(); /* Materials. */ if (object->totcol != 0) { if (object->type == OB_MESH) { add_operation_node(&object->id, - DEG_NODE_TYPE_SHADING, + NodeType::SHADING, function_bind(BKE_object_eval_update_shading, _1, object_cow), - DEG_OPCODE_SHADING); + OperationCode::SHADING); } for (int a = 1; a <= object->totcol; a++) { Material *ma = give_current_material(object, a); @@ -1316,7 +1302,7 @@ void DepsgraphNodeBuilder::build_object_data_geometry_datablock( if (built_map_.checkIsBuiltAndTag(obdata)) { return; } - OperationDepsNode *op_node; + OperationNode *op_node; /* Make sure we've got an ID node before requesting CoW pointer. */ (void) add_id_node((ID *)obdata); ID *obdata_cow = get_cow_id(obdata); @@ -1328,18 +1314,17 @@ void DepsgraphNodeBuilder::build_object_data_geometry_datablock( build_shapekeys(key); } /* Nodes for result of obdata's evaluation, and geometry - * evaluation on object. - */ + * evaluation on object. */ const ID_Type id_type = GS(obdata->name); switch (id_type) { case ID_ME: { op_node = add_operation_node(obdata, - DEG_NODE_TYPE_GEOMETRY, + NodeType::GEOMETRY, function_bind(BKE_mesh_eval_geometry, _1, (Mesh *)obdata_cow), - DEG_OPCODE_PLACEHOLDER, + OperationCode::PLACEHOLDER, "Geometry Eval"); op_node->set_as_entry(); break; @@ -1347,9 +1332,9 @@ void DepsgraphNodeBuilder::build_object_data_geometry_datablock( case ID_MB: { op_node = add_operation_node(obdata, - DEG_NODE_TYPE_GEOMETRY, + NodeType::GEOMETRY, NULL, - DEG_OPCODE_PLACEHOLDER, + OperationCode::PLACEHOLDER, "Geometry Eval"); op_node->set_as_entry(); break; @@ -1357,16 +1342,15 @@ void DepsgraphNodeBuilder::build_object_data_geometry_datablock( case ID_CU: { op_node = add_operation_node(obdata, - DEG_NODE_TYPE_GEOMETRY, + NodeType::GEOMETRY, function_bind(BKE_curve_eval_geometry, _1, (Curve *)obdata_cow), - DEG_OPCODE_PLACEHOLDER, + OperationCode::PLACEHOLDER, "Geometry Eval"); op_node->set_as_entry(); /* Make sure objects used for bevel.taper are in the graph. - * NOTE: This objects might be not linked to the scene. - */ + * NOTE: This objects might be not linked to the scene. */ Curve *cu = (Curve *)obdata; if (cu->bevobj != NULL) { build_object(-1, @@ -1391,11 +1375,11 @@ void DepsgraphNodeBuilder::build_object_data_geometry_datablock( case ID_LT: { op_node = add_operation_node(obdata, - DEG_NODE_TYPE_GEOMETRY, + NodeType::GEOMETRY, function_bind(BKE_lattice_eval_geometry, _1, (Lattice *)obdata_cow), - DEG_OPCODE_PLACEHOLDER, + OperationCode::PLACEHOLDER, "Geometry Eval"); op_node->set_as_entry(); break; @@ -1405,11 +1389,11 @@ void DepsgraphNodeBuilder::build_object_data_geometry_datablock( { /* GPencil evaluation operations. */ op_node = add_operation_node(obdata, - DEG_NODE_TYPE_GEOMETRY, + NodeType::GEOMETRY, function_bind(BKE_gpencil_eval_geometry, _1, (bGPdata *)obdata_cow), - DEG_OPCODE_PLACEHOLDER, + OperationCode::PLACEHOLDER, "Geometry Eval"); op_node->set_as_entry(); break; @@ -1418,21 +1402,21 @@ void DepsgraphNodeBuilder::build_object_data_geometry_datablock( BLI_assert(!"Should not happen"); break; } - op_node = add_operation_node(obdata, DEG_NODE_TYPE_GEOMETRY, NULL, - DEG_OPCODE_PLACEHOLDER, "Eval Done"); + op_node = add_operation_node(obdata, NodeType::GEOMETRY, NULL, + OperationCode::PLACEHOLDER, "Eval Done"); op_node->set_as_exit(); /* Parameters for driver sources. */ add_operation_node(obdata, - DEG_NODE_TYPE_PARAMETERS, + NodeType::PARAMETERS, NULL, - DEG_OPCODE_PARAMETERS_EVAL); + OperationCode::PARAMETERS_EVAL); /* Batch cache. */ add_operation_node(obdata, - DEG_NODE_TYPE_BATCH_CACHE, + NodeType::BATCH_CACHE, function_bind(BKE_object_data_select_update, _1, obdata_cow), - DEG_OPCODE_GEOMETRY_SELECT_UPDATE); + OperationCode::GEOMETRY_SELECT_UPDATE); } void DepsgraphNodeBuilder::build_armature(bArmature *armature) @@ -1443,9 +1427,9 @@ void DepsgraphNodeBuilder::build_armature(bArmature *armature) build_animdata(&armature->id); /* Make sure pose is up-to-date with armature updates. */ add_operation_node(&armature->id, - DEG_NODE_TYPE_PARAMETERS, + NodeType::PARAMETERS, NULL, - DEG_OPCODE_PLACEHOLDER, + OperationCode::PLACEHOLDER, "Armature Eval"); } @@ -1454,12 +1438,12 @@ void DepsgraphNodeBuilder::build_camera(Camera *camera) if (built_map_.checkIsBuiltAndTag(camera)) { return; } - OperationDepsNode *op_node; + OperationNode *op_node; build_animdata(&camera->id); op_node = add_operation_node(&camera->id, - DEG_NODE_TYPE_PARAMETERS, + NodeType::PARAMETERS, NULL, - DEG_OPCODE_PARAMETERS_EVAL); + OperationCode::PARAMETERS_EVAL); op_node->set_as_exit(); } @@ -1468,12 +1452,12 @@ void DepsgraphNodeBuilder::build_lamp(Lamp *lamp) if (built_map_.checkIsBuiltAndTag(lamp)) { return; } - OperationDepsNode *op_node; + OperationNode *op_node; build_animdata(&lamp->id); op_node = add_operation_node(&lamp->id, - DEG_NODE_TYPE_PARAMETERS, + NodeType::PARAMETERS, NULL, - DEG_OPCODE_PARAMETERS_EVAL); + OperationCode::PARAMETERS_EVAL); /* NOTE: We mark this node as both entry and exit. This way we have a * node to link all dependencies for shading (which includes relation to the * lamp object, and incldues relation from node tree) without adding a @@ -1499,19 +1483,18 @@ void DepsgraphNodeBuilder::build_nodetree(bNodeTree *ntree) build_animdata(&ntree->id); /* Shading update. */ add_operation_node(&ntree->id, - DEG_NODE_TYPE_SHADING, + NodeType::SHADING, NULL, - DEG_OPCODE_MATERIAL_UPDATE); + OperationCode::MATERIAL_UPDATE); /* NOTE: We really pass original and CoW node trees here, this is how the - * callback works. Ideally we need to find a better way for that. - */ + * callback works. Ideally we need to find a better way for that. */ add_operation_node(&ntree->id, - DEG_NODE_TYPE_SHADING_PARAMETERS, + NodeType::SHADING_PARAMETERS, function_bind(BKE_nodetree_shading_params_eval, _1, ntree_cow, ntree), - DEG_OPCODE_MATERIAL_UPDATE); + OperationCode::MATERIAL_UPDATE); /* nodetree's nodes... */ LISTBASE_FOREACH (bNode *, bnode, &ntree->nodes) { ID *id = bnode->id; @@ -1534,8 +1517,7 @@ void DepsgraphNodeBuilder::build_nodetree(bNodeTree *ntree) } else if (id_type == ID_SCE) { /* Scenes are used by compositor trees, and handled by render - * pipeline. No need to build dependencies for them here. - */ + * pipeline. No need to build dependencies for them here. */ } else if (id_type == ID_TXT) { /* Ignore script nodes. */ @@ -1569,11 +1551,11 @@ void DepsgraphNodeBuilder::build_material(Material *material) Material *material_cow = get_cow_datablock(material); /* Shading update. */ add_operation_node(&material->id, - DEG_NODE_TYPE_SHADING, + NodeType::SHADING, function_bind(BKE_material_eval, _1, material_cow), - DEG_OPCODE_MATERIAL_UPDATE); + OperationCode::MATERIAL_UPDATE); /* Material animation. */ build_animdata(&material->id); /* Material's nodetree. */ @@ -1597,9 +1579,9 @@ void DepsgraphNodeBuilder::build_texture(Tex *texture) } } add_operation_node(&texture->id, - DEG_NODE_TYPE_GENERIC_DATABLOCK, + NodeType::GENERIC_DATABLOCK, NULL, - DEG_OPCODE_GENERIC_DATABLOCK_UPDATE); + OperationCode::GENERIC_DATABLOCK_UPDATE); } void DepsgraphNodeBuilder::build_image(Image *image) { @@ -1607,9 +1589,9 @@ void DepsgraphNodeBuilder::build_image(Image *image) { return; } add_operation_node(&image->id, - DEG_NODE_TYPE_GENERIC_DATABLOCK, + NodeType::GENERIC_DATABLOCK, NULL, - DEG_OPCODE_GENERIC_DATABLOCK_UPDATE); + OperationCode::GENERIC_DATABLOCK_UPDATE); } void DepsgraphNodeBuilder::build_compositor(Scene *scene) @@ -1617,12 +1599,11 @@ void DepsgraphNodeBuilder::build_compositor(Scene *scene) /* For now, just a plain wrapper? */ // TODO: create compositing component? // XXX: component type undefined! - //graph->get_node(&scene->id, NULL, DEG_NODE_TYPE_COMPOSITING, NULL); + //graph->get_node(&scene->id, NULL, NodeType::COMPOSITING, NULL); /* for now, nodetrees are just parameters; compositing occurs in internals - * of renderer... - */ - add_component_node(&scene->id, DEG_NODE_TYPE_PARAMETERS); + * of renderer... */ + add_component_node(&scene->id, NodeType::PARAMETERS); build_nodetree(scene->nodetree); } @@ -1634,12 +1615,10 @@ void DepsgraphNodeBuilder::build_gpencil(bGPdata *gpd) ID *gpd_id = &gpd->id; /* TODO(sergey): what about multiple users of same datablock? This should - * only get added once. - */ + * only get added once. */ /* The main reason Grease Pencil is included here is because the animation - * (and drivers) need to be hosted somewhere. - */ + * (and drivers) need to be hosted somewhere. */ build_animdata(gpd_id); } @@ -1652,8 +1631,8 @@ void DepsgraphNodeBuilder::build_cachefile(CacheFile *cache_file) /* Animation, */ build_animdata(cache_file_id); /* Cache evaluation itself. */ - add_operation_node(cache_file_id, DEG_NODE_TYPE_CACHE, NULL, - DEG_OPCODE_PLACEHOLDER, "Cache File Update"); + add_operation_node(cache_file_id, NodeType::CACHE, NULL, + OperationCode::PLACEHOLDER, "Cache File Update"); } void DepsgraphNodeBuilder::build_mask(Mask *mask) @@ -1667,14 +1646,14 @@ void DepsgraphNodeBuilder::build_mask(Mask *mask) build_animdata(mask_id); /* Animation based on mask's shapes. */ add_operation_node(mask_id, - DEG_NODE_TYPE_ANIMATION, + NodeType::ANIMATION, function_bind(BKE_mask_eval_animation, _1, mask_cow), - DEG_OPCODE_MASK_ANIMATION); + OperationCode::MASK_ANIMATION); /* Final mask evaluation. */ add_operation_node(mask_id, - DEG_NODE_TYPE_PARAMETERS, + NodeType::PARAMETERS, function_bind(BKE_mask_eval_update, _1, mask_cow), - DEG_OPCODE_MASK_EVAL); + OperationCode::MASK_EVAL); } void DepsgraphNodeBuilder::build_movieclip(MovieClip *clip) @@ -1688,14 +1667,14 @@ void DepsgraphNodeBuilder::build_movieclip(MovieClip *clip) build_animdata(clip_id); /* Movie clip evaluation. */ add_operation_node(clip_id, - DEG_NODE_TYPE_PARAMETERS, + NodeType::PARAMETERS, function_bind(BKE_movieclip_eval_update, _1, clip_cow), - DEG_OPCODE_MOVIECLIP_EVAL); + OperationCode::MOVIECLIP_EVAL); add_operation_node(clip_id, - DEG_NODE_TYPE_BATCH_CACHE, + NodeType::BATCH_CACHE, function_bind(BKE_movieclip_eval_selection_update, _1, clip_cow), - DEG_OPCODE_MOVIECLIP_SELECT_UPDATE); + OperationCode::MOVIECLIP_SELECT_UPDATE); } void DepsgraphNodeBuilder::build_lightprobe(LightProbe *probe) @@ -1705,9 +1684,9 @@ void DepsgraphNodeBuilder::build_lightprobe(LightProbe *probe) } /* Placeholder so we can add relations and tag ID node for update. */ add_operation_node(&probe->id, - DEG_NODE_TYPE_PARAMETERS, + NodeType::PARAMETERS, NULL, - DEG_OPCODE_LIGHT_PROBE_EVAL); + OperationCode::LIGHT_PROBE_EVAL); build_animdata(&probe->id); } @@ -1719,9 +1698,9 @@ void DepsgraphNodeBuilder::build_speaker(Speaker *speaker) } /* Placeholder so we can add relations and tag ID node for update. */ add_operation_node(&speaker->id, - DEG_NODE_TYPE_PARAMETERS, + NodeType::PARAMETERS, NULL, - DEG_OPCODE_SPEAKER_EVAL); + OperationCode::SPEAKER_EVAL); build_animdata(&speaker->id); } diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h index 1db3f5d4e99..7c683f1da97 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h @@ -31,11 +31,12 @@ #pragma once #include "intern/builder/deg_builder_map.h" -#include "intern/depsgraph_types.h" +#include "intern/depsgraph_type.h" #include "DEG_depsgraph.h" -#include "intern/nodes/deg_node_id.h" +#include "intern/node/deg_node_id.h" +#include "intern/node/deg_node_operation.h" struct Base; struct CacheFile; @@ -73,12 +74,12 @@ struct PropertyRNA; namespace DEG { -struct ComponentDepsNode; -struct DepsNode; +struct ComponentNode; +struct Node; struct Depsgraph; -struct IDDepsNode; -struct OperationDepsNode; -struct TimeSourceDepsNode; +struct IDNode; +struct OperationNode; +struct TimeSourceNode; struct DepsgraphNodeBuilder { DepsgraphNodeBuilder(Main *bmain, Depsgraph *graph); @@ -87,8 +88,7 @@ struct DepsgraphNodeBuilder { /* For given original ID get ID which is created by CoW system. */ ID *get_cow_id(const ID *id_orig) const; /* Similar to above, but for the cases when there is no ID node we create - * one. - */ + * one. */ ID *ensure_cow_id(ID *id_orig); /* Helper wrapper function which wraps get_cow_id with a needed type cast. */ @@ -106,59 +106,59 @@ struct DepsgraphNodeBuilder { void begin_build(); void end_build(); - IDDepsNode *add_id_node(ID *id); - IDDepsNode *find_id_node(ID *id); - TimeSourceDepsNode *add_time_source(); + IDNode *add_id_node(ID *id); + IDNode *find_id_node(ID *id); + TimeSourceNode *add_time_source(); - ComponentDepsNode *add_component_node(ID *id, - eDepsNode_Type comp_type, - const char *comp_name = ""); + ComponentNode *add_component_node(ID *id, + NodeType comp_type, + const char *comp_name = ""); - OperationDepsNode *add_operation_node(ComponentDepsNode *comp_node, - const DepsEvalOperationCb& op, - eDepsOperation_Code opcode, - const char *name = "", - int name_tag = -1); - OperationDepsNode *add_operation_node(ID *id, - eDepsNode_Type comp_type, - const char *comp_name, - const DepsEvalOperationCb& op, - eDepsOperation_Code opcode, - const char *name = "", - int name_tag = -1); - OperationDepsNode *add_operation_node(ID *id, - eDepsNode_Type comp_type, - const DepsEvalOperationCb& op, - eDepsOperation_Code opcode, - const char *name = "", - int name_tag = -1); + OperationNode *add_operation_node(ComponentNode *comp_node, + const DepsEvalOperationCb& op, + OperationCode opcode, + const char *name = "", + int name_tag = -1); + OperationNode *add_operation_node(ID *id, + NodeType comp_type, + const char *comp_name, + const DepsEvalOperationCb& op, + OperationCode opcode, + const char *name = "", + int name_tag = -1); + OperationNode *add_operation_node(ID *id, + NodeType comp_type, + const DepsEvalOperationCb& op, + OperationCode opcode, + const char *name = "", + int name_tag = -1); - OperationDepsNode *ensure_operation_node(ID *id, - eDepsNode_Type comp_type, - const DepsEvalOperationCb& op, - eDepsOperation_Code opcode, - const char *name = "", - int name_tag = -1); + OperationNode *ensure_operation_node(ID *id, + NodeType comp_type, + const DepsEvalOperationCb& op, + OperationCode opcode, + const char *name = "", + int name_tag = -1); bool has_operation_node(ID *id, - eDepsNode_Type comp_type, + NodeType comp_type, const char *comp_name, - eDepsOperation_Code opcode, + OperationCode opcode, const char *name = "", int name_tag = -1); - OperationDepsNode *find_operation_node(ID *id, - eDepsNode_Type comp_type, - const char *comp_name, - eDepsOperation_Code opcode, - const char *name = "", + OperationNode *find_operation_node(ID *id, + NodeType comp_type, + const char *comp_name, + OperationCode opcode, + const char *name = "", int name_tag = -1); - OperationDepsNode *find_operation_node(ID *id, - eDepsNode_Type comp_type, - eDepsOperation_Code opcode, - const char *name = "", - int name_tag = -1); + OperationNode *find_operation_node(ID *id, + NodeType comp_type, + OperationCode opcode, + const char *name = "", + int name_tag = -1); void build_id(ID *id); void build_layer_collections(ListBase *lb); @@ -224,14 +224,12 @@ struct DepsgraphNodeBuilder { void build_speaker(Speaker *speaker); /* Per-ID information about what was already in the dependency graph. - * Allows to re-use certain values, to speed up following evaluation. - */ + * Allows to re-use certain values, to speed up following evaluation. */ struct IDInfo { /* Copy-on-written pointer of the corresponding ID. */ ID *id_cow; /* Mask of visible components from previous state of the - * dependency graph. - */ + * dependency graph. */ IDComponentsMask previously_visible_components_mask; /* Special evaluation flag mask from the previous depsgraph. */ uint32_t previous_eval_flags; @@ -242,12 +240,11 @@ struct DepsgraphNodeBuilder { protected: /* Allows to identify an operation which was tagged for update at the time * relations are being updated. We can not reuse operation node pointer - * since it will change during dependency graph construction. - */ + * since it will change during dependency graph construction. */ struct SavedEntryTag { ID *id_orig; - eDepsNode_Type component_type; - eDepsOperation_Code opcode; + NodeType component_type; + OperationCode opcode; const char *name; int name_tag; }; @@ -276,21 +273,18 @@ protected: ViewLayer *view_layer_; int view_layer_index_; /* NOTE: Collection are possibly built recursively, so be careful when - * setting the current state. - */ + * setting the current state. */ Collection *collection_; /* Accumulated flag over the hierarchy opf currently building collections. * Denotes whether all the hierarchy from parent of collection_ to the - * very root is visible (aka not restricted.). - */ + * very root is visible (aka not restricted.). */ bool is_parent_collection_visible_; /* Indexed by original ID, values are IDInfo. */ GHash *id_info_hash_; /* Set of IDs which were already build. Makes it easier to keep track of - * what was already built and what was not. - */ + * what was already built and what was not. */ BuilderMap built_map_; }; diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc index 083153185dd..4fcf825eaa0 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc @@ -58,12 +58,10 @@ extern "C" { #include "intern/builder/deg_builder.h" #include "intern/eval/deg_eval_copy_on_write.h" -#include "intern/nodes/deg_node.h" -#include "intern/nodes/deg_node_component.h" -#include "intern/nodes/deg_node_operation.h" -#include "intern/depsgraph_types.h" -#include "intern/depsgraph_intern.h" -#include "util/deg_util_foreach.h" +#include "intern/node/deg_node.h" +#include "intern/node/deg_node_component.h" +#include "intern/node/deg_node_operation.h" +#include "intern/depsgraph_type.h" namespace DEG { @@ -79,13 +77,13 @@ void DepsgraphNodeBuilder::build_pose_constraints( data.is_parent_visible = is_object_visible; BKE_constraints_id_loop(&pchan->constraints, constraint_walk, &data); /* Create node for constraint stack. */ - add_operation_node(&object->id, DEG_NODE_TYPE_BONE, pchan->name, + add_operation_node(&object->id, NodeType::BONE, pchan->name, function_bind(BKE_pose_constraints_evaluate, _1, get_cow_datablock(scene_), get_cow_datablock(object), pchan_index), - DEG_OPCODE_BONE_CONSTRAINTS); + OperationCode::BONE_CONSTRAINTS); } /* IK Solver Eval Steps */ @@ -101,8 +99,8 @@ void DepsgraphNodeBuilder::build_ik_pose(Object *object, return; } - if (has_operation_node(&object->id, DEG_NODE_TYPE_EVAL_POSE, rootchan->name, - DEG_OPCODE_POSE_IK_SOLVER)) + if (has_operation_node(&object->id, NodeType::EVAL_POSE, rootchan->name, + OperationCode::POSE_IK_SOLVER)) { return; } @@ -110,13 +108,13 @@ void DepsgraphNodeBuilder::build_ik_pose(Object *object, int rootchan_index = BLI_findindex(&object->pose->chanbase, rootchan); BLI_assert(rootchan_index != -1); /* Operation node for evaluating/running IK Solver. */ - add_operation_node(&object->id, DEG_NODE_TYPE_EVAL_POSE, rootchan->name, + add_operation_node(&object->id, NodeType::EVAL_POSE, rootchan->name, function_bind(BKE_pose_iktree_evaluate, _1, get_cow_datablock(scene_), get_cow_datablock(object), rootchan_index), - DEG_OPCODE_POSE_IK_SOLVER); + OperationCode::POSE_IK_SOLVER); } /* Spline IK Eval Steps */ @@ -131,17 +129,16 @@ void DepsgraphNodeBuilder::build_splineik_pose(Object *object, /* Operation node for evaluating/running Spline IK Solver. * Store the "root bone" of this chain in the solver, so it knows where to - * start. - */ + * start. */ int rootchan_index = BLI_findindex(&object->pose->chanbase, rootchan); BLI_assert(rootchan_index != -1); - add_operation_node(&object->id, DEG_NODE_TYPE_EVAL_POSE, rootchan->name, + add_operation_node(&object->id, NodeType::EVAL_POSE, rootchan->name, function_bind(BKE_pose_splineik_evaluate, _1, get_cow_datablock(scene_), get_cow_datablock(object), rootchan_index), - DEG_OPCODE_POSE_SPLINE_IK_SOLVER); + OperationCode::POSE_SPLINE_IK_SOLVER); } /* Pose/Armature Bones Graph */ @@ -150,7 +147,7 @@ void DepsgraphNodeBuilder::build_rig(Object *object, bool is_object_visible) bArmature *armature = (bArmature *)object->data; Scene *scene_cow = get_cow_datablock(scene_); Object *object_cow = get_cow_datablock(object); - OperationDepsNode *op_node; + OperationNode *op_node; /* Animation and/or drivers linking posebones to base-armature used to * define them. * @@ -158,8 +155,7 @@ void DepsgraphNodeBuilder::build_rig(Object *object, bool is_object_visible) * which ideally should be able to be unique across different * instances. Eventually, we need some type of proxy/isolation * mechanism in-between here to ensure that we can use same rig - * multiple times in same scene. - */ + * multiple times in same scene. */ /* Armature. */ build_armature(armature); /* Rebuild pose if not up to date. */ @@ -193,75 +189,74 @@ void DepsgraphNodeBuilder::build_rig(Object *object, bool is_object_visible) * and constraint stack) so that they can be easily found. * - Everything else which depends on bone-results hook up to the component * only so that we can redirect those to point at either the the post-IK/ - * post-constraint/post-matrix steps, as needed. - */ + * post-constraint/post-matrix steps, as needed. */ /* Pose eval context. */ op_node = add_operation_node(&object->id, - DEG_NODE_TYPE_EVAL_POSE, + NodeType::EVAL_POSE, function_bind(BKE_pose_eval_init, _1, scene_cow, object_cow), - DEG_OPCODE_POSE_INIT); + OperationCode::POSE_INIT); op_node->set_as_entry(); op_node = add_operation_node(&object->id, - DEG_NODE_TYPE_EVAL_POSE, + NodeType::EVAL_POSE, function_bind(BKE_pose_eval_init_ik, _1, scene_cow, object_cow), - DEG_OPCODE_POSE_INIT_IK); + OperationCode::POSE_INIT_IK); add_operation_node(&object->id, - DEG_NODE_TYPE_EVAL_POSE, + NodeType::EVAL_POSE, function_bind(BKE_pose_eval_cleanup, _1, scene_cow, object_cow), - DEG_OPCODE_POSE_CLEANUP); + OperationCode::POSE_CLEANUP); op_node = add_operation_node(&object->id, - DEG_NODE_TYPE_EVAL_POSE, + NodeType::EVAL_POSE, function_bind(BKE_pose_eval_done, _1, object_cow), - DEG_OPCODE_POSE_DONE); + OperationCode::POSE_DONE); op_node->set_as_exit(); /* Bones. */ int pchan_index = 0; LISTBASE_FOREACH (bPoseChannel *, pchan, &object->pose->chanbase) { /* Node for bone evaluation. */ - op_node = add_operation_node(&object->id, DEG_NODE_TYPE_BONE, pchan->name, NULL, - DEG_OPCODE_BONE_LOCAL); + op_node = add_operation_node(&object->id, NodeType::BONE, pchan->name, NULL, + OperationCode::BONE_LOCAL); op_node->set_as_entry(); - add_operation_node(&object->id, DEG_NODE_TYPE_BONE, pchan->name, + add_operation_node(&object->id, NodeType::BONE, pchan->name, function_bind(BKE_pose_eval_bone, _1, scene_cow, object_cow, pchan_index), - DEG_OPCODE_BONE_POSE_PARENT); + OperationCode::BONE_POSE_PARENT); /* NOTE: Dedicated noop for easier relationship construction. */ - add_operation_node(&object->id, DEG_NODE_TYPE_BONE, pchan->name, + add_operation_node(&object->id, NodeType::BONE, pchan->name, NULL, - DEG_OPCODE_BONE_READY); + OperationCode::BONE_READY); - op_node = add_operation_node(&object->id, DEG_NODE_TYPE_BONE, pchan->name, + op_node = add_operation_node(&object->id, NodeType::BONE, pchan->name, function_bind(BKE_pose_bone_done, _1, object_cow, pchan_index), - DEG_OPCODE_BONE_DONE); + OperationCode::BONE_DONE); /* B-Bone shape computation - the real last step if present. */ if (pchan->bone != NULL && pchan->bone->segments > 1) { - op_node = add_operation_node(&object->id, DEG_NODE_TYPE_BONE, pchan->name, + op_node = add_operation_node(&object->id, NodeType::BONE, pchan->name, function_bind(BKE_pose_eval_bbone_segments, _1, object_cow, pchan_index), - DEG_OPCODE_BONE_SEGMENTS); + OperationCode::BONE_SEGMENTS); } op_node->set_as_exit(); @@ -269,9 +264,9 @@ void DepsgraphNodeBuilder::build_rig(Object *object, bool is_object_visible) /* Custom properties. */ if (pchan->prop != NULL) { add_operation_node(&object->id, - DEG_NODE_TYPE_PARAMETERS, + NodeType::PARAMETERS, NULL, - DEG_OPCODE_PARAMETERS_EVAL, + OperationCode::PARAMETERS_EVAL, pchan->name); } /* Build constraints. */ @@ -289,8 +284,7 @@ void DepsgraphNodeBuilder::build_rig(Object *object, bool is_object_visible) * Unsolved Issues: * - Care is needed to ensure that multi-headed trees work out the same * as in ik-tree building - * - Animated chain-lengths are a problem. - */ + * - Animated chain-lengths are a problem. */ LISTBASE_FOREACH (bConstraint *, con, &pchan->constraints) { switch (con->type) { case CONSTRAINT_TYPE_KINEMATIC: @@ -321,7 +315,7 @@ void DepsgraphNodeBuilder::build_rig(Object *object, bool is_object_visible) void DepsgraphNodeBuilder::build_proxy_rig(Object *object) { bArmature *armature = (bArmature *)object->data; - OperationDepsNode *op_node; + OperationNode *op_node; Object *object_cow = get_cow_datablock(object); /* Sanity check. */ BLI_assert(object->pose != NULL); @@ -333,62 +327,62 @@ void DepsgraphNodeBuilder::build_proxy_rig(Object *object) BKE_pose_update_constraint_flags(object->pose); } op_node = add_operation_node(&object->id, - DEG_NODE_TYPE_EVAL_POSE, + NodeType::EVAL_POSE, function_bind(BKE_pose_eval_proxy_init, _1, object_cow), - DEG_OPCODE_POSE_INIT); + OperationCode::POSE_INIT); op_node->set_as_entry(); int pchan_index = 0; LISTBASE_FOREACH (bPoseChannel *, pchan, &object->pose->chanbase) { op_node = add_operation_node(&object->id, - DEG_NODE_TYPE_BONE, + NodeType::BONE, pchan->name, NULL, - DEG_OPCODE_BONE_LOCAL); + OperationCode::BONE_LOCAL); op_node->set_as_entry(); /* Bone is ready for solvers. */ add_operation_node(&object->id, - DEG_NODE_TYPE_BONE, + NodeType::BONE, pchan->name, NULL, - DEG_OPCODE_BONE_READY); + OperationCode::BONE_READY); /* Bone is fully evaluated. */ op_node = add_operation_node( &object->id, - DEG_NODE_TYPE_BONE, + NodeType::BONE, pchan->name, function_bind(BKE_pose_eval_proxy_copy_bone, _1, object_cow, pchan_index), - DEG_OPCODE_BONE_DONE); + OperationCode::BONE_DONE); op_node->set_as_exit(); /* Custom properties. */ if (pchan->prop != NULL) { add_operation_node(&object->id, - DEG_NODE_TYPE_PARAMETERS, + NodeType::PARAMETERS, NULL, - DEG_OPCODE_PARAMETERS_EVAL, + OperationCode::PARAMETERS_EVAL, pchan->name); } pchan_index++; } op_node = add_operation_node(&object->id, - DEG_NODE_TYPE_EVAL_POSE, + NodeType::EVAL_POSE, function_bind(BKE_pose_eval_proxy_cleanup, _1, object_cow), - DEG_OPCODE_POSE_CLEANUP); + OperationCode::POSE_CLEANUP); op_node = add_operation_node(&object->id, - DEG_NODE_TYPE_EVAL_POSE, + NodeType::EVAL_POSE, function_bind(BKE_pose_eval_proxy_done, _1, object_cow), - DEG_OPCODE_POSE_DONE); + OperationCode::POSE_DONE); op_node->set_as_exit(); } diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc index 04cb8d12a0c..f6a3e4ca9b5 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc @@ -57,12 +57,11 @@ extern "C" { #include "DEG_depsgraph_build.h" #include "intern/builder/deg_builder.h" -#include "intern/nodes/deg_node.h" -#include "intern/nodes/deg_node_component.h" -#include "intern/nodes/deg_node_operation.h" -#include "intern/depsgraph_types.h" -#include "intern/depsgraph_intern.h" -#include "util/deg_util_foreach.h" +#include "intern/depsgraph.h" +#include "intern/node/deg_node.h" +#include "intern/node/deg_node_component.h" +#include "intern/node/deg_node_operation.h" +#include "intern/depsgraph_type.h" namespace DEG { @@ -103,8 +102,7 @@ void DepsgraphNodeBuilder::build_view_layer( int select_color = 1; /* NOTE: Base is used for function bindings as-is, so need to pass CoW base, * but object is expected to be an original one. Hence we go into some - * tricks here iterating over the view layer. - */ + * tricks here iterating over the view layer. */ int base_index = 0; const int base_flag = (graph_->mode == DAG_EVAL_VIEWPORT) ? BASE_ENABLED_VIEWPORT : BASE_ENABLED_RENDER; @@ -164,17 +162,17 @@ void DepsgraphNodeBuilder::build_view_layer( } /* Collections. */ add_operation_node(&scene->id, - DEG_NODE_TYPE_LAYER_COLLECTIONS, + NodeType::LAYER_COLLECTIONS, function_bind(BKE_layer_eval_view_layer_indexed, _1, scene_cow, view_layer_index_), - DEG_OPCODE_VIEW_LAYER_EVAL); + OperationCode::VIEW_LAYER_EVAL); /* Parameters evaluation for scene relations mainly. */ add_operation_node(&scene->id, - DEG_NODE_TYPE_PARAMETERS, + NodeType::PARAMETERS, NULL, - DEG_OPCODE_PLACEHOLDER, + OperationCode::PLACEHOLDER, "Scene Eval"); /* Build all set scenes. */ if (scene->set != NULL) { diff --git a/source/blender/depsgraph/intern/builder/deg_builder_pchanmap.cc b/source/blender/depsgraph/intern/builder/deg_builder_pchanmap.cc index 59eb7ed8cf1..e8006a6a5ab 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_pchanmap.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_pchanmap.cc @@ -82,8 +82,7 @@ void RootPChanMap::add_bone(const char *bone, const char *root) { if (BLI_ghash_haskey(map_, bone)) { /* Add new entry, but only add the root if it doesn't already - * exist in there. - */ + * exist in there. */ GSet *values = (GSet *)BLI_ghash_lookup(map_, bone); BLI_gset_add(values, (void *)root); } diff --git a/source/blender/depsgraph/intern/builder/deg_builder_pchanmap.h b/source/blender/depsgraph/intern/builder/deg_builder_pchanmap.h index 233d8602fce..18f1f604a52 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_pchanmap.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_pchanmap.h @@ -54,8 +54,7 @@ protected: * - Values are "sets" (const char *) - not dynamically allocated. * * We don't use the C++ maps here, as it's more convenient to use - * Blender's GHash and be able to compare by-value instead of by-ref. - */ + * Blender's GHash and be able to compare by-value instead of by-ref. */ struct GHash *map_; }; diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index 04d0c6cd02c..0ca1222f5ba 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -104,18 +104,18 @@ extern "C" { #include "intern/builder/deg_builder.h" #include "intern/builder/deg_builder_pchanmap.h" +#include "intern/debug/deg_debug.h" +#include "intern/depsgraph_tag.h" +#include "intern/depsgraph_physics.h" #include "intern/eval/deg_eval_copy_on_write.h" -#include "intern/nodes/deg_node.h" -#include "intern/nodes/deg_node_component.h" -#include "intern/nodes/deg_node_id.h" -#include "intern/nodes/deg_node_operation.h" -#include "intern/nodes/deg_node_time.h" +#include "intern/node/deg_node.h" +#include "intern/node/deg_node_component.h" +#include "intern/node/deg_node_id.h" +#include "intern/node/deg_node_operation.h" +#include "intern/node/deg_node_time.h" -#include "intern/depsgraph_intern.h" -#include "intern/depsgraph_types.h" - -#include "util/deg_util_foreach.h" +#include "intern/depsgraph_type.h" namespace DEG { @@ -138,13 +138,11 @@ static bool python_driver_depends_on_time(ChannelDriver *driver) if (strstr(driver->expression, "frame") != NULL) { /* Variable `frame` depends on time. */ /* TODO(sergey): This is a bit weak, but not sure about better way of - * handling this. - */ + * handling this. */ return true; } /* Possible indirect time relation s should be handled via variable - * targets. - */ + * targets. */ return false; } @@ -186,7 +184,7 @@ static bool check_id_has_anim_component(ID *id) (!BLI_listbase_is_empty(&adt->nla_tracks)); } -static eDepsOperation_Code bone_target_opcode(ID *target, +static OperationCode bone_target_opcode(ID *target, const char *subtarget, ID *id, const char *component_subdata, @@ -197,13 +195,12 @@ static eDepsOperation_Code bone_target_opcode(ID *target, /* Using "done" here breaks in-chain deps, while using * "ready" here breaks most production rigs instead. * So, we do a compromise here, and only do this when an - * IK chain conflict may occur. - */ + * IK chain conflict may occur. */ if (root_map->has_common_root(component_subdata, subtarget)) { - return DEG_OPCODE_BONE_READY; + return OperationCode::BONE_READY; } } - return DEG_OPCODE_BONE_DONE; + return OperationCode::BONE_DONE; } static bool bone_has_segments(Object *object, const char *bone_name) @@ -227,7 +224,7 @@ DepsgraphRelationBuilder::DepsgraphRelationBuilder(Main *bmain, { } -TimeSourceDepsNode *DepsgraphRelationBuilder::get_node( +TimeSourceNode *DepsgraphRelationBuilder::get_node( const TimeSourceKey &key) const { if (key.id) { @@ -239,24 +236,24 @@ TimeSourceDepsNode *DepsgraphRelationBuilder::get_node( } } -ComponentDepsNode *DepsgraphRelationBuilder::get_node( +ComponentNode *DepsgraphRelationBuilder::get_node( const ComponentKey &key) const { - IDDepsNode *id_node = graph_->find_id_node(key.id); + IDNode *id_node = graph_->find_id_node(key.id); if (!id_node) { fprintf(stderr, "find_node component: Could not find ID %s\n", (key.id != NULL) ? key.id->name : ""); return NULL; } - ComponentDepsNode *node = id_node->find_component(key.type, key.name); + ComponentNode *node = id_node->find_component(key.type, key.name); return node; } -OperationDepsNode *DepsgraphRelationBuilder::get_node( +OperationNode *DepsgraphRelationBuilder::get_node( const OperationKey &key) const { - OperationDepsNode *op_node = find_node(key); + OperationNode *op_node = find_node(key); if (op_node == NULL) { fprintf(stderr, "find_node_operation: Failed for (%s, '%s')\n", operationCodeAsString(key.opcode), key.name); @@ -264,19 +261,19 @@ OperationDepsNode *DepsgraphRelationBuilder::get_node( return op_node; } -DepsNode *DepsgraphRelationBuilder::get_node(const RNAPathKey &key) const +Node *DepsgraphRelationBuilder::get_node(const RNAPathKey &key) const { return graph_->find_node_from_pointer(&key.ptr, key.prop, key.source); } -OperationDepsNode *DepsgraphRelationBuilder::find_node( +OperationNode *DepsgraphRelationBuilder::find_node( const OperationKey &key) const { - IDDepsNode *id_node = graph_->find_id_node(key.id); + IDNode *id_node = graph_->find_id_node(key.id); if (!id_node) { return NULL; } - ComponentDepsNode *comp_node = id_node->find_component(key.component_type, + ComponentNode *comp_node = id_node->find_component(key.component_type, key.component_name); if (!comp_node) { return NULL; @@ -292,7 +289,7 @@ bool DepsgraphRelationBuilder::has_node(const OperationKey &key) const void DepsgraphRelationBuilder::add_customdata_mask(Object *object, uint64_t mask) { if (mask != 0 && object != NULL && object->type == OB_MESH) { - DEG::IDDepsNode *id_node = graph_->find_id_node(&object->id); + DEG::IDNode *id_node = graph_->find_id_node(&object->id); if (id_node == NULL) { BLI_assert(!"ID should always be valid"); @@ -305,7 +302,7 @@ void DepsgraphRelationBuilder::add_customdata_mask(Object *object, uint64_t mask void DepsgraphRelationBuilder::add_special_eval_flag(ID *id, uint32_t flag) { - DEG::IDDepsNode *id_node = graph_->find_id_node(id); + DEG::IDNode *id_node = graph_->find_id_node(id); if (id_node == NULL) { BLI_assert(!"ID should always be valid"); } @@ -314,16 +311,15 @@ void DepsgraphRelationBuilder::add_special_eval_flag(ID *id, uint32_t flag) } } -DepsRelation *DepsgraphRelationBuilder::add_time_relation( - TimeSourceDepsNode *timesrc, - DepsNode *node_to, +Relation *DepsgraphRelationBuilder::add_time_relation( + TimeSourceNode *timesrc, + Node *node_to, const char *description, - bool check_unique, int flags) { if (timesrc && node_to) { return graph_->add_new_relation( - timesrc, node_to, description, check_unique, flags); + timesrc, node_to, description, flags); } else { DEG_DEBUG_PRINTF((::Depsgraph *)graph_, @@ -335,18 +331,16 @@ DepsRelation *DepsgraphRelationBuilder::add_time_relation( return NULL; } -DepsRelation *DepsgraphRelationBuilder::add_operation_relation( - OperationDepsNode *node_from, - OperationDepsNode *node_to, +Relation *DepsgraphRelationBuilder::add_operation_relation( + OperationNode *node_from, + OperationNode *node_to, const char *description, - bool check_unique, int flags) { if (node_from && node_to) { return graph_->add_new_relation(node_from, node_to, description, - check_unique, flags); } else { @@ -365,14 +359,14 @@ void DepsgraphRelationBuilder::add_particle_collision_relations( Collection *collection, const char *name) { - ListBase *relations = deg_build_collision_relations(graph_, collection, eModifierType_Collision); + ListBase *relations = build_collision_relations(graph_, collection, eModifierType_Collision); LISTBASE_FOREACH (CollisionRelation *, relation, relations) { if (relation->ob != object) { - ComponentKey trf_key(&relation->ob->id, DEG_NODE_TYPE_TRANSFORM); + ComponentKey trf_key(&relation->ob->id, NodeType::TRANSFORM); add_relation(trf_key, key, name); - ComponentKey coll_key(&relation->ob->id, DEG_NODE_TYPE_GEOMETRY); + ComponentKey coll_key(&relation->ob->id, NodeType::GEOMETRY); add_relation(coll_key, key, name); } } @@ -386,28 +380,28 @@ void DepsgraphRelationBuilder::add_particle_forcefield_relations( bool add_absorption, const char *name) { - ListBase *relations = deg_build_effector_relations(graph_, eff->group); + ListBase *relations = build_effector_relations(graph_, eff->group); LISTBASE_FOREACH (EffectorRelation *, relation, relations) { if (relation->ob != object) { /* Relation to forcefield object, optionally including geometry. */ - ComponentKey eff_key(&relation->ob->id, DEG_NODE_TYPE_TRANSFORM); + ComponentKey eff_key(&relation->ob->id, NodeType::TRANSFORM); add_relation(eff_key, key, name); if (ELEM(relation->pd->shape, PFIELD_SHAPE_SURFACE, PFIELD_SHAPE_POINTS) || relation->pd->forcefield == PFIELD_GUIDE) { - ComponentKey mod_key(&relation->ob->id, DEG_NODE_TYPE_GEOMETRY); + ComponentKey mod_key(&relation->ob->id, NodeType::GEOMETRY); add_relation(mod_key, key, name); } /* Smoke flow relations. */ if (relation->pd->forcefield == PFIELD_SMOKEFLOW && relation->pd->f_source) { ComponentKey trf_key(&relation->pd->f_source->id, - DEG_NODE_TYPE_TRANSFORM); + NodeType::TRANSFORM); add_relation(trf_key, key, "Smoke Force Domain"); ComponentKey eff_key(&relation->pd->f_source->id, - DEG_NODE_TYPE_GEOMETRY); + NodeType::GEOMETRY); add_relation(eff_key, key, "Smoke Force Domain"); } @@ -423,18 +417,17 @@ void DepsgraphRelationBuilder::add_particle_forcefield_relations( if (relation->psys) { if (relation->ob != object) { ComponentKey eff_key(&relation->ob->id, - DEG_NODE_TYPE_PARTICLE_SYSTEM); + NodeType::PARTICLE_SYSTEM); add_relation(eff_key, key, name); /* TODO: remove this when/if EVAL_PARTICLES is sufficient - * for up to date particles. - */ - ComponentKey mod_key(&relation->ob->id, DEG_NODE_TYPE_GEOMETRY); + * for up to date particles. */ + ComponentKey mod_key(&relation->ob->id, NodeType::GEOMETRY); add_relation(mod_key, key, name); } else if (relation->psys != psys) { OperationKey eff_key(&relation->ob->id, - DEG_NODE_TYPE_PARTICLE_SYSTEM, - DEG_OPCODE_PARTICLE_SYSTEM_EVAL, + NodeType::PARTICLE_SYSTEM, + OperationCode::PARTICLE_SYSTEM_EVAL, relation->psys->name); add_relation(eff_key, key, name); } @@ -539,10 +532,10 @@ void DepsgraphRelationBuilder::build_collection( } const bool group_done = built_map_.checkIsBuiltAndTag(collection); OperationKey object_transform_final_key(object != NULL ? &object->id : NULL, - DEG_NODE_TYPE_TRANSFORM, - DEG_OPCODE_TRANSFORM_FINAL); + NodeType::TRANSFORM, + OperationCode::TRANSFORM_FINAL); ComponentKey duplicator_key(object != NULL ? &object->id : NULL, - DEG_NODE_TYPE_DUPLI); + NodeType::DUPLI); if (!group_done) { LISTBASE_FOREACH (CollectionObject *, cob, &collection->gobject) { build_object(NULL, cob->ob); @@ -554,17 +547,16 @@ void DepsgraphRelationBuilder::build_collection( if (object != NULL) { FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN(collection, ob, graph_->mode) { - ComponentKey dupli_transform_key(&ob->id, DEG_NODE_TYPE_TRANSFORM); + ComponentKey dupli_transform_key(&ob->id, NodeType::TRANSFORM); add_relation(dupli_transform_key, object_transform_final_key, "Dupligroup"); /* Hook to special component, to ensure proper visibility/evaluation - * optimizations. - */ + * optimizations. */ add_relation(dupli_transform_key, duplicator_key, "Dupligroup"); - const eDepsNode_Type dupli_geometry_component_type = - deg_geometry_tag_to_component(&ob->id); - if (dupli_geometry_component_type != DEG_NODE_TYPE_UNDEFINED) { + const NodeType dupli_geometry_component_type = + geometry_tag_to_component(&ob->id); + if (dupli_geometry_component_type != NodeType::UNDEFINED) { ComponentKey dupli_geometry_component_key( &ob->id, dupli_geometry_component_type); add_relation(dupli_geometry_component_key, @@ -585,21 +577,21 @@ void DepsgraphRelationBuilder::build_object(Base *base, Object *object) return; } /* Object Transforms */ - eDepsOperation_Code base_op = (object->parent) ? DEG_OPCODE_TRANSFORM_PARENT - : DEG_OPCODE_TRANSFORM_LOCAL; - OperationKey base_op_key(&object->id, DEG_NODE_TYPE_TRANSFORM, base_op); + OperationCode base_op = (object->parent) ? OperationCode::TRANSFORM_PARENT + : OperationCode::TRANSFORM_LOCAL; + OperationKey base_op_key(&object->id, NodeType::TRANSFORM, base_op); OperationKey local_transform_key(&object->id, - DEG_NODE_TYPE_TRANSFORM, - DEG_OPCODE_TRANSFORM_LOCAL); + NodeType::TRANSFORM, + OperationCode::TRANSFORM_LOCAL); OperationKey parent_transform_key(&object->id, - DEG_NODE_TYPE_TRANSFORM, - DEG_OPCODE_TRANSFORM_PARENT); + NodeType::TRANSFORM, + OperationCode::TRANSFORM_PARENT); OperationKey final_transform_key(&object->id, - DEG_NODE_TYPE_TRANSFORM, - DEG_OPCODE_TRANSFORM_FINAL); + NodeType::TRANSFORM, + OperationCode::TRANSFORM_FINAL); OperationKey ob_ubereval_key(&object->id, - DEG_NODE_TYPE_TRANSFORM, - DEG_OPCODE_TRANSFORM_OBJECT_UBEREVAL); + NodeType::TRANSFORM, + OperationCode::TRANSFORM_OBJECT_UBEREVAL); /* Various flags, flushing from bases/collections. */ build_object_flags(base, object); /* Parenting. */ @@ -640,11 +632,11 @@ void DepsgraphRelationBuilder::build_object(Base *base, Object *object) /* Object constraints. */ if (object->constraints.first != NULL) { OperationKey constraint_key(&object->id, - DEG_NODE_TYPE_TRANSFORM, - DEG_OPCODE_TRANSFORM_CONSTRAINTS); + NodeType::TRANSFORM, + OperationCode::TRANSFORM_CONSTRAINTS); /* Constraint relations. */ build_constraints(&object->id, - DEG_NODE_TYPE_TRANSFORM, + NodeType::TRANSFORM, "", &object->constraints, NULL); @@ -658,12 +650,10 @@ void DepsgraphRelationBuilder::build_object(Base *base, Object *object) else { /* NOTE: Keep an eye here, we skip some relations here to "streamline" * dependencies and avoid transitive relations which causes overhead. - * But once we get rid of uber eval node this will need reconsideration. - */ + * But once we get rid of uber eval node this will need reconsideration. */ if (object->rigidbody_object == NULL) { /* Rigid body will hook up another node inbetween, so skip - * relation here to avoid transitive relation. - */ + * relation here to avoid transitive relation. */ add_relation(base_op_key, ob_ubereval_key, "Temp Ubereval"); } add_relation(ob_ubereval_key, final_transform_key, "Temp Ubereval"); @@ -679,15 +669,15 @@ void DepsgraphRelationBuilder::build_object(Base *base, Object *object) /* Proxy object to copy from. */ if (object->proxy_from != NULL) { build_object(NULL, object->proxy_from); - ComponentKey ob_transform_key(&object->proxy_from->id, DEG_NODE_TYPE_TRANSFORM); - ComponentKey proxy_transform_key(&object->id, DEG_NODE_TYPE_TRANSFORM); + ComponentKey ob_transform_key(&object->proxy_from->id, NodeType::TRANSFORM); + ComponentKey proxy_transform_key(&object->id, NodeType::TRANSFORM); add_relation(ob_transform_key, proxy_transform_key, "Proxy Transform"); } if (object->proxy_group != NULL) { build_object(NULL, object->proxy_group); OperationKey proxy_group_ubereval_key(&object->proxy_group->id, - DEG_NODE_TYPE_TRANSFORM, - DEG_OPCODE_TRANSFORM_OBJECT_UBEREVAL); + NodeType::TRANSFORM, + OperationCode::TRANSFORM_OBJECT_UBEREVAL); add_relation(proxy_group_ubereval_key, final_transform_key, "Proxy Group Transform"); } /* Object dupligroup. */ @@ -698,8 +688,8 @@ void DepsgraphRelationBuilder::build_object(Base *base, Object *object) build_object_pointcache(object); /* Syncronization back to original object. */ OperationKey synchronize_key(&object->id, - DEG_NODE_TYPE_SYNCHRONIZE, - DEG_OPCODE_SYNCHRONIZE_TO_ORIGINAL); + NodeType::SYNCHRONIZE, + OperationCode::SYNCHRONIZE_TO_ORIGINAL); add_relation( final_transform_key, synchronize_key, "Synchronize to Original"); } @@ -710,16 +700,16 @@ void DepsgraphRelationBuilder::build_object_flags(Base *base, Object *object) return; } OperationKey view_layer_done_key(&scene_->id, - DEG_NODE_TYPE_LAYER_COLLECTIONS, - DEG_OPCODE_VIEW_LAYER_EVAL); + NodeType::LAYER_COLLECTIONS, + OperationCode::VIEW_LAYER_EVAL); OperationKey object_flags_key(&object->id, - DEG_NODE_TYPE_OBJECT_FROM_LAYER, - DEG_OPCODE_OBJECT_BASE_FLAGS); + NodeType::OBJECT_FROM_LAYER, + OperationCode::OBJECT_BASE_FLAGS); add_relation(view_layer_done_key, object_flags_key, "Base flags flush"); /* Syncronization back to original object. */ OperationKey synchronize_key(&object->id, - DEG_NODE_TYPE_SYNCHRONIZE, - DEG_OPCODE_SYNCHRONIZE_TO_ORIGINAL); + NodeType::SYNCHRONIZE, + OperationCode::SYNCHRONIZE_TO_ORIGINAL); add_relation( object_flags_key, synchronize_key, "Synchronize to Original"); } @@ -746,8 +736,7 @@ void DepsgraphRelationBuilder::build_object_data(Object *object) { build_object_data_geometry(object); /* TODO(sergey): Only for until we support granular - * update of curves. - */ + * update of curves. */ if (object->type == OB_FONT) { Curve *curve = (Curve *)object->data; if (curve->textoncurve) { @@ -779,8 +768,8 @@ void DepsgraphRelationBuilder::build_object_data(Object *object) } Key *key = BKE_key_from_object(object); if (key != NULL) { - ComponentKey geometry_key((ID *)object->data, DEG_NODE_TYPE_GEOMETRY); - ComponentKey key_key(&key->id, DEG_NODE_TYPE_GEOMETRY); + ComponentKey geometry_key((ID *)object->data, NodeType::GEOMETRY); + ComponentKey key_key(&key->id, NodeType::GEOMETRY); add_relation(key_key, geometry_key, "Shapekeys"); build_nested_shapekey(&object->id, key); } @@ -790,8 +779,8 @@ void DepsgraphRelationBuilder::build_object_data_camera(Object *object) { Camera *camera = (Camera *)object->data; build_camera(camera); - ComponentKey object_parameters_key(&object->id, DEG_NODE_TYPE_PARAMETERS); - ComponentKey camera_parameters_key(&camera->id, DEG_NODE_TYPE_PARAMETERS); + ComponentKey object_parameters_key(&object->id, NodeType::PARAMETERS); + ComponentKey camera_parameters_key(&camera->id, NodeType::PARAMETERS); add_relation(camera_parameters_key, object_parameters_key, "Camera -> Object"); } @@ -799,8 +788,8 @@ void DepsgraphRelationBuilder::build_object_data_lamp(Object *object) { Lamp *lamp = (Lamp *)object->data; build_lamp(lamp); - ComponentKey object_parameters_key(&object->id, DEG_NODE_TYPE_PARAMETERS); - ComponentKey lamp_parameters_key(&lamp->id, DEG_NODE_TYPE_PARAMETERS); + ComponentKey object_parameters_key(&object->id, NodeType::PARAMETERS); + ComponentKey lamp_parameters_key(&lamp->id, NodeType::PARAMETERS); add_relation(lamp_parameters_key, object_parameters_key, "Light -> Object"); } @@ -809,11 +798,11 @@ void DepsgraphRelationBuilder::build_object_data_lightprobe(Object *object) LightProbe *probe = (LightProbe *)object->data; build_lightprobe(probe); OperationKey probe_key(&probe->id, - DEG_NODE_TYPE_PARAMETERS, - DEG_OPCODE_LIGHT_PROBE_EVAL); + NodeType::PARAMETERS, + OperationCode::LIGHT_PROBE_EVAL); OperationKey object_key(&object->id, - DEG_NODE_TYPE_PARAMETERS, - DEG_OPCODE_LIGHT_PROBE_EVAL); + NodeType::PARAMETERS, + OperationCode::LIGHT_PROBE_EVAL); add_relation(probe_key, object_key, "LightProbe Update"); } @@ -822,29 +811,28 @@ void DepsgraphRelationBuilder::build_object_data_speaker(Object *object) Speaker *speaker = (Speaker *)object->data; build_speaker(speaker); OperationKey probe_key(&speaker->id, - DEG_NODE_TYPE_PARAMETERS, - DEG_OPCODE_SPEAKER_EVAL); + NodeType::PARAMETERS, + OperationCode::SPEAKER_EVAL); OperationKey object_key(&object->id, - DEG_NODE_TYPE_PARAMETERS, - DEG_OPCODE_SPEAKER_EVAL); + NodeType::PARAMETERS, + OperationCode::SPEAKER_EVAL); add_relation(probe_key, object_key, "Speaker Update"); } void DepsgraphRelationBuilder::build_object_parent(Object *object) { /* XXX: for now, need to use the component key (not just direct to the parent op), - * or else the matrix doesn't get reset/ - */ + * or else the matrix doesn't get reset. */ // XXX: @sergey - it would be good if we got that backwards flushing working // when tagging for updates. - //OperationKey ob_key(&object->id, DEG_NODE_TYPE_TRANSFORM, DEG_OPCODE_TRANSFORM_PARENT); - ComponentKey ob_key(&object->id, DEG_NODE_TYPE_TRANSFORM); + //OperationKey ob_key(&object->id, NodeType::TRANSFORM, OperationCode::TRANSFORM_PARENT); + ComponentKey ob_key(&object->id, NodeType::TRANSFORM); /* type-specific links */ switch (object->partype) { case PARSKEL: /* Armature Deform (Virtual Modifier) */ { - ComponentKey parent_key(&object->parent->id, DEG_NODE_TYPE_TRANSFORM); + ComponentKey parent_key(&object->parent->id, NodeType::TRANSFORM); add_relation(parent_key, ob_key, "Armature Deform Parent"); break; } @@ -852,13 +840,13 @@ void DepsgraphRelationBuilder::build_object_parent(Object *object) case PARVERT1: /* Vertex Parent */ case PARVERT3: { - ComponentKey parent_key(&object->parent->id, DEG_NODE_TYPE_GEOMETRY); + ComponentKey parent_key(&object->parent->id, NodeType::GEOMETRY); add_relation(parent_key, ob_key, "Vertex Parent"); /* XXX not sure what this is for or how you could be done properly - lukas */ add_customdata_mask(object->parent, CD_MASK_ORIGINDEX); - ComponentKey transform_key(&object->parent->id, DEG_NODE_TYPE_TRANSFORM); + ComponentKey transform_key(&object->parent->id, NodeType::TRANSFORM); add_relation(transform_key, ob_key, "Vertex Parent TFM"); break; } @@ -866,11 +854,11 @@ void DepsgraphRelationBuilder::build_object_parent(Object *object) case PARBONE: /* Bone Parent */ { ComponentKey parent_bone_key(&object->parent->id, - DEG_NODE_TYPE_BONE, + NodeType::BONE, object->parsubstr); OperationKey parent_transform_key(&object->parent->id, - DEG_NODE_TYPE_TRANSFORM, - DEG_OPCODE_TRANSFORM_FINAL); + NodeType::TRANSFORM, + OperationCode::TRANSFORM_FINAL); add_relation(parent_bone_key, ob_key, "Bone Parent"); add_relation(parent_transform_key, ob_key, "Armature Parent"); break; @@ -881,8 +869,8 @@ void DepsgraphRelationBuilder::build_object_parent(Object *object) if (object->parent->type == OB_LATTICE) { /* Lattice Deform Parent - Virtual Modifier */ // XXX: no virtual modifiers should be left! - ComponentKey parent_key(&object->parent->id, DEG_NODE_TYPE_TRANSFORM); - ComponentKey geom_key(&object->parent->id, DEG_NODE_TYPE_GEOMETRY); + ComponentKey parent_key(&object->parent->id, NodeType::TRANSFORM); + ComponentKey geom_key(&object->parent->id, NodeType::GEOMETRY); add_relation(parent_key, ob_key, "Lattice Deform Parent"); add_relation(geom_key, ob_key, "Lattice Deform Parent Geom"); @@ -892,21 +880,21 @@ void DepsgraphRelationBuilder::build_object_parent(Object *object) if (cu->flag & CU_PATH) { /* Follow Path */ - ComponentKey parent_key(&object->parent->id, DEG_NODE_TYPE_GEOMETRY); + ComponentKey parent_key(&object->parent->id, NodeType::GEOMETRY); add_relation(parent_key, ob_key, "Curve Follow Parent"); - ComponentKey transform_key(&object->parent->id, DEG_NODE_TYPE_TRANSFORM); + ComponentKey transform_key(&object->parent->id, NodeType::TRANSFORM); add_relation(transform_key, ob_key, "Curve Follow TFM"); } else { /* Standard Parent */ - ComponentKey parent_key(&object->parent->id, DEG_NODE_TYPE_TRANSFORM); + ComponentKey parent_key(&object->parent->id, NodeType::TRANSFORM); add_relation(parent_key, ob_key, "Curve Parent"); } } else { /* Standard Parent */ - ComponentKey parent_key(&object->parent->id, DEG_NODE_TYPE_TRANSFORM); + ComponentKey parent_key(&object->parent->id, NodeType::TRANSFORM); add_relation(parent_key, ob_key, "Parent"); } break; @@ -916,7 +904,7 @@ void DepsgraphRelationBuilder::build_object_parent(Object *object) void DepsgraphRelationBuilder::build_object_pointcache(Object *object) { - ComponentKey point_cache_key(&object->id, DEG_NODE_TYPE_POINT_CACHE); + ComponentKey point_cache_key(&object->id, NodeType::POINT_CACHE); /* Different point caches are affecting different aspects of life of the * object. We keep track of those aspects and avoid duplicate relations. */ enum { @@ -933,7 +921,7 @@ void DepsgraphRelationBuilder::build_object_pointcache(Object *object) if (ptcache_id->type == PTCACHE_TYPE_RIGIDBODY) { flag = FLAG_TRANSFORM; ComponentKey transform_key(&object->id, - DEG_NODE_TYPE_TRANSFORM); + NodeType::TRANSFORM); add_relation(point_cache_key, transform_key, "Point Cache -> Rigid Body"); @@ -941,7 +929,7 @@ void DepsgraphRelationBuilder::build_object_pointcache(Object *object) else { flag = FLAG_GEOMETRY; ComponentKey geometry_key(&object->id, - DEG_NODE_TYPE_GEOMETRY); + NodeType::GEOMETRY); add_relation(point_cache_key, geometry_key, "Point Cache -> Geometry"); @@ -956,7 +944,7 @@ void DepsgraphRelationBuilder::build_object_pointcache(Object *object) } void DepsgraphRelationBuilder::build_constraints(ID *id, - eDepsNode_Type component_type, + NodeType component_type, const char *component_subdata, ListBase *constraints, RootPChanMap *root_map) @@ -965,9 +953,9 @@ void DepsgraphRelationBuilder::build_constraints(ID *id, id, component_type, component_subdata, - (component_type == DEG_NODE_TYPE_BONE) - ? DEG_OPCODE_BONE_CONSTRAINTS - : DEG_OPCODE_TRANSFORM_CONSTRAINTS); + (component_type == NodeType::BONE) + ? OperationCode::BONE_CONSTRAINTS + : OperationCode::TRANSFORM_CONSTRAINTS); /* Add dependencies for each constraint in turn. */ for (bConstraint *con = (bConstraint *)constraints->first; con; con = con->next) { const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con); @@ -976,11 +964,9 @@ void DepsgraphRelationBuilder::build_constraints(ID *id, continue; } /* Special case for camera tracking -- it doesn't use targets to - * define relations. - */ + * define relations. */ /* TODO: we can now represent dependencies in a much richer manner, - * so review how this is done. - */ + * so review how this is done. */ if (ELEM(cti->type, CONSTRAINT_TYPE_FOLLOWTRACK, CONSTRAINT_TYPE_CAMERASOLVER, @@ -996,9 +982,9 @@ void DepsgraphRelationBuilder::build_constraints(ID *id, } if (data->depth_ob) { ComponentKey depth_transform_key(&data->depth_ob->id, - DEG_NODE_TYPE_TRANSFORM); + NodeType::TRANSFORM); ComponentKey depth_geometry_key(&data->depth_ob->id, - DEG_NODE_TYPE_GEOMETRY); + NodeType::GEOMETRY); add_relation(depth_transform_key, constraint_op_key, cti->name); add_relation(depth_geometry_key, constraint_op_key, cti->name); } @@ -1007,24 +993,22 @@ void DepsgraphRelationBuilder::build_constraints(ID *id, depends_on_camera = true; } if (depends_on_camera && scene_->camera != NULL) { - ComponentKey camera_key(&scene_->camera->id, DEG_NODE_TYPE_TRANSFORM); + ComponentKey camera_key(&scene_->camera->id, NodeType::TRANSFORM); add_relation(camera_key, constraint_op_key, cti->name); } /* TODO(sergey): This is more a TimeSource -> MovieClip -> - * Constraint dependency chain. - */ + * Constraint dependency chain. */ TimeSourceKey time_src_key; add_relation(time_src_key, constraint_op_key, "TimeSrc -> Animation"); } else if (cti->type == CONSTRAINT_TYPE_TRANSFORM_CACHE) { /* TODO(kevin): This is more a TimeSource -> CacheFile -> Constraint - * dependency chain. - */ + * dependency chain. */ TimeSourceKey time_src_key; add_relation(time_src_key, constraint_op_key, "TimeSrc -> Animation"); bTransformCacheConstraint *data = (bTransformCacheConstraint *)con->data; if (data->cache_file) { - ComponentKey cache_key(&data->cache_file->id, DEG_NODE_TYPE_CACHE); + ComponentKey cache_key(&data->cache_file->id, NodeType::CACHE); add_relation(cache_key, constraint_op_key, cti->name); } } @@ -1040,37 +1024,36 @@ void DepsgraphRelationBuilder::build_constraints(ID *id, CONSTRAINT_TYPE_SPLINEIK)) { /* Ignore IK constraints - these are handled separately - * (on pose level). - */ + * (on pose level). */ } else if (ELEM(con->type, CONSTRAINT_TYPE_FOLLOWPATH, CONSTRAINT_TYPE_CLAMPTO)) { /* These constraints require path geometry data. */ - ComponentKey target_key(&ct->tar->id, DEG_NODE_TYPE_GEOMETRY); + ComponentKey target_key(&ct->tar->id, NodeType::GEOMETRY); add_relation(target_key, constraint_op_key, cti->name); ComponentKey target_transform_key(&ct->tar->id, - DEG_NODE_TYPE_TRANSFORM); + NodeType::TRANSFORM); add_relation(target_transform_key, constraint_op_key, cti->name); } else if ((ct->tar->type == OB_ARMATURE) && (ct->subtarget[0])) { - eDepsOperation_Code opcode; + OperationCode opcode; /* relation to bone */ opcode = bone_target_opcode(&ct->tar->id, ct->subtarget, id, component_subdata, root_map); /* Armature constraint always wants the final position and chan_mat. */ if (ELEM(con->type, CONSTRAINT_TYPE_ARMATURE)) { - opcode = DEG_OPCODE_BONE_DONE; + opcode = OperationCode::BONE_DONE; } /* if needs bbone shape, reference the segment computation */ if (BKE_constraint_target_uses_bbone(con, ct) && bone_has_segments(ct->tar, ct->subtarget)) { - opcode = DEG_OPCODE_BONE_SEGMENTS; + opcode = OperationCode::BONE_SEGMENTS; } OperationKey target_key(&ct->tar->id, - DEG_NODE_TYPE_BONE, + NodeType::BONE, ct->subtarget, opcode); add_relation(target_key, constraint_op_key, cti->name); @@ -1080,9 +1063,8 @@ void DepsgraphRelationBuilder::build_constraints(ID *id, { /* Vertex group. */ /* NOTE: for now, we don't need to represent vertex groups - * separately. - */ - ComponentKey target_key(&ct->tar->id, DEG_NODE_TYPE_GEOMETRY); + * separately. */ + ComponentKey target_key(&ct->tar->id, NodeType::GEOMETRY); add_relation(target_key, constraint_op_key, cti->name); add_customdata_mask(ct->tar, CD_MASK_MDEFORMVERT); } @@ -1090,7 +1072,7 @@ void DepsgraphRelationBuilder::build_constraints(ID *id, bShrinkwrapConstraint *scon = (bShrinkwrapConstraint *) con->data; /* Constraints which requires the target object surface. */ - ComponentKey target_key(&ct->tar->id, DEG_NODE_TYPE_GEOMETRY); + ComponentKey target_key(&ct->tar->id, NodeType::GEOMETRY); add_relation(target_key, constraint_op_key, cti->name); /* Add dependency on normal layers if necessary. */ @@ -1105,10 +1087,9 @@ void DepsgraphRelationBuilder::build_constraints(ID *id, } /* NOTE: obdata eval now doesn't necessarily depend on the - * object's transform. - */ + * object's transform. */ ComponentKey target_transform_key(&ct->tar->id, - DEG_NODE_TYPE_TRANSFORM); + NodeType::TRANSFORM); add_relation(target_transform_key, constraint_op_key, cti->name); } else { @@ -1121,34 +1102,32 @@ void DepsgraphRelationBuilder::build_constraints(ID *id, * case, it's just transform -> bone. * - If however it is a real self targeting case, just * make it depend on the previous constraint (or the - * pre-constraint state). - */ + * pre-constraint state). */ if ((ct->tar->type == OB_ARMATURE) && - (component_type == DEG_NODE_TYPE_BONE)) + (component_type == NodeType::BONE)) { OperationKey target_key(&ct->tar->id, - DEG_NODE_TYPE_TRANSFORM, - DEG_OPCODE_TRANSFORM_FINAL); + NodeType::TRANSFORM, + OperationCode::TRANSFORM_FINAL); add_relation(target_key, constraint_op_key, cti->name); } else { OperationKey target_key(&ct->tar->id, - DEG_NODE_TYPE_TRANSFORM, - DEG_OPCODE_TRANSFORM_LOCAL); + NodeType::TRANSFORM, + OperationCode::TRANSFORM_LOCAL); add_relation(target_key, constraint_op_key, cti->name); } } else { /* Normal object dependency. */ OperationKey target_key(&ct->tar->id, - DEG_NODE_TYPE_TRANSFORM, - DEG_OPCODE_TRANSFORM_FINAL); + NodeType::TRANSFORM, + OperationCode::TRANSFORM_FINAL); add_relation(target_key, constraint_op_key, cti->name); } } /* Constraints which needs world's matrix for transform. - * TODO(sergey): More constraints here? - */ + * TODO(sergey): More constraints here? */ if (ELEM(con->type, CONSTRAINT_TYPE_ROTLIKE, CONSTRAINT_TYPE_SIZELIKE, @@ -1157,7 +1136,7 @@ void DepsgraphRelationBuilder::build_constraints(ID *id, { /* TODO(sergey): Add used space check. */ ComponentKey target_transform_key(&ct->tar->id, - DEG_NODE_TYPE_TRANSFORM); + NodeType::TRANSFORM); add_relation(target_transform_key, constraint_op_key, cti->name); } } @@ -1189,19 +1168,19 @@ void DepsgraphRelationBuilder::build_animdata_curves(ID *id) return; } /* Wire up dependency to time source. */ - ComponentKey adt_key(id, DEG_NODE_TYPE_ANIMATION); + ComponentKey adt_key(id, NodeType::ANIMATION); /* Relation from action itself. */ if (adt->action != NULL) { - ComponentKey action_key(&adt->action->id, DEG_NODE_TYPE_ANIMATION); + ComponentKey action_key(&adt->action->id, NodeType::ANIMATION); add_relation(action_key, adt_key, "Action -> Animation"); } /* Get source operations. */ - DepsNode *node_from = get_node(adt_key); + Node *node_from = get_node(adt_key); BLI_assert(node_from != NULL); if (node_from == NULL) { return; } - OperationDepsNode *operation_from = node_from->get_exit_operation(); + OperationNode *operation_from = node_from->get_exit_operation(); BLI_assert(operation_from != NULL); /* Build relations from animation operation to properties it changes. */ if (adt->action != NULL) { @@ -1218,7 +1197,7 @@ void DepsgraphRelationBuilder::build_animdata_curves(ID *id) void DepsgraphRelationBuilder::build_animdata_curves_targets( ID *id, ComponentKey &adt_key, - OperationDepsNode *operation_from, + OperationNode *operation_from, ListBase *curves) { /* Iterate over all curves and build relations. */ @@ -1233,49 +1212,53 @@ void DepsgraphRelationBuilder::build_animdata_curves_targets( { continue; } - DepsNode *node_to = graph_->find_node_from_pointer( + Node *node_to = graph_->find_node_from_pointer( &ptr, prop, RNAPointerSource::ENTRY); if (node_to == NULL) { continue; } - OperationDepsNode *operation_to = node_to->get_entry_operation(); + OperationNode *operation_to = node_to->get_entry_operation(); /* NOTE: Special case for bones, avoid relation from animation to * each of the bones. Bone evaluation could only start from pose - * init anyway. - */ - if (operation_to->opcode == DEG_OPCODE_BONE_LOCAL) { + * init anyway. */ + if (operation_to->opcode == OperationCode::BONE_LOCAL) { OperationKey pose_init_key(id, - DEG_NODE_TYPE_EVAL_POSE, - DEG_OPCODE_POSE_INIT); - add_relation(adt_key, pose_init_key, "Animation -> Prop", true); + NodeType::EVAL_POSE, + OperationCode::POSE_INIT); + add_relation(adt_key, + pose_init_key, + "Animation -> Prop", + RELATION_CHECK_BEFORE_ADD); continue; } graph_->add_new_relation(operation_from, operation_to, "Animation -> Prop", - true); + RELATION_CHECK_BEFORE_ADD); /* It is possible that animation is writing to a nested ID datablock, - * need to make sure animation is evaluated after target ID is copied. - */ - const IDDepsNode *id_node_from = operation_from->owner->owner; - const IDDepsNode *id_node_to = operation_to->owner->owner; + * need to make sure animation is evaluated after target ID is copied. */ + const IDNode *id_node_from = operation_from->owner->owner; + const IDNode *id_node_to = operation_to->owner->owner; if (id_node_from != id_node_to) { ComponentKey cow_key(id_node_to->id_orig, - DEG_NODE_TYPE_COPY_ON_WRITE); - add_relation(cow_key, adt_key, "Animated CoW -> Animation", true); + NodeType::COPY_ON_WRITE); + add_relation(cow_key, + adt_key, + "Animated CoW -> Animation", + RELATION_CHECK_BEFORE_ADD); } } } void DepsgraphRelationBuilder::build_animdata_nlastrip_targets( ID *id, ComponentKey &adt_key, - OperationDepsNode *operation_from, + OperationNode *operation_from, ListBase *strips) { LISTBASE_FOREACH(NlaStrip *, strip, strips) { if (strip->act != NULL) { build_action(strip->act); - ComponentKey action_key(&strip->act->id, DEG_NODE_TYPE_ANIMATION); + ComponentKey action_key(&strip->act->id, NodeType::ANIMATION); add_relation(action_key, adt_key, "Action -> Animation"); build_animdata_curves_targets(id, adt_key, @@ -1296,11 +1279,11 @@ void DepsgraphRelationBuilder::build_animdata_drivers(ID *id) if (adt == NULL) { return; } - ComponentKey adt_key(id, DEG_NODE_TYPE_ANIMATION); + ComponentKey adt_key(id, NodeType::ANIMATION); LISTBASE_FOREACH (FCurve *, fcu, &adt->drivers) { OperationKey driver_key(id, - DEG_NODE_TYPE_PARAMETERS, - DEG_OPCODE_DRIVER, + NodeType::PARAMETERS, + OperationCode::DRIVER, fcu->rna_path ? fcu->rna_path : "", fcu->array_index); @@ -1316,8 +1299,7 @@ void DepsgraphRelationBuilder::build_animdata_drivers(ID *id) * - We do relation from next array index to a previous one, so we don't * have to deal with array index 0. * - * TODO(sergey): Avoid liner lookup somehow. - */ + * TODO(sergey): Avoid liner lookup somehow. */ if (fcu->array_index > 0) { FCurve *fcu_prev = NULL; LISTBASE_FOREACH (FCurve *, fcu_candidate, &adt->drivers) { @@ -1339,13 +1321,13 @@ void DepsgraphRelationBuilder::build_animdata_drivers(ID *id) } if (fcu_prev != NULL) { OperationKey prev_driver_key(id, - DEG_NODE_TYPE_PARAMETERS, - DEG_OPCODE_DRIVER, + NodeType::PARAMETERS, + OperationCode::DRIVER, fcu_prev->rna_path ? fcu_prev->rna_path : "", fcu_prev->array_index); OperationKey driver_key(id, - DEG_NODE_TYPE_PARAMETERS, - DEG_OPCODE_DRIVER, + NodeType::PARAMETERS, + OperationCode::DRIVER, fcu->rna_path ? fcu->rna_path : "", fcu->array_index); add_relation(prev_driver_key, driver_key, "Driver Order"); @@ -1365,7 +1347,7 @@ void DepsgraphRelationBuilder::build_action(bAction *action) return; } TimeSourceKey time_src_key; - ComponentKey animation_key(&action->id, DEG_NODE_TYPE_ANIMATION); + ComponentKey animation_key(&action->id, NodeType::ANIMATION); add_relation(time_src_key, animation_key, "TimeSrc -> Animation"); } @@ -1373,20 +1355,18 @@ void DepsgraphRelationBuilder::build_driver(ID *id, FCurve *fcu) { ChannelDriver *driver = fcu->driver; OperationKey driver_key(id, - DEG_NODE_TYPE_PARAMETERS, - DEG_OPCODE_DRIVER, + NodeType::PARAMETERS, + OperationCode::DRIVER, fcu->rna_path ? fcu->rna_path : "", fcu->array_index); /* Driver -> data components (for interleaved evaluation - * bones/constraints/modifiers). - */ + * bones/constraints/modifiers). */ build_driver_data(id, fcu); /* Loop over variables to get the target relationships. */ build_driver_variables(id, fcu); /* It's quite tricky to detect if the driver actually depends on time or * not, so for now we'll be quite conservative here about optimization and - * consider all python drivers to be depending on time. - */ + * consider all python drivers to be depending on time. */ if ((driver->type == DRIVER_TYPE_PYTHON) && python_driver_depends_on_time(driver)) { @@ -1398,23 +1378,21 @@ void DepsgraphRelationBuilder::build_driver(ID *id, FCurve *fcu) void DepsgraphRelationBuilder::build_driver_data(ID *id, FCurve *fcu) { OperationKey driver_key(id, - DEG_NODE_TYPE_PARAMETERS, - DEG_OPCODE_DRIVER, + NodeType::PARAMETERS, + OperationCode::DRIVER, fcu->rna_path ? fcu->rna_path : "", fcu->array_index); const char *rna_path = fcu->rna_path ? fcu->rna_path : ""; if (GS(id->name) == ID_AR && strstr(rna_path, "bones[")) { /* Drivers on armature-level bone settings (i.e. bbone stuff), - * which will affect the evaluation of corresponding pose bones. - */ - IDDepsNode *arm_node = graph_->find_id_node(id); + * which will affect the evaluation of corresponding pose bones. */ + IDNode *arm_node = graph_->find_id_node(id); char *bone_name = BLI_str_quoted_substrN(rna_path, "bones["); if (arm_node != NULL && bone_name != NULL) { /* Find objects which use this, and make their eval callbacks - * depend on this. - */ - foreach (DepsRelation *rel, arm_node->outlinks) { - IDDepsNode *to_node = (IDDepsNode *)rel->to; + * depend on this. */ + for (Relation *rel : arm_node->outlinks) { + IDNode *to_node = (IDNode *)rel->to; /* We only care about objects with pose data which use this. */ if (GS(to_node->id_orig->name) == ID_OB) { Object *object = (Object *)to_node->id_orig; @@ -1423,9 +1401,9 @@ void DepsgraphRelationBuilder::build_driver_data(ID *id, FCurve *fcu) bone_name); if (pchan != NULL) { OperationKey bone_key(&object->id, - DEG_NODE_TYPE_BONE, + NodeType::BONE, pchan->name, - DEG_OPCODE_BONE_LOCAL); + OperationCode::BONE_LOCAL); add_relation(driver_key, bone_key, "Arm Bone -> Driver -> Bone"); @@ -1463,11 +1441,11 @@ void DepsgraphRelationBuilder::build_driver_data(ID *id, FCurve *fcu) if (RNA_path_resolve_full(&id_ptr, fcu->rna_path, &ptr, NULL, NULL)) { if (id_ptr.id.data != ptr.id.data) { ComponentKey cow_key((ID *)ptr.id.data, - DEG_NODE_TYPE_COPY_ON_WRITE); + NodeType::COPY_ON_WRITE); add_relation(cow_key, driver_key, "Driven CoW -> Driver", - true); + RELATION_CHECK_BEFORE_ADD); } } } @@ -1476,8 +1454,8 @@ void DepsgraphRelationBuilder::build_driver_data(ID *id, FCurve *fcu) { RNAPathKey property_exit_key(id, rna_path, RNAPointerSource::EXIT); OperationKey parameters_key(id, - DEG_NODE_TYPE_PARAMETERS, - DEG_OPCODE_PARAMETERS_EVAL); + NodeType::PARAMETERS, + OperationCode::PARAMETERS_EVAL); add_relation(property_exit_key, parameters_key, "Driven Property -> Properties"); @@ -1489,8 +1467,8 @@ void DepsgraphRelationBuilder::build_driver_variables(ID *id, FCurve *fcu) { ChannelDriver *driver = fcu->driver; OperationKey driver_key(id, - DEG_NODE_TYPE_PARAMETERS, - DEG_OPCODE_DRIVER, + NodeType::PARAMETERS, + OperationCode::DRIVER, fcu->rna_path ? fcu->rna_path : "", fcu->array_index); const char *rna_path = fcu->rna_path ? fcu->rna_path : ""; @@ -1524,9 +1502,9 @@ void DepsgraphRelationBuilder::build_driver_variables(ID *id, FCurve *fcu) continue; } OperationKey variable_key(dtar->id, - DEG_NODE_TYPE_BONE, + NodeType::BONE, target_pchan->name, - DEG_OPCODE_BONE_DONE); + OperationCode::BONE_DONE); if (is_same_bone_dependency(variable_key, self_key)) { continue; } @@ -1537,13 +1515,12 @@ void DepsgraphRelationBuilder::build_driver_variables(ID *id, FCurve *fcu) if (dtar->id == id) { /* Ignore input dependency if we're driving properties of * the same ID, otherwise we'll be ending up in a cyclic - * dependency here. - */ + * dependency here. */ continue; } OperationKey target_key(dtar->id, - DEG_NODE_TYPE_TRANSFORM, - DEG_OPCODE_TRANSFORM_FINAL); + NodeType::TRANSFORM, + OperationCode::TRANSFORM_FINAL); add_relation(target_key, driver_key, "Target -> Driver"); } else if (dtar->rna_path != NULL && dtar->rna_path[0] != '\0') { @@ -1591,11 +1568,11 @@ void DepsgraphRelationBuilder::build_world(World *world) if (world->nodetree != NULL) { build_nodetree(world->nodetree); OperationKey ntree_key(&world->nodetree->id, - DEG_NODE_TYPE_SHADING, - DEG_OPCODE_MATERIAL_UPDATE); + NodeType::SHADING, + OperationCode::MATERIAL_UPDATE); OperationKey world_key(&world->id, - DEG_NODE_TYPE_SHADING, - DEG_OPCODE_WORLD_UPDATE); + NodeType::SHADING, + OperationCode::WORLD_UPDATE); add_relation(ntree_key, world_key, "World's NTree"); build_nested_nodetree(&world->id, world->nodetree); } @@ -1605,8 +1582,8 @@ void DepsgraphRelationBuilder::build_rigidbody(Scene *scene) { RigidBodyWorld *rbw = scene->rigidbody_world; - OperationKey init_key(&scene->id, DEG_NODE_TYPE_TRANSFORM, DEG_OPCODE_RIGIDBODY_REBUILD); - OperationKey sim_key(&scene->id, DEG_NODE_TYPE_TRANSFORM, DEG_OPCODE_RIGIDBODY_SIM); + OperationKey init_key(&scene->id, NodeType::TRANSFORM, OperationCode::RIGIDBODY_REBUILD); + OperationKey sim_key(&scene->id, NodeType::TRANSFORM, OperationCode::RIGIDBODY_SIM); /* rel between the two sim-nodes */ add_relation(init_key, sim_key, "Rigidbody [Init -> SimStep]"); @@ -1614,9 +1591,9 @@ void DepsgraphRelationBuilder::build_rigidbody(Scene *scene) /* set up dependencies between these operations and other builtin nodes --------------- */ /* effectors */ - ListBase *relations = deg_build_effector_relations(graph_, rbw->effector_weights->group); + ListBase *relations = build_effector_relations(graph_, rbw->effector_weights->group); LISTBASE_FOREACH (EffectorRelation *, relation, relations) { - ComponentKey eff_key(&relation->ob->id, DEG_NODE_TYPE_TRANSFORM); + ComponentKey eff_key(&relation->ob->id, NodeType::TRANSFORM); add_relation(eff_key, init_key, "RigidBody Field"); // FIXME add relations so pointache is marked as outdated when effectors are modified } @@ -1641,19 +1618,18 @@ void DepsgraphRelationBuilder::build_rigidbody(Scene *scene) * * 3) simulation needs to know base transforms to figure out what to do * XXX: there's probably a difference between passive and active - * - passive don't change, so may need to know full transform... - */ - OperationKey rbo_key(&object->id, DEG_NODE_TYPE_TRANSFORM, DEG_OPCODE_RIGIDBODY_TRANSFORM_COPY); + * - passive don't change, so may need to know full transform... */ + OperationKey rbo_key(&object->id, NodeType::TRANSFORM, OperationCode::RIGIDBODY_TRANSFORM_COPY); - eDepsOperation_Code trans_opcode = object->parent ? DEG_OPCODE_TRANSFORM_PARENT : DEG_OPCODE_TRANSFORM_LOCAL; - OperationKey trans_op(&object->id, DEG_NODE_TYPE_TRANSFORM, trans_opcode); + OperationCode trans_opcode = object->parent ? OperationCode::TRANSFORM_PARENT : OperationCode::TRANSFORM_LOCAL; + OperationKey trans_op(&object->id, NodeType::TRANSFORM, trans_opcode); add_relation(sim_key, rbo_key, "Rigidbody Sim Eval -> RBO Sync"); /* Geometry must be known to create the rigid body. RBO_MESH_BASE uses the non-evaluated * mesh, so then the evaluation is unnecessary. */ if (object->rigidbody_object != NULL && object->rigidbody_object->mesh_source != RBO_MESH_BASE) { - ComponentKey geom_key(&object->id, DEG_NODE_TYPE_GEOMETRY); + ComponentKey geom_key(&object->id, NodeType::GEOMETRY); add_relation(geom_key, init_key, "Object Geom Eval -> Rigidbody Rebuild"); } @@ -1663,23 +1639,21 @@ void DepsgraphRelationBuilder::build_rigidbody(Scene *scene) * Also, since constraints are hooked up to the final nodes, this link * means that we can also fit in there too... * - Later, it might be good to include a constraint in the stack allowing us - * to control whether rigidbody eval gets interleaved into the constraint stack - */ + * to control whether rigidbody eval gets interleaved into the constraint stack */ if (object->constraints.first) { OperationKey constraint_key(&object->id, - DEG_NODE_TYPE_TRANSFORM, - DEG_OPCODE_TRANSFORM_CONSTRAINTS); + NodeType::TRANSFORM, + OperationCode::TRANSFORM_CONSTRAINTS); add_relation(rbo_key, constraint_key, "RBO Sync -> Ob Constraints"); } else { /* Final object transform depends on rigidbody. * * NOTE: Currently we consider final here an ubereval node. - * If it is gone we'll need to reconsider relation here. - */ + * If it is gone we'll need to reconsider relation here. */ OperationKey uber_key(&object->id, - DEG_NODE_TYPE_TRANSFORM, - DEG_OPCODE_TRANSFORM_OBJECT_UBEREVAL); + NodeType::TRANSFORM, + OperationCode::TRANSFORM_OBJECT_UBEREVAL); add_relation(rbo_key, uber_key, "RBO Sync -> Uber (Temp)"); } @@ -1703,9 +1677,9 @@ void DepsgraphRelationBuilder::build_rigidbody(Scene *scene) build_object(NULL, rbc->ob2); /* final result of the constraint object's transform controls how * the constraint affects the physics sim for these objects. */ - ComponentKey trans_key(&object->id, DEG_NODE_TYPE_TRANSFORM); - OperationKey ob1_key(&rbc->ob1->id, DEG_NODE_TYPE_TRANSFORM, DEG_OPCODE_RIGIDBODY_TRANSFORM_COPY); - OperationKey ob2_key(&rbc->ob2->id, DEG_NODE_TYPE_TRANSFORM, DEG_OPCODE_RIGIDBODY_TRANSFORM_COPY); + ComponentKey trans_key(&object->id, NodeType::TRANSFORM); + OperationKey ob1_key(&rbc->ob1->id, NodeType::TRANSFORM, OperationCode::RIGIDBODY_TRANSFORM_COPY); + OperationKey ob2_key(&rbc->ob2->id, NodeType::TRANSFORM, OperationCode::RIGIDBODY_TRANSFORM_COPY); /* Constrained-objects sync depends on the constraint-holder. */ add_relation(trans_key, ob1_key, "RigidBodyConstraint -> RBC.Object_1"); add_relation(trans_key, ob2_key, "RigidBodyConstraint -> RBC.Object_2"); @@ -1720,17 +1694,17 @@ void DepsgraphRelationBuilder::build_particle_systems(Object *object) { TimeSourceKey time_src_key; OperationKey obdata_ubereval_key(&object->id, - DEG_NODE_TYPE_GEOMETRY, - DEG_OPCODE_GEOMETRY_UBEREVAL); + NodeType::GEOMETRY, + OperationCode::GEOMETRY_UBEREVAL); OperationKey eval_init_key(&object->id, - DEG_NODE_TYPE_PARTICLE_SYSTEM, - DEG_OPCODE_PARTICLE_SYSTEM_INIT); + NodeType::PARTICLE_SYSTEM, + OperationCode::PARTICLE_SYSTEM_INIT); OperationKey eval_done_key(&object->id, - DEG_NODE_TYPE_PARTICLE_SYSTEM, - DEG_OPCODE_PARTICLE_SYSTEM_DONE); - ComponentKey eval_key(&object->id, DEG_NODE_TYPE_PARTICLE_SYSTEM); + NodeType::PARTICLE_SYSTEM, + OperationCode::PARTICLE_SYSTEM_DONE); + ComponentKey eval_key(&object->id, NodeType::PARTICLE_SYSTEM); if (BKE_ptcache_object_has(scene_, object, 0)) { - ComponentKey point_cache_key(&object->id, DEG_NODE_TYPE_POINT_CACHE); + ComponentKey point_cache_key(&object->id, NodeType::POINT_CACHE); add_relation(eval_key, point_cache_key, "Particle Point Cache"); } /* Particle systems. */ @@ -1741,13 +1715,13 @@ void DepsgraphRelationBuilder::build_particle_systems(Object *object) build_particle_settings(part); /* This particle system. */ OperationKey psys_key(&object->id, - DEG_NODE_TYPE_PARTICLE_SYSTEM, - DEG_OPCODE_PARTICLE_SYSTEM_EVAL, + NodeType::PARTICLE_SYSTEM, + OperationCode::PARTICLE_SYSTEM_EVAL, psys->name); /* Update particle system when settings changes. */ OperationKey particle_settings_key(&part->id, - DEG_NODE_TYPE_PARTICLE_SETTINGS, - DEG_OPCODE_PARTICLE_SETTINGS_EVAL); + NodeType::PARTICLE_SETTINGS, + OperationCode::PARTICLE_SETTINGS_EVAL); add_relation(particle_settings_key, eval_init_key, "Particle Settings Change"); @@ -1793,7 +1767,7 @@ void DepsgraphRelationBuilder::build_particle_systems(Object *object) } if (ruleob != NULL) { ComponentKey ruleob_key(&ruleob->id, - DEG_NODE_TYPE_TRANSFORM); + NodeType::TRANSFORM); add_relation(ruleob_key, psys_key, "Boid Rule"); } } @@ -1812,7 +1786,7 @@ void DepsgraphRelationBuilder::build_particle_systems(Object *object) /* Use geometry component, since that's where particles are * actually evaluated. */ ComponentKey target_key(&particle_target->ob->id, - DEG_NODE_TYPE_GEOMETRY); + NodeType::GEOMETRY); add_relation(target_key, psys_key, "Keyed Target"); } } @@ -1843,7 +1817,7 @@ void DepsgraphRelationBuilder::build_particle_systems(Object *object) * * TODO(sergey): This relation should be altered once real granular update * is implemented. */ - ComponentKey transform_key(&object->id, DEG_NODE_TYPE_TRANSFORM); + ComponentKey transform_key(&object->id, NodeType::TRANSFORM); add_relation(transform_key, obdata_ubereval_key, "Particle Eval"); } @@ -1855,15 +1829,15 @@ void DepsgraphRelationBuilder::build_particle_settings(ParticleSettings *part) /* Animation data relations. */ build_animdata(&part->id); OperationKey particle_settings_init_key(&part->id, - DEG_NODE_TYPE_PARTICLE_SETTINGS, - DEG_OPCODE_PARTICLE_SETTINGS_INIT); + NodeType::PARTICLE_SETTINGS, + OperationCode::PARTICLE_SETTINGS_INIT); OperationKey particle_settings_eval_key(&part->id, - DEG_NODE_TYPE_PARTICLE_SETTINGS, - DEG_OPCODE_PARTICLE_SETTINGS_EVAL); + NodeType::PARTICLE_SETTINGS, + OperationCode::PARTICLE_SETTINGS_EVAL); OperationKey particle_settings_reset_key( &part->id, - DEG_NODE_TYPE_PARTICLE_SETTINGS, - DEG_OPCODE_PARTICLE_SETTINGS_RESET); + NodeType::PARTICLE_SETTINGS, + OperationCode::PARTICLE_SETTINGS_RESET); add_relation(particle_settings_init_key, particle_settings_eval_key, "Particle Settings Init Order"); @@ -1878,22 +1852,22 @@ void DepsgraphRelationBuilder::build_particle_settings(ParticleSettings *part) } build_texture(mtex->tex); ComponentKey texture_key(&mtex->tex->id, - DEG_NODE_TYPE_GENERIC_DATABLOCK); + NodeType::GENERIC_DATABLOCK); add_relation(texture_key, particle_settings_reset_key, "Particle Texture", - DEPSREL_FLAG_FLUSH_USER_EDIT_ONLY); + RELATION_FLAG_FLUSH_USER_EDIT_ONLY); /* TODO(sergey): Consider moving texture space handling to an own * function. */ if (mtex->texco == TEXCO_OBJECT && mtex->object != NULL) { - ComponentKey object_key(&mtex->object->id, DEG_NODE_TYPE_TRANSFORM); + ComponentKey object_key(&mtex->object->id, NodeType::TRANSFORM); add_relation(object_key, particle_settings_eval_key, "Particle Texture Space"); } } if (check_id_has_anim_component(&part->id)) { - ComponentKey animation_key(&part->id, DEG_NODE_TYPE_ANIMATION); + ComponentKey animation_key(&part->id, NodeType::ANIMATION); add_relation(animation_key, particle_settings_eval_key, "Particle Settings Animation"); @@ -1906,16 +1880,16 @@ void DepsgraphRelationBuilder::build_particle_system_visualization_object( Object *draw_object) { OperationKey psys_key(&object->id, - DEG_NODE_TYPE_PARTICLE_SYSTEM, - DEG_OPCODE_PARTICLE_SYSTEM_EVAL, + NodeType::PARTICLE_SYSTEM, + OperationCode::PARTICLE_SYSTEM_EVAL, psys->name); OperationKey obdata_ubereval_key(&object->id, - DEG_NODE_TYPE_GEOMETRY, - DEG_OPCODE_GEOMETRY_UBEREVAL); - ComponentKey dup_ob_key(&draw_object->id, DEG_NODE_TYPE_TRANSFORM); + NodeType::GEOMETRY, + OperationCode::GEOMETRY_UBEREVAL); + ComponentKey dup_ob_key(&draw_object->id, NodeType::TRANSFORM); add_relation(dup_ob_key, psys_key, "Particle Object Visualization"); if (draw_object->type == OB_MBALL) { - ComponentKey dup_geometry_key(&draw_object->id, DEG_NODE_TYPE_GEOMETRY); + ComponentKey dup_geometry_key(&draw_object->id, NodeType::GEOMETRY); add_relation(obdata_ubereval_key, dup_geometry_key, "Particle MBall Visualization"); @@ -1931,11 +1905,11 @@ void DepsgraphRelationBuilder::build_shapekeys(Key *key) /* Attach animdata to geometry. */ build_animdata(&key->id); /* Connect all blocks properties to the final result evaluation. */ - ComponentKey geometry_key(&key->id, DEG_NODE_TYPE_GEOMETRY); + ComponentKey geometry_key(&key->id, NodeType::GEOMETRY); LISTBASE_FOREACH (KeyBlock *, key_block, &key->block) { OperationKey key_block_key(&key->id, - DEG_NODE_TYPE_PARAMETERS, - DEG_OPCODE_PARAMETERS_EVAL, + NodeType::PARAMETERS, + OperationCode::PARAMETERS_EVAL, key_block->name); add_relation(key_block_key, geometry_key, "Key Block Properties"); } @@ -1966,28 +1940,26 @@ void DepsgraphRelationBuilder::build_object_data_geometry(Object *object) ID *obdata = (ID *)object->data; /* Init operation of object-level geometry evaluation. */ OperationKey geom_init_key(&object->id, - DEG_NODE_TYPE_GEOMETRY, - DEG_OPCODE_PLACEHOLDER, + NodeType::GEOMETRY, + OperationCode::PLACEHOLDER, "Eval Init"); /* Get nodes for result of obdata's evaluation, and geometry evaluation - * on object. - */ - ComponentKey obdata_geom_key(obdata, DEG_NODE_TYPE_GEOMETRY); - ComponentKey geom_key(&object->id, DEG_NODE_TYPE_GEOMETRY); + * on object. */ + ComponentKey obdata_geom_key(obdata, NodeType::GEOMETRY); + ComponentKey geom_key(&object->id, NodeType::GEOMETRY); /* Link components to each other. */ add_relation(obdata_geom_key, geom_key, "Object Geometry Base Data"); OperationKey obdata_ubereval_key(&object->id, - DEG_NODE_TYPE_GEOMETRY, - DEG_OPCODE_GEOMETRY_UBEREVAL); + NodeType::GEOMETRY, + OperationCode::GEOMETRY_UBEREVAL); /* Special case: modifiers evaluation queries scene for various things like * data mask to be used. We add relation here to ensure object is never - * evaluated prior to Scene's CoW is ready. - */ + * evaluated prior to Scene's CoW is ready. */ OperationKey scene_key(&scene_->id, - DEG_NODE_TYPE_LAYER_COLLECTIONS, - DEG_OPCODE_VIEW_LAYER_EVAL); - DepsRelation *rel = add_relation(scene_key, obdata_ubereval_key, "CoW Relation"); - rel->flag |= DEPSREL_FLAG_NO_FLUSH; + NodeType::LAYER_COLLECTIONS, + OperationCode::VIEW_LAYER_EVAL); + Relation *rel = add_relation(scene_key, obdata_ubereval_key, "CoW Relation"); + rel->flag |= RELATION_FLAG_NO_FLUSH; /* Modifiers */ if (object->modifiers.first != NULL) { ModifierUpdateDepsgraphContext ctx = {}; @@ -2051,11 +2023,11 @@ void DepsgraphRelationBuilder::build_object_data_geometry(Object *object) if (object->type == OB_MESH) { OperationKey material_key(&ma->id, - DEG_NODE_TYPE_SHADING, - DEG_OPCODE_MATERIAL_UPDATE); + NodeType::SHADING, + OperationCode::MATERIAL_UPDATE); OperationKey shading_key(&object->id, - DEG_NODE_TYPE_SHADING, - DEG_OPCODE_SHADING); + NodeType::SHADING, + OperationCode::SHADING); add_relation(material_key, shading_key, "Material Update"); } } @@ -2067,37 +2039,36 @@ void DepsgraphRelationBuilder::build_object_data_geometry(Object *object) } /* Make sure uber update is the last in the dependencies. * - * TODO(sergey): Get rid of this node. - */ + * TODO(sergey): Get rid of this node. */ if (object->type != OB_ARMATURE) { /* Armatures does no longer require uber node. */ OperationKey obdata_ubereval_key(&object->id, - DEG_NODE_TYPE_GEOMETRY, - DEG_OPCODE_GEOMETRY_UBEREVAL); + NodeType::GEOMETRY, + OperationCode::GEOMETRY_UBEREVAL); add_relation(geom_init_key, obdata_ubereval_key, "Object Geometry UberEval"); if (object->totcol != 0 && object->type == OB_MESH) { - ComponentKey object_shading_key(&object->id, DEG_NODE_TYPE_SHADING); - DepsRelation *rel = add_relation(obdata_ubereval_key, - object_shading_key, - "Object Geometry batch Update"); - rel->flag |= DEPSREL_FLAG_NO_FLUSH; + ComponentKey object_shading_key(&object->id, NodeType::SHADING); + Relation *rel = add_relation(obdata_ubereval_key, + object_shading_key, + "Object Geometry batch Update"); + rel->flag |= RELATION_FLAG_NO_FLUSH; } } if (object->type == OB_MBALL) { Object *mom = BKE_mball_basis_find(scene_, object); - ComponentKey mom_geom_key(&mom->id, DEG_NODE_TYPE_GEOMETRY); + ComponentKey mom_geom_key(&mom->id, NodeType::GEOMETRY); /* motherball - mom depends on children! */ if (mom == object) { ComponentKey mom_transform_key(&mom->id, - DEG_NODE_TYPE_TRANSFORM); + NodeType::TRANSFORM); add_relation(mom_transform_key, mom_geom_key, "Metaball Motherball Transform -> Geometry"); } else { - ComponentKey transform_key(&object->id, DEG_NODE_TYPE_TRANSFORM); + ComponentKey transform_key(&object->id, NodeType::TRANSFORM); add_relation(geom_key, mom_geom_key, "Metaball Motherball"); add_relation(transform_key, mom_geom_key, "Metaball Motherball"); } @@ -2108,13 +2079,12 @@ void DepsgraphRelationBuilder::build_object_data_geometry(Object *object) * This relation is similar to what dag_object_time_update_flags() * was doing for mesh objects with particle system. * - * Ideally we need to get rid of this relation. - */ + * Ideally we need to get rid of this relation. */ if (object_particles_depends_on_time(object)) { TimeSourceKey time_key; OperationKey obdata_ubereval_key(&object->id, - DEG_NODE_TYPE_GEOMETRY, - DEG_OPCODE_GEOMETRY_UBEREVAL); + NodeType::GEOMETRY, + OperationCode::GEOMETRY_UBEREVAL); add_relation(time_key, obdata_ubereval_key, "Legacy particle time"); } /* Object data datablock. */ @@ -2124,17 +2094,17 @@ void DepsgraphRelationBuilder::build_object_data_geometry(Object *object) if (key->adt != NULL) { if (key->adt->action || key->adt->nla_tracks.first) { ComponentKey obdata_key((ID *)object->data, - DEG_NODE_TYPE_GEOMETRY); - ComponentKey adt_key(&key->id, DEG_NODE_TYPE_ANIMATION); + NodeType::GEOMETRY); + ComponentKey adt_key(&key->id, NodeType::ANIMATION); add_relation(adt_key, obdata_key, "Animation"); } } } /* Syncronization back to original object. */ - ComponentKey final_geometry_jey(&object->id, DEG_NODE_TYPE_GEOMETRY); + ComponentKey final_geometry_jey(&object->id, NodeType::GEOMETRY); OperationKey synchronize_key(&object->id, - DEG_NODE_TYPE_SYNCHRONIZE, - DEG_OPCODE_SYNCHRONIZE_TO_ORIGINAL); + NodeType::SYNCHRONIZE, + OperationCode::SYNCHRONIZE_TO_ORIGINAL); add_relation( final_geometry_jey, synchronize_key, "Synchronize to Original"); } @@ -2153,12 +2123,12 @@ void DepsgraphRelationBuilder::build_object_data_geometry_datablock(ID *obdata) } /* Link object data evaluation node to exit operation. */ OperationKey obdata_geom_eval_key(obdata, - DEG_NODE_TYPE_GEOMETRY, - DEG_OPCODE_PLACEHOLDER, + NodeType::GEOMETRY, + OperationCode::PLACEHOLDER, "Geometry Eval"); OperationKey obdata_geom_done_key(obdata, - DEG_NODE_TYPE_GEOMETRY, - DEG_OPCODE_PLACEHOLDER, + NodeType::GEOMETRY, + OperationCode::PLACEHOLDER, "Eval Done"); add_relation(obdata_geom_eval_key, obdata_geom_done_key, @@ -2175,12 +2145,12 @@ void DepsgraphRelationBuilder::build_object_data_geometry_datablock(ID *obdata) Curve *cu = (Curve *)obdata; if (cu->bevobj != NULL) { ComponentKey bevob_geom_key(&cu->bevobj->id, - DEG_NODE_TYPE_GEOMETRY); + NodeType::GEOMETRY); add_relation(bevob_geom_key, obdata_geom_eval_key, "Curve Bevel Geometry"); ComponentKey bevob_key(&cu->bevobj->id, - DEG_NODE_TYPE_TRANSFORM); + NodeType::TRANSFORM); add_relation(bevob_key, obdata_geom_eval_key, "Curve Bevel Transform"); @@ -2188,13 +2158,13 @@ void DepsgraphRelationBuilder::build_object_data_geometry_datablock(ID *obdata) } if (cu->taperobj != NULL) { ComponentKey taperob_key(&cu->taperobj->id, - DEG_NODE_TYPE_GEOMETRY); + NodeType::GEOMETRY); add_relation(taperob_key, obdata_geom_eval_key, "Curve Taper"); build_object(NULL, cu->taperobj); } if (cu->textoncurve != NULL) { ComponentKey textoncurve_key(&cu->textoncurve->id, - DEG_NODE_TYPE_GEOMETRY); + NodeType::GEOMETRY); add_relation(textoncurve_key, obdata_geom_eval_key, "Text on Curve"); @@ -2211,24 +2181,22 @@ void DepsgraphRelationBuilder::build_object_data_geometry_datablock(ID *obdata) /* Geometry cache needs to be recalculated on frame change * (e.g. to fix crashes after scrubbing the timeline when * onion skinning is enabled, since the ghosts need to be - * re-added to the cache once scrubbing ends) - */ + * re-added to the cache once scrubbing ends). */ TimeSourceKey time_key; - ComponentKey geometry_key(obdata, DEG_NODE_TYPE_GEOMETRY); + ComponentKey geometry_key(obdata, NodeType::GEOMETRY); add_relation(time_key, geometry_key, "GP Frame Change"); /* Geometry cache also needs to be recalculated when Material * settings change (e.g. when fill.opacity changes on/off, - * we need to rebuild the bGPDstroke->triangles caches) - */ + * we need to rebuild the bGPDstroke->triangles caches). */ for (int i = 0; i < gpd->totcol; i++) { Material *ma = gpd->mat[i]; if ((ma != NULL) && (ma->gp_style != NULL)) { OperationKey material_key(&ma->id, - DEG_NODE_TYPE_SHADING, - DEG_OPCODE_MATERIAL_UPDATE); + NodeType::SHADING, + OperationCode::MATERIAL_UPDATE); add_relation(material_key, geometry_key, "Material -> GP Data"); @@ -2256,8 +2224,8 @@ void DepsgraphRelationBuilder::build_camera(Camera *camera) return; } if (camera->dof_ob != NULL) { - ComponentKey camera_parameters_key(&camera->id, DEG_NODE_TYPE_PARAMETERS); - ComponentKey dof_ob_key(&camera->dof_ob->id, DEG_NODE_TYPE_TRANSFORM); + ComponentKey camera_parameters_key(&camera->id, NodeType::PARAMETERS); + ComponentKey dof_ob_key(&camera->dof_ob->id, NodeType::TRANSFORM); add_relation(dof_ob_key, camera_parameters_key, "Camera DOF"); } } @@ -2271,8 +2239,8 @@ void DepsgraphRelationBuilder::build_lamp(Lamp *lamp) /* lamp's nodetree */ if (lamp->nodetree != NULL) { build_nodetree(lamp->nodetree); - ComponentKey lamp_parameters_key(&lamp->id, DEG_NODE_TYPE_PARAMETERS); - ComponentKey nodetree_key(&lamp->nodetree->id, DEG_NODE_TYPE_SHADING); + ComponentKey lamp_parameters_key(&lamp->id, NodeType::PARAMETERS); + ComponentKey nodetree_key(&lamp->nodetree->id, NodeType::SHADING); add_relation(nodetree_key, lamp_parameters_key, "NTree->Light Parameters"); build_nested_nodetree(&lamp->id, lamp->nodetree); } @@ -2287,7 +2255,7 @@ void DepsgraphRelationBuilder::build_nodetree(bNodeTree *ntree) return; } build_animdata(&ntree->id); - ComponentKey shading_key(&ntree->id, DEG_NODE_TYPE_SHADING); + ComponentKey shading_key(&ntree->id, NodeType::SHADING); /* nodetree's nodes... */ LISTBASE_FOREACH (bNode *, bnode, &ntree->nodes) { ID *id = bnode->id; @@ -2309,8 +2277,7 @@ void DepsgraphRelationBuilder::build_nodetree(bNodeTree *ntree) } else if (id_type == ID_SCE) { /* Scenes are used by compositor trees, and handled by render - * pipeline. No need to build dependencies for them here. - */ + * pipeline. No need to build dependencies for them here. */ } else if (id_type == ID_TXT) { /* Ignore script nodes. */ @@ -2325,7 +2292,7 @@ void DepsgraphRelationBuilder::build_nodetree(bNodeTree *ntree) bNodeTree *group_ntree = (bNodeTree *)id; build_nodetree(group_ntree); ComponentKey group_shading_key(&group_ntree->id, - DEG_NODE_TYPE_SHADING); + NodeType::SHADING); add_relation(group_shading_key, shading_key, "Group Node"); } else { @@ -2334,15 +2301,15 @@ void DepsgraphRelationBuilder::build_nodetree(bNodeTree *ntree) } OperationKey shading_update_key(&ntree->id, - DEG_NODE_TYPE_SHADING, - DEG_OPCODE_MATERIAL_UPDATE); + NodeType::SHADING, + OperationCode::MATERIAL_UPDATE); OperationKey shading_parameters_key(&ntree->id, - DEG_NODE_TYPE_SHADING_PARAMETERS, - DEG_OPCODE_MATERIAL_UPDATE); + NodeType::SHADING_PARAMETERS, + OperationCode::MATERIAL_UPDATE); add_relation(shading_parameters_key, shading_update_key, "NTree Shading Parameters"); if (check_id_has_anim_component(&ntree->id)) { - ComponentKey animation_key(&ntree->id, DEG_NODE_TYPE_ANIMATION); + ComponentKey animation_key(&ntree->id, NodeType::ANIMATION); add_relation(animation_key, shading_parameters_key, "NTree Shading Parameters"); } } @@ -2359,11 +2326,11 @@ void DepsgraphRelationBuilder::build_material(Material *material) if (material->nodetree != NULL) { build_nodetree(material->nodetree); OperationKey ntree_key(&material->nodetree->id, - DEG_NODE_TYPE_SHADING, - DEG_OPCODE_MATERIAL_UPDATE); + NodeType::SHADING, + OperationCode::MATERIAL_UPDATE); OperationKey material_key(&material->id, - DEG_NODE_TYPE_SHADING, - DEG_OPCODE_MATERIAL_UPDATE); + NodeType::SHADING, + OperationCode::MATERIAL_UPDATE); add_relation(ntree_key, material_key, "Material's NTree"); build_nested_nodetree(&material->id, material->nodetree); } @@ -2381,9 +2348,9 @@ void DepsgraphRelationBuilder::build_texture(Tex *texture) build_nodetree(texture->nodetree); build_nested_nodetree(&texture->id, texture->nodetree); if (check_id_has_anim_component(&texture->id)) { - ComponentKey animation_key(&texture->id, DEG_NODE_TYPE_ANIMATION); + ComponentKey animation_key(&texture->id, NodeType::ANIMATION); ComponentKey datablock_key(&texture->id, - DEG_NODE_TYPE_GENERIC_DATABLOCK); + NodeType::GENERIC_DATABLOCK); add_relation(animation_key, datablock_key, "Datablock Animation"); } } @@ -2424,12 +2391,12 @@ void DepsgraphRelationBuilder::build_mask(Mask *mask) build_animdata(mask_id); /* Own mask animation. */ OperationKey mask_animation_key(mask_id, - DEG_NODE_TYPE_ANIMATION, - DEG_OPCODE_MASK_ANIMATION); + NodeType::ANIMATION, + OperationCode::MASK_ANIMATION); TimeSourceKey time_src_key; add_relation(time_src_key, mask_animation_key, "TimeSrc -> Mask Animation"); /* Final mask evaluation. */ - ComponentKey parameters_key(mask_id, DEG_NODE_TYPE_PARAMETERS); + ComponentKey parameters_key(mask_id, NodeType::PARAMETERS); add_relation(mask_animation_key, parameters_key, "Mask Animation -> Mask Eval"); } @@ -2460,7 +2427,7 @@ void DepsgraphRelationBuilder::build_speaker(Speaker *speaker) void DepsgraphRelationBuilder::build_copy_on_write_relations() { - foreach (IDDepsNode *id_node, graph_->id_nodes) { + for (IDNode *id_node : graph_->id_nodes) { build_copy_on_write_relations(id_node); } } @@ -2473,11 +2440,11 @@ void DepsgraphRelationBuilder::build_copy_on_write_relations() void DepsgraphRelationBuilder::build_nested_datablock(ID *owner, ID *id) { OperationKey owner_copy_on_write_key(owner, - DEG_NODE_TYPE_COPY_ON_WRITE, - DEG_OPCODE_COPY_ON_WRITE); + NodeType::COPY_ON_WRITE, + OperationCode::COPY_ON_WRITE); OperationKey id_copy_on_write_key(id, - DEG_NODE_TYPE_COPY_ON_WRITE, - DEG_OPCODE_COPY_ON_WRITE); + NodeType::COPY_ON_WRITE, + OperationCode::COPY_ON_WRITE); add_relation(id_copy_on_write_key, owner_copy_on_write_key, "Eval Order"); @@ -2500,24 +2467,24 @@ void DepsgraphRelationBuilder::build_nested_shapekey(ID *owner, Key *key) build_nested_datablock(owner, &key->id); } -void DepsgraphRelationBuilder::build_copy_on_write_relations(IDDepsNode *id_node) +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); TimeSourceKey time_source_key; OperationKey copy_on_write_key(id_orig, - DEG_NODE_TYPE_COPY_ON_WRITE, - DEG_OPCODE_COPY_ON_WRITE); + NodeType::COPY_ON_WRITE, + OperationCode::COPY_ON_WRITE); /* XXX: This is a quick hack to make Alt-A to work. */ // add_relation(time_source_key, copy_on_write_key, "Fluxgate capacitor hack"); /* Resat of code is using rather low level trickery, so need to get some * explicit pointers. */ - DepsNode *node_cow = find_node(copy_on_write_key); - OperationDepsNode *op_cow = node_cow->get_exit_operation(); + Node *node_cow = find_node(copy_on_write_key); + OperationNode *op_cow = node_cow->get_exit_operation(); /* Plug any other components to this one. */ - GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, id_node->components) + GHASH_FOREACH_BEGIN(ComponentNode *, comp_node, id_node->components) { - if (comp_node->type == DEG_NODE_TYPE_COPY_ON_WRITE) { + if (comp_node->type == NodeType::COPY_ON_WRITE) { /* Copy-on-write component never depends on itself. */ continue; } @@ -2525,13 +2492,13 @@ void DepsgraphRelationBuilder::build_copy_on_write_relations(IDDepsNode *id_node /* Component explicitly requests to not add relation. */ continue; } - int rel_flag = (DEPSREL_FLAG_NO_FLUSH | DEPSREL_FLAG_GODMODE); - if (id_type == ID_ME && comp_node->type == DEG_NODE_TYPE_GEOMETRY) { - rel_flag &= ~DEPSREL_FLAG_NO_FLUSH; + int rel_flag = (RELATION_FLAG_NO_FLUSH | RELATION_FLAG_GODMODE); + if (id_type == ID_ME && comp_node->type == NodeType::GEOMETRY) { + rel_flag &= ~RELATION_FLAG_NO_FLUSH; } /* materials need update grease pencil objects */ if (id_type == ID_MA) { - rel_flag &= ~DEPSREL_FLAG_NO_FLUSH; + rel_flag &= ~RELATION_FLAG_NO_FLUSH; } /* Notes on exceptions: * - Parameters component is where drivers are living. Changing any @@ -2550,49 +2517,47 @@ void DepsgraphRelationBuilder::build_copy_on_write_relations(IDDepsNode *id_node * - Action is allowed to flush as well, this way it's possible to * keep current tagging in animation editors (which tags action for * CoW update when it's changed) but yet guarantee evaluation order - * with objects which are using that action. - */ - if (comp_node->type == DEG_NODE_TYPE_PARAMETERS || - comp_node->type == DEG_NODE_TYPE_LAYER_COLLECTIONS || - (comp_node->type == DEG_NODE_TYPE_ANIMATION && id_type == ID_AC)) + * with objects which are using that action. */ + if (comp_node->type == NodeType::PARAMETERS || + comp_node->type == NodeType::LAYER_COLLECTIONS || + (comp_node->type == NodeType::ANIMATION && id_type == ID_AC)) { - rel_flag &= ~DEPSREL_FLAG_NO_FLUSH; + rel_flag &= ~RELATION_FLAG_NO_FLUSH; } /* All entry operations of each component should wait for a proper - * copy of ID. - */ - OperationDepsNode *op_entry = comp_node->get_entry_operation(); + * copy of ID. */ + OperationNode *op_entry = comp_node->get_entry_operation(); if (op_entry != NULL) { - DepsRelation *rel = graph_->add_new_relation( + Relation *rel = graph_->add_new_relation( op_cow, op_entry, "CoW Dependency"); rel->flag |= rel_flag; } /* All dangling operations should also be executed after copy-on-write. */ - GHASH_FOREACH_BEGIN(OperationDepsNode *, op_node, comp_node->operations_map) + GHASH_FOREACH_BEGIN(OperationNode *, op_node, comp_node->operations_map) { if (op_node == op_entry) { continue; } if (op_node->inlinks.size() == 0) { - DepsRelation *rel = graph_->add_new_relation( + Relation *rel = graph_->add_new_relation( op_cow, op_node, "CoW Dependency"); rel->flag |= rel_flag; } else { bool has_same_comp_dependency = false; - foreach (DepsRelation *rel_current, op_node->inlinks) { - if (rel_current->from->type != DEG_NODE_TYPE_OPERATION) { + for (Relation *rel_current : op_node->inlinks) { + if (rel_current->from->type != NodeType::OPERATION) { continue; } - OperationDepsNode *op_node_from = - (OperationDepsNode *)rel_current->from; + OperationNode *op_node_from = + (OperationNode *)rel_current->from; if (op_node_from->owner == op_node->owner) { has_same_comp_dependency = true; break; } } if (!has_same_comp_dependency) { - DepsRelation *rel = graph_->add_new_relation( + Relation *rel = graph_->add_new_relation( op_cow, op_node, "CoW Dependency"); rel->flag |= rel_flag; } @@ -2605,25 +2570,23 @@ void DepsgraphRelationBuilder::build_copy_on_write_relations(IDDepsNode *id_node * component of it's Mesh. This is because pointers are all known * already so remapping will happen all correct. And then If some object * evaluation step needs geometry, it will have transitive dependency - * to Mesh copy-on-write already. - */ + * to Mesh copy-on-write already. */ } GHASH_FOREACH_END(); /* TODO(sergey): This solves crash for now, but causes too many - * updates potentially. - */ + * updates potentially. */ if (GS(id_orig->name) == ID_OB) { Object *object = (Object *)id_orig; ID *object_data_id = (ID *)object->data; if (object_data_id != NULL) { if (deg_copy_on_write_is_needed(object_data_id)) { OperationKey data_copy_on_write_key(object_data_id, - DEG_NODE_TYPE_COPY_ON_WRITE, - DEG_OPCODE_COPY_ON_WRITE); + NodeType::COPY_ON_WRITE, + OperationCode::COPY_ON_WRITE); add_relation(data_copy_on_write_key, copy_on_write_key, "Eval Order", - DEPSREL_FLAG_GODMODE); + RELATION_FLAG_GODMODE); } } else { diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h b/source/blender/depsgraph/intern/builder/deg_builder_relations.h index aafd351cbc5..e504550f361 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h @@ -33,7 +33,7 @@ #include #include -#include "intern/depsgraph_types.h" +#include "intern/depsgraph_type.h" #include "DNA_ID.h" @@ -45,9 +45,9 @@ #include "intern/builder/deg_builder_map.h" #include "intern/depsgraph.h" -#include "intern/nodes/deg_node.h" -#include "intern/nodes/deg_node_component.h" -#include "intern/nodes/deg_node_operation.h" +#include "intern/node/deg_node.h" +#include "intern/node/deg_node_component.h" +#include "intern/node/deg_node_operation.h" struct Base; struct CacheFile; @@ -87,15 +87,15 @@ struct PropertyRNA; namespace DEG { -struct ComponentDepsNode; -struct DepsNode; +struct ComponentNode; +struct Node; struct DepsNodeHandle; -struct DepsRelation; +struct Relation; struct Depsgraph; -struct IDDepsNode; -struct OperationDepsNode; +struct IDNode; +struct OperationNode; struct RootPChanMap; -struct TimeSourceDepsNode; +struct TimeSourceNode; struct TimeSourceKey { @@ -110,12 +110,12 @@ struct TimeSourceKey struct ComponentKey { ComponentKey(); - ComponentKey(ID *id, eDepsNode_Type type, const char *name = ""); + ComponentKey(ID *id, NodeType type, const char *name = ""); string identifier() const; ID *id; - eDepsNode_Type type; + NodeType type; const char *name; }; @@ -123,41 +123,41 @@ struct OperationKey { OperationKey(); OperationKey(ID *id, - eDepsNode_Type component_type, + NodeType component_type, const char *name, int name_tag = -1); OperationKey(ID *id, - eDepsNode_Type component_type, + NodeType component_type, const char *component_name, const char *name, int name_tag); OperationKey(ID *id, - eDepsNode_Type component_type, - eDepsOperation_Code opcode); + NodeType component_type, + OperationCode opcode); OperationKey(ID *id, - eDepsNode_Type component_type, + NodeType component_type, const char *component_name, - eDepsOperation_Code opcode); + OperationCode opcode); OperationKey(ID *id, - eDepsNode_Type component_type, - eDepsOperation_Code opcode, + NodeType component_type, + OperationCode opcode, const char *name, int name_tag = -1); OperationKey(ID *id, - eDepsNode_Type component_type, + NodeType component_type, const char *component_name, - eDepsOperation_Code opcode, + OperationCode opcode, const char *name, int name_tag = -1); string identifier() const; ID *id; - eDepsNode_Type component_type; + NodeType component_type; const char *component_name; - eDepsOperation_Code opcode; + OperationCode opcode; const char *name; int name_tag; }; @@ -185,31 +185,22 @@ struct DepsgraphRelationBuilder void begin_build(); template - DepsRelation *add_relation(const KeyFrom& key_from, - const KeyTo& key_to, - const char *description, - bool check_unique = false, - int flags = 0); - - template - DepsRelation *add_relation(const KeyFrom& key_from, - const KeyTo& key_to, - const char *description, - eDepsRelation_Flag flag); + Relation *add_relation(const KeyFrom& key_from, + const KeyTo& key_to, + const char *description, + int flags = 0); template - DepsRelation *add_relation(const TimeSourceKey& key_from, - const KeyTo& key_to, - const char *description, - bool check_unique = false, - int flags = 0); + Relation *add_relation(const TimeSourceKey& key_from, + const KeyTo& key_to, + const char *description, + int flags = 0); template - DepsRelation *add_node_handle_relation(const KeyType& key_from, - const DepsNodeHandle *handle, - const char *description, - bool check_unique = false, - int flags = 0); + Relation *add_node_handle_relation(const KeyType& key_from, + const DepsNodeHandle *handle, + const char *description, + int flags = 0); void add_customdata_mask(Object *object, uint64_t mask); void add_special_eval_flag(ID *object, uint32_t flag); @@ -232,7 +223,7 @@ struct DepsgraphRelationBuilder void build_object_parent(Object *object); void build_object_pointcache(Object *object); void build_constraints(ID *id, - eDepsNode_Type component_type, + NodeType component_type, const char *component_subdata, ListBase *constraints, RootPChanMap *root_map); @@ -240,11 +231,11 @@ struct DepsgraphRelationBuilder void build_animdata_curves(ID *id); void build_animdata_curves_targets(ID *id, ComponentKey &adt_key, - OperationDepsNode *operation_from, + OperationNode *operation_from, ListBase *curves); void build_animdata_nlastrip_targets(ID *id, ComponentKey &adt_key, - OperationDepsNode *operation_from, + OperationNode *operation_from, ListBase *strips); void build_animdata_drivers(ID *id); void build_action(bAction *action); @@ -298,32 +289,30 @@ struct DepsgraphRelationBuilder bool add_absorption, const char *name); void build_copy_on_write_relations(); - void build_copy_on_write_relations(IDDepsNode *id_node); + void build_copy_on_write_relations(IDNode *id_node); template - OperationDepsNode *find_operation_node(const KeyType &key); + OperationNode *find_operation_node(const KeyType &key); Depsgraph *getGraph(); protected: - TimeSourceDepsNode *get_node(const TimeSourceKey &key) const; - ComponentDepsNode *get_node(const ComponentKey &key) const; - OperationDepsNode *get_node(const OperationKey &key) const; - DepsNode *get_node(const RNAPathKey &key) const; + TimeSourceNode *get_node(const TimeSourceKey &key) const; + ComponentNode *get_node(const ComponentKey &key) const; + OperationNode *get_node(const OperationKey &key) const; + Node *get_node(const RNAPathKey &key) const; - OperationDepsNode *find_node(const OperationKey &key) const; + OperationNode *find_node(const OperationKey &key) const; bool has_node(const OperationKey &key) const; - DepsRelation *add_time_relation(TimeSourceDepsNode *timesrc, - DepsNode *node_to, - const char *description, - bool check_unique = false, - int flags = 0); - DepsRelation *add_operation_relation(OperationDepsNode *node_from, - OperationDepsNode *node_to, - const char *description, - bool check_unique = false, - int flags = 0); + Relation *add_time_relation(TimeSourceNode *timesrc, + Node *node_to, + const char *description, + int flags = 0); + Relation *add_operation_relation(OperationNode *node_from, + OperationNode *node_to, + const char *description, + int flags = 0); template DepsNodeHandle create_node_handle(const KeyType& key, @@ -335,14 +324,12 @@ protected: * * This is used by drivers relations builder to avoid possible fake * dependency cycle when one bone property drives another property of the - * same bone. - */ + * same bone. */ template bool is_same_bone_dependency(const KeyFrom& key_from, const KeyTo& key_to); /* Similar to above, but used to check whether driver is using node from - * the same node tree as a driver variable. - */ + * the same node tree as a driver variable. */ template bool is_same_nodetree_node_dependency(const KeyFrom& key_from, const KeyTo& key_to); @@ -375,7 +362,7 @@ private: struct DepsNodeHandle { DepsNodeHandle(DepsgraphRelationBuilder *builder, - OperationDepsNode *node, + OperationNode *node, const char *default_name = "") : builder(builder), node(node), @@ -385,7 +372,7 @@ struct DepsNodeHandle } DepsgraphRelationBuilder *builder; - OperationDepsNode *node; + OperationNode *node; const char *default_name; }; diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h b/source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h index f5b9a9ed25a..67e9f9e6071 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h @@ -30,7 +30,7 @@ #pragma once -#include "intern/nodes/deg_node_id.h" +#include "intern/node/deg_node_id.h" extern "C" { #include "DNA_ID.h" @@ -39,26 +39,24 @@ extern "C" { namespace DEG { template -OperationDepsNode *DepsgraphRelationBuilder::find_operation_node(const KeyType& key) +OperationNode *DepsgraphRelationBuilder::find_operation_node(const KeyType& key) { - DepsNode *node = get_node(key); + Node *node = get_node(key); return node != NULL ? node->get_exit_operation() : NULL; } template -DepsRelation *DepsgraphRelationBuilder::add_relation(const KeyFrom &key_from, - const KeyTo &key_to, - const char *description, - bool check_unique, - int flags) +Relation *DepsgraphRelationBuilder::add_relation(const KeyFrom &key_from, + const KeyTo &key_to, + const char *description, + int flags) { - DepsNode *node_from = get_node(key_from); - DepsNode *node_to = get_node(key_to); - OperationDepsNode *op_from = node_from ? node_from->get_exit_operation() : NULL; - OperationDepsNode *op_to = node_to ? node_to->get_entry_operation() : NULL; + Node *node_from = get_node(key_from); + Node *node_to = get_node(key_to); + OperationNode *op_from = node_from ? node_from->get_exit_operation() : NULL; + OperationNode *op_to = node_to ? node_to->get_entry_operation() : NULL; if (op_from && op_to) { - return add_operation_relation( - op_from, op_to, description, check_unique, flags); + return add_operation_relation(op_from, op_to, description, flags); } else { if (!op_from) { @@ -83,49 +81,35 @@ DepsRelation *DepsgraphRelationBuilder::add_relation(const KeyFrom &key_from, return NULL; } -template -DepsRelation *DepsgraphRelationBuilder::add_relation( - const KeyFrom& key_from, - const KeyTo& key_to, - const char *description, - eDepsRelation_Flag flag) -{ - return add_relation( - key_from, key_to, description, false, static_cast(flag)); -} - template -DepsRelation *DepsgraphRelationBuilder::add_relation( +Relation *DepsgraphRelationBuilder::add_relation( const TimeSourceKey &key_from, const KeyTo &key_to, const char *description, - bool check_unique, int flags) { - TimeSourceDepsNode *time_from = get_node(key_from); - DepsNode *node_to = get_node(key_to); - OperationDepsNode *op_to = node_to ? node_to->get_entry_operation() : NULL; + TimeSourceNode *time_from = get_node(key_from); + Node *node_to = get_node(key_to); + OperationNode *op_to = node_to ? node_to->get_entry_operation() : NULL; if (time_from != NULL && op_to != NULL) { return add_time_relation( - time_from, op_to, description, check_unique, flags); + time_from, op_to, description, flags); } return NULL; } template -DepsRelation *DepsgraphRelationBuilder::add_node_handle_relation( +Relation *DepsgraphRelationBuilder::add_node_handle_relation( const KeyType &key_from, const DepsNodeHandle *handle, const char *description, - bool check_unique, int flags) { - DepsNode *node_from = get_node(key_from); - OperationDepsNode *op_from = node_from ? node_from->get_exit_operation() : NULL; - OperationDepsNode *op_to = handle->node->get_entry_operation(); + Node *node_from = get_node(key_from); + OperationNode *op_from = node_from ? node_from->get_exit_operation() : NULL; + OperationNode *op_to = handle->node->get_entry_operation(); if (op_from != NULL && op_to != NULL) { - return add_operation_relation( - op_from, op_to, description, check_unique, flags); + return add_operation_relation(op_from, op_to, description, flags); } else { if (!op_from) { @@ -157,13 +141,13 @@ bool DepsgraphRelationBuilder::is_same_bone_dependency(const KeyFrom& key_from, const KeyTo& key_to) { /* Get operations for requested keys. */ - DepsNode *node_from = get_node(key_from); - DepsNode *node_to = get_node(key_to); + Node *node_from = get_node(key_from); + Node *node_to = get_node(key_to); if (node_from == NULL || node_to == NULL) { return false; } - OperationDepsNode *op_from = node_from->get_exit_operation(); - OperationDepsNode *op_to = node_to->get_entry_operation(); + OperationNode *op_from = node_from->get_exit_operation(); + OperationNode *op_to = node_to->get_entry_operation(); if (op_from == NULL || op_to == NULL) { return false; } @@ -172,8 +156,8 @@ bool DepsgraphRelationBuilder::is_same_bone_dependency(const KeyFrom& key_from, return false; } /* We are only interested in relations like BONE_DONE -> BONE_LOCAL... */ - if (!(op_from->opcode == DEG_OPCODE_BONE_DONE && - op_to->opcode == DEG_OPCODE_BONE_LOCAL)) + if (!(op_from->opcode == OperationCode::BONE_DONE && + op_to->opcode == OperationCode::BONE_LOCAL)) { return false; } @@ -190,13 +174,13 @@ bool DepsgraphRelationBuilder::is_same_nodetree_node_dependency( const KeyTo& key_to) { /* Get operations for requested keys. */ - DepsNode *node_from = get_node(key_from); - DepsNode *node_to = get_node(key_to); + Node *node_from = get_node(key_from); + Node *node_to = get_node(key_to); if (node_from == NULL || node_to == NULL) { return false; } - OperationDepsNode *op_from = node_from->get_exit_operation(); - OperationDepsNode *op_to = node_to->get_entry_operation(); + OperationNode *op_from = node_from->get_exit_operation(); + OperationNode *op_to = node_to->get_entry_operation(); if (op_from == NULL || op_to == NULL) { return false; } @@ -209,8 +193,8 @@ bool DepsgraphRelationBuilder::is_same_nodetree_node_dependency( return false; } /* We are only interested in relations like BONE_DONE -> BONE_LOCAL... */ - if (!(op_from->opcode == DEG_OPCODE_PARAMETERS_EVAL && - op_to->opcode == DEG_OPCODE_PARAMETERS_EVAL)) + if (!(op_from->opcode == OperationCode::PARAMETERS_EVAL && + op_to->opcode == OperationCode::PARAMETERS_EVAL)) { return false; } diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc index f86959a1693..454a886f946 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc @@ -57,12 +57,12 @@ string TimeSourceKey::identifier() const ComponentKey::ComponentKey() : id(NULL), - type(DEG_NODE_TYPE_UNDEFINED), + type(NodeType::UNDEFINED), name("") { } -ComponentKey::ComponentKey(ID *id, eDepsNode_Type type, const char *name) +ComponentKey::ComponentKey(ID *id, NodeType type, const char *name) : id(id), type(type), name(name) @@ -87,44 +87,44 @@ string ComponentKey::identifier() const OperationKey::OperationKey() : id(NULL), - component_type(DEG_NODE_TYPE_UNDEFINED), + component_type(NodeType::UNDEFINED), component_name(""), - opcode(DEG_OPCODE_OPERATION), + opcode(OperationCode::OPERATION), name(""), name_tag(-1) { } OperationKey::OperationKey(ID *id, - eDepsNode_Type component_type, + NodeType component_type, const char *name, int name_tag) : id(id), component_type(component_type), component_name(""), - opcode(DEG_OPCODE_OPERATION), + opcode(OperationCode::OPERATION), name(name), name_tag(name_tag) { } OperationKey::OperationKey(ID *id, - eDepsNode_Type component_type, + NodeType component_type, const char *component_name, const char *name, int name_tag) : id(id), component_type(component_type), component_name(component_name), - opcode(DEG_OPCODE_OPERATION), + opcode(OperationCode::OPERATION), name(name), name_tag(name_tag) { } OperationKey::OperationKey(ID *id, - eDepsNode_Type component_type, - eDepsOperation_Code opcode) + NodeType component_type, + OperationCode opcode) : id(id), component_type(component_type), component_name(""), @@ -135,9 +135,9 @@ OperationKey::OperationKey(ID *id, } OperationKey::OperationKey(ID *id, - eDepsNode_Type component_type, + NodeType component_type, const char *component_name, - eDepsOperation_Code opcode) + OperationCode opcode) : id(id), component_type(component_type), component_name(component_name), @@ -148,8 +148,8 @@ OperationKey::OperationKey(ID *id, } OperationKey::OperationKey(ID *id, - eDepsNode_Type component_type, - eDepsOperation_Code opcode, + NodeType component_type, + OperationCode opcode, const char *name, int name_tag) : id(id), @@ -162,9 +162,9 @@ OperationKey::OperationKey(ID *id, } OperationKey::OperationKey(ID *id, - eDepsNode_Type component_type, + NodeType component_type, const char *component_name, - eDepsOperation_Code opcode, + OperationCode opcode, const char *name, int name_tag) : id(id), diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc index efedf847515..0915da3f7cc 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc @@ -59,15 +59,12 @@ extern "C" { #include "intern/builder/deg_builder.h" #include "intern/builder/deg_builder_pchanmap.h" +#include "intern/debug/deg_debug.h" +#include "intern/node/deg_node.h" +#include "intern/node/deg_node_component.h" +#include "intern/node/deg_node_operation.h" -#include "intern/nodes/deg_node.h" -#include "intern/nodes/deg_node_component.h" -#include "intern/nodes/deg_node_operation.h" - -#include "intern/depsgraph_intern.h" -#include "intern/depsgraph_types.h" - -#include "util/deg_util_foreach.h" +#include "intern/depsgraph_type.h" namespace DEG { @@ -84,24 +81,24 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *object, return; } OperationKey pchan_local_key(&object->id, - DEG_NODE_TYPE_BONE, + NodeType::BONE, pchan->name, - DEG_OPCODE_BONE_LOCAL); + OperationCode::BONE_LOCAL); OperationKey init_ik_key( - &object->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_INIT_IK); + &object->id, NodeType::EVAL_POSE, OperationCode::POSE_INIT_IK); OperationKey solver_key(&object->id, - DEG_NODE_TYPE_EVAL_POSE, + NodeType::EVAL_POSE, rootchan->name, - DEG_OPCODE_POSE_IK_SOLVER); + OperationCode::POSE_IK_SOLVER); OperationKey pose_cleanup_key( - &object->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_CLEANUP); + &object->id, NodeType::EVAL_POSE, OperationCode::POSE_CLEANUP); add_relation(pchan_local_key, init_ik_key, "IK Constraint -> Init IK Tree"); add_relation(init_ik_key, solver_key, "Init IK -> IK Solver"); /* Never cleanup before solver is run. */ add_relation(solver_key, pose_cleanup_key, "IK Solver -> Cleanup", - DEPSREL_FLAG_GODMODE); + RELATION_FLAG_GODMODE); /* IK target */ /* TODO(sergey): This should get handled as part of the constraint code. */ if (data->tar != NULL) { @@ -112,23 +109,23 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *object, * This way we ensuring the whole subtree is updated from scratch * without need of intermediate matricies. This is an overkill, but good * enough for testing IK solver. */ - ComponentKey pose_key(&object->id, DEG_NODE_TYPE_EVAL_POSE); + ComponentKey pose_key(&object->id, NodeType::EVAL_POSE); if ((data->tar->type == OB_ARMATURE) && (data->subtarget[0])) { /* TODO(sergey): This is only for until granular update stores * intermediate result. */ if (data->tar != object) { /* Different armature - can just read the results. */ ComponentKey target_key( - &data->tar->id, DEG_NODE_TYPE_BONE, data->subtarget); + &data->tar->id, NodeType::BONE, data->subtarget); add_relation(target_key, pose_key, con->name); } else { /* Same armature - we'll use the ready state only, just in case * this bone is in the chain we're solving. */ OperationKey target_key(&data->tar->id, - DEG_NODE_TYPE_BONE, + NodeType::BONE, data->subtarget, - DEG_OPCODE_BONE_DONE); + OperationCode::BONE_DONE); add_relation(target_key, solver_key, con->name); } } @@ -138,13 +135,13 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *object, /* Vertex group target. */ /* NOTE: for now, we don't need to represent vertex groups * separately. */ - ComponentKey target_key(&data->tar->id, DEG_NODE_TYPE_GEOMETRY); + ComponentKey target_key(&data->tar->id, NodeType::GEOMETRY); add_relation(target_key, solver_key, con->name); add_customdata_mask(data->tar, CD_MASK_MDEFORMVERT); } else { /* Standard Object Target. */ - ComponentKey target_key(&data->tar->id, DEG_NODE_TYPE_TRANSFORM); + ComponentKey target_key(&data->tar->id, NodeType::TRANSFORM); add_relation(target_key, pose_key, con->name); } if (data->tar == object && data->subtarget[0]) { @@ -158,7 +155,7 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *object, if (data->poletar != NULL) { if ((data->poletar->type == OB_ARMATURE) && (data->polesubtarget[0])) { ComponentKey target_key(&data->poletar->id, - DEG_NODE_TYPE_BONE, + NodeType::BONE, data->polesubtarget); add_relation(target_key, solver_key, con->name); } @@ -168,12 +165,12 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *object, /* Vertex group target. */ /* NOTE: for now, we don't need to represent vertex groups * separately. */ - ComponentKey target_key(&data->poletar->id, DEG_NODE_TYPE_GEOMETRY); + ComponentKey target_key(&data->poletar->id, NodeType::GEOMETRY); add_relation(target_key, solver_key, con->name); add_customdata_mask(data->poletar, CD_MASK_MDEFORMVERT); } else { - ComponentKey target_key(&data->poletar->id, DEG_NODE_TYPE_TRANSFORM); + ComponentKey target_key(&data->poletar->id, NodeType::TRANSFORM); add_relation(target_key, solver_key, con->name); } } @@ -189,8 +186,8 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *object, parchan = pchan->parent; } root_map->add_bone(parchan->name, rootchan->name); - OperationKey parchan_transforms_key(&object->id, DEG_NODE_TYPE_BONE, - parchan->name, DEG_OPCODE_BONE_READY); + OperationKey parchan_transforms_key(&object->id, NodeType::BONE, + parchan->name, OperationCode::BONE_READY); add_relation(parchan_transforms_key, solver_key, "IK Solver Owner"); /* Walk to the chain's root. */ int segcount = 0; @@ -201,21 +198,21 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *object, * with IK solver results. */ if (parchan != pchan) { OperationKey parent_key(&object->id, - DEG_NODE_TYPE_BONE, + NodeType::BONE, parchan->name, - DEG_OPCODE_BONE_READY); + OperationCode::BONE_READY); add_relation(parent_key, solver_key, "IK Chain Parent"); OperationKey bone_done_key(&object->id, - DEG_NODE_TYPE_BONE, + NodeType::BONE, parchan->name, - DEG_OPCODE_BONE_DONE); + OperationCode::BONE_DONE); add_relation(solver_key, bone_done_key, "IK Chain Result"); } else { OperationKey final_transforms_key(&object->id, - DEG_NODE_TYPE_BONE, + NodeType::BONE, parchan->name, - DEG_OPCODE_BONE_DONE); + OperationCode::BONE_DONE); add_relation(solver_key, final_transforms_key, "IK Solver Result"); } parchan->flag |= POSE_DONE; @@ -234,7 +231,7 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *object, parchan = parchan->parent; } OperationKey pose_done_key( - &object->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_DONE); + &object->id, NodeType::EVAL_POSE, OperationCode::POSE_DONE); add_relation(solver_key, pose_done_key, "PoseEval Result-Bone Link"); } @@ -247,18 +244,18 @@ void DepsgraphRelationBuilder::build_splineik_pose(Object *object, bSplineIKConstraint *data = (bSplineIKConstraint *)con->data; bPoseChannel *rootchan = BKE_armature_splineik_solver_find_root(pchan, data); OperationKey transforms_key(&object->id, - DEG_NODE_TYPE_BONE, + NodeType::BONE, pchan->name, - DEG_OPCODE_BONE_READY); + OperationCode::BONE_READY); OperationKey init_ik_key(&object->id, - DEG_NODE_TYPE_EVAL_POSE, - DEG_OPCODE_POSE_INIT_IK); + NodeType::EVAL_POSE, + OperationCode::POSE_INIT_IK); OperationKey solver_key(&object->id, - DEG_NODE_TYPE_EVAL_POSE, + NodeType::EVAL_POSE, rootchan->name, - DEG_OPCODE_POSE_SPLINE_IK_SOLVER); + OperationCode::POSE_SPLINE_IK_SOLVER); OperationKey pose_cleanup_key( - &object->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_CLEANUP); + &object->id, NodeType::EVAL_POSE, OperationCode::POSE_CLEANUP); /* Solver depends on initialization. */ add_relation(init_ik_key, solver_key, "Init IK -> IK Solver"); /* Never cleanup before solver is run. */ @@ -267,22 +264,21 @@ void DepsgraphRelationBuilder::build_splineik_pose(Object *object, add_relation(transforms_key, solver_key, "Spline IK Solver Owner", - DEPSREL_FLAG_GODMODE); + RELATION_FLAG_GODMODE); /* Attach path dependency to solver. */ if (data->tar != NULL) { /* TODO(sergey): For until we'll store partial matricies in the * depsgraph, we create dependency between target object and pose eval - * component. See IK pose for a bit more information. - */ + * component. See IK pose for a bit more information. */ /* TODO: the bigggest point here is that we need the curve PATH and not * just the general geometry. */ - ComponentKey target_key(&data->tar->id, DEG_NODE_TYPE_GEOMETRY); - ComponentKey pose_key(&object->id, DEG_NODE_TYPE_EVAL_POSE); + ComponentKey target_key(&data->tar->id, NodeType::GEOMETRY); + ComponentKey pose_key(&object->id, NodeType::EVAL_POSE); add_relation(target_key, pose_key, "Curve.Path -> Spline IK"); } pchan->flag |= POSE_DONE; OperationKey final_transforms_key( - &object->id, DEG_NODE_TYPE_BONE, pchan->name, DEG_OPCODE_BONE_DONE); + &object->id, NodeType::BONE, pchan->name, OperationCode::BONE_DONE); add_relation(solver_key, final_transforms_key, "Spline IK Result"); root_map->add_bone(pchan->name, rootchan->name); /* Walk to the chain's root/ */ @@ -297,21 +293,21 @@ void DepsgraphRelationBuilder::build_splineik_pose(Object *object, * the result with IK solver results. */ if (parchan != pchan) { OperationKey parent_key(&object->id, - DEG_NODE_TYPE_BONE, + NodeType::BONE, parchan->name, - DEG_OPCODE_BONE_READY); + OperationCode::BONE_READY); add_relation(parent_key, solver_key, "Spline IK Solver Update"); OperationKey bone_done_key(&object->id, - DEG_NODE_TYPE_BONE, + NodeType::BONE, parchan->name, - DEG_OPCODE_BONE_DONE); + OperationCode::BONE_DONE); add_relation(solver_key, bone_done_key, "IK Chain Result"); } parchan->flag |= POSE_DONE; OperationKey final_transforms_key(&object->id, - DEG_NODE_TYPE_BONE, + NodeType::BONE, parchan->name, - DEG_OPCODE_BONE_DONE); + OperationCode::BONE_DONE); add_relation( solver_key, final_transforms_key, "Spline IK Solver Result"); root_map->add_bone(parchan->name, rootchan->name); @@ -323,7 +319,7 @@ void DepsgraphRelationBuilder::build_splineik_pose(Object *object, } } OperationKey pose_done_key( - &object->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_DONE); + &object->id, NodeType::EVAL_POSE, OperationCode::POSE_DONE); add_relation(solver_key, pose_done_key, "PoseEval Result-Bone Link"); } @@ -334,15 +330,15 @@ void DepsgraphRelationBuilder::build_rig(Object *object) bArmature *armature = (bArmature *)object->data; // TODO: selection status? /* Attach links between pose operations. */ - ComponentKey local_transform(&object->id, DEG_NODE_TYPE_TRANSFORM); + ComponentKey local_transform(&object->id, NodeType::TRANSFORM); OperationKey pose_init_key( - &object->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_INIT); + &object->id, NodeType::EVAL_POSE, OperationCode::POSE_INIT); OperationKey pose_init_ik_key( - &object->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_INIT_IK); + &object->id, NodeType::EVAL_POSE, OperationCode::POSE_INIT_IK); OperationKey pose_cleanup_key( - &object->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_CLEANUP); + &object->id, NodeType::EVAL_POSE, OperationCode::POSE_CLEANUP); OperationKey pose_done_key( - &object->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_DONE); + &object->id, NodeType::EVAL_POSE, OperationCode::POSE_DONE); add_relation( local_transform, pose_init_key, "Local Transform -> Pose Init"); add_relation(pose_init_key, pose_init_ik_key, "Pose Init -> Pose Init IK"); @@ -351,8 +347,8 @@ void DepsgraphRelationBuilder::build_rig(Object *object) /* Make sure pose is up-to-date with armature updates. */ build_armature(armature); OperationKey armature_key(&armature->id, - DEG_NODE_TYPE_PARAMETERS, - DEG_OPCODE_PLACEHOLDER, + NodeType::PARAMETERS, + OperationCode::PLACEHOLDER, "Armature Eval"); add_relation(armature_key, pose_init_key, "Data dependency"); /* IK Solvers. @@ -401,50 +397,50 @@ void DepsgraphRelationBuilder::build_rig(Object *object) if (pose_depends_on_local_transform) { /* TODO(sergey): Once partial updates are possible use relation between * object transform and solver itself in it's build function. */ - ComponentKey pose_key(&object->id, DEG_NODE_TYPE_EVAL_POSE); - ComponentKey local_transform_key(&object->id, DEG_NODE_TYPE_TRANSFORM); + ComponentKey pose_key(&object->id, NodeType::EVAL_POSE); + ComponentKey local_transform_key(&object->id, NodeType::TRANSFORM); add_relation(local_transform_key, pose_key, "Local Transforms"); } /* Links between operations for each bone. */ LISTBASE_FOREACH (bPoseChannel *, pchan, &object->pose->chanbase) { OperationKey bone_local_key(&object->id, - DEG_NODE_TYPE_BONE, + NodeType::BONE, pchan->name, - DEG_OPCODE_BONE_LOCAL); + OperationCode::BONE_LOCAL); OperationKey bone_pose_key(&object->id, - DEG_NODE_TYPE_BONE, + NodeType::BONE, pchan->name, - DEG_OPCODE_BONE_POSE_PARENT); + OperationCode::BONE_POSE_PARENT); OperationKey bone_ready_key(&object->id, - DEG_NODE_TYPE_BONE, + NodeType::BONE, pchan->name, - DEG_OPCODE_BONE_READY); + OperationCode::BONE_READY); OperationKey bone_done_key(&object->id, - DEG_NODE_TYPE_BONE, + NodeType::BONE, pchan->name, - DEG_OPCODE_BONE_DONE); + OperationCode::BONE_DONE); pchan->flag &= ~POSE_DONE; /* Pose init to bone local. */ add_relation(pose_init_key, bone_local_key, "Pose Init - Bone Local", - DEPSREL_FLAG_GODMODE); + RELATION_FLAG_GODMODE); /* Local to pose parenting operation. */ add_relation(bone_local_key, bone_pose_key, "Bone Local - Bone Pose"); /* Parent relation. */ if (pchan->parent != NULL) { - eDepsOperation_Code parent_key_opcode; + OperationCode parent_key_opcode; /* NOTE: this difference in handling allows us to prevent lockups * while ensuring correct poses for separate chains. */ if (root_map.has_common_root(pchan->name, pchan->parent->name)) { - parent_key_opcode = DEG_OPCODE_BONE_READY; + parent_key_opcode = OperationCode::BONE_READY; } else { - parent_key_opcode = DEG_OPCODE_BONE_DONE; + parent_key_opcode = OperationCode::BONE_DONE; } OperationKey parent_key(&object->id, - DEG_NODE_TYPE_BONE, + NodeType::BONE, pchan->parent->name, parent_key_opcode); add_relation( @@ -459,15 +455,15 @@ void DepsgraphRelationBuilder::build_rig(Object *object) &pchan->constraints, constraint_walk, &data); /* Constraints stack and constraint dependencies. */ build_constraints(&object->id, - DEG_NODE_TYPE_BONE, + NodeType::BONE, pchan->name, &pchan->constraints, &root_map); /* Pose -> constraints. */ OperationKey constraints_key(&object->id, - DEG_NODE_TYPE_BONE, + NodeType::BONE, pchan->name, - DEG_OPCODE_BONE_CONSTRAINTS); + OperationCode::BONE_CONSTRAINTS); add_relation(bone_pose_key, constraints_key, "Constraints Stack"); /* Constraints -> ready/ */ /* TODO(sergey): When constraint stack is exploded, this step should @@ -487,9 +483,9 @@ void DepsgraphRelationBuilder::build_rig(Object *object) /* B-Bone shape is the real final step after Done if present. */ if (pchan->bone != NULL && pchan->bone->segments > 1) { OperationKey bone_segments_key(&object->id, - DEG_NODE_TYPE_BONE, + NodeType::BONE, pchan->name, - DEG_OPCODE_BONE_SEGMENTS); + OperationCode::BONE_SEGMENTS); /* B-Bone shape depends on the final position of the bone. */ add_relation(bone_done_key, bone_segments_key, @@ -499,18 +495,18 @@ void DepsgraphRelationBuilder::build_rig(Object *object) BKE_pchan_bbone_handles_get(pchan, &prev, &next); if (prev) { OperationKey prev_key(&object->id, - DEG_NODE_TYPE_BONE, + NodeType::BONE, prev->name, - DEG_OPCODE_BONE_DONE); + OperationCode::BONE_DONE); add_relation(prev_key, bone_segments_key, "Prev Handle -> B-Bone Segments"); } if (next) { OperationKey next_key(&object->id, - DEG_NODE_TYPE_BONE, + NodeType::BONE, next->name, - DEG_OPCODE_BONE_DONE); + OperationCode::BONE_DONE); add_relation(next_key, bone_segments_key, "Next Handle -> B-Bone Segments"); @@ -519,7 +515,7 @@ void DepsgraphRelationBuilder::build_rig(Object *object) add_relation(bone_segments_key, pose_done_key, "PoseEval Result-Bone Link", - DEPSREL_FLAG_GODMODE); + RELATION_FLAG_GODMODE); add_relation(bone_segments_key, pose_cleanup_key, "Cleanup dependency"); @@ -547,30 +543,30 @@ void DepsgraphRelationBuilder::build_proxy_rig(Object *object) Object *proxy_from = object->proxy_from; build_armature(armature); OperationKey pose_init_key(&object->id, - DEG_NODE_TYPE_EVAL_POSE, - DEG_OPCODE_POSE_INIT); + NodeType::EVAL_POSE, + OperationCode::POSE_INIT); OperationKey pose_done_key(&object->id, - DEG_NODE_TYPE_EVAL_POSE, - DEG_OPCODE_POSE_DONE); + NodeType::EVAL_POSE, + OperationCode::POSE_DONE); OperationKey pose_cleanup_key(&object->id, - DEG_NODE_TYPE_EVAL_POSE, - DEG_OPCODE_POSE_CLEANUP); + NodeType::EVAL_POSE, + OperationCode::POSE_CLEANUP); LISTBASE_FOREACH (bPoseChannel *, pchan, &object->pose->chanbase) { OperationKey bone_local_key(&object->id, - DEG_NODE_TYPE_BONE, pchan->name, - DEG_OPCODE_BONE_LOCAL); + NodeType::BONE, pchan->name, + OperationCode::BONE_LOCAL); OperationKey bone_ready_key(&object->id, - DEG_NODE_TYPE_BONE, + NodeType::BONE, pchan->name, - DEG_OPCODE_BONE_READY); + OperationCode::BONE_READY); OperationKey bone_done_key(&object->id, - DEG_NODE_TYPE_BONE, + NodeType::BONE, pchan->name, - DEG_OPCODE_BONE_DONE); + OperationCode::BONE_DONE); OperationKey from_bone_done_key(&proxy_from->id, - DEG_NODE_TYPE_BONE, + NodeType::BONE, pchan->name, - DEG_OPCODE_BONE_DONE); + OperationCode::BONE_DONE); add_relation(pose_init_key, bone_local_key, "Pose Init -> Bone Local"); add_relation(bone_local_key, bone_ready_key, "Local -> Ready"); add_relation(bone_ready_key, bone_done_key, "Ready -> Done"); @@ -579,18 +575,17 @@ void DepsgraphRelationBuilder::build_proxy_rig(Object *object) add_relation(bone_done_key, pose_done_key, "Bone Done -> Pose Done", - DEPSREL_FLAG_GODMODE); - + RELATION_FLAG_GODMODE); /* Make sure bone in the proxy is not done before it's FROM is done. */ if (pchan->bone && pchan->bone->segments > 1) { OperationKey from_bone_segments_key(&proxy_from->id, - DEG_NODE_TYPE_BONE, + NodeType::BONE, pchan->name, - DEG_OPCODE_BONE_SEGMENTS); + OperationCode::BONE_SEGMENTS); add_relation(from_bone_segments_key, bone_done_key, "Bone Segments -> Bone Done", - DEPSREL_FLAG_GODMODE); + RELATION_FLAG_GODMODE); } else { add_relation(from_bone_done_key, @@ -600,12 +595,12 @@ void DepsgraphRelationBuilder::build_proxy_rig(Object *object) if (pchan->prop != NULL) { OperationKey bone_parameters(&object->id, - DEG_NODE_TYPE_PARAMETERS, - DEG_OPCODE_PARAMETERS_EVAL, + NodeType::PARAMETERS, + OperationCode::PARAMETERS_EVAL, pchan->name); OperationKey from_bone_parameters(&proxy_from->id, - DEG_NODE_TYPE_PARAMETERS, - DEG_OPCODE_PARAMETERS_EVAL, + NodeType::PARAMETERS, + OperationCode::PARAMETERS_EVAL, pchan->name); add_relation(from_bone_parameters, bone_parameters, diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc index 200ac4531c6..bd0c19ac34b 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc @@ -57,15 +57,12 @@ extern "C" { #include "intern/builder/deg_builder.h" #include "intern/builder/deg_builder_pchanmap.h" -#include "intern/nodes/deg_node.h" -#include "intern/nodes/deg_node_component.h" -#include "intern/nodes/deg_node_id.h" -#include "intern/nodes/deg_node_operation.h" +#include "intern/node/deg_node.h" +#include "intern/node/deg_node_component.h" +#include "intern/node/deg_node_id.h" +#include "intern/node/deg_node_operation.h" -#include "intern/depsgraph_intern.h" -#include "intern/depsgraph_types.h" - -#include "util/deg_util_foreach.h" +#include "intern/depsgraph_type.h" namespace DEG { @@ -92,8 +89,7 @@ void DepsgraphRelationBuilder::build_view_layer(Scene *scene, ViewLayer *view_la /* Scene objects. */ /* NOTE: Nodes builder requires us to pass CoW base because it's being * passed to the evaluation functions. During relations builder we only - * do NULL-pointer check of the base, so it's fine to pass original one. - */ + * do NULL-pointer check of the base, so it's fine to pass original one. */ const int base_flag = (graph_->mode == DAG_EVAL_VIEWPORT) ? BASE_ENABLED_VIEWPORT : BASE_ENABLED_RENDER; LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) { diff --git a/source/blender/depsgraph/intern/builder/deg_builder_transitive.cc b/source/blender/depsgraph/intern/builder/deg_builder_transitive.cc index a39b18f2f0a..d331ed61f5f 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_transitive.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_transitive.cc @@ -32,14 +32,12 @@ #include "MEM_guardedalloc.h" -#include "intern/nodes/deg_node.h" -#include "intern/nodes/deg_node_component.h" -#include "intern/nodes/deg_node_operation.h" +#include "intern/node/deg_node.h" +#include "intern/node/deg_node_component.h" +#include "intern/node/deg_node_operation.h" #include "intern/depsgraph.h" -#include "intern/depsgraph_intern.h" - -#include "util/deg_util_foreach.h" +#include "intern/debug/deg_debug.h" namespace DEG { @@ -63,17 +61,16 @@ enum { OP_REACHABLE = 2, }; -static void deg_graph_tag_paths_recursive(DepsNode *node) +static void deg_graph_tag_paths_recursive(Node *node) { if (node->custom_flags & OP_VISITED) { return; } node->custom_flags |= OP_VISITED; - foreach (DepsRelation *rel, node->inlinks) { + for (Relation *rel : node->inlinks) { deg_graph_tag_paths_recursive(rel->from); /* Do this only in inlinks loop, so the target node does not get - * flagged. - */ + * flagged. */ rel->from->custom_flags |= OP_REACHABLE; } } @@ -81,36 +78,34 @@ static void deg_graph_tag_paths_recursive(DepsNode *node) void deg_graph_transitive_reduction(Depsgraph *graph) { int num_removed_relations = 0; - foreach (OperationDepsNode *target, graph->operations) { + for (OperationNode *target : graph->operations) { /* Clear tags. */ - foreach (OperationDepsNode *node, graph->operations) { + for (OperationNode *node : graph->operations) { node->custom_flags = 0; } /* Mark nodes from which we can reach the target * start with children, so the target node and direct children are not - * flagged. - */ + * flagged. */ target->custom_flags |= OP_VISITED; - foreach (DepsRelation *rel, target->inlinks) { + for (Relation *rel : target->inlinks) { deg_graph_tag_paths_recursive(rel->from); } /* Remove redundant paths to the target. */ - for (DepsNode::Relations::const_iterator it_rel = target->inlinks.begin(); + for (Node::Relations::const_iterator it_rel = target->inlinks.begin(); it_rel != target->inlinks.end(); ) { - DepsRelation *rel = *it_rel; - if (rel->from->type == DEG_NODE_TYPE_TIMESOURCE) { + Relation *rel = *it_rel; + if (rel->from->type == NodeType::TIMESOURCE) { /* HACK: time source nodes don't get "custom_flags" flag * set/cleared. */ /* TODO: there will be other types in future, so iterators above - * need modifying. - */ + * need modifying. */ ++it_rel; } else if (rel->from->custom_flags & OP_REACHABLE) { rel->unlink(); - OBJECT_GUARDED_DELETE(rel, DepsRelation); + OBJECT_GUARDED_DELETE(rel, Relation); ++num_removed_relations; } else { -- cgit v1.2.3