diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-07-05 16:50:50 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-07-05 16:50:50 +0400 |
commit | b5135a8bdf16c0948fadea62715ece62e33cc2fb (patch) | |
tree | 4d3f3c96632975f3fbbb105f01253cd963404f39 /source | |
parent | 9208aa57922d3e6fb537f89d6ee76f543355516e (diff) |
fix for making local loosing references to node groups.
node->id was left as an indirect link which wont get saved with the file.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/node.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index a5e081d122d..33df8e4b503 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -633,8 +633,12 @@ bNodeTree *ntreeAddTree(const char *name, int type, int nodetype) * - this gets called when executing compositing updates (for threaded previews) * - when the nodetree datablock needs to be copied (i.e. when users get copied) * - for scene duplication use ntreeSwapID() after so we don't have stale pointers. + * + * do_make_extern: keep enabled for general use, only reason _not_ to enable is when + * copying for internal use (threads for eg), where you wont want it to modify the + * scene data. */ -bNodeTree *ntreeCopyTree(bNodeTree *ntree) +static bNodeTree *ntreeCopyTree_internal(bNodeTree *ntree, const short do_make_extern) { bNodeTree *newtree; bNode *node /*, *nnode */ /* UNUSED */, *last; @@ -664,6 +668,11 @@ bNodeTree *ntreeCopyTree(bNodeTree *ntree) last = ntree->nodes.last; for (node= ntree->nodes.first; node; node= node->next) { + + if (do_make_extern) { + id_lib_extern(node->id); + } + node->new_node= NULL; /* nnode= */ nodeCopyNode(newtree, node); /* sets node->new */ @@ -709,6 +718,11 @@ bNodeTree *ntreeCopyTree(bNodeTree *ntree) return newtree; } +bNodeTree *ntreeCopyTree(bNodeTree *ntree) +{ + return ntreeCopyTree_internal(ntree, TRUE); +} + /* use when duplicating scenes */ void ntreeSwitchID(bNodeTree *ntree, ID *id_from, ID *id_to) { @@ -1131,7 +1145,7 @@ bNodeTree *ntreeLocalize(bNodeTree *ntree) } /* node copy func */ - ltree= ntreeCopyTree(ntree); + ltree = ntreeCopyTree_internal(ntree, FALSE); if (adt) { AnimData *ladt= BKE_animdata_from_id(<ree->id); |