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:
authorBastien Montagne <montagne29@wanadoo.fr>2017-05-29 12:00:01 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2017-05-29 12:02:27 +0300
commitbe31582e3d4207eac0b296e143fffe5b98e95df1 (patch)
tree0d8ec21b52d756d841cce10fca47c6cf3294430f /source/blender/editors/object
parentea147e9a28dc5d432f2720ee6077bd72b2299597 (diff)
Fix T51624: Scene Full Copy ignores shader node links.
Properly remap nodes' pointers to copied IDs in copied ntrees. Note that this only affects root trees, node groups are not concerned here, since they are assumed to be reusable chunks and hence *not* duplicated.
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r--source/blender/editors/object/object_relations.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 5a0921f7119..7ec43b02b38 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -83,6 +83,7 @@
#include "BKE_mball.h"
#include "BKE_mesh.h"
#include "BKE_modifier.h"
+#include "BKE_node.h"
#include "BKE_object.h"
#include "BKE_report.h"
#include "BKE_sca.h"
@@ -2102,6 +2103,18 @@ void ED_object_single_users(Main *bmain, Scene *scene, const bool full, const bo
single_tex_users_expand(bmain);
}
+ /* Relink nodetrees' pointers that have been duplicated. */
+ FOREACH_NODETREE(bmain, ntree, id)
+ {
+ /* This is a bit convoluted, we want to root ntree of copied IDs and only those,
+ * so we first check that old ID has been copied and that ntree is root tree of old ID,
+ * then get root tree of new ID and remap its pointers to new ID... */
+ if (id->newid && (&ntree->id != id)) {
+ ntree = ntreeFromID(id->newid);
+ BKE_libblock_relink_to_newid(&ntree->id);
+ }
+ } FOREACH_NODETREE_END
+
/* Relink datablock pointer properties */
{
IDP_RelinkProperty(scene->id.properties);