[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33332] branches/particles-2010/source/ blender/nodes/intern/SIM_nodes/SIM_curve.c: Added missing file.

Lukas Toenne lukas.toenne at googlemail.com
Fri Nov 26 15:02:00 CET 2010


Revision: 33332
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33332
Author:   lukastoenne
Date:     2010-11-26 15:02:00 +0100 (Fri, 26 Nov 2010)

Log Message:
-----------
Added missing file.

Added Paths:
-----------
    branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_curve.c

Added: branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_curve.c
===================================================================
--- branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_curve.c	                        (rev 0)
+++ branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_curve.c	2010-11-26 14:02:00 UTC (rev 33332)
@@ -0,0 +1,93 @@
+/**
+ * ***** 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) 2005 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "../SIM_util.h"
+
+#include "DNA_color_types.h"
+
+#include "BKE_colortools.h"
+
+/* **************** Curve ******************** */ 
+
+static bNodeSocketDefinition inputs[]= {
+	{ SOCK_FLOAT, 1, "Input", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+	{ -1, 0, "" }
+};
+
+static bNodeSocketDefinition outputs[]= {
+	{ SOCK_FLOAT, 0, "Value", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
+	{ -1, 0, "" }
+};
+
+static void kernel_curve(int global_id, void **UNUSED(args), SimNodeStack *node)
+{
+	float x;
+	SIM_INPUT_FLOAT(0, global_id, &x);
+	*SIM_OUTPUT_FLOAT(0, global_id) = curvemapping_evaluateF(node->base->storage, 0, x);
+}
+
+static void enqueue(SimExecData *execdata, SimNodeStack *node, SimDataContext *UNUSED(self))
+{
+	SimKernel *kernel;
+	
+	kernel=MEM_callocN(sizeof(SimKernel), "SimKernel");
+	sim_kernel_init(execdata, kernel, node, kernel_curve, NULL, 0);
+	sim_kernel_enqueue(execdata, kernel, node->outstack[0].context.size, &node->inputevents, &node->events);
+}
+
+static void init(bNode *node)
+{
+	node->storage= curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
+}
+
+void nodeRegisterSimCurve(ListBase *typelist)
+{
+	static bNodeType type;
+	memset(&type, 0, sizeof(bNodeType));
+	
+	/* required */
+	type.type = SIM_NODE_CURVE;
+	type.name = "Curve";
+	type.width = 120;
+	type.minwidth = 110;
+	type.maxwidth = 160;
+	type.nclass = NODE_CLASS_CONVERTOR;
+	
+	/* optional */
+	type.flag = NODE_OPTIONS;
+	type.inputs = inputs;
+	type.outputs = outputs;
+	
+	strcpy(type.storagename, "CurveMapping");
+	type.initfunc = init;
+	type.freestoragefunc = node_free_curves;
+	type.copystoragefunc = node_copy_curves;
+	
+	type.enqueue = enqueue;
+	
+	nodeRegisterType(typelist, &type);
+}





More information about the Bf-blender-cvs mailing list