[Bf-blender-cvs] [a0b8885] depsgraph_cleanup: Depsgraph: Avoid generated enums
Sergey Sharybin
noreply at git.blender.org
Thu May 26 10:02:26 CEST 2016
Commit: a0b8885eb98bc4f9acd53141626a78f874031fdd
Author: Sergey Sharybin
Date: Wed May 25 15:14:34 2016 +0200
Branches: depsgraph_cleanup
https://developer.blender.org/rBa0b8885eb98bc4f9acd53141626a78f874031fdd
Depsgraph: Avoid generated enums
Those are rather confusing for the debugging purposes, not being
able to quickly see values, where the thing came from and so on.
===================================================================
M source/blender/depsgraph/CMakeLists.txt
M source/blender/depsgraph/intern/depsgraph_types.h
A source/blender/depsgraph/intern/depsnode_opcodes.cc
M source/blender/depsgraph/intern/depsnode_opcodes.h
M source/blender/depsgraph/intern/depsnode_operation.cc
===================================================================
diff --git a/source/blender/depsgraph/CMakeLists.txt b/source/blender/depsgraph/CMakeLists.txt
index 2b4df85..91f89ed 100644
--- a/source/blender/depsgraph/CMakeLists.txt
+++ b/source/blender/depsgraph/CMakeLists.txt
@@ -55,6 +55,7 @@ set(SRC
intern/depsgraph_queue.cc
intern/depsgraph_tag.cc
intern/depsgraph_type_defines.cc
+ intern/depsnode_opcodes.cc
util/depsgraph_util_cycle.cc
util/depsgraph_util_pchanmap.cc
util/depsgraph_util_transitive.cc
diff --git a/source/blender/depsgraph/intern/depsgraph_types.h b/source/blender/depsgraph/intern/depsgraph_types.h
index 1ad0353..40d9d3e 100644
--- a/source/blender/depsgraph/intern/depsgraph_types.h
+++ b/source/blender/depsgraph/intern/depsgraph_types.h
@@ -95,16 +95,8 @@ typedef enum eDepsNode_Type {
DEPSNODE_TYPE_SHADING = 24, /* Material Shading Component */
} eDepsNode_Type;
-/* Identifiers for common operations (as an enum) */
-typedef enum eDepsOperation_Code {
-#define DEF_DEG_OPCODE(label) DEG_OPCODE_##label,
+/* Identifiers for common operations (as an enum). */
#include "depsnode_opcodes.h"
-#undef DEF_DEG_OPCODE
-} eDepsOperation_Code;
-
-/* String defines for these opcodes, defined in depsnode_operation.cpp */
-extern const char *DEG_OPNAMES[];
-
/* Type of operation */
typedef enum eDepsOperation_Type {
diff --git a/source/blender/depsgraph/intern/depsnode_opcodes.cc b/source/blender/depsgraph/intern/depsnode_opcodes.cc
new file mode 100644
index 0000000..b743325
--- /dev/null
+++ b/source/blender/depsgraph/intern/depsnode_opcodes.cc
@@ -0,0 +1,87 @@
+/*
+ * ***** 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) 2016 Blender Foundation.
+ * All rights reserved.
+ *
+ * Original Author: Sergey Sharybin
+ * Contributor(s): None Yet
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "depsnode_opcodes.h"
+
+#include "BLI_utildefines.h"
+
+DepsOperationStringifier DEG_OPNAMES;
+
+static const char *stringify_opcode(int opcode)
+{
+ switch (opcode) {
+#define STRINGIFY_OPCODE(name) case DEG_OPCODE_##name: return #name
+ STRINGIFY_OPCODE(OPERATION);
+ STRINGIFY_OPCODE(PLACEHOLDER);
+ STRINGIFY_OPCODE(NOOP);
+ STRINGIFY_OPCODE(ANIMATION);
+ STRINGIFY_OPCODE(DRIVER);
+ //STRINGIFY_OPCODE(PROXY);
+ STRINGIFY_OPCODE(TRANSFORM_LOCAL);
+ STRINGIFY_OPCODE(TRANSFORM_PARENT);
+ STRINGIFY_OPCODE(TRANSFORM_CONSTRAINTS);
+ //STRINGIFY_OPCODE(TRANSFORM_CONSTRAINTS_INIT);
+ //STRINGIFY_OPCODE(TRANSFORM_CONSTRAINT);
+ //STRINGIFY_OPCODE(TRANSFORM_CONSTRAINTS_DONE);
+ STRINGIFY_OPCODE(RIGIDBODY_REBUILD);
+ STRINGIFY_OPCODE(RIGIDBODY_SIM);
+ STRINGIFY_OPCODE(TRANSFORM_RIGIDBODY);
+ STRINGIFY_OPCODE(TRANSFORM_FINAL);
+ STRINGIFY_OPCODE(OBJECT_UBEREVAL);
+ STRINGIFY_OPCODE(GEOMETRY_UBEREVAL);
+ STRINGIFY_OPCODE(GEOMETRY_MODIFIER);
+ STRINGIFY_OPCODE(GEOMETRY_PATH);
+ STRINGIFY_OPCODE(POSE_INIT);
+ STRINGIFY_OPCODE(POSE_DONE);
+ STRINGIFY_OPCODE(POSE_IK_SOLVER);
+ STRINGIFY_OPCODE(POSE_SPLINE_IK_SOLVER);
+ STRINGIFY_OPCODE(BONE_LOCAL);
+ STRINGIFY_OPCODE(BONE_POSE_PARENT);
+ STRINGIFY_OPCODE(BONE_CONSTRAINTS);
+ //STRINGIFY_OPCODE(BONE_CONSTRAINTS_INIT);
+ //STRINGIFY_OPCODE(BONE_CONSTRAINT);
+ //STRINGIFY_OPCODE(BONE_CONSTRAINTS_DONE);
+ STRINGIFY_OPCODE(BONE_READY);
+ STRINGIFY_OPCODE(BONE_DONE);
+ STRINGIFY_OPCODE(PSYS_EVAL);
+#undef STRINGIFY_OPCODE
+ }
+ return "UNKNOWN";
+}
+
+DepsOperationStringifier::DepsOperationStringifier() {
+ for (int i = 0; i < DEG_NUM_OPCODES; ++i) {
+ names_[i] = stringify_opcode(i);
+ }
+}
+
+const char *DepsOperationStringifier::operator[](int opcode) {
+ BLI_assert((opcode > 0) && (opcode < DEG_NUM_OPCODES));
+ if (opcode >= 0 && opcode < DEG_NUM_OPCODES) {
+ return names_[opcode];
+ }
+ return "UnknownOpcode";
+}
diff --git a/source/blender/depsgraph/intern/depsnode_opcodes.h b/source/blender/depsgraph/intern/depsnode_opcodes.h
index b81822c..955c92b 100644
--- a/source/blender/depsgraph/intern/depsnode_opcodes.h
+++ b/source/blender/depsgraph/intern/depsnode_opcodes.h
@@ -41,105 +41,121 @@
*/
-/* Example macro define: */
-/* #define DEF_DEG_OPCODE(label) DEG_OPCODE_##label, */
+typedef enum eDepsOperation_Code {
+ /* Generic Operations ------------------------------ */
-/* Generic Operations ------------------------------ */
+ /* Placeholder for operations which don't need special mention */
+ DEG_OPCODE_OPERATION = 0,
-/* Placeholder for operations which don't need special mention */
-DEF_DEG_OPCODE(OPERATION)
+ // XXX: Placeholder while porting depsgraph code
+ DEG_OPCODE_PLACEHOLDER,
-// XXX: Placeholder while porting depsgraph code
-DEF_DEG_OPCODE(PLACEHOLDER)
+ DEG_OPCODE_NOOP,
-DEF_DEG_OPCODE(NOOP)
+ /* Animation, Drivers, etc. ------------------------ */
-/* Animation, Drivers, etc. ------------------------ */
+ /* NLA + Action */
+ DEG_OPCODE_ANIMATION,
-/* NLA + Action */
-DEF_DEG_OPCODE(ANIMATION)
+ /* Driver */
+ DEG_OPCODE_DRIVER,
-/* Driver */
-DEF_DEG_OPCODE(DRIVER)
+ /* Proxy Inherit? */
+ //DEG_OPCODE_PROXY,
-/* Proxy Inherit? */
-//DEF_DEG_OPCODE(PROXY)
+ /* Transform --------------------------------------- */
-/* Transform --------------------------------------- */
+ /* Transform entry point - local transforms only */
+ DEG_OPCODE_TRANSFORM_LOCAL,
-/* Transform entry point - local transforms only */
-DEF_DEG_OPCODE(TRANSFORM_LOCAL)
+ /* Parenting */
+ DEG_OPCODE_TRANSFORM_PARENT,
-/* Parenting */
-DEF_DEG_OPCODE(TRANSFORM_PARENT)
+ /* Constraints */
+ DEG_OPCODE_TRANSFORM_CONSTRAINTS,
+ //DEG_OPCODE_TRANSFORM_CONSTRAINTS_INIT,
+ //DEG_OPCODE_TRANSFORM_CONSTRAINT,
+ //DEG_OPCODE_TRANSFORM_CONSTRAINTS_DONE,
-/* Constraints */
-DEF_DEG_OPCODE(TRANSFORM_CONSTRAINTS)
-//DEF_DEG_OPCODE(TRANSFORM_CONSTRAINTS_INIT)
-//DEF_DEG_OPCODE(TRANSFORM_CONSTRAINT)
-//DEF_DEG_OPCODE(TRANSFORM_CONSTRAINTS_DONE)
+ /* Rigidbody Sim - Perform Sim */
+ DEG_OPCODE_RIGIDBODY_REBUILD,
+ DEG_OPCODE_RIGIDBODY_SIM,
-/* Rigidbody Sim - Perform Sim */
-DEF_DEG_OPCODE(RIGIDBODY_REBUILD)
-DEF_DEG_OPCODE(RIGIDBODY_SIM)
+ /* Rigidbody Sim - Copy Results to Object */
+ DEG_OPCODE_TRANSFORM_RIGIDBODY,
-/* Rigidbody Sim - Copy Results to Object */
-DEF_DEG_OPCODE(TRANSFORM_RIGIDBODY)
+ /* Transform exitpoint */
+ DEG_OPCODE_TRANSFORM_FINAL,
-/* Transform exitpoint */
-DEF_DEG_OPCODE(TRANSFORM_FINAL)
+ /* XXX: ubereval is for temporary porting purposes only */
+ DEG_OPCODE_OBJECT_UBEREVAL,
-/* XXX: ubereval is for temporary porting purposes only */
-DEF_DEG_OPCODE(OBJECT_UBEREVAL)
+ /* Geometry ---------------------------------------- */
-/* Geometry ---------------------------------------- */
+ /* XXX: Placeholder - UberEval */
+ DEG_OPCODE_GEOMETRY_UBEREVAL,
-/* XXX: Placeholder - UberEval */
-DEF_DEG_OPCODE(GEOMETRY_UBEREVAL)
+ /* Modifier */
+ DEG_OPCODE_GEOMETRY_MODIFIER,
-/* Modifier */
-DEF_DEG_OPCODE(GEOMETRY_MODIFIER)
+ /* Curve Objects - Path Calculation (used for path-following tools, */
+ DEG_OPCODE_GEOMETRY_PATH,
-/* Curve Objects - Path Calculation (used for path-following tools) */
-DEF_DEG_OPCODE(GEOMETRY_PATH)
+ /* Pose -------------------------------------------- */
-/* Pose -------------------------------------------- */
+ /* Init IK Trees, etc. */
+ DEG_OPCODE_POSE_INIT,
-/* Init IK Trees, etc. */
-DEF_DEG_OPCODE(POSE_INIT)
+ /* Free IK Trees + Compute Deform Matrices */
+ DEG_OPCODE_POSE_DONE,
-/* Free IK Trees + Compute Deform Matrices */
-DEF_DEG_OPCODE(POSE_DONE)
+ /* IK/Spline Solvers */
+ DEG_OPCODE_POSE_IK_SOLVER,
+ DEG_OPCODE_POSE_SPLINE_IK_SOLVER,
-/* IK/Spline Solvers */
-DEF_DEG_OPCODE(POSE_IK_SOLVER)
-DEF_DEG_OPCODE(POSE_SPLINE_IK_SOLVER)
+ /* Bone -------------------------------------------- */
-/* Bone -------------------------------------------- */
+ /* Bone local transforms - Entrypoint */
+ DEG_OPCODE_BONE_LOCAL,
-/* Bone local transforms - Entrypoint */
-DEF_DEG_OPCODE(BONE_LOCAL)
+ /* Pose-space conversion (includes parent + restpose, */
+ DEG_OPCODE_BONE_POSE_PARENT,
-/* Pose-space conversion (includes parent + restpose) */
-DEF_DEG_OPCODE(BONE_POSE_PARENT)
+ /* Constraints */
+ DEG_OPCODE_BONE_CONSTRAINTS,
+ //DEG_OPCODE_BONE_CONSTRAINTS_INIT,
+ //DEG_OPCODE_BONE_CONSTRAINT,
+ //DEG_OPCODE_BONE_CONSTRAINTS_DONE,
-/* Constraints */
-DEF_DEG_OPCODE(BONE_CONSTRAINTS)
-//DEF_DEG_OPCODE(BONE_CONSTRAINTS_INIT)
-//DEF_DEG_OPCODE(BONE_CONSTRAINT)
-//DEF_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,
-/* 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...
-DEF_DEG_OPCODE(BONE_READY)
-D
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list