[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12971] branches/pynodes/source/blender/ nodes/intern/SHD_nodes/SHD_dynamic.c: Small fix: when a pynode is updated ( button "Update"), remove its socket links to other nodes.

Willian Padovani Germano wpgermano at gmail.com
Fri Dec 21 21:54:39 CET 2007


Revision: 12971
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12971
Author:   ianwill
Date:     2007-12-21 21:54:39 +0100 (Fri, 21 Dec 2007)

Log Message:
-----------
Small fix: when a pynode is updated (button "Update"), remove its socket links to other nodes. This is not "final", it's just to avoid messing those links or crashing the program.

Modified Paths:
--------------
    branches/pynodes/source/blender/nodes/intern/SHD_nodes/SHD_dynamic.c

Modified: branches/pynodes/source/blender/nodes/intern/SHD_nodes/SHD_dynamic.c
===================================================================
--- branches/pynodes/source/blender/nodes/intern/SHD_nodes/SHD_dynamic.c	2007-12-21 17:42:39 UTC (rev 12970)
+++ branches/pynodes/source/blender/nodes/intern/SHD_nodes/SHD_dynamic.c	2007-12-21 20:54:39 UTC (rev 12971)
@@ -84,6 +84,7 @@
 			sock++;
 		}
 		MEM_freeN(tinfo->inputs);
+		tinfo->inputs = NULL;
 	}
 	if (tinfo->outputs) {
 		sock = tinfo->outputs;
@@ -92,6 +93,7 @@
 			sock++;
 		}
 		MEM_freeN(tinfo->outputs);
+		tinfo->outputs = NULL;
 	}
 }
 
@@ -114,6 +116,7 @@
 	BLI_freelistN(&node->outputs);
 }
 
+/* XXX for now we just remove the socket links */
 static void node_dynamic_update_socket_links(bNode *node)
 {
 	Material *ma;
@@ -126,9 +129,7 @@
 	*/
 	ma = give_current_material(OBACT, OBACT->actcol);
 	if (ma && ma->nodetree)
-		nodeUpdateType(ma->nodetree, node, node->typeinfo);
-	// XXX unfinished
-
+		nodeVerifyType(ma->nodetree, node);
 }
 
 static void node_dynamic_free_storage(bNode *node)
@@ -197,7 +198,6 @@
 
 	if (BTST(node->custom1, NODE_DYNAMIC_REPARSE)) {
 		node_dynamic_free_typeinfo_sockets(node);
-		node_dynamic_free_sockets(node);
 		node_dynamic_update_socket_links(node);
 		node_dynamic_free_storage(node);
 		nsd = MEM_callocN(sizeof(NodeScriptDict), "node script dictionary");
@@ -294,11 +294,13 @@
 }
 
 /* When a pynode is updated (REPARSE) we also update all other
- * pynodes that use the same script (same typeinfo) */
-static void node_dynamic_update_script_links(ID *id)
+ * pynodes that use the same script (same typeinfo) or not?
+ * still undecided, gotta test well first */
+/*static void node_dynamic_update_script_links(ID *id)
 {
 	return;
 }
+*/
 
 static void node_dynamic_exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) {
 	BPy_Node *mynode = NULL;





More information about the Bf-blender-cvs mailing list