[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [21446] branches/soc-2009-aligorith/source /blender: NLA SoC: Assorted cleanups

Joshua Leung aligorith at gmail.com
Thu Jul 9 03:04:43 CEST 2009


Revision: 21446
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21446
Author:   aligorith
Date:     2009-07-09 03:04:42 +0200 (Thu, 09 Jul 2009)

Log Message:
-----------
NLA SoC: Assorted cleanups

* Some cleanups aimed at giving some (neglible) speedups 

* Preparation for NLA-Strip keyframes to be editable

Modified Paths:
--------------
    branches/soc-2009-aligorith/source/blender/blenkernel/BKE_nla.h
    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/editors/interface/interface_anim.c
    branches/soc-2009-aligorith/source/blender/makesdna/DNA_anim_types.h

Modified: branches/soc-2009-aligorith/source/blender/blenkernel/BKE_nla.h
===================================================================
--- branches/soc-2009-aligorith/source/blender/blenkernel/BKE_nla.h	2009-07-08 22:49:35 UTC (rev 21445)
+++ branches/soc-2009-aligorith/source/blender/blenkernel/BKE_nla.h	2009-07-09 01:04:42 UTC (rev 21446)
@@ -83,6 +83,8 @@
 
 short BKE_nlastrip_within_bounds(struct NlaStrip *strip, float min, float max);
 
+short BKE_nlatrack_has_animated_strips(struct NlaTrack *nlt);
+short BKE_nlatracks_have_animated_strips(ListBase *tracks);
 void BKE_nlastrip_validate_fcurves(struct NlaStrip *strip);
 
 /* ............ */

Modified: branches/soc-2009-aligorith/source/blender/blenkernel/intern/anim_sys.c
===================================================================
--- branches/soc-2009-aligorith/source/blender/blenkernel/intern/anim_sys.c	2009-07-08 22:49:35 UTC (rev 21445)
+++ branches/soc-2009-aligorith/source/blender/blenkernel/intern/anim_sys.c	2009-07-09 01:04:42 UTC (rev 21446)
@@ -392,10 +392,10 @@
 short animsys_remap_path (AnimMapper *remap, char *path, char **dst)
 {
 	/* is there a valid remapping table to use? */
-	if (remap) {
+	//if (remap) {
 		/* find a matching entry... to use to remap */
 		// ...TODO...
-	}
+	//}
 	
 	/* nothing suitable found, so just set dst to look at path (i.e. no alloc/free needed) */
 	*dst= path;
@@ -521,7 +521,6 @@
 		short ok= 0;
 		
 		/* check if this driver's curve should be skipped */
-		// FIXME: maybe we shouldn't check for muted, though that would make things more confusing, as there's already too many ways to disable?
 		if ((fcu->flag & (FCURVE_MUTED|FCURVE_DISABLED)) == 0) 
 		{
 			/* check if driver itself is tagged for recalculation */
@@ -1185,6 +1184,9 @@
 	ListBase echannels= {NULL, NULL};
 	NlaEvalStrip *nes;
 	
+	// TODO: need to zero out all channels used, otherwise we have problems with threadsafety
+	// and also when the user jumps between different times instead of moving sequentially...
+	
 	/* 1. get the stack of strips to evaluate at current time (influence calculated here) */
 	for (nlt=adt->nla_tracks.first; nlt; nlt=nlt->next, track_index++) { 
 		/* if tweaking is on and this strip is the tweaking track, stop on this one */

Modified: branches/soc-2009-aligorith/source/blender/blenkernel/intern/nla.c
===================================================================
--- branches/soc-2009-aligorith/source/blender/blenkernel/intern/nla.c	2009-07-08 22:49:35 UTC (rev 21445)
+++ branches/soc-2009-aligorith/source/blender/blenkernel/intern/nla.c	2009-07-09 01:04:42 UTC (rev 21446)
@@ -926,7 +926,6 @@
 		nlt_a->flag |= NLATRACK_ACTIVE;
 }
 
-
 /* Check if there is any space in the given track to add a strip of the given length */
 short BKE_nlatrack_has_space (NlaTrack *nlt, float start, float end)
 {
@@ -1050,6 +1049,46 @@
 	return 1;
 }
 
+/* Animated Strips ------------------------------------------- */
+
+/* Check if the given NLA-Track has any strips with own F-Curves */
+short BKE_nlatrack_has_animated_strips (NlaTrack *nlt)
+{
+	NlaStrip *strip;
+	
+	/* sanity checks */
+	if ELEM(NULL, nlt, nlt->strips.first)
+		return 0;
+		
+	/* check each strip for F-Curves only (don't care about whether the flags are set) */
+	for (strip= nlt->strips.first; strip; strip= strip->next) {
+		if (strip->fcurves.first)
+			return 1;
+	}
+	
+	/* none found */
+	return 0;
+}
+
+/* Check if given NLA-Tracks have any strips with own F-Curves */
+short BKE_nlatracks_have_animated_strips (ListBase *tracks)
+{
+	NlaTrack *nlt;
+	
+	/* sanity checks */
+	if ELEM(NULL, tracks, tracks->first)
+		return 0;
+		
+	/* check each track, stopping on the first hit */
+	for (nlt= tracks->first; nlt; nlt= nlt->next) {
+		if (BKE_nlatrack_has_animated_strips(nlt))
+			return 1;
+	}
+	
+	/* none found */
+	return 0;
+}
+
 /* Validate the NLA-Strips 'control' F-Curves based on the flags set*/
 void BKE_nlastrip_validate_fcurves (NlaStrip *strip) 
 {

Modified: branches/soc-2009-aligorith/source/blender/editors/interface/interface_anim.c
===================================================================
--- branches/soc-2009-aligorith/source/blender/editors/interface/interface_anim.c	2009-07-08 22:49:35 UTC (rev 21445)
+++ branches/soc-2009-aligorith/source/blender/editors/interface/interface_anim.c	2009-07-09 01:04:42 UTC (rev 21446)
@@ -30,12 +30,15 @@
 void ui_but_anim_flag(uiBut *but, float cfra)
 {
 	but->flag &= ~(UI_BUT_ANIMATED|UI_BUT_ANIMATED_KEY|UI_BUT_DRIVEN);
-
-	if(but->rnaprop && but->rnapoin.id.data) {
+	
+	/* there must be some RNA-pointer + property combo for this button */
+	if (but->rnaprop && but->rnapoin.id.data && 
+		RNA_property_animateable(&but->rnapoin, but->rnaprop)) 
+	{
 		AnimData *adt= BKE_animdata_from_id(but->rnapoin.id.data);
 		FCurve *fcu;
 		char *path;
-
+		
 		if (adt) {
 			if ((adt->action && adt->action->curves.first) || (adt->drivers.first)) {
 				/* XXX this function call can become a performance bottleneck */
@@ -113,7 +116,6 @@
 	WM_operator_name_call(C, "ANIM_OT_remove_driver_button", WM_OP_INVOKE_DEFAULT, NULL);
 }
 
-// TODO: refine the logic for adding/removing drivers...
 void ui_but_anim_menu(bContext *C, uiBut *but)
 {
 	uiPopupMenu *pup;

Modified: branches/soc-2009-aligorith/source/blender/makesdna/DNA_anim_types.h
===================================================================
--- branches/soc-2009-aligorith/source/blender/makesdna/DNA_anim_types.h	2009-07-08 22:49:35 UTC (rev 21445)
+++ branches/soc-2009-aligorith/source/blender/makesdna/DNA_anim_types.h	2009-07-09 01:04:42 UTC (rev 21446)
@@ -741,6 +741,8 @@
 	ADT_NLA_EDIT_ON			= (1<<2),
 		/* active Action for 'tweaking' does not have mapping applied for editing */
 	ADT_NLA_EDIT_NOMAP		= (1<<3),
+		/* NLA-Strip F-Curves are expanded in UI */
+	ADT_NLA_SKEYS_COLLAPSED	= (1<<4),
 	
 		/* drivers expanded in UI */
 	ADT_DRIVERS_COLLAPSED	= (1<<10),





More information about the Bf-blender-cvs mailing list