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:
authorChris Want <cwant@ualberta.ca>2012-07-06 20:55:35 +0400
committerChris Want <cwant@ualberta.ca>2012-07-06 20:55:35 +0400
commit16b165eed5e929f8f6ea2917fa4cb803e0c1dcc0 (patch)
treec83d9b4aeb73ff98e618a11cd1d649dcf1ed651a /source/blender/blenkernel/intern/material.c
parent5f792b08e4115e4231f92f67cdc5ffde50473055 (diff)
Fix for bug 32017.
There was some bad recursion introduced recently that caused crashes when a Material node is the same material as the material itself (e.g., if Material.001 has a node with Material.001). This commit attempt to correct this by keeping track of the material at the root of the node tree, and doesn't recurse further if it encounters it again within the nodetree. Joshua, please review!
Diffstat (limited to 'source/blender/blenkernel/intern/material.c')
-rw-r--r--source/blender/blenkernel/intern/material.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 23f197155a1..de2b99fcbf9 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -1056,10 +1056,11 @@ int material_in_material(Material *parmat, Material *mat)
/* ****************** */
/* Update drivers for materials in a nodetree */
-static void material_node_drivers_update(Scene *scene, bNodeTree *ntree, float ctime)
+static void material_node_drivers_update(Scene *scene, bNodeTree *ntree, float ctime, Material *rootma)
{
bNode *node;
-
+ Material *ma;
+
/* nodetree itself */
if (ntree->adt && ntree->adt->drivers.first) {
BKE_animsys_evaluate_animdata(scene, &ntree->id, ntree->adt, ctime, ADT_RECALC_DRIVERS);
@@ -1069,10 +1070,14 @@ static void material_node_drivers_update(Scene *scene, bNodeTree *ntree, float c
for (node = ntree->nodes.first; node; node = node->next) {
if (node->id && GS(node->id->name) == ID_MA) {
/* TODO: prevent infinite recursion here... */
- material_drivers_update(scene, (Material *)node->id, ctime);
+ ma = (Material *)node->id;
+ if (ma != rootma) {
+ material_drivers_update(scene, ma, ctime);
+ }
}
else if (node->type == NODE_GROUP && node->id) {
- material_node_drivers_update(scene, (bNodeTree *)node->id, ctime);
+ material_node_drivers_update(scene, (bNodeTree *)node->id,
+ ctime, rootma);
}
}
}
@@ -1094,7 +1099,7 @@ void material_drivers_update(Scene *scene, Material *ma, float ctime)
/* nodes */
if (ma->nodetree) {
- material_node_drivers_update(scene, ma->nodetree, ctime);
+ material_node_drivers_update(scene, ma->nodetree, ctime, ma);
}
}