[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [21542] branches/blender2.5/blender/source /blender: NLA Bugfixes:

Joshua Leung aligorith at gmail.com
Sun Jul 12 06:29:36 CEST 2009


Revision: 21542
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21542
Author:   aligorith
Date:     2009-07-12 06:29:36 +0200 (Sun, 12 Jul 2009)

Log Message:
-----------
NLA Bugfixes:

* Fixed crash when anim-playback is running and a strip beside a transition gets transformed. 
Transition strips no-longer assume that their neighbours are action-clips, using the standard NLA-strip evaluation function instead to evaluate their neighbours. However, a check for ping-pong recursion needed to be added there, so that a transition beside a meta-strip, with the meta having a transition nested at the start of one of its levels, wouldn't fail with stack overflow.

* Moved 'Tweak Mode' menu entry to Edit menu, since it's not really that modal. 

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/blenkernel/intern/anim_sys.c
    branches/blender2.5/blender/source/blender/editors/space_nla/nla_header.c

Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/anim_sys.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/anim_sys.c	2009-07-12 03:42:39 UTC (rev 21541)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/anim_sys.c	2009-07-12 04:29:36 UTC (rev 21542)
@@ -1049,12 +1049,12 @@
 		/* first strip */
 	tmp_nes.strip_mode= NES_TIME_TRANSITION_START;
 	tmp_nes.strip= s1;
-	nlastrip_evaluate_actionclip(ptr, &tmp_channels, &tmp_modifiers, &tmp_nes);
+	nlastrip_evaluate(ptr, &tmp_channels, &tmp_modifiers, &tmp_nes);
 	
 		/* second strip */
 	tmp_nes.strip_mode= NES_TIME_TRANSITION_END;
 	tmp_nes.strip= s2;
-	nlastrip_evaluate_actionclip(ptr, &tmp_channels, &tmp_modifiers, &tmp_nes);
+	nlastrip_evaluate(ptr, &tmp_channels, &tmp_modifiers, &tmp_nes);
 	
 	
 	/* assumulate temp-buffer and full-buffer, using the 'real' strip */
@@ -1108,8 +1108,18 @@
 /* evaluates the given evaluation strip */
 void nlastrip_evaluate (PointerRNA *ptr, ListBase *channels, ListBase *modifiers, NlaEvalStrip *nes)
 {
+	NlaStrip *strip= nes->strip;
+	
+	/* to prevent potential infinite recursion problems (i.e. transition strip, beside meta strip containing a transition
+	 * several levels deep inside it), we tag the current strip as being evaluated, and clear this when we leave
+	 */
+	// TODO: be careful with this flag, since some edit tools may be running and have set this while animplayback was running
+	if (strip->flag & NLASTRIP_FLAG_EDIT_TOUCHED)
+		return;
+	strip->flag |= NLASTRIP_FLAG_EDIT_TOUCHED;
+	
 	/* actions to take depend on the type of strip */
-	switch (nes->strip->type) {
+	switch (strip->type) {
 		case NLASTRIP_TYPE_CLIP: /* action-clip */
 			nlastrip_evaluate_actionclip(ptr, channels, modifiers, nes);
 			break;
@@ -1120,6 +1130,9 @@
 			nlastrip_evaluate_meta(ptr, channels, modifiers, nes);
 			break;
 	}
+	
+	/* clear temp recursion safe-check */
+	strip->flag &= ~NLASTRIP_FLAG_EDIT_TOUCHED;
 }
 
 /* write the accumulated settings to */

Modified: branches/blender2.5/blender/source/blender/editors/space_nla/nla_header.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_nla/nla_header.c	2009-07-12 03:42:39 UTC (rev 21541)
+++ branches/blender2.5/blender/source/blender/editors/space_nla/nla_header.c	2009-07-12 04:29:36 UTC (rev 21542)
@@ -83,7 +83,6 @@
 {
 	bScreen *sc= CTX_wm_screen(C);
 	ScrArea *sa= CTX_wm_area(C);
-	Scene *scene= CTX_data_scene(C);
 	SpaceNla *snla= (SpaceNla*)CTX_wm_space_data(C);
 	PointerRNA spaceptr;
 	
@@ -104,11 +103,6 @@
 
 	uiItemS(layout);
 	
-	if (scene->flag & SCE_NLA_EDIT_ON) 
-		uiItemO(layout, NULL, 0, "NLA_OT_tweakmode_exit");
-	else
-		uiItemO(layout, NULL, 0, "NLA_OT_tweakmode_enter");
-	
 	uiItemS(layout);
 	
 	uiItemO(layout, NULL, 0, "ANIM_OT_previewrange_set");
@@ -153,6 +147,8 @@
 
 static void nla_editmenu(bContext *C, uiLayout *layout, void *arg_unused)
 {
+	Scene *scene= CTX_data_scene(C);
+	
 	uiItemMenuF(layout, "Transform", 0, nla_edit_transformmenu);
 	uiItemMenuF(layout, "Snap", 0, nla_edit_snapmenu);
 	
@@ -160,9 +156,6 @@
 	
 	uiItemO(layout, NULL, 0, "NLA_OT_duplicate");
 	uiItemO(layout, NULL, 0, "NLA_OT_split");
-	
-	uiItemS(layout);
-	
 	uiItemO(layout, NULL, 0, "NLA_OT_delete");
 	
 	uiItemS(layout);
@@ -178,6 +171,14 @@
 	
 	uiItemO(layout, NULL, 0, "NLA_OT_move_up");
 	uiItemO(layout, NULL, 0, "NLA_OT_move_down");
+	
+	uiItemS(layout);
+	
+	// TODO: names of these tools for 'tweakmode' need changing?
+	if (scene->flag & SCE_NLA_EDIT_ON) 
+		uiItemO(layout, "Stop Tweaking Strip Actions", 0, "NLA_OT_tweakmode_exit");
+	else
+		uiItemO(layout, "Start Tweaking Strip Actions", 0, "NLA_OT_tweakmode_enter");
 }
 
 static void nla_addmenu(bContext *C, uiLayout *layout, void *arg_unused)





More information about the Bf-blender-cvs mailing list