[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20670] branches/soc-2009-aligorith/source /blender: NLA SoC: Various user-counts and file IO bugfixes for tweaking actions...

Joshua Leung aligorith at gmail.com
Sat Jun 6 07:06:48 CEST 2009


Revision: 20670
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20670
Author:   aligorith
Date:     2009-06-06 07:06:46 +0200 (Sat, 06 Jun 2009)

Log Message:
-----------
NLA SoC: Various user-counts and file IO bugfixes for tweaking actions...

Modified Paths:
--------------
    branches/soc-2009-aligorith/source/blender/blenkernel/intern/anim_sys.c
    branches/soc-2009-aligorith/source/blender/blenkernel/intern/nla.c
    branches/soc-2009-aligorith/source/blender/blenloader/intern/readfile.c

Modified: branches/soc-2009-aligorith/source/blender/blenkernel/intern/anim_sys.c
===================================================================
--- branches/soc-2009-aligorith/source/blender/blenkernel/intern/anim_sys.c	2009-06-06 05:00:40 UTC (rev 20669)
+++ branches/soc-2009-aligorith/source/blender/blenkernel/intern/anim_sys.c	2009-06-06 05:06:46 UTC (rev 20670)
@@ -154,7 +154,7 @@
 	// XXX review this... it might not be optimal behaviour yet...
 	//id_us_plus((ID *)dadt->action);
 	dadt->action= copy_action(adt->action);
-	dadt->tmpact= copy_action(adt->action);
+	dadt->tmpact= copy_action(adt->tmpact);
 	
 	/* duplicate NLA data */
 	copy_nladata(&dadt->nla_tracks, &adt->nla_tracks);

Modified: branches/soc-2009-aligorith/source/blender/blenkernel/intern/nla.c
===================================================================
--- branches/soc-2009-aligorith/source/blender/blenkernel/intern/nla.c	2009-06-06 05:00:40 UTC (rev 20669)
+++ branches/soc-2009-aligorith/source/blender/blenkernel/intern/nla.c	2009-06-06 05:06:46 UTC (rev 20670)
@@ -675,11 +675,12 @@
 	
 	/* handle AnimData level changes:
 	 *	- 'real' active action to temp storage (no need to change user-counts)
-	 *	- action of active strip set to be the 'active action'
+	 *	- action of active strip set to be the 'active action', and have its usercount incremented
 	 *	- editing-flag for this AnimData block should also get turned on (for more efficient restoring)
 	 */
 	adt->tmpact= adt->action;
 	adt->action= activeStrip->act;
+	id_us_plus(&activeStrip->act->id);
 	adt->flag |= ADT_NLA_EDIT_ON;
 	
 	/* done! */
@@ -706,10 +707,12 @@
 		nlt->flag &= ~NLATRACK_DISABLED;
 	
 	/* handle AnimData level changes:
+	 *	- 'temporary' active action needs its usercount decreased, since we're removing this reference
 	 *	- 'real' active action is restored from storage
 	 *	- storage pointer gets cleared (to avoid having bad notes hanging around)
 	 *	- editing-flag for this AnimData block should also get turned off
 	 */
+	if (adt->action) adt->action->id.us--;
 	adt->action= adt->tmpact;
 	adt->tmpact= NULL;
 	adt->flag &= ~ADT_NLA_EDIT_ON;

Modified: branches/soc-2009-aligorith/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/soc-2009-aligorith/source/blender/blenloader/intern/readfile.c	2009-06-06 05:00:40 UTC (rev 20669)
+++ branches/soc-2009-aligorith/source/blender/blenloader/intern/readfile.c	2009-06-06 05:06:46 UTC (rev 20670)
@@ -1896,6 +1896,7 @@
 	
 	/* link action data */
 	adt->action= newlibadr_us(fd, id->lib, adt->action);
+	adt->tmpact= newlibadr_us(fd, id->lib, adt->tmpact);
 	
 	/* link drivers */
 	lib_link_fcurves(fd, id, &adt->drivers);
@@ -9406,6 +9407,7 @@
 	
 	/* own action */
 	expand_doit(fd, mainvar, adt->action);
+	expand_doit(fd, mainvar, adt->tmpact);
 	
 	/* drivers - assume that these F-Curves have driver data to be in this list... */
 	for (fcd= adt->drivers.first; fcd; fcd= fcd->next) {





More information about the Bf-blender-cvs mailing list