[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15514] trunk/blender/source/blender/src/ editnla.c: Apricot Request:

Joshua Leung aligorith at gmail.com
Thu Jul 10 02:15:57 CEST 2008


Revision: 15514
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15514
Author:   aligorith
Date:     2008-07-10 02:15:57 +0200 (Thu, 10 Jul 2008)

Log Message:
-----------
Apricot Request:

When changing the active action in the NLA editor with NLA-override off, armatures now have their restpose applied before the new action is evaluated. 

I've commented the code here to make it clearer what is going on.

Modified Paths:
--------------
    trunk/blender/source/blender/src/editnla.c

Modified: trunk/blender/source/blender/src/editnla.c
===================================================================
--- trunk/blender/source/blender/src/editnla.c	2008-07-10 00:09:43 UTC (rev 15513)
+++ trunk/blender/source/blender/src/editnla.c	2008-07-10 00:15:57 UTC (rev 15514)
@@ -501,26 +501,47 @@
 {
 	bActionStrip *strip;
 	
+	/* make sure all other strips are not active */
 	for (strip = ob->nlastrips.first; strip; strip=strip->next)
 		strip->flag &= ~ACTSTRIP_ACTIVE;
 	
-	if(act) {
+	/* act is new active strip */
+	if (act) {
+		/* set active flag for this strip */
 		act->flag |= ACTSTRIP_ACTIVE;
-	
-		if(ob->action!=act->act) {
-			if(ob->action) ob->action->id.us--;
-			if(act->act->id.lib) {
+		
+		/* check if active action will still be the same one */
+		if (ob->action != act->act) {
+			/* clear object's links with its current action (if present) */
+			if (ob->action) {
+				ob->action->id.us--;
+			}
+			
+			/* only set object's action to active strip's action if possible */
+			if (act->act->id.lib) {
 				ob->action= NULL;
 			}
 			else {
 				ob->action= act->act;
 				id_us_plus(&ob->action->id);
-			}			
+			}	
+			
+			/* request redrawing in relevant spaces */
 			allqueue(REDRAWIPO, 0);
 			allqueue(REDRAWVIEW3D, 0);
 			allqueue(REDRAWACTION, 0);
 			allqueue(REDRAWNLA, 0);
-			ob->ctime= -1234567.0f;	// eveil! 
+			
+			/* when only showing action (i.e. nla-override off), 
+			 * reset pose to restpose for armatures 
+			 */
+			if ((ob->nlaflag & OB_NLA_OVERRIDE)==0) {
+				if (ob->type == OB_ARMATURE)
+					rest_pose(ob->pose);
+			}
+			
+			/* flush depsgraph */
+			ob->ctime= -1234567.0f;	// evil! 
 			DAG_object_flush_update(G.scene, ob, OB_RECALC_OB|OB_RECALC_DATA);
 		}
 	}	





More information about the Bf-blender-cvs mailing list