[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14942] trunk/blender/source/blender/nodes /intern/SHD_nodes/SHD_dynamic.c: == PyNodes ==

Willian Padovani Germano wpgermano at gmail.com
Fri May 23 18:31:02 CEST 2008


Revision: 14942
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14942
Author:   ianwill
Date:     2008-05-23 18:31:02 +0200 (Fri, 23 May 2008)

Log Message:
-----------
== PyNodes ==

Fixing bug #11737 reported by Daniel Salazar (Zanqdo, thanks!): assigning as pynode a text that failed to parse as a pynode script, then deleting that text would crash Blender.

http://projects.blender.org/tracker/?func=detail&atid=125&aid=11737&group_id=9

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

Modified: trunk/blender/source/blender/nodes/intern/SHD_nodes/SHD_dynamic.c
===================================================================
--- trunk/blender/source/blender/nodes/intern/SHD_nodes/SHD_dynamic.c	2008-05-23 11:12:03 UTC (rev 14941)
+++ trunk/blender/source/blender/nodes/intern/SHD_nodes/SHD_dynamic.c	2008-05-23 16:31:02 UTC (rev 14942)
@@ -239,6 +239,27 @@
 	tinfo = node->typeinfo;
 	tinfo_default = node_dynamic_find_typeinfo(&node_all_shaders, NULL);
 
+	if ((tinfo == tinfo_default) && unlink_text) {
+		ID *textID = node->id;
+	/* already at default (empty) state, which happens if this node's
+	 * script failed to parse at the first stage: definition. We're here
+	 * because its text was removed from Blender. */
+		for (ma= G.main->mat.first; ma; ma= ma->id.next) {
+			if (ma->nodetree) {
+				bNode *nd;
+				for (nd= ma->nodetree->nodes.first; nd; nd = nd->next) {
+					if (nd->id == textID) {
+						nd->id = NULL;
+						nd->custom1 = 0;
+						nd->custom1 = BSET(nd->custom1, NODE_DYNAMIC_NEW);
+						BLI_strncpy(nd->name, "Dynamic", 8);
+						return;
+					}
+				}
+			}
+		}
+	}
+
 	node_dynamic_rem_all_links(tinfo);
 	node_dynamic_free_typeinfo_sockets(tinfo);
 





More information about the Bf-blender-cvs mailing list