[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32748] branches/particles-2010/source/ blender: Data nodes now also handle singleton particle data.

Lukas Toenne lukas.toenne at googlemail.com
Thu Oct 28 09:11:19 CEST 2010


Revision: 32748
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32748
Author:   lukastoenne
Date:     2010-10-28 09:11:19 +0200 (Thu, 28 Oct 2010)

Log Message:
-----------
Data nodes now also handle singleton particle data. Currently used by the OnCreate socket of the AddParticle node, which executes a subtree for just the newly created particle.

Modified Paths:
--------------
    branches/particles-2010/source/blender/makesdna/DNA_node_types.h
    branches/particles-2010/source/blender/nodes/intern/simulation/nodes/SIM_get_data.c
    branches/particles-2010/source/blender/nodes/intern/simulation/nodes/SIM_set_data.c

Modified: branches/particles-2010/source/blender/makesdna/DNA_node_types.h
===================================================================
--- branches/particles-2010/source/blender/makesdna/DNA_node_types.h	2010-10-27 22:15:55 UTC (rev 32747)
+++ branches/particles-2010/source/blender/makesdna/DNA_node_types.h	2010-10-28 07:11:19 UTC (rev 32748)
@@ -391,7 +391,6 @@
 typedef struct SimDataNodeSocket {
 	int type;						/* type of property */
 	int pad;
-//	char identifier[64];			/* identifier string */
 } SimDataNodeSocket;
 
 #define SIM_DATA_RNA		1

Modified: branches/particles-2010/source/blender/nodes/intern/simulation/nodes/SIM_get_data.c
===================================================================
--- branches/particles-2010/source/blender/nodes/intern/simulation/nodes/SIM_get_data.c	2010-10-27 22:15:55 UTC (rev 32747)
+++ branches/particles-2010/source/blender/nodes/intern/simulation/nodes/SIM_get_data.c	2010-10-28 07:11:19 UTC (rev 32748)
@@ -286,20 +286,17 @@
 	}
 	else if (data->type == SIM_DATA_PARPROP) {
 		ID *id= sim_context_id(&out->context);
-		ParticleSet *pset= NULL;
-		ParticlePropertyInfo *parprop= NULL;
-		if (id && GS(id->name)==ID_PS) {
-			pset= (ParticleSet*)id;
-			if (pset) {
-				parprop= pset_find_particle_property(pset, out->base->name);
-				if (parprop) {
-					ParticleIterator pit;
-					pit_init(&pit, pset);
-					while (pit.pa) {
-						sim_parprop_socket_write(execdata, pit.pa, parprop, &sockiter);
-						pit_next(&pit);
-						sim_output_next(execdata, &sockiter);
-					}
+		StructRNA *type= sim_context_type(&out->context);
+		if (type && RNA_struct_is_a(type, &RNA_NParticle) && id && GS(id->name)==ID_PS) {
+			ParticleSet *pset= (ParticleSet*)id;
+			ParticlePropertyInfo *parprop= pset_find_particle_property(pset, out->base->name);
+			if (parprop) {
+				ParticleIterator pit;
+				pit_init(&pit, pset);
+				while (pit.pa) {
+					sim_parprop_socket_write(execdata, pit.pa, parprop, &sockiter);
+					pit_next(&pit);
+					sim_output_next(execdata, &sockiter);
 				}
 			}
 		}
@@ -322,6 +319,16 @@
 	else if (data->type == SIM_DATA_IDPROP) {
 	}
 	else if (data->type == SIM_DATA_PARPROP) {
+		ID *id= sim_context_id(&out->context);
+		StructRNA *type= sim_context_type(&out->context);
+		if (type && RNA_struct_is_a(type, &RNA_NParticle) && id && GS(id->name)==ID_PS) {
+			ParticleSet *pset= (ParticleSet*)id;
+			ParticlePropertyInfo *parprop= pset_find_particle_property(pset, out->base->name);
+			if (parprop) {
+				NParticle *pa= (NParticle*)sim_context_data(&out->context);
+				sim_parprop_socket_read(execdata, pa, parprop, &sockiter);
+			}
+		}
 	}
 	sim_output_end(execdata, &sockiter);
 }

Modified: branches/particles-2010/source/blender/nodes/intern/simulation/nodes/SIM_set_data.c
===================================================================
--- branches/particles-2010/source/blender/nodes/intern/simulation/nodes/SIM_set_data.c	2010-10-27 22:15:55 UTC (rev 32747)
+++ branches/particles-2010/source/blender/nodes/intern/simulation/nodes/SIM_set_data.c	2010-10-28 07:11:19 UTC (rev 32748)
@@ -271,20 +271,17 @@
 	}
 	else if (data->type == SIM_DATA_PARPROP) {
 		ID *id= sim_context_id(ctx);
-		ParticleSet *pset= NULL;
-		ParticlePropertyInfo *parprop= NULL;
-		if (id && GS(id->name)==ID_PS) {
-			pset= (ParticleSet*)id;
-			if (pset) {
-				parprop= pset_find_particle_property(pset, sock->name);
-				if (parprop) {
-					ParticleIterator pit;
-					pit_init(&pit, pset);
-					while (pit.pa) {
-						sim_parprop_socket_read(execdata, pit.pa, parprop, &sockiter);
-						pit_next(&pit);
-						sim_input_next(execdata, &sockiter);
-					}
+		StructRNA *type= sim_context_type(ctx);
+		if (type && RNA_struct_is_a(type, &RNA_NParticle) && id && GS(id->name)==ID_PS) {
+			ParticleSet *pset= (ParticleSet*)id;
+			ParticlePropertyInfo *parprop= pset_find_particle_property(pset, sock->name);
+			if (parprop) {
+				ParticleIterator pit;
+				pit_init(&pit, pset);
+				while (pit.pa) {
+					sim_parprop_socket_read(execdata, pit.pa, parprop, &sockiter);
+					pit_next(&pit);
+					sim_input_next(execdata, &sockiter);
 				}
 			}
 		}
@@ -308,6 +305,16 @@
 	else if (data->type == SIM_DATA_IDPROP) {
 	}
 	else if (data->type == SIM_DATA_PARPROP) {
+		ID *id= sim_context_id(ctx);
+		StructRNA *type= sim_context_type(ctx);
+		if (type && RNA_struct_is_a(type, &RNA_NParticle) && id && GS(id->name)==ID_PS) {
+			ParticleSet *pset= (ParticleSet*)id;
+			ParticlePropertyInfo *parprop= pset_find_particle_property(pset, sock->name);
+			if (parprop) {
+				NParticle *pa= (NParticle*)sim_context_data(ctx);
+				sim_parprop_socket_read(execdata, pa, parprop, &sockiter);
+			}
+		}
 	}
 	sim_input_end(execdata, &sockiter);
 }





More information about the Bf-blender-cvs mailing list