Use the new BKE_libblock_copy_nolib function for bNodeTree datablocks
as well. These were already doing the same thing, just not as nice. Only difference is the do_action argument (false for BKE_libblock_copy_nolib) but this is of no consequence because the function is only called for trees nested inside material, scene, etc., which never have own actions.
This commit is contained in:
parent
c626462c0f
commit
6e99fb04b6
Notes:
blender-bot
2023-02-14 05:51:15 +01:00
Referenced by commit 6f71491d61
, Fix T40108: Copying materials leaves a shared Action datablock in nested
|
@ -1114,20 +1114,13 @@ static bNodeTree *ntreeCopyTree_internal(bNodeTree *ntree, Main *bmain, bool do_
|
|||
|
||||
if (ntree == NULL) return NULL;
|
||||
|
||||
if (bmain) {
|
||||
/* is ntree part of library? */
|
||||
if (BLI_findindex(&bmain->nodetree, ntree) != -1)
|
||||
newtree = BKE_libblock_copy(&ntree->id);
|
||||
else
|
||||
newtree = NULL;
|
||||
/* is ntree part of library? */
|
||||
if (bmain && BLI_findindex(&bmain->nodetree, ntree) >= 0) {
|
||||
newtree = BKE_libblock_copy(&ntree->id);
|
||||
}
|
||||
else
|
||||
newtree = NULL;
|
||||
|
||||
if (newtree == NULL) {
|
||||
newtree = MEM_dupallocN(ntree);
|
||||
else {
|
||||
newtree = BKE_libblock_copy_nolib(&ntree->id);
|
||||
newtree->id.lib = NULL; /* same as owning datablock id.lib */
|
||||
BKE_libblock_copy_data(&newtree->id, &ntree->id, true); /* copy animdata and ID props */
|
||||
}
|
||||
|
||||
id_us_plus((ID *)newtree->gpd);
|
||||
|
|
Loading…
Reference in New Issue