[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32855] branches/particles-2010/source/ blender/nodes/intern/simulation: Fixed timestep input node.

Lukas Toenne lukas.toenne at googlemail.com
Wed Nov 3 13:53:55 CET 2010


Revision: 32855
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32855
Author:   lukastoenne
Date:     2010-11-03 13:53:55 +0100 (Wed, 03 Nov 2010)

Log Message:
-----------
Fixed timestep input node.

Modified Paths:
--------------
    branches/particles-2010/source/blender/nodes/intern/simulation/node_tree_simulation.c
    branches/particles-2010/source/blender/nodes/intern/simulation/nodes/SIM_timestep.c

Modified: branches/particles-2010/source/blender/nodes/intern/simulation/node_tree_simulation.c
===================================================================
--- branches/particles-2010/source/blender/nodes/intern/simulation/node_tree_simulation.c	2010-11-03 11:14:02 UTC (rev 32854)
+++ branches/particles-2010/source/blender/nodes/intern/simulation/node_tree_simulation.c	2010-11-03 12:53:55 UTC (rev 32855)
@@ -958,7 +958,8 @@
 		if (out->base->flag & SOCK_ADAPT_CONTEXT) {
 			if (!context_found) {
 				if (!sim_node_get_max_context(node->instack, node->totin, &ctx))
-					sim_context_create(NULL, NULL, NULL, 0, &ctx);
+					sim_context_create(self->scene, NULL, NULL, 0, &ctx);
+				context_found = 1;
 			}
 			out->context = ctx;
 		}

Modified: branches/particles-2010/source/blender/nodes/intern/simulation/nodes/SIM_timestep.c
===================================================================
--- branches/particles-2010/source/blender/nodes/intern/simulation/nodes/SIM_timestep.c	2010-11-03 11:14:02 UTC (rev 32854)
+++ branches/particles-2010/source/blender/nodes/intern/simulation/nodes/SIM_timestep.c	2010-11-03 12:53:55 UTC (rev 32855)
@@ -38,6 +38,38 @@
 	{ -1, 0, "" }
 };
 
+static void prepare_outputs(SimExecData *execdata, SimNodeStack *node, SimDataContext *self)
+{
+	SimDataContext ctx;
+	
+	sim_context_create(self->scene, NULL, NULL, 0, &ctx);
+	node->outstack[0].context = ctx;
+	node->outstack[1].context = ctx;
+	node->outstack[2].context = ctx;
+	node->outstack[3].context = ctx;
+}
+
+static void enqueue(SimExecData *execdata, SimNodeStack *node, SimDataContext *self)
+{
+	SimSocketIterator sockiter;
+	
+	sim_output_begin(execdata, &node->outstack[0], &sockiter);
+	sim_output_write_float(execdata, &sockiter, self->scene->r.cfra);
+	sim_output_end(execdata, &sockiter);
+
+	sim_output_begin(execdata, &node->outstack[1], &sockiter);
+	sim_output_write_float(execdata, &sockiter, 1.0f);
+	sim_output_end(execdata, &sockiter);
+	
+	sim_output_begin(execdata, &node->outstack[2], &sockiter);
+	sim_output_write_float(execdata, &sockiter, self->scene->r.cfra);
+	sim_output_end(execdata, &sockiter);
+
+	sim_output_begin(execdata, &node->outstack[3], &sockiter);
+	sim_output_write_float(execdata, &sockiter, 1.0f);
+	sim_output_end(execdata, &sockiter);
+}
+
 void nodeRegisterSimTimeStep(ListBase *typelist)
 {
 	static bNodeType type;
@@ -54,7 +86,8 @@
 	/* optional */
 //	type.flag = NODE_OPTIONS;
 	type.outputs = outputs;
-//	type.enqueue = enqueue;
+	type.enqueue = enqueue;
+	type.prepare_outputs = prepare_outputs;
 	
 	nodeRegisterType(typelist, &type);
 }





More information about the Bf-blender-cvs mailing list