[Bf-blender-cvs] [17ef1b3] depsgraph_cleanup: Depsgraph: Use proper type for opcode

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


Commit: 17ef1b39902dff977a2b7ff7058ac7699364d250
Author: Sergey Sharybin
Date:   Wed May 25 15:18:18 2016 +0200
Branches: depsgraph_cleanup
https://developer.blender.org/rB17ef1b39902dff977a2b7ff7058ac7699364d250

Depsgraph: Use proper type for opcode

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

M	source/blender/depsgraph/intern/depsnode_opcodes.cc
M	source/blender/depsgraph/intern/depsnode_opcodes.h
M	source/blender/depsgraph/intern/depsnode_operation.h

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

diff --git a/source/blender/depsgraph/intern/depsnode_opcodes.cc b/source/blender/depsgraph/intern/depsnode_opcodes.cc
index b743325..3e83247 100644
--- a/source/blender/depsgraph/intern/depsnode_opcodes.cc
+++ b/source/blender/depsgraph/intern/depsnode_opcodes.cc
@@ -30,7 +30,7 @@
 
 DepsOperationStringifier DEG_OPNAMES;
 
-static const char *stringify_opcode(int opcode)
+static const char *stringify_opcode(eDepsOperation_Code opcode)
 {
 	switch (opcode) {
 #define STRINGIFY_OPCODE(name) case DEG_OPCODE_##name: return #name
@@ -67,6 +67,8 @@ static const char *stringify_opcode(int opcode)
 		STRINGIFY_OPCODE(BONE_READY);
 		STRINGIFY_OPCODE(BONE_DONE);
 		STRINGIFY_OPCODE(PSYS_EVAL);
+
+		case DEG_NUM_OPCODES: return "SpecialCase";
 #undef STRINGIFY_OPCODE
 	}
 	return "UNKNOWN";
@@ -74,11 +76,11 @@ static const char *stringify_opcode(int opcode)
 
 DepsOperationStringifier::DepsOperationStringifier() {
 	for (int i = 0; i < DEG_NUM_OPCODES; ++i) {
-		names_[i] = stringify_opcode(i);
+		names_[i] = stringify_opcode((eDepsOperation_Code)i);
 	}
 }
 
-const char *DepsOperationStringifier::operator[](int opcode) {
+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];
diff --git a/source/blender/depsgraph/intern/depsnode_opcodes.h b/source/blender/depsgraph/intern/depsnode_opcodes.h
index 955c92b..948025d 100644
--- a/source/blender/depsgraph/intern/depsnode_opcodes.h
+++ b/source/blender/depsgraph/intern/depsnode_opcodes.h
@@ -152,7 +152,7 @@ typedef enum eDepsOperation_Code {
 class DepsOperationStringifier {
 public:
 	DepsOperationStringifier();
-	const char *operator[](int opcodex);
+	const char *operator[](eDepsOperation_Code opcodex);
 protected:
 	const char *names_[DEG_NUM_OPCODES];
 };
diff --git a/source/blender/depsgraph/intern/depsnode_operation.h b/source/blender/depsgraph/intern/depsnode_operation.h
index 06cd0db..263e920 100644
--- a/source/blender/depsgraph/intern/depsnode_operation.h
+++ b/source/blender/depsgraph/intern/depsnode_operation.h
@@ -77,7 +77,7 @@ struct OperationDepsNode : public DepsNode {
 	bool scheduled;
 
 	short optype;                 /* (eDepsOperation_Type) stage of evaluation */
-	int   opcode;                 /* (eDepsOperation_Code) identifier for the operation being performed */
+	eDepsOperation_Code opcode;   /* (eDepsOperation_Code) identifier for the operation being performed */
 
 	int flag;                     /* (eDepsOperation_Flag) extra settings affecting evaluation */




More information about the Bf-blender-cvs mailing list