[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33308] branches/particles-2010/source/ blender: Added a simple curve node for customizable mapping.

Lukas Toenne lukas.toenne at googlemail.com
Thu Nov 25 15:10:03 CET 2010


Revision: 33308
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33308
Author:   lukastoenne
Date:     2010-11-25 15:10:03 +0100 (Thu, 25 Nov 2010)

Log Message:
-----------
Added a simple curve node for customizable mapping. Currently only supports scalar (float) output, could be extended to colors, vectors, etc.

Modified Paths:
--------------
    branches/particles-2010/source/blender/blenkernel/BKE_node.h
    branches/particles-2010/source/blender/blenkernel/intern/node.c
    branches/particles-2010/source/blender/editors/space_node/drawnode.c
    branches/particles-2010/source/blender/editors/space_node/node_header.c
    branches/particles-2010/source/blender/makesrna/intern/rna_nodetree.c
    branches/particles-2010/source/blender/makesrna/intern/rna_nodetree_types.h
    branches/particles-2010/source/blender/nodes/CMakeLists.txt
    branches/particles-2010/source/blender/nodes/SIM_node.h

Modified: branches/particles-2010/source/blender/blenkernel/BKE_node.h
===================================================================
--- branches/particles-2010/source/blender/blenkernel/BKE_node.h	2010-11-25 14:00:11 UTC (rev 33307)
+++ branches/particles-2010/source/blender/blenkernel/BKE_node.h	2010-11-25 14:10:03 UTC (rev 33308)
@@ -592,6 +592,7 @@
 #define SIM_NODE_INDEX				752
 #define SIM_NODE_TIMESTEP			753
 #define SIM_NODE_RANDOM				754
+#define SIM_NODE_CURVE				755
 #define SIM_NODE_CONSTFLOAT			770
 #define SIM_NODE_CONSTINT			771
 #define SIM_NODE_CONSTBOOL			772

Modified: branches/particles-2010/source/blender/blenkernel/intern/node.c
===================================================================
--- branches/particles-2010/source/blender/blenkernel/intern/node.c	2010-11-25 14:00:11 UTC (rev 33307)
+++ branches/particles-2010/source/blender/blenkernel/intern/node.c	2010-11-25 14:10:03 UTC (rev 33308)
@@ -2537,6 +2537,8 @@
 	nodeRegisterSimConstants(ntypelist);
 	nodeRegisterSimDebugPrint(ntypelist);
 
+	nodeRegisterSimCurve(ntypelist);
+
 	nodeRegisterSimAddParticle(ntypelist);
 	nodeRegisterSimAddParticleForce(ntypelist);
 	nodeRegisterSimParticleDynamics(ntypelist);

Modified: branches/particles-2010/source/blender/editors/space_node/drawnode.c
===================================================================
--- branches/particles-2010/source/blender/editors/space_node/drawnode.c	2010-11-25 14:00:11 UTC (rev 33307)
+++ branches/particles-2010/source/blender/editors/space_node/drawnode.c	2010-11-25 14:10:03 UTC (rev 33308)
@@ -1574,6 +1574,11 @@
 	uiItemR(col, ptr, "max_iterations", 0, NULL, 0);
 }
 
+static void node_simulation_buts_curve(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+	uiTemplateCurveMapping(layout, ptr, "mapping", 'v', 0, 0);
+}
+
 static void node_simulation_buts_fromquaternion(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
 {
 	uiLayout *col;
@@ -1630,6 +1635,9 @@
 	case SIM_NODE_TOQUATERNION:
 		ntype->uifunc = node_simulation_buts_toquaternion;
 		break;
+	case SIM_NODE_CURVE:
+		ntype->uifunc = node_simulation_buts_curve;
+		break;
 		
 	default:
 		ntype->uifunc= NULL;

Modified: branches/particles-2010/source/blender/editors/space_node/node_header.c
===================================================================
--- branches/particles-2010/source/blender/editors/space_node/node_header.c	2010-11-25 14:00:11 UTC (rev 33307)
+++ branches/particles-2010/source/blender/editors/space_node/node_header.c	2010-11-25 14:10:03 UTC (rev 33308)
@@ -203,7 +203,7 @@
 	else if(snode->treetype==NTREE_SIMULATION) {
 		uiItemMenuF(layout, "Execution", 0, node_auto_add_menu, SET_INT_IN_POINTER(NODE_CLASS_EXECUTION));
 		uiItemMenuF(layout, "Data", 0, node_auto_add_menu, SET_INT_IN_POINTER(NODE_CLASS_DATA));
-		uiItemMenuF(layout, "Input", 0, node_auto_add_menu, SET_INT_IN_POINTER(NODE_CLASS_INPUT));
+		uiItemMenuF(layout, "Convertor", 0, node_auto_add_menu, SET_INT_IN_POINTER(NODE_CLASS_CONVERTOR));
 		uiItemMenuF(layout, "Math", 0, node_auto_add_menu, SET_INT_IN_POINTER(NODE_CLASS_MATH));
 		uiItemMenuF(layout, "Vector Math", 0, node_auto_add_menu, SET_INT_IN_POINTER(NODE_CLASS_MATH_VECTOR));
 		uiItemMenuF(layout, "Rotation Math", 0, node_auto_add_menu, SET_INT_IN_POINTER(NODE_CLASS_MATH_ROTATION));

Modified: branches/particles-2010/source/blender/makesrna/intern/rna_nodetree.c
===================================================================
--- branches/particles-2010/source/blender/makesrna/intern/rna_nodetree.c	2010-11-25 14:00:11 UTC (rev 33307)
+++ branches/particles-2010/source/blender/makesrna/intern/rna_nodetree.c	2010-11-25 14:10:03 UTC (rev 33308)
@@ -2432,6 +2432,17 @@
 	RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
 }
 
+static void def_sim_curve(StructRNA *srna)
+{
+	PropertyRNA *prop;
+	
+	prop = RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE);
+	RNA_def_property_pointer_sdna(prop, NULL, "storage");
+	RNA_def_property_struct_type(prop, "CurveMapping");
+	RNA_def_property_ui_text(prop, "Mapping", "");
+	RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+}
+
 /* XXX This is a partial of the Object rotation modes. See rna_object.c
  * The quaternion mode has been removed, since quaternion-to-quaternion conversion is not needed
  */

Modified: branches/particles-2010/source/blender/makesrna/intern/rna_nodetree_types.h
===================================================================
--- branches/particles-2010/source/blender/makesrna/intern/rna_nodetree_types.h	2010-11-25 14:00:11 UTC (rev 33307)
+++ branches/particles-2010/source/blender/makesrna/intern/rna_nodetree_types.h	2010-11-25 14:10:03 UTC (rev 33308)
@@ -173,6 +173,7 @@
 DefNode( SimulationNode, SIM_NODE_PARTICLEDYNAMICS, 0,                    "PARTICLEDYNAMICS", ParticleDynamics, "Particle Dynamics", ""            )
 DefNode( SimulationNode, SIM_NODE_ADDPARTICLEFORCE, 0,                    "ADDPARTICLEFORCE", AddParticleForce, "Add Particle Force", ""            )
 DefNode( SimulationNode, SIM_NODE_TIMESTEP,       0,                      "TIMESTEP",       TimeStep,         "Time Step",         ""              )
+DefNode( SimulationNode, SIM_NODE_CURVE,          def_sim_curve,          "CURVE",          Curve,            "Curve",             ""              )
 DefNode( SimulationNode, SIM_NODE_DEBUGPRINT,     0,                      "DEBUGPRINT",     DebugPrint,       "Debug Print",       ""              )
 DefNode( SimulationNode, SIM_NODE_CONSTFLOAT,     def_sim_constant,       "CONSTFLOAT",     ConstFloat,       "Float",             ""              )
 DefNode( SimulationNode, SIM_NODE_CONSTINT,       def_sim_constant,       "CONSTINT",       ConstInt,         "Integer",           ""              )

Modified: branches/particles-2010/source/blender/nodes/CMakeLists.txt
===================================================================
--- branches/particles-2010/source/blender/nodes/CMakeLists.txt	2010-11-25 14:00:11 UTC (rev 33307)
+++ branches/particles-2010/source/blender/nodes/CMakeLists.txt	2010-11-25 14:10:03 UTC (rev 33308)
@@ -144,6 +144,7 @@
 	intern/SIM_nodes/SIM_add_particle.c
 	intern/SIM_nodes/SIM_add_particle_force.c
 	intern/SIM_nodes/SIM_constant.c
+	intern/SIM_nodes/SIM_curve.c
 	intern/SIM_nodes/SIM_debugprint.c
 	intern/SIM_nodes/SIM_filter.c
 	intern/SIM_nodes/SIM_for.c

Modified: branches/particles-2010/source/blender/nodes/SIM_node.h
===================================================================
--- branches/particles-2010/source/blender/nodes/SIM_node.h	2010-11-25 14:00:11 UTC (rev 33307)
+++ branches/particles-2010/source/blender/nodes/SIM_node.h	2010-11-25 14:10:03 UTC (rev 33308)
@@ -82,6 +82,8 @@
 void nodeRegisterSimRandom(struct ListBase *typelist);
 void nodeRegisterSimConstants(struct ListBase *typelist);
 
+void nodeRegisterSimCurve(struct ListBase *typelist);
+
 void nodeRegisterSimAddParticle(struct ListBase *typelist);
 void nodeRegisterSimAddParticleForce(struct ListBase *typelist);
 void nodeRegisterSimParticleDynamics(struct ListBase *typelist);





More information about the Bf-blender-cvs mailing list