Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2019-01-31 14:56:40 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2019-01-31 16:31:41 +0300
commitc1da8e3b28f95188f9e9152383856c95f29586b4 (patch)
tree611acd206bfb126f076e78caa047b14bcd3673b6 /source/blender
parent7ccef23c4d010d4b4f83efe2cd6c82ff26824a10 (diff)
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.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/depsgraph/CMakeLists.txt37
-rw-r--r--source/blender/depsgraph/DEG_depsgraph.h6
-rw-r--r--source/blender/depsgraph/DEG_depsgraph_build.h15
-rw-r--r--source/blender/depsgraph/DEG_depsgraph_query.h6
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder.cc62
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_cycle.cc59
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_map.h6
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_nodes.cc403
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_nodes.h124
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc110
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc22
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_pchanmap.cc3
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_pchanmap.h3
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations.cc777
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations.h129
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h84
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc32
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc211
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc16
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_transitive.cc37
-rw-r--r--source/blender/depsgraph/intern/debug/deg_debug.cc67
-rw-r--r--source/blender/depsgraph/intern/debug/deg_debug.h66
-rw-r--r--source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc229
-rw-r--r--source/blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc12
-rw-r--r--source/blender/depsgraph/intern/depsgraph.cc415
-rw-r--r--source/blender/depsgraph/intern/depsgraph.h110
-rw-r--r--source/blender/depsgraph/intern/depsgraph_build.cc76
-rw-r--r--source/blender/depsgraph/intern/depsgraph_debug.cc214
-rw-r--r--source/blender/depsgraph/intern/depsgraph_eval.cc10
-rw-r--r--source/blender/depsgraph/intern/depsgraph_intern.h155
-rw-r--r--source/blender/depsgraph/intern/depsgraph_physics.cc20
-rw-r--r--source/blender/depsgraph/intern/depsgraph_physics.h (renamed from source/blender/depsgraph/util/deg_util_foreach.h)21
-rw-r--r--source/blender/depsgraph/intern/depsgraph_query.cc31
-rw-r--r--source/blender/depsgraph/intern/depsgraph_query_filter.cc49
-rw-r--r--source/blender/depsgraph/intern/depsgraph_query_foreach.cc71
-rw-r--r--source/blender/depsgraph/intern/depsgraph_query_iter.cc21
-rw-r--r--source/blender/depsgraph/intern/depsgraph_tag.cc207
-rw-r--r--source/blender/depsgraph/intern/depsgraph_tag.h53
-rw-r--r--source/blender/depsgraph/intern/depsgraph_type.cc58
-rw-r--r--source/blender/depsgraph/intern/depsgraph_type.h80
-rw-r--r--source/blender/depsgraph/intern/depsgraph_type_defines.cc217
-rw-r--r--source/blender/depsgraph/intern/depsgraph_types.h325
-rw-r--r--source/blender/depsgraph/intern/depsgraph_update.cc65
-rw-r--r--source/blender/depsgraph/intern/depsgraph_update.h (renamed from source/blender/depsgraph/util/deg_util_function.h)21
-rw-r--r--source/blender/depsgraph/intern/eval/deg_eval.cc78
-rw-r--r--source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc87
-rw-r--r--source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.h8
-rw-r--r--source/blender/depsgraph/intern/eval/deg_eval_flush.cc83
-rw-r--r--source/blender/depsgraph/intern/eval/deg_eval_stats.cc25
-rw-r--r--source/blender/depsgraph/intern/node/deg_node.cc187
-rw-r--r--source/blender/depsgraph/intern/node/deg_node.h201
-rw-r--r--source/blender/depsgraph/intern/node/deg_node_component.cc (renamed from source/blender/depsgraph/intern/nodes/deg_node_component.cc)179
-rw-r--r--source/blender/depsgraph/intern/node/deg_node_component.h (renamed from source/blender/depsgraph/intern/nodes/deg_node_component.h)97
-rw-r--r--source/blender/depsgraph/intern/node/deg_node_factory.cc53
-rw-r--r--source/blender/depsgraph/intern/node/deg_node_factory.h73
-rw-r--r--source/blender/depsgraph/intern/node/deg_node_factory_impl.h73
-rw-r--r--source/blender/depsgraph/intern/node/deg_node_id.cc (renamed from source/blender/depsgraph/intern/nodes/deg_node_id.cc)93
-rw-r--r--source/blender/depsgraph/intern/node/deg_node_id.h (renamed from source/blender/depsgraph/intern/nodes/deg_node_id.h)35
-rw-r--r--source/blender/depsgraph/intern/node/deg_node_operation.cc202
-rw-r--r--source/blender/depsgraph/intern/node/deg_node_operation.h239
-rw-r--r--source/blender/depsgraph/intern/node/deg_node_time.cc (renamed from source/blender/depsgraph/intern/nodes/deg_node_time.cc)15
-rw-r--r--source/blender/depsgraph/intern/node/deg_node_time.h (renamed from source/blender/depsgraph/intern/nodes/deg_node_time.h)6
-rw-r--r--source/blender/depsgraph/intern/nodes/deg_node.cc137
-rw-r--r--source/blender/depsgraph/intern/nodes/deg_node.h117
-rw-r--r--source/blender/depsgraph/intern/nodes/deg_node_operation.cc116
-rw-r--r--source/blender/depsgraph/intern/nodes/deg_node_operation.h101
66 files changed, 3469 insertions, 3471 deletions
diff --git a/source/blender/depsgraph/CMakeLists.txt b/source/blender/depsgraph/CMakeLists.txt
index 884f1d272a5..042388a6250 100644
--- a/source/blender/depsgraph/CMakeLists.txt
+++ b/source/blender/depsgraph/CMakeLists.txt
@@ -53,17 +53,19 @@ set(SRC
intern/builder/deg_builder_relations_rig.cc
intern/builder/deg_builder_relations_view_layer.cc
intern/builder/deg_builder_transitive.cc
+ intern/debug/deg_debug.cc
intern/debug/deg_debug_relations_graphviz.cc
intern/debug/deg_debug_stats_gnuplot.cc
intern/eval/deg_eval.cc
intern/eval/deg_eval_copy_on_write.cc
intern/eval/deg_eval_flush.cc
intern/eval/deg_eval_stats.cc
- intern/nodes/deg_node.cc
- intern/nodes/deg_node_component.cc
- intern/nodes/deg_node_id.cc
- intern/nodes/deg_node_operation.cc
- intern/nodes/deg_node_time.cc
+ intern/node/deg_node.cc
+ intern/node/deg_node_component.cc
+ intern/node/deg_node_factory.cc
+ intern/node/deg_node_id.cc
+ intern/node/deg_node_operation.cc
+ intern/node/deg_node_time.cc
intern/depsgraph.cc
intern/depsgraph_build.cc
intern/depsgraph_debug.cc
@@ -74,7 +76,8 @@ set(SRC
intern/depsgraph_query_foreach.cc
intern/depsgraph_query_iter.cc
intern/depsgraph_tag.cc
- intern/depsgraph_type_defines.cc
+ intern/depsgraph_type.cc
+ intern/depsgraph_update.cc
DEG_depsgraph.h
DEG_depsgraph_build.h
@@ -90,21 +93,23 @@ set(SRC
intern/builder/deg_builder_relations.h
intern/builder/deg_builder_relations_impl.h
intern/builder/deg_builder_transitive.h
+ intern/debug/deg_debug.h
intern/eval/deg_eval.h
intern/eval/deg_eval_copy_on_write.h
intern/eval/deg_eval_flush.h
intern/eval/deg_eval_stats.h
- intern/nodes/deg_node.h
- intern/nodes/deg_node_component.h
- intern/nodes/deg_node_id.h
- intern/nodes/deg_node_operation.h
- intern/nodes/deg_node_time.h
+ intern/node/deg_node.h
+ intern/node/deg_node_component.h
+ intern/node/deg_node_factory.h
+ intern/node/deg_node_factory_impl.h
+ intern/node/deg_node_id.h
+ intern/node/deg_node_operation.h
+ intern/node/deg_node_time.h
intern/depsgraph.h
- intern/depsgraph_intern.h
- intern/depsgraph_types.h
-
- util/deg_util_foreach.h
- util/deg_util_function.h
+ intern/depsgraph_physics.h
+ intern/depsgraph_tag.h
+ intern/depsgraph_type.h
+ intern/depsgraph_update.h
)
if(WITH_BOOST)
diff --git a/source/blender/depsgraph/DEG_depsgraph.h b/source/blender/depsgraph/DEG_depsgraph.h
index 410f5554069..31a9c7a8a6b 100644
--- a/source/blender/depsgraph/DEG_depsgraph.h
+++ b/source/blender/depsgraph/DEG_depsgraph.h
@@ -79,12 +79,10 @@ typedef enum eEvaluationMode {
enum {
/* Regardless to curve->path animation flag path is to be evaluated anyway,
* to meet dependencies with such a things as curve modifier and other guys
- * who're using curve deform, where_on_path and so.
- */
+ * who're using curve deform, where_on_path and so. */
DAG_EVAL_NEED_CURVE_PATH = (1 << 0),
/* A shrinkwrap modifier or constraint targeting this mesh needs information
- * about non-manifold boundary edges for the Target Normal Project mode.
- */
+ * about non-manifold boundary edges for the Target Normal Project mode. */
DAG_EVAL_NEED_SHRINKWRAP_BOUNDARY = (1 << 1),
};
diff --git a/source/blender/depsgraph/DEG_depsgraph_build.h b/source/blender/depsgraph/DEG_depsgraph_build.h
index d783e49dd29..a6b19e8a314 100644
--- a/source/blender/depsgraph/DEG_depsgraph_build.h
+++ b/source/blender/depsgraph/DEG_depsgraph_build.h
@@ -89,12 +89,10 @@ struct DepsNodeHandle;
typedef enum eDepsSceneComponentType {
/* Parameters Component - Default when nothing else fits
- * (i.e. just SDNA property setting).
- */
+ * (i.e. just SDNA property setting). */
DEG_SCENE_COMP_PARAMETERS,
/* Animation Component
- * TODO(sergey): merge in with parameters?
- */
+ * TODO(sergey): merge in with parameters? */
DEG_SCENE_COMP_ANIMATION,
/* Sequencer Component (Scene Only). */
DEG_SCENE_COMP_SEQUENCER,
@@ -102,17 +100,14 @@ typedef enum eDepsSceneComponentType {
typedef enum eDepsObjectComponentType {
/* Parameters Component - Default when nothing else fits
- * (i.e. just SDNA property setting).
- */
+ * (i.e. just SDNA property setting). */
DEG_OB_COMP_PARAMETERS,
/* Generic "Proxy-Inherit" Component.
- * TODO(sergey): Also for instancing of subgraphs?
- */
+ * TODO(sergey): Also for instancing of subgraphs? */
DEG_OB_COMP_PROXY,
/* Animation Component.
*
- * TODO(sergey): merge in with parameters?
- */
+ * TODO(sergey): merge in with parameters? */
DEG_OB_COMP_ANIMATION,
/* Transform Component (Parenting/Constraints) */
DEG_OB_COMP_TRANSFORM,
diff --git a/source/blender/depsgraph/DEG_depsgraph_query.h b/source/blender/depsgraph/DEG_depsgraph_query.h
index 46a9d2c5d72..423072994e9 100644
--- a/source/blender/depsgraph/DEG_depsgraph_query.h
+++ b/source/blender/depsgraph/DEG_depsgraph_query.h
@@ -129,12 +129,10 @@ typedef struct DEGObjectIterData {
/* Next duplicated object to step into. */
struct DupliObject *dupli_object_next;
/* Corresponds to current object: current iterator object is evaluated from
- * this duplicated object.
- */
+ * this duplicated object. */
struct DupliObject *dupli_object_current;
/* Temporary storage to report fully populated DNA to the render engine or
- * other users of the iterator.
- */
+ * other users of the iterator. */
struct Object temp_dupli_object;
/* **** Iteration over ID nodes **** */
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<typename T> 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 : "<null>");
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 <cstdio>
#include <cstring>
-#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 <typename KeyFrom, typename KeyTo>
- DepsRelation *add_relation(const KeyFrom& key_from,
- const KeyTo& key_to,
- const char *description,
- bool check_unique = false,
- int flags = 0);
-
- template <typename KeyFrom, typename KeyTo>
- 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 <typename KeyTo>
- 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 <typename KeyType>
- 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 <typename KeyType>
- 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 <typename KeyType>
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 <typename KeyFrom, typename KeyTo>
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 <typename KeyFrom, typename KeyTo>
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 <typename KeyType>
-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 <typename KeyFrom, typename KeyTo>
-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 <typename KeyFrom, typename KeyTo>
-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<int>(flag));
-}
-
template <typename KeyTo>
-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 <typename KeyType>
-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 {
diff --git a/source/blender/depsgraph/intern/debug/deg_debug.cc b/source/blender/depsgraph/intern/debug/deg_debug.cc
new file mode 100644
index 00000000000..670ebe0e006
--- /dev/null
+++ b/source/blender/depsgraph/intern/debug/deg_debug.cc
@@ -0,0 +1,67 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2013 Blender Foundation.
+ * All rights reserved.
+ *
+ * Original Author: Sergey Sharybin
+ * Contributor(s): None Yet
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/depsgraph/intern/debug/deg_debug.cc
+ * \ingroup depsgraph
+ */
+
+#include "intern/debug/deg_debug.h"
+
+#include "BLI_utildefines.h"
+#include "BLI_console.h"
+#include "BLI_hash.h"
+#include "BLI_string.h"
+
+#include "BKE_global.h"
+
+namespace DEG {
+
+bool terminal_do_color(void)
+{
+ return (G.debug & G_DEBUG_DEPSGRAPH_PRETTY) != 0;
+}
+
+string color_for_pointer(const void *pointer)
+{
+ if (!terminal_do_color()) {
+ return "";
+ }
+ int r, g, b;
+ BLI_hash_pointer_to_color(pointer, &r, &g, &b);
+ char buffer[64];
+ BLI_snprintf(buffer, sizeof(buffer), TRUECOLOR_ANSI_COLOR_FORMAT, r, g, b);
+ return string(buffer);
+}
+
+string color_end(void)
+{
+ if (!terminal_do_color()) {
+ return "";
+ }
+ return string(TRUECOLOR_ANSI_COLOR_FINISH);
+}
+
+} // namespace DEG
diff --git a/source/blender/depsgraph/intern/debug/deg_debug.h b/source/blender/depsgraph/intern/debug/deg_debug.h
new file mode 100644
index 00000000000..5cb016bbbee
--- /dev/null
+++ b/source/blender/depsgraph/intern/debug/deg_debug.h
@@ -0,0 +1,66 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2013 Blender Foundation.
+ * All rights reserved.
+ *
+ * Original Author: Sergey Sharybin
+ * Contributor(s): None Yet
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/depsgraph/intern/debug/deg_debug.h
+ * \ingroup depsgraph
+ */
+
+#pragma once
+
+#include "intern/depsgraph_type.h"
+
+#include "BKE_global.h"
+
+#include "DEG_depsgraph_debug.h"
+
+namespace DEG {
+
+#define DEG_DEBUG_PRINTF(depsgraph, type, ...) \
+ do { \
+ if (DEG_debug_flags_get(depsgraph) & G_DEBUG_DEPSGRAPH_ ## type) { \
+ DEG_debug_print_begin(depsgraph); \
+ fprintf(stdout, __VA_ARGS__); \
+ } \
+ } while (0)
+
+#define DEG_GLOBAL_DEBUG_PRINTF(type, ...) \
+ do { \
+ if (G.debug & G_DEBUG_DEPSGRAPH_ ## type) { \
+ fprintf(stdout, __VA_ARGS__); \
+ } \
+ } while (0)
+
+#define DEG_ERROR_PRINTF(...) \
+ do { \
+ fprintf(stderr, __VA_ARGS__); \
+ fflush(stderr); \
+ } while (0)
+
+bool terminal_do_color(void);
+string color_for_pointer(const void *pointer);
+string color_end(void);
+
+} // namespace DEG
diff --git a/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc b/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc
index d8a24292aa6..70c49c47395 100644
--- a/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc
+++ b/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc
@@ -30,6 +30,8 @@
* Implementation of tools for debugging the depsgraph
*/
+#include <cstdarg>
+
#include "BLI_utildefines.h"
#include "BLI_ghash.h"
@@ -40,11 +42,11 @@ extern "C" {
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_debug.h"
-#include "intern/depsgraph_intern.h"
-#include "intern/nodes/deg_node_id.h"
-#include "intern/nodes/deg_node_time.h"
-
-#include "util/deg_util_foreach.h"
+#include "intern/depsgraph.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"
/* ****************** */
/* Graphviz Debugging */
@@ -82,36 +84,36 @@ static const char *deg_debug_colors_light[] = {
#ifdef COLOR_SCHEME_NODE_TYPE
static const int deg_debug_node_type_color_map[][2] = {
- {DEG_NODE_TYPE_TIMESOURCE, 0},
- {DEG_NODE_TYPE_ID_REF, 1},
+ {NodeType::TIMESOURCE, 0},
+ {NodeType::ID_REF, 1},
/* Outer Types */
- {DEG_NODE_TYPE_PARAMETERS, 2},
- {DEG_NODE_TYPE_PROXY, 3},
- {DEG_NODE_TYPE_ANIMATION, 4},
- {DEG_NODE_TYPE_TRANSFORM, 5},
- {DEG_NODE_TYPE_GEOMETRY, 6},
- {DEG_NODE_TYPE_SEQUENCER, 7},
- {DEG_NODE_TYPE_SHADING, 8},
- {DEG_NODE_TYPE_SHADING_PARAMETERS, 9},
- {DEG_NODE_TYPE_CACHE, 10},
- {DEG_NODE_TYPE_POINT_CACHE, 11},
- {DEG_NODE_TYPE_LAYER_COLLECTIONS, 12},
- {DEG_NODE_TYPE_COPY_ON_WRITE, 13},
+ {NodeType::PARAMETERS, 2},
+ {NodeType::PROXY, 3},
+ {NodeType::ANIMATION, 4},
+ {NodeType::TRANSFORM, 5},
+ {NodeType::GEOMETRY, 6},
+ {NodeType::SEQUENCER, 7},
+ {NodeType::SHADING, 8},
+ {NodeType::SHADING_PARAMETERS, 9},
+ {NodeType::CACHE, 10},
+ {NodeType::POINT_CACHE, 11},
+ {NodeType::LAYER_COLLECTIONS, 12},
+ {NodeType::COPY_ON_WRITE, 13},
{-1, 0}
};
#endif
-static int deg_debug_node_color_index(const DepsNode *node)
+static int deg_debug_node_color_index(const Node *node)
{
#ifdef COLOR_SCHEME_NODE_CLASS
/* Some special types. */
switch (node->type) {
- case DEG_NODE_TYPE_ID_REF:
+ case NodeType::ID_REF:
return 5;
- case DEG_NODE_TYPE_OPERATION:
+ case NodeType::OPERATION:
{
- OperationDepsNode *op_node = (OperationDepsNode *)node;
+ OperationNode *op_node = (OperationNode *)node;
if (op_node->is_noop())
return 8;
break;
@@ -122,9 +124,9 @@ static int deg_debug_node_color_index(const DepsNode *node)
}
/* Do others based on class. */
switch (node->get_class()) {
- case DEG_NODE_CLASS_OPERATION:
+ case NodeClass::OPERATION:
return 4;
- case DEG_NODE_CLASS_COMPONENT:
+ case NodeClass::COMPONENT:
return 1;
default:
return 9;
@@ -185,7 +187,7 @@ static void deg_debug_graphviz_legend(const DebugContext &ctx)
#ifdef COLOR_SCHEME_NODE_TYPE
const int (*pair)[2];
for (pair = deg_debug_node_type_color_map; (*pair)[0] >= 0; ++pair) {
- DepsNodeFactory *nti = deg_type_get_factory((eDepsNode_Type)(*pair)[0]);
+ DepsNodeFactory *nti = type_get_factory((NodeType)(*pair)[0]);
deg_debug_graphviz_legend_color(ctx,
nti->tname().c_str(),
deg_debug_colors_light[(*pair)[1] % deg_debug_max_colors]);
@@ -200,15 +202,15 @@ static void deg_debug_graphviz_legend(const DebugContext &ctx)
}
static void deg_debug_graphviz_node_color(const DebugContext &ctx,
- const DepsNode *node)
+ const Node *node)
{
const char *color_default = "black";
const char *color_modified = "orangered4";
const char *color_update = "dodgerblue3";
const char *color = color_default;
if (ctx.show_tags) {
- if (node->get_class() == DEG_NODE_CLASS_OPERATION) {
- OperationDepsNode *op_node = (OperationDepsNode *)node;
+ if (node->get_class() == NodeClass::OPERATION) {
+ OperationNode *op_node = (OperationNode *)node;
if (op_node->flag & DEPSOP_FLAG_DIRECTLY_MODIFIED) {
color = color_modified;
}
@@ -221,15 +223,15 @@ static void deg_debug_graphviz_node_color(const DebugContext &ctx,
}
static void deg_debug_graphviz_node_penwidth(const DebugContext &ctx,
- const DepsNode *node)
+ const Node *node)
{
float penwidth_default = 1.0f;
float penwidth_modified = 4.0f;
float penwidth_update = 4.0f;
float penwidth = penwidth_default;
if (ctx.show_tags) {
- if (node->get_class() == DEG_NODE_CLASS_OPERATION) {
- OperationDepsNode *op_node = (OperationDepsNode *)node;
+ if (node->get_class() == NodeClass::OPERATION) {
+ OperationNode *op_node = (OperationNode *)node;
if (op_node->flag & DEPSOP_FLAG_DIRECTLY_MODIFIED) {
penwidth = penwidth_modified;
}
@@ -242,7 +244,7 @@ static void deg_debug_graphviz_node_penwidth(const DebugContext &ctx,
}
static void deg_debug_graphviz_node_fillcolor(const DebugContext &ctx,
- const DepsNode *node)
+ const Node *node)
{
const char *defaultcolor = "gainsboro";
int color_index = deg_debug_node_color_index(node);
@@ -251,49 +253,49 @@ static void deg_debug_graphviz_node_fillcolor(const DebugContext &ctx,
}
static void deg_debug_graphviz_relation_color(const DebugContext &ctx,
- const DepsRelation *rel)
+ const Relation *rel)
{
const char *color_default = "black";
const char *color_cyclic = "red4"; /* The color of crime scene. */
const char *color_godmode = "blue4"; /* The color of beautiful sky. */
const char *color = color_default;
- if (rel->flag & DEPSREL_FLAG_CYCLIC) {
+ if (rel->flag & RELATION_FLAG_CYCLIC) {
color = color_cyclic;
}
- else if (rel->flag & DEPSREL_FLAG_GODMODE) {
+ else if (rel->flag & RELATION_FLAG_GODMODE) {
color = color_godmode;
}
deg_debug_fprintf(ctx, "%s", color);
}
static void deg_debug_graphviz_relation_style(const DebugContext &ctx,
- const DepsRelation *rel)
+ const Relation *rel)
{
const char *style_default = "solid";
const char *style_no_flush = "dashed";
const char *style_flush_user_only = "dotted";
const char *style = style_default;
- if (rel->flag & DEPSREL_FLAG_NO_FLUSH) {
+ if (rel->flag & RELATION_FLAG_NO_FLUSH) {
style = style_no_flush;
}
- if (rel->flag & DEPSREL_FLAG_FLUSH_USER_EDIT_ONLY) {
+ if (rel->flag & RELATION_FLAG_FLUSH_USER_EDIT_ONLY) {
style = style_flush_user_only;
}
deg_debug_fprintf(ctx, "%s", style);
}
static void deg_debug_graphviz_relation_arrowhead(const DebugContext &ctx,
- const DepsRelation *rel)
+ const Relation *rel)
{
const char *shape_default = "normal";
const char *shape_no_cow = "box";
const char *shape = shape_default;
- if (rel->from->get_class() == DEG_NODE_CLASS_OPERATION &&
- rel->to->get_class() == DEG_NODE_CLASS_OPERATION)
+ if (rel->from->get_class() == NodeClass::OPERATION &&
+ rel->to->get_class() == NodeClass::OPERATION)
{
- OperationDepsNode *op_from = (OperationDepsNode *)rel->from;
- OperationDepsNode *op_to = (OperationDepsNode *)rel->to;
- if (op_from->owner->type == DEG_NODE_TYPE_COPY_ON_WRITE &&
+ OperationNode *op_from = (OperationNode *)rel->from;
+ OperationNode *op_to = (OperationNode *)rel->to;
+ if (op_from->owner->type == NodeType::COPY_ON_WRITE &&
!op_to->owner->need_tag_cow_before_update())
{
shape = shape_no_cow;
@@ -302,32 +304,32 @@ static void deg_debug_graphviz_relation_arrowhead(const DebugContext &ctx,
deg_debug_fprintf(ctx, "%s", shape);
}
-static void deg_debug_graphviz_node_style(const DebugContext &ctx, const DepsNode *node)
+static void deg_debug_graphviz_node_style(const DebugContext &ctx, const Node *node)
{
const char *base_style = "filled"; /* default style */
if (ctx.show_tags) {
- if (node->get_class() == DEG_NODE_CLASS_OPERATION) {
- OperationDepsNode *op_node = (OperationDepsNode *)node;
+ if (node->get_class() == NodeClass::OPERATION) {
+ OperationNode *op_node = (OperationNode *)node;
if (op_node->flag & (DEPSOP_FLAG_DIRECTLY_MODIFIED | DEPSOP_FLAG_NEEDS_UPDATE)) {
base_style = "striped";
}
}
}
switch (node->get_class()) {
- case DEG_NODE_CLASS_GENERIC:
+ case NodeClass::GENERIC:
deg_debug_fprintf(ctx, "\"%s\"", base_style);
break;
- case DEG_NODE_CLASS_COMPONENT:
+ case NodeClass::COMPONENT:
deg_debug_fprintf(ctx, "\"%s\"", base_style);
break;
- case DEG_NODE_CLASS_OPERATION:
+ case NodeClass::OPERATION:
deg_debug_fprintf(ctx, "\"%s,rounded\"", base_style);
break;
}
}
static void deg_debug_graphviz_node_single(const DebugContext &ctx,
- const DepsNode *node)
+ const Node *node)
{
const char *shape = "box";
string name = node->identifier();
@@ -348,7 +350,7 @@ static void deg_debug_graphviz_node_single(const DebugContext &ctx,
}
static void deg_debug_graphviz_node_cluster_begin(const DebugContext &ctx,
- const DepsNode *node)
+ const Node *node)
{
string name = node->identifier();
deg_debug_fprintf(ctx, "// %s\n", name.c_str());
@@ -383,18 +385,18 @@ static void deg_debug_graphviz_graph_relations(const DebugContext &ctx,
const Depsgraph *graph);
static void deg_debug_graphviz_node(const DebugContext &ctx,
- const DepsNode *node)
+ const Node *node)
{
switch (node->type) {
- case DEG_NODE_TYPE_ID_REF:
+ case NodeType::ID_REF:
{
- const IDDepsNode *id_node = (const IDDepsNode *)node;
+ const IDNode *id_node = (const IDNode *)node;
if (BLI_ghash_len(id_node->components) == 0) {
deg_debug_graphviz_node_single(ctx, node);
}
else {
deg_debug_graphviz_node_cluster_begin(ctx, node);
- GHASH_FOREACH_BEGIN(const ComponentDepsNode *, comp, id_node->components)
+ GHASH_FOREACH_BEGIN(const ComponentNode *, comp, id_node->components)
{
deg_debug_graphviz_node(ctx, comp);
}
@@ -403,32 +405,32 @@ static void deg_debug_graphviz_node(const DebugContext &ctx,
}
break;
}
- case DEG_NODE_TYPE_PARAMETERS:
- case DEG_NODE_TYPE_ANIMATION:
- case DEG_NODE_TYPE_TRANSFORM:
- case DEG_NODE_TYPE_PROXY:
- case DEG_NODE_TYPE_GEOMETRY:
- case DEG_NODE_TYPE_SEQUENCER:
- case DEG_NODE_TYPE_EVAL_POSE:
- case DEG_NODE_TYPE_BONE:
- case DEG_NODE_TYPE_SHADING:
- case DEG_NODE_TYPE_SHADING_PARAMETERS:
- case DEG_NODE_TYPE_CACHE:
- case DEG_NODE_TYPE_POINT_CACHE:
- case DEG_NODE_TYPE_LAYER_COLLECTIONS:
- case DEG_NODE_TYPE_PARTICLE_SYSTEM:
- case DEG_NODE_TYPE_PARTICLE_SETTINGS:
- case DEG_NODE_TYPE_COPY_ON_WRITE:
- case DEG_NODE_TYPE_OBJECT_FROM_LAYER:
- case DEG_NODE_TYPE_BATCH_CACHE:
- case DEG_NODE_TYPE_DUPLI:
- case DEG_NODE_TYPE_SYNCHRONIZE:
- case DEG_NODE_TYPE_GENERIC_DATABLOCK:
+ case NodeType::PARAMETERS:
+ case NodeType::ANIMATION:
+ case NodeType::TRANSFORM:
+ case NodeType::PROXY:
+ case NodeType::GEOMETRY:
+ case NodeType::SEQUENCER:
+ case NodeType::EVAL_POSE:
+ case NodeType::BONE:
+ case NodeType::SHADING:
+ case NodeType::SHADING_PARAMETERS:
+ case NodeType::CACHE:
+ case NodeType::POINT_CACHE:
+ case NodeType::LAYER_COLLECTIONS:
+ case NodeType::PARTICLE_SYSTEM:
+ case NodeType::PARTICLE_SETTINGS:
+ case NodeType::COPY_ON_WRITE:
+ case NodeType::OBJECT_FROM_LAYER:
+ case NodeType::BATCH_CACHE:
+ case NodeType::DUPLI:
+ case NodeType::SYNCHRONIZE:
+ case NodeType::GENERIC_DATABLOCK:
{
- ComponentDepsNode *comp_node = (ComponentDepsNode *)node;
+ ComponentNode *comp_node = (ComponentNode *)node;
if (!comp_node->operations.empty()) {
deg_debug_graphviz_node_cluster_begin(ctx, node);
- foreach (DepsNode *op_node, comp_node->operations) {
+ for (Node *op_node : comp_node->operations) {
deg_debug_graphviz_node(ctx, op_node);
}
deg_debug_graphviz_node_cluster_end(ctx);
@@ -438,34 +440,34 @@ static void deg_debug_graphviz_node(const DebugContext &ctx,
}
break;
}
- case DEG_NODE_TYPE_UNDEFINED:
- case DEG_NODE_TYPE_TIMESOURCE:
- case DEG_NODE_TYPE_OPERATION:
+ case NodeType::UNDEFINED:
+ case NodeType::TIMESOURCE:
+ case NodeType::OPERATION:
deg_debug_graphviz_node_single(ctx, node);
break;
- case NUM_DEG_NODE_TYPES:
+ case NodeType::NUM_TYPES:
break;
}
}
-static bool deg_debug_graphviz_is_cluster(const DepsNode *node)
+static bool deg_debug_graphviz_is_cluster(const Node *node)
{
switch (node->type) {
- case DEG_NODE_TYPE_ID_REF:
+ case NodeType::ID_REF:
{
- const IDDepsNode *id_node = (const IDDepsNode *)node;
+ const IDNode *id_node = (const IDNode *)node;
return BLI_ghash_len(id_node->components) > 0;
}
- case DEG_NODE_TYPE_PARAMETERS:
- case DEG_NODE_TYPE_ANIMATION:
- case DEG_NODE_TYPE_TRANSFORM:
- case DEG_NODE_TYPE_PROXY:
- case DEG_NODE_TYPE_GEOMETRY:
- case DEG_NODE_TYPE_SEQUENCER:
- case DEG_NODE_TYPE_EVAL_POSE:
- case DEG_NODE_TYPE_BONE:
+ case NodeType::PARAMETERS:
+ case NodeType::ANIMATION:
+ case NodeType::TRANSFORM:
+ case NodeType::PROXY:
+ case NodeType::GEOMETRY:
+ case NodeType::SEQUENCER:
+ case NodeType::EVAL_POSE:
+ case NodeType::BONE:
{
- ComponentDepsNode *comp_node = (ComponentDepsNode *)node;
+ ComponentNode *comp_node = (ComponentNode *)node;
return !comp_node->operations.empty();
}
default:
@@ -473,20 +475,20 @@ static bool deg_debug_graphviz_is_cluster(const DepsNode *node)
}
}
-static bool deg_debug_graphviz_is_owner(const DepsNode *node,
- const DepsNode *other)
+static bool deg_debug_graphviz_is_owner(const Node *node,
+ const Node *other)
{
switch (node->get_class()) {
- case DEG_NODE_CLASS_COMPONENT:
+ case NodeClass::COMPONENT:
{
- ComponentDepsNode *comp_node = (ComponentDepsNode *)node;
+ ComponentNode *comp_node = (ComponentNode *)node;
if (comp_node->owner == other)
return true;
break;
}
- case DEG_NODE_CLASS_OPERATION:
+ case NodeClass::OPERATION:
{
- OperationDepsNode *op_node = (OperationDepsNode *)node;
+ OperationNode *op_node = (OperationNode *)node;
if (op_node->owner == other)
return true;
else if (op_node->owner->owner == other)
@@ -499,13 +501,13 @@ static bool deg_debug_graphviz_is_owner(const DepsNode *node,
}
static void deg_debug_graphviz_node_relations(const DebugContext &ctx,
- const DepsNode *node)
+ const Node *node)
{
- foreach (DepsRelation *rel, node->inlinks) {
+ for (Relation *rel : node->inlinks) {
float penwidth = 2.0f;
- const DepsNode *tail = rel->to; /* same as node */
- const DepsNode *head = rel->from;
+ const Node *tail = rel->to; /* same as node */
+ const Node *head = rel->from;
deg_debug_fprintf(ctx, "// %s -> %s\n",
head->identifier().c_str(),
tail->identifier().c_str());
@@ -526,8 +528,7 @@ static void deg_debug_graphviz_node_relations(const DebugContext &ctx,
deg_debug_fprintf(ctx, ",penwidth=\"%f\"", penwidth);
/* NOTE: edge from node to own cluster is not possible and gives graphviz
* warning, avoid this here by just linking directly to the invisible
- * placeholder node
- */
+ * placeholder node. */
if (deg_debug_graphviz_is_cluster(tail) &&
!deg_debug_graphviz_is_owner(head, tail))
{
@@ -546,10 +547,10 @@ static void deg_debug_graphviz_node_relations(const DebugContext &ctx,
static void deg_debug_graphviz_graph_nodes(const DebugContext &ctx,
const Depsgraph *graph)
{
- foreach (DepsNode *node, graph->id_nodes) {
+ for (Node *node : graph->id_nodes) {
deg_debug_graphviz_node(ctx, node);
}
- TimeSourceDepsNode *time_source = graph->find_time_source();
+ TimeSourceNode *time_source = graph->find_time_source();
if (time_source != NULL) {
deg_debug_graphviz_node(ctx, time_source);
}
@@ -558,17 +559,17 @@ static void deg_debug_graphviz_graph_nodes(const DebugContext &ctx,
static void deg_debug_graphviz_graph_relations(const DebugContext &ctx,
const Depsgraph *graph)
{
- 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)
{
- foreach (OperationDepsNode *op_node, comp_node->operations) {
+ for (OperationNode *op_node : comp_node->operations) {
deg_debug_graphviz_node_relations(ctx, op_node);
}
}
GHASH_FOREACH_END();
}
- TimeSourceDepsNode *time_source = graph->find_time_source();
+ TimeSourceNode *time_source = graph->find_time_source();
if (time_source != NULL) {
deg_debug_graphviz_node_relations(ctx, time_source);
}
diff --git a/source/blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc b/source/blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc
index 0ea9f564fb1..e6b162b84a4 100644
--- a/source/blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc
+++ b/source/blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc
@@ -37,9 +37,7 @@
#include "BLI_math_base.h"
#include "intern/depsgraph.h"
-#include "intern/nodes/deg_node_id.h"
-
-#include "util/deg_util_foreach.h"
+#include "intern/node/deg_node_id.h"
extern "C" {
#include "DNA_ID.h"
@@ -58,7 +56,7 @@ struct DebugContext {
};
struct StatsEntry {
- const IDDepsNode *id_node;
+ const IDNode *id_node;
double time;
};
@@ -75,7 +73,7 @@ static void deg_debug_fprintf(const DebugContext &ctx, const char *fmt, ...)
}
BLI_INLINE double get_node_time(const DebugContext& /*ctx*/,
- const DepsNode *node)
+ const Node *node)
{
// TODO(sergey): Figure out a nice way to define which exact time
// we want to show.
@@ -111,7 +109,7 @@ void write_stats_data(const DebugContext& ctx)
// Fill in array of all stats which are to be displayed.
vector<StatsEntry> stats;
stats.reserve(ctx.graph->id_nodes.size());
- foreach (const IDDepsNode *id_node, ctx.graph->id_nodes) {
+ for (const IDNode *id_node : ctx.graph->id_nodes) {
const double time = get_node_time(ctx, id_node);
if (time == 0.0) {
continue;
@@ -128,7 +126,7 @@ void write_stats_data(const DebugContext& ctx)
std::reverse(stats.begin(), stats.end());
// Print data to the file stream.
deg_debug_fprintf(ctx, "$data << EOD" NL);
- foreach (const StatsEntry& entry, stats) {
+ for (const StatsEntry& entry : stats) {
deg_debug_fprintf(
ctx, "\"[%s] %s\",%f" NL,
gnuplotify_id_code(entry.id_node->id_orig->name).c_str(),
diff --git a/source/blender/depsgraph/intern/depsgraph.cc b/source/blender/depsgraph/intern/depsgraph.cc
index 00a16f3e32c..feeb8ac7248 100644
--- a/source/blender/depsgraph/intern/depsgraph.cc
+++ b/source/blender/depsgraph/intern/depsgraph.cc
@@ -52,6 +52,7 @@ extern "C" {
#include "BKE_scene.h"
#include "BKE_constraint.h"
+#include "BKE_global.h"
}
#include <algorithm>
@@ -60,22 +61,21 @@ extern "C" {
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_debug.h"
+#include "intern/depsgraph_update.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_factory.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 "util/deg_util_foreach.h"
+#include "intern/depsgraph_physics.h"
namespace DEG {
-static DEG_EditorUpdateIDCb deg_editor_update_id_cb = NULL;
-static DEG_EditorUpdateSceneCb deg_editor_update_scene_cb = NULL;
-
/* TODO(sergey): Find a better place for this. */
template <typename T>
static void remove_from_vector(vector<T> *vector, const T& value)
@@ -111,7 +111,7 @@ Depsgraph::~Depsgraph()
BLI_ghash_free(id_hash, NULL, NULL);
BLI_gset_free(entry_tags, NULL);
if (time_source != NULL) {
- OBJECT_GUARDED_DELETE(time_source, TimeSourceDepsNode);
+ OBJECT_GUARDED_DELETE(time_source, TimeSourceNode);
}
BLI_spin_end(&lock);
}
@@ -123,9 +123,9 @@ static bool pointer_to_component_node_criteria(
const PropertyRNA *prop,
RNAPointerSource /*source*/,
ID **id,
- eDepsNode_Type *type,
+ NodeType *type,
const char **component_name,
- eDepsOperation_Code *operation_code,
+ OperationCode *operation_code,
const char **operation_name,
int *operation_name_tag)
{
@@ -135,27 +135,27 @@ static bool pointer_to_component_node_criteria(
/* Set default values for returns. */
*id = (ID *)ptr->id.data;
*component_name = "";
- *operation_code = DEG_OPCODE_OPERATION;
+ *operation_code = OperationCode::OPERATION;
*operation_name = "";
*operation_name_tag = -1;
/* Handling of commonly known scenarios. */
if (ptr->type == &RNA_PoseBone) {
bPoseChannel *pchan = (bPoseChannel *)ptr->data;
if (prop != NULL && RNA_property_is_idprop(prop)) {
- *type = DEG_NODE_TYPE_PARAMETERS;
- *operation_code = DEG_OPCODE_ID_PROPERTY;
+ *type = NodeType::PARAMETERS;
+ *operation_code = OperationCode::ID_PROPERTY;
*operation_name = RNA_property_identifier((PropertyRNA *)prop);
*operation_name_tag = -1;
}
else {
/* Bone - generally, we just want the bone component. */
- *type = DEG_NODE_TYPE_BONE;
+ *type = NodeType::BONE;
*component_name = pchan->name;
/* But B-Bone properties should connect to the actual operation. */
if (!ELEM(NULL, pchan->bone, prop) && pchan->bone->segments > 1 &&
STRPREFIX(RNA_property_identifier(prop), "bbone_"))
{
- *operation_code = DEG_OPCODE_BONE_SEGMENTS;
+ *operation_code = OperationCode::BONE_SEGMENTS;
}
}
return true;
@@ -164,7 +164,7 @@ static bool pointer_to_component_node_criteria(
Bone *bone = (Bone *)ptr->data;
/* armature-level bone, but it ends up going to bone component anyway */
// NOTE: the ID in this case will end up being bArmature.
- *type = DEG_NODE_TYPE_BONE;
+ *type = NodeType::BONE;
*component_name = bone->name;
return true;
}
@@ -176,15 +176,15 @@ static bool pointer_to_component_node_criteria(
* at a given constraint, but for rigging one might use constraint
* influence to be used to drive some corrective shape keys or so. */
if (BLI_findindex(&object->constraints, con) != -1) {
- *type = DEG_NODE_TYPE_TRANSFORM;
- *operation_code = DEG_OPCODE_TRANSFORM_LOCAL;
+ *type = NodeType::TRANSFORM;
+ *operation_code = OperationCode::TRANSFORM_LOCAL;
return true;
}
else if (object->pose != NULL) {
LISTBASE_FOREACH(bPoseChannel *, pchan, &object->pose->chanbase) {
if (BLI_findindex(&pchan->constraints, con) != -1) {
- *type = DEG_NODE_TYPE_BONE;
- *operation_code = DEG_OPCODE_BONE_LOCAL;
+ *type = NodeType::BONE;
+ *operation_code = OperationCode::BONE_LOCAL;
*component_name = pchan->name;
return true;
}
@@ -199,19 +199,19 @@ static bool pointer_to_component_node_criteria(
bConstraint *con = BKE_constraint_find_from_target(object, tgt, &pchan);
if (con != NULL) {
if (pchan != NULL) {
- *type = DEG_NODE_TYPE_BONE;
- *operation_code = DEG_OPCODE_BONE_LOCAL;
+ *type = NodeType::BONE;
+ *operation_code = OperationCode::BONE_LOCAL;
*component_name = pchan->name;
}
else {
- *type = DEG_NODE_TYPE_TRANSFORM;
- *operation_code = DEG_OPCODE_TRANSFORM_LOCAL;
+ *type = NodeType::TRANSFORM;
+ *operation_code = OperationCode::TRANSFORM_LOCAL;
}
return true;
}
}
else if (RNA_struct_is_a(ptr->type, &RNA_Modifier)) {
- *type = DEG_NODE_TYPE_GEOMETRY;
+ *type = NodeType::GEOMETRY;
return true;
}
else if (ptr->type == &RNA_Object) {
@@ -224,13 +224,13 @@ static bool pointer_to_component_node_criteria(
strstr(prop_identifier, "scale") ||
strstr(prop_identifier, "matrix_"))
{
- *type = DEG_NODE_TYPE_TRANSFORM;
+ *type = NodeType::TRANSFORM;
return true;
}
else if (strstr(prop_identifier, "data")) {
/* We access object.data, most likely a geometry.
* Might be a bone tho. */
- *type = DEG_NODE_TYPE_GEOMETRY;
+ *type = NodeType::GEOMETRY;
return true;
}
}
@@ -238,47 +238,47 @@ static bool pointer_to_component_node_criteria(
else if (ptr->type == &RNA_ShapeKey) {
KeyBlock *key_block = (KeyBlock *)ptr->data;
*id = (ID *)ptr->id.data;
- *type = DEG_NODE_TYPE_PARAMETERS;
- *operation_code = DEG_OPCODE_PARAMETERS_EVAL;
+ *type = NodeType::PARAMETERS;
+ *operation_code = OperationCode::PARAMETERS_EVAL;
*operation_name = key_block->name;
return true;
}
else if (ptr->type == &RNA_Key) {
*id = (ID *)ptr->id.data;
- *type = DEG_NODE_TYPE_GEOMETRY;
+ *type = NodeType::GEOMETRY;
return true;
}
else if (RNA_struct_is_a(ptr->type, &RNA_Sequence)) {
Sequence *seq = (Sequence *)ptr->data;
/* Sequencer strip */
- *type = DEG_NODE_TYPE_SEQUENCER;
+ *type = NodeType::SEQUENCER;
*component_name = seq->name;
return true;
}
else if (RNA_struct_is_a(ptr->type, &RNA_NodeSocket)) {
- *type = DEG_NODE_TYPE_SHADING;
+ *type = NodeType::SHADING;
return true;
}
else if (RNA_struct_is_a(ptr->type, &RNA_ShaderNode)) {
- *type = DEG_NODE_TYPE_SHADING;
+ *type = NodeType::SHADING;
return true;
}
else if (ELEM(ptr->type, &RNA_Curve, &RNA_TextCurve)) {
*id = (ID *)ptr->id.data;
- *type = DEG_NODE_TYPE_GEOMETRY;
+ *type = NodeType::GEOMETRY;
return true;
}
if (prop != NULL) {
/* All unknown data effectively falls under "parameter evaluation". */
if (RNA_property_is_idprop(prop)) {
- *type = DEG_NODE_TYPE_PARAMETERS;
- *operation_code = DEG_OPCODE_ID_PROPERTY;
+ *type = NodeType::PARAMETERS;
+ *operation_code = OperationCode::ID_PROPERTY;
*operation_name = RNA_property_identifier((PropertyRNA *)prop);
*operation_name_tag = -1;
}
else {
- *type = DEG_NODE_TYPE_PARAMETERS;
- *operation_code = DEG_OPCODE_PARAMETERS_EVAL;
+ *type = NodeType::PARAMETERS;
+ *operation_code = OperationCode::PARAMETERS_EVAL;
*operation_name = "";
*operation_name_tag = -1;
}
@@ -288,30 +288,30 @@ static bool pointer_to_component_node_criteria(
}
/* Convenience wrapper to find node given just pointer + property. */
-DepsNode *Depsgraph::find_node_from_pointer(const PointerRNA *ptr,
- const PropertyRNA *prop,
- RNAPointerSource source) const
+Node *Depsgraph::find_node_from_pointer(const PointerRNA *ptr,
+ const PropertyRNA *prop,
+ RNAPointerSource source) const
{
ID *id;
- eDepsNode_Type node_type;
+ NodeType node_type;
const char *component_name, *operation_name;
- eDepsOperation_Code operation_code;
+ OperationCode operation_code;
int operation_name_tag;
if (pointer_to_component_node_criteria(
ptr, prop, source,
&id, &node_type, &component_name,
&operation_code, &operation_name, &operation_name_tag))
{
- IDDepsNode *id_node = find_id_node(id);
+ IDNode *id_node = find_id_node(id);
if (id_node == NULL) {
return NULL;
}
- ComponentDepsNode *comp_node =
+ ComponentNode *comp_node =
id_node->find_component(node_type, component_name);
if (comp_node == NULL) {
return NULL;
}
- if (operation_code == DEG_OPCODE_OPERATION) {
+ if (operation_code == OperationCode::OPERATION) {
return comp_node;
}
return comp_node->find_operation(operation_code,
@@ -323,38 +323,37 @@ DepsNode *Depsgraph::find_node_from_pointer(const PointerRNA *ptr,
/* Node Management ---------------------------- */
-TimeSourceDepsNode *Depsgraph::add_time_source()
+TimeSourceNode *Depsgraph::add_time_source()
{
if (time_source == NULL) {
- DepsNodeFactory *factory = deg_type_get_factory(DEG_NODE_TYPE_TIMESOURCE);
- time_source = (TimeSourceDepsNode *)factory->create_node(NULL, "", "Time Source");
+ DepsNodeFactory *factory = type_get_factory(NodeType::TIMESOURCE);
+ time_source = (TimeSourceNode *)factory->create_node(NULL, "", "Time Source");
}
return time_source;
}
-TimeSourceDepsNode *Depsgraph::find_time_source() const
+TimeSourceNode *Depsgraph::find_time_source() const
{
return time_source;
}
-IDDepsNode *Depsgraph::find_id_node(const ID *id) const
+IDNode *Depsgraph::find_id_node(const ID *id) const
{
- return reinterpret_cast<IDDepsNode *>(BLI_ghash_lookup(id_hash, id));
+ return reinterpret_cast<IDNode *>(BLI_ghash_lookup(id_hash, id));
}
-IDDepsNode *Depsgraph::add_id_node(ID *id, ID *id_cow_hint)
+IDNode *Depsgraph::add_id_node(ID *id, ID *id_cow_hint)
{
BLI_assert((id->tag & LIB_TAG_COPIED_ON_WRITE) == 0);
- IDDepsNode *id_node = find_id_node(id);
+ IDNode *id_node = find_id_node(id);
if (!id_node) {
- DepsNodeFactory *factory = deg_type_get_factory(DEG_NODE_TYPE_ID_REF);
- id_node = (IDDepsNode *)factory->create_node(id, "", id->name);
+ DepsNodeFactory *factory = type_get_factory(NodeType::ID_REF);
+ id_node = (IDNode *)factory->create_node(id, "", id->name);
id_node->init_copy_on_write(id_cow_hint);
/* Register node in ID hash.
*
* NOTE: We address ID nodes by the original ID pointer they are
- * referencing to.
- */
+ * referencing to. */
BLI_ghash_insert(id_hash, id, id_node);
id_nodes.push_back(id_node);
}
@@ -363,11 +362,10 @@ IDDepsNode *Depsgraph::add_id_node(ID *id, ID *id_cow_hint)
void Depsgraph::clear_id_nodes_conditional(const std::function <bool (ID_Type id_type)>& filter)
{
- foreach (IDDepsNode *id_node, id_nodes) {
+ for (IDNode *id_node : id_nodes) {
if (id_node->id_cow == NULL) {
/* This means builder "stole" ownership of the copy-on-written
- * datablock for her own dirty needs.
- */
+ * datablock for her own dirty needs. */
continue;
}
if (!deg_copy_on_write_is_expanded(id_node->id_cow)) {
@@ -388,65 +386,52 @@ void Depsgraph::clear_id_nodes()
clear_id_nodes_conditional([](ID_Type id_type) { return id_type == ID_SCE; });
clear_id_nodes_conditional([](ID_Type id_type) { return id_type != ID_PA; });
- foreach (IDDepsNode *id_node, id_nodes) {
- OBJECT_GUARDED_DELETE(id_node, IDDepsNode);
+ for (IDNode *id_node : id_nodes) {
+ OBJECT_GUARDED_DELETE(id_node, IDNode);
}
/* Clear containers. */
BLI_ghash_clear(id_hash, NULL, NULL);
id_nodes.clear();
/* Clear physics relation caches. */
- deg_clear_physics_relations(this);
+ clear_physics_relations(this);
}
-/* Add new relationship between two nodes. */
-DepsRelation *Depsgraph::add_new_relation(OperationDepsNode *from,
- OperationDepsNode *to,
- const char *description,
- bool check_unique,
- int flags)
+/* Add new relation between two nodes */
+Relation *Depsgraph::add_new_relation(Node *from, Node *to,
+ const char *description,
+ int flags)
{
- DepsRelation *rel = NULL;
- if (check_unique) {
+ Relation *rel = NULL;
+ if (flags & RELATION_CHECK_BEFORE_ADD) {
rel = check_nodes_connected(from, to, description);
}
if (rel != NULL) {
rel->flag |= flags;
return rel;
}
- /* COW nodes can only depend on other COW nodes. */
- BLI_assert(to->owner->type != DEG_NODE_TYPE_COPY_ON_WRITE ||
- from->owner->type == DEG_NODE_TYPE_COPY_ON_WRITE);
- /* Create new relation, and add it to the graph. */
- rel = OBJECT_GUARDED_NEW(DepsRelation, from, to, description);
- rel->flag |= flags;
- return rel;
-}
-/* Add new relation between two nodes */
-DepsRelation *Depsgraph::add_new_relation(DepsNode *from, DepsNode *to,
- const char *description,
- bool check_unique,
- int flags)
-{
- DepsRelation *rel = NULL;
- if (check_unique) {
- rel = check_nodes_connected(from, to, description);
- }
- if (rel != NULL) {
- rel->flag |= flags;
- return rel;
+#ifndef NDEBUG
+ if (from->type == NodeType::OPERATION &&
+ to->type == NodeType::OPERATION)
+ {
+ OperationNode *operation_from = static_cast<OperationNode *>(from);
+ OperationNode *operation_to = static_cast<OperationNode *>(to);
+ BLI_assert(operation_to->owner->type != NodeType::COPY_ON_WRITE ||
+ operation_from->owner->type == NodeType::COPY_ON_WRITE);
}
+#endif
+
/* Create new relation, and add it to the graph. */
- rel = OBJECT_GUARDED_NEW(DepsRelation, from, to, description);
+ rel = OBJECT_GUARDED_NEW(Relation, from, to, description);
rel->flag |= flags;
return rel;
}
-DepsRelation *Depsgraph::check_nodes_connected(const DepsNode *from,
- const DepsNode *to,
- const char *description)
+Relation *Depsgraph::check_nodes_connected(const Node *from,
+ const Node *to,
+ const char *description)
{
- foreach (DepsRelation *rel, from->outlinks) {
+ for (Relation *rel : from->outlinks) {
BLI_assert(rel->from == from);
if (rel->to != to) {
continue;
@@ -462,9 +447,7 @@ DepsRelation *Depsgraph::check_nodes_connected(const DepsNode *from,
/* ************************ */
/* Relationships Management */
-DepsRelation::DepsRelation(DepsNode *from,
- DepsNode *to,
- const char *description)
+Relation::Relation(Node *from, Node *to, const char *description)
: from(from),
to(to),
name(description),
@@ -482,19 +465,18 @@ DepsRelation::DepsRelation(DepsNode *from,
* anyway.
*
* - Unregistering relation is not a cheap operation, so better to have it
- * as an explicit call if we need this.
- */
+ * as an explicit call if we need this. */
from->outlinks.push_back(this);
to->inlinks.push_back(this);
}
-DepsRelation::~DepsRelation()
+Relation::~Relation()
{
/* Sanity check. */
BLI_assert(from != NULL && to != NULL);
}
-void DepsRelation::unlink()
+void Relation::unlink()
{
/* Sanity check. */
BLI_assert(from != NULL && to != NULL);
@@ -505,15 +487,16 @@ void DepsRelation::unlink()
/* Low level tagging -------------------------------------- */
/* Tag a specific node as needing updates. */
-void Depsgraph::add_entry_tag(OperationDepsNode *node)
+void Depsgraph::add_entry_tag(OperationNode *node)
{
/* Sanity check. */
if (node == NULL) {
return;
}
- /* Add to graph-level set of directly modified nodes to start searching from.
- * NOTE: this is necessary since we have several thousand nodes to play with...
- */
+ /* Add to graph-level set of directly modified nodes to start searching
+ * from.
+ * NOTE: this is necessary since we have several thousand nodes to play
+ * with. */
BLI_gset_insert(entry_tags, node);
}
@@ -521,22 +504,21 @@ void Depsgraph::clear_all_nodes()
{
clear_id_nodes();
if (time_source != NULL) {
- OBJECT_GUARDED_DELETE(time_source, TimeSourceDepsNode);
+ OBJECT_GUARDED_DELETE(time_source, TimeSourceNode);
time_source = NULL;
}
}
ID *Depsgraph::get_cow_id(const ID *id_orig) const
{
- IDDepsNode *id_node = find_id_node(id_orig);
+ IDNode *id_node = find_id_node(id_orig);
if (id_node == NULL) {
/* This function is used from places where we expect ID to be either
* already a copy-on-write version or have a corresponding copy-on-write
* version.
*
* We try to enforce that in debug builds, for for release we play a bit
- * safer game here.
- */
+ * safer game here. */
if ((id_orig->tag & LIB_TAG_COPIED_ON_WRITE) == 0) {
/* TODO(sergey): This is nice sanity check to have, but it fails
* in following situations:
@@ -545,8 +527,7 @@ ID *Depsgraph::get_cow_id(const ID *id_orig) const
* shading system and hence can be ignored at construction.
* - Object or mesh has material at a slot which is not used (for
* example, object has material slot by materials are set to
- * object data).
- */
+ * object data). */
// BLI_assert(!"Request for non-existing copy-on-write ID");
}
return (ID *)id_orig;
@@ -554,46 +535,6 @@ ID *Depsgraph::get_cow_id(const ID *id_orig) const
return id_node->id_cow;
}
-void deg_editors_id_update(const DEGEditorUpdateContext *update_ctx, ID *id)
-{
- if (deg_editor_update_id_cb != NULL) {
- deg_editor_update_id_cb(update_ctx, id);
- }
-}
-
-void deg_editors_scene_update(const DEGEditorUpdateContext *update_ctx,
- bool updated)
-{
- if (deg_editor_update_scene_cb != NULL) {
- deg_editor_update_scene_cb(update_ctx, updated);
- }
-}
-
-bool deg_terminal_do_color(void)
-{
- return (G.debug & G_DEBUG_DEPSGRAPH_PRETTY) != 0;
-}
-
-string deg_color_for_pointer(const void *pointer)
-{
- if (!deg_terminal_do_color()) {
- return "";
- }
- int r, g, b;
- BLI_hash_pointer_to_color(pointer, &r, &g, &b);
- char buffer[64];
- BLI_snprintf(buffer, sizeof(buffer), TRUECOLOR_ANSI_COLOR_FORMAT, r, g, b);
- return string(buffer);
-}
-
-string deg_color_end(void)
-{
- if (!deg_terminal_do_color()) {
- return "";
- }
- return string(TRUECOLOR_ANSI_COLOR_FINISH);
-}
-
} // namespace DEG
/* **************** */
@@ -619,22 +560,13 @@ void DEG_graph_free(Depsgraph *graph)
OBJECT_GUARDED_DELETE(deg_depsgraph, Depsgraph);
}
-/* Set callbacks which are being called when depsgraph changes. */
-void DEG_editors_set_update_cb(DEG_EditorUpdateIDCb id_func,
- DEG_EditorUpdateSceneCb scene_func)
-{
- DEG::deg_editor_update_id_cb = id_func;
- DEG::deg_editor_update_scene_cb = scene_func;
-}
-
bool DEG_is_active(const struct Depsgraph *depsgraph)
{
if (depsgraph == NULL) {
/* Happens for such cases as work object in what_does_obaction(),
* and sine render pipeline parts. Shouldn't really be accepting
* NULL depsgraph, but is quite hard to get proper one in those
- * cases.
- */
+ * cases. */
return false;
}
const DEG::Depsgraph *deg_graph =
@@ -654,150 +586,3 @@ void DEG_make_inactive(struct Depsgraph *depsgraph)
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(depsgraph);
deg_graph->is_active = false;
}
-
-/* Evaluation and debug */
-
-bool DEG_debug_is_evaluating(struct Depsgraph *depsgraph)
-{
- DEG::Depsgraph *deg_graph =
- reinterpret_cast<DEG::Depsgraph *>(depsgraph);
- return deg_graph->debug_is_evaluating;
-}
-
-static DEG::string depsgraph_name_for_logging(struct Depsgraph *depsgraph)
-{
- const char *name = DEG_debug_name_get(depsgraph);
- if (name[0] == '\0') {
- return "";
- }
- return "[" + DEG::string(name) + "]: ";
-}
-
-void DEG_debug_print_begin(struct Depsgraph *depsgraph)
-{
- fprintf(stdout, "%s",
- depsgraph_name_for_logging(depsgraph).c_str());
-}
-
-void DEG_debug_print_eval(struct Depsgraph *depsgraph,
- const char *function_name,
- const char *object_name,
- const void *object_address)
-{
- if ((DEG_debug_flags_get(depsgraph) & G_DEBUG_DEPSGRAPH_EVAL) == 0) {
- return;
- }
- fprintf(stdout,
- "%s%s on %s %s(%p)%s\n",
- depsgraph_name_for_logging(depsgraph).c_str(),
- function_name,
- object_name,
- DEG::deg_color_for_pointer(object_address).c_str(),
- object_address,
- DEG::deg_color_end().c_str());
- fflush(stdout);
-}
-
-void DEG_debug_print_eval_subdata(struct Depsgraph *depsgraph,
- const char *function_name,
- const char *object_name,
- const void *object_address,
- const char *subdata_comment,
- const char *subdata_name,
- const void *subdata_address)
-{
- if ((DEG_debug_flags_get(depsgraph) & G_DEBUG_DEPSGRAPH_EVAL) == 0) {
- return;
- }
- fprintf(stdout,
- "%s%s on %s %s(%p)%s %s %s %s(%p)%s\n",
- depsgraph_name_for_logging(depsgraph).c_str(),
- function_name,
- object_name,
- DEG::deg_color_for_pointer(object_address).c_str(),
- object_address,
- DEG::deg_color_end().c_str(),
- subdata_comment,
- subdata_name,
- DEG::deg_color_for_pointer(subdata_address).c_str(),
- subdata_address,
- DEG::deg_color_end().c_str());
- fflush(stdout);
-}
-
-void DEG_debug_print_eval_subdata_index(struct Depsgraph *depsgraph,
- const char *function_name,
- const char *object_name,
- const void *object_address,
- const char *subdata_comment,
- const char *subdata_name,
- const void *subdata_address,
- const int subdata_index)
-{
- if ((DEG_debug_flags_get(depsgraph) & G_DEBUG_DEPSGRAPH_EVAL) == 0) {
- return;
- }
- fprintf(stdout,
- "%s%s on %s %s(%p)%s %s %s[%d] %s(%p)%s\n",
- depsgraph_name_for_logging(depsgraph).c_str(),
- function_name,
- object_name,
- DEG::deg_color_for_pointer(object_address).c_str(),
- object_address,
- DEG::deg_color_end().c_str(),
- subdata_comment,
- subdata_name,
- subdata_index,
- DEG::deg_color_for_pointer(subdata_address).c_str(),
- subdata_address,
- DEG::deg_color_end().c_str());
- fflush(stdout);
-}
-
-void DEG_debug_print_eval_parent_typed(struct Depsgraph *depsgraph,
- const char *function_name,
- const char *object_name,
- const void *object_address,
- const char *parent_comment,
- const char *parent_name,
- const void *parent_address)
-{
- if ((DEG_debug_flags_get(depsgraph) & G_DEBUG_DEPSGRAPH_EVAL) == 0) {
- return;
- }
- fprintf(stdout,
- "%s%s on %s %s(%p) [%s] %s %s %s(%p)%s\n",
- depsgraph_name_for_logging(depsgraph).c_str(),
- function_name,
- object_name,
- DEG::deg_color_for_pointer(object_address).c_str(),
- object_address,
- DEG::deg_color_end().c_str(),
- parent_comment,
- parent_name,
- DEG::deg_color_for_pointer(parent_address).c_str(),
- parent_address,
- DEG::deg_color_end().c_str());
- fflush(stdout);
-}
-
-void DEG_debug_print_eval_time(struct Depsgraph *depsgraph,
- const char *function_name,
- const char *object_name,
- const void *object_address,
- float time)
-{
- if ((DEG_debug_flags_get(depsgraph) & G_DEBUG_DEPSGRAPH_EVAL) == 0) {
- return;
- }
- fprintf(stdout,
- "%s%s on %s %s(%p)%s at time %f\n",
- depsgraph_name_for_logging(depsgraph).c_str(),
- function_name,
- object_name,
- DEG::deg_color_for_pointer(object_address).c_str(),
- object_address,
- DEG::deg_color_end().c_str(),
- time);
- fflush(stdout);
-}
diff --git a/source/blender/depsgraph/intern/depsgraph.h b/source/blender/depsgraph/intern/depsgraph.h
index a816fcc32df..ee52f87d9e4 100644
--- a/source/blender/depsgraph/intern/depsgraph.h
+++ b/source/blender/depsgraph/intern/depsgraph.h
@@ -47,7 +47,7 @@
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_physics.h"
-#include "intern/depsgraph_types.h"
+#include "intern/depsgraph_type.h"
struct GHash;
struct GSet;
@@ -60,47 +60,46 @@ struct ViewLayer;
namespace DEG {
-struct ComponentDepsNode;
-struct DepsNode;
-struct IDDepsNode;
-struct OperationDepsNode;
-struct TimeSourceDepsNode;
+struct ComponentNode;
+struct Node;
+struct IDNode;
+struct OperationNode;
+struct TimeSourceNode;
/* *************************** */
/* Relationships Between Nodes */
-/* Settings/Tags on Relationship */
-typedef enum eDepsRelation_Flag {
+/* Settings/Tags on Relationship.
+ * NOTE: Is a bitmask, allowing accumulation. */
+enum RelationFlag {
/* "cyclic" link - when detecting cycles, this relationship was the one
* which triggers a cyclic relationship to exist in the graph. */
- DEPSREL_FLAG_CYCLIC = (1 << 0),
+ RELATION_FLAG_CYCLIC = (1 << 0),
/* Update flush will not go through this relation. */
- DEPSREL_FLAG_NO_FLUSH = (1 << 1),
+ RELATION_FLAG_NO_FLUSH = (1 << 1),
/* Only flush along the relation is update comes from a node which was
* affected by user input. */
- DEPSREL_FLAG_FLUSH_USER_EDIT_ONLY = (1 << 2),
+ RELATION_FLAG_FLUSH_USER_EDIT_ONLY = (1 << 2),
/* The relation can not be killed by the cyclic dependencies solver. */
- DEPSREL_FLAG_GODMODE = (1 << 3),
-} eDepsRelation_Flag;
+ RELATION_FLAG_GODMODE = (1 << 3),
+ /* Relation will check existance before being added. */
+ RELATION_CHECK_BEFORE_ADD = (1 << 4),
+};
/* B depends on A (A -> B) */
-struct DepsRelation {
+struct Relation {
+ Relation(Node *from, Node *to, const char *description);
+ ~Relation();
+
+ void unlink();
+
/* the nodes in the relationship (since this is shared between the nodes) */
- DepsNode *from; /* A */
- DepsNode *to; /* B */
+ Node *from; /* A */
+ Node *to; /* B */
/* relationship attributes */
const char *name; /* label for debugging */
-
- int flag; /* (eDepsRelation_Flag) */
-
- DepsRelation(DepsNode *from,
- DepsNode *to,
- const char *description);
-
- ~DepsRelation();
-
- void unlink();
+ int flag; /* Bitmask of RelationFlag) */
};
/* For queries which gives operation node or key defines whether we are
@@ -123,8 +122,8 @@ enum class RNAPointerSource {
/* Dependency Graph object */
struct Depsgraph {
// TODO(sergey): Go away from C++ container and use some native BLI.
- typedef vector<OperationDepsNode *> OperationNodes;
- typedef vector<IDDepsNode *> IDDepsNodes;
+ typedef vector<OperationNode *> OperationNodes;
+ typedef vector<IDNode *> IDDepsNodes;
Depsgraph(Scene *scene,
ViewLayer *view_layer,
@@ -140,41 +139,33 @@ struct Depsgraph {
*
* \return A node matching the required characteristics if it exists
* or NULL if no such node exists in the graph */
- DepsNode *find_node_from_pointer(const PointerRNA *ptr,
+ Node *find_node_from_pointer(const PointerRNA *ptr,
const PropertyRNA *prop,
RNAPointerSource source) const;
- TimeSourceDepsNode *add_time_source();
- TimeSourceDepsNode *find_time_source() const;
+ TimeSourceNode *add_time_source();
+ TimeSourceNode *find_time_source() const;
- IDDepsNode *find_id_node(const ID *id) const;
- IDDepsNode *add_id_node(ID *id, ID *id_cow_hint = NULL);
+ IDNode *find_id_node(const ID *id) const;
+ IDNode *add_id_node(ID *id, ID *id_cow_hint = NULL);
void clear_id_nodes();
void clear_id_nodes_conditional(const std::function <bool (ID_Type id_type)>& filter);
/* Add new relationship between two nodes. */
- DepsRelation *add_new_relation(OperationDepsNode *from,
- OperationDepsNode *to,
- const char *description,
- bool check_unique = false,
- int flags = 0);
-
- DepsRelation *add_new_relation(DepsNode *from,
- DepsNode *to,
- const char *description,
- bool check_unique = false,
- int flags = 0);
+ Relation *add_new_relation(Node *from,
+ Node *to,
+ const char *description,
+ int flags = 0);
/* Check whether two nodes are connected by relation with given
* description. Description might be NULL to check ANY relation between
- * given nodes.
- */
- DepsRelation *check_nodes_connected(const DepsNode *from,
- const DepsNode *to,
- const char *description);
+ * given nodes. */
+ Relation *check_nodes_connected(const Node *from,
+ const Node *to,
+ const char *description);
/* Tag a specific node as needing updates. */
- void add_entry_tag(OperationDepsNode *node);
+ void add_entry_tag(OperationNode *node);
/* Clear storage used by all nodes. */
void clear_all_nodes();
@@ -186,19 +177,17 @@ struct Depsgraph {
/* Core Graph Functionality ........... */
- /* <ID : IDDepsNode> mapping from ID blocks to nodes representing these
- * blocks, used for quick lookups.
- */
+ /* <ID : IDNode> mapping from ID blocks to nodes representing these
+ * blocks, used for quick lookups. */
GHash *id_hash;
/* Ordered list of ID nodes, order matches ID allocation order.
* Used for faster iteration, especially for areas which are critical to
- * keep exact order of iteration.
- */
+ * keep exact order of iteration. */
IDDepsNodes id_nodes;
/* Top-level time source node. */
- TimeSourceDepsNode *time_source;
+ TimeSourceNode *time_source;
/* Indicates whether relations needs to be updated. */
bool need_update;
@@ -218,8 +207,7 @@ struct Depsgraph {
OperationNodes operations;
/* Spin lock for threading-critical operations.
- * Mainly used by graph evaluation.
- */
+ * Mainly used by graph evaluation. */
SpinLock lock;
/* Scene, layer, mode this dependency graph is built for. */
@@ -231,8 +219,7 @@ struct Depsgraph {
float ctime;
/* Evaluated version of datablocks we access a lot.
- * Stored here to save us form doing hash lookup.
- */
+ * Stored here to save us form doing hash lookup. */
Scene *scene_cow;
/* Active dependency graph is a dependency graph which is used by the
@@ -241,8 +228,7 @@ struct Depsgraph {
* result and other selective things (object matrix?) to original object.
*
* This way we simplify operators, which don't need to worry about where
- * to read stuff from.
- */
+ * to read stuff from. */
bool is_active;
/* NOTE: Corresponds to G_DEBUG_DEPSGRAPH_* flags. */
diff --git a/source/blender/depsgraph/intern/depsgraph_build.cc b/source/blender/depsgraph/intern/depsgraph_build.cc
index 5ff504bc8c6..590488a109b 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.cc
+++ b/source/blender/depsgraph/intern/depsgraph_build.cc
@@ -58,45 +58,44 @@ extern "C" {
#include "builder/deg_builder_relations.h"
#include "builder/deg_builder_transitive.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/debug/deg_debug.h"
-#include "intern/depsgraph_types.h"
-#include "intern/depsgraph_intern.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 "util/deg_util_foreach.h"
+#include "intern/depsgraph_type.h"
/* ****************** */
/* External Build API */
-static DEG::eDepsNode_Type deg_build_scene_component_type(
+static DEG::NodeType deg_build_scene_component_type(
eDepsSceneComponentType component)
{
switch (component) {
- case DEG_SCENE_COMP_PARAMETERS: return DEG::DEG_NODE_TYPE_PARAMETERS;
- case DEG_SCENE_COMP_ANIMATION: return DEG::DEG_NODE_TYPE_ANIMATION;
- case DEG_SCENE_COMP_SEQUENCER: return DEG::DEG_NODE_TYPE_SEQUENCER;
+ case DEG_SCENE_COMP_PARAMETERS: return DEG::NodeType::PARAMETERS;
+ case DEG_SCENE_COMP_ANIMATION: return DEG::NodeType::ANIMATION;
+ case DEG_SCENE_COMP_SEQUENCER: return DEG::NodeType::SEQUENCER;
}
- return DEG::DEG_NODE_TYPE_UNDEFINED;
+ return DEG::NodeType::UNDEFINED;
}
-static DEG::eDepsNode_Type deg_build_object_component_type(
+static DEG::NodeType deg_build_object_component_type(
eDepsObjectComponentType component)
{
switch (component) {
- case DEG_OB_COMP_PARAMETERS: return DEG::DEG_NODE_TYPE_PARAMETERS;
- case DEG_OB_COMP_PROXY: return DEG::DEG_NODE_TYPE_PROXY;
- case DEG_OB_COMP_ANIMATION: return DEG::DEG_NODE_TYPE_ANIMATION;
- case DEG_OB_COMP_TRANSFORM: return DEG::DEG_NODE_TYPE_TRANSFORM;
- case DEG_OB_COMP_GEOMETRY: return DEG::DEG_NODE_TYPE_GEOMETRY;
- case DEG_OB_COMP_EVAL_POSE: return DEG::DEG_NODE_TYPE_EVAL_POSE;
- case DEG_OB_COMP_BONE: return DEG::DEG_NODE_TYPE_BONE;
- case DEG_OB_COMP_SHADING: return DEG::DEG_NODE_TYPE_SHADING;
- case DEG_OB_COMP_CACHE: return DEG::DEG_NODE_TYPE_CACHE;
+ case DEG_OB_COMP_PARAMETERS: return DEG::NodeType::PARAMETERS;
+ case DEG_OB_COMP_PROXY: return DEG::NodeType::PROXY;
+ case DEG_OB_COMP_ANIMATION: return DEG::NodeType::ANIMATION;
+ case DEG_OB_COMP_TRANSFORM: return DEG::NodeType::TRANSFORM;
+ case DEG_OB_COMP_GEOMETRY: return DEG::NodeType::GEOMETRY;
+ case DEG_OB_COMP_EVAL_POSE: return DEG::NodeType::EVAL_POSE;
+ case DEG_OB_COMP_BONE: return DEG::NodeType::BONE;
+ case DEG_OB_COMP_SHADING: return DEG::NodeType::SHADING;
+ case DEG_OB_COMP_CACHE: return DEG::NodeType::CACHE;
}
- return DEG::DEG_NODE_TYPE_UNDEFINED;
+ return DEG::NodeType::UNDEFINED;
}
static DEG::DepsNodeHandle *get_node_handle(DepsNodeHandle *node_handle)
@@ -109,7 +108,7 @@ void DEG_add_scene_relation(DepsNodeHandle *node_handle,
eDepsSceneComponentType component,
const char *description)
{
- DEG::eDepsNode_Type type = deg_build_scene_component_type(component);
+ DEG::NodeType type = deg_build_scene_component_type(component);
DEG::ComponentKey comp_key(&scene->id, type);
DEG::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
deg_node_handle->builder->add_node_handle_relation(comp_key,
@@ -122,7 +121,7 @@ void DEG_add_object_relation(DepsNodeHandle *node_handle,
eDepsObjectComponentType component,
const char *description)
{
- DEG::eDepsNode_Type type = deg_build_object_component_type(component);
+ DEG::NodeType type = deg_build_object_component_type(component);
DEG::ComponentKey comp_key(&object->id, type);
DEG::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
deg_node_handle->builder->add_node_handle_relation(comp_key,
@@ -135,7 +134,7 @@ void DEG_add_object_cache_relation(DepsNodeHandle *node_handle,
eDepsObjectComponentType component,
const char *description)
{
- DEG::eDepsNode_Type type = deg_build_object_component_type(component);
+ DEG::NodeType type = deg_build_object_component_type(component);
DEG::ComponentKey comp_key(&cache_file->id, type);
DEG::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
deg_node_handle->builder->add_node_handle_relation(comp_key,
@@ -149,7 +148,7 @@ void DEG_add_bone_relation(DepsNodeHandle *node_handle,
eDepsObjectComponentType component,
const char *description)
{
- DEG::eDepsNode_Type type = deg_build_object_component_type(component);
+ DEG::NodeType type = deg_build_object_component_type(component);
DEG::ComponentKey comp_key(&object->id, type, bone_name);
DEG::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
deg_node_handle->builder->add_node_handle_relation(comp_key,
@@ -162,7 +161,7 @@ void DEG_add_object_pointcache_relation(struct DepsNodeHandle *node_handle,
eDepsObjectComponentType component,
const char *description)
{
- DEG::eDepsNode_Type type = deg_build_object_component_type(component);
+ DEG::NodeType type = deg_build_object_component_type(component);
DEG::ComponentKey comp_key(&object->id, type);
DEG::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
DEG::DepsgraphRelationBuilder *relation_builder = deg_node_handle->builder;
@@ -171,11 +170,11 @@ void DEG_add_object_pointcache_relation(struct DepsNodeHandle *node_handle,
comp_key, deg_node_handle, description);
/* Node deduct point cache component and connect source to it. */
ID *id = DEG_get_id_from_handle(node_handle);
- DEG::ComponentKey point_cache_key(id, DEG::DEG_NODE_TYPE_POINT_CACHE);
- DEG::DepsRelation *rel = relation_builder->add_relation(
+ DEG::ComponentKey point_cache_key(id, DEG::NodeType::POINT_CACHE);
+ DEG::Relation *rel = relation_builder->add_relation(
comp_key, point_cache_key, "Point Cache");
if (rel != NULL) {
- rel->flag |= DEG::DEPSREL_FLAG_FLUSH_USER_EDIT_ONLY;
+ rel->flag |= DEG::RELATION_FLAG_FLUSH_USER_EDIT_ONLY;
}
else {
fprintf(stderr,
@@ -191,8 +190,8 @@ void DEG_add_generic_id_relation(struct DepsNodeHandle *node_handle,
{
DEG::OperationKey operation_key(
id,
- DEG::DEG_NODE_TYPE_GENERIC_DATABLOCK,
- DEG::DEG_OPCODE_GENERIC_DATABLOCK_UPDATE);
+ DEG::NodeType::GENERIC_DATABLOCK,
+ DEG::OperationCode::GENERIC_DATABLOCK_UPDATE);
DEG::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
deg_node_handle->builder->add_node_handle_relation(operation_key,
deg_node_handle,
@@ -256,8 +255,7 @@ void DEG_graph_build_from_view_layer(Depsgraph *graph,
DEG::DEG_ID_LINKED_DIRECTLY);
node_builder.end_build();
/* Hook up relationships between operations - to determine evaluation
- * order.
- */
+ * order. */
DEG::DepsgraphRelationBuilder relation_builder(bmain, deg_graph);
relation_builder.begin_build();
relation_builder.build_view_layer(scene, view_layer);
@@ -267,8 +265,7 @@ void DEG_graph_build_from_view_layer(Depsgraph *graph,
/* Simplify the graph by removing redundant relations (to optimize
* traversal later). */
/* TODO: it would be useful to have an option to disable this in cases where
- * it is causing trouble.
- */
+ * it is causing trouble. */
if (G.debug_value == 799) {
DEG::deg_graph_transitive_reduction(deg_graph);
}
@@ -303,9 +300,8 @@ void DEG_graph_tag_relations_update(Depsgraph *graph)
* re-create flat array of bases in view layer.
*
* TODO(sergey): Try to make it so we don't flush updates
- * to the whole depsgraph.
- */
- DEG::IDDepsNode *id_node = deg_graph->find_id_node(&deg_graph->scene->id);
+ * to the whole depsgraph. */
+ DEG::IDNode *id_node = deg_graph->find_id_node(&deg_graph->scene->id);
if (id_node != NULL) {
id_node->tag_update(deg_graph, DEG::DEG_UPDATE_SOURCE_RELATIONS);
}
diff --git a/source/blender/depsgraph/intern/depsgraph_debug.cc b/source/blender/depsgraph/intern/depsgraph_debug.cc
index 91db054b006..9809b1487e9 100644
--- a/source/blender/depsgraph/intern/depsgraph_debug.cc
+++ b/source/blender/depsgraph/intern/depsgraph_debug.cc
@@ -44,12 +44,12 @@ extern "C" {
#include "DEG_depsgraph_build.h"
#include "DEG_depsgraph_query.h"
-#include "intern/depsgraph_intern.h"
-#include "intern/depsgraph_types.h"
-#include "intern/nodes/deg_node_id.h"
-#include "intern/nodes/deg_node_time.h"
-
-#include "util/deg_util_foreach.h"
+#include "intern/depsgraph.h"
+#include "intern/depsgraph_type.h"
+#include "intern/debug/deg_debug.h"
+#include "intern/node/deg_node_component.h"
+#include "intern/node/deg_node_id.h"
+#include "intern/node/deg_node_time.h"
void DEG_debug_flags_set(Depsgraph *depsgraph, int flags)
{
@@ -94,8 +94,7 @@ bool DEG_debug_compare(const struct Depsgraph *graph1,
*
* Would be cool to make it more robust, but it's good enough
* for now. Also, proper graph check is actually NP-complex
- * problem..
- */
+ * problem. */
return true;
}
@@ -118,49 +117,46 @@ bool DEG_debug_graph_relations_validate(Depsgraph *graph,
bool DEG_debug_consistency_check(Depsgraph *graph)
{
- const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(graph);
-
+ const DEG::Depsgraph *deg_graph =
+ reinterpret_cast<const DEG::Depsgraph *>(graph);
/* Validate links exists in both directions. */
- foreach (DEG::OperationDepsNode *node, deg_graph->operations) {
- foreach (DEG::DepsRelation *rel, node->outlinks) {
+ for (DEG::OperationNode *node : deg_graph->operations) {
+ for (DEG::Relation *rel : node->outlinks) {
int counter1 = 0;
- foreach (DEG::DepsRelation *tmp_rel, node->outlinks) {
+ for (DEG::Relation *tmp_rel : node->outlinks) {
if (tmp_rel == rel) {
++counter1;
}
}
-
int counter2 = 0;
- foreach (DEG::DepsRelation *tmp_rel, rel->to->inlinks) {
+ for (DEG::Relation *tmp_rel : rel->to->inlinks) {
if (tmp_rel == rel) {
++counter2;
}
}
-
if (counter1 != counter2) {
- printf("Relation exists in outgoing direction but not in incoming (%d vs. %d).\n",
+ printf("Relation exists in outgoing direction but not in "
+ "incoming (%d vs. %d).\n",
counter1, counter2);
return false;
}
}
}
- foreach (DEG::OperationDepsNode *node, deg_graph->operations) {
- foreach (DEG::DepsRelation *rel, node->inlinks) {
+ for (DEG::OperationNode *node : deg_graph->operations) {
+ for (DEG::Relation *rel : node->inlinks) {
int counter1 = 0;
- foreach (DEG::DepsRelation *tmp_rel, node->inlinks) {
+ for (DEG::Relation *tmp_rel : node->inlinks) {
if (tmp_rel == rel) {
++counter1;
}
}
-
int counter2 = 0;
- foreach (DEG::DepsRelation *tmp_rel, rel->from->outlinks) {
+ for (DEG::Relation *tmp_rel : rel->from->outlinks) {
if (tmp_rel == rel) {
++counter2;
}
}
-
if (counter1 != counter2) {
printf("Relation exists in incoming direction but not in outcoming (%d vs. %d).\n",
counter1, counter2);
@@ -169,20 +165,20 @@ bool DEG_debug_consistency_check(Depsgraph *graph)
}
/* Validate node valency calculated in both directions. */
- foreach (DEG::OperationDepsNode *node, deg_graph->operations) {
+ for (DEG::OperationNode *node : deg_graph->operations) {
node->num_links_pending = 0;
node->custom_flags = 0;
}
- foreach (DEG::OperationDepsNode *node, deg_graph->operations) {
+ for (DEG::OperationNode *node : deg_graph->operations) {
if (node->custom_flags) {
printf("Node %s is twice in the operations!\n",
node->identifier().c_str());
return false;
}
- foreach (DEG::DepsRelation *rel, node->outlinks) {
- if (rel->to->type == DEG::DEG_NODE_TYPE_OPERATION) {
- DEG::OperationDepsNode *to = (DEG::OperationDepsNode *)rel->to;
+ for (DEG::Relation *rel : node->outlinks) {
+ if (rel->to->type == DEG::NodeType::OPERATION) {
+ DEG::OperationNode *to = (DEG::OperationNode *)rel->to;
BLI_assert(to->num_links_pending < to->inlinks.size());
++to->num_links_pending;
}
@@ -190,10 +186,10 @@ bool DEG_debug_consistency_check(Depsgraph *graph)
node->custom_flags = 1;
}
- foreach (DEG::OperationDepsNode *node, deg_graph->operations) {
+ for (DEG::OperationNode *node : deg_graph->operations) {
int num_links_pending = 0;
- foreach (DEG::DepsRelation *rel, node->inlinks) {
- if (rel->from->type == DEG::DEG_NODE_TYPE_OPERATION) {
+ for (DEG::Relation *rel : node->inlinks) {
+ if (rel->from->type == DEG::NodeType::OPERATION) {
++num_links_pending;
}
}
@@ -224,8 +220,7 @@ void DEG_stats_simple(const Depsgraph *graph, size_t *r_outer,
/* number of operations */
if (r_operations) {
/* All operations should be in this list, allowing us to count the total
- * number of nodes.
- */
+ * number of nodes. */
*r_operations = deg_graph->operations.size();
}
@@ -234,19 +229,19 @@ void DEG_stats_simple(const Depsgraph *graph, size_t *r_outer,
size_t tot_outer = 0;
size_t tot_rels = 0;
- foreach (DEG::IDDepsNode *id_node, deg_graph->id_nodes) {
+ for (DEG::IDNode *id_node : deg_graph->id_nodes) {
tot_outer++;
- GHASH_FOREACH_BEGIN(DEG::ComponentDepsNode *, comp_node, id_node->components)
+ GHASH_FOREACH_BEGIN(DEG::ComponentNode *, comp_node, id_node->components)
{
tot_outer++;
- foreach (DEG::OperationDepsNode *op_node, comp_node->operations) {
+ for (DEG::OperationNode *op_node : comp_node->operations) {
tot_rels += op_node->inlinks.size();
}
}
GHASH_FOREACH_END();
}
- DEG::TimeSourceDepsNode *time_source = deg_graph->find_time_source();
+ DEG::TimeSourceNode *time_source = deg_graph->find_time_source();
if (time_source != NULL) {
tot_rels += time_source->inlinks.size();
}
@@ -255,3 +250,148 @@ void DEG_stats_simple(const Depsgraph *graph, size_t *r_outer,
if (r_outer) *r_outer = tot_outer;
}
}
+
+bool DEG_debug_is_evaluating(struct Depsgraph *depsgraph)
+{
+ DEG::Depsgraph *deg_graph =
+ reinterpret_cast<DEG::Depsgraph *>(depsgraph);
+ return deg_graph->debug_is_evaluating;
+}
+
+static DEG::string depsgraph_name_for_logging(struct Depsgraph *depsgraph)
+{
+ const char *name = DEG_debug_name_get(depsgraph);
+ if (name[0] == '\0') {
+ return "";
+ }
+ return "[" + DEG::string(name) + "]: ";
+}
+
+void DEG_debug_print_begin(struct Depsgraph *depsgraph)
+{
+ fprintf(stdout, "%s",
+ depsgraph_name_for_logging(depsgraph).c_str());
+}
+
+void DEG_debug_print_eval(struct Depsgraph *depsgraph,
+ const char *function_name,
+ const char *object_name,
+ const void *object_address)
+{
+ if ((DEG_debug_flags_get(depsgraph) & G_DEBUG_DEPSGRAPH_EVAL) == 0) {
+ return;
+ }
+ fprintf(stdout,
+ "%s%s on %s %s(%p)%s\n",
+ depsgraph_name_for_logging(depsgraph).c_str(),
+ function_name,
+ object_name,
+ DEG::color_for_pointer(object_address).c_str(),
+ object_address,
+ DEG::color_end().c_str());
+ fflush(stdout);
+}
+
+void DEG_debug_print_eval_subdata(struct Depsgraph *depsgraph,
+ const char *function_name,
+ const char *object_name,
+ const void *object_address,
+ const char *subdata_comment,
+ const char *subdata_name,
+ const void *subdata_address)
+{
+ if ((DEG_debug_flags_get(depsgraph) & G_DEBUG_DEPSGRAPH_EVAL) == 0) {
+ return;
+ }
+ fprintf(stdout,
+ "%s%s on %s %s(%p)%s %s %s %s(%p)%s\n",
+ depsgraph_name_for_logging(depsgraph).c_str(),
+ function_name,
+ object_name,
+ DEG::color_for_pointer(object_address).c_str(),
+ object_address,
+ DEG::color_end().c_str(),
+ subdata_comment,
+ subdata_name,
+ DEG::color_for_pointer(subdata_address).c_str(),
+ subdata_address,
+ DEG::color_end().c_str());
+ fflush(stdout);
+}
+
+void DEG_debug_print_eval_subdata_index(struct Depsgraph *depsgraph,
+ const char *function_name,
+ const char *object_name,
+ const void *object_address,
+ const char *subdata_comment,
+ const char *subdata_name,
+ const void *subdata_address,
+ const int subdata_index)
+{
+ if ((DEG_debug_flags_get(depsgraph) & G_DEBUG_DEPSGRAPH_EVAL) == 0) {
+ return;
+ }
+ fprintf(stdout,
+ "%s%s on %s %s(%p)%s %s %s[%d] %s(%p)%s\n",
+ depsgraph_name_for_logging(depsgraph).c_str(),
+ function_name,
+ object_name,
+ DEG::color_for_pointer(object_address).c_str(),
+ object_address,
+ DEG::color_end().c_str(),
+ subdata_comment,
+ subdata_name,
+ subdata_index,
+ DEG::color_for_pointer(subdata_address).c_str(),
+ subdata_address,
+ DEG::color_end().c_str());
+ fflush(stdout);
+}
+
+void DEG_debug_print_eval_parent_typed(struct Depsgraph *depsgraph,
+ const char *function_name,
+ const char *object_name,
+ const void *object_address,
+ const char *parent_comment,
+ const char *parent_name,
+ const void *parent_address)
+{
+ if ((DEG_debug_flags_get(depsgraph) & G_DEBUG_DEPSGRAPH_EVAL) == 0) {
+ return;
+ }
+ fprintf(stdout,
+ "%s%s on %s %s(%p) [%s] %s %s %s(%p)%s\n",
+ depsgraph_name_for_logging(depsgraph).c_str(),
+ function_name,
+ object_name,
+ DEG::color_for_pointer(object_address).c_str(),
+ object_address,
+ DEG::color_end().c_str(),
+ parent_comment,
+ parent_name,
+ DEG::color_for_pointer(parent_address).c_str(),
+ parent_address,
+ DEG::color_end().c_str());
+ fflush(stdout);
+}
+
+void DEG_debug_print_eval_time(struct Depsgraph *depsgraph,
+ const char *function_name,
+ const char *object_name,
+ const void *object_address,
+ float time)
+{
+ if ((DEG_debug_flags_get(depsgraph) & G_DEBUG_DEPSGRAPH_EVAL) == 0) {
+ return;
+ }
+ fprintf(stdout,
+ "%s%s on %s %s(%p)%s at time %f\n",
+ depsgraph_name_for_logging(depsgraph).c_str(),
+ function_name,
+ object_name,
+ DEG::color_for_pointer(object_address).c_str(),
+ object_address,
+ DEG::color_end().c_str(),
+ time);
+ fflush(stdout);
+}
diff --git a/source/blender/depsgraph/intern/depsgraph_eval.cc b/source/blender/depsgraph/intern/depsgraph_eval.cc
index 49eccd76f38..24013038465 100644
--- a/source/blender/depsgraph/intern/depsgraph_eval.cc
+++ b/source/blender/depsgraph/intern/depsgraph_eval.cc
@@ -49,9 +49,9 @@ extern "C" {
#include "intern/eval/deg_eval.h"
#include "intern/eval/deg_eval_flush.h"
-#include "intern/nodes/deg_node.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_operation.h"
+#include "intern/node/deg_node_time.h"
#include "intern/depsgraph.h"
@@ -61,7 +61,7 @@ void DEG_evaluate_on_refresh(Depsgraph *graph)
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph);
deg_graph->ctime = BKE_scene_frame_get(deg_graph->scene);
/* Update time on primary timesource. */
- DEG::TimeSourceDepsNode *tsrc = deg_graph->find_time_source();
+ DEG::TimeSourceNode *tsrc = deg_graph->find_time_source();
tsrc->cfra = deg_graph->ctime;
/* Update time in scene. */
if (deg_graph->scene_cow) {
@@ -78,7 +78,7 @@ void DEG_evaluate_on_framechange(Main *bmain,
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph);
deg_graph->ctime = ctime;
/* Update time on primary timesource. */
- DEG::TimeSourceDepsNode *tsrc = deg_graph->find_time_source();
+ DEG::TimeSourceNode *tsrc = deg_graph->find_time_source();
tsrc->cfra = ctime;
tsrc->tag_update(deg_graph, DEG::DEG_UPDATE_SOURCE_TIME);
DEG::deg_graph_flush_updates(bmain, deg_graph);
diff --git a/source/blender/depsgraph/intern/depsgraph_intern.h b/source/blender/depsgraph/intern/depsgraph_intern.h
deleted file mode 100644
index 730e853363f..00000000000
--- a/source/blender/depsgraph/intern/depsgraph_intern.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2013 Blender Foundation.
- * All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/depsgraph/intern/depsgraph_intern.h
- * \ingroup depsgraph
- *
- * API's for internal use in the Depsgraph
- * - Also, defines for "Node Type Info"
- */
-
-#pragma once
-
-#include <cstdlib>
-
-#include "MEM_guardedalloc.h"
-
-extern "C" {
-#include "BKE_global.h"
-}
-
-#include "intern/nodes/deg_node.h"
-#include "intern/nodes/deg_node_component.h"
-#include "intern/nodes/deg_node_operation.h"
-#include "intern/depsgraph.h"
-
-#include "DEG_depsgraph_debug.h"
-
-struct Collection;
-struct DEGEditorUpdateContext;
-struct ListBase;
-struct Main;
-struct Scene;
-
-namespace DEG {
-
-/* Node Types Handling ================================================= */
-
-/* "Typeinfo" for Node Types ------------------------------------------- */
-
-/* Typeinfo Struct (nti) */
-struct DepsNodeFactory {
- virtual eDepsNode_Type type() const = 0;
- virtual const char *tname() const = 0;
- virtual int id_recalc_tag() const = 0;
-
- virtual DepsNode *create_node(const ID *id,
- const char *subdata,
- const char *name) const = 0;
-};
-
-template <class NodeType>
-struct DepsNodeFactoryImpl : public DepsNodeFactory {
- eDepsNode_Type type() const { return NodeType::typeinfo.type; }
- const char *tname() const { return NodeType::typeinfo.tname; }
- int id_recalc_tag() const { return NodeType::typeinfo.id_recalc_tag; }
-
- DepsNode *create_node(const ID *id, const char *subdata, const char *name) const
- {
- DepsNode *node = OBJECT_GUARDED_NEW(NodeType);
-
- /* populate base node settings */
- node->type = type();
-
- if (name[0] != '\0') {
- /* set name if provided ... */
- node->name = name;
- }
- else {
- /* ... otherwise use default type name */
- node->name = tname();
- }
-
- node->init(id, subdata);
-
- return node;
- }
-};
-
-/* Typeinfo Management -------------------------------------------------- */
-
-/* Register typeinfo */
-void deg_register_node_typeinfo(DepsNodeFactory *factory);
-
-/* Get typeinfo for specified type */
-DepsNodeFactory *deg_type_get_factory(const eDepsNode_Type type);
-
-/* Editors Integration -------------------------------------------------- */
-
-void deg_editors_id_update(const DEGEditorUpdateContext *update_ctx,
- struct ID *id);
-
-void deg_editors_scene_update(const DEGEditorUpdateContext *update_ctx,
- bool updated);
-
-#define DEG_DEBUG_PRINTF(depsgraph, type, ...) \
- do { \
- if (DEG_debug_flags_get(depsgraph) & G_DEBUG_DEPSGRAPH_ ## type) { \
- DEG_debug_print_begin(depsgraph); \
- fprintf(stdout, __VA_ARGS__); \
- } \
- } while (0)
-
-#define DEG_GLOBAL_DEBUG_PRINTF(type, ...) \
- do { \
- if (G.debug & G_DEBUG_DEPSGRAPH_ ## type) { \
- fprintf(stdout, __VA_ARGS__); \
- } \
- } while (0)
-
-#define DEG_ERROR_PRINTF(...) \
- do { \
- fprintf(stderr, __VA_ARGS__); \
- fflush(stderr); \
- } while (0)
-
-bool deg_terminal_do_color(void);
-string deg_color_for_pointer(const void *pointer);
-string deg_color_end(void);
-
-/* Physics Utilities -------------------------------------------------- */
-
-struct ListBase *deg_build_effector_relations(Depsgraph *graph, struct Collection *collection);
-struct ListBase *deg_build_collision_relations(Depsgraph *graph, struct Collection *collection, unsigned int modifier_type);
-void deg_clear_physics_relations(Depsgraph *graph);
-
-/* Tagging Utilities -------------------------------------------------------- */
-
-eDepsNode_Type deg_geometry_tag_to_component(const ID *id);
-void deg_id_tag_update(Main *bmain, ID *id, int flag, eUpdateSource update_source);
-void deg_graph_id_tag_update(Main *bmain, Depsgraph *graph, ID *id, int flag, eUpdateSource update_source);
-
-} // namespace DEG
diff --git a/source/blender/depsgraph/intern/depsgraph_physics.cc b/source/blender/depsgraph/intern/depsgraph_physics.cc
index e091f612a05..f0d3644d57c 100644
--- a/source/blender/depsgraph/intern/depsgraph_physics.cc
+++ b/source/blender/depsgraph/intern/depsgraph_physics.cc
@@ -27,6 +27,8 @@
* Physics utilities for effectors and collision.
*/
+#include "intern/depsgraph_physics.h"
+
#include "MEM_guardedalloc.h"
#include "BLI_compiler_compat.h"
@@ -48,7 +50,6 @@ extern "C" {
#include "DEG_depsgraph_query.h"
#include "depsgraph.h"
-#include "depsgraph_intern.h"
/*************************** Evaluation Query API *****************************/
@@ -110,7 +111,7 @@ void DEG_add_collision_relations(DepsNodeHandle *handle,
{
Depsgraph *depsgraph = DEG_get_graph_from_handle(handle);
DEG::Depsgraph *deg_graph = (DEG::Depsgraph *)depsgraph;
- ListBase *relations = deg_build_collision_relations(
+ ListBase *relations = build_collision_relations(
deg_graph, collection, modifier_type);
LISTBASE_FOREACH (CollisionRelation *, relation, relations) {
Object *ob1 = relation->ob;
@@ -140,7 +141,7 @@ void DEG_add_forcefield_relations(DepsNodeHandle *handle,
Depsgraph *depsgraph = DEG_get_graph_from_handle(handle);
DEG::Depsgraph *deg_graph = (DEG::Depsgraph *)depsgraph;
ListBase *relations =
- deg_build_effector_relations(deg_graph, effector_weights->group);
+ build_effector_relations(deg_graph, effector_weights->group);
LISTBASE_FOREACH (EffectorRelation *, relation, relations) {
if (relation->ob == object) {
continue;
@@ -195,8 +196,7 @@ void DEG_add_forcefield_relations(DepsNodeHandle *handle,
namespace DEG
{
-ListBase *deg_build_effector_relations(Depsgraph *graph,
- Collection *collection)
+ListBase *build_effector_relations(Depsgraph *graph, Collection *collection)
{
GHash *hash = graph->physics_relations[DEG_PHYSICS_EFFECTOR];
if (hash == NULL) {
@@ -215,9 +215,9 @@ ListBase *deg_build_effector_relations(Depsgraph *graph,
return relations;
}
-ListBase *deg_build_collision_relations(Depsgraph *graph,
- Collection *collection,
- unsigned int modifier_type)
+ListBase *build_collision_relations(Depsgraph *graph,
+ Collection *collection,
+ unsigned int modifier_type)
{
const ePhysicsRelationType type = modifier_to_relation_type(modifier_type);
GHash *hash = graph->physics_relations[type];
@@ -251,11 +251,11 @@ void free_collision_relations(void *value)
} // namespace
-void deg_clear_physics_relations(Depsgraph *graph)
+void clear_physics_relations(Depsgraph *graph)
{
for (int i = 0; i < DEG_PHYSICS_RELATIONS_NUM; i++) {
if (graph->physics_relations[i]) {
- ePhysicsRelationType type = (ePhysicsRelationType)i;
+ const ePhysicsRelationType type = (ePhysicsRelationType)i;
switch (type) {
case DEG_PHYSICS_EFFECTOR:
diff --git a/source/blender/depsgraph/util/deg_util_foreach.h b/source/blender/depsgraph/intern/depsgraph_physics.h
index 5484192207b..193fe108e24 100644
--- a/source/blender/depsgraph/util/deg_util_foreach.h
+++ b/source/blender/depsgraph/intern/depsgraph_physics.h
@@ -15,19 +15,32 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * The Original Code is Copyright (C) 2016 Blender Foundation.
+ * The Original Code is Copyright (C) 2019 Blender Foundation.
* All rights reserved.
*
* Original Author: Sergey Sharybin
- * Contributor(s):
+ * Contributor(s): None Yet
*
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/util/deg_util_foreach.h
+/** \file blender/depsgraph/intern/depsgraph_physics.h
* \ingroup depsgraph
*/
#pragma once
-#define foreach(x, y) for(x : y)
+struct Collection;
+struct ListBase;
+
+namespace DEG {
+
+struct Depsgraph;
+
+ListBase *build_effector_relations(Depsgraph *graph, Collection *collection);
+ListBase *build_collision_relations(Depsgraph *graph,
+ Collection *collection,
+ unsigned int modifier_type);
+void clear_physics_relations(Depsgraph *graph);
+
+} // namespace DEG
diff --git a/source/blender/depsgraph/intern/depsgraph_query.cc b/source/blender/depsgraph/intern/depsgraph_query.cc
index c6ade6ac4c3..9efde0605ff 100644
--- a/source/blender/depsgraph/intern/depsgraph_query.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query.cc
@@ -51,9 +51,9 @@ extern "C" {
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
+#include "intern/depsgraph.h"
#include "intern/eval/deg_eval_copy_on_write.h"
-#include "intern/depsgraph_intern.h"
-#include "intern/nodes/deg_node_id.h"
+#include "intern/node/deg_node_id.h"
struct Scene *DEG_get_input_scene(const Depsgraph *graph)
{
@@ -107,13 +107,12 @@ uint32_t DEG_get_eval_flags_for_id(const Depsgraph *graph, ID *id)
* after modifying scene graph.
*
* Currently harmless because it's only called for temporary
- * objects which are out of the DAG anyway.
- */
+ * objects which are out of the DAG anyway. */
return 0;
}
const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(graph);
- const DEG::IDDepsNode *id_node = deg_graph->find_id_node(DEG_get_original_id(id));
+ const DEG::IDNode *id_node = deg_graph->find_id_node(DEG_get_original_id(id));
if (id_node == NULL) {
/* TODO(sergey): Does it mean we need to check set scene? */
return 0;
@@ -129,13 +128,12 @@ uint64_t DEG_get_customdata_mask_for_object(const Depsgraph *graph, Object *ob)
* after modifying scene graph.
*
* Currently harmless because it's only called for temporary
- * objects which are out of the DAG anyway.
- */
+ * objects which are out of the DAG anyway. */
return 0;
}
const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(graph);
- const DEG::IDDepsNode *id_node = deg_graph->find_id_node(DEG_get_original_id(&ob->id));
+ const DEG::IDNode *id_node = deg_graph->find_id_node(DEG_get_original_id(&ob->id));
if (id_node == NULL) {
/* TODO(sergey): Does it mean we need to check set scene? */
return 0;
@@ -151,8 +149,7 @@ Scene *DEG_get_evaluated_scene(const Depsgraph *graph)
Scene *scene_cow = deg_graph->scene_cow;
/* TODO(sergey): Shall we expand datablock here? Or is it OK to assume
* that calleer is OK with just a pointer in case scene is not updated
- * yet?
- */
+ * yet? */
BLI_assert(scene_cow != NULL && DEG::deg_copy_on_write_is_expanded(&scene_cow->id));
return scene_cow;
}
@@ -188,10 +185,9 @@ ID *DEG_get_evaluated_id(const Depsgraph *depsgraph, ID *id)
}
/* TODO(sergey): This is a duplicate of Depsgraph::get_cow_id(),
* but here we never do assert, since we don't know nature of the
- * incoming ID datablock.
- */
+ * incoming ID datablock. */
const DEG::Depsgraph *deg_graph = (const DEG::Depsgraph *)depsgraph;
- const DEG::IDDepsNode *id_node = deg_graph->find_id_node(id);
+ const DEG::IDNode *id_node = deg_graph->find_id_node(id);
if (id_node == NULL) {
return id;
}
@@ -215,8 +211,7 @@ void DEG_get_evaluated_rna_pointer(const Depsgraph *depsgraph, PointerRNA *ptr,
else if (ptr->type == &RNA_PoseBone) {
/* HACK: Since bone keyframing is quite commonly used,
* speed things up for this case by doing a special lookup
- * for bones
- */
+ * for bones */
const Object *ob_eval = (Object *)cow_id;
bPoseChannel *pchan = (bPoseChannel *)ptr->data;
const bPoseChannel *pchan_eval = BKE_pose_channel_find_name(ob_eval->pose, pchan->name);
@@ -227,11 +222,9 @@ void DEG_get_evaluated_rna_pointer(const Depsgraph *depsgraph, PointerRNA *ptr,
else {
/* For everything else, try to get RNA Path of the BMain-pointer,
* then use that to look up what the COW-domain one should be
- * given the COW ID pointer as the new lookup point
- */
+ * given the COW ID pointer as the new lookup point */
/* TODO: Find a faster alternative, or implement support for other
- * common types too above (e.g. modifiers)
- */
+ * common types too above (e.g. modifiers) */
char *path = RNA_path_from_ID_to_struct(ptr);
if (path) {
PointerRNA cow_id_ptr;
diff --git a/source/blender/depsgraph/intern/depsgraph_query_filter.cc b/source/blender/depsgraph/intern/depsgraph_query_filter.cc
index 1b44d4229e6..4d99f56f444 100644
--- a/source/blender/depsgraph/intern/depsgraph_query_filter.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query_filter.cc
@@ -53,18 +53,15 @@ extern "C" {
#include "DEG_depsgraph_query.h"
#include "DEG_depsgraph_debug.h"
-#include "util/deg_util_foreach.h"
-
#include "intern/eval/deg_eval_copy_on_write.h"
#include "intern/depsgraph.h"
-#include "intern/depsgraph_types.h"
-#include "intern/depsgraph_intern.h"
+#include "intern/depsgraph_type.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"
/* *************************************************** */
@@ -89,25 +86,25 @@ static void deg_add_retained_id_cb(ID *id, void *user_data)
/* ------------------------------------------- */
-/* Remove relations pointing to the given OperationDepsNode */
-/* TODO: Make this part of OperationDepsNode? */
-static void deg_unlink_opnode(Depsgraph *graph, OperationDepsNode *op_node)
+/* Remove relations pointing to the given OperationNode */
+/* TODO: Make this part of OperationNode? */
+static void deg_unlink_opnode(Depsgraph *graph, OperationNode *op_node)
{
- std::vector<DepsRelation *> all_links;
+ vector<Relation *> all_links;
/* Collect all inlinks to this operation */
- foreach (DepsRelation *rel, op_node->inlinks) {
+ for (Relation *rel : op_node->inlinks) {
all_links.push_back(rel);
}
/* Collect all outlinks from this operation */
- foreach (DepsRelation *rel, op_node->outlinks) {
+ for (Relation *rel : op_node->outlinks) {
all_links.push_back(rel);
}
/* Delete all collected relations */
- foreach (DepsRelation *rel, all_links) {
+ for (Relation *rel : all_links) {
rel->unlink();
- OBJECT_GUARDED_DELETE(rel, DepsRelation);
+ OBJECT_GUARDED_DELETE(rel, Relation);
}
/* Remove from entry tags */
@@ -121,14 +118,13 @@ static void deg_filter_remove_unwanted_ids(Depsgraph *graph, GSet *retained_ids)
{
/* 1) First pass over ID nodes + their operations
* - Identify and tag ID's (via "custom_flags = 1") to be removed
- * - Remove all links to/from operations that will be removed
- */
- foreach (IDDepsNode *id_node, graph->id_nodes) {
+ * - Remove all links to/from operations that will be removed. */
+ for (IDNode *id_node : graph->id_nodes) {
id_node->custom_flags = !BLI_gset_haskey(retained_ids, (void *)id_node->id_orig);
if (id_node->custom_flags) {
- GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, id_node->components)
+ GHASH_FOREACH_BEGIN(ComponentNode *, comp_node, id_node->components)
{
- foreach (OperationDepsNode *op_node, comp_node->operations) {
+ for (OperationNode *op_node : comp_node->operations) {
deg_unlink_opnode(graph, op_node);
}
}
@@ -141,8 +137,8 @@ static void deg_filter_remove_unwanted_ids(Depsgraph *graph, GSet *retained_ids)
it_opnode != graph->operations.end();
)
{
- OperationDepsNode *op_node = *it_opnode;
- IDDepsNode *id_node = op_node->owner->owner;
+ OperationNode *op_node = *it_opnode;
+ IDNode *id_node = op_node->owner->owner;
if (id_node->custom_flags) {
it_opnode = graph->operations.erase(it_opnode);
}
@@ -155,13 +151,12 @@ static void deg_filter_remove_unwanted_ids(Depsgraph *graph, GSet *retained_ids)
*
* This is loosely based on Depsgraph::clear_id_nodes().
* However, we don't worry about the conditional freeing for physics
- * stuff, since it's rarely needed currently.
- */
+ * stuff, since it's rarely needed currently. */
for (Depsgraph::IDDepsNodes::iterator it_id = graph->id_nodes.begin();
it_id != graph->id_nodes.end();
)
{
- IDDepsNode *id_node = *it_id;
+ IDNode *id_node = *it_id;
ID *id = id_node->id_orig;
if (id_node->custom_flags) {
@@ -171,7 +166,7 @@ static void deg_filter_remove_unwanted_ids(Depsgraph *graph, GSet *retained_ids)
BLI_ghash_remove(graph->id_hash, id, NULL, NULL);
it_id = graph->id_nodes.erase(it_id);
- OBJECT_GUARDED_DELETE(id_node, IDDepsNode);
+ OBJECT_GUARDED_DELETE(id_node, IDNode);
}
else {
/* This node has not been marked for deletion. Increment iterator */
diff --git a/source/blender/depsgraph/intern/depsgraph_query_foreach.cc b/source/blender/depsgraph/intern/depsgraph_query_foreach.cc
index b6138e4e81c..0957016bc97 100644
--- a/source/blender/depsgraph/intern/depsgraph_query_foreach.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query_foreach.cc
@@ -46,30 +46,27 @@ extern "C" {
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
-#include "intern/depsgraph_intern.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 "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_id.h"
+#include "intern/node/deg_node_operation.h"
/* ************************ DEG TRAVERSAL ********************* */
namespace DEG {
-typedef std::deque<OperationDepsNode *> TraversalQueue;
+typedef std::deque<OperationNode *> TraversalQueue;
enum {
DEG_NODE_VISITED = (1 << 0),
};
static void deg_foreach_clear_flags(const Depsgraph *graph)
{
- foreach (OperationDepsNode *op_node, graph->operations) {
+ for (OperationNode *op_node : graph->operations) {
op_node->scheduled = false;
}
- foreach (IDDepsNode *id_node, graph->id_nodes) {
+ for (IDNode *id_node : graph->id_nodes) {
id_node->custom_flags = 0;
}
}
@@ -80,20 +77,19 @@ static void deg_foreach_dependent_ID(const Depsgraph *graph,
void *user_data)
{
/* Start with getting ID node from the graph. */
- IDDepsNode *target_id_node = graph->find_id_node(id);
+ IDNode *target_id_node = graph->find_id_node(id);
if (target_id_node == NULL) {
/* TODO(sergey): Shall we inform or assert here about attempt to start
- * iterating over non-existing ID?
- */
+ * iterating over non-existing ID? */
return;
}
/* Make sure all runtime flags are ready and clear. */
deg_foreach_clear_flags(graph);
/* Start with scheduling all operations from ID node. */
TraversalQueue queue;
- GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, target_id_node->components)
+ GHASH_FOREACH_BEGIN(ComponentNode *, comp_node, target_id_node->components)
{
- foreach (OperationDepsNode *op_node, comp_node->operations) {
+ for (OperationNode *op_node : comp_node->operations) {
queue.push_back(op_node);
op_node->scheduled = true;
}
@@ -103,12 +99,12 @@ static void deg_foreach_dependent_ID(const Depsgraph *graph,
/* Process the queue. */
while (!queue.empty()) {
/* get next operation node to process. */
- OperationDepsNode *op_node = queue.front();
+ OperationNode *op_node = queue.front();
queue.pop_front();
for (;;) {
/* Check whether we need to inform callee about corresponding ID node. */
- ComponentDepsNode *comp_node = op_node->owner;
- IDDepsNode *id_node = comp_node->owner;
+ ComponentNode *comp_node = op_node->owner;
+ IDNode *id_node = comp_node->owner;
if ((id_node->custom_flags & DEG_NODE_VISITED) == 0) {
/* TODO(sergey): Is it orig or CoW? */
callback(id_node->id_orig, user_data);
@@ -116,7 +112,7 @@ static void deg_foreach_dependent_ID(const Depsgraph *graph,
}
/* Schedule outgoing operation nodes. */
if (op_node->outlinks.size() == 1) {
- OperationDepsNode *to_node = (OperationDepsNode *)op_node->outlinks[0]->to;
+ OperationNode *to_node = (OperationNode *)op_node->outlinks[0]->to;
if (to_node->scheduled == false) {
to_node->scheduled = true;
op_node = to_node;
@@ -126,8 +122,8 @@ static void deg_foreach_dependent_ID(const Depsgraph *graph,
}
}
else {
- foreach (DepsRelation *rel, op_node->outlinks) {
- OperationDepsNode *to_node = (OperationDepsNode *)rel->to;
+ for (Relation *rel : op_node->outlinks) {
+ OperationNode *to_node = (OperationNode *)rel->to;
if (to_node->scheduled == false) {
queue.push_front(to_node);
to_node->scheduled = true;
@@ -145,20 +141,19 @@ static void deg_foreach_ancestor_ID(const Depsgraph *graph,
void *user_data)
{
/* Start with getting ID node from the graph. */
- IDDepsNode *target_id_node = graph->find_id_node(id);
+ IDNode *target_id_node = graph->find_id_node(id);
if (target_id_node == NULL) {
/* TODO(sergey): Shall we inform or assert here about attempt to start
- * iterating over non-existing ID?
- */
+ * iterating over non-existing ID? */
return;
}
/* Make sure all runtime flags are ready and clear. */
deg_foreach_clear_flags(graph);
/* Start with scheduling all operations from ID node. */
TraversalQueue queue;
- GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, target_id_node->components)
+ GHASH_FOREACH_BEGIN(ComponentNode *, comp_node, target_id_node->components)
{
- foreach (OperationDepsNode *op_node, comp_node->operations) {
+ for (OperationNode *op_node : comp_node->operations) {
queue.push_back(op_node);
op_node->scheduled = true;
}
@@ -168,12 +163,12 @@ static void deg_foreach_ancestor_ID(const Depsgraph *graph,
/* Process the queue. */
while (!queue.empty()) {
/* get next operation node to process. */
- OperationDepsNode *op_node = queue.front();
+ OperationNode *op_node = queue.front();
queue.pop_front();
for (;;) {
/* Check whether we need to inform callee about corresponding ID node. */
- ComponentDepsNode *comp_node = op_node->owner;
- IDDepsNode *id_node = comp_node->owner;
+ ComponentNode *comp_node = op_node->owner;
+ IDNode *id_node = comp_node->owner;
if ((id_node->custom_flags & DEG_NODE_VISITED) == 0) {
/* TODO(sergey): Is it orig or CoW? */
callback(id_node->id_orig, user_data);
@@ -181,9 +176,9 @@ static void deg_foreach_ancestor_ID(const Depsgraph *graph,
}
/* Schedule incoming operation nodes. */
if (op_node->inlinks.size() == 1) {
- DepsNode *from = op_node->inlinks[0]->from;
- if (from->get_class() == DEG_NODE_CLASS_OPERATION) {
- OperationDepsNode *from_node = (OperationDepsNode *)from;
+ Node *from = op_node->inlinks[0]->from;
+ if (from->get_class() == NodeClass::OPERATION) {
+ OperationNode *from_node = (OperationNode *)from;
if (from_node->scheduled == false) {
from_node->scheduled = true;
op_node = from_node;
@@ -194,10 +189,10 @@ static void deg_foreach_ancestor_ID(const Depsgraph *graph,
}
}
else {
- foreach (DepsRelation *rel, op_node->inlinks) {
- DepsNode *from = rel->from;
- if (from->get_class() == DEG_NODE_CLASS_OPERATION) {
- OperationDepsNode *from_node = (OperationDepsNode *)from;
+ for (Relation *rel : op_node->inlinks) {
+ Node *from = rel->from;
+ if (from->get_class() == NodeClass::OPERATION) {
+ OperationNode *from_node = (OperationNode *)from;
if (from_node->scheduled == false) {
queue.push_front(from_node);
from_node->scheduled = true;
@@ -213,7 +208,7 @@ static void deg_foreach_ancestor_ID(const Depsgraph *graph,
static void deg_foreach_id(const Depsgraph *depsgraph,
DEGForeachIDCallback callback, void *user_data)
{
- foreach (const IDDepsNode *id_node, depsgraph->id_nodes) {
+ for (const IDNode *id_node : depsgraph->id_nodes) {
callback(id_node->id_orig, user_data);
}
}
diff --git a/source/blender/depsgraph/intern/depsgraph_query_iter.cc b/source/blender/depsgraph/intern/depsgraph_query_iter.cc
index e938572b453..f3cbcae1046 100644
--- a/source/blender/depsgraph/intern/depsgraph_query_iter.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query_iter.cc
@@ -51,10 +51,8 @@ extern "C" {
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
-#include "intern/depsgraph_intern.h"
-#include "util/deg_util_foreach.h"
-
-#include "intern/nodes/deg_node_id.h"
+#include "intern/depsgraph.h"
+#include "intern/node/deg_node_id.h"
#ifndef NDEBUG
# include "intern/eval/deg_eval_copy_on_write.h"
@@ -177,7 +175,7 @@ bool deg_objects_dupli_iterator_next(BLI_Iterator *iter)
return false;
}
-void deg_iterator_objects_step(BLI_Iterator *iter, DEG::IDDepsNode *id_node)
+void deg_iterator_objects_step(BLI_Iterator *iter, DEG::IDNode *id_node)
{
/* Set it early in case we need to exit and we are running from within a loop. */
iter->skip = true;
@@ -264,7 +262,7 @@ void DEG_iterator_objects_begin(BLI_Iterator *iter, DEGObjectIterData *data)
data->eval_mode = DEG_get_mode(depsgraph);
deg_invalidate_iterator_work_data(data);
- DEG::IDDepsNode *id_node = deg_graph->id_nodes[data->id_node_index];
+ DEG::IDNode *id_node = deg_graph->id_nodes[data->id_node_index];
deg_iterator_objects_step(iter, id_node);
if (iter->skip) {
@@ -300,7 +298,7 @@ void DEG_iterator_objects_next(BLI_Iterator *iter)
return;
}
- DEG::IDDepsNode *id_node = deg_graph->id_nodes[data->id_node_index];
+ DEG::IDNode *id_node = deg_graph->id_nodes[data->id_node_index];
deg_iterator_objects_step(iter, id_node);
} while (iter->skip);
}
@@ -310,15 +308,14 @@ void DEG_iterator_objects_end(BLI_Iterator *iter)
DEGObjectIterData *data = (DEGObjectIterData *)iter->data;
if (data != NULL) {
/* Force crash in case the iterator data is referenced and accessed down
- * the line. (T51718)
- */
+ * the line. (T51718) */
deg_invalidate_iterator_work_data(data);
}
}
/* ************************ DEG ID ITERATOR ********************* */
-static void DEG_iterator_ids_step(BLI_Iterator *iter, DEG::IDDepsNode *id_node, bool only_updated)
+static void DEG_iterator_ids_step(BLI_Iterator *iter, DEG::IDNode *id_node, bool only_updated)
{
ID *id_cow = id_node->id_cow;
@@ -358,7 +355,7 @@ void DEG_iterator_ids_begin(BLI_Iterator *iter, DEGIDIterData *data)
data->id_node_index = 0;
data->num_id_nodes = num_id_nodes;
- DEG::IDDepsNode *id_node = deg_graph->id_nodes[data->id_node_index];
+ DEG::IDNode *id_node = deg_graph->id_nodes[data->id_node_index];
DEG_iterator_ids_step(iter, id_node, data->only_updated);
if (iter->skip) {
@@ -381,7 +378,7 @@ void DEG_iterator_ids_next(BLI_Iterator *iter)
return;
}
- DEG::IDDepsNode *id_node = deg_graph->id_nodes[data->id_node_index];
+ DEG::IDNode *id_node = deg_graph->id_nodes[data->id_node_index];
DEG_iterator_ids_step(iter, id_node, data->only_updated);
} while (iter->skip);
}
diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc
index 69f35323969..310cd8c6e4d 100644
--- a/source/blender/depsgraph/intern/depsgraph_tag.cc
+++ b/source/blender/depsgraph/intern/depsgraph_tag.cc
@@ -30,6 +30,8 @@
* Core routines for how the Depsgraph works.
*/
+#include "intern/depsgraph_tag.h"
+
#include <stdio.h>
#include <cstring> /* required for memset */
#include <queue>
@@ -51,6 +53,7 @@ extern "C" {
#include "DNA_windowmanager_types.h"
#include "BKE_animsys.h"
+#include "BKE_global.h"
#include "BKE_idcode.h"
#include "BKE_node.h"
#include "BKE_scene.h"
@@ -62,18 +65,19 @@ extern "C" {
} /* extern "C" */
#include "DEG_depsgraph.h"
+#include "DEG_depsgraph_debug.h"
#include "DEG_depsgraph_query.h"
#include "intern/builder/deg_builder.h"
+#include "intern/depsgraph.h"
+#include "intern/depsgraph_update.h"
#include "intern/eval/deg_eval_copy_on_write.h"
#include "intern/eval/deg_eval_flush.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_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_factory.h"
+#include "intern/node/deg_node_id.h"
+#include "intern/node/deg_node_operation.h"
/* *********************** */
/* Update Tagging/Flushing */
@@ -83,10 +87,10 @@ namespace DEG {
namespace {
void depsgraph_geometry_tag_to_component(const ID *id,
- eDepsNode_Type *component_type)
+ NodeType *component_type)
{
- const eDepsNode_Type result = deg_geometry_tag_to_component(id);
- if (result != DEG_NODE_TYPE_UNDEFINED) {
+ const NodeType result = geometry_tag_to_component(id);
+ if (result != NodeType::UNDEFINED) {
*component_type = result;
}
}
@@ -98,8 +102,8 @@ bool is_selectable_data_id_type(const ID_Type id_type)
void depsgraph_select_tag_to_component_opcode(
const ID *id,
- eDepsNode_Type *component_type,
- eDepsOperation_Code *operation_code)
+ NodeType *component_type,
+ OperationCode *operation_code)
{
const ID_Type id_type = GS(id->name);
if (id_type == ID_SCE) {
@@ -111,74 +115,74 @@ void depsgraph_select_tag_to_component_opcode(
* TODO(sergey): We can introduce explicit exit operation which
* does nothing and which is only used to cascade flush down the
* road. */
- *component_type = DEG_NODE_TYPE_LAYER_COLLECTIONS;
- *operation_code = DEG_OPCODE_VIEW_LAYER_EVAL;
+ *component_type = NodeType::LAYER_COLLECTIONS;
+ *operation_code = OperationCode::VIEW_LAYER_EVAL;
}
else if (id_type == ID_OB) {
- *component_type = DEG_NODE_TYPE_OBJECT_FROM_LAYER;
- *operation_code = DEG_OPCODE_OBJECT_BASE_FLAGS;
+ *component_type = NodeType::OBJECT_FROM_LAYER;
+ *operation_code = OperationCode::OBJECT_BASE_FLAGS;
}
else if (id_type == ID_MC) {
- *component_type = DEG_NODE_TYPE_BATCH_CACHE;
- *operation_code = DEG_OPCODE_MOVIECLIP_SELECT_UPDATE;
+ *component_type = NodeType::BATCH_CACHE;
+ *operation_code = OperationCode::MOVIECLIP_SELECT_UPDATE;
}
else if (is_selectable_data_id_type(id_type)) {
- *component_type = DEG_NODE_TYPE_BATCH_CACHE;
- *operation_code = DEG_OPCODE_GEOMETRY_SELECT_UPDATE;
+ *component_type = NodeType::BATCH_CACHE;
+ *operation_code = OperationCode::GEOMETRY_SELECT_UPDATE;
}
else {
- *component_type = DEG_NODE_TYPE_COPY_ON_WRITE;
- *operation_code = DEG_OPCODE_COPY_ON_WRITE;
+ *component_type = NodeType::COPY_ON_WRITE;
+ *operation_code = OperationCode::COPY_ON_WRITE;
}
}
void depsgraph_base_flags_tag_to_component_opcode(
const ID *id,
- eDepsNode_Type *component_type,
- eDepsOperation_Code *operation_code)
+ NodeType *component_type,
+ OperationCode *operation_code)
{
const ID_Type id_type = GS(id->name);
if (id_type == ID_SCE) {
- *component_type = DEG_NODE_TYPE_LAYER_COLLECTIONS;
- *operation_code = DEG_OPCODE_VIEW_LAYER_EVAL;
+ *component_type = NodeType::LAYER_COLLECTIONS;
+ *operation_code = OperationCode::VIEW_LAYER_EVAL;
}
else if (id_type == ID_OB) {
- *component_type = DEG_NODE_TYPE_OBJECT_FROM_LAYER;
- *operation_code = DEG_OPCODE_OBJECT_BASE_FLAGS;
+ *component_type = NodeType::OBJECT_FROM_LAYER;
+ *operation_code = OperationCode::OBJECT_BASE_FLAGS;
}
}
-eDepsOperation_Code psysTagToOperationCode(IDRecalcFlag tag)
+OperationCode psysTagToOperationCode(IDRecalcFlag tag)
{
if (tag == ID_RECALC_PSYS_RESET) {
- return DEG_OPCODE_PARTICLE_SETTINGS_RESET;
+ return OperationCode::PARTICLE_SETTINGS_RESET;
}
- return DEG_OPCODE_OPERATION;
+ return OperationCode::OPERATION;
}
void depsgraph_tag_to_component_opcode(const ID *id,
IDRecalcFlag tag,
- eDepsNode_Type *component_type,
- eDepsOperation_Code *operation_code)
+ NodeType *component_type,
+ OperationCode *operation_code)
{
const ID_Type id_type = GS(id->name);
- *component_type = DEG_NODE_TYPE_UNDEFINED;
- *operation_code = DEG_OPCODE_OPERATION;
+ *component_type = NodeType::UNDEFINED;
+ *operation_code = OperationCode::OPERATION;
/* Special case for now, in the future we should get rid of this. */
if (tag == 0) {
- *component_type = DEG_NODE_TYPE_ID_REF;
- *operation_code = DEG_OPCODE_OPERATION;
+ *component_type = NodeType::ID_REF;
+ *operation_code = OperationCode::OPERATION;
return;
}
switch (tag) {
case ID_RECALC_TRANSFORM:
- *component_type = DEG_NODE_TYPE_TRANSFORM;
+ *component_type = NodeType::TRANSFORM;
break;
case ID_RECALC_GEOMETRY:
depsgraph_geometry_tag_to_component(id, component_type);
break;
case ID_RECALC_ANIMATION:
- *component_type = DEG_NODE_TYPE_ANIMATION;
+ *component_type = NodeType::ANIMATION;
break;
case ID_RECALC_PSYS_REDO:
case ID_RECALC_PSYS_RESET:
@@ -190,22 +194,22 @@ void depsgraph_tag_to_component_opcode(const ID *id,
* component. Will be nice to get this unified with object,
* but we can survive for now with single exception here.
* Particles needs reconsideration anyway, */
- *component_type = DEG_NODE_TYPE_PARTICLE_SETTINGS;
+ *component_type = NodeType::PARTICLE_SETTINGS;
*operation_code = psysTagToOperationCode(tag);
}
else {
- *component_type = DEG_NODE_TYPE_PARTICLE_SYSTEM;
+ *component_type = NodeType::PARTICLE_SYSTEM;
}
break;
case ID_RECALC_COPY_ON_WRITE:
- *component_type = DEG_NODE_TYPE_COPY_ON_WRITE;
+ *component_type = NodeType::COPY_ON_WRITE;
break;
case ID_RECALC_SHADING:
if (id_type == ID_NT) {
- *component_type = DEG_NODE_TYPE_SHADING_PARAMETERS;
+ *component_type = NodeType::SHADING_PARAMETERS;
}
else {
- *component_type = DEG_NODE_TYPE_SHADING;
+ *component_type = NodeType::SHADING;
}
break;
case ID_RECALC_SELECT:
@@ -219,7 +223,7 @@ void depsgraph_tag_to_component_opcode(const ID *id,
operation_code);
break;
case ID_RECALC_POINT_CACHE:
- *component_type = DEG_NODE_TYPE_POINT_CACHE;
+ *component_type = NodeType::POINT_CACHE;
break;
case ID_RECALC_EDITORS:
/* There is no such node in depsgraph, this tag is to be handled
@@ -242,7 +246,7 @@ void id_tag_update_ntree_special(Main *bmain,
if (ntree == NULL) {
return;
}
- deg_graph_id_tag_update(bmain, graph, &ntree->id, flag, update_source);
+ graph_id_tag_update(bmain, graph, &ntree->id, flag, update_source);
}
void depsgraph_update_editors_tag(Main *bmain, Depsgraph *graph, ID *id)
@@ -259,21 +263,21 @@ void depsgraph_update_editors_tag(Main *bmain, Depsgraph *graph, ID *id)
}
void depsgraph_tag_component(Depsgraph *graph,
- IDDepsNode *id_node,
- eDepsNode_Type component_type,
- eDepsOperation_Code operation_code,
+ IDNode *id_node,
+ NodeType component_type,
+ OperationCode operation_code,
eUpdateSource update_source)
{
- ComponentDepsNode *component_node =
+ ComponentNode *component_node =
id_node->find_component(component_type);
if (component_node == NULL) {
return;
}
- if (operation_code == DEG_OPCODE_OPERATION) {
+ if (operation_code == OperationCode::OPERATION) {
component_node->tag_update(graph, update_source);
}
else {
- OperationDepsNode *operation_node =
+ OperationNode *operation_node =
component_node->find_operation(operation_code);
if (operation_node != NULL) {
operation_node->tag_update(graph, update_source);
@@ -281,8 +285,8 @@ void depsgraph_tag_component(Depsgraph *graph,
}
/* If component depends on copy-on-write, tag it as well. */
if (component_node->need_tag_cow_before_update()) {
- ComponentDepsNode *cow_comp =
- id_node->find_component(DEG_NODE_TYPE_COPY_ON_WRITE);
+ ComponentNode *cow_comp =
+ id_node->find_component(NodeType::COPY_ON_WRITE);
cow_comp->tag_update(graph, update_source);
id_node->id_orig->recalc |= ID_RECALC_COPY_ON_WRITE;
}
@@ -306,7 +310,7 @@ void deg_graph_id_tag_legacy_compat(Main *bmain,
Object *object = (Object *)id;
ID *data_id = (ID *)object->data;
if (data_id != NULL) {
- deg_graph_id_tag_update(
+ graph_id_tag_update(
bmain, depsgraph, data_id, 0, update_source);
}
break;
@@ -319,7 +323,7 @@ void deg_graph_id_tag_legacy_compat(Main *bmain,
Mesh *mesh = (Mesh *)id;
ID *key_id = &mesh->key->id;
if (key_id != NULL) {
- deg_graph_id_tag_update(
+ graph_id_tag_update(
bmain, depsgraph, key_id, 0, update_source);
}
break;
@@ -329,7 +333,7 @@ void deg_graph_id_tag_legacy_compat(Main *bmain,
Lattice *lattice = (Lattice *)id;
ID *key_id = &lattice->key->id;
if (key_id != NULL) {
- deg_graph_id_tag_update(
+ graph_id_tag_update(
bmain, depsgraph, key_id, 0, update_source);
}
break;
@@ -339,7 +343,7 @@ void deg_graph_id_tag_legacy_compat(Main *bmain,
Curve *curve = (Curve *)id;
ID *key_id = &curve->key->id;
if (key_id != NULL) {
- deg_graph_id_tag_update(
+ graph_id_tag_update(
bmain, depsgraph, key_id, 0, update_source);
}
break;
@@ -350,12 +354,12 @@ void deg_graph_id_tag_legacy_compat(Main *bmain,
}
}
-static void deg_graph_id_tag_update_single_flag(Main *bmain,
- Depsgraph *graph,
- ID *id,
- IDDepsNode *id_node,
- IDRecalcFlag tag,
- eUpdateSource update_source)
+static void graph_id_tag_update_single_flag(Main *bmain,
+ Depsgraph *graph,
+ ID *id,
+ IDNode *id_node,
+ IDRecalcFlag tag,
+ eUpdateSource update_source)
{
if (tag == ID_RECALC_EDITORS) {
if (graph != NULL) {
@@ -364,20 +368,20 @@ static void deg_graph_id_tag_update_single_flag(Main *bmain,
return;
}
/* Get description of what is to be tagged. */
- eDepsNode_Type component_type;
- eDepsOperation_Code operation_code;
+ NodeType component_type;
+ OperationCode operation_code;
depsgraph_tag_to_component_opcode(id,
tag,
&component_type,
&operation_code);
/* Check whether we've got something to tag. */
- if (component_type == DEG_NODE_TYPE_UNDEFINED) {
+ if (component_type == NodeType::UNDEFINED) {
/* Given ID does not support tag. */
/* TODO(sergey): Shall we raise some panic here? */
return;
}
/* Tag ID recalc flag. */
- DepsNodeFactory *factory = deg_type_get_factory(component_type);
+ DepsNodeFactory *factory = type_get_factory(component_type);
BLI_assert(factory != NULL);
id->recalc |= factory->id_recalc_tag();
/* Some sanity checks before moving forward. */
@@ -387,7 +391,7 @@ static void deg_graph_id_tag_update_single_flag(Main *bmain,
return;
}
/* Tag corresponding dependency graph operation for update. */
- if (component_type == DEG_NODE_TYPE_ID_REF) {
+ if (component_type == NodeType::ID_REF) {
id_node->tag_update(graph, update_source);
}
else {
@@ -450,7 +454,7 @@ const char *update_source_as_string(eUpdateSource source)
* explicit and granular for users to tag what they really need. */
void deg_graph_node_tag_zero(Main *bmain,
Depsgraph *graph,
- IDDepsNode *id_node,
+ IDNode *id_node,
eUpdateSource update_source)
{
if (id_node == NULL) {
@@ -459,9 +463,9 @@ void deg_graph_node_tag_zero(Main *bmain,
ID *id = id_node->id_orig;
/* TODO(sergey): Which recalc flags to set here? */
id->recalc |= ID_RECALC_ALL & ~(ID_RECALC_PSYS_ALL | ID_RECALC_ANIMATION);
- 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_ANIMATION) {
+ if (comp_node->type == NodeType::ANIMATION) {
continue;
}
comp_node->tag_update(graph, DEG_UPDATE_SOURCE_USER_EDIT);
@@ -473,7 +477,7 @@ void deg_graph_node_tag_zero(Main *bmain,
void deg_graph_on_visible_update(Main *bmain, Depsgraph *graph)
{
- foreach (DEG::IDDepsNode *id_node, graph->id_nodes) {
+ for (DEG::IDNode *id_node : graph->id_nodes) {
if (!id_node->visible_components_mask) {
/* ID has no components which affects anything visible. no meed
* bother with it to tag or anything. */
@@ -499,10 +503,10 @@ void deg_graph_on_visible_update(Main *bmain, Depsgraph *graph)
if (id_type == ID_OB) {
flag |= ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY;
}
- deg_graph_id_tag_update(bmain,
- graph,
- id_node->id_orig,
- flag, DEG_UPDATE_SOURCE_VISIBILITY);
+ graph_id_tag_update(bmain,
+ graph,
+ id_node->id_orig,
+ flag, DEG_UPDATE_SOURCE_VISIBILITY);
if (id_type == ID_SCE) {
/* Make sure collection properties are up to date. */
id_node->tag_update(graph, DEG_UPDATE_SOURCE_VISIBILITY);
@@ -523,7 +527,7 @@ void deg_graph_on_visible_update(Main *bmain, Depsgraph *graph)
} /* namespace */
-eDepsNode_Type deg_geometry_tag_to_component(const ID *id)
+NodeType geometry_tag_to_component(const ID *id)
{
const ID_Type id_type = GS(id->name);
switch (id_type) {
@@ -538,9 +542,9 @@ eDepsNode_Type deg_geometry_tag_to_component(const ID *id)
case OB_LATTICE:
case OB_MBALL:
case OB_GPENCIL:
- return DEG_NODE_TYPE_GEOMETRY;
+ return NodeType::GEOMETRY;
case OB_ARMATURE:
- return DEG_NODE_TYPE_EVAL_POSE;
+ return NodeType::EVAL_POSE;
/* TODO(sergey): More cases here? */
}
break;
@@ -549,27 +553,24 @@ eDepsNode_Type deg_geometry_tag_to_component(const ID *id)
case ID_CU:
case ID_LT:
case ID_MB:
- return DEG_NODE_TYPE_GEOMETRY;
+ return NodeType::GEOMETRY;
case ID_PA: /* Particles */
- return DEG_NODE_TYPE_UNDEFINED;
+ return NodeType::UNDEFINED;
case ID_LP:
- return DEG_NODE_TYPE_PARAMETERS;
+ return NodeType::PARAMETERS;
case ID_GD:
- return DEG_NODE_TYPE_GEOMETRY;
+ return NodeType::GEOMETRY;
case ID_PAL: /* Palettes */
- return DEG_NODE_TYPE_PARAMETERS;
+ return NodeType::PARAMETERS;
default:
break;
}
- return DEG_NODE_TYPE_UNDEFINED;
+ return NodeType::UNDEFINED;
}
-void deg_id_tag_update(Main *bmain,
- ID *id,
- int flag,
- eUpdateSource update_source)
+void id_tag_update(Main *bmain, ID *id, int flag, eUpdateSource update_source)
{
- deg_graph_id_tag_update(bmain, NULL, id, flag, update_source);
+ graph_id_tag_update(bmain, NULL, id, flag, update_source);
LISTBASE_FOREACH (Scene *, scene, &bmain->scene) {
LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
Depsgraph *depsgraph =
@@ -577,18 +578,18 @@ void deg_id_tag_update(Main *bmain,
view_layer,
false);
if (depsgraph != NULL) {
- deg_graph_id_tag_update(
+ graph_id_tag_update(
bmain, depsgraph, id, flag, update_source);
}
}
}
}
-void deg_graph_id_tag_update(Main *bmain,
- Depsgraph *graph,
- ID *id,
- int flag,
- eUpdateSource update_source)
+void graph_id_tag_update(Main *bmain,
+ Depsgraph *graph,
+ ID *id,
+ int flag,
+ eUpdateSource update_source)
{
const int debug_flags = (graph != NULL)
? DEG_debug_flags_get((::Depsgraph *)graph)
@@ -600,7 +601,7 @@ void deg_graph_id_tag_update(Main *bmain,
stringify_update_bitfield(flag).c_str(),
update_source_as_string(update_source));
}
- IDDepsNode *id_node = (graph != NULL) ? graph->find_id_node(id)
+ IDNode *id_node = (graph != NULL) ? graph->find_id_node(id)
: NULL;
DEG_id_type_tag(bmain, GS(id->name));
if (flag == 0) {
@@ -611,7 +612,7 @@ void deg_graph_id_tag_update(Main *bmain,
while (current_flag != 0) {
IDRecalcFlag tag =
(IDRecalcFlag)(1 << bitscan_forward_clear_i(&current_flag));
- deg_graph_id_tag_update_single_flag(
+ graph_id_tag_update_single_flag(
bmain, graph, id, id_node, tag, update_source);
}
/* Special case for nested node tree datablocks. */
@@ -619,7 +620,7 @@ void deg_graph_id_tag_update(Main *bmain,
/* Direct update tags means that something outside of simulated/cached
* physics did change and that cache is to be invalidated. */
if (update_source == DEG_UPDATE_SOURCE_USER_EDIT) {
- deg_graph_id_tag_update_single_flag(
+ graph_id_tag_update_single_flag(
bmain, graph, id, id_node, ID_RECALC_POINT_CACHE, update_source);
}
}
@@ -663,7 +664,7 @@ void DEG_id_tag_update_ex(Main *bmain, ID *id, int flag)
/* Ideally should not happen, but old depsgraph allowed this. */
return;
}
- DEG::deg_id_tag_update(
+ DEG::id_tag_update(
bmain, id, flag, DEG::DEG_UPDATE_SOURCE_USER_EDIT);
}
@@ -673,7 +674,7 @@ void DEG_graph_id_tag_update(struct Main *bmain,
int flag)
{
DEG::Depsgraph *graph = (DEG::Depsgraph *)depsgraph;
- DEG::deg_graph_id_tag_update(
+ DEG::graph_id_tag_update(
bmain, graph, id, flag, DEG::DEG_UPDATE_SOURCE_USER_EDIT);
}
@@ -763,7 +764,7 @@ static void deg_graph_clear_id_node_func(
* correctly when there are multiple depsgraph with others still using
* the recalc flag. */
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(data_v);
- DEG::IDDepsNode *id_node = deg_graph->id_nodes[i];
+ DEG::IDNode *id_node = deg_graph->id_nodes[i];
id_node->id_cow->recalc &= ~ID_RECALC_ALL;
id_node->id_orig->recalc &= ~ID_RECALC_ALL;
diff --git a/source/blender/depsgraph/intern/depsgraph_tag.h b/source/blender/depsgraph/intern/depsgraph_tag.h
new file mode 100644
index 00000000000..2d427e0b8a9
--- /dev/null
+++ b/source/blender/depsgraph/intern/depsgraph_tag.h
@@ -0,0 +1,53 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2019 Blender Foundation.
+ * All rights reserved.
+ *
+ * Original Author: Sergey Sharybin
+ * Contributor(s): None Yet
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/depsgraph/intern/depsgraph_tag.h
+ * \ingroup depsgraph
+ */
+
+#include "intern/node/deg_node.h"
+
+struct ID;
+struct Main;
+
+namespace DEG {
+
+struct Depsgraph;
+
+/* Get type of a node which corresponds to a ID_RECALC_GEOMETRY tag. */
+NodeType geometry_tag_to_component(const ID *id);
+
+/* Tag given ID for an update in all registered dependency graphs. */
+void id_tag_update(Main *bmain, ID *id, int flag, eUpdateSource update_source);
+
+/* Tag given ID for an update with in a given dependency graph. */
+void graph_id_tag_update(Main *bmain,
+ Depsgraph *graph,
+ ID *id,
+ int flag,
+ eUpdateSource update_source);
+
+} // namespace DEG
diff --git a/source/blender/depsgraph/intern/depsgraph_type.cc b/source/blender/depsgraph/intern/depsgraph_type.cc
new file mode 100644
index 00000000000..e28e4e250f7
--- /dev/null
+++ b/source/blender/depsgraph/intern/depsgraph_type.cc
@@ -0,0 +1,58 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2013 Blender Foundation.
+ * All rights reserved.
+ *
+ * Original Author: Joshua Leung
+ * Contributor(s): None Yet
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/depsgraph/intern/depsgraph_type_defines.cc
+ * \ingroup depsgraph
+ *
+ * Defines and code for core node types.
+ */
+
+#include <cstdlib> // for BLI_assert()
+
+
+#include "BLI_utildefines.h"
+#include "BLI_ghash.h"
+
+#include "DEG_depsgraph.h"
+
+#include "intern/node/deg_node.h"
+#include "intern/node/deg_node_component.h"
+#include "intern/node/deg_node_factory.h"
+#include "intern/node/deg_node_operation.h"
+
+/* Register all node types */
+void DEG_register_node_types(void)
+{
+ /* register node types */
+ DEG::deg_register_base_depsnodes();
+ DEG::deg_register_component_depsnodes();
+ DEG::deg_register_operation_depsnodes();
+}
+
+/* Free registry on exit */
+void DEG_free_node_types(void)
+{
+}
diff --git a/source/blender/depsgraph/intern/depsgraph_type.h b/source/blender/depsgraph/intern/depsgraph_type.h
new file mode 100644
index 00000000000..ed7689fb046
--- /dev/null
+++ b/source/blender/depsgraph/intern/depsgraph_type.h
@@ -0,0 +1,80 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2013 Blender Foundation.
+ * All rights reserved.
+ *
+ * Original Author: Joshua Leung
+ * Contributor(s): None Yet
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/depsgraph/intern/depsgraph_type.h
+ * \ingroup depsgraph
+ *
+ * Datatypes for internal use in the Depsgraph
+ *
+ * All of these datatypes are only really used within the "core" depsgraph.
+ * In particular, node types declared here form the structure of operations
+ * in the graph.
+ */
+
+#pragma once
+
+#include <functional>
+
+/* TODO(sergey): Ideally we'll just use char* and statically allocated strings
+ * to avoid any possible overhead caused by string (re)allocation/formatting. */
+#include <string>
+#include <vector>
+#include <algorithm>
+
+struct Depsgraph;
+
+namespace DEG {
+
+/* Commonly used types. */
+using std::string;
+using std::vector;
+
+/* Commonly used functions. */
+using std::max;
+using std::to_string;
+
+/* Function bindings. */
+using std::function;
+using namespace std::placeholders;
+#define function_bind std::bind
+
+/* Source of the dependency graph node update tag.
+ *
+ * NOTE: This is a bit mask, so accumulation of sources is possible.
+ *
+ * TODO(sergey): Find a better place for this. */
+enum eUpdateSource {
+ /* Update is caused by a time change. */
+ DEG_UPDATE_SOURCE_TIME = (1 << 0),
+ /* Update caused by user directly or indirectly influencing the node. */
+ DEG_UPDATE_SOURCE_USER_EDIT = (1 << 1),
+ /* Update is happening as a special response for the relations update. */
+ DEG_UPDATE_SOURCE_RELATIONS = (1 << 2),
+ /* Update is happening due to visibility change. */
+ DEG_UPDATE_SOURCE_VISIBILITY = (1 << 3),
+};
+
+} // namespace DEG
diff --git a/source/blender/depsgraph/intern/depsgraph_type_defines.cc b/source/blender/depsgraph/intern/depsgraph_type_defines.cc
deleted file mode 100644
index a89446ea28f..00000000000
--- a/source/blender/depsgraph/intern/depsgraph_type_defines.cc
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2013 Blender Foundation.
- * All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/depsgraph/intern/depsgraph_type_defines.cc
- * \ingroup depsgraph
- *
- * Defines and code for core node types.
- */
-
-#include <cstdlib> // for BLI_assert()
-
-
-#include "BLI_utildefines.h"
-#include "BLI_ghash.h"
-
-#include "DEG_depsgraph.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"
-
-namespace DEG {
-
-/* ************ */
-/* External API */
-
-/* Global type registry */
-
-static DepsNodeFactory *depsnode_typeinfo_registry[NUM_DEG_NODE_TYPES] = {NULL};
-
-/* Registration ------------------------------------------- */
-
-/* Register node type */
-void deg_register_node_typeinfo(DepsNodeFactory *factory)
-{
- BLI_assert(factory != NULL);
- depsnode_typeinfo_registry[factory->type()] = factory;
-}
-
-/* Getters ------------------------------------------------- */
-
-/* Get typeinfo for specified type */
-DepsNodeFactory *deg_type_get_factory(const eDepsNode_Type type)
-{
- /* look up type - at worst, it doesn't exist in table yet, and we fail */
- return depsnode_typeinfo_registry[type];
-}
-
-/* Stringified node types ---------------------------------- */
-
-const char *nodeTypeAsString(eDepsNode_Type type)
-{
- switch (type) {
-#define STRINGIFY_TYPE(name) case DEG_NODE_TYPE_##name: return #name
-
- STRINGIFY_TYPE(UNDEFINED);
- STRINGIFY_TYPE(OPERATION);
- /* **** Generic Types **** */
- STRINGIFY_TYPE(TIMESOURCE);
- STRINGIFY_TYPE(ID_REF);
- /* **** Outer Types **** */
- STRINGIFY_TYPE(PARAMETERS);
- STRINGIFY_TYPE(PROXY);
- STRINGIFY_TYPE(ANIMATION);
- STRINGIFY_TYPE(TRANSFORM);
- STRINGIFY_TYPE(GEOMETRY);
- STRINGIFY_TYPE(SEQUENCER);
- STRINGIFY_TYPE(LAYER_COLLECTIONS);
- STRINGIFY_TYPE(COPY_ON_WRITE);
- STRINGIFY_TYPE(OBJECT_FROM_LAYER);
- /* **** Evaluation-Related Outer Types (with Subdata) **** */
- STRINGIFY_TYPE(EVAL_POSE);
- STRINGIFY_TYPE(BONE);
- STRINGIFY_TYPE(PARTICLE_SYSTEM);
- STRINGIFY_TYPE(PARTICLE_SETTINGS);
- STRINGIFY_TYPE(SHADING);
- STRINGIFY_TYPE(SHADING_PARAMETERS);
- STRINGIFY_TYPE(CACHE);
- STRINGIFY_TYPE(POINT_CACHE);
- STRINGIFY_TYPE(BATCH_CACHE);
- /* Duplication. */
- STRINGIFY_TYPE(DUPLI);
- /* Synchronization. */
- STRINGIFY_TYPE(SYNCHRONIZE);
- /* Generic datablock. */
- STRINGIFY_TYPE(GENERIC_DATABLOCK);
-
- /* Total number of meaningful node types. */
- case NUM_DEG_NODE_TYPES: return "SpecialCase";
-#undef STRINGIFY_TYPE
- }
- return "UNKNOWN";
-}
-
-/* Stringified opcodes ------------------------------------- */
-
-const char *operationCodeAsString(eDepsOperation_Code opcode)
-{
- switch (opcode) {
-#define STRINGIFY_OPCODE(name) case DEG_OPCODE_##name: return #name
- /* Generic Operations. */
- STRINGIFY_OPCODE(OPERATION);
- STRINGIFY_OPCODE(ID_PROPERTY);
- STRINGIFY_OPCODE(PARAMETERS_EVAL);
- STRINGIFY_OPCODE(PLACEHOLDER);
- /* Animation, Drivers, etc. */
- STRINGIFY_OPCODE(ANIMATION);
- STRINGIFY_OPCODE(DRIVER);
- /* Object related. */
- STRINGIFY_OPCODE(OBJECT_BASE_FLAGS);
- /* Transform. */
- STRINGIFY_OPCODE(TRANSFORM_LOCAL);
- STRINGIFY_OPCODE(TRANSFORM_PARENT);
- STRINGIFY_OPCODE(TRANSFORM_CONSTRAINTS);
- STRINGIFY_OPCODE(TRANSFORM_FINAL);
- STRINGIFY_OPCODE(TRANSFORM_OBJECT_UBEREVAL);
- /* Rigid body. */
- STRINGIFY_OPCODE(RIGIDBODY_REBUILD);
- STRINGIFY_OPCODE(RIGIDBODY_SIM);
- STRINGIFY_OPCODE(RIGIDBODY_TRANSFORM_COPY);
- /* Geometry. */
- STRINGIFY_OPCODE(GEOMETRY_UBEREVAL);
- STRINGIFY_OPCODE(GEOMETRY_SHAPEKEY);
- /* Object data. */
- STRINGIFY_OPCODE(LIGHT_PROBE_EVAL);
- STRINGIFY_OPCODE(SPEAKER_EVAL);
- /* Pose. */
- STRINGIFY_OPCODE(POSE_INIT);
- STRINGIFY_OPCODE(POSE_INIT_IK);
- STRINGIFY_OPCODE(POSE_CLEANUP);
- STRINGIFY_OPCODE(POSE_DONE);
- STRINGIFY_OPCODE(POSE_IK_SOLVER);
- STRINGIFY_OPCODE(POSE_SPLINE_IK_SOLVER);
- /* Bone. */
- STRINGIFY_OPCODE(BONE_LOCAL);
- STRINGIFY_OPCODE(BONE_POSE_PARENT);
- STRINGIFY_OPCODE(BONE_CONSTRAINTS);
- STRINGIFY_OPCODE(BONE_READY);
- STRINGIFY_OPCODE(BONE_DONE);
- STRINGIFY_OPCODE(BONE_SEGMENTS);
- /* Particle System. */
- STRINGIFY_OPCODE(PARTICLE_SYSTEM_INIT);
- STRINGIFY_OPCODE(PARTICLE_SYSTEM_EVAL);
- STRINGIFY_OPCODE(PARTICLE_SYSTEM_DONE);
- /* Particles Settings. */
- STRINGIFY_OPCODE(PARTICLE_SETTINGS_INIT);
- STRINGIFY_OPCODE(PARTICLE_SETTINGS_EVAL);
- STRINGIFY_OPCODE(PARTICLE_SETTINGS_RESET);
- /* Point Cache. */
- STRINGIFY_OPCODE(POINT_CACHE_RESET);
- /* Batch cache. */
- STRINGIFY_OPCODE(GEOMETRY_SELECT_UPDATE);
- /* Masks. */
- STRINGIFY_OPCODE(MASK_ANIMATION);
- STRINGIFY_OPCODE(MASK_EVAL);
- /* Collections. */
- STRINGIFY_OPCODE(VIEW_LAYER_EVAL);
- /* Copy on write. */
- STRINGIFY_OPCODE(COPY_ON_WRITE);
- /* Shading. */
- STRINGIFY_OPCODE(SHADING);
- STRINGIFY_OPCODE(MATERIAL_UPDATE);
- STRINGIFY_OPCODE(WORLD_UPDATE);
- /* Movie clip. */
- STRINGIFY_OPCODE(MOVIECLIP_EVAL);
- STRINGIFY_OPCODE(MOVIECLIP_SELECT_UPDATE);
- /* Synchronization. */
- STRINGIFY_OPCODE(SYNCHRONIZE_TO_ORIGINAL);
- /* Generic datablock. */
- STRINGIFY_OPCODE(GENERIC_DATABLOCK_UPDATE);
-
- case DEG_NUM_OPCODES: return "SpecialCase";
-#undef STRINGIFY_OPCODE
- }
- return "UNKNOWN";
-}
-
-} // namespace DEG
-
-/* Register all node types */
-void DEG_register_node_types(void)
-{
- /* register node types */
- DEG::deg_register_base_depsnodes();
- DEG::deg_register_component_depsnodes();
- DEG::deg_register_operation_depsnodes();
-}
-
-/* Free registry on exit */
-void DEG_free_node_types(void)
-{
-}
diff --git a/source/blender/depsgraph/intern/depsgraph_types.h b/source/blender/depsgraph/intern/depsgraph_types.h
deleted file mode 100644
index 9e6b1260a4b..00000000000
--- a/source/blender/depsgraph/intern/depsgraph_types.h
+++ /dev/null
@@ -1,325 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2013 Blender Foundation.
- * All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/depsgraph/intern/depsgraph_types.h
- * \ingroup depsgraph
- *
- * Datatypes for internal use in the Depsgraph
- *
- * All of these datatypes are only really used within the "core" depsgraph.
- * In particular, node types declared here form the structure of operations
- * in the graph.
- */
-
-#pragma once
-
-#include "util/deg_util_function.h"
-
-/* TODO(sergey): Ideally we'll just use char* and statically allocated strings
- * to avoid any possible overhead caused by string (re)allocation/formatting.
- */
-#include <string>
-#include <vector>
-#include <algorithm>
-
-struct ChannelDriver;
-struct Depsgraph;
-struct FCurve;
-struct ModifierData;
-struct PointerRNA;
-struct bAction;
-
-namespace DEG {
-
-/* TODO(sergey): Find a better place for this. */
-using std::string;
-using std::vector;
-using std::max;
-
-/* Evaluation Operation for atomic operation */
-// XXX: move this to another header that can be exposed?
-typedef function<void(struct ::Depsgraph *)> DepsEvalOperationCb;
-
-/* Metatype of Nodes - The general "level" in the graph structure
- * the node serves.
- */
-typedef enum eDepsNode_Class {
- /* Types generally unassociated with user-visible entities,
- * but needed for graph functioning.
- */
- DEG_NODE_CLASS_GENERIC = 0,
- /* [Outer Node] An "aspect" of evaluating/updating an ID-Block, requiring
- * certain types of evaluation behavior.
- */
- DEG_NODE_CLASS_COMPONENT = 1,
- /* [Inner Node] A glorified function-pointer/callback for scheduling up
- * evaluation operations for components, subject to relationship
- * requirements.
- */
- DEG_NODE_CLASS_OPERATION = 2,
-} eDepsNode_Class;
-
-/* Note: We use max comparison to mark an id node that is linked more than once
- * So keep this enum ordered accordingly.
- */
-typedef enum eDepsNode_LinkedState_Type {
- /* Generic indirectly linked id node. */
- DEG_ID_LINKED_INDIRECTLY = 0,
- /* Id node present in the set (background) only. */
- DEG_ID_LINKED_VIA_SET = 1,
- /* Id node directly linked via the ScenLayer. */
- DEG_ID_LINKED_DIRECTLY = 2,
-} eDepsNode_LinkedState_Type;
-
-/* Types of Nodes */
-typedef enum eDepsNode_Type {
- /* Fallback type for invalid return value */
- DEG_NODE_TYPE_UNDEFINED = 0,
- /* Inner Node (Operation) */
- DEG_NODE_TYPE_OPERATION,
-
- /* **** Generic Types **** */
-
- /* Time-Source */
- DEG_NODE_TYPE_TIMESOURCE,
- /* ID-Block reference - used as landmarks/collection point for components,
- * but not usually part of main graph.
- */
- DEG_NODE_TYPE_ID_REF,
-
- /* **** Outer Types **** */
-
- /* Parameters Component - Default when nothing else fits
- * (i.e. just SDNA property setting).
- */
- DEG_NODE_TYPE_PARAMETERS,
- /* Generic "Proxy-Inherit" Component. */
- DEG_NODE_TYPE_PROXY,
- /* Animation Component */
- DEG_NODE_TYPE_ANIMATION,
- /* Transform Component (Parenting/Constraints) */
- DEG_NODE_TYPE_TRANSFORM,
- /* Geometry Component (Mesh/Displist) */
- DEG_NODE_TYPE_GEOMETRY,
- /* Sequencer Component (Scene Only) */
- DEG_NODE_TYPE_SEQUENCER,
- /* Component which contains all operations needed for layer collections
- * evaluation.
- */
- DEG_NODE_TYPE_LAYER_COLLECTIONS,
- /* Entry component of majority of ID nodes: prepares CoW pointers for
- * execution.
- */
- DEG_NODE_TYPE_COPY_ON_WRITE,
- /* Used by all operations which are updating object when something is
- * changed in view layer.
- */
- DEG_NODE_TYPE_OBJECT_FROM_LAYER,
- /* Un-interestying datablock, which is a part of dependency graph, but does
- * not have very distinctive update procedure. */
- DEG_NODE_TYPE_GENERIC_DATABLOCK,
-
- /* **** Evaluation-Related Outer Types (with Subdata) **** */
-
- /* Pose Component - Owner/Container of Bones Eval */
- DEG_NODE_TYPE_EVAL_POSE,
- /* Bone Component - Child/Subcomponent of Pose */
- DEG_NODE_TYPE_BONE,
- /* Particle Systems Component */
- DEG_NODE_TYPE_PARTICLE_SYSTEM,
- DEG_NODE_TYPE_PARTICLE_SETTINGS,
- /* Material Shading Component */
- DEG_NODE_TYPE_SHADING,
- DEG_NODE_TYPE_SHADING_PARAMETERS,
- /* Point cache Component */
- DEG_NODE_TYPE_POINT_CACHE,
- /* Cache Component */
- /* TODO(sergey); Verify that we really need this. */
- DEG_NODE_TYPE_CACHE,
- /* Batch Cache Component - TODO (dfelinto/sergey) rename to make it more generic. */
- DEG_NODE_TYPE_BATCH_CACHE,
- /* Duplication system. Used to force duplicated objects visible when
- * when duplicator is visible.
- */
- DEG_NODE_TYPE_DUPLI,
- /* Synchronization back to original datablock. */
- DEG_NODE_TYPE_SYNCHRONIZE,
-
- /* Total number of meaningful node types. */
- NUM_DEG_NODE_TYPES,
-} eDepsNode_Type;
-const char *nodeTypeAsString(eDepsNode_Type type);
-
-/* Identifiers for common operations (as an enum). */
-typedef enum eDepsOperation_Code {
- /* Generic Operations. -------------------------------------------------- */
-
- /* Placeholder for operations which don't need special mention */
- DEG_OPCODE_OPERATION = 0,
-
- /* Generic parameters evaluation. */
- DEG_OPCODE_ID_PROPERTY,
- DEG_OPCODE_PARAMETERS_EVAL,
-
- // XXX: Placeholder while porting depsgraph code
- DEG_OPCODE_PLACEHOLDER,
-
- /* Animation, Drivers, etc. --------------------------------------------- */
- /* NLA + Action */
- DEG_OPCODE_ANIMATION,
- /* Driver */
- DEG_OPCODE_DRIVER,
-
- /* Object related. ------------------------------------------------------ */
- DEG_OPCODE_OBJECT_BASE_FLAGS,
-
- /* Transform. ----------------------------------------------------------- */
- /* Transform entry point - local transforms only */
- DEG_OPCODE_TRANSFORM_LOCAL,
- /* Parenting */
- DEG_OPCODE_TRANSFORM_PARENT,
- /* Constraints */
- DEG_OPCODE_TRANSFORM_CONSTRAINTS,
- /* Transform exit point */
- DEG_OPCODE_TRANSFORM_FINAL,
- /* Handle object-level updates, mainly proxies hacks and recalc flags. */
- DEG_OPCODE_TRANSFORM_OBJECT_UBEREVAL,
-
- /* Rigid body. ---------------------------------------------------------- */
- /* Perform Simulation */
- DEG_OPCODE_RIGIDBODY_REBUILD,
- DEG_OPCODE_RIGIDBODY_SIM,
- /* Copy results to object */
- DEG_OPCODE_RIGIDBODY_TRANSFORM_COPY,
-
- /* Geometry. ------------------------------------------------------------ */
-
- /* Evaluate the whole geometry, including modifiers. */
- DEG_OPCODE_GEOMETRY_UBEREVAL,
- /* Evaluation of a shape key. */
- DEG_OPCODE_GEOMETRY_SHAPEKEY,
-
- /* Object data. --------------------------------------------------------- */
- DEG_OPCODE_LIGHT_PROBE_EVAL,
- DEG_OPCODE_SPEAKER_EVAL,
-
- /* Pose. ---------------------------------------------------------------- */
- /* Init pose, clear flags, etc. */
- DEG_OPCODE_POSE_INIT,
- /* Initialize IK solver related pose stuff. */
- DEG_OPCODE_POSE_INIT_IK,
- /* Pose is evaluated, and runtime data can be freed. */
- DEG_OPCODE_POSE_CLEANUP,
- /* Pose has been fully evaluated and ready to be used by others. */
- DEG_OPCODE_POSE_DONE,
- /* IK/Spline Solvers */
- DEG_OPCODE_POSE_IK_SOLVER,
- DEG_OPCODE_POSE_SPLINE_IK_SOLVER,
-
- /* Bone. ---------------------------------------------------------------- */
- /* Bone local transforms - entry point */
- DEG_OPCODE_BONE_LOCAL,
- /* Pose-space conversion (includes parent + restpose, */
- DEG_OPCODE_BONE_POSE_PARENT,
- /* Constraints */
- DEG_OPCODE_BONE_CONSTRAINTS,
- /* Bone transforms are ready
- *
- * - "READY" This (internal, noop is used to signal that all pre-IK
- * operations are done. Its role is to help mediate situations
- * where cyclic relations may otherwise form (i.e. one bone in
- * chain targeting another in same chain,
- *
- * - "DONE" This noop is used to signal that the bone's final pose
- * transform can be read by others
- */
- // TODO: deform mats could get calculated in the final_transform ops...
- DEG_OPCODE_BONE_READY,
- DEG_OPCODE_BONE_DONE,
- /* B-Bone segment shape computation (after DONE) */
- DEG_OPCODE_BONE_SEGMENTS,
-
- /* Particle System. ----------------------------------------------------- */
- DEG_OPCODE_PARTICLE_SYSTEM_INIT,
- DEG_OPCODE_PARTICLE_SYSTEM_EVAL,
- DEG_OPCODE_PARTICLE_SYSTEM_DONE,
-
- /* Particle Settings. --------------------------------------------------- */
- DEG_OPCODE_PARTICLE_SETTINGS_INIT,
- DEG_OPCODE_PARTICLE_SETTINGS_EVAL,
- DEG_OPCODE_PARTICLE_SETTINGS_RESET,
-
- /* Point Cache. --------------------------------------------------------- */
- DEG_OPCODE_POINT_CACHE_RESET,
-
- /* Collections. --------------------------------------------------------- */
- DEG_OPCODE_VIEW_LAYER_EVAL,
-
- /* Copy on Write. ------------------------------------------------------- */
- DEG_OPCODE_COPY_ON_WRITE,
-
- /* Shading. ------------------------------------------------------------- */
- DEG_OPCODE_SHADING,
- DEG_OPCODE_MATERIAL_UPDATE,
- DEG_OPCODE_WORLD_UPDATE,
-
- /* Batch caches. -------------------------------------------------------- */
- DEG_OPCODE_GEOMETRY_SELECT_UPDATE,
-
- /* Masks. --------------------------------------------------------------- */
- DEG_OPCODE_MASK_ANIMATION,
- DEG_OPCODE_MASK_EVAL,
-
- /* Movie clips. --------------------------------------------------------- */
- DEG_OPCODE_MOVIECLIP_EVAL,
- DEG_OPCODE_MOVIECLIP_SELECT_UPDATE,
-
- /* Synchronization clips. ----------------------------------------------- */
- DEG_OPCODE_SYNCHRONIZE_TO_ORIGINAL,
-
- /* Generic datablock ---------------------------------------------------- */
- DEG_OPCODE_GENERIC_DATABLOCK_UPDATE,
-
- DEG_NUM_OPCODES,
-} eDepsOperation_Code;
-const char *operationCodeAsString(eDepsOperation_Code opcode);
-
-/* Source of the dependency graph node update tag.
- *
- * NOTE: This is a bit mask, so accumulation of sources is possible.
- */
-typedef enum eUpdateSource {
- /* Update is caused by a time change. */
- DEG_UPDATE_SOURCE_TIME = (1 << 0),
- /* Update caused by user directly or indirectly influencing the node. */
- DEG_UPDATE_SOURCE_USER_EDIT = (1 << 1),
- /* Update is happening as a special response for the relations update. */
- DEG_UPDATE_SOURCE_RELATIONS = (1 << 2),
- /* Update is happening due to visibility change. */
- DEG_UPDATE_SOURCE_VISIBILITY = (1 << 3),
-} eUpdateSource;
-
-} // namespace DEG
diff --git a/source/blender/depsgraph/intern/depsgraph_update.cc b/source/blender/depsgraph/intern/depsgraph_update.cc
new file mode 100644
index 00000000000..9fdfdc3e067
--- /dev/null
+++ b/source/blender/depsgraph/intern/depsgraph_update.cc
@@ -0,0 +1,65 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2013 Blender Foundation.
+ * All rights reserved.
+ *
+ * Original Author: Joshua Leung
+ * Contributor(s): None Yet
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/depsgraph/intern/depsgraph_update.cc
+ * \ingroup depsgraph
+ */
+
+#include "intern/depsgraph_update.h"
+
+#include "DEG_depsgraph.h"
+
+#include "intern/depsgraph_type.h"
+
+namespace DEG {
+
+static DEG_EditorUpdateIDCb deg_editor_update_id_cb = NULL;
+static DEG_EditorUpdateSceneCb deg_editor_update_scene_cb = NULL;
+
+void deg_editors_id_update(const DEGEditorUpdateContext *update_ctx, ID *id)
+{
+ if (deg_editor_update_id_cb != NULL) {
+ deg_editor_update_id_cb(update_ctx, id);
+ }
+}
+
+void deg_editors_scene_update(const DEGEditorUpdateContext *update_ctx,
+ bool updated)
+{
+ if (deg_editor_update_scene_cb != NULL) {
+ deg_editor_update_scene_cb(update_ctx, updated);
+ }
+}
+
+} // namespace DEG
+
+/* Set callbacks which are being called when depsgraph changes. */
+void DEG_editors_set_update_cb(DEG_EditorUpdateIDCb id_func,
+ DEG_EditorUpdateSceneCb scene_func)
+{
+ DEG::deg_editor_update_id_cb = id_func;
+ DEG::deg_editor_update_scene_cb = scene_func;
+}
diff --git a/source/blender/depsgraph/util/deg_util_function.h b/source/blender/depsgraph/intern/depsgraph_update.h
index 0ec41412d7b..3cb8f6b546e 100644
--- a/source/blender/depsgraph/util/deg_util_function.h
+++ b/source/blender/depsgraph/intern/depsgraph_update.h
@@ -15,27 +15,30 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * The Original Code is Copyright (C) 2014 Blender Foundation.
+ * The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
*
- * Original Author: Lukas Toenne
- * Contributor(s):
+ * Original Author: Joshua Leung
+ * Contributor(s): None Yet
*
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/util/deg_util_function.h
+/** \file blender/depsgraph/intern/depsgraph_update.h
* \ingroup depsgraph
*/
#pragma once
-#include <functional>
+struct DEGEditorUpdateContext;
+struct ID;
namespace DEG {
-using std::function;
-using namespace std::placeholders;
-#define function_bind std::bind
+void deg_editors_id_update(const DEGEditorUpdateContext *update_ctx,
+ struct ID *id);
-} // namespace
+void deg_editors_scene_update(const DEGEditorUpdateContext *update_ctx,
+ bool updated);
+
+} // namespace DEG
diff --git a/source/blender/depsgraph/intern/eval/deg_eval.cc b/source/blender/depsgraph/intern/eval/deg_eval.cc
index 02d286c3bd1..0425407d1cd 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval.cc
@@ -38,6 +38,8 @@
#include "BLI_task.h"
#include "BLI_ghash.h"
+#include "BKE_global.h"
+
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
@@ -49,15 +51,12 @@
#include "intern/eval/deg_eval_copy_on_write.h"
#include "intern/eval/deg_eval_flush.h"
#include "intern/eval/deg_eval_stats.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.h"
-#include "intern/depsgraph_intern.h"
-
-#include "util/deg_util_foreach.h"
namespace DEG {
@@ -67,7 +66,7 @@ namespace DEG {
/* Forward declarations. */
static void schedule_children(TaskPool *pool,
Depsgraph *graph,
- OperationDepsNode *node,
+ OperationNode *node,
const int thread_id);
struct DepsgraphEvalState {
@@ -82,7 +81,7 @@ static void deg_task_run_func(TaskPool *pool,
{
void *userdata_v = BLI_task_pool_userdata(pool);
DepsgraphEvalState *state = (DepsgraphEvalState *)userdata_v;
- OperationDepsNode *node = (OperationDepsNode *)taskdata;
+ OperationNode *node = (OperationNode *)taskdata;
/* Sanity checks. */
BLI_assert(!node->is_noop() && "NOOP nodes should not actually be scheduled");
/* Perform operation. */
@@ -104,13 +103,12 @@ typedef struct CalculatePendingData {
Depsgraph *graph;
} CalculatePendingData;
-static bool check_operation_node_visible(OperationDepsNode *op_node)
+static bool check_operation_node_visible(OperationNode *op_node)
{
- const ComponentDepsNode *comp_node = op_node->owner;
+ const ComponentNode *comp_node = op_node->owner;
/* Special exception, copy on write component is to be always evaluated,
- * to keep copied "database" in a consistent state.
- */
- if (comp_node->type == DEG_NODE_TYPE_COPY_ON_WRITE) {
+ * to keep copied "database" in a consistent state. */
+ if (comp_node->type == NodeType::COPY_ON_WRITE) {
return true;
}
return comp_node->affects_directly_visible;
@@ -123,7 +121,7 @@ static void calculate_pending_func(
{
CalculatePendingData *data = (CalculatePendingData *)data_v;
Depsgraph *graph = data->graph;
- OperationDepsNode *node = graph->operations[i];
+ OperationNode *node = graph->operations[i];
/* Update counters, applies for both visible and invisible IDs. */
node->num_links_pending = 0;
node->scheduled = false;
@@ -135,16 +133,15 @@ static void calculate_pending_func(
if ((node->flag & DEPSOP_FLAG_NEEDS_UPDATE) == 0) {
return;
}
- foreach (DepsRelation *rel, node->inlinks) {
- if (rel->from->type == DEG_NODE_TYPE_OPERATION &&
- (rel->flag & DEPSREL_FLAG_CYCLIC) == 0)
+ for (Relation *rel : node->inlinks) {
+ if (rel->from->type == NodeType::OPERATION &&
+ (rel->flag & RELATION_FLAG_CYCLIC) == 0)
{
- OperationDepsNode *from = (OperationDepsNode *)rel->from;
+ OperationNode *from = (OperationNode *)rel->from;
/* TODO(sergey): This is how old layer system was checking for the
* calculation, but how is it possible that visible object depends
* on an invisible? This is something what is prohibited after
- * deg_graph_build_flush_layers().
- */
+ * deg_graph_build_flush_layers(). */
if (!check_operation_node_visible(from)) {
continue;
}
@@ -177,7 +174,7 @@ static void initialize_execution(DepsgraphEvalState *state, Depsgraph *graph)
const bool do_stats = state->do_stats;
calculate_pending_parents(graph);
/* Clear tags and other things which needs to be clear. */
- foreach (OperationDepsNode *node, graph->operations) {
+ for (OperationNode *node : graph->operations) {
if (do_stats) {
node->stats.reset_current();
}
@@ -189,7 +186,7 @@ static void initialize_execution(DepsgraphEvalState *state, Depsgraph *graph)
* scheduled after a task has been completed.
*/
static void schedule_node(TaskPool *pool, Depsgraph *graph,
- OperationDepsNode *node, bool dec_parents,
+ OperationNode *node, bool dec_parents,
const int thread_id)
{
/* No need to schedule nodes of invisible ID. */
@@ -197,33 +194,30 @@ static void schedule_node(TaskPool *pool, Depsgraph *graph,
return;
}
/* No need to schedule operations which are not tagged for update, they are
- * considered to be up to date.
- */
+ * considered to be up to date. */
if ((node->flag & DEPSOP_FLAG_NEEDS_UPDATE) == 0) {
return;
}
/* TODO(sergey): This is not strictly speaking safe to read
- * num_links_pending.
- */
+ * num_links_pending. */
if (dec_parents) {
BLI_assert(node->num_links_pending > 0);
atomic_sub_and_fetch_uint32(&node->num_links_pending, 1);
}
/* Cal not schedule operation while its dependencies are not yet
- * evaluated.
- */
+ * evaluated. */
if (node->num_links_pending != 0) {
return;
}
/* During the COW stage only schedule COW nodes. */
DepsgraphEvalState *state = (DepsgraphEvalState *)BLI_task_pool_userdata(pool);
if (state->is_cow_stage) {
- if (node->owner->type != DEG_NODE_TYPE_COPY_ON_WRITE) {
+ if (node->owner->type != NodeType::COPY_ON_WRITE) {
return;
}
}
else {
- BLI_assert(node->scheduled || node->owner->type != DEG_NODE_TYPE_COPY_ON_WRITE);
+ BLI_assert(node->scheduled || node->owner->type != NodeType::COPY_ON_WRITE);
}
/* Actually schedule the node. */
bool is_scheduled = atomic_fetch_and_or_uint8(
@@ -247,19 +241,19 @@ static void schedule_node(TaskPool *pool, Depsgraph *graph,
static void schedule_graph(TaskPool *pool, Depsgraph *graph)
{
- foreach (OperationDepsNode *node, graph->operations) {
+ for (OperationNode *node : graph->operations) {
schedule_node(pool, graph, node, false, 0);
}
}
static void schedule_children(TaskPool *pool,
Depsgraph *graph,
- OperationDepsNode *node,
+ OperationNode *node,
const int thread_id)
{
- foreach (DepsRelation *rel, node->outlinks) {
- OperationDepsNode *child = (OperationDepsNode *)rel->to;
- BLI_assert(child->type == DEG_NODE_TYPE_OPERATION);
+ for (Relation *rel : node->outlinks) {
+ OperationNode *child = (OperationNode *)rel->to;
+ BLI_assert(child->type == NodeType::OPERATION);
if (child->scheduled) {
/* Happens when having cyclic dependencies. */
continue;
@@ -267,7 +261,7 @@ static void schedule_children(TaskPool *pool,
schedule_node(pool,
graph,
child,
- (rel->flag & DEPSREL_FLAG_CYCLIC) == 0,
+ (rel->flag & RELATION_FLAG_CYCLIC) == 0,
thread_id);
}
}
@@ -277,13 +271,12 @@ static void depsgraph_ensure_view_layer(Depsgraph *graph)
/* We update copy-on-write scene in the following cases:
* - It was not expanded yet.
* - It was tagged for update of CoW component.
- * This allows us to have proper view layer pointer.
- */
+ * This allows us to have proper view layer pointer. */
Scene *scene_cow = graph->scene_cow;
if (!deg_copy_on_write_is_expanded(&scene_cow->id) ||
scene_cow->id.recalc & ID_RECALC_COPY_ON_WRITE)
{
- const IDDepsNode *id_node = graph->find_id_node(&graph->scene->id);
+ const IDNode *id_node = graph->find_id_node(&graph->scene->id);
deg_update_copy_on_write_datablock(graph, id_node);
}
}
@@ -335,8 +328,7 @@ void deg_evaluate_on_refresh(Depsgraph *graph)
BLI_task_pool_free(task_pool);
/* Finalize statistics gathering. This is because we only gather single
* operation timing here, without aggregating anything to avoid any extra
- * synchronization.
- */
+ * synchronization. */
if (state.do_stats) {
deg_eval_stats_aggregate(graph);
}
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
index aa028629093..47affdd1bf9 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
@@ -95,8 +95,8 @@ extern "C" {
#include "intern/depsgraph.h"
#include "intern/builder/deg_builder_nodes.h"
-#include "intern/nodes/deg_node.h"
-#include "intern/nodes/deg_node_id.h"
+#include "intern/node/deg_node.h"
+#include "intern/node/deg_node_id.h"
namespace DEG {
@@ -446,8 +446,7 @@ struct RemapCallbackUserData {
/* Create placeholder for ID nodes for cases when we need to remap original
* ID to it[s CoW version but we don't have required ID node yet.
*
- * This happens when expansion happens a ta construction time.
- */
+ * This happens when expansion happens a ta construction time. */
DepsgraphNodeBuilder *node_builder;
bool create_placeholders;
};
@@ -472,12 +471,11 @@ int foreach_libblock_remap_callback(void *user_data_v,
*
* TODO(sergey): Ideally we need to tell ID looper to ignore
* those or at least make it more reliable check where the
- * pointer is coming from.
- */
+ * pointer is coming from. */
const ID_Type id_type = GS(id_orig->name);
const ID_Type id_type_self = GS(id_self->name);
if (id_type == ID_OB && id_type_self == ID_SCE) {
- IDDepsNode *id_node = depsgraph->find_id_node(id_orig);
+ IDNode *id_node = depsgraph->find_id_node(id_orig);
if (id_node == NULL) {
id_cow = id_orig;
}
@@ -541,8 +539,7 @@ void update_mesh_edit_mode_pointers(const Depsgraph *depsgraph,
*
* This is kind of confusing, because actual bmesh is not owned by
* the CoW object, so need to be accurate about using link from
- * edit_btmesh to object.
- */
+ * edit_btmesh to object. */
const Mesh *mesh_orig = (const Mesh *)id_orig;
Mesh *mesh_cow = (Mesh *)id_cow;
if (mesh_orig->edit_btmesh == NULL) {
@@ -621,8 +618,7 @@ void update_special_pointers(const Depsgraph *depsgraph,
case ID_OB:
{
/* Ensure we don't drag someone's else derived mesh to the
- * new copy of the object.
- */
+ * new copy of the object. */
Object *object_cow = (Object *)id_cow;
const Object *object_orig = (const Object *)id_orig;
object_cow->mode = object_orig->mode;
@@ -683,7 +679,7 @@ int foreach_libblock_validate_callback(void *user_data,
* NOTE: Expects that CoW datablock is empty.
*/
ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph,
- const IDDepsNode *id_node,
+ const IDNode *id_node,
DepsgraphNodeBuilder *node_builder,
bool create_placeholders)
{
@@ -691,8 +687,7 @@ ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph,
ID *id_cow = id_node->id_cow;
const int id_cow_recalc = id_cow->recalc;
/* No need to expand such datablocks, their copied ID is same as original
- * one already.
- */
+ * one already. */
if (!deg_copy_on_write_is_needed(id_orig)) {
return id_cow;
}
@@ -700,29 +695,25 @@ ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph,
id_orig->name, id_orig, id_cow);
/* Sanity checks. */
/* NOTE: Disabled for now, conflicts when re-using evaluated datablock when
- * rebuilding dependencies.
- */
+ * rebuilding dependencies. */
if (check_datablock_expanded(id_cow) && create_placeholders) {
deg_free_copy_on_write_datablock(id_cow);
}
// BLI_assert(check_datablock_expanded(id_cow) == false);
/* Copy data from original ID to a copied version. */
/* TODO(sergey): Avoid doing full ID copy somehow, make Mesh to reference
- * original geometry arrays for until those are modified.
- */
+ * original geometry arrays for until those are modified. */
/* TODO(sergey): We do some trickery with temp bmain and extra ID pointer
* just to be able to use existing API. Ideally we need to replace this with
* in-place copy from existing datablock to a prepared memory.
*
* NOTE: We don't use BKE_main_{new,free} because:
* - We don't want heap-allocations here.
- * - We don't want bmain's content to be freed when main is freed.
- */
+ * - We don't want bmain's content to be freed when main is freed. */
bool done = false;
/* First we handle special cases which are not covered by id_copy() yet.
* or cases where we want to do something smarter than simple datablock
- * copy.
- */
+ * copy. */
const ID_Type id_type = GS(id_orig->name);
switch (id_type) {
case ID_SCE:
@@ -736,8 +727,7 @@ ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph,
case ID_ME:
{
/* TODO(sergey): Ideally we want to handle meshes in a special
- * manner here to avoid initial copy of all the geometry arrays.
- */
+ * manner here to avoid initial copy of all the geometry arrays. */
break;
}
default:
@@ -757,8 +747,7 @@ ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph,
ntree_hack_remap_pointers(depsgraph, id_cow);
#endif
/* Do it now, so remapping will understand that possibly remapped self ID
- * is not to be remapped again.
- */
+ * is not to be remapped again. */
deg_tag_copy_on_write_id(id_cow, id_orig);
/* Perform remapping of the nodes. */
RemapCallbackUserData user_data = {NULL};
@@ -771,8 +760,7 @@ ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph,
(void *)&user_data,
IDWALK_NOP);
/* Correct or tweak some pointers which are not taken care by foreach
- * from above.
- */
+ * from above. */
update_special_pointers(depsgraph, id_orig, id_cow);
id_cow->recalc = id_orig->recalc | id_cow_recalc;
return id_cow;
@@ -784,7 +772,7 @@ ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph,
DepsgraphNodeBuilder *node_builder,
bool create_placeholders)
{
- DEG::IDDepsNode *id_node = depsgraph->find_id_node(id_orig);
+ DEG::IDNode *id_node = depsgraph->find_id_node(id_orig);
BLI_assert(id_node != NULL);
return deg_expand_copy_on_write_datablock(depsgraph,
id_node,
@@ -793,7 +781,7 @@ ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph,
}
static void deg_update_copy_on_write_animation(const Depsgraph *depsgraph,
- const IDDepsNode *id_node)
+ const IDNode *id_node)
{
DEG_debug_print_eval((::Depsgraph *)depsgraph,
__func__,
@@ -829,8 +817,7 @@ static void deg_backup_object_runtime(
BKE_object_runtime_reset(object);
/* Object update will override actual object->data to an evaluated version.
* Need to make sure we don't have data set to evaluated one before free
- * anything.
- */
+ * anything. */
if (mesh_eval != NULL && object->data == mesh_eval) {
object->data = object->runtime.mesh_orig;
}
@@ -853,8 +840,7 @@ static void deg_restore_object_runtime(
* have any "persistent" pointers to point to an invalid data.
*
* We restore object's data datablock to an original copy of
- * that datablock.
- */
+ * that datablock. */
object->data = mesh_orig;
/* After that, immediately free the invalidated caches. */
@@ -863,13 +849,11 @@ static void deg_restore_object_runtime(
else {
Mesh *mesh_eval = object->runtime.mesh_eval;
/* Do same thing as object update: override actual object data
- * pointer with evaluated datablock.
- */
+ * pointer with evaluated datablock. */
object->data = mesh_eval;
/* Evaluated mesh simply copied edit_btmesh pointer from
* original mesh during update, need to make sure no dead
- * pointers are left behind.
- */
+ * pointers are left behind. */
mesh_eval->edit_btmesh = mesh_orig->edit_btmesh;
}
}
@@ -878,7 +862,7 @@ static void deg_restore_object_runtime(
}
ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph,
- const IDDepsNode *id_node)
+ const IDNode *id_node)
{
const ID *id_orig = id_node->id_orig;
const ID_Type id_type = GS(id_orig->name);
@@ -892,15 +876,12 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph,
* - Perform full datablock copy.
*
* Note that we never free GPU materials from here since that's not
- * safe for threading and GPU materials are likely to be re-used.
- */
+ * safe for threading and GPU materials are likely to be re-used. */
/* TODO(sergey): Either move this to an utility function or redesign
* Copy-on-Write components in a way that only needed parts are being
- * copied over.
- */
+ * copied over. */
/* TODO(sergey): Wrap GPU material backup and object runtime backup to a
- * generic backup structure.
- */
+ * generic backup structure. */
ListBase gpumaterial_backup;
ListBase *gpumaterial_ptr = NULL;
DrawDataList drawdata_backup;
@@ -928,8 +909,7 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph,
*
* These flags CURRENTLY don't need full datablock update,
* everything is done by node tree update function which
- * only copies socket values.
- */
+ * only copies socket values. */
const int ignore_flag = (ID_RECALC_SHADING |
ID_RECALC_ANIMATION |
ID_RECALC_COPY_ON_WRITE);
@@ -978,7 +958,7 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph,
ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph,
ID *id_orig)
{
- DEG::IDDepsNode *id_node = depsgraph->find_id_node(id_orig);
+ DEG::IDNode *id_node = depsgraph->find_id_node(id_orig);
BLI_assert(id_node != NULL);
return deg_update_copy_on_write_datablock(depsgraph, id_node);
}
@@ -1071,8 +1051,7 @@ void deg_free_copy_on_write_datablock(ID *id_cow)
{
if (!check_datablock_expanded(id_cow)) {
/* Actual content was never copied on top of CoW block, we have
- * nothing to free.
- */
+ * nothing to free. */
return;
}
const ID_Type type = GS(id_cow->name);
@@ -1084,8 +1063,7 @@ void deg_free_copy_on_write_datablock(ID *id_cow)
{
/* TODO(sergey): This workaround is only to prevent free derived
* caches from modifying object->data. This is currently happening
- * due to mesh/curve datablock boundbox tagging dirty.
- */
+ * due to mesh/curve datablock boundbox tagging dirty. */
Object *ob_cow = (Object *)id_cow;
ob_cow->data = NULL;
ob_cow->sculpt = NULL;
@@ -1102,14 +1080,13 @@ void deg_free_copy_on_write_datablock(ID *id_cow)
}
void deg_evaluate_copy_on_write(struct ::Depsgraph *graph,
- const IDDepsNode *id_node)
+ const IDNode *id_node)
{
const DEG::Depsgraph *depsgraph = reinterpret_cast<const DEG::Depsgraph *>(graph);
DEG_debug_print_eval(graph, __func__, id_node->id_orig->name, id_node->id_cow);
if (id_node->id_orig == &depsgraph->scene->id) {
/* NOTE: This is handled by eval_ctx setup routines, which
- * ensures scene and view layer pointers are valid.
- */
+ * ensures scene and view layer pointers are valid. */
return;
}
deg_update_copy_on_write_datablock(depsgraph, id_node);
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.h b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.h
index e9f5bc1e918..c1124f01f7f 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.h
+++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.h
@@ -52,13 +52,13 @@ namespace DEG {
struct Depsgraph;
struct DepsgraphNodeBuilder;
-struct IDDepsNode;
+struct IDNode;
/* Get fully expanded (ready for use) copy-on-write datablock for the given
* original datablock.
*/
ID *deg_expand_copy_on_write_datablock(const struct Depsgraph *depsgraph,
- const IDDepsNode *id_node,
+ const IDNode *id_node,
DepsgraphNodeBuilder *node_builder = NULL,
bool create_placeholders = false);
ID *deg_expand_copy_on_write_datablock(const struct Depsgraph *depsgraph,
@@ -70,7 +70,7 @@ ID *deg_expand_copy_on_write_datablock(const struct Depsgraph *depsgraph,
* datablock.
*/
ID *deg_update_copy_on_write_datablock(const struct Depsgraph *depsgraph,
- const IDDepsNode *id_node);
+ const IDNode *id_node);
ID *deg_update_copy_on_write_datablock(const struct Depsgraph *depsgraph,
struct ID *id_orig);
@@ -81,7 +81,7 @@ void deg_free_copy_on_write_datablock(struct ID *id_cow);
* datablock is ready for use by further evaluation routines.
*/
void deg_evaluate_copy_on_write(struct ::Depsgraph *depsgraph,
- const struct IDDepsNode *id_node);
+ const struct IDNode *id_node);
/* Check that given ID is properly expanded and does not have any shallow
* copies inside.
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
index 5373c142ba6..a7071e14c38 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
@@ -52,14 +52,16 @@ extern "C" {
#include "DEG_depsgraph.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/debug/deg_debug.h"
+#include "intern/depsgraph.h"
+#include "intern/depsgraph_update.h"
+#include "intern/node/deg_node.h"
+#include "intern/node/deg_node_component.h"
+#include "intern/node/deg_node_factory.h"
+#include "intern/node/deg_node_id.h"
+#include "intern/node/deg_node_operation.h"
-#include "intern/depsgraph_intern.h"
#include "intern/eval/deg_eval_copy_on_write.h"
-#include "util/deg_util_foreach.h"
// Invalidate datablock data when update is flushed on it.
//
@@ -85,7 +87,7 @@ enum {
COMPONENT_STATE_DONE = 2,
};
-typedef std::deque<OperationDepsNode *> FlushQueue;
+typedef std::deque<OperationNode *> FlushQueue;
namespace {
@@ -95,7 +97,7 @@ void flush_init_operation_node_func(
const ParallelRangeTLS *__restrict /*tls*/)
{
Depsgraph *graph = (Depsgraph *)data_v;
- OperationDepsNode *node = graph->operations[i];
+ OperationNode *node = graph->operations[i];
node->scheduled = false;
}
@@ -105,9 +107,9 @@ void flush_init_id_node_func(
const ParallelRangeTLS *__restrict /*tls*/)
{
Depsgraph *graph = (Depsgraph *)data_v;
- IDDepsNode *id_node = graph->id_nodes[i];
+ IDNode *id_node = graph->id_nodes[i];
id_node->custom_flags = ID_STATE_NONE;
- GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, id_node->components)
+ GHASH_FOREACH_BEGIN(ComponentNode *, comp_node, id_node->components)
comp_node->custom_flags = COMPONENT_STATE_NONE;
GHASH_FOREACH_END();
}
@@ -138,7 +140,7 @@ BLI_INLINE void flush_prepare(Depsgraph *graph)
BLI_INLINE void flush_schedule_entrypoints(Depsgraph *graph, FlushQueue *queue)
{
- GSET_FOREACH_BEGIN(OperationDepsNode *, op_node, graph->entry_tags)
+ GSET_FOREACH_BEGIN(OperationNode *, op_node, graph->entry_tags)
{
queue->push_back(op_node);
op_node->scheduled = true;
@@ -149,14 +151,14 @@ BLI_INLINE void flush_schedule_entrypoints(Depsgraph *graph, FlushQueue *queue)
GSET_FOREACH_END();
}
-BLI_INLINE void flush_handle_id_node(IDDepsNode *id_node)
+BLI_INLINE void flush_handle_id_node(IDNode *id_node)
{
id_node->custom_flags = ID_STATE_MODIFIED;
}
/* TODO(sergey): We can reduce number of arguments here. */
-BLI_INLINE void flush_handle_component_node(IDDepsNode *id_node,
- ComponentDepsNode *comp_node,
+BLI_INLINE void flush_handle_component_node(IDNode *id_node,
+ ComponentNode *comp_node,
FlushQueue *queue)
{
/* We only handle component once. */
@@ -168,19 +170,18 @@ BLI_INLINE void flush_handle_component_node(IDDepsNode *id_node,
* special component where we don't want all operations to be tagged.
*
* TODO(sergey): Make this a more generic solution. */
- if (comp_node->type != DEG_NODE_TYPE_PARTICLE_SETTINGS &&
- comp_node->type != DEG_NODE_TYPE_PARTICLE_SYSTEM)
+ if (comp_node->type != NodeType::PARTICLE_SETTINGS &&
+ comp_node->type != NodeType::PARTICLE_SYSTEM)
{
- foreach (OperationDepsNode *op, comp_node->operations) {
+ for (OperationNode *op : comp_node->operations) {
op->flag |= DEPSOP_FLAG_NEEDS_UPDATE;
}
}
/* when some target changes bone, we might need to re-run the
- * whole IK solver, otherwise result might be unpredictable.
- */
- if (comp_node->type == DEG_NODE_TYPE_BONE) {
- ComponentDepsNode *pose_comp =
- id_node->find_component(DEG_NODE_TYPE_EVAL_POSE);
+ * whole IK solver, otherwise result might be unpredictable. */
+ if (comp_node->type == NodeType::BONE) {
+ ComponentNode *pose_comp =
+ id_node->find_component(NodeType::EVAL_POSE);
BLI_assert(pose_comp != NULL);
if (pose_comp->custom_flags == COMPONENT_STATE_NONE) {
queue->push_front(pose_comp->get_entry_operation());
@@ -195,24 +196,24 @@ BLI_INLINE void flush_handle_component_node(IDDepsNode *id_node,
* return value, so it can start being handled right away, without building too
* much of a queue.
*/
-BLI_INLINE OperationDepsNode *flush_schedule_children(
- OperationDepsNode *op_node,
+BLI_INLINE OperationNode *flush_schedule_children(
+ OperationNode *op_node,
FlushQueue *queue)
{
- OperationDepsNode *result = NULL;
- foreach (DepsRelation *rel, op_node->outlinks) {
+ OperationNode *result = NULL;
+ for (Relation *rel : op_node->outlinks) {
/* Flush is forbidden, completely. */
- if (rel->flag & DEPSREL_FLAG_NO_FLUSH) {
+ if (rel->flag & RELATION_FLAG_NO_FLUSH) {
continue;
}
/* Relation only allows flushes on user changes, but the node was not
* affected by user. */
- if ((rel->flag & DEPSREL_FLAG_FLUSH_USER_EDIT_ONLY) &&
+ if ((rel->flag & RELATION_FLAG_FLUSH_USER_EDIT_ONLY) &&
(op_node->flag & DEPSOP_FLAG_USER_MODIFIED) == 0)
{
continue;
}
- OperationDepsNode *to_node = (OperationDepsNode *)rel->to;
+ OperationNode *to_node = (OperationNode *)rel->to;
/* Always flush flushable flags, so children always know what happened
* to their parents. */
to_node->flag |= (op_node->flag & DEPSOP_FLAG_FLUSH);
@@ -247,7 +248,7 @@ void flush_editors_id_update(Main *bmain,
Depsgraph *graph,
const DEGEditorUpdateContext *update_ctx)
{
- foreach (IDDepsNode *id_node, graph->id_nodes) {
+ for (IDNode *id_node : graph->id_nodes) {
if (id_node->custom_flags != ID_STATE_MODIFIED) {
continue;
}
@@ -257,16 +258,15 @@ void flush_editors_id_update(Main *bmain,
ID *id_cow = id_node->id_cow;
/* Copy tag from original data to CoW storage.
* This is because DEG_id_tag_update() sets tags on original
- * data.
- */
+ * data. */
id_cow->recalc |= (id_orig->recalc & ID_RECALC_ALL);
/* Gather recalc flags from all changed components. */
- GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, id_node->components)
+ GHASH_FOREACH_BEGIN(ComponentNode *, comp_node, id_node->components)
{
if (comp_node->custom_flags != COMPONENT_STATE_DONE) {
continue;
}
- DepsNodeFactory *factory = deg_type_get_factory(comp_node->type);
+ DepsNodeFactory *factory = type_get_factory(comp_node->type);
BLI_assert(factory != NULL);
id_cow->recalc |= factory->id_recalc_tag();
}
@@ -330,7 +330,7 @@ void invalidate_tagged_evaluated_geometry(ID *id)
void invalidate_tagged_evaluated_data(Depsgraph *graph)
{
#ifdef INVALIDATE_ON_FLUSH
- foreach (IDDepsNode *id_node, graph->id_nodes) {
+ for (IDNode *id_node : graph->id_nodes) {
if (id_node->custom_flags != ID_STATE_MODIFIED) {
continue;
}
@@ -338,7 +338,7 @@ void invalidate_tagged_evaluated_data(Depsgraph *graph)
if (!deg_copy_on_write_is_expanded(id_cow)) {
continue;
}
- GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, id_node->components)
+ GHASH_FOREACH_BEGIN(ComponentNode *, comp_node, id_node->components)
{
if (comp_node->custom_flags != COMPONENT_STATE_DONE) {
continue;
@@ -388,14 +388,14 @@ void deg_graph_flush_updates(Main *bmain, Depsgraph *graph)
update_ctx.view_layer = graph->view_layer;
/* Do actual flush. */
while (!queue.empty()) {
- OperationDepsNode *op_node = queue.front();
+ OperationNode *op_node = queue.front();
queue.pop_front();
while (op_node != NULL) {
/* Tag operation as required for update. */
op_node->flag |= DEPSOP_FLAG_NEEDS_UPDATE;
/* Inform corresponding ID and component nodes about the change. */
- ComponentDepsNode *comp_node = op_node->owner;
- IDDepsNode *id_node = comp_node->owner;
+ ComponentNode *comp_node = op_node->owner;
+ IDNode *id_node = comp_node->owner;
flush_handle_id_node(id_node);
flush_handle_component_node(id_node,
comp_node,
@@ -407,8 +407,7 @@ void deg_graph_flush_updates(Main *bmain, Depsgraph *graph)
/* Inform editors about all changes. */
flush_editors_id_update(bmain, graph, &update_ctx);
/* Reset evaluation result tagged which is tagged for update to some state
- * which is obvious to catch.
- */
+ * which is obvious to catch. */
invalidate_tagged_evaluated_data(graph);
}
@@ -418,7 +417,7 @@ static void graph_clear_operation_func(
const ParallelRangeTLS *__restrict /*tls*/)
{
Depsgraph *graph = (Depsgraph *)data_v;
- OperationDepsNode *node = graph->operations[i];
+ OperationNode *node = graph->operations[i];
/* Clear node's "pending update" settings. */
node->flag &= ~(DEPSOP_FLAG_DIRECTLY_MODIFIED |
DEPSOP_FLAG_NEEDS_UPDATE |
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_stats.cc b/source/blender/depsgraph/intern/eval/deg_eval_stats.cc
index 52ce744cc0a..4dae608bae8 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_stats.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_stats.cc
@@ -35,23 +35,20 @@
#include "intern/depsgraph.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 "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"
namespace DEG {
void deg_eval_stats_aggregate(Depsgraph *graph)
{
/* Reset current evaluation stats for ID and component nodes.
- * Those are not filled in by the evaluation engine.
- */
- foreach (DepsNode *node, graph->id_nodes) {
- IDDepsNode *id_node = (IDDepsNode *)node;
- GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, id_node->components)
+ * Those are not filled in by the evaluation engine. */
+ for (Node *node : graph->id_nodes) {
+ IDNode *id_node = (IDNode *)node;
+ GHASH_FOREACH_BEGIN(ComponentNode *, comp_node, id_node->components)
{
comp_node->stats.reset_current();
}
@@ -59,9 +56,9 @@ void deg_eval_stats_aggregate(Depsgraph *graph)
id_node->stats.reset_current();
}
/* Now accumulate operation timings to components and IDs. */
- foreach (OperationDepsNode *op_node, graph->operations) {
- ComponentDepsNode *comp_node = op_node->owner;
- IDDepsNode *id_node = comp_node->owner;
+ for (OperationNode *op_node : graph->operations) {
+ ComponentNode *comp_node = op_node->owner;
+ IDNode *id_node = comp_node->owner;
id_node->stats.current_time += op_node->stats.current_time;
comp_node->stats.current_time += op_node->stats.current_time;
}
diff --git a/source/blender/depsgraph/intern/node/deg_node.cc b/source/blender/depsgraph/intern/node/deg_node.cc
new file mode 100644
index 00000000000..cfded3d3c90
--- /dev/null
+++ b/source/blender/depsgraph/intern/node/deg_node.cc
@@ -0,0 +1,187 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2013 Blender Foundation.
+ * All rights reserved.
+ *
+ * Original Author: Joshua Leung
+ * Contributor(s): None Yet
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/depsgraph/intern/node/deg_node.cc
+ * \ingroup depsgraph
+ */
+
+#include "intern/node/deg_node.h"
+
+#include <stdio.h>
+
+#include "BLI_utildefines.h"
+
+#include "intern/depsgraph.h"
+#include "intern/eval/deg_eval_copy_on_write.h"
+#include "intern/node/deg_node_component.h"
+#include "intern/node/deg_node_factory.h"
+#include "intern/node/deg_node_id.h"
+#include "intern/node/deg_node_operation.h"
+#include "intern/node/deg_node_time.h"
+
+namespace DEG {
+
+const char *nodeClassAsString(NodeClass node_class)
+{
+ switch (node_class) {
+ case NodeClass::GENERIC: return "GENERIC";
+ case NodeClass::COMPONENT: return "COMPONENT";
+ case NodeClass::OPERATION: return "OPERATION";
+ }
+ BLI_assert(!"Unhandled node class, should never happen.");
+ return "UNKNOWN";
+}
+
+const char *nodeTypeAsString(NodeType type)
+{
+ switch (type) {
+ case NodeType::UNDEFINED: return "UNDEFINED";
+ case NodeType::OPERATION: return "OPERATION";
+ /* **** Generic Types **** */
+ case NodeType::TIMESOURCE: return "TIMESOURCE";
+ case NodeType::ID_REF: return "ID_REF";
+ /* **** Outer Types **** */
+ case NodeType::PARAMETERS: return "PARAMETERS";
+ case NodeType::PROXY: return "PROXY";
+ case NodeType::ANIMATION: return "ANIMATION";
+ case NodeType::TRANSFORM: return "TRANSFORM";
+ case NodeType::GEOMETRY: return "GEOMETRY";
+ case NodeType::SEQUENCER: return "SEQUENCER";
+ case NodeType::LAYER_COLLECTIONS: return "LAYER_COLLECTIONS";
+ case NodeType::COPY_ON_WRITE: return "COPY_ON_WRITE";
+ case NodeType::OBJECT_FROM_LAYER: return "OBJECT_FROM_LAYER";
+ /* **** Evaluation-Related Outer Types (with Subdata) **** */
+ case NodeType::EVAL_POSE: return "EVAL_POSE";
+ case NodeType::BONE: return "BONE";
+ case NodeType::PARTICLE_SYSTEM: return "PARTICLE_SYSTEM";
+ case NodeType::PARTICLE_SETTINGS: return "PARTICLE_SETTINGS";
+ case NodeType::SHADING: return "SHADING";
+ case NodeType::SHADING_PARAMETERS: return "SHADING_PARAMETERS";
+ case NodeType::CACHE: return "CACHE";
+ case NodeType::POINT_CACHE: return "POINT_CACHE";
+ case NodeType::BATCH_CACHE: return "BATCH_CACHE";
+ /* Duplication. */
+ case NodeType::DUPLI: return "DUPLI";
+ /* Synchronization. */
+ case NodeType::SYNCHRONIZE: return "SYNCHRONIZE";
+ /* Generic datablock. */
+ case NodeType::GENERIC_DATABLOCK: return "GENERIC_DATABLOCK";
+
+ /* Total number of meaningful node types. */
+ case NodeType::NUM_TYPES: return "SpecialCase";
+ }
+ BLI_assert(!"Unhandled node type, should never happen.");
+ return "UNKNOWN";
+}
+
+/*******************************************************************************
+ * Type information.
+ */
+
+Node::TypeInfo::TypeInfo(NodeType type,
+ const char *type_name,
+ int id_recalc_tag)
+ : type(type),
+ type_name(type_name),
+ id_recalc_tag(id_recalc_tag)
+{
+}
+
+/*******************************************************************************
+ * Evaluation statistics.
+ */
+
+Node::Stats::Stats()
+{
+ reset();
+}
+
+void Node::Stats::reset()
+{
+ current_time = 0.0;
+}
+
+void Node::Stats::reset_current()
+{
+ current_time = 0.0;
+}
+
+/*******************************************************************************
+ * Node itself.
+ */
+
+Node::Node()
+{
+ name = "";
+}
+
+Node::~Node()
+{
+ /* Free links. */
+ /* NOTE: We only free incoming links. This is to avoid double-free of links
+ * when we're trying to free same link from both it's sides. We don't have
+ * dangling links so this is not a problem from memory leaks point of view. */
+ for (Relation *rel : inlinks) {
+ OBJECT_GUARDED_DELETE(rel, Relation);
+ }
+}
+
+
+/* Generic identifier for Depsgraph Nodes. */
+string Node::identifier() const
+{
+ return string(nodeTypeAsString(type)) + " : " + name;
+}
+
+NodeClass Node::get_class() const {
+ if (type == NodeType::OPERATION) {
+ return NodeClass::OPERATION;
+ }
+ else if (type < NodeType::PARAMETERS) {
+ return NodeClass::GENERIC;
+ }
+ else {
+ return NodeClass::COMPONENT;
+ }
+}
+
+/*******************************************************************************
+ * Generic nodes definition.
+ */
+
+DEG_DEPSNODE_DEFINE(TimeSourceNode, NodeType::TIMESOURCE, "Time Source");
+static DepsNodeFactoryImpl<TimeSourceNode> DNTI_TIMESOURCE;
+
+DEG_DEPSNODE_DEFINE(IDNode, NodeType::ID_REF, "ID Node");
+static DepsNodeFactoryImpl<IDNode> DNTI_ID_REF;
+
+void deg_register_base_depsnodes()
+{
+ register_node_typeinfo(&DNTI_TIMESOURCE);
+ register_node_typeinfo(&DNTI_ID_REF);
+}
+
+} // namespace DEG
diff --git a/source/blender/depsgraph/intern/node/deg_node.h b/source/blender/depsgraph/intern/node/deg_node.h
new file mode 100644
index 00000000000..a07990df862
--- /dev/null
+++ b/source/blender/depsgraph/intern/node/deg_node.h
@@ -0,0 +1,201 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2013 Blender Foundation.
+ * All rights reserved.
+ *
+ * Original Author: Joshua Leung
+ * Contributor(s): None Yet
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file depsgraph/intern/node/deg_node.h
+ * \ingroup depsgraph
+ */
+
+#pragma once
+
+#include "intern/depsgraph_type.h"
+
+#include "BLI_utildefines.h"
+
+struct GHash;
+struct ID;
+struct Scene;
+
+namespace DEG {
+
+struct Relation;
+struct Depsgraph;
+struct OperationNode;
+
+/* Metatype of Nodes - The general "level" in the graph structure
+ * the node serves. */
+enum class NodeClass {
+ /* Types generally unassociated with user-visible entities,
+ * but needed for graph functioning. */
+ GENERIC = 0,
+ /* [Outer Node] An "aspect" of evaluating/updating an ID-Block, requiring
+ * certain types of evaluation behavior. */
+ COMPONENT = 1,
+ /* [Inner Node] A glorified function-pointer/callback for scheduling up
+ * evaluation operations for components, subject to relationship
+ * requirements. */
+ OPERATION = 2,
+};
+const char *nodeClassAsString(NodeClass node_class);
+
+/* Types of Nodes */
+enum class NodeType {
+ /* Fallback type for invalid return value */
+ UNDEFINED = 0,
+ /* Inner Node (Operation) */
+ OPERATION,
+
+ /* **** Generic Types **** */
+
+ /* Time-Source */
+ TIMESOURCE,
+ /* ID-Block reference - used as landmarks/collection point for components,
+ * but not usually part of main graph. */
+ ID_REF,
+
+ /* **** Outer Types **** */
+
+ /* Parameters Component - Default when nothing else fits
+ * (i.e. just SDNA property setting). */
+ PARAMETERS,
+ /* Generic "Proxy-Inherit" Component. */
+ PROXY,
+ /* Animation Component */
+ ANIMATION,
+ /* Transform Component (Parenting/Constraints) */
+ TRANSFORM,
+ /* Geometry Component (Mesh/Displist) */
+ GEOMETRY,
+ /* Sequencer Component (Scene Only) */
+ SEQUENCER,
+ /* Component which contains all operations needed for layer collections
+ * evaluation. */
+ LAYER_COLLECTIONS,
+ /* Entry component of majority of ID nodes: prepares CoW pointers for
+ * execution. */
+ COPY_ON_WRITE,
+ /* Used by all operations which are updating object when something is
+ * changed in view layer. */
+ OBJECT_FROM_LAYER,
+ /* Un-interestying datablock, which is a part of dependency graph, but does
+ * not have very distinctive update procedure. */
+ GENERIC_DATABLOCK,
+
+ /* **** Evaluation-Related Outer Types (with Subdata) **** */
+
+ /* Pose Component - Owner/Container of Bones Eval */
+ EVAL_POSE,
+ /* Bone Component - Child/Subcomponent of Pose */
+ BONE,
+ /* Particle Systems Component */
+ PARTICLE_SYSTEM,
+ PARTICLE_SETTINGS,
+ /* Material Shading Component */
+ SHADING,
+ SHADING_PARAMETERS,
+ /* Point cache Component */
+ POINT_CACHE,
+ /* Cache Component */
+ /* TODO(sergey); Verify that we really need this. */
+ CACHE,
+ /* Batch Cache Component.
+ * TODO (dfelinto/sergey): rename to make it more generic. */
+ BATCH_CACHE,
+ /* Duplication system. Used to force duplicated objects visible when
+ * when duplicator is visible. */
+ DUPLI,
+ /* Synchronization back to original datablock. */
+ SYNCHRONIZE,
+
+ /* Total number of meaningful node types. */
+ NUM_TYPES,
+};
+const char *nodeTypeAsString(NodeType type);
+
+/* All nodes in Depsgraph are descended from this. */
+struct Node {
+ /* Helper class for static typeinfo in subclasses. */
+ struct TypeInfo {
+ TypeInfo(NodeType type,
+ const char *type_name,
+ int id_recalc_tag = 0);
+ NodeType type;
+ const char *type_name;
+ int id_recalc_tag;
+ };
+ struct Stats {
+ Stats();
+ /* Reset all the counters. Including all stats needed for average
+ * evaluation time calculation. */
+ void reset();
+ /* Reset counters needed for the current graph evaluation, does not
+ * touch averaging accumulators. */
+ void reset_current();
+ /* Time spend on this node during current graph evaluation. */
+ double current_time;
+ };
+ /* Relationships between nodes
+ * The reason why all depsgraph nodes are descended from this type (apart
+ * from basic serialization benefits - from the typeinfo) is that we can
+ * have relationships between these nodes. */
+ typedef vector<Relation *> Relations;
+
+ const char *name; /* Identifier - mainly for debugging purposes. */
+ NodeType type; /* Structural type of node. */
+ Relations inlinks; /* Nodes which this one depends on. */
+ Relations outlinks; /* Nodes which depend on this one. */
+ Stats stats; /* Evaluation statistics. */
+
+ /* Generic tags for traversal algorithms and such.
+ *
+ * Actual meaning of values depends on a specific area. Every area is to
+ * clean this before use. */
+ int custom_flags;
+
+ /* Methods. */
+ Node();
+ virtual ~Node();
+
+ virtual string identifier() const;
+
+ virtual void init(const ID * /*id*/, const char * /*subdata*/) {}
+
+ virtual void tag_update(Depsgraph * /*graph*/, eUpdateSource /*source*/) {}
+
+ virtual OperationNode *get_entry_operation() { return NULL; }
+ virtual OperationNode *get_exit_operation() { return NULL; }
+
+ virtual NodeClass get_class() const;
+};
+
+/* Macros for common static typeinfo. */
+#define DEG_DEPSNODE_DECLARE \
+ static const Node::TypeInfo typeinfo
+#define DEG_DEPSNODE_DEFINE(NodeType, type_, tname_) \
+ const Node::TypeInfo NodeType::typeinfo = Node::TypeInfo(type_, tname_)
+
+void deg_register_base_depsnodes();
+
+} // namespace DEG
diff --git a/source/blender/depsgraph/intern/nodes/deg_node_component.cc b/source/blender/depsgraph/intern/node/deg_node_component.cc
index 5037513d1a2..b0246295dbb 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node_component.cc
+++ b/source/blender/depsgraph/intern/node/deg_node_component.cc
@@ -24,11 +24,11 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/nodes/deg_node_component.cc
+/** \file blender/depsgraph/intern/node/deg_node_component.cc
* \ingroup depsgraph
*/
-#include "intern/nodes/deg_node_component.h"
+#include "intern/node/deg_node_component.h"
#include <stdio.h>
#include <cstring> /* required for STREQ later on. */
@@ -42,10 +42,9 @@ extern "C" {
#include "BKE_action.h"
} /* extern "C" */
-#include "intern/nodes/deg_node_id.h"
-#include "intern/nodes/deg_node_operation.h"
-#include "intern/depsgraph_intern.h"
-#include "util/deg_util_foreach.h"
+#include "intern/node/deg_node_id.h"
+#include "intern/node/deg_node_factory.h"
+#include "intern/node/deg_node_operation.h"
namespace DEG {
@@ -54,21 +53,21 @@ namespace DEG {
/* Standard Component Methods ============================= */
-ComponentDepsNode::OperationIDKey::OperationIDKey()
- : opcode(DEG_OPCODE_OPERATION),
+ComponentNode::OperationIDKey::OperationIDKey()
+ : opcode(OperationCode::OPERATION),
name(""),
name_tag(-1)
{
}
-ComponentDepsNode::OperationIDKey::OperationIDKey(eDepsOperation_Code opcode)
+ComponentNode::OperationIDKey::OperationIDKey(OperationCode opcode)
: opcode(opcode),
name(""),
name_tag(-1)
{
}
-ComponentDepsNode::OperationIDKey::OperationIDKey(eDepsOperation_Code opcode,
+ComponentNode::OperationIDKey::OperationIDKey(OperationCode opcode,
const char *name,
int name_tag)
: opcode(opcode),
@@ -77,14 +76,13 @@ ComponentDepsNode::OperationIDKey::OperationIDKey(eDepsOperation_Code opcode,
{
}
-string ComponentDepsNode::OperationIDKey::identifier() const
+string ComponentNode::OperationIDKey::identifier() const
{
- char codebuf[5];
- BLI_snprintf(codebuf, sizeof(codebuf), "%d", opcode);
- return string("OperationIDKey(") + codebuf + ", " + name + ")";
+ const string codebuf = to_string(static_cast<int>(opcode));
+ return "OperationIDKey(" + codebuf + ", " + name + ")";
}
-bool ComponentDepsNode::OperationIDKey::operator==(
+bool ComponentNode::OperationIDKey::operator==(
const OperationIDKey &other) const
{
return (opcode == other.opcode) &&
@@ -94,35 +92,36 @@ bool ComponentDepsNode::OperationIDKey::operator==(
static unsigned int comp_node_hash_key(const void *key_v)
{
- const ComponentDepsNode::OperationIDKey *key =
- reinterpret_cast<const ComponentDepsNode::OperationIDKey *>(key_v);
- return BLI_ghashutil_combine_hash(BLI_ghashutil_uinthash(key->opcode),
+ const ComponentNode::OperationIDKey *key =
+ reinterpret_cast<const ComponentNode::OperationIDKey *>(key_v);
+ int opcode_as_int = static_cast<int>(key->opcode);
+ return BLI_ghashutil_combine_hash(BLI_ghashutil_uinthash(opcode_as_int),
BLI_ghashutil_strhash_p(key->name));
}
static bool comp_node_hash_key_cmp(const void *a, const void *b)
{
- const ComponentDepsNode::OperationIDKey *key_a =
- reinterpret_cast<const ComponentDepsNode::OperationIDKey *>(a);
- const ComponentDepsNode::OperationIDKey *key_b =
- reinterpret_cast<const ComponentDepsNode::OperationIDKey *>(b);
+ const ComponentNode::OperationIDKey *key_a =
+ reinterpret_cast<const ComponentNode::OperationIDKey *>(a);
+ const ComponentNode::OperationIDKey *key_b =
+ reinterpret_cast<const ComponentNode::OperationIDKey *>(b);
return !(*key_a == *key_b);
}
static void comp_node_hash_key_free(void *key_v)
{
- typedef ComponentDepsNode::OperationIDKey OperationIDKey;
+ typedef ComponentNode::OperationIDKey OperationIDKey;
OperationIDKey *key = reinterpret_cast<OperationIDKey *>(key_v);
OBJECT_GUARDED_DELETE(key, OperationIDKey);
}
static void comp_node_hash_value_free(void *value_v)
{
- OperationDepsNode *op_node = reinterpret_cast<OperationDepsNode *>(value_v);
- OBJECT_GUARDED_DELETE(op_node, OperationDepsNode);
+ OperationNode *op_node = reinterpret_cast<OperationNode *>(value_v);
+ OBJECT_GUARDED_DELETE(op_node, OperationNode);
}
-ComponentDepsNode::ComponentDepsNode() :
+ComponentNode::ComponentNode() :
entry_operation(NULL),
exit_operation(NULL),
affects_directly_visible(false)
@@ -133,7 +132,7 @@ ComponentDepsNode::ComponentDepsNode() :
}
/* Initialize 'component' node - from pointer data given */
-void ComponentDepsNode::init(const ID * /*id*/,
+void ComponentNode::init(const ID * /*id*/,
const char * /*subdata*/)
{
/* hook up eval context? */
@@ -141,7 +140,7 @@ void ComponentDepsNode::init(const ID * /*id*/,
}
/* Free 'component' node */
-ComponentDepsNode::~ComponentDepsNode()
+ComponentNode::~ComponentNode()
{
clear_operations();
if (operations_map != NULL) {
@@ -151,28 +150,25 @@ ComponentDepsNode::~ComponentDepsNode()
}
}
-string ComponentDepsNode::identifier() const
+string ComponentNode::identifier() const
{
- string idname = this->owner->name;
-
- char typebuf[16];
- sprintf(typebuf, "(%d)", type);
-
- return string(typebuf) + name + " : " + idname +
+ const string idname = this->owner->name;
+ const string typebuf = "" + to_string(static_cast<int>(type)) + ")";
+ return typebuf + name + " : " + idname +
"( affects_directly_visible: " +
(affects_directly_visible ? "true"
: "false") + ")";
;
}
-OperationDepsNode *ComponentDepsNode::find_operation(OperationIDKey key) const
+OperationNode *ComponentNode::find_operation(OperationIDKey key) const
{
- OperationDepsNode *node = NULL;
+ OperationNode *node = NULL;
if (operations_map != NULL) {
- node = (OperationDepsNode *)BLI_ghash_lookup(operations_map, &key);
+ node = (OperationNode *)BLI_ghash_lookup(operations_map, &key);
}
else {
- foreach (OperationDepsNode *op_node, operations) {
+ for (OperationNode *op_node : operations) {
if (op_node->opcode == key.opcode &&
op_node->name_tag == key.name_tag &&
STREQ(op_node->name, key.name))
@@ -185,7 +181,7 @@ OperationDepsNode *ComponentDepsNode::find_operation(OperationIDKey key) const
return node;
}
-OperationDepsNode *ComponentDepsNode::find_operation(eDepsOperation_Code opcode,
+OperationNode *ComponentNode::find_operation(OperationCode opcode,
const char *name,
int name_tag) const
{
@@ -193,9 +189,9 @@ OperationDepsNode *ComponentDepsNode::find_operation(eDepsOperation_Code opcode,
return find_operation(key);
}
-OperationDepsNode *ComponentDepsNode::get_operation(OperationIDKey key) const
+OperationNode *ComponentNode::get_operation(OperationIDKey key) const
{
- OperationDepsNode *node = find_operation(key);
+ OperationNode *node = find_operation(key);
if (node == NULL) {
fprintf(stderr, "%s: find_operation(%s) failed\n",
this->identifier().c_str(), key.identifier().c_str());
@@ -205,7 +201,7 @@ OperationDepsNode *ComponentDepsNode::get_operation(OperationIDKey key) const
return node;
}
-OperationDepsNode *ComponentDepsNode::get_operation(eDepsOperation_Code opcode,
+OperationNode *ComponentNode::get_operation(OperationCode opcode,
const char *name,
int name_tag) const
{
@@ -213,12 +209,12 @@ OperationDepsNode *ComponentDepsNode::get_operation(eDepsOperation_Code opcode,
return get_operation(key);
}
-bool ComponentDepsNode::has_operation(OperationIDKey key) const
+bool ComponentNode::has_operation(OperationIDKey key) const
{
return find_operation(key) != NULL;
}
-bool ComponentDepsNode::has_operation(eDepsOperation_Code opcode,
+bool ComponentNode::has_operation(OperationCode opcode,
const char *name,
int name_tag) const
{
@@ -226,15 +222,15 @@ bool ComponentDepsNode::has_operation(eDepsOperation_Code opcode,
return has_operation(key);
}
-OperationDepsNode *ComponentDepsNode::add_operation(const DepsEvalOperationCb& op,
- eDepsOperation_Code opcode,
+OperationNode *ComponentNode::add_operation(const DepsEvalOperationCb& op,
+ OperationCode opcode,
const char *name,
int name_tag)
{
- OperationDepsNode *op_node = find_operation(opcode, name, name_tag);
+ OperationNode *op_node = find_operation(opcode, name, name_tag);
if (!op_node) {
- DepsNodeFactory *factory = deg_type_get_factory(DEG_NODE_TYPE_OPERATION);
- op_node = (OperationDepsNode *)factory->create_node(this->owner->id_orig, "", name);
+ DepsNodeFactory *factory = type_get_factory(NodeType::OPERATION);
+ op_node = (OperationNode *)factory->create_node(this->owner->id_orig, "", name);
/* register opnode in this component's operation set */
OperationIDKey *key = OBJECT_GUARDED_NEW(OperationIDKey, opcode, name, name_tag);
@@ -258,43 +254,43 @@ OperationDepsNode *ComponentDepsNode::add_operation(const DepsEvalOperationCb& o
return op_node;
}
-void ComponentDepsNode::set_entry_operation(OperationDepsNode *op_node)
+void ComponentNode::set_entry_operation(OperationNode *op_node)
{
BLI_assert(entry_operation == NULL);
entry_operation = op_node;
}
-void ComponentDepsNode::set_exit_operation(OperationDepsNode *op_node)
+void ComponentNode::set_exit_operation(OperationNode *op_node)
{
BLI_assert(exit_operation == NULL);
exit_operation = op_node;
}
-void ComponentDepsNode::clear_operations()
+void ComponentNode::clear_operations()
{
if (operations_map != NULL) {
BLI_ghash_clear(operations_map,
comp_node_hash_key_free,
comp_node_hash_value_free);
}
- foreach (OperationDepsNode *op_node, operations) {
- OBJECT_GUARDED_DELETE(op_node, OperationDepsNode);
+ for (OperationNode *op_node : operations) {
+ OBJECT_GUARDED_DELETE(op_node, OperationNode);
}
operations.clear();
}
-void ComponentDepsNode::tag_update(Depsgraph *graph, eUpdateSource source)
+void ComponentNode::tag_update(Depsgraph *graph, eUpdateSource source)
{
- OperationDepsNode *entry_op = get_entry_operation();
+ OperationNode *entry_op = get_entry_operation();
if (entry_op != NULL && entry_op->flag & DEPSOP_FLAG_NEEDS_UPDATE) {
return;
}
- foreach (OperationDepsNode *op_node, operations) {
+ for (OperationNode *op_node : operations) {
op_node->tag_update(graph, source);
}
// It is possible that tag happens before finalization.
if (operations_map != NULL) {
- GHASH_FOREACH_BEGIN(OperationDepsNode *, op_node, operations_map)
+ GHASH_FOREACH_BEGIN(OperationNode *, op_node, operations_map)
{
op_node->tag_update(graph, source);
}
@@ -302,15 +298,15 @@ void ComponentDepsNode::tag_update(Depsgraph *graph, eUpdateSource source)
}
}
-OperationDepsNode *ComponentDepsNode::get_entry_operation()
+OperationNode *ComponentNode::get_entry_operation()
{
if (entry_operation) {
return entry_operation;
}
else if (operations_map != NULL && BLI_ghash_len(operations_map) == 1) {
- OperationDepsNode *op_node = NULL;
+ OperationNode *op_node = NULL;
/* TODO(sergey): This is somewhat slow. */
- GHASH_FOREACH_BEGIN(OperationDepsNode *, tmp, operations_map)
+ GHASH_FOREACH_BEGIN(OperationNode *, tmp, operations_map)
{
op_node = tmp;
}
@@ -325,15 +321,15 @@ OperationDepsNode *ComponentDepsNode::get_entry_operation()
return NULL;
}
-OperationDepsNode *ComponentDepsNode::get_exit_operation()
+OperationNode *ComponentNode::get_exit_operation()
{
if (exit_operation) {
return exit_operation;
}
else if (operations_map != NULL && BLI_ghash_len(operations_map) == 1) {
- OperationDepsNode *op_node = NULL;
+ OperationNode *op_node = NULL;
/* TODO(sergey): This is somewhat slow. */
- GHASH_FOREACH_BEGIN(OperationDepsNode *, tmp, operations_map)
+ GHASH_FOREACH_BEGIN(OperationNode *, tmp, operations_map)
{
op_node = tmp;
}
@@ -348,10 +344,10 @@ OperationDepsNode *ComponentDepsNode::get_exit_operation()
return NULL;
}
-void ComponentDepsNode::finalize_build(Depsgraph * /*graph*/)
+void ComponentNode::finalize_build(Depsgraph * /*graph*/)
{
operations.reserve(BLI_ghash_len(operations_map));
- GHASH_FOREACH_BEGIN(OperationDepsNode *, op_node, operations_map)
+ GHASH_FOREACH_BEGIN(OperationNode *, op_node, operations_map)
{
operations.push_back(op_node);
}
@@ -365,15 +361,14 @@ void ComponentDepsNode::finalize_build(Depsgraph * /*graph*/)
/* Bone Component ========================================= */
/* Initialize 'bone component' node - from pointer data given */
-void BoneComponentDepsNode::init(const ID *id, const char *subdata)
+void BoneComponentNode::init(const ID *id, const char *subdata)
{
/* generic component-node... */
- ComponentDepsNode::init(id, subdata);
+ ComponentNode::init(id, subdata);
/* name of component comes is bone name */
/* TODO(sergey): This sets name to an empty string because subdata is
- * empty. Is it a bug?
- */
+ * empty. Is it a bug? */
//this->name = subdata;
/* bone-specific node data */
@@ -410,27 +405,27 @@ DEG_COMPONENT_NODE_DEFINE(GenericDatablock, GENERIC_DATABLOCK, 0);
void deg_register_component_depsnodes()
{
- deg_register_node_typeinfo(&DNTI_ANIMATION);
- deg_register_node_typeinfo(&DNTI_BONE);
- deg_register_node_typeinfo(&DNTI_CACHE);
- deg_register_node_typeinfo(&DNTI_BATCH_CACHE);
- deg_register_node_typeinfo(&DNTI_COPY_ON_WRITE);
- deg_register_node_typeinfo(&DNTI_GEOMETRY);
- deg_register_node_typeinfo(&DNTI_LAYER_COLLECTIONS);
- deg_register_node_typeinfo(&DNTI_PARAMETERS);
- deg_register_node_typeinfo(&DNTI_PARTICLE_SYSTEM);
- deg_register_node_typeinfo(&DNTI_PARTICLE_SETTINGS);
- deg_register_node_typeinfo(&DNTI_POINT_CACHE);
- deg_register_node_typeinfo(&DNTI_PROXY);
- deg_register_node_typeinfo(&DNTI_EVAL_POSE);
- deg_register_node_typeinfo(&DNTI_SEQUENCER);
- deg_register_node_typeinfo(&DNTI_SHADING);
- deg_register_node_typeinfo(&DNTI_SHADING_PARAMETERS);
- deg_register_node_typeinfo(&DNTI_TRANSFORM);
- deg_register_node_typeinfo(&DNTI_OBJECT_FROM_LAYER);
- deg_register_node_typeinfo(&DNTI_DUPLI);
- deg_register_node_typeinfo(&DNTI_SYNCHRONIZE);
- deg_register_node_typeinfo(&DNTI_GENERIC_DATABLOCK);
+ register_node_typeinfo(&DNTI_ANIMATION);
+ register_node_typeinfo(&DNTI_BONE);
+ register_node_typeinfo(&DNTI_CACHE);
+ register_node_typeinfo(&DNTI_BATCH_CACHE);
+ register_node_typeinfo(&DNTI_COPY_ON_WRITE);
+ register_node_typeinfo(&DNTI_GEOMETRY);
+ register_node_typeinfo(&DNTI_LAYER_COLLECTIONS);
+ register_node_typeinfo(&DNTI_PARAMETERS);
+ register_node_typeinfo(&DNTI_PARTICLE_SYSTEM);
+ register_node_typeinfo(&DNTI_PARTICLE_SETTINGS);
+ register_node_typeinfo(&DNTI_POINT_CACHE);
+ register_node_typeinfo(&DNTI_PROXY);
+ register_node_typeinfo(&DNTI_EVAL_POSE);
+ register_node_typeinfo(&DNTI_SEQUENCER);
+ register_node_typeinfo(&DNTI_SHADING);
+ register_node_typeinfo(&DNTI_SHADING_PARAMETERS);
+ register_node_typeinfo(&DNTI_TRANSFORM);
+ register_node_typeinfo(&DNTI_OBJECT_FROM_LAYER);
+ register_node_typeinfo(&DNTI_DUPLI);
+ register_node_typeinfo(&DNTI_SYNCHRONIZE);
+ register_node_typeinfo(&DNTI_GENERIC_DATABLOCK);
}
} // namespace DEG
diff --git a/source/blender/depsgraph/intern/nodes/deg_node_component.h b/source/blender/depsgraph/intern/node/deg_node_component.h
index f767faaeef3..7d81b5470d7 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node_component.h
+++ b/source/blender/depsgraph/intern/node/deg_node_component.h
@@ -24,13 +24,14 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/nodes/deg_node_component.h
+/** \file blender/depsgraph/intern/node/deg_node_component.h
* \ingroup depsgraph
*/
#pragma once
-#include "intern/nodes/deg_node.h"
+#include "intern/node/deg_node.h"
+#include "intern/node/deg_node_operation.h"
#include "BLI_utildefines.h"
#include "BLI_string.h"
@@ -41,23 +42,23 @@ struct bPoseChannel;
namespace DEG {
-struct BoneComponentDepsNode;
+struct BoneComponentNode;
struct Depsgraph;
-struct IDDepsNode;
-struct OperationDepsNode;
+struct IDNode;
+struct OperationNode;
/* ID Component - Base type for all components */
-struct ComponentDepsNode : public DepsNode {
+struct ComponentNode : public Node {
/* Key used to look up operations within a component */
struct OperationIDKey
{
- eDepsOperation_Code opcode;
+ OperationCode opcode;
const char *name;
int name_tag;
OperationIDKey();
- OperationIDKey(eDepsOperation_Code opcode);
- OperationIDKey(eDepsOperation_Code opcode,
+ OperationIDKey(OperationCode opcode);
+ OperationIDKey(OperationCode opcode,
const char *name,
int name_tag);
@@ -66,30 +67,29 @@ struct ComponentDepsNode : public DepsNode {
};
/* Typedef for container of operations */
- ComponentDepsNode();
- ~ComponentDepsNode();
+ ComponentNode();
+ ~ComponentNode();
void init(const ID *id, const char *subdata) override;
virtual string identifier() const override;
/* Find an existing operation, if requested operation does not exist
- * NULL will be returned.
- */
- OperationDepsNode *find_operation(OperationIDKey key) const;
- OperationDepsNode *find_operation(eDepsOperation_Code opcode,
+ * NULL will be returned. */
+ OperationNode *find_operation(OperationIDKey key) const;
+ OperationNode *find_operation(OperationCode opcode,
const char *name,
int name_tag) const;
/* Find an existing operation, will throw an assert() if it does not exist. */
- OperationDepsNode *get_operation(OperationIDKey key) const;
- OperationDepsNode *get_operation(eDepsOperation_Code opcode,
+ OperationNode *get_operation(OperationIDKey key) const;
+ OperationNode *get_operation(OperationCode opcode,
const char *name,
int name_tag) const;
/* Check operation exists and return it. */
bool has_operation(OperationIDKey key) const;
- bool has_operation(eDepsOperation_Code opcode,
+ bool has_operation(OperationCode opcode,
const char *name,
int name_tag) const;
@@ -104,82 +104,77 @@ struct ComponentDepsNode : public DepsNode {
* \param optype: Role that operation plays within component
* (i.e. where in eval process)
* \param op: The operation to perform
- * \param name: Identifier for operation - used to find/locate it again
- */
- OperationDepsNode *add_operation(const DepsEvalOperationCb& op,
- eDepsOperation_Code opcode,
+ * \param name: Identifier for operation - used to find/locate it again */
+ OperationNode *add_operation(const DepsEvalOperationCb& op,
+ OperationCode opcode,
const char *name,
int name_tag);
/* Entry/exit operations management.
*
- * Use those instead of direct set since this will perform sanity checks.
- */
- void set_entry_operation(OperationDepsNode *op_node);
- void set_exit_operation(OperationDepsNode *op_node);
+ * Use those instead of direct set since this will perform sanity checks. */
+ void set_entry_operation(OperationNode *op_node);
+ void set_exit_operation(OperationNode *op_node);
void clear_operations();
virtual void tag_update(Depsgraph *graph, eUpdateSource source) override;
- virtual OperationDepsNode *get_entry_operation() override;
- virtual OperationDepsNode *get_exit_operation() override;
+ virtual OperationNode *get_entry_operation() override;
+ virtual OperationNode *get_exit_operation() override;
void finalize_build(Depsgraph *graph);
- IDDepsNode *owner;
+ IDNode *owner;
/* ** Inner nodes for this component ** */
/* Operations stored as a hash map, for faster build.
- * This hash map will be freed when graph is fully built.
- */
+ * This hash map will be freed when graph is fully built. */
GHash *operations_map;
/* This is a "normal" list of operations, used by evaluation
- * and other routines after construction.
- */
- vector<OperationDepsNode *> operations;
+ * and other routines after construction. */
+ vector<OperationNode *> operations;
- OperationDepsNode *entry_operation;
- OperationDepsNode *exit_operation;
+ OperationNode *entry_operation;
+ OperationNode *exit_operation;
virtual bool depends_on_cow() { return true; }
/* Denotes whether COW component is to be tagged when this component
- * is tagged for update.
- */
+ * is tagged for update. */
virtual bool need_tag_cow_before_update() { return true; }
/* Denotes whether this component affects (possibly indirectly) on a
- * directly visible object.
- */
+ * directly visible object. */
bool affects_directly_visible;
};
/* ---------------------------------------- */
-#define DEG_COMPONENT_NODE_DEFINE_TYPEINFO(NodeType, type_, tname_, id_recalc_tag) \
- const DepsNode::TypeInfo NodeType::typeinfo = \
- DepsNode::TypeInfo(type_, tname_, id_recalc_tag)
+#define DEG_COMPONENT_NODE_DEFINE_TYPEINFO(\
+ NodeType, type_, type_name_, id_recalc_tag) \
+ const Node::TypeInfo NodeType::typeinfo = \
+ Node::TypeInfo(type_, type_name_, id_recalc_tag)
#define DEG_COMPONENT_NODE_DECLARE DEG_DEPSNODE_DECLARE
#define DEG_COMPONENT_NODE_DEFINE(name, NAME, id_recalc_tag) \
- DEG_COMPONENT_NODE_DEFINE_TYPEINFO(name ## ComponentDepsNode, \
- DEG_NODE_TYPE_ ## NAME, \
+ DEG_COMPONENT_NODE_DEFINE_TYPEINFO(name ## ComponentNode, \
+ NodeType:: NAME, \
#name " Component", \
id_recalc_tag) ; \
- static DepsNodeFactoryImpl<name ## ComponentDepsNode> DNTI_ ## NAME
+ static DepsNodeFactoryImpl<name ## ComponentNode> DNTI_ ## NAME
#define DEG_COMPONENT_NODE_DECLARE_GENERIC(name) \
- struct name ## ComponentDepsNode : public ComponentDepsNode { \
+ struct name ## ComponentNode : public ComponentNode { \
DEG_COMPONENT_NODE_DECLARE; \
}
-#define DEG_COMPONENT_NODE_DECLARE_NO_COW_TAG_ON_UPDATE(name) \
- struct name ## ComponentDepsNode : public ComponentDepsNode { \
- DEG_COMPONENT_NODE_DECLARE; \
+#define DEG_COMPONENT_NODE_DECLARE_NO_COW_TAG_ON_UPDATE(name) \
+ struct name ## ComponentNode : public ComponentNode { \
+ DEG_COMPONENT_NODE_DECLARE; \
virtual bool need_tag_cow_before_update() { return false; } \
}
@@ -205,7 +200,7 @@ DEG_COMPONENT_NODE_DECLARE_GENERIC(Synchronize);
DEG_COMPONENT_NODE_DECLARE_GENERIC(GenericDatablock);
/* Bone Component */
-struct BoneComponentDepsNode : public ComponentDepsNode {
+struct BoneComponentNode : public ComponentNode {
void init(const ID *id, const char *subdata);
struct bPoseChannel *pchan; /* the bone that this component represents */
diff --git a/source/blender/depsgraph/intern/node/deg_node_factory.cc b/source/blender/depsgraph/intern/node/deg_node_factory.cc
new file mode 100644
index 00000000000..f5cfe594d66
--- /dev/null
+++ b/source/blender/depsgraph/intern/node/deg_node_factory.cc
@@ -0,0 +1,53 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2019 Blender Foundation.
+ * All rights reserved.
+ *
+ * Original Author: Joshua Leung
+ * Contributor(s): None Yet
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/depsgraph/intern/node/deh_node_factory.cc
+ * \ingroup depsgraph
+ */
+
+#include "intern/node/deg_node_factory.h"
+
+namespace DEG {
+
+/* Global type registry */
+static DepsNodeFactory *
+node_typeinfo_registry[static_cast<int>(NodeType::NUM_TYPES)] = {NULL};
+
+void register_node_typeinfo(DepsNodeFactory *factory)
+{
+ BLI_assert(factory != NULL);
+ const int type_as_int = static_cast<int>(factory->type());
+ node_typeinfo_registry[type_as_int] = factory;
+}
+
+DepsNodeFactory *type_get_factory(const NodeType type)
+{
+ /* Look up type - at worst, it doesn't exist in table yet, and we fail. */
+ const int type_as_int = static_cast<int>(type);
+ return node_typeinfo_registry[type_as_int];
+}
+
+} // namespace DEG
diff --git a/source/blender/depsgraph/intern/node/deg_node_factory.h b/source/blender/depsgraph/intern/node/deg_node_factory.h
new file mode 100644
index 00000000000..a755ffa71a1
--- /dev/null
+++ b/source/blender/depsgraph/intern/node/deg_node_factory.h
@@ -0,0 +1,73 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2019 Blender Foundation.
+ * All rights reserved.
+ *
+ * Original Author: Joshua Leung
+ * Contributor(s): None Yet
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/depsgraph/intern/node/deh_node_factory.h
+ * \ingroup depsgraph
+ */
+
+#pragma once
+
+#include "MEM_guardedalloc.h"
+
+#include "intern/node/deg_node.h"
+#include "intern/depsgraph_type.h"
+
+struct ID;
+
+namespace DEG {
+
+struct DepsNodeFactory {
+ virtual NodeType type() const = 0;
+ virtual const char *type_name() const = 0;
+
+ virtual int id_recalc_tag() const = 0;
+
+ virtual Node *create_node(const ID *id,
+ const char *subdata,
+ const char *name) const = 0;
+};
+
+template <class ModeObjectType>
+struct DepsNodeFactoryImpl : public DepsNodeFactory {
+ virtual NodeType type() const override;
+ virtual const char *type_name() const override;
+
+ virtual int id_recalc_tag() const override;
+
+ virtual Node *create_node(const ID *id,
+ const char *subdata,
+ const char *name) const override;
+};
+
+/* Register typeinfo */
+void register_node_typeinfo(DepsNodeFactory *factory);
+
+/* Get typeinfo for specified type */
+DepsNodeFactory *type_get_factory(const NodeType type);
+
+} // namespace DEG
+
+#include "intern/node/deg_node_factory_impl.h"
diff --git a/source/blender/depsgraph/intern/node/deg_node_factory_impl.h b/source/blender/depsgraph/intern/node/deg_node_factory_impl.h
new file mode 100644
index 00000000000..f6e93264cec
--- /dev/null
+++ b/source/blender/depsgraph/intern/node/deg_node_factory_impl.h
@@ -0,0 +1,73 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2019 Blender Foundation.
+ * All rights reserved.
+ *
+ * Original Author: Joshua Leung
+ * Contributor(s): None Yet
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/depsgraph/intern/node/deh_node_factory_impl.h
+ * \ingroup depsgraph
+ */
+
+#pragma once
+
+#include "intern/node/deg_node_factory.h"
+
+struct ID;
+
+namespace DEG {
+
+template <class ModeObjectType>
+NodeType DepsNodeFactoryImpl<ModeObjectType>::type() const
+{
+ return ModeObjectType::typeinfo.type;
+}
+
+template <class ModeObjectType>
+const char *DepsNodeFactoryImpl<ModeObjectType>::type_name() const {
+ return ModeObjectType::typeinfo.type_name;
+}
+
+template <class ModeObjectType>
+int DepsNodeFactoryImpl<ModeObjectType>::id_recalc_tag() const {
+ return ModeObjectType::typeinfo.id_recalc_tag;
+}
+
+template <class ModeObjectType>
+Node *DepsNodeFactoryImpl<ModeObjectType>::create_node(
+ const ID *id, const char *subdata, const char *name) const
+{
+ Node *node = OBJECT_GUARDED_NEW(ModeObjectType);
+ /* Populate base node settings. */
+ node->type = type();
+ /* Set name if provided, or use default type name. */
+ if (name[0] != '\0') {
+ node->name = name;
+ }
+ else {
+ node->name = type_name();
+ }
+ node->init(id, subdata);
+ return node;
+}
+
+} // namespace DEG
diff --git a/source/blender/depsgraph/intern/nodes/deg_node_id.cc b/source/blender/depsgraph/intern/node/deg_node_id.cc
index 4d7e191cba9..448f3384ab6 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node_id.cc
+++ b/source/blender/depsgraph/intern/node/deg_node_id.cc
@@ -24,17 +24,18 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/nodes/deg_node_id.cc
+/** \file blender/depsgraph/intern/node/deg_node_id.cc
* \ingroup depsgraph
*/
-#include "intern/nodes/deg_node_id.h"
+#include "intern/node/deg_node_id.h"
#include <stdio.h>
#include <cstring> /* required for STREQ later on. */
#include "BLI_utildefines.h"
#include "BLI_ghash.h"
+#include "BLI_string.h"
extern "C" {
#include "DNA_ID.h"
@@ -47,57 +48,68 @@ extern "C" {
#include "DEG_depsgraph.h"
#include "intern/eval/deg_eval_copy_on_write.h"
-#include "intern/nodes/deg_node_time.h"
-#include "intern/depsgraph_intern.h"
-
-#include "util/deg_util_foreach.h"
+#include "intern/node/deg_node_factory.h"
+#include "intern/node/deg_node_component.h"
+#include "intern/node/deg_node_time.h"
namespace DEG {
-IDDepsNode::ComponentIDKey::ComponentIDKey(eDepsNode_Type type,
+const char *linkedStateAsString(eDepsNode_LinkedState_Type linked_state)
+{
+ switch (linked_state) {
+ case DEG_ID_LINKED_INDIRECTLY: return "INDIRECTLY";
+ case DEG_ID_LINKED_VIA_SET: return "VIA_SET";
+ case DEG_ID_LINKED_DIRECTLY: return "DIRECTLY";
+ }
+ BLI_assert(!"Unhandled linked state, should never happen.");
+ return "UNKNOW";
+}
+
+IDNode::ComponentIDKey::ComponentIDKey(NodeType type,
const char *name)
: type(type), name(name)
{
}
-bool IDDepsNode::ComponentIDKey::operator== (const ComponentIDKey &other) const
+bool IDNode::ComponentIDKey::operator== (const ComponentIDKey &other) const
{
return type == other.type &&
- STREQ(name, other.name);
+ STREQ(name, other.name);
}
static unsigned int id_deps_node_hash_key(const void *key_v)
{
- const IDDepsNode::ComponentIDKey *key =
- reinterpret_cast<const IDDepsNode::ComponentIDKey *>(key_v);
- return BLI_ghashutil_combine_hash(BLI_ghashutil_uinthash(key->type),
+ const IDNode::ComponentIDKey *key =
+ reinterpret_cast<const IDNode::ComponentIDKey *>(key_v);
+ const int type_as_int = static_cast<int>(key->type);
+ return BLI_ghashutil_combine_hash(BLI_ghashutil_uinthash(type_as_int),
BLI_ghashutil_strhash_p(key->name));
}
static bool id_deps_node_hash_key_cmp(const void *a, const void *b)
{
- const IDDepsNode::ComponentIDKey *key_a =
- reinterpret_cast<const IDDepsNode::ComponentIDKey *>(a);
- const IDDepsNode::ComponentIDKey *key_b =
- reinterpret_cast<const IDDepsNode::ComponentIDKey *>(b);
+ const IDNode::ComponentIDKey *key_a =
+ reinterpret_cast<const IDNode::ComponentIDKey *>(a);
+ const IDNode::ComponentIDKey *key_b =
+ reinterpret_cast<const IDNode::ComponentIDKey *>(b);
return !(*key_a == *key_b);
}
static void id_deps_node_hash_key_free(void *key_v)
{
- typedef IDDepsNode::ComponentIDKey ComponentIDKey;
+ typedef IDNode::ComponentIDKey ComponentIDKey;
ComponentIDKey *key = reinterpret_cast<ComponentIDKey *>(key_v);
OBJECT_GUARDED_DELETE(key, ComponentIDKey);
}
static void id_deps_node_hash_value_free(void *value_v)
{
- ComponentDepsNode *comp_node = reinterpret_cast<ComponentDepsNode *>(value_v);
- OBJECT_GUARDED_DELETE(comp_node, ComponentDepsNode);
+ ComponentNode *comp_node = reinterpret_cast<ComponentNode *>(value_v);
+ OBJECT_GUARDED_DELETE(comp_node, ComponentNode);
}
/* Initialize 'id' node - from pointer data given. */
-void IDDepsNode::init(const ID *id, const char *UNUSED(subdata))
+void IDNode::init(const ID *id, const char *UNUSED(subdata))
{
BLI_assert(id != NULL);
/* Store ID-pointer. */
@@ -118,12 +130,11 @@ void IDDepsNode::init(const ID *id, const char *UNUSED(subdata))
"Depsgraph id components hash");
}
-void IDDepsNode::init_copy_on_write(ID *id_cow_hint)
+void IDNode::init_copy_on_write(ID *id_cow_hint)
{
/* Create pointer as early as possible, so we can use it for function
* bindings. Rest of data we'll be copying to the new datablock when
- * it is actually needed.
- */
+ * it is actually needed. */
if (id_cow_hint != NULL) {
// BLI_assert(deg_copy_on_write_is_needed(id_orig));
if (deg_copy_on_write_is_needed(id_orig)) {
@@ -145,12 +156,12 @@ void IDDepsNode::init_copy_on_write(ID *id_cow_hint)
}
/* Free 'id' node. */
-IDDepsNode::~IDDepsNode()
+IDNode::~IDNode()
{
destroy();
}
-void IDDepsNode::destroy()
+void IDNode::destroy()
{
if (id_orig == NULL) {
return;
@@ -173,7 +184,7 @@ void IDDepsNode::destroy()
id_orig = NULL;
}
-string IDDepsNode::identifier() const
+string IDNode::identifier() const
{
char orig_ptr[24], cow_ptr[24];
BLI_snprintf(orig_ptr, sizeof(orig_ptr), "%p", id_orig);
@@ -184,20 +195,20 @@ string IDDepsNode::identifier() const
: "false") + ")";
}
-ComponentDepsNode *IDDepsNode::find_component(eDepsNode_Type type,
+ComponentNode *IDNode::find_component(NodeType type,
const char *name) const
{
ComponentIDKey key(type, name);
- return reinterpret_cast<ComponentDepsNode *>(BLI_ghash_lookup(components, &key));
+ return reinterpret_cast<ComponentNode *>(BLI_ghash_lookup(components, &key));
}
-ComponentDepsNode *IDDepsNode::add_component(eDepsNode_Type type,
+ComponentNode *IDNode::add_component(NodeType type,
const char *name)
{
- ComponentDepsNode *comp_node = find_component(type, name);
+ ComponentNode *comp_node = find_component(type, name);
if (!comp_node) {
- DepsNodeFactory *factory = deg_type_get_factory(type);
- comp_node = (ComponentDepsNode *)factory->create_node(this->id_orig, "", name);
+ DepsNodeFactory *factory = type_get_factory(type);
+ comp_node = (ComponentNode *)factory->create_node(this->id_orig, "", name);
/* Register. */
ComponentIDKey *key = OBJECT_GUARDED_NEW(ComponentIDKey, type, name);
@@ -207,19 +218,19 @@ ComponentDepsNode *IDDepsNode::add_component(eDepsNode_Type type,
return comp_node;
}
-void IDDepsNode::tag_update(Depsgraph *graph, eUpdateSource source)
+void IDNode::tag_update(Depsgraph *graph, eUpdateSource source)
{
- GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, components)
+ GHASH_FOREACH_BEGIN(ComponentNode *, comp_node, components)
{
comp_node->tag_update(graph, source);
}
GHASH_FOREACH_END();
}
-void IDDepsNode::finalize_build(Depsgraph *graph)
+void IDNode::finalize_build(Depsgraph *graph)
{
/* Finalize build of all components. */
- GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, components)
+ GHASH_FOREACH_BEGIN(ComponentNode *, comp_node, components)
{
comp_node->finalize_build(graph);
}
@@ -227,14 +238,14 @@ void IDDepsNode::finalize_build(Depsgraph *graph)
visible_components_mask = get_visible_components_mask();
}
-IDComponentsMask IDDepsNode::get_visible_components_mask() const {
+IDComponentsMask IDNode::get_visible_components_mask() const {
IDComponentsMask result = 0;
- GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, components)
+ GHASH_FOREACH_BEGIN(ComponentNode *, comp_node, components)
{
if (comp_node->affects_directly_visible) {
- const int component_type = comp_node->type;
- BLI_assert(component_type < 64);
- result |= (1ULL << component_type);
+ const int component_type_as_int = static_cast<int>(comp_node->type);
+ BLI_assert(component_type_as_int < 64);
+ result |= (1ULL << component_type_as_int);
}
}
GHASH_FOREACH_END();
diff --git a/source/blender/depsgraph/intern/nodes/deg_node_id.h b/source/blender/depsgraph/intern/node/deg_node_id.h
index a0c5d2c2bd6..556f61a87e2 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node_id.h
+++ b/source/blender/depsgraph/intern/node/deg_node_id.h
@@ -24,41 +24,53 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file depsgraph/intern/nodes/deg_node_id.h
+/** \file depsgraph/intern/node/deg_node_id.h
* \ingroup depsgraph
*/
#pragma once
-#include "intern/nodes/deg_node.h"
+#include "intern/node/deg_node.h"
#include "BLI_sys_types.h"
namespace DEG {
-struct ComponentDepsNode;
+struct ComponentNode;
typedef uint64_t IDComponentsMask;
+/* NOTE: We use max comparison to mark an id node that is linked more than once
+ * So keep this enum ordered accordingly. */
+enum eDepsNode_LinkedState_Type {
+ /* Generic indirectly linked id node. */
+ DEG_ID_LINKED_INDIRECTLY = 0,
+ /* Id node present in the set (background) only. */
+ DEG_ID_LINKED_VIA_SET = 1,
+ /* Id node directly linked via the SceneLayer. */
+ DEG_ID_LINKED_DIRECTLY = 2,
+};
+const char *linkedStateAsString(eDepsNode_LinkedState_Type linked_state);
+
/* ID-Block Reference */
-struct IDDepsNode : public DepsNode {
+struct IDNode : public Node {
struct ComponentIDKey {
- ComponentIDKey(eDepsNode_Type type, const char *name = "");
+ ComponentIDKey(NodeType type, const char *name = "");
bool operator==(const ComponentIDKey &other) const;
- eDepsNode_Type type;
+ NodeType type;
const char *name;
};
virtual void init(const ID *id, const char *subdata) override;
void init_copy_on_write(ID *id_cow_hint = NULL);
- ~IDDepsNode();
+ ~IDNode();
void destroy();
virtual string identifier() const override;
- ComponentDepsNode *find_component(eDepsNode_Type type,
+ ComponentNode *find_component(NodeType type,
const char *name = "") const;
- ComponentDepsNode *add_component(eDepsNode_Type type,
+ ComponentNode *add_component(NodeType type,
const char *name = "");
virtual void tag_update(Depsgraph *graph, eUpdateSource source) override;
@@ -76,8 +88,7 @@ struct IDDepsNode : public DepsNode {
/* Additional flags needed for scene evaluation.
* TODO(sergey): Only needed for until really granular updates
- * of all the entities.
- */
+ * of all the entities. */
uint32_t eval_flags;
uint32_t previous_eval_flags;
@@ -91,7 +102,7 @@ struct IDDepsNode : public DepsNode {
bool is_directly_visible;
/* For the collection type of ID, denotes whether collection was fully
- * recursed into. */
+ * recursed into. */
bool is_collection_fully_expanded;
IDComponentsMask visible_components_mask;
diff --git a/source/blender/depsgraph/intern/node/deg_node_operation.cc b/source/blender/depsgraph/intern/node/deg_node_operation.cc
new file mode 100644
index 00000000000..17d80775d6f
--- /dev/null
+++ b/source/blender/depsgraph/intern/node/deg_node_operation.cc
@@ -0,0 +1,202 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2013 Blender Foundation.
+ * All rights reserved.
+ *
+ * Original Author: Joshua Leung
+ * Contributor(s): None Yet
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/depsgraph/intern/node/deg_node_operation.cc
+ * \ingroup depsgraph
+ */
+
+#include "intern/node/deg_node_operation.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_utildefines.h"
+#include "BLI_ghash.h"
+
+#include "intern/depsgraph.h"
+#include "intern/node/deg_node_factory.h"
+#include "intern/node/deg_node_component.h"
+#include "intern/node/deg_node_id.h"
+
+namespace DEG {
+
+const char *operationCodeAsString(OperationCode opcode)
+{
+ switch (opcode) {
+ /* Generic Operations. */
+ case OperationCode::OPERATION: return "OPERATION";
+ case OperationCode::ID_PROPERTY: return "ID_PROPERTY";
+ case OperationCode::PARAMETERS_EVAL: return "PARAMETERS_EVAL";
+ case OperationCode::PLACEHOLDER: return "PLACEHOLDER";
+ /* Animation, Drivers, etc. */
+ case OperationCode::ANIMATION: return "ANIMATION";
+ case OperationCode::DRIVER: return "DRIVER";
+ /* Object related. */
+ case OperationCode::OBJECT_BASE_FLAGS: return "OBJECT_BASE_FLAGS";
+ /* Transform. */
+ case OperationCode::TRANSFORM_LOCAL: return "TRANSFORM_LOCAL";
+ case OperationCode::TRANSFORM_PARENT: return "TRANSFORM_PARENT";
+ case OperationCode::TRANSFORM_CONSTRAINTS:
+ return "TRANSFORM_CONSTRAINTS";
+ case OperationCode::TRANSFORM_FINAL: return "TRANSFORM_FINAL";
+ case OperationCode::TRANSFORM_OBJECT_UBEREVAL:
+ return "TRANSFORM_OBJECT_UBEREVAL";
+ /* Rigid body. */
+ case OperationCode::RIGIDBODY_REBUILD: return "RIGIDBODY_REBUILD";
+ case OperationCode::RIGIDBODY_SIM: return "RIGIDBODY_SIM";
+ case OperationCode::RIGIDBODY_TRANSFORM_COPY:
+ return "RIGIDBODY_TRANSFORM_COPY";
+ /* Geometry. */
+ case OperationCode::GEOMETRY_UBEREVAL: return "GEOMETRY_UBEREVAL";
+ case OperationCode::GEOMETRY_SHAPEKEY: return "GEOMETRY_SHAPEKEY";
+ /* Object data. */
+ case OperationCode::LIGHT_PROBE_EVAL: return "LIGHT_PROBE_EVAL";
+ case OperationCode::SPEAKER_EVAL: return "SPEAKER_EVAL";
+ /* Pose. */
+ case OperationCode::POSE_INIT: return "POSE_INIT";
+ case OperationCode::POSE_INIT_IK: return "POSE_INIT_IK";
+ case OperationCode::POSE_CLEANUP: return "POSE_CLEANUP";
+ case OperationCode::POSE_DONE: return "POSE_DONE";
+ case OperationCode::POSE_IK_SOLVER: return "POSE_IK_SOLVER";
+ case OperationCode::POSE_SPLINE_IK_SOLVER:
+ return "POSE_SPLINE_IK_SOLVER";
+ /* Bone. */
+ case OperationCode::BONE_LOCAL: return "BONE_LOCAL";
+ case OperationCode::BONE_POSE_PARENT: return "BONE_POSE_PARENT";
+ case OperationCode::BONE_CONSTRAINTS: return "BONE_CONSTRAINTS";
+ case OperationCode::BONE_READY: return "BONE_READY";
+ case OperationCode::BONE_DONE: return "BONE_DONE";
+ case OperationCode::BONE_SEGMENTS: return "BONE_SEGMENTS";
+ /* Particle System. */
+ case OperationCode::PARTICLE_SYSTEM_INIT: return "PARTICLE_SYSTEM_INIT";
+ case OperationCode::PARTICLE_SYSTEM_EVAL: return "PARTICLE_SYSTEM_EVAL";
+ case OperationCode::PARTICLE_SYSTEM_DONE: return "PARTICLE_SYSTEM_DONE";
+ /* Particles Settings. */
+ case OperationCode::PARTICLE_SETTINGS_INIT:
+ return "PARTICLE_SETTINGS_INIT";
+ case OperationCode::PARTICLE_SETTINGS_EVAL:
+ return "PARTICLE_SETTINGS_EVAL";
+ case OperationCode::PARTICLE_SETTINGS_RESET:
+ return "PARTICLE_SETTINGS_RESET";
+ /* Point Cache. */
+ case OperationCode::POINT_CACHE_RESET: return "POINT_CACHE_RESET";
+ /* Batch cache. */
+ case OperationCode::GEOMETRY_SELECT_UPDATE:
+ return "GEOMETRY_SELECT_UPDATE";
+ /* Masks. */
+ case OperationCode::MASK_ANIMATION: return "MASK_ANIMATION";
+ case OperationCode::MASK_EVAL: return "MASK_EVAL";
+ /* Collections. */
+ case OperationCode::VIEW_LAYER_EVAL: return "VIEW_LAYER_EVAL";
+ /* Copy on write. */
+ case OperationCode::COPY_ON_WRITE: return "COPY_ON_WRITE";
+ /* Shading. */
+ case OperationCode::SHADING: return "SHADING";
+ case OperationCode::MATERIAL_UPDATE: return "MATERIAL_UPDATE";
+ case OperationCode::WORLD_UPDATE: return "WORLD_UPDATE";
+ /* Movie clip. */
+ case OperationCode::MOVIECLIP_EVAL: return "MOVIECLIP_EVAL";
+ case OperationCode::MOVIECLIP_SELECT_UPDATE:
+ return "MOVIECLIP_SELECT_UPDATE";
+ /* Synchronization. */
+ case OperationCode::SYNCHRONIZE_TO_ORIGINAL:
+ return "SYNCHRONIZE_TO_ORIGINAL";
+ /* Generic datablock. */
+ case OperationCode::GENERIC_DATABLOCK_UPDATE:
+ return "GENERIC_DATABLOCK_UPDATE";
+ }
+ BLI_assert(!"Unhandled operation code, should never happen.");
+ return "UNKNOWN";
+}
+
+OperationNode::OperationNode() :
+ name_tag(-1),
+ flag(0)
+{
+}
+
+OperationNode::~OperationNode()
+{
+}
+
+string OperationNode::identifier() const
+{
+ return string(operationCodeAsString(opcode)) + "(" + name + ")";
+}
+
+/* Full node identifier, including owner name.
+ * used for logging and debug prints. */
+string OperationNode::full_identifier() const
+{
+ string owner_str = "";
+ if (owner->type == NodeType::BONE) {
+ owner_str = string(owner->owner->name) + "." + owner->name;
+ }
+ else {
+ owner_str = owner->owner->name;
+ }
+ return owner_str + "." + identifier();
+}
+
+void OperationNode::tag_update(Depsgraph *graph, eUpdateSource source)
+{
+ if ((flag & DEPSOP_FLAG_NEEDS_UPDATE) == 0) {
+ graph->add_entry_tag(this);
+ }
+ /* Tag for update, but also note that this was the source of an update. */
+ flag |= (DEPSOP_FLAG_NEEDS_UPDATE | DEPSOP_FLAG_DIRECTLY_MODIFIED);
+ switch (source) {
+ case DEG_UPDATE_SOURCE_TIME:
+ case DEG_UPDATE_SOURCE_RELATIONS:
+ case DEG_UPDATE_SOURCE_VISIBILITY:
+ /* Currently nothing. */
+ break;
+ case DEG_UPDATE_SOURCE_USER_EDIT:
+ flag |= DEPSOP_FLAG_USER_MODIFIED;
+ break;
+ }
+}
+
+void OperationNode::set_as_entry()
+{
+ BLI_assert(owner != NULL);
+ owner->set_entry_operation(this);
+}
+
+void OperationNode::set_as_exit()
+{
+ BLI_assert(owner != NULL);
+ owner->set_exit_operation(this);
+}
+
+DEG_DEPSNODE_DEFINE(OperationNode, NodeType::OPERATION, "Operation");
+static DepsNodeFactoryImpl<OperationNode> DNTI_OPERATION;
+
+void deg_register_operation_depsnodes()
+{
+ register_node_typeinfo(&DNTI_OPERATION);
+}
+
+} // namespace DEG
diff --git a/source/blender/depsgraph/intern/node/deg_node_operation.h b/source/blender/depsgraph/intern/node/deg_node_operation.h
new file mode 100644
index 00000000000..30ed457e1f5
--- /dev/null
+++ b/source/blender/depsgraph/intern/node/deg_node_operation.h
@@ -0,0 +1,239 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2013 Blender Foundation.
+ * All rights reserved.
+ *
+ * Original Author: Joshua Leung
+ * Contributor(s): None Yet
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/depsgraph/intern/node/deg_node_operation.h
+ * \ingroup depsgraph
+ */
+
+#pragma once
+
+#include "intern/node/deg_node.h"
+
+#include "intern/depsgraph_type.h"
+
+struct ID;
+struct Depsgraph;
+
+namespace DEG {
+
+struct ComponentNode;
+
+/* Evaluation Operation for atomic operation */
+// XXX: move this to another header that can be exposed?
+typedef function<void(struct ::Depsgraph *)> DepsEvalOperationCb;
+
+/* Identifiers for common operations (as an enum). */
+enum class OperationCode {
+ /* Generic Operations. -------------------------------------------------- */
+
+ /* Placeholder for operations which don't need special mention */
+ OPERATION = 0,
+
+ /* Generic parameters evaluation. */
+ ID_PROPERTY,
+ PARAMETERS_EVAL,
+
+ // XXX: Placeholder while porting depsgraph code
+ PLACEHOLDER,
+
+ /* Animation, Drivers, etc. --------------------------------------------- */
+ /* NLA + Action */
+ ANIMATION,
+ /* Driver */
+ DRIVER,
+
+ /* Object related. ------------------------------------------------------ */
+ OBJECT_BASE_FLAGS,
+
+ /* Transform. ----------------------------------------------------------- */
+ /* Transform entry point - local transforms only */
+ TRANSFORM_LOCAL,
+ /* Parenting */
+ TRANSFORM_PARENT,
+ /* Constraints */
+ TRANSFORM_CONSTRAINTS,
+ /* Transform exit point */
+ TRANSFORM_FINAL,
+ /* Handle object-level updates, mainly proxies hacks and recalc flags. */
+ TRANSFORM_OBJECT_UBEREVAL,
+
+ /* Rigid body. ---------------------------------------------------------- */
+ /* Perform Simulation */
+ RIGIDBODY_REBUILD,
+ RIGIDBODY_SIM,
+ /* Copy results to object */
+ RIGIDBODY_TRANSFORM_COPY,
+
+ /* Geometry. ------------------------------------------------------------ */
+
+ /* Evaluate the whole geometry, including modifiers. */
+ GEOMETRY_UBEREVAL,
+ /* Evaluation of a shape key. */
+ GEOMETRY_SHAPEKEY,
+
+ /* Object data. --------------------------------------------------------- */
+ LIGHT_PROBE_EVAL,
+ SPEAKER_EVAL,
+
+ /* Pose. ---------------------------------------------------------------- */
+ /* Init pose, clear flags, etc. */
+ POSE_INIT,
+ /* Initialize IK solver related pose stuff. */
+ POSE_INIT_IK,
+ /* Pose is evaluated, and runtime data can be freed. */
+ POSE_CLEANUP,
+ /* Pose has been fully evaluated and ready to be used by others. */
+ POSE_DONE,
+ /* IK/Spline Solvers */
+ POSE_IK_SOLVER,
+ POSE_SPLINE_IK_SOLVER,
+
+ /* Bone. ---------------------------------------------------------------- */
+ /* Bone local transforms - entry point */
+ BONE_LOCAL,
+ /* Pose-space conversion (includes parent + restpose, */
+ BONE_POSE_PARENT,
+ /* Constraints */
+ BONE_CONSTRAINTS,
+ /* Bone transforms are ready
+ *
+ * - "READY" This (internal, noop is used to signal that all pre-IK
+ * operations are done. Its role is to help mediate situations
+ * where cyclic relations may otherwise form (i.e. one bone in
+ * chain targeting another in same chain,
+ *
+ * - "DONE" This noop is used to signal that the bone's final pose
+ * transform can be read by others. */
+ // TODO: deform mats could get calculated in the final_transform ops...
+ BONE_READY,
+ BONE_DONE,
+ /* B-Bone segment shape computation (after DONE) */
+ BONE_SEGMENTS,
+
+ /* Particle System. ----------------------------------------------------- */
+ PARTICLE_SYSTEM_INIT,
+ PARTICLE_SYSTEM_EVAL,
+ PARTICLE_SYSTEM_DONE,
+
+ /* Particle Settings. --------------------------------------------------- */
+ PARTICLE_SETTINGS_INIT,
+ PARTICLE_SETTINGS_EVAL,
+ PARTICLE_SETTINGS_RESET,
+
+ /* Point Cache. --------------------------------------------------------- */
+ POINT_CACHE_RESET,
+
+ /* Collections. --------------------------------------------------------- */
+ VIEW_LAYER_EVAL,
+
+ /* Copy on Write. ------------------------------------------------------- */
+ COPY_ON_WRITE,
+
+ /* Shading. ------------------------------------------------------------- */
+ SHADING,
+ MATERIAL_UPDATE,
+ WORLD_UPDATE,
+
+ /* Batch caches. -------------------------------------------------------- */
+ GEOMETRY_SELECT_UPDATE,
+
+ /* Masks. --------------------------------------------------------------- */
+ MASK_ANIMATION,
+ MASK_EVAL,
+
+ /* Movie clips. --------------------------------------------------------- */
+ MOVIECLIP_EVAL,
+ MOVIECLIP_SELECT_UPDATE,
+
+ /* Synchronization clips. ----------------------------------------------- */
+ SYNCHRONIZE_TO_ORIGINAL,
+
+ /* Generic datablock ---------------------------------------------------- */
+ GENERIC_DATABLOCK_UPDATE,
+};
+const char *operationCodeAsString(OperationCode opcode);
+
+/* Flags for Depsgraph Nodes.
+ * NOTE: IS a bit shifts to allow usage as an accumulated. bitmask.
+ */
+enum OperationFlag {
+ /* Node needs to be updated. */
+ DEPSOP_FLAG_NEEDS_UPDATE = (1 << 0),
+ /* Node was directly modified, causing need for update. */
+ DEPSOP_FLAG_DIRECTLY_MODIFIED = (1 << 1),
+ /* Node was updated due to user input. */
+ DEPSOP_FLAG_USER_MODIFIED = (1 << 2),
+
+ /* Set of flags which gets flushed along the relations. */
+ DEPSOP_FLAG_FLUSH = (DEPSOP_FLAG_USER_MODIFIED),
+};
+
+/* Atomic Operation - Base type for all operations */
+struct OperationNode : public Node {
+ OperationNode();
+ ~OperationNode();
+
+ virtual string identifier() const override;
+ string full_identifier() const;
+
+ virtual void tag_update(Depsgraph *graph, eUpdateSource source) override;
+
+ bool is_noop() const { return (bool)evaluate == false; }
+
+ virtual OperationNode *get_entry_operation() override {
+ return this;
+ }
+ virtual OperationNode *get_exit_operation() override {
+ return this;
+ }
+
+ /* Set this operation as component's entry/exit operation. */
+ void set_as_entry();
+ void set_as_exit();
+
+ /* Component that contains the operation. */
+ ComponentNode *owner;
+
+ /* Callback for operation. */
+ DepsEvalOperationCb evaluate;
+
+ /* How many inlinks are we still waiting on before we can be evaluated. */
+ uint32_t num_links_pending;
+ bool scheduled;
+
+ /* Identifier for the operation being performed. */
+ OperationCode opcode;
+ int name_tag;
+
+ /* (OperationFlag) extra settings affecting evaluation. */
+ int flag;
+
+ DEG_DEPSNODE_DECLARE;
+};
+
+void deg_register_operation_depsnodes();
+
+} // namespace DEG
diff --git a/source/blender/depsgraph/intern/nodes/deg_node_time.cc b/source/blender/depsgraph/intern/node/deg_node_time.cc
index 82f2c628b3e..df6b0ab2c7d 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node_time.cc
+++ b/source/blender/depsgraph/intern/node/deg_node_time.cc
@@ -24,23 +24,22 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/nodes/deg_node_time.cc
+/** \file blender/depsgraph/intern/node/deg_node_time.cc
* \ingroup depsgraph
*/
-#include "intern/nodes/deg_node_time.h"
-
-#include "intern/depsgraph_intern.h"
-#include "util/deg_util_foreach.h"
+#include "intern/node/deg_node_time.h"
#include "DNA_scene_types.h"
+#include "intern/depsgraph.h"
+
namespace DEG {
-void TimeSourceDepsNode::tag_update(Depsgraph *graph, eUpdateSource /*source*/)
+void TimeSourceNode::tag_update(Depsgraph *graph, eUpdateSource /*source*/)
{
- foreach (DepsRelation *rel, outlinks) {
- DepsNode *node = rel->to;
+ for (Relation *rel : outlinks) {
+ Node *node = rel->to;
node->tag_update(graph, DEG_UPDATE_SOURCE_TIME);
}
}
diff --git a/source/blender/depsgraph/intern/nodes/deg_node_time.h b/source/blender/depsgraph/intern/node/deg_node_time.h
index 392f4f3a95f..4b7ad676678 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node_time.h
+++ b/source/blender/depsgraph/intern/node/deg_node_time.h
@@ -24,18 +24,18 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file depsgraph/intern/nodes/deg_node_time.h
+/** \file depsgraph/intern/node/deg_node_time.h
* \ingroup depsgraph
*/
#pragma once
-#include "intern/nodes/deg_node.h"
+#include "intern/node/deg_node.h"
namespace DEG {
/* Time Source Node. */
-struct TimeSourceDepsNode : public DepsNode {
+struct TimeSourceNode : public Node {
/* New "current time". */
float cfra;
diff --git a/source/blender/depsgraph/intern/nodes/deg_node.cc b/source/blender/depsgraph/intern/nodes/deg_node.cc
deleted file mode 100644
index 3e2c48e9096..00000000000
--- a/source/blender/depsgraph/intern/nodes/deg_node.cc
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2013 Blender Foundation.
- * All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/depsgraph/intern/nodes/deg_node.cc
- * \ingroup depsgraph
- */
-
-#include "intern/nodes/deg_node.h"
-
-#include <stdio.h>
-
-#include "BLI_utildefines.h"
-
-#include "intern/eval/deg_eval_copy_on_write.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/depsgraph_intern.h"
-
-#include "util/deg_util_foreach.h"
-#include "util/deg_util_function.h"
-
-namespace DEG {
-
-/*******************************************************************************
- * Type information.
- */
-
-DepsNode::TypeInfo::TypeInfo(eDepsNode_Type type,
- const char *tname,
- int id_recalc_tag)
- : type(type),
- tname(tname),
- id_recalc_tag(id_recalc_tag)
-{
-}
-
-/*******************************************************************************
- * Evaluation statistics.
- */
-
-DepsNode::Stats::Stats()
-{
- reset();
-}
-
-void DepsNode::Stats::reset()
-{
- current_time = 0.0;
-}
-
-void DepsNode::Stats::reset_current()
-{
- current_time = 0.0;
-}
-
-/*******************************************************************************
- * Node itself.
- */
-
-DepsNode::DepsNode()
-{
- name = "";
-}
-
-DepsNode::~DepsNode()
-{
- /* Free links. */
- /* NOTE: We only free incoming links. This is to avoid double-free of links
- * when we're trying to free same link from both it's sides. We don't have
- * dangling links so this is not a problem from memory leaks point of view.
- */
- foreach (DepsRelation *rel, inlinks) {
- OBJECT_GUARDED_DELETE(rel, DepsRelation);
- }
-}
-
-
-/* Generic identifier for Depsgraph Nodes. */
-string DepsNode::identifier() const
-{
- return string(nodeTypeAsString(type)) + " : " + name;
-}
-
-eDepsNode_Class DepsNode::get_class() const {
- if (type == DEG_NODE_TYPE_OPERATION) {
- return DEG_NODE_CLASS_OPERATION;
- }
- else if (type < DEG_NODE_TYPE_PARAMETERS) {
- return DEG_NODE_CLASS_GENERIC;
- }
- else {
- return DEG_NODE_CLASS_COMPONENT;
- }
-}
-
-/*******************************************************************************
- * Generic nodes definition.
- */
-
-DEG_DEPSNODE_DEFINE(TimeSourceDepsNode, DEG_NODE_TYPE_TIMESOURCE, "Time Source");
-static DepsNodeFactoryImpl<TimeSourceDepsNode> DNTI_TIMESOURCE;
-
-DEG_DEPSNODE_DEFINE(IDDepsNode, DEG_NODE_TYPE_ID_REF, "ID Node");
-static DepsNodeFactoryImpl<IDDepsNode> DNTI_ID_REF;
-
-void deg_register_base_depsnodes()
-{
- deg_register_node_typeinfo(&DNTI_TIMESOURCE);
- deg_register_node_typeinfo(&DNTI_ID_REF);
-}
-
-} // namespace DEG
diff --git a/source/blender/depsgraph/intern/nodes/deg_node.h b/source/blender/depsgraph/intern/nodes/deg_node.h
deleted file mode 100644
index ba5d9bebd9c..00000000000
--- a/source/blender/depsgraph/intern/nodes/deg_node.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2013 Blender Foundation.
- * All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file depsgraph/intern/nodes/deg_node.h
- * \ingroup depsgraph
- */
-
-#pragma once
-
-#include "intern/depsgraph_types.h"
-
-#include "BLI_utildefines.h"
-
-struct GHash;
-struct ID;
-struct Scene;
-
-namespace DEG {
-
-struct DepsRelation;
-struct Depsgraph;
-struct OperationDepsNode;
-
-/* *********************************** */
-/* Base-Defines for Nodes in Depsgraph */
-
-/* All nodes in Depsgraph are descended from this. */
-struct DepsNode {
- /* Helper class for static typeinfo in subclasses. */
- struct TypeInfo {
- TypeInfo(eDepsNode_Type type, const char *tname, int id_recalc_tag = 0);
- eDepsNode_Type type;
- const char *tname;
- int id_recalc_tag;
- };
- struct Stats {
- Stats();
- /* Reset all the counters. Including all stats needed for average
- * evaluation time calculation.
- */
- void reset();
- /* Reset counters needed for the current graph evaluation, does not
- * touch averaging accumulators.
- */
- void reset_current();
- /* Time spend on this node during current graph evaluation. */
- double current_time;
- };
- /* Relationships between nodes
- * The reason why all depsgraph nodes are descended from this type (apart
- * from basic serialization benefits - from the typeinfo) is that we can have
- * relationships between these nodes!
- */
- typedef vector<DepsRelation *> Relations;
-
- const char *name; /* Identifier - mainly for debugging purposes. */
- eDepsNode_Type type; /* Structural type of node. */
- Relations inlinks; /* Nodes which this one depends on. */
- Relations outlinks; /* Nodes which depend on this one. */
- Stats stats; /* Evaluation statistics. */
-
- /* Generic tags for traversal algorithms and such.
- *
- * Actual meaning of values depends on a specific area. Every area is to
- * clean this before use.
- */
- int custom_flags;
-
- /* Methods. */
- DepsNode();
- virtual ~DepsNode();
-
- virtual string identifier() const;
-
- virtual void init(const ID * /*id*/,
- const char * /*subdata*/) {}
-
- virtual void tag_update(Depsgraph * /*graph*/, eUpdateSource /*source*/) {}
-
- virtual OperationDepsNode *get_entry_operation() { return NULL; }
- virtual OperationDepsNode *get_exit_operation() { return NULL; }
-
- virtual eDepsNode_Class get_class() const;
-};
-
-/* Macros for common static typeinfo. */
-#define DEG_DEPSNODE_DECLARE \
- static const DepsNode::TypeInfo typeinfo
-#define DEG_DEPSNODE_DEFINE(NodeType, type_, tname_) \
- const DepsNode::TypeInfo NodeType::typeinfo = DepsNode::TypeInfo(type_, tname_)
-
-void deg_register_base_depsnodes();
-
-} // namespace DEG
diff --git a/source/blender/depsgraph/intern/nodes/deg_node_operation.cc b/source/blender/depsgraph/intern/nodes/deg_node_operation.cc
deleted file mode 100644
index 3ad7ee8d093..00000000000
--- a/source/blender/depsgraph/intern/nodes/deg_node_operation.cc
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2013 Blender Foundation.
- * All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/depsgraph/intern/nodes/deg_node_operation.cc
- * \ingroup depsgraph
- */
-
-#include "intern/nodes/deg_node_operation.h"
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_utildefines.h"
-#include "BLI_ghash.h"
-
-#include "intern/depsgraph.h"
-#include "intern/depsgraph_intern.h"
-#include "intern/nodes/deg_node_id.h"
-
-namespace DEG {
-
-/* *********** */
-/* Inner Nodes */
-
-OperationDepsNode::OperationDepsNode() :
- name_tag(-1),
- flag(0)
-{
-}
-
-OperationDepsNode::~OperationDepsNode()
-{
-}
-
-string OperationDepsNode::identifier() const
-{
- return string(operationCodeAsString(opcode)) + "(" + name + ")";
-}
-
-/* Full node identifier, including owner name.
- * used for logging and debug prints.
- */
-string OperationDepsNode::full_identifier() const
-{
- string owner_str = "";
- if (owner->type == DEG_NODE_TYPE_BONE) {
- owner_str = string(owner->owner->name) + "." + owner->name;
- }
- else {
- owner_str = owner->owner->name;
- }
- return owner_str + "." + identifier();
-}
-
-void OperationDepsNode::tag_update(Depsgraph *graph, eUpdateSource source)
-{
- if ((flag & DEPSOP_FLAG_NEEDS_UPDATE) == 0) {
- graph->add_entry_tag(this);
- }
- /* Tag for update, but also note that this was the source of an update. */
- flag |= (DEPSOP_FLAG_NEEDS_UPDATE | DEPSOP_FLAG_DIRECTLY_MODIFIED);
- switch (source) {
- case DEG_UPDATE_SOURCE_TIME:
- case DEG_UPDATE_SOURCE_RELATIONS:
- case DEG_UPDATE_SOURCE_VISIBILITY:
- /* Currently nothing. */
- break;
- case DEG_UPDATE_SOURCE_USER_EDIT:
- flag |= DEPSOP_FLAG_USER_MODIFIED;
- break;
- }
-}
-
-void OperationDepsNode::set_as_entry()
-{
- BLI_assert(owner != NULL);
- owner->set_entry_operation(this);
-}
-
-void OperationDepsNode::set_as_exit()
-{
- BLI_assert(owner != NULL);
- owner->set_exit_operation(this);
-}
-
-DEG_DEPSNODE_DEFINE(OperationDepsNode, DEG_NODE_TYPE_OPERATION, "Operation");
-static DepsNodeFactoryImpl<OperationDepsNode> DNTI_OPERATION;
-
-void deg_register_operation_depsnodes()
-{
- deg_register_node_typeinfo(&DNTI_OPERATION);
-}
-
-} // namespace DEG
diff --git a/source/blender/depsgraph/intern/nodes/deg_node_operation.h b/source/blender/depsgraph/intern/nodes/deg_node_operation.h
deleted file mode 100644
index d7a0fa34c80..00000000000
--- a/source/blender/depsgraph/intern/nodes/deg_node_operation.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2013 Blender Foundation.
- * All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/depsgraph/intern/nodes/deg_node_operation.h
- * \ingroup depsgraph
- */
-
-#pragma once
-
-#include "intern/nodes/deg_node.h"
-
-struct ID;
-
-struct Depsgraph;
-
-namespace DEG {
-
-struct ComponentDepsNode;
-
-/* Flags for Depsgraph Nodes. */
-typedef enum eDepsOperation_Flag {
- /* Node needs to be updated. */
- DEPSOP_FLAG_NEEDS_UPDATE = (1 << 0),
- /* Node was directly modified, causing need for update. */
- DEPSOP_FLAG_DIRECTLY_MODIFIED = (1 << 1),
- /* Node was updated due to user input. */
- DEPSOP_FLAG_USER_MODIFIED = (1 << 2),
-
- /* Set of flags which gets flushed along the relations. */
- DEPSOP_FLAG_FLUSH = (DEPSOP_FLAG_USER_MODIFIED),
-} eDepsOperation_Flag;
-
-/* Atomic Operation - Base type for all operations */
-struct OperationDepsNode : public DepsNode {
- OperationDepsNode();
- ~OperationDepsNode();
-
- virtual string identifier() const override;
- string full_identifier() const;
-
- virtual void tag_update(Depsgraph *graph, eUpdateSource source) override;
-
- bool is_noop() const { return (bool)evaluate == false; }
-
- virtual OperationDepsNode *get_entry_operation() override {
- return this;
- }
- virtual OperationDepsNode *get_exit_operation() override {
- return this;
- }
-
- /* Set this operation as component's entry/exit operation. */
- void set_as_entry();
- void set_as_exit();
-
- /* Component that contains the operation. */
- ComponentDepsNode *owner;
-
- /* Callback for operation. */
- DepsEvalOperationCb evaluate;
-
- /* How many inlinks are we still waiting on before we can be evaluated. */
- uint32_t num_links_pending;
- bool scheduled;
-
- /* Identifier for the operation being performed. */
- eDepsOperation_Code opcode;
- int name_tag;
-
- /* (eDepsOperation_Flag) extra settings affecting evaluation. */
- int flag;
-
- DEG_DEPSNODE_DECLARE;
-};
-
-void deg_register_operation_depsnodes();
-
-} // namespace DEG