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:
authorCampbell Barton <ideasman42@gmail.com>2010-02-15 11:50:04 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-02-15 11:50:04 +0300
commit83fd3fbb433c3899f92de2078dd6a9350722da8d (patch)
tree4e149346d7afb837fbda7f3b4ac79ce97f77d54c /source/blender/blenkernel/intern/library.c
parent12cd5617ea38039fcae77bdd6a8216b041fb0ce0 (diff)
copy animdata and id-props when copying material node tree's to avoid double memory frees or node trees sharing animdata when they shouldnt.
Diffstat (limited to 'source/blender/blenkernel/intern/library.c')
-rw-r--r--source/blender/blenkernel/intern/library.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 33e59aa2ec5..3ea36450b80 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -653,7 +653,17 @@ static void id_copy_animdata(ID *id)
}
}
-/* used everywhere in blenkernel and text.c */
+/* material nodes use this since they are not treated as libdata */
+void copy_libblock_data(ID *id, const ID *id_from)
+{
+ if (id_from->properties)
+ id->properties = IDP_CopyProperty(id_from->properties);
+
+ /* the duplicate should get a copy of the animdata */
+ id_copy_animdata(id);
+}
+
+/* used everywhere in blenkernel */
void *copy_libblock(void *rt)
{
ID *idn, *id;
@@ -679,10 +689,8 @@ void *copy_libblock(void *rt)
id->newid= idn;
idn->flag |= LIB_NEW;
- if (id->properties) idn->properties = IDP_CopyProperty(id->properties);
-
- /* the duplicate should get a copy of the animdata */
- id_copy_animdata(idn);
+
+ copy_libblock_data(idn, id);
return idn;
}