[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31406] branches/particles-2010: * Added a ParticleDynamics node that calculates a dynamic step for particles (currently only simple 1-frame euler)

Lukas Toenne lukas.toenne at googlemail.com
Tue Aug 17 10:08:18 CEST 2010


Revision: 31406
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31406
Author:   lukastoenne
Date:     2010-08-17 10:08:18 +0200 (Tue, 17 Aug 2010)

Log Message:
-----------
* Added a ParticleDynamics node that calculates a dynamic step for particles (currently only simple 1-frame euler)
* Removed superfluous enum for particle property RNA, to remove the need to keep two lists in sync.
* Fixed output node execution macro for singleton-only inputs. These would cancel after the first element, even if there is more output data to write.
* Updated object get/set data nodes.
* Fixed minor ui script bug from latest merge.

Modified Paths:
--------------
    branches/particles-2010/release/scripts/ui/properties_data_particleset.py
    branches/particles-2010/source/blender/blenkernel/BKE_node.h
    branches/particles-2010/source/blender/blenkernel/intern/node.c
    branches/particles-2010/source/blender/editors/particleset/particleset_edit.c
    branches/particles-2010/source/blender/editors/space_node/drawnode.c
    branches/particles-2010/source/blender/makesdna/DNA_particleset_types.h
    branches/particles-2010/source/blender/makesrna/intern/rna_nodetree_types.h
    branches/particles-2010/source/blender/makesrna/intern/rna_particleset.c
    branches/particles-2010/source/blender/nodes/SIM_node.h
    branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_get_object_data.c
    branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_get_particle_data.c
    branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_get_vertex_data.c
    branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_set_object_data.c
    branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_set_particle_data.c
    branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_set_vertex_data.c
    branches/particles-2010/source/blender/nodes/intern/SIM_util.h
    branches/particles-2010/source/blender/nodes/intern/node_tree_simulation.c

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

Modified: branches/particles-2010/release/scripts/ui/properties_data_particleset.py
===================================================================
--- branches/particles-2010/release/scripts/ui/properties_data_particleset.py	2010-08-17 07:49:53 UTC (rev 31405)
+++ branches/particles-2010/release/scripts/ui/properties_data_particleset.py	2010-08-17 08:08:18 UTC (rev 31406)
@@ -20,15 +20,14 @@
 import bpy
 from rna_prop_ui import PropertyPanel
 
-narrowui = bpy.context.user_preferences.view.properties_width_check
 
-
 class DataButtonsPanel(bpy.types.Panel):
     bl_space_type = 'PROPERTIES'
     bl_region_type = 'WINDOW'
     bl_context = "data"
 
-    def poll(self, context):
+    @classmethod
+    def poll(cls, context):
         return context.particleset
 
 
@@ -42,21 +41,11 @@
         ob = context.object
         pset = context.particleset
         space = context.space_data
-        wide_ui = context.region.width > narrowui
 
-        if wide_ui:
-            split = layout.split(percentage=0.65)
-            if ob:
-                split.template_ID(ob, "data")
-                split.separator()
-            elif lat:
-                split.template_ID(space, "pin_id")
-                split.separator()
-        else:
-            if ob:
-                layout.template_ID(ob, "data")
-            elif lat:
-                layout.template_ID(space, "pin_id")
+        if ob:
+            layout.template_ID(ob, "data")
+        elif lat:
+            layout.template_ID(space, "pin_id")
 
 
 class DATA_PT_custom_props_particleset(DataButtonsPanel, PropertyPanel):
@@ -70,7 +59,6 @@
         layout = self.layout
 
         pset = context.particleset
-        wide_ui = context.region.width > narrowui
 
         row = layout.row()
         row.prop(pset, "page_size")

Modified: branches/particles-2010/source/blender/blenkernel/BKE_node.h
===================================================================
--- branches/particles-2010/source/blender/blenkernel/BKE_node.h	2010-08-17 07:49:53 UTC (rev 31405)
+++ branches/particles-2010/source/blender/blenkernel/BKE_node.h	2010-08-17 08:08:18 UTC (rev 31406)
@@ -530,6 +530,7 @@
 #define SIM_NODE_GETPARTICLEDATA	756
 #define SIM_NODE_SETPARTICLEDATA	757
 #define SIM_NODE_RANDOM				758
+#define SIM_NODE_PARTICLEDYNAMICS	759
 
 /* TO BE REMOVED: debugging stuff, testing, etc. */
 #define SIM_NODE_DEBUGPRINT			801

Modified: branches/particles-2010/source/blender/blenkernel/intern/node.c
===================================================================
--- branches/particles-2010/source/blender/blenkernel/intern/node.c	2010-08-17 07:49:53 UTC (rev 31405)
+++ branches/particles-2010/source/blender/blenkernel/intern/node.c	2010-08-17 08:08:18 UTC (rev 31406)
@@ -2911,6 +2911,7 @@
 	nodeRegisterType(ntypelist, &sim_node_getparticledata);
 	nodeRegisterType(ntypelist, &sim_node_setparticledata);
 	nodeRegisterType(ntypelist, &sim_node_random);
+	nodeRegisterType(ntypelist, &sim_node_particledynamics);
 
 	nodeRegisterType(ntypelist, &sim_node_debugprint);
 }

Modified: branches/particles-2010/source/blender/editors/particleset/particleset_edit.c
===================================================================
--- branches/particles-2010/source/blender/editors/particleset/particleset_edit.c	2010-08-17 07:49:53 UTC (rev 31405)
+++ branches/particles-2010/source/blender/editors/particleset/particleset_edit.c	2010-08-17 08:08:18 UTC (rev 31406)
@@ -148,6 +148,10 @@
 }
 
 /* ================= property_add ================= */
+static EnumPropertyItem particle_std_properties_items[] = {
+{ 0, "PLACEHOLDER",          0, "Placeholder",          ""},
+{0, NULL, 0, NULL, NULL}};
+
 static int property_add_exec(bContext *C, wmOperator *op)
 {
 	Scene *scene= CTX_data_scene(C);
@@ -170,31 +174,23 @@
 static EnumPropertyItem *property_add_itemf(bContext *C, PointerRNA *ptr, int *free)
 {	
 	Object *ob= ED_object_active_context(C);
-	EnumPropertyItem *item= NULL, *pp_item;
+	EnumPropertyItem *item= NULL;
+	EnumPropertyItem tmp = {0, "", 0, "", ""};
 	ParticlePropertyInfo *propinfo;
 	int totitem= 0, a;
 	
-	if(!ob)
-		return particle_property_std_items;
-
-	for(a=0; particle_property_std_items[a].identifier; a++) {
-		pp_item= &particle_property_std_items[a];
-
-		if(pp_item->identifier[0]) {
-			
-//			propinfo= modifierType_getInfo(md_item->value);
-
-//			if(mti->flags & eModifierTypeFlag_NoUserAdd)
-//				continue;
-
-//			if(!((mti->flags & eModifierTypeFlag_AcceptsCVs) ||
-//			   (ob->type==OB_MESH && (mti->flags & eModifierTypeFlag_AcceptsMesh))))
-//				continue;
-		}
-
-		RNA_enum_item_add(&item, &totitem, pp_item);
+	/* TODO check for existing properties! */
+//	if(!ob)
+//		return NULL;
+	
+	for (a=0, propinfo=particle_std_properties; propinfo->name[0] != '\0'; ++a, ++propinfo) {
+		tmp.identifier = propinfo->name;
+		tmp.name= propinfo->name;
+		tmp.value = a;
+		
+		RNA_enum_item_add(&item, &totitem, &tmp);
 	}
-
+	
 	RNA_enum_item_end(&item, &totitem);
 	*free= 1;
 
@@ -219,7 +215,7 @@
 	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
-	prop= RNA_def_enum(ot->srna, "type", particle_property_std_items, PARPROP_POSITION, "Type", "");
+	prop= RNA_def_enum(ot->srna, "type", particle_std_properties_items, 0, "Type", "");
 	RNA_def_enum_funcs(prop, property_add_itemf);
 	ot->prop= prop;
 }

Modified: branches/particles-2010/source/blender/editors/space_node/drawnode.c
===================================================================
--- branches/particles-2010/source/blender/editors/space_node/drawnode.c	2010-08-17 07:49:53 UTC (rev 31405)
+++ branches/particles-2010/source/blender/editors/space_node/drawnode.c	2010-08-17 08:08:18 UTC (rev 31406)
@@ -1295,6 +1295,9 @@
 	case SIM_NODE_SETPARTICLEDATA:
 		ntype->uifunc = node_simulation_buts_object;
 		break;
+	case SIM_NODE_PARTICLEDYNAMICS:
+		ntype->uifunc = node_simulation_buts_object;
+		break;
 		
 	default:
 		ntype->uifunc= NULL;

Modified: branches/particles-2010/source/blender/makesdna/DNA_particleset_types.h
===================================================================
--- branches/particles-2010/source/blender/makesdna/DNA_particleset_types.h	2010-08-17 07:49:53 UTC (rev 31405)
+++ branches/particles-2010/source/blender/makesdna/DNA_particleset_types.h	2010-08-17 08:08:18 UTC (rev 31406)
@@ -69,6 +69,8 @@
 	int mapoffset;						/* previous offset for restoring */
 } ParticlePropertyInfo;
 
+extern ParticlePropertyInfo particle_std_properties[];
+
 typedef enum eParticleStdProperty {
 	PARPROP_POSITION = 0,
 	PARPROP_VELOCITY,

Modified: branches/particles-2010/source/blender/makesrna/intern/rna_nodetree_types.h
===================================================================
--- branches/particles-2010/source/blender/makesrna/intern/rna_nodetree_types.h	2010-08-17 07:49:53 UTC (rev 31405)
+++ branches/particles-2010/source/blender/makesrna/intern/rna_nodetree_types.h	2010-08-17 08:08:18 UTC (rev 31406)
@@ -165,5 +165,6 @@
 DefNode( SimulationNode, SIM_NODE_GETPARTICLEDATA,def_sim_objectnode,     "GETPARTICLEDATA",GetParticleData,  "Get Particle Data", ""              )
 DefNode( SimulationNode, SIM_NODE_SETPARTICLEDATA,def_sim_objectnode,     "SETPARTICLEDATA",SetParticleData,  "Set Particle Data", ""              )
 DefNode( SimulationNode, SIM_NODE_RANDOM,         0,                      "RANDOM",         Random,           "Random",            ""              )
+DefNode( SimulationNode, SIM_NODE_PARTICLEDYNAMICS, def_sim_objectnode,   "PARTICLEDYNAMICS", ParticleDynamics, "Particle Dynamics", ""            )
 DefNode( SimulationNode, SIM_NODE_TIMESTEP,       0,                      "TIMESTEP",       TimeStep,         "Time Step",         ""              )
 DefNode( SimulationNode, SIM_NODE_DEBUGPRINT,     0,                      "DEBUGPRINT",     DebugPrint,       "Debug Print",       ""              )

Modified: branches/particles-2010/source/blender/makesrna/intern/rna_particleset.c
===================================================================
--- branches/particles-2010/source/blender/makesrna/intern/rna_particleset.c	2010-08-17 07:49:53 UTC (rev 31405)
+++ branches/particles-2010/source/blender/makesrna/intern/rna_particleset.c	2010-08-17 08:08:18 UTC (rev 31406)
@@ -38,14 +38,6 @@
 #include "WM_types.h"
 #include "WM_api.h"
 
-EnumPropertyItem particle_property_std_items[] = {
-	{PARPROP_POSITION, "POSITION", 0, "Position", ""},
-	{PARPROP_VELOCITY, "VELOCITY", 0, "Velocity", ""},
-	{PARPROP_MASS, "MASS", 0, "Mass", ""},
-	{PARPROP_CUSTOM, "CUSTOM", 0, "Custom", ""},
-	{0, NULL, 0, NULL, NULL}
-};
-
 #ifdef RNA_RUNTIME
 
 #include "BKE_context.h"

Modified: branches/particles-2010/source/blender/nodes/SIM_node.h
===================================================================
--- branches/particles-2010/source/blender/nodes/SIM_node.h	2010-08-17 07:49:53 UTC (rev 31405)
+++ branches/particles-2010/source/blender/nodes/SIM_node.h	2010-08-17 08:08:18 UTC (rev 31406)
@@ -73,6 +73,7 @@
 extern bNodeType sim_node_getparticledata;
 extern bNodeType sim_node_setparticledata;
 extern bNodeType sim_node_random;
+extern bNodeType sim_node_particledynamics;
 
 extern bNodeType sim_node_debugprint;
 

Modified: branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_get_object_data.c
===================================================================
--- branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_get_object_data.c	2010-08-17 07:49:53 UTC (rev 31405)
+++ branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_get_object_data.c	2010-08-17 08:08:18 UTC (rev 31406)
@@ -39,18 +39,21 @@
 };
 
 static bNodeSocketType outputs[]= { 
-	{ SOCK_VECTOR, 0, "Location", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f },
+	{ SOCK_VECTOR, 0, "Location", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0, NDC_SINGLETON },
 	{ -1, 0, "" }
 };
 
-static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static int exec(SimNodeThreadContext *ctx, SimNodeJob *job)
 {
-//	SimulationContext *sim= (SimulationContext*)data;
-	Object *ob = (Object*)node->id;
+	SimNodeDataStream ostream[1];
+	Object *ob = (Object*)job->node->node->id;
 	
 	if (ob) {
-//		sim_set_vector(out[0], ob->loc);
+		SIM_JOBEXEC_INPUT_BEGIN(ctx, job, ostream, job->current < 1);
+		sim_ostream_write_vector(ostream, 0, ob->loc);
+		SIM_JOBEXEC_INPUT_END(ctx, job)
 	}
+	return NODE_EXEC_FINISHED;
 }
 
 bNodeType sim_node_getobjectdata= {
@@ -58,14 +61,18 @@

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list