[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29712] branches/particles-2010/source/ blender: svn merge -r 29689:HEAD https://svn.blender.org/svnroot/bf-blender /branches/particles-2010

Lukas Tönne lukas.toenne at hotmail.com
Sat Jun 26 17:36:44 CEST 2010


Revision: 29712
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29712
Author:   lukastoenne
Date:     2010-06-26 17:36:44 +0200 (Sat, 26 Jun 2010)

Log Message:
-----------
svn merge -r 29689:HEAD https://svn.blender.org/svnroot/bf-blender/branches/particles-2010

Modified Paths:
--------------
    branches/particles-2010/source/blender/blenkernel/intern/particle_system.c
    branches/particles-2010/source/blender/blenloader/intern/readfile.c

Added Paths:
-----------
    branches/particles-2010/source/blender/nodes/PAR_node.h
    branches/particles-2010/source/blender/nodes/intern/PAR_nodes/
    branches/particles-2010/source/blender/nodes/intern/PAR_nodes/PAR_emitter.c
    branches/particles-2010/source/blender/nodes/intern/PAR_nodes/PAR_input.c
    branches/particles-2010/source/blender/nodes/intern/PAR_nodes/PAR_newtonian.c
    branches/particles-2010/source/blender/nodes/intern/PAR_nodes/PAR_object.c
    branches/particles-2010/source/blender/nodes/intern/PAR_nodes/PAR_program.c
    branches/particles-2010/source/blender/nodes/intern/PAR_util.c
    branches/particles-2010/source/blender/nodes/intern/PAR_util.h

Modified: branches/particles-2010/source/blender/blenkernel/intern/particle_system.c
===================================================================
--- branches/particles-2010/source/blender/blenkernel/intern/particle_system.c	2010-06-26 15:07:43 UTC (rev 29711)
+++ branches/particles-2010/source/blender/blenkernel/intern/particle_system.c	2010-06-26 15:36:44 UTC (rev 29712)
@@ -464,6 +464,14 @@
 			return 0;
 	}
 
+	{
+		ModifierData *md;
+		printf("MODIFIERS:\n");
+		for (md=ob->modifiers.first; md; md = md->next)
+			printf("md->name = %s\n", md->name);
+		printf("----------\n");
+	}
+	
 	psmd= psys_get_modifier(ob, psys);
 	if(psys->renderdata) {
 		if(!(psmd->modifier.mode & eModifierMode_Render))

Modified: branches/particles-2010/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/particles-2010/source/blender/blenloader/intern/readfile.c	2010-06-26 15:07:43 UTC (rev 29711)
+++ branches/particles-2010/source/blender/blenloader/intern/readfile.c	2010-06-26 15:36:44 UTC (rev 29712)
@@ -3695,14 +3695,6 @@
 				ParticleEmitterModifierData *pemd = (ParticleEmitterModifierData *)modifiers_findByType(ob, eModifierType_ParticleEmitter);
 				
 				if(pemd) {
-					#if 0
-					ParticleSystemsItem *item = (ParticleSystemsItem*)pemd->psystems.first;
-					while (item) {
-						item->ob = newlibadr(fd, ob->id.lib, item->ob);
-						item->psys = newlibadr(fd, ob->id.lib, item->psys);
-						item = item->next;
-					}
-					#endif
 				}
 			}
 			
@@ -3914,9 +3906,6 @@
 		} else if (md->type==eModifierType_ParticleEmitter) {
 			ParticleEmitterModifierData *pemd = (ParticleEmitterModifierData*) md;
 
-			#if 0
-			link_list(fd, &pemd->psystems);
-			#endif
 			pemd->dm = NULL;
 		} else if (md->type==eModifierType_Explode) {
 			ExplodeModifierData *psmd = (ExplodeModifierData*) md;

Added: branches/particles-2010/source/blender/nodes/PAR_node.h
===================================================================
--- branches/particles-2010/source/blender/nodes/PAR_node.h	                        (rev 0)
+++ branches/particles-2010/source/blender/nodes/PAR_node.h	2010-06-26 15:36:44 UTC (rev 29712)
@@ -0,0 +1,46 @@
+/**
+ *
+ * ***** 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License.  See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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 *****
+ */
+
+#ifndef PAR_NODE_H
+#define PAR_NODE_H
+
+#include "BKE_node.h"
+
+
+/* ****************** types array for all particle nodes ****************** */
+
+extern bNodeType par_node_input;
+extern bNodeType par_node_program;
+extern bNodeType par_node_newtonian;
+extern bNodeType par_node_emitter;
+extern bNodeType par_node_object;
+
+#endif

Added: branches/particles-2010/source/blender/nodes/intern/PAR_nodes/PAR_emitter.c
===================================================================
--- branches/particles-2010/source/blender/nodes/intern/PAR_nodes/PAR_emitter.c	                        (rev 0)
+++ branches/particles-2010/source/blender/nodes/intern/PAR_nodes/PAR_emitter.c	2010-06-26 15:36:44 UTC (rev 29712)
@@ -0,0 +1,132 @@
+/**
+ *
+ * ***** 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):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "../PAR_util.h"
+
+#include "DNA_node_types.h"
+#include "DNA_particle_types.h"
+
+#include "BKE_particle_emitter.h"
+#include "BKE_particle_settings.h"
+#include "BKE_particle_system.h"
+
+/* **************** Newtonian Physics ******************** */
+static bNodeSocketType inputs[]= {
+//	{ SOCK_OP, 1, "Port",		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f },
+	{ SOCK_ID, 1, "Object",	0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f },
+	{ SOCK_VALUE, 1, "Rate",	1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f },
+	{ -1, 0, "" }
+};
+static bNodeSocketType outputs[]= {
+	{ SOCK_OP, 0, "Exec",		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f },
+	{ -1, 0, "" }
+};
+
+static int operator_exec(struct ParticleOperator *op, ParticleOperatorContext *ctx)
+{
+	ParticleNodeEmitter *pne = (ParticleNodeEmitter*)op->data;
+	ParticleSystem *psys= ctx->sim->psys;
+	ParticleSettings *pset= psys->part;
+	int oldtotpart, emit;
+	ParticleIterator pit;
+	
+	/* TODO frames & times - phonybone */
+
+	/* TODO the emitter will use the it's own settings. more interesting emission methods can be added. */
+
+	oldtotpart = psys->totpart;
+	/* This ensures that even for dfra << 1 the accumulated emission per frame will equal emission_rate. */
+	emit = (int)(pne->rate * (ctx->cfra + ctx->dfra)) - (int)(pne->rate * ctx->cfra);
+	psys_emit_particles(ctx->sim, ctx->cfra, emit);
+	
+	/* initialize new particles */
+	psys_iterator_init(&pit, psys);
+	psys_iterator_goto(&pit, oldtotpart);
+	while (pit.pa) {
+		psys_distribute_particle(ctx->sim, pne->emitter_index, pit.pa, pit.index);
+		reset_particle(ctx->sim, pit.pa, pit.index, ctx->dfra, ctx->cfra); /* XXX dfra should be changed to dtime - phonybone */
+		
+		psys_iterator_next(&pit);
+	}
+	
+	return 1;
+}
+
+static void init(bNode *node)
+{
+	ParticleNodeEmitter *pne = MEM_callocN(sizeof(struct ParticleNodeEmitter), "par_node_emitter storage");
+	pne->op.execute = operator_exec;
+	pne->op.data = pne;
+	pne->emitter_index = -1;
+	
+	node->storage = pne;
+}
+
+static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+{
+	ParticlesCallData *pcd= (ParticlesCallData*)data;
+	ParticleNodeEmitter *pne = (ParticleNodeEmitter*)node->storage;
+	ID *id;
+	Object *ob;
+
+	par_input_get_id(&id, in[0]);
+	/* TODO check if data type is mesh - phonybone */
+	if (!id || GS(id->name) != ID_OB)
+		ob = NULL;
+	else
+		ob = (Object*)id;
+	
+	par_input_get_value(&pne->rate, in[1]);
+	
+	/* update the emitter cache entry */
+	/* TODO this should only be done when necessary - phonybone */
+	if (pne->emitter_index < 0)
+		out[0]->data = NULL;
+	else {
+		psys_update_emitter_cache(pcd->sim->psys, pne->emitter_index, ob);
+		
+		out[0]->data = &pne->op;
+	}
+}
+
+bNodeType par_node_emitter= {
+	/* *next,*prev */	NULL, NULL,
+	/* type code   */	PAR_NODE_EMITTER,
+	/* name        */	"Emitter",
+	/* width+range */	100, 60, 150,
+	/* class+opts  */	NODE_CLASS_SIMULATION, NODE_OPTIONS,
+	/* input sock  */	inputs,
+	/* output sock */	outputs,
+	/* storage     */	"", 
+	/* execfunc    */	exec,
+	/* butfunc     */	NULL,
+	/* initfunc    */	init,
+	/* freestoragefunc    */	node_free_standard_storage,
+	/* copystoragefunc    */	node_copy_standard_storage,
+	/* id          */	NULL
+};

Added: branches/particles-2010/source/blender/nodes/intern/PAR_nodes/PAR_input.c
===================================================================
--- branches/particles-2010/source/blender/nodes/intern/PAR_nodes/PAR_input.c	                        (rev 0)
+++ branches/particles-2010/source/blender/nodes/intern/PAR_nodes/PAR_input.c	2010-06-26 15:36:44 UTC (rev 29712)
@@ -0,0 +1,74 @@
+/**
+ *
+ * ***** 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):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "../PAR_util.h"
+
+#include "BKE_particle_system.h"
+
+/* **************** Simulation ******************** */
+static bNodeSocketType inputs[]= {
+	{ -1, 0, "" }
+};
+static bNodeSocketType outputs[]= {
+	{ SOCK_VALUE, 0, "timestep",	1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f },
+	{ SOCK_VECTOR, 0, "location",	0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f },
+	{ SOCK_VECTOR, 0, "velocity",	0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f },
+	{ SOCK_VALUE, 0, "size",		1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f },
+	{ -1, 0, "" }
+};
+
+static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+{
+//	if (data) {
+//		float timestep= ((ParticlesCallData*)data)->timestep;
+//		int p;
+		
+//		printf("me executing things ...\n");
+//		for (p= 0; p < bucket->num_particles; ++p) {

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list