[Bf-blender-cvs] [4484fbe] depsgraph_refactor: Added back defines of "opcodes" for opearation nodes

Joshua Leung noreply at git.blender.org
Wed Dec 17 04:41:00 CET 2014


Commit: 4484fbe4b2836a8db7f697b0c6da8171d417fe5c
Author: Joshua Leung
Date:   Fri Dec 12 15:26:05 2014 +1300
Branches: depsgraph_refactor
https://developer.blender.org/rB4484fbe4b2836a8db7f697b0c6da8171d417fe5c

Added back defines of "opcodes" for opearation nodes

These are essentially identifiers we can use for quickly checking or searching
for particular types of operation nodes from a component, without resorting
to dynamically building identifier strings or other crazy stuff like that.

* Unlike in the past, these are stored on the OperationDepsNodes themselves.

* Not all operations need to have an identifier defined. Only those operations
  which are very common or important must have one. All others can simply
  reuse the generic "DEG_OPCODE_OPERATION" with a suitable string

* These are defined in a separate header, which is designed to be used like UI_icons.h
  to create a set of printable string ID's for nicer debug printing

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

M	source/blender/depsgraph/CMakeLists.txt
A	source/blender/depsgraph/intern/depsnode_opcodes.h
M	source/blender/depsgraph/intern/depsnode_operation.h

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

diff --git a/source/blender/depsgraph/CMakeLists.txt b/source/blender/depsgraph/CMakeLists.txt
index 5231ae4..bd23b6c 100644
--- a/source/blender/depsgraph/CMakeLists.txt
+++ b/source/blender/depsgraph/CMakeLists.txt
@@ -65,6 +65,7 @@ set(SRC
 	intern/depsnode.h
 	intern/depsnode_component.h
 	intern/depsnode_operation.h
+	intern/depsnode_opcodes.h
 	intern/depsgraph_build.h
 	intern/depsgraph_debug.h
 	intern/depsgraph_eval.h
diff --git a/source/blender/depsgraph/intern/depsnode_opcodes.h b/source/blender/depsgraph/intern/depsnode_opcodes.h
new file mode 100644
index 0000000..28725eb
--- /dev/null
+++ b/source/blender/depsgraph/intern/depsnode_opcodes.h
@@ -0,0 +1,126 @@
+/*
+ * ***** 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) 2014 Blender Foundation.
+ * All rights reserved.
+ *
+ * Original Author: Joshua Leung
+ * Contributor(s): None Yet
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/* == OpCodes for OperationDepsNodes == 
+ * This file defines all the "operation codes" (opcodes) used to identify
+ * common operation node types. The intention of these defines is to have
+ * a fast and reliable way of identifying the relevant nodes within a component
+ * without having to use fragile dynamic strings.
+ *
+ * This file is meant to be used like UI_icons.h. That is, before including
+ * the file, the host file must define the DEG_OPCODE(_label) macro, which
+ * is responsible for converting the define into whatever form is suitable.
+ */
+
+#ifndef __DEPSNODE_OPCODES_H__
+#define __DEPSNODE_OPCODES_H__
+
+/* Example macro define: */
+/* #define DEF_DEG_OPCODE(label) DEG_OPCODE_##label, */
+
+/* Generic Operations ------------------------------ */
+
+/* Placeholder for operations which don't need special mention */
+DEF_DEG_OPCODE(OPERATION)
+
+DEF_DEG_OPCODE(NOOP)
+
+/* Animation, Drivers, etc. ------------------------ */
+
+/* NLA + Action */
+DEF_DEG_OPCODE(ANIMATION)
+
+/* Driver */
+DEF_DEG_OPCODE(DRIVER)
+
+/* Proxy Inherit? */
+//DEF_DEG_OPCODE(PROXY)
+
+/* Transform --------------------------------------- */
+
+/* Transform entry point - local transforms only */
+DEF_DEG_OPCODE(TRANSFORM_LOCAL)
+
+/* Parenting */
+DEF_DEG_OPCODE(TRANSFORM_PARENT)
+
+/* Constraints */
+DEF_DEG_OPCODE(TRANSFORM_CONSTRAINTS)
+//DEF_DEG_OPCODE(TRANSFORM_CONSTRAINTS_INIT)
+//DEF_DEG_OPCODE(TRANSFORM_CONSTRAINT)
+//DEF_DEG_OPCODE(TRANSFORM_CONSTRAINTS_DONE)
+
+//DEF_DEG_OPCODE(TRANSFORM_RIGIDBODY)
+
+/* Transform exitpoint */
+DEF_DEG_OPCODE(TRANSFORM_FINAL)
+
+/* Geometry ---------------------------------------- */
+
+/* Placeholder - UberEval */
+DEF_DEG_OPCODE(GEOMETRY_UBEREVAL)
+
+/* Modifier */
+DEF_DEG_OPCODE(GEOMETRY_MODIFIER)
+
+/* Curve Objects - Path Calculation (used for path-following tools) */
+DEF_DEG_OPCODE(GEOMETRY_PATH)
+
+/* Pose -------------------------------------------- */
+
+/* Init IK Trees, etc. */
+DEF_DEG_OPCODE(POSE_INIT)
+
+/* Free IK Trees + Compute Deform Matrices */
+DEF_DEG_OPCODE(POSE_DONE)
+
+/* IK/Spline Solvers */
+DEF_DEG_OPCODE(POSE_IK_SOLVER)
+DEF_DEG_OPCODE(POSE_SPLINE_IK_SOLVER)
+
+/* Bone -------------------------------------------- */
+
+/* Bone local transforms - Entrypoint */
+DEF_DEG_OPCODE(BONE_LOCAL)
+
+/* Pose-space conversion (includes parent + restpose) */
+DEF_DEG_OPCODE(BONE_POSE_PARENT)
+
+/* 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 
+ * - "PRE_IK"            This (internal) noop is used to signal that all pre-IK operations are done
+ *                       NOTE: it isn't strictly necessary, as it should be possible to infer this from the data
+ * - "FINAL_TRANSFORM"   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_TRANSFORM_FINAL)
+
+#endif /* __DEPSNODE_OPCODES_H__ */
diff --git a/source/blender/depsgraph/intern/depsnode_operation.h b/source/blender/depsgraph/intern/depsnode_operation.h
index 7787586..ae7ba9f 100644
--- a/source/blender/depsgraph/intern/depsnode_operation.h
+++ b/source/blender/depsgraph/intern/depsnode_operation.h
@@ -47,6 +47,13 @@ struct ID;
 struct Depsgraph;
 struct DepsgraphCopyContext;
 
+/* 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
+} eDepsOperation_Code;
+
 /* Flags for Depsgraph Nodes */
 typedef enum eDepsOperation_Flag {
 	/* node needs to be updated */
@@ -83,6 +90,8 @@ struct OperationDepsNode : public DepsNode {
 	bool scheduled;
 	
 	short optype;                 /* (eDepsOperation_Type) stage of evaluation */
+	int   opcode;                 /* (eDepsOperation_Code) identifier for the operation being performed */	
+	
 	int flag;                     /* (eDepsOperation_Flag) extra settings affecting evaluation */
 	int done;                     /* generic tag for traversal algorithms */




More information about the Bf-blender-cvs mailing list