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:
authorJoshua Leung <aligorith@gmail.com>2012-05-05 19:54:08 +0400
committerJoshua Leung <aligorith@gmail.com>2012-05-05 19:54:08 +0400
commitff4ff9c8a429d9869e7056417bc7acd47a545eb2 (patch)
treea964667f39d4d0300676210f52303e68fd447e96 /source/blender/blenloader
parent34b18fcbc18c6d89a1a1516d19c489994e4964dc (diff)
Bugfixes for various ID-block references (Constraints, NLA)
* ID-blocks referenced by Constraints but not being used as the target objects (such as Actions in the Action Constraint, or Text Blocks in PyConstraints) now get usercounts for being referenced in this way. This should fix ancient bugs such as [#19205] and [#8593]. More tests still needed to verify that this does now play nicely with proxies. * Changing actions used by NLA strips should now update the usercounts accordingly
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/readfile.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 231c1ab8d03..ec7d58035b4 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -2473,10 +2473,19 @@ typedef struct tConstraintLinkData {
ID *id;
} tConstraintLinkData;
/* callback function used to relink constraint ID-links */
-static void lib_link_constraint_cb(bConstraint *UNUSED(con), ID **idpoin, void *userdata)
+static void lib_link_constraint_cb(bConstraint *UNUSED(con), ID **idpoin, short isReference, void *userdata)
{
tConstraintLinkData *cld= (tConstraintLinkData *)userdata;
- *idpoin = newlibadr(cld->fd, cld->id->lib, *idpoin);
+
+ /* for reference types, we need to increment the usercounts on load... */
+ if (isReference) {
+ /* reference type - with usercount */
+ *idpoin = newlibadr_us(cld->fd, cld->id->lib, *idpoin);
+ }
+ else {
+ /* target type - no usercount needed */
+ *idpoin = newlibadr(cld->fd, cld->id->lib, *idpoin);
+ }
}
static void lib_link_constraints(FileData *fd, ID *id, ListBase *conlist)
@@ -8115,7 +8124,7 @@ typedef struct tConstraintExpandData {
Main *mainvar;
} tConstraintExpandData;
/* callback function used to expand constraint ID-links */
-static void expand_constraint_cb(bConstraint *UNUSED(con), ID **idpoin, void *userdata)
+static void expand_constraint_cb(bConstraint *UNUSED(con), ID **idpoin, short UNUSED(isReference), void *userdata)
{
tConstraintExpandData *ced= (tConstraintExpandData *)userdata;
expand_doit(ced->fd, ced->mainvar, *idpoin);