[Bf-blender-cvs] [3874c7f] depsgraph_cleanup: Depsgraph: Move opcodes to depsgraph_types.h file

Sergey Sharybin noreply at git.blender.org
Thu May 26 10:02:42 CEST 2016


Commit: 3874c7f3dc7a60849f44e2033ebfa06e71678dcd
Author: Sergey Sharybin
Date:   Wed May 25 17:39:45 2016 +0200
Branches: depsgraph_cleanup
https://developer.blender.org/rB3874c7f3dc7a60849f44e2033ebfa06e71678dcd

Depsgraph: Move opcodes to depsgraph_types.h file

No real reason to have a dedicated file for just opcodes.

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

M	source/blender/depsgraph/CMakeLists.txt
M	source/blender/depsgraph/intern/depsgraph_type_defines.cc
M	source/blender/depsgraph/intern/depsgraph_types.h
D	source/blender/depsgraph/intern/depsnode_opcodes.cc
D	source/blender/depsgraph/intern/depsnode_opcodes.h

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

diff --git a/source/blender/depsgraph/CMakeLists.txt b/source/blender/depsgraph/CMakeLists.txt
index 3898a7f..8e00460 100644
--- a/source/blender/depsgraph/CMakeLists.txt
+++ b/source/blender/depsgraph/CMakeLists.txt
@@ -58,7 +58,6 @@ set(SRC
 	intern/depsgraph_query.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
@@ -78,7 +77,6 @@ set(SRC
 	intern/depsnode.h
 	intern/depsnode_component.h
 	intern/depsnode_operation.h
-	intern/depsnode_opcodes.h
 	intern/depsgraph_debug.h
 	intern/depsgraph_intern.h
 	intern/depsgraph_types.h
diff --git a/source/blender/depsgraph/intern/depsgraph_type_defines.cc b/source/blender/depsgraph/intern/depsgraph_type_defines.cc
index 5a3048a..84c3d37 100644
--- a/source/blender/depsgraph/intern/depsgraph_type_defines.cc
+++ b/source/blender/depsgraph/intern/depsgraph_type_defines.cc
@@ -30,6 +30,8 @@
  * Defines and code for core node types.
  */
 
+#include <cstdlib>  // for BLI_assert()
+
 extern "C" {
 #include "BLI_utildefines.h"
 #include "BLI_ghash.h"
@@ -100,3 +102,65 @@ DepsNodeFactory *DEG_node_get_factory(const DepsNode *node)
 
 	return DEG_get_node_factory(node->type);
 }
+
+/* Stringified opcodes ------------------------------------- */
+
+DepsOperationStringifier DEG_OPNAMES;
+
+static const char *stringify_opcode(eDepsOperation_Code 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);
+
+		case DEG_NUM_OPCODES: return "SpecialCase";
+#undef STRINGIFY_OPCODE
+	}
+	return "UNKNOWN";
+}
+
+DepsOperationStringifier::DepsOperationStringifier() {
+	for (int i = 0; i < DEG_NUM_OPCODES; ++i) {
+		names_[i] = stringify_opcode((eDepsOperation_Code)i);
+	}
+}
+
+const char *DepsOperationStringifier::operator[](eDepsOperation_Code 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/depsgraph_types.h b/source/blender/depsgraph/intern/depsgraph_types.h
index 40d9d3e..231c813 100644
--- a/source/blender/depsgraph/intern/depsgraph_types.h
+++ b/source/blender/depsgraph/intern/depsgraph_types.h
@@ -96,7 +96,125 @@ typedef enum eDepsNode_Type {
 } eDepsNode_Type;
 
 /* Identifiers for common operations (as an enum). */
-#include "depsnode_opcodes.h"
+typedef enum eDepsOperation_Code {
+	/* Generic Operations ------------------------------ */
+
+	/* Placeholder for operations which don't need special mention */
+	DEG_OPCODE_OPERATION = 0,
+
+	// XXX: Placeholder while porting depsgraph code
+	DEG_OPCODE_PLACEHOLDER,
+
+	DEG_OPCODE_NOOP,
+
+	/* 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;
+
+/* 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 {
diff --git a/source/blender/depsgraph/intern/depsnode_opcodes.cc b/source/blender/depsgraph/intern/depsnode_opcodes.cc
deleted file mode 100644
index 5af5bcd..0000000
--- a/source/blender/depsgraph/intern/depsnode_opcodes.cc
+++ /dev/null
@@ -1,91 +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) 2016 Blender Foundation.
- * All rights reserved.
- *
- * Original Author: Sergey Sharybin
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#include "depsnode_opcodes.h"
-
-#include <cstdlib>  // for BLI_assert()
-
-#include "BLI_utildefines.h"
-
-DepsOperationStringifier DEG_OPNAMES;
-
-static const char *stringify_opcode(eDepsOperation_Code 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);
-
-		case DEG_NUM_OPCODES: return "SpecialCase";
-#undef STRINGIFY_OPCODE
-	}
-	return "UNKNOWN";
-}
-
-DepsOperationStringifier::DepsOperationStringifier() {
-	for (int i = 0; i < DEG_NUM_OPCODES; ++i) {
-		names_[i] = stringify_opcode((eDepsOperation_Code)i);
-	}
-}
-
-const char *DepsOperationStringifier::operator[](eDepsOperation_Code opcode) {
-	BLI_assert((opcode > 0) && (opcode < DEG_NUM_OPCO

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list