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:
Diffstat (limited to 'source/blender/depsgraph/intern/nodes/deg_node_component.h')
-rw-r--r--source/blender/depsgraph/intern/nodes/deg_node_component.h114
1 files changed, 52 insertions, 62 deletions
diff --git a/source/blender/depsgraph/intern/nodes/deg_node_component.h b/source/blender/depsgraph/intern/nodes/deg_node_component.h
index 969771a29c9..985716deaac 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node_component.h
+++ b/source/blender/depsgraph/intern/nodes/deg_node_component.h
@@ -46,6 +46,7 @@ namespace DEG {
struct Depsgraph;
struct OperationDepsNode;
struct BoneComponentDepsNode;
+struct IDDepsNode;
/* ID Component - Base type for all components */
struct ComponentDepsNode : public DepsNode {
@@ -74,18 +75,26 @@ struct ComponentDepsNode : public DepsNode {
string identifier() const;
- /* Find an existing operation, will throw an assert() if it does not exist. */
+ /* 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,
- const char *name,
- int name_tag) const;
+ const char *name,
+ int name_tag) const;
- /* Check operation exists and return it. */
- OperationDepsNode *has_operation(OperationIDKey key) const;
- OperationDepsNode *has_operation(eDepsOperation_Code opcode,
+ /* 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,
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,
+ const char *name,
+ int name_tag) const;
+
/**
* Create a new node for representing an operation and add this to graph
* \warning If an existing node is found, it will be modified. This helps
@@ -99,29 +108,22 @@ struct ComponentDepsNode : public DepsNode {
* \param op: The operation to perform
* \param name: Identifier for operation - used to find/locate it again
*/
- OperationDepsNode *add_operation(eDepsOperation_Type optype,
- DepsEvalOperationCb op,
+ OperationDepsNode *add_operation(const DepsEvalOperationCb& op,
eDepsOperation_Code 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);
+
void clear_operations();
void tag_update(Depsgraph *graph);
- /* Evaluation Context Management .................. */
-
- /* Initialize component's evaluation context used for the specified
- * purpose.
- */
- virtual bool eval_context_init(EvaluationContext * /*eval_ctx*/) { return false; }
- /* Free data in component's evaluation context which is used for
- * the specified purpose
- *
- * NOTE: this does not free the actual context in question
- */
- virtual void eval_context_free(EvaluationContext * /*eval_ctx*/) {}
-
OperationDepsNode *get_entry_operation();
OperationDepsNode *get_exit_operation();
@@ -152,33 +154,34 @@ struct ComponentDepsNode : public DepsNode {
/* ---------------------------------------- */
-struct ParametersComponentDepsNode : public ComponentDepsNode {
- DEG_DEPSNODE_DECLARE;
-};
-
-struct AnimationComponentDepsNode : public ComponentDepsNode {
- DEG_DEPSNODE_DECLARE;
-};
-
-struct TransformComponentDepsNode : public ComponentDepsNode {
- DEG_DEPSNODE_DECLARE;
-};
-
-struct ProxyComponentDepsNode : public ComponentDepsNode {
- DEG_DEPSNODE_DECLARE;
-};
-
-struct GeometryComponentDepsNode : public ComponentDepsNode {
- DEG_DEPSNODE_DECLARE;
-};
-
-struct SequencerComponentDepsNode : public ComponentDepsNode {
- DEG_DEPSNODE_DECLARE;
-};
-
-struct PoseComponentDepsNode : public ComponentDepsNode {
- DEG_DEPSNODE_DECLARE;
-};
+#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_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, \
+ #name " Component", \
+ id_recalc_tag) ; \
+ static DepsNodeFactoryImpl<name ## ComponentDepsNode> DNTI_ ## NAME
+
+#define DEG_COMPONENT_NODE_DECLARE_GENERIC(name) \
+ struct name ## ComponentDepsNode : public ComponentDepsNode { \
+ DEG_COMPONENT_NODE_DECLARE; \
+ }
+
+DEG_COMPONENT_NODE_DECLARE_GENERIC(Animation);
+DEG_COMPONENT_NODE_DECLARE_GENERIC(Cache);
+DEG_COMPONENT_NODE_DECLARE_GENERIC(Geometry);
+DEG_COMPONENT_NODE_DECLARE_GENERIC(Parameters);
+DEG_COMPONENT_NODE_DECLARE_GENERIC(Particles);
+DEG_COMPONENT_NODE_DECLARE_GENERIC(Proxy);
+DEG_COMPONENT_NODE_DECLARE_GENERIC(Pose);
+DEG_COMPONENT_NODE_DECLARE_GENERIC(Sequencer);
+DEG_COMPONENT_NODE_DECLARE_GENERIC(Shading);
+DEG_COMPONENT_NODE_DECLARE_GENERIC(Transform);
/* Bone Component */
struct BoneComponentDepsNode : public ComponentDepsNode {
@@ -186,22 +189,9 @@ struct BoneComponentDepsNode : public ComponentDepsNode {
struct bPoseChannel *pchan; /* the bone that this component represents */
- DEG_DEPSNODE_DECLARE;
+ DEG_COMPONENT_NODE_DECLARE;
};
-struct ParticlesComponentDepsNode : public ComponentDepsNode {
- DEG_DEPSNODE_DECLARE;
-};
-
-struct ShadingComponentDepsNode : public ComponentDepsNode {
- DEG_DEPSNODE_DECLARE;
-};
-
-struct CacheComponentDepsNode : public ComponentDepsNode {
- DEG_DEPSNODE_DECLARE;
-};
-
-
void deg_register_component_depsnodes();
} // namespace DEG