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>2011-06-09 16:44:38 +0400
committerJoshua Leung <aligorith@gmail.com>2011-06-09 16:44:38 +0400
commitee713387242e992fdb8d87897193a6946fd1d0c0 (patch)
tree75ccbe342913d473afc8ff558456d87368402bcd /source/blender/makesrna/intern/rna_animation.c
parente4500096a5a9650899966fee9fa86a190cf2af1f (diff)
Bugfix: Setting action for AnimData via RNA didn't change the
usercounts. Cheers to Atom on BA for noticing this.
Diffstat (limited to 'source/blender/makesrna/intern/rna_animation.c')
-rw-r--r--source/blender/makesrna/intern/rna_animation.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c
index 7f817aa5b4b..d523a01dc2c 100644
--- a/source/blender/makesrna/intern/rna_animation.c
+++ b/source/blender/makesrna/intern/rna_animation.c
@@ -76,6 +76,10 @@ static void rna_AnimData_action_set(PointerRNA *ptr, PointerRNA value)
ID *ownerId = (ID *)ptr->id.data;
AnimData *adt = (AnimData *)ptr->data;
+ /* manage usercount for current action */
+ if (adt->action)
+ id_us_min((ID*)adt->action);
+
/* assume that AnimData's action can in fact be edited... */
if ((value.data) && (ownerId)) {
bAction *act = (bAction *)value.data;
@@ -85,6 +89,7 @@ static void rna_AnimData_action_set(PointerRNA *ptr, PointerRNA value)
if (ELEM(act->idroot, 0, GS(ownerId->name))) {
/* can set */
adt->action = act;
+ id_us_plus((ID*)adt->action);
}
else {
/* cannot set */
@@ -98,6 +103,7 @@ static void rna_AnimData_action_set(PointerRNA *ptr, PointerRNA value)
act->id.name+2);
adt->action = act;
+ id_us_plus((ID*)adt->action);
}
}
else {