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:
authorAntony Riakiotakis <kalast@gmail.com>2014-11-06 19:55:55 +0300
committerAntony Riakiotakis <kalast@gmail.com>2014-11-06 20:07:18 +0300
commit4542504162a2962188e708e8b7dab609bddc0865 (patch)
treed06646f68a280554163882f1c87c805390de7044 /source/blender
parenta91888206fbef1dd43439986505865d0d1f10935 (diff)
better fix for fix T42525 (tm)
Looks like material node trees are stored directly in the material. The reason I thought this was fixed was because my test file didn't connect the lamp data node in the rest of the tree. Thanks to Campbell for catching this :)
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/object.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index b910e11beed..96c5944794e 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -96,6 +96,7 @@
#include "BKE_editmesh.h"
#include "BKE_mball.h"
#include "BKE_modifier.h"
+#include "BKE_node.h"
#include "BKE_object.h"
#include "BKE_paint.h"
#include "BKE_particle.h"
@@ -436,7 +437,6 @@ void BKE_object_unlink(Object *ob)
SceneRenderLayer *srl;
FreestyleLineSet *lineset;
bNodeTree *ntree;
- bNode *node;
Curve *cu;
Tex *tex;
Group *group;
@@ -638,17 +638,22 @@ void BKE_object_unlink(Object *ob)
}
/* materials */
- mat = bmain->mat.first;
- while (mat) {
-
+ for (mat = bmain->mat.first; mat; mat = mat->id.next) {
+ if (mat->nodetree) {
+ ntreeSwitchID(mat->nodetree, &ob->id, NULL);
+ }
for (a = 0; a < MAX_MTEX; a++) {
if (mat->mtex[a] && ob == mat->mtex[a]->object) {
/* actually, test for lib here... to do */
mat->mtex[a]->object = NULL;
}
}
+ }
- mat = mat->id.next;
+ /* node trees */
+ for (ntree = bmain->nodetree.first; ntree; ntree = ntree->id.next) {
+ if (ntree->type == NTREE_SHADER)
+ ntreeSwitchID(ntree, &ob->id, NULL);
}
/* textures */
@@ -813,15 +818,6 @@ void BKE_object_unlink(Object *ob)
}
camera = camera->id.next;
}
-
- /* nodes */
- for (ntree = bmain->nodetree.first; ntree; ntree = ntree->id.next) {
- for (node = ntree->nodes.first; node; node = node->next) {
- if (node->id == &ob->id) {
- node->id = NULL;
- }
- }
- }
}
/* actual check for internal data, not context or flags */