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>2016-05-27 19:01:18 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2016-05-27 19:01:18 +0300
commit55b24bef557922b8f51cf993b12047e980e43617 (patch)
tree7a9dd18a1d096e71e94406fb1ceecf233fa4e3af /source/blender/depsgraph/intern/depsgraph_types.h
parent3d86a5bc72a63b1ef8b165d68a1806d0abf0a8ac (diff)
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with this module more pleasant and solve such issues as: - Annoyance with looong files, which had craftload in them - Usage of STL for the data structures we've got in BLI - Possible symbol conflicts - Not real clear layout of what is located where So in this commit the following changes are done: - STL is prohibited, it's not really predictable on various compilers, with our BLI algorithms we can predict things much better. There are still few usages of std::vector, but that we'll be solving later once we've got similar thing in BLI. - Simplify foreach loops, avoid using const_iterator all over the place. - New directory layout, which is hopefully easier to follow. - Some files were split, some of them will be split soon. The idea of this is to split huge functions into own files with good documentation and everything. - Removed stuff which was planned for use in the future but was never finished, tested or anything. Let's wipe it out for now, and bring back once we really start using it, so it'll be more clear if it solves our needs. - All the internal routines were moved to DEG namespace to separate them better from rest of blender. Some places now annoyingly using DEG::foo, but that we can olve by moving some utility functions inside of the namespace. While working on this we've found some hotspot in updates flush, so now playback of blenrig is few percent faster (something like 96fps with previous master and around 99-100fps after this change). Not saying it's something final, there is still room for cleanup and API simplification, but those might happen as a regular development now without doing any global changes.
Diffstat (limited to 'source/blender/depsgraph/intern/depsgraph_types.h')
-rw-r--r--source/blender/depsgraph/intern/depsgraph_types.h252
1 files changed, 207 insertions, 45 deletions
diff --git a/source/blender/depsgraph/intern/depsgraph_types.h b/source/blender/depsgraph/intern/depsgraph_types.h
index f5fbf0bcc76..7516ccbfdc2 100644
--- a/source/blender/depsgraph/intern/depsgraph_types.h
+++ b/source/blender/depsgraph/intern/depsgraph_types.h
@@ -34,10 +34,9 @@
* in the graph.
*/
-#ifndef __DEPSGRAPH_TYPES_H__
-#define __DEPSGRAPH_TYPES_H__
+#pragma once
-#include "depsgraph_util_function.h"
+#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.
@@ -55,69 +54,232 @@ struct PointerRNA;
struct EvaluationContext;
struct FCurve;
+namespace DEG {
+
/* Evaluation Operation for atomic operation */
// XXX: move this to another header that can be exposed?
typedef function<void(struct EvaluationContext *)> DepsEvalOperationCb;
-/* Metatype of Nodes - The general "level" in the graph structure the node serves */
+/* Metatype of Nodes - The general "level" in the graph structure
+ * the node serves.
+ */
typedef enum eDepsNode_Class {
- DEPSNODE_CLASS_GENERIC = 0, /* Types generally unassociated with user-visible entities, but needed for graph functioning */
-
- DEPSNODE_CLASS_COMPONENT = 1, /* [Outer Node] An "aspect" of evaluating/updating an ID-Block, requiring certain types of evaluation behaviours */
- DEPSNODE_CLASS_OPERATION = 2, /* [Inner Node] A glorified function-pointer/callback for scheduling up evaluation operations for components, subject to relationship requirements */
+ /* Types generally unassociated with user-visible entities,
+ * but needed for graph functioning.
+ */
+ DEPSNODE_CLASS_GENERIC = 0,
+ /* [Outer Node] An "aspect" of evaluating/updating an ID-Block, requiring
+ * certain types of evaluation behavior.
+ */
+ DEPSNODE_CLASS_COMPONENT = 1,
+ /* [Inner Node] A glorified function-pointer/callback for scheduling up
+ * evaluation operations for components, subject to relationship
+ * requirements.
+ */
+ DEPSNODE_CLASS_OPERATION = 2,
} eDepsNode_Class;
/* Types of Nodes */
typedef enum eDepsNode_Type {
- DEPSNODE_TYPE_UNDEFINED = -1, /* fallback type for invalid return value */
+ /* Fallback type for invalid return value */
+ DEPSNODE_TYPE_UNDEFINED = -1,
+ /* Inner Node (Operation) */
+ DEPSNODE_TYPE_OPERATION = 0,
+
+ /* **** Generic Types **** */
+
+ /* "Current Scene" - basically whatever kicks off the evaluation process. */
+ DEPSNODE_TYPE_ROOT = 1,
+ /* Time-Source */
+ DEPSNODE_TYPE_TIMESOURCE = 2,
+ /* ID-Block reference - used as landmarks/collection point for components,
+ * but not usually part of main graph.
+ */
+ DEPSNODE_TYPE_ID_REF = 3,
+ /* Isolated sub-graph - used for keeping instanced data separate from
+ * instances using them.
+ */
+ DEPSNODE_TYPE_SUBGRAPH = 4,
- DEPSNODE_TYPE_OPERATION = 0, /* Inner Node (Operation) */
+ /* **** Outer Types **** */
- /* Generic Types */
- DEPSNODE_TYPE_ROOT = 1, /* "Current Scene" - basically whatever kicks off the evaluation process */
- DEPSNODE_TYPE_TIMESOURCE = 2, /* Time-Source */
+ /* Parameters Component - Default when nothing else fits
+ * (i.e. just SDNA property setting).
+ */
+ DEPSNODE_TYPE_PARAMETERS = 11,
+ /* Generic "Proxy-Inherit" Component
+ * XXX: Also for instancing of subgraphs?
+ */
+ DEPSNODE_TYPE_PROXY = 12,
+ /* Animation Component
+ *
+ * XXX: merge in with parameters?
+ */
+ DEPSNODE_TYPE_ANIMATION = 13,
+ /* Transform Component (Parenting/Constraints) */
+ DEPSNODE_TYPE_TRANSFORM = 14,
+ /* Geometry Component (DerivedMesh/Displist) */
+ DEPSNODE_TYPE_GEOMETRY = 15,
+ /* Sequencer Component (Scene Only) */
+ DEPSNODE_TYPE_SEQUENCER = 16,
+
+ /* **** Evaluation-Related Outer Types (with Subdata) **** */
+
+ /* Pose Component - Owner/Container of Bones Eval */
+ DEPSNODE_TYPE_EVAL_POSE = 21,
+ /* Bone Component - Child/Subcomponent of Pose */
+ DEPSNODE_TYPE_BONE = 22,
+ /* Particle Systems Component */
+ DEPSNODE_TYPE_EVAL_PARTICLES = 23,
+ /* Material Shading Component */
+ DEPSNODE_TYPE_SHADING = 24,
+} eDepsNode_Type;
- DEPSNODE_TYPE_ID_REF = 3, /* ID-Block reference - used as landmarks/collection point for components, but not usually part of main graph */
- DEPSNODE_TYPE_SUBGRAPH = 4, /* Isolated sub-graph - used for keeping instanced data separate from instances using them */
+/* Identifiers for common operations (as an enum). */
+typedef enum eDepsOperation_Code {
+ /* Generic Operations ------------------------------ */
- /* Outer Types */
- DEPSNODE_TYPE_PARAMETERS = 11, /* Parameters Component - Default when nothing else fits (i.e. just SDNA property setting) */
- DEPSNODE_TYPE_PROXY = 12, /* Generic "Proxy-Inherit" Component */ // XXX: Also for instancing of subgraphs?
- DEPSNODE_TYPE_ANIMATION = 13, /* Animation Component */ // XXX: merge in with parameters?
- DEPSNODE_TYPE_TRANSFORM = 14, /* Transform Component (Parenting/Constraints) */
- DEPSNODE_TYPE_GEOMETRY = 15, /* Geometry Component (DerivedMesh/Displist) */
- DEPSNODE_TYPE_SEQUENCER = 16, /* Sequencer Component (Scene Only) */
+ /* Placeholder for operations which don't need special mention */
+ DEG_OPCODE_OPERATION = 0,
- /* Evaluation-Related Outer Types (with Subdata) */
- DEPSNODE_TYPE_EVAL_POSE = 21, /* Pose Component - Owner/Container of Bones Eval */
- DEPSNODE_TYPE_BONE = 22, /* Bone Component - Child/Subcomponent of Pose */
+ // XXX: Placeholder while porting depsgraph code
+ DEG_OPCODE_PLACEHOLDER,
- DEPSNODE_TYPE_EVAL_PARTICLES = 23, /* Particle Systems Component */
- DEPSNODE_TYPE_SHADING = 24, /* Material Shading Component */
-} eDepsNode_Type;
+ DEG_OPCODE_NOOP,
-/* Identifiers for common operations (as an enum) */
-typedef enum eDepsOperation_Code {
-#define DEF_DEG_OPCODE(label) DEG_OPCODE_##label,
-#include "depsnode_opcodes.h"
-#undef DEF_DEG_OPCODE
+ /* Animation, Drivers, etc. ------------------------ */
+
+ /* NLA + Action */
+ DEG_OPCODE_ANIMATION,
+
+ /* Driver */
+ DEG_OPCODE_DRIVER,
+
+ /* Proxy Inherit? */
+ //DEG_OPCODE_PROXY,
+
+ /* Transform --------------------------------------- */
+
+ /* Transform entry point - local transforms only */
+ DEG_OPCODE_TRANSFORM_LOCAL,
+
+ /* Parenting */
+ DEG_OPCODE_TRANSFORM_PARENT,
+
+ /* Constraints */
+ DEG_OPCODE_TRANSFORM_CONSTRAINTS,
+ //DEG_OPCODE_TRANSFORM_CONSTRAINTS_INIT,
+ //DEG_OPCODE_TRANSFORM_CONSTRAINT,
+ //DEG_OPCODE_TRANSFORM_CONSTRAINTS_DONE,
+
+ /* Rigidbody Sim - Perform Sim */
+ DEG_OPCODE_RIGIDBODY_REBUILD,
+ DEG_OPCODE_RIGIDBODY_SIM,
+
+ /* Rigidbody Sim - Copy Results to Object */
+ DEG_OPCODE_TRANSFORM_RIGIDBODY,
+
+ /* Transform exitpoint */
+ DEG_OPCODE_TRANSFORM_FINAL,
+
+ /* XXX: ubereval is for temporary porting purposes only */
+ DEG_OPCODE_OBJECT_UBEREVAL,
+
+ /* Geometry ---------------------------------------- */
+
+ /* XXX: Placeholder - UberEval */
+ DEG_OPCODE_GEOMETRY_UBEREVAL,
+
+ /* Modifier */
+ DEG_OPCODE_GEOMETRY_MODIFIER,
+
+ /* Curve Objects - Path Calculation (used for path-following tools, */
+ DEG_OPCODE_GEOMETRY_PATH,
+
+ /* Pose -------------------------------------------- */
+
+ /* Init IK Trees, etc. */
+ DEG_OPCODE_POSE_INIT,
+
+ /* Free IK Trees + Compute Deform Matrices */
+ DEG_OPCODE_POSE_DONE,
+
+ /* IK/Spline Solvers */
+ DEG_OPCODE_POSE_IK_SOLVER,
+ DEG_OPCODE_POSE_SPLINE_IK_SOLVER,
+
+ /* Bone -------------------------------------------- */
+
+ /* Bone local transforms - Entrypoint */
+ DEG_OPCODE_BONE_LOCAL,
+
+ /* Pose-space conversion (includes parent + restpose, */
+ DEG_OPCODE_BONE_POSE_PARENT,
+
+ /* Constraints */
+ DEG_OPCODE_BONE_CONSTRAINTS,
+ //DEG_OPCODE_BONE_CONSTRAINTS_INIT,
+ //DEG_OPCODE_BONE_CONSTRAINT,
+ //DEG_OPCODE_BONE_CONSTRAINTS_DONE,
+
+ /* 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 targetting 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,
+
+ /* Particles --------------------------------------- */
+
+ /* XXX: placeholder - Particle System eval */
+ DEG_OPCODE_PSYS_EVAL,
+
+ DEG_NUM_OPCODES,
} eDepsOperation_Code;
-/* String defines for these opcodes, defined in depsnode_operation.cpp */
-extern const char *DEG_OPNAMES[];
+/* Some magic to stringify operation codes. */
+class DepsOperationStringifier {
+public:
+ DepsOperationStringifier();
+ const char *operator[](eDepsOperation_Code opcodex);
+protected:
+ const char *names_[DEG_NUM_OPCODES];
+};
+/* String defines for these opcodes, defined in depsgraph_type_defines.cpp */
+extern DepsOperationStringifier DEG_OPNAMES;
/* Type of operation */
typedef enum eDepsOperation_Type {
- /* Primary operation types */
- DEPSOP_TYPE_INIT = 0, /* initialise evaluation data */
- DEPSOP_TYPE_EXEC = 1, /* standard evaluation step */
- DEPSOP_TYPE_POST = 2, /* cleanup evaluation data + flush results */
-
- /* Additional operation types */
- DEPSOP_TYPE_OUT = 3, /* indicator for outputting a temporary result that other components can use */ // XXX?
- DEPSOP_TYPE_SIM = 4, /* indicator for things like IK Solvers and Rigidbody Sim steps which modify final results of separate entities at once */
- DEPSOP_TYPE_REBUILD = 5, /* rebuild internal evaluation data - used for Rigidbody Reset and Armature Rebuild-On-Load */
+ /* **** Primary operation types **** */
+
+ /* Initialise evaluation data */
+ DEPSOP_TYPE_INIT = 0,
+ /* Standard evaluation step */
+ DEPSOP_TYPE_EXEC = 1,
+ /* Cleanup evaluation data + flush results */
+ DEPSOP_TYPE_POST = 2,
+
+ /* **** Additional operation types **** */
+ /* Indicator for outputting a temporary result that other components
+ * can use. // XXX?
+ */
+ DEPSOP_TYPE_OUT = 3,
+ /* Indicator for things like IK Solvers and Rigidbody Sim steps which
+ * modify final results of separate entities at once.
+ */
+ DEPSOP_TYPE_SIM = 4,
+ /* Rebuild internal evaluation data - used for Rigidbody Reset and
+ * Armature Rebuild-On-Load.
+ */
+ DEPSOP_TYPE_REBUILD = 5,
} eDepsOperation_Type;
/* Types of relationships between nodes
@@ -170,4 +332,4 @@ typedef enum eDepsRelation_Type {
DEPSREL_TYPE_UPDATE_UI,
} eDepsRelation_Type;
-#endif /* __DEPSGRAPH_TYPES_H__ */
+} // namespace DEG