[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [57312] trunk/blender/source/blender/ editors/space_nla: NLA Editor: It is now possible to add strips to AnimData blocks with no existing

Joshua Leung aligorith at gmail.com
Sun Jun 9 15:13:47 CEST 2013


Revision: 57312
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=57312
Author:   aligorith
Date:     2013-06-09 13:13:47 +0000 (Sun, 09 Jun 2013)
Log Message:
-----------
NLA Editor: It is now possible to add strips to AnimData blocks with no existing
tracks

As a convenience feature for those who are loading in action libraries and using
these to quickly block out things in the NLA editor, it is now possible to add
strips to AnimData blocks without first manually creating empty tracks to add
these strips to. Simply ensure that such empty AnimData blocks are selected
(Hint: click on the action line of the affected AnimData block to do so), and
try to add a strip normally.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_nla/nla_channels.c
    trunk/blender/source/blender/editors/space_nla/nla_edit.c
    trunk/blender/source/blender/editors/space_nla/nla_intern.h

Modified: trunk/blender/source/blender/editors/space_nla/nla_channels.c
===================================================================
--- trunk/blender/source/blender/editors/space_nla/nla_channels.c	2013-06-09 12:53:17 UTC (rev 57311)
+++ trunk/blender/source/blender/editors/space_nla/nla_channels.c	2013-06-09 13:13:47 UTC (rev 57312)
@@ -395,7 +395,7 @@
 /* Add NLA Tracks to the same AnimData block as a selected track, or above the selected tracks */
 
 /* helper - add NLA Tracks alongside existing ones */
-static bool nlaedit_add_tracks_existing(bAnimContext *ac, bool above_sel)
+bool nlaedit_add_tracks_existing(bAnimContext *ac, bool above_sel)
 {
 	ListBase anim_data = {NULL, NULL};
 	bAnimListElem *ale;
@@ -437,7 +437,7 @@
 }
 
 /* helper - add NLA Tracks to empty (and selected) AnimData blocks */
-static bool nlaedit_add_tracks_empty(bAnimContext *ac)
+bool nlaedit_add_tracks_empty(bAnimContext *ac)
 {
 	ListBase anim_data = {NULL, NULL};
 	bAnimListElem *ale;

Modified: trunk/blender/source/blender/editors/space_nla/nla_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_nla/nla_edit.c	2013-06-09 12:53:17 UTC (rev 57311)
+++ trunk/blender/source/blender/editors/space_nla/nla_edit.c	2013-06-09 13:13:47 UTC (rev 57312)
@@ -412,6 +412,11 @@
 		            act->id.name + 2);
 	}
 	
+	/* add tracks to empty but selected animdata blocks so that strips can be added to those directly
+	 * without having to manually add tracks first
+	 */
+	nlaedit_add_tracks_empty(&ac);
+	
 	/* get a list of the editable tracks being shown in the NLA
 	 *	- this is limited to active ones for now, but could be expanded to 
 	 */
@@ -419,7 +424,9 @@
 	items = ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
 	
 	if (items == 0) {
-		BKE_report(op->reports, RPT_ERROR, "No active track(s) to add strip to");
+		BKE_report(op->reports, RPT_ERROR, 
+		           "No active track(s) to add strip to. "
+		           "Select an existing track or add one before trying again");
 		return OPERATOR_CANCELLED;
 	}
 	
@@ -1671,8 +1678,6 @@
 	filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
 	ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
 	
-	/* init the editing data */
-	
 	/* for each NLA-Track, apply scale of all selected strips */
 	for (ale = anim_data.first; ale; ale = ale->next) {
 		NlaTrack *nlt = (NlaTrack *)ale->data;

Modified: trunk/blender/source/blender/editors/space_nla/nla_intern.h
===================================================================
--- trunk/blender/source/blender/editors/space_nla/nla_intern.h	2013-06-09 12:53:17 UTC (rev 57311)
+++ trunk/blender/source/blender/editors/space_nla/nla_intern.h	2013-06-09 13:13:47 UTC (rev 57312)
@@ -71,8 +71,7 @@
 /* **************************************** */
 /* nla_edit.c */
 
-/* defines for snap strips
- */
+/* defines for snap strips */
 enum eNlaEdit_Snap_Mode {
 	NLAEDIT_SNAP_CFRA = 1,
 	NLAEDIT_SNAP_NEAREST_FRAME,
@@ -122,6 +121,11 @@
 /* **************************************** */
 /* nla_channels.c */
 
+bool nlaedit_add_tracks_existing(bAnimContext *ac, bool above_sel);
+bool nlaedit_add_tracks_empty(bAnimContext *ac);
+
+/* --- */
+
 void NLA_OT_channels_click(wmOperatorType *ot);
 
 void NLA_OT_tracks_add(wmOperatorType *ot);




More information about the Bf-blender-cvs mailing list