Fix T40108: Copying materials leaves a shared Action datablock in nested

bNodeTree blocks.

This was broken by rB6e99fb0 (own commit). I expected the `do_action`
argument to be of no importance in this case due to node trees using
material animation, but this is not the case.

Anyway, this patch adds back a do_action to the BKE_libblock_copy_nolib
function as well to restore the previous behavior.
This commit is contained in:
2014-05-09 14:59:14 +02:00
parent 31849cafc2
commit 6f71491d61
4 changed files with 5 additions and 5 deletions

View File

@@ -49,7 +49,7 @@ struct PropertyRNA;
void *BKE_libblock_alloc(struct Main *bmain, short type, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
void *BKE_libblock_copy_ex(struct Main *bmain, struct ID *id) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
void *BKE_libblock_copy_nolib(struct ID *id) ATTR_NONNULL();
void *BKE_libblock_copy_nolib(struct ID *id, const bool do_action) ATTR_NONNULL();
void *BKE_libblock_copy(struct ID *id) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
void BKE_libblock_copy_data(struct ID *id, const struct ID *id_from, const bool do_action);

View File

@@ -806,7 +806,7 @@ void *BKE_libblock_copy_ex(Main *bmain, ID *id)
return idn;
}
void *BKE_libblock_copy_nolib(ID *id)
void *BKE_libblock_copy_nolib(ID *id, const bool do_action)
{
ID *idn;
size_t idn_len;
@@ -827,7 +827,7 @@ void *BKE_libblock_copy_nolib(ID *id)
id->newid = idn;
idn->flag |= LIB_NEW;
BKE_libblock_copy_data(idn, id, false);
BKE_libblock_copy_data(idn, id, do_action);
return idn;
}

View File

@@ -257,7 +257,7 @@ Material *localize_material(Material *ma)
Material *man;
int a;
man = BKE_libblock_copy_nolib(&ma->id);
man = BKE_libblock_copy_nolib(&ma->id, false);
/* no increment for texture ID users, in previewrender.c it prevents decrement */
for (a = 0; a < MAX_MTEX; a++) {

View File

@@ -1123,7 +1123,7 @@ static bNodeTree *ntreeCopyTree_internal(bNodeTree *ntree, Main *bmain, bool do_
newtree = BKE_libblock_copy(&ntree->id);
}
else {
newtree = BKE_libblock_copy_nolib(&ntree->id);
newtree = BKE_libblock_copy_nolib(&ntree->id, true);
newtree->id.lib = NULL; /* same as owning datablock id.lib */
}