Commit: d9de6a8a87e2752eac30cef97608b63af01de26d
Author: Sergey Sharybin
Date:   Thu Dec 18 19:26:17 2014 +0500
Branches: depsgraph_refactor
https://developer.blender.org/rBd9de6a8a87e2752eac30cef97608b63af01de26d

Depsgraph: Code cleanup

===================================================================

M       source/blender/depsgraph/intern/depsnode.h

===================================================================

diff --git a/source/blender/depsgraph/intern/depsnode.h 
b/source/blender/depsgraph/intern/depsnode.h
index a692554..f7a47e0 100644
--- a/source/blender/depsgraph/intern/depsnode.h
+++ b/source/blender/depsgraph/intern/depsnode.h
@@ -45,55 +45,65 @@ struct DepsRelation;
 struct DepsgraphCopyContext;
 struct OperationDepsNode;
 
-/* ************************************* */
+/* *********************************** */
 /* Base-Defines for Nodes in Depsgraph */
 
-/* All nodes in Depsgraph are descended from this */
+/* All nodes in Depsgraph are descended from this. */
 struct DepsNode {
-       /* Helper class for static typeinfo in subclasses */
+       /* Helper class for static typeinfo in subclasses. */
        struct TypeInfo {
                TypeInfo(eDepsNode_Type type, const string &tname);
-               
+
                eDepsNode_Type type;
                eDepsNode_Class tclass;
                string tname;
        };
-       
-       string name;                /* identifier - mainly for debugging 
purposes... */
-       
-       eDepsNode_Type type;        /* structural type of node */
-       eDepsNode_Class tclass;     /* type of data/behaviour represented by 
node... */
-       
-       
+
+       /* Identifier - mainly for debugging purposes. */
+       string name;
+
+       /* Structural type of node. */
+       eDepsNode_Type type;
+
+       /* Type of data/behaviour represented by node... */
+       eDepsNode_Class tclass;
+
        /* Relationships between nodes
-        * The reason why all depsgraph nodes are descended from this type 
(apart from basic serialisation
-        * benefits - from the typeinfo) is that we can have relationships 
between these nodes!
+        * The reason why all depsgraph nodes are descended from this type 
(apart
+        * from basic serialisation benefits - from the typeinfo) is that we 
can have
+        * relationships between these nodes!
         */
        typedef unordered_set<DepsRelation *> Relations;
-       
-       Relations inlinks;          /* nodes which this one depends on */
-       Relations outlinks;         /* nodes which depend on this one */
-       
-       int done;                   /* generic tag for traversal algorithms */
-       
-public:
+
+       /* Nodes which this one depends on. */
+       Relations inlinks;
+
+       /* Nodes which depend on this one. */
+       Relations outlinks;
+
+       /* Generic tag for traversal algorithms */
+       int done;
+
+       /* Methods. */
+
        DepsNode();
        virtual ~DepsNode();
-       
+
        virtual string identifier() const;
-       
+
        virtual void init(const ID *id, const string &subdata) {}
        virtual void copy(DepsgraphCopyContext *dcc, const DepsNode *src) {}
-       
+
        virtual void tag_update(Depsgraph *graph) {}
 };
 
-/* Macros for common static typeinfo */
+/* 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_)
 
+/* TODO(sergey): Move to depsgraph_types.h. */
 using std::vector;
 
 /* Generic Nodes ======================= */
@@ -101,46 +111,56 @@ using std::vector;
 struct ComponentDepsNode;
 struct IDDepsNode;
 
-/* Time Source Node */
+/* Time Source Node. */
 struct TimeSourceDepsNode : public DepsNode {
-       double cfra;                    /* new "current time" */
-       double offset;                  /* time-offset relative to the 
"official" time source that this one has */
-       
+       /* TODO(sergey): Time in blender is float, not double. */
+       /* New "current time". */
+       double cfra;
+
+       /* time-offset relative to the "official" time source that this one 
has. */
+       double offset;
+
        // TODO: evaluate() operation needed
-       
+
        void tag_update(Depsgraph *graph);
-       
+
        DEG_DEPSNODE_DECLARE;
 };
 
-/* Root Node */
+/* Root Node. */
 struct RootDepsNode : public DepsNode {
        ~RootDepsNode();
 
        TimeSourceDepsNode *add_time_source(const string &name = "");
-       
-       struct Scene *scene;             /* scene that this corresponds to */
-       TimeSourceDepsNode *time_source; /* entrypoint node for time-changed */
-       
+
+       /* scene that this corresponds to */
+       Scene *scene;
+
+       /* Entrypoint node for time-changed. */
+       TimeSourceDepsNode *time_source;
+
        DEG_DEPSNODE_DECLARE;
 };
 
 /* ID-Block Reference */
 struct IDDepsNode : public DepsNode {
        struct ComponentKey {
-               ComponentKey(eDepsNode_Type type_, const string &name_ = "") : 
type(type_), name(name_) {}
-               
+               ComponentKey(eDepsNode_Type type, const string &name = "")
+                   : type(type), name(name) {}
+
                bool operator== (const ComponentKey &other) const
                {
                        return type == other.type && name == other.name;
                }
-               
+
                eDepsNode_Type type;
                string name;
        };
-       
-       /* XXX can't specialize std::hash for this purpose, because 
ComponentKey is a nested type ...
-        * http://stackoverflow.com/a/951245
+
+       /* XXX can't specialize std::hash for this purpose, because 
ComponentKey is
+        * a nested type ...
+        *
+        *   http://stackoverflow.com/a/951245
         */
        struct component_key_hash {
                bool operator() (const ComponentKey &key) const
@@ -148,49 +168,71 @@ struct IDDepsNode : public DepsNode {
                        return hash_combine(hash<int>()(key.type), 
hash<string>()(key.name));
                }
        };
-       
-       typedef unordered_map<ComponentKey, ComponentDepsNode *, 
component_key_hash> ComponentMap;
-       
+
+       typedef unordered_map<ComponentKey,
+                             ComponentDepsNode*,
+                             component_key_hash> ComponentMap;
+
        void init(const ID *id, const string &subdata);
        void copy(DepsgraphCopyContext *dcc, const IDDepsNode *src);
        ~IDDepsNode();
-       
-       ComponentDepsNode *find_component(eDepsNode_Type type, const string 
&name = "") const;
-       ComponentDepsNode *add_component(eDepsNode_Type type, const string 
&name = "");
+
+       ComponentDepsNode *find_component(eDepsNode_Type type,
+                                         const string &name = "") const;
+       ComponentDepsNode *add_component(eDepsNode_Type type,
+                                        const string &name = "");
        void remove_component(eDepsNode_Type type, const string &name = "");
        void clear_components();
-       
+
        void tag_update(Depsgraph *graph);
-       
-       struct ID *id;                  /* ID Block referenced */
-       ComponentMap components;        /* hash to make it faster to look up 
components */
-       
+
+       /* ID Block referenced. */
+       ID *id;
+
+       /* Hash to make it faster to look up components. */
+       ComponentMap components;
+
        DEG_DEPSNODE_DECLARE;
 };
 
-/* Subgraph Reference */
+/* Subgraph Reference. */
 struct SubgraphDepsNode : public DepsNode {
        void init(const ID *id, const string &subdata);
        void copy(DepsgraphCopyContext *dcc, const SubgraphDepsNode *src);
        ~SubgraphDepsNode();
-       
-       Depsgraph *graph;        /* instanced graph */
-       struct ID *root_id;      /* ID-block at root of subgraph (if 
applicable) */
-       
-       size_t num_users;        /* number of nodes which use/reference this 
subgraph - if just 1, it may be possible to merge into main */
-       int flag;                /* (eSubgraphRef_Flag) assorted settings for 
subgraph node */
-       
+
+       /* Instanced graph. */
+       Depsgraph *graph;
+
+       /* ID-block at root of subgraph (if applicable). */
+       ID *root_id;
+
+       /* Number of nodes which use/reference this subgraph - if just 1, it 
may be
+        * possible to merge into main,
+        */
+       size_t num_users;
+
+       /* (eSubgraphRef_Flag) assorted settings for subgraph node. */
+       int flag;
+
        DEG_DEPSNODE_DECLARE;
 };
 
 /* Flags for subgraph node */
 typedef enum eSubgraphRef_Flag {
-       SUBGRAPH_FLAG_SHARED      = (1 << 0),   /* subgraph referenced is 
shared with another reference, so shouldn't free on exit */
-       SUBGRAPH_FLAG_FIRSTREF    = (1 << 1),   /* node is first reference to 
subgraph, so it can be freed when we are removed */
+       /* Subgraph referenced is shared with another reference, so shouldn't
+        * free on exit.
+        */
+       SUBGRAPH_FLAG_SHARED      = (1 << 0),
+
+       /* Node is first reference to subgraph, so it can be freed when we are
+        * removed.
+        */
+       SUBGRAPH_FLAG_FIRSTREF    = (1 << 1),
 } eSubgraphRef_Flag;
 
 /* ************************************* */
 
 void DEG_register_base_depsnodes();
 
-#endif // __DEPSNODE_H__
+#endif  /* __DEPSNODE_H__ */

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to