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.
This commit is contained in:
@@ -395,7 +395,7 @@ void NLA_OT_channels_click(wmOperatorType *ot)
|
||||
/* 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 @@ static bool nlaedit_add_tracks_existing(bAnimContext *ac, bool above_sel)
|
||||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
@@ -412,6 +412,11 @@ static int nlaedit_add_actionclip_exec(bContext *C, wmOperator *op)
|
||||
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 @@ static int nlaedit_add_actionclip_exec(bContext *C, wmOperator *op)
|
||||
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 @@ static int nlaedit_apply_scale_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
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;
|
||||
|
||||
@@ -71,8 +71,7 @@ void NLA_OT_click_select(wmOperatorType *ot);
|
||||
/* **************************************** */
|
||||
/* 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 @@ void NLA_OT_fmodifier_paste(wmOperatorType *ot);
|
||||
/* **************************************** */
|
||||
/* 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);
|
||||
|
||||
Reference in New Issue
Block a user