Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWillian Padovani Germano <wpgermano@gmail.com>2008-05-23 20:31:02 +0400
committerWillian Padovani Germano <wpgermano@gmail.com>2008-05-23 20:31:02 +0400
commit5f70682f6a622b2832e50860cc2699c67d9b7e65 (patch)
tree9f972bedc047b3bd1175e648dae38cc95397c0a3 /source/blender/nodes
parent18abce25e5e53a284818d1ebbb5ee5a7eecaa339 (diff)
== 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
Diffstat (limited to 'source/blender/nodes')
-rw-r--r--source/blender/nodes/intern/SHD_nodes/SHD_dynamic.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_dynamic.c b/source/blender/nodes/intern/SHD_nodes/SHD_dynamic.c
index 78f780c43b1..49473b213ce 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_dynamic.c
+++ b/source/blender/nodes/intern/SHD_nodes/SHD_dynamic.c
@@ -239,6 +239,27 @@ static void node_dynamic_reset(bNode *node, int unlink_text)
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);