[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34320] branches/particles-2010/source/ blender/nodes: Missing files added.

Lukas Toenne lukas.toenne at googlemail.com
Fri Jan 14 17:02:39 CET 2011


Revision: 34320
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=34320
Author:   lukastoenne
Date:     2011-01-14 16:02:38 +0000 (Fri, 14 Jan 2011)
Log Message:
-----------
Missing files added.

Added Paths:
-----------
    branches/particles-2010/source/blender/nodes/MOD_node.h
    branches/particles-2010/source/blender/nodes/intern/MOD_nodetree.c
    branches/particles-2010/source/blender/nodes/intern/node_exec.c
    branches/particles-2010/source/blender/nodes/intern/node_exec.h

Added: branches/particles-2010/source/blender/nodes/MOD_node.h
===================================================================
--- branches/particles-2010/source/blender/nodes/MOD_node.h	                        (rev 0)
+++ branches/particles-2010/source/blender/nodes/MOD_node.h	2011-01-14 16:02:38 UTC (rev 34320)
@@ -0,0 +1,43 @@
+/**
+ *
+ * ***** 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 MOD_NODE_H
+#define MOD_NODE_H
+
+#include "BKE_node.h"
+
+extern bNodeTreeType ntreeType_Modifier;
+
+/* ****************** types array for all simulation nodes ****************** */
+
+//void nodeRegisterSimProgram(struct ListBase *typelist);
+
+#endif

Added: branches/particles-2010/source/blender/nodes/intern/MOD_nodetree.c
===================================================================
--- branches/particles-2010/source/blender/nodes/intern/MOD_nodetree.c	                        (rev 0)
+++ branches/particles-2010/source/blender/nodes/intern/MOD_nodetree.c	2011-01-14 16:02:38 UTC (rev 34320)
@@ -0,0 +1,95 @@
+/**
+ * ***** 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) 2007 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <assert.h>
+
+#include "DNA_node_types.h"
+#include "DNA_object_types.h"
+
+#include "BLI_listbase.h"
+#include "BLI_utildefines.h"
+
+#include "BKE_global.h"
+#include "BKE_main.h"
+#include "BKE_node.h"
+
+#include "MOD_node.h"
+#include "node_util.h"
+
+#include "MEM_guardedalloc.h"
+
+//#define DEBUGPRINT
+
+static void foreachNodeTree(Main *main, void *calldata, bNodeTreeCallback func)
+{
+	Object *ob;
+	for(ob= main->object.first; ob; ob= ob->id.next) {
+		/* TODO */
+//		func(calldata, &ob->id, ob->modifier_nodetree);
+	}
+}
+
+static bNodeTreeExecData *beginExec(bNodeTree *ntree)
+{
+	bNodeTreeExecData *execdata;
+	
+	execdata = MEM_callocN(sizeof(bNodeTreeExecData), "bNodeTreeExecData");
+	
+	return execdata;
+}
+
+static void exec(bNodeTreeExecData *execdata, void *callerdata, int UNUSED(thread))
+{
+}
+
+static void endExec(bNodeTreeExecData *execdata)
+{
+}
+
+static bNodeSocketType sock_types[] = {
+};
+
+bNodeTreeType ntreeType_Modifier = {
+	/* type */				NTREE_MODIFIER,
+	/* id_name */			"NTModifier Nodetree",
+	
+	/* node_types */		{ NULL, NULL },
+	/* sock_types */		sock_types,
+	/* num_sock_types */	0,
+	
+	/* freeCache */			NULL,
+	/* freeNodeCache */		NULL,
+	/* foreachNodeTree */	foreachNodeTree,
+	/* beginExec */			beginExec,
+	/* endExec */			endExec,
+	/* exec */				exec,
+	/* update */			ntree_update,
+	/* updateNode */		ntree_update_node,
+	/* verifyLink */		ntree_verify_link
+};
+
+#undef DEBUGPRINT

Added: branches/particles-2010/source/blender/nodes/intern/node_exec.c
===================================================================
--- branches/particles-2010/source/blender/nodes/intern/node_exec.c	                        (rev 0)
+++ branches/particles-2010/source/blender/nodes/intern/node_exec.c	2011-01-14 16:02:38 UTC (rev 34320)
@@ -0,0 +1,216 @@
+/**
+ *
+ * ***** 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) 2007 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Nathan Letwory.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "DNA_node_types.h"
+
+#include "BLI_listbase.h"
+#include "BLI_utildefines.h"
+
+#include "BKE_node.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "node_exec.h"
+
+#include "CMP_util.h"
+
+bNodeThreadStack *ntreeGetThreadStack(bNodeTreeExecDataCST *execdata, int thread)
+{
+	ListBase *lb= &execdata->threadstack[thread];
+	bNodeThreadStack *nts;
+	
+	for(nts=lb->first; nts; nts=nts->next) {
+		if(!nts->used) {
+			nts->used= 1;
+			return nts;
+		}
+	}
+	nts= MEM_callocN(sizeof(bNodeThreadStack), "bNodeThreadStack");
+	nts->stack= MEM_dupallocN(execdata->stack);
+	nts->used= 1;
+	BLI_addtail(lb, nts);
+
+	return nts;
+}
+
+void ntreeReleaseThreadStack(bNodeThreadStack *nts)
+{
+	nts->used= 0;
+}
+
+void group_tag_used_outputs(bNode *gnode, bNodeStack *stack)
+{
+	bNodeTree *ntree= (bNodeTree *)gnode->id;
+	bNode *node;
+	
+	stack+= gnode->stack_index;
+	
+	for(node= ntree->nodes.first; node; node= node->next) {
+		if(node->typeinfo->execfunc) {
+			bNodeSocket *sock;
+			
+			for(sock= node->inputs.first; sock; sock= sock->next) {
+				if(sock->intern) {
+					if(sock->link) {
+						bNodeStack *ns= stack + sock->link->fromsock->stack_index;
+						ns->hasoutput= 1;
+						ns->sockettype= sock->link->fromsock->type;
+					}
+				}
+			}
+		}
+	}
+}
+
+/* recursively called for groups */
+/* we set all trees on own local indices, but put a total counter
+   in the groups, so each instance of a group has own stack */
+int ntree_begin_exec_tree(bNodeTree *ntree)
+{
+	bNode *node;
+	bNodeSocket *sock;
+	int index= 0, index_in= 0, index_out= 0;
+	
+	if((ntree->init & NTREE_TYPE_INIT)==0)
+		ntreeInitTypes(ntree);
+	
+	/* create indices for stack, check preview */
+	for(node= ntree->nodes.first; node; node= node->next) {
+		
+		for(sock= node->inputs.first; sock; sock= sock->next) {
+			/* unlinked sockets need a dummy stack entry for input */
+			if(!sock->link)
+				sock->stack_index= index++;
+			if(sock->intern==0)
+				sock->stack_index_ext= index_in++;
+		}
+		
+		for(sock= node->outputs.first; sock; sock= sock->next) {
+			sock->stack_index= index++;
+			if(sock->intern==0)
+				sock->stack_index_ext= index_out++;
+		}
+		
+		if(node->type==NODE_GROUP) {
+			if(node->id) {
+				node->stack_index= index;
+				index+= ntree_begin_exec_tree((bNodeTree *)node->id);
+			}
+		}
+	}
+	
+	return index;
+}
+
+void node_get_stack(bNode *node, bNodeStack *stack, bNodeStack **in, bNodeStack **out)
+{
+	bNodeSocket *sock;
+	
+	/* build pointer stack */
+	for(sock= node->inputs.first; sock; sock= sock->next) {
+		if(sock->link)
+			*(in++)= stack + sock->link->fromsock->stack_index;
+		else
+			*(in++)= stack + sock->stack_index;
+	}
+	
+	for(sock= node->outputs.first; sock; sock= sock->next) {
+		*(out++)= stack + sock->stack_index;
+	}
+}
+
+/* see notes at ntreeBeginExecTree */
+void group_node_get_stack(bNode *node, bNodeStack *stack, bNodeStack **in, bNodeStack **out, bNodeStack **gin, bNodeStack **gout)
+{
+	bNodeSocket *sock;
+	
+	/* build pointer stack */
+	for(sock= node->inputs.first; sock; sock= sock->next) {
+		if(sock->intern) {
+			/* yep, intern can have link or is hidden socket */
+			if(sock->link)
+				*(in++)= stack + sock->link->fromsock->stack_index;
+			else
+				*(in++)= stack + sock->stack_index;
+		}
+		else
+			*(in++)= gin[sock->stack_index_ext];
+	}
+	
+	for(sock= node->outputs.first; sock; sock= sock->next) {
+		if(sock->intern)
+			*(out++)= stack + sock->stack_index;
+		else
+			*(out++)= gout[sock->stack_index_ext];
+	}
+}
+
+void node_group_execute(bNodeStack *stack, void *data, bNode *gnode, bNodeStack **in, bNodeStack **out)
+{
+	bNode *node;
+	bNodeTree *ntree= (bNodeTree *)gnode->id;
+	bNodeStack *nsin[MAX_SOCKET];	/* arbitrary... watch this */
+	bNodeStack *nsout[MAX_SOCKET];	/* arbitrary... watch this */
+	
+	if(ntree==NULL) return;
+	
+	stack+= gnode->stack_index;
+		
+	for(node= ntree->nodes.first; node; node= node->next) {
+		if(node->typeinfo->execfunc) {
+			group_node_get_stack(node, stack, nsin, nsout, in, out);
+			
+			/* for groups, only execute outputs for edited group */
+			if(node->typeinfo->nclass==NODE_CLASS_OUTPUT) {
+				if(node->type==CMP_NODE_OUTPUT_FILE || (gnode->flag & NODE_GROUP_EDIT))
+					node->typeinfo->execfunc(data, node, nsin, nsout);
+			}
+			else
+				node->typeinfo->execfunc(data, node, nsin, nsout);
+		}
+	}
+	
+	/* free internal group output nodes */
+	if(ntree->type==NTREE_COMPOSIT) {
+		for(node= ntree->nodes.first; node; node= node->next) {
+			if(node->typeinfo->execfunc) {
+				bNodeSocket *sock;
+				

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list