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:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2012-08-02 04:10:05 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2012-08-02 04:10:05 +0400
commit4ea2fb8b0a13ca74821b6705c683f31eafcd57ae (patch)
tree7e76e6fc3688a858dbb51966dbbb38a012c7fcd9 /source/blender/blenkernel/intern/material.c
parent40e3dfd3bd1ff22d293df1d9d7b1b9b90d9bd708 (diff)
parent6a6bcea81765976e902a4bac99ff9cbcd0faed55 (diff)
Merged changes in the trunk up to revision 49478.
Conflicts resolved: source/blender/blenkernel/intern/library.c source/blender/blenloader/intern/readfile.c source/blender/editors/interface/resources.c source/blender/makesrna/intern/rna_scene.c
Diffstat (limited to 'source/blender/blenkernel/intern/material.c')
-rw-r--r--source/blender/blenkernel/intern/material.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 6167379309c..e93b08f15fc 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -1057,28 +1057,24 @@ 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, Material *rootma)
+static void material_node_drivers_update(Scene *scene, bNodeTree *ntree, float ctime)
{
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);
}
- /* nodes... */
+ /* nodes */
for (node = ntree->nodes.first; node; node = node->next) {
- if (node->id && GS(node->id->name) == ID_MA) {
- /* TODO: prevent infinite recursion here... */
- 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, rootma);
+ if (node->id) {
+ if (GS(node->id->name) == ID_MA) {
+ material_drivers_update(scene, (Material *)node->id, ctime);
+ }
+ else if (node->type == NODE_GROUP) {
+ material_node_drivers_update(scene, (bNodeTree *)node->id, ctime);
+ }
}
}
}
@@ -1093,6 +1089,15 @@ void material_drivers_update(Scene *scene, Material *ma, float ctime)
//if (G.f & G_DEBUG)
// printf("material_drivers_update(%s, %s)\n", scene->id.name, ma->id.name);
+ /* Prevent infinite recursion by checking (and tagging the material) as having been visited already
+ * (see BKE_scene_update_tagged()). This assumes ma->id.flag & LIB_DOIT isn't set by anything else
+ * in the meantime... [#32017]
+ */
+ if (ma->id.flag & LIB_DOIT)
+ return;
+ else
+ ma->id.flag |= LIB_DOIT;
+
/* material itself */
if (ma->adt && ma->adt->drivers.first) {
BKE_animsys_evaluate_animdata(scene, &ma->id, ma->adt, ctime, ADT_RECALC_DRIVERS);
@@ -1100,7 +1105,7 @@ void material_drivers_update(Scene *scene, Material *ma, float ctime)
/* nodes */
if (ma->nodetree) {
- material_node_drivers_update(scene, ma->nodetree, ctime, ma);
+ material_node_drivers_update(scene, ma->nodetree, ctime);
}
}