[Bf-blender-cvs] [3993033] depsgraph_refactor: Depsgraph: Code cleanup for single operation components

Joshua Leung noreply at git.blender.org
Tue Jan 13 03:40:20 CET 2015


Commit: 39930332a4c55ff42c6e33f545b322a9b9070648
Author: Joshua Leung
Date:   Tue Jan 13 12:50:08 2015 +1300
Branches: depsgraph_refactor
https://developer.blender.org/rB39930332a4c55ff42c6e33f545b322a9b9070648

Depsgraph: Code cleanup for single operation components

If a component has just a single operation and no declared entry/exit operation,
get_entry/exit_operation() now automatically just uses the operation that does
exist.

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

M	source/blender/depsgraph/intern/depsgraph_build.h
M	source/blender/depsgraph/intern/depsgraph_build_nodes.cpp

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

diff --git a/source/blender/depsgraph/intern/depsgraph_build.h b/source/blender/depsgraph/intern/depsgraph_build.h
index 6217095..648d4b8 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.h
+++ b/source/blender/depsgraph/intern/depsgraph_build.h
@@ -327,10 +327,26 @@ BLI_INLINE OperationDepsNode *get_exit_operation(OperationDepsNode *node)
 { return node; }
 
 BLI_INLINE OperationDepsNode *get_entry_operation(ComponentDepsNode *node)
-{ return node ? node->entry_operation : NULL; }
+{
+	if (node) {
+		if (node->entry_operation)
+			return node->entry_operation;
+		else if (node->operations.size() == 1)
+			return node->operations.begin()->second;
+	}
+	return NULL;
+}
 
 BLI_INLINE OperationDepsNode *get_exit_operation(ComponentDepsNode *node)
-{ return node ? node->exit_operation : NULL; }
+{
+	if (node) {
+		if (node->exit_operation)
+			return node->exit_operation;
+		else if (node->operations.size() == 1)
+			return node->operations.begin()->second;
+	}
+	return NULL;
+}
 
 template <typename KeyFrom, typename KeyTo>
 void DepsgraphRelationBuilder::add_relation(const KeyFrom &key_from, const KeyTo &key_to,
diff --git a/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp b/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
index 13c053d..f41a123 100644
--- a/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
@@ -352,13 +352,6 @@ void DepsgraphNodeBuilder::build_animdata(ID *id)
 			                            DEPSOP_TYPE_EXEC, function_bind(BKE_animsys_eval_animdata, _1, id, time_src),
 			                            DEG_OPCODE_ANIMATION, id->name);
 			
-			/* ensure that the Animation component uses this as its entry/exit op,
-			 * or else it won't get hooked up
-			 */
-			// XXX: maybe this should be done via the type instead?
-			adt_op->owner->entry_operation = adt_op;
-			adt_op->owner->exit_operation  = adt_op;
-			
 			// TODO: for each channel affected, we might also want to add some support for running RNA update callbacks on them
 			// (which will be needed for proper handling of drivers later)
 		}




More information about the Bf-blender-cvs mailing list