[Bf-blender-cvs] [6f71491] master: Fix T40108: Copying materials leaves a shared Action datablock in nested bNodeTree blocks.
Lukas Tönne
noreply at git.blender.org
Fri May 9 15:08:56 CEST 2014
Commit: 6f71491d61d5d99954b23b5b240f031055da602e
Author: Lukas Tönne
Date: Fri May 9 14:59:14 2014 +0200
https://developer.blender.org/rB6f71491d61d5d99954b23b5b240f031055da602e
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.
===================================================================
M source/blender/blenkernel/BKE_library.h
M source/blender/blenkernel/intern/library.c
M source/blender/blenkernel/intern/material.c
M source/blender/blenkernel/intern/node.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h
index 44a9885..55c71ff 100644
--- a/source/blender/blenkernel/BKE_library.h
+++ b/source/blender/blenkernel/BKE_library.h
@@ -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);
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 6306971..fe2d148 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -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;
}
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index c8ad920..de3aea9 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -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++) {
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 3e64868..ce1e34d 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -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 */
}
More information about the Bf-blender-cvs
mailing list