Merged changes in the trunk up to revision 55357.
[blender-staging.git] / source / blender / editors / space_nla / nla_channels.c
1 /*
2  * ***** BEGIN GPL LICENSE BLOCK *****
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version. 
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  * The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
19  * All rights reserved.
20  *
21  * 
22  * Contributor(s): Joshua Leung (major recode)
23  *
24  * ***** END GPL LICENSE BLOCK *****
25  */
26
27 /** \file blender/editors/space_nla/nla_channels.c
28  *  \ingroup spnla
29  */
30
31
32 #include <string.h>
33 #include <stdio.h>
34 #include <stdlib.h>
35 #include <math.h>
36
37 #include "DNA_anim_types.h"
38 #include "DNA_object_types.h"
39 #include "DNA_scene_types.h"
40
41 #include "BLI_blenlib.h"
42 #include "BLI_math.h"
43 #include "BLI_rand.h"
44 #include "BLI_utildefines.h"
45
46 #include "BKE_animsys.h"
47 #include "BKE_nla.h"
48 #include "BKE_context.h"
49 #include "BKE_global.h"
50 #include "BKE_screen.h"
51 #include "BKE_report.h"
52
53 #include "ED_anim_api.h"
54 #include "ED_keyframes_edit.h"
55 #include "ED_screen.h"
56
57 #include "RNA_access.h"
58 #include "RNA_define.h"
59
60 #include "WM_api.h"
61 #include "WM_types.h"
62
63 #include "UI_view2d.h"
64
65 #include "nla_intern.h" // own include
66
67 /* *********************************************** */
68 /* Operators for NLA channels-list which need to be different from the standard Animation Editor ones */
69
70 /* ******************** Mouse-Click Operator *********************** */
71 /* Depending on the channel that was clicked on, the mouse click will activate whichever
72  * part of the channel is relevant.
73  *
74  * NOTE: eventually, this should probably be phased out when many of these things are replaced with buttons
75  *      --> Most channels are now selection only...
76  */
77
78 static int mouse_nla_channels(bAnimContext *ac, float x, int channel_index, short selectmode)
79 {
80         ListBase anim_data = {NULL, NULL};
81         bAnimListElem *ale;
82         int filter;
83         
84         View2D *v2d = &ac->ar->v2d;
85         int notifierFlags = 0;
86         
87         /* get the channel that was clicked on */
88         /* filter channels */
89         filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS);
90         ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
91         
92         /* get channel from index */
93         ale = BLI_findlink(&anim_data, channel_index);
94         if (ale == NULL) {
95                 /* channel not found */
96                 if (G.debug & G_DEBUG)
97                         printf("Error: animation channel (index = %d) not found in mouse_anim_channels()\n", channel_index);
98                 
99                 BLI_freelistN(&anim_data);
100                 return 0;
101         }
102         
103         /* action to take depends on what channel we've got */
104         // WARNING: must keep this in sync with the equivalent function in anim_channels_edit.c
105         switch (ale->type) {
106                 case ANIMTYPE_SCENE:
107                 {
108                         Scene *sce = (Scene *)ale->data;
109                         AnimData *adt = sce->adt;
110                         
111                         /* set selection status */
112                         if (selectmode == SELECT_INVERT) {
113                                 /* swap select */
114                                 sce->flag ^= SCE_DS_SELECTED;
115                                 if (adt) adt->flag ^= ADT_UI_SELECTED;
116                         }
117                         else {
118                                 sce->flag |= SCE_DS_SELECTED;
119                                 if (adt) adt->flag |= ADT_UI_SELECTED;
120                         }
121                         
122                         notifierFlags |= (ND_ANIMCHAN | NA_SELECTED);
123                 }
124                 break;
125                 case ANIMTYPE_OBJECT:
126                 {
127                         bDopeSheet *ads = (bDopeSheet *)ac->data;
128                         Scene *sce = (Scene *)ads->source;
129                         Base *base = (Base *)ale->data;
130                         Object *ob = base->object;
131                         AnimData *adt = ob->adt;
132                         
133                         if (nlaedit_is_tweakmode_on(ac) == 0) {
134                                 /* set selection status */
135                                 if (selectmode == SELECT_INVERT) {
136                                         /* swap select */
137                                         base->flag ^= SELECT;
138                                         ob->flag = base->flag;
139                                         
140                                         if (adt) adt->flag ^= ADT_UI_SELECTED;
141                                 }
142                                 else {
143                                         Base *b;
144                                         
145                                         /* deselect all */
146                                         /* TODO: should this deselect all other types of channels too? */
147                                         for (b = sce->base.first; b; b = b->next) {
148                                                 b->flag &= ~SELECT;
149                                                 b->object->flag = b->flag;
150                                                 if (b->object->adt) b->object->adt->flag &= ~(ADT_UI_SELECTED | ADT_UI_ACTIVE);
151                                         }
152                                         
153                                         /* select object now */
154                                         base->flag |= SELECT;
155                                         ob->flag |= SELECT;
156                                         if (adt) adt->flag |= ADT_UI_SELECTED;
157                                 }
158                                 
159                                 if ((adt) && (adt->flag & ADT_UI_SELECTED))
160                                         adt->flag |= ADT_UI_ACTIVE;
161                                 
162                                 /* notifiers - channel was selected */
163                                 notifierFlags |= (ND_ANIMCHAN | NA_SELECTED);
164                         }
165                 }
166                 break;
167                         
168                 case ANIMTYPE_FILLACTD: /* Action Expander */
169                 case ANIMTYPE_DSMAT:    /* Datablock AnimData Expanders */
170                 case ANIMTYPE_DSLAM:
171                 case ANIMTYPE_DSCAM:
172                 case ANIMTYPE_DSCUR:
173                 case ANIMTYPE_DSSKEY:
174                 case ANIMTYPE_DSWOR:
175                 case ANIMTYPE_DSNTREE:
176                 case ANIMTYPE_DSPART:
177                 case ANIMTYPE_DSMBALL:
178                 case ANIMTYPE_DSARM:
179                 case ANIMTYPE_DSMESH:
180                 case ANIMTYPE_DSTEX:
181                 case ANIMTYPE_DSLAT:
182 #ifdef WITH_FREESTYLE
183                 case ANIMTYPE_DSLINESTYLE:
184 #endif
185                 case ANIMTYPE_DSSPK:
186                 {
187                         /* sanity checking... */
188                         if (ale->adt) {
189                                 /* select/deselect */
190                                 if (selectmode == SELECT_INVERT) {
191                                         /* inverse selection status of this AnimData block only */
192                                         ale->adt->flag ^= ADT_UI_SELECTED;
193                                 }
194                                 else {
195                                         /* select AnimData block by itself */
196                                         ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR);
197                                         ale->adt->flag |= ADT_UI_SELECTED;
198                                 }
199                                 
200                                 /* set active? */
201                                 if ((ale->adt) && (ale->adt->flag & ADT_UI_SELECTED))
202                                         ale->adt->flag |= ADT_UI_ACTIVE;
203                         }
204                         
205                         notifierFlags |= (ND_ANIMCHAN | NA_SELECTED);
206                 }
207                 break;
208                         
209                 case ANIMTYPE_NLATRACK:
210                 {
211                         NlaTrack *nlt = (NlaTrack *)ale->data;
212                         AnimData *adt = ale->adt;
213                         short offset;
214                         
215                         /* offset for start of channel (on LHS of channel-list) */
216                         if (ale->id) {
217                                 /* special exception for materials and particles */
218                                 if (ELEM(GS(ale->id->name), ID_MA, ID_PA))
219                                         offset = 21 + NLACHANNEL_BUTTON_WIDTH;
220                                 else
221                                         offset = 14;
222                         }
223                         else
224                                 offset = 0;
225                         
226                         if (x >= (v2d->cur.xmax - NLACHANNEL_BUTTON_WIDTH)) {
227                                 /* toggle protection (only if there's a toggle there) */
228                                 nlt->flag ^= NLATRACK_PROTECTED;
229                                 
230                                 /* notifier flags - channel was edited */
231                                 notifierFlags |= (ND_ANIMCHAN | NA_EDITED);
232                         }
233                         else if (x >= (v2d->cur.xmax - 2 * NLACHANNEL_BUTTON_WIDTH)) {
234                                 /* toggle mute */
235                                 nlt->flag ^= NLATRACK_MUTED;
236                                 
237                                 /* notifier flags - channel was edited */
238                                 notifierFlags |= (ND_ANIMCHAN | NA_EDITED);
239                         }
240                         else if (x <= ((NLACHANNEL_BUTTON_WIDTH * 2) + offset)) {
241                                 /* toggle 'solo' */
242                                 BKE_nlatrack_solo_toggle(adt, nlt);
243                                 
244                                 /* notifier flags - channel was edited */
245                                 notifierFlags |= (ND_ANIMCHAN | NA_EDITED);
246                         }
247                         else if (nlaedit_is_tweakmode_on(ac) == 0) {
248                                 /* set selection */
249                                 if (selectmode == SELECT_INVERT) {
250                                         /* inverse selection status of this F-Curve only */
251                                         nlt->flag ^= NLATRACK_SELECTED;
252                                 }
253                                 else {
254                                         /* select F-Curve by itself */
255                                         ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR);
256                                         nlt->flag |= NLATRACK_SELECTED;
257                                 }
258                                 
259                                 /* if NLA-Track is selected now, make NLA-Track the 'active' one in the visible list */
260                                 if (nlt->flag & NLATRACK_SELECTED)
261                                         ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, nlt, ANIMTYPE_NLATRACK);
262                                         
263                                 /* notifier flags - channel was selected */
264                                 notifierFlags |= (ND_ANIMCHAN | NA_SELECTED);
265                         }
266                 }
267                 break;
268                 case ANIMTYPE_NLAACTION:
269                 {
270                         AnimData *adt = BKE_animdata_from_id(ale->id);
271                         
272                         /* button area... */
273                         if (x >= (v2d->cur.xmax - NLACHANNEL_BUTTON_WIDTH)) {
274                                 if (nlaedit_is_tweakmode_on(ac) == 0) {
275                                         /* 'push-down' action - only usable when not in TweakMode */
276                                         /* TODO: make this use the operator instead of calling the function directly
277                                          *  however, calling the operator requires that we supply the args, and that works with proper buttons only */
278                                         BKE_nla_action_pushdown(adt);
279                                 }
280                                 else {
281                                         /* when in tweakmode, this button becomes the toggle for mapped editing */
282                                         adt->flag ^= ADT_NLA_EDIT_NOMAP;
283                                 }
284                                 
285                                 /* changes to NLA-Action occurred */
286                                 notifierFlags |= ND_NLA_ACTCHANGE;
287                         }
288                         /* OR rest of name... */
289                         else {
290                                 /* NOTE: rest of NLA-Action name doubles for operating on the AnimData block 
291                                  * - this is useful when there's no clear divider, and makes more sense in
292                                  *   the case of users trying to use this to change actions
293                                  */
294                                 
295                                 /* select/deselect */
296                                 if (selectmode == SELECT_INVERT) {
297                                         /* inverse selection status of this AnimData block only */
298                                         adt->flag ^= ADT_UI_SELECTED;
299                                 }
300                                 else {
301                                         /* select AnimData block by itself */
302                                         ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR);
303                                         adt->flag |= ADT_UI_SELECTED;
304                                 }
305                                 
306                                 /* set active? */
307                                 if (adt->flag & ADT_UI_SELECTED)
308                                         adt->flag |= ADT_UI_ACTIVE;
309                                 
310                                 notifierFlags |= (ND_ANIMCHAN | NA_SELECTED);
311                         }
312                 }
313                 break;
314                         
315                 default:
316                         if (G.debug & G_DEBUG)
317                                 printf("Error: Invalid channel type in mouse_nla_channels()\n");
318         }
319         
320         /* free channels */
321         BLI_freelistN(&anim_data);
322         
323         /* return the notifier-flags set */
324         return notifierFlags;
325 }
326
327 /* ------------------- */
328
329 /* handle clicking */
330 static int nlachannels_mouseclick_invoke(bContext *C, wmOperator *op, const wmEvent *event)
331 {
332         bAnimContext ac;
333         SpaceNla *snla;
334         ARegion *ar;
335         View2D *v2d;
336         int channel_index;
337         int notifierFlags = 0;
338         short selectmode;
339         float x, y;
340         
341         /* get editor data */
342         if (ANIM_animdata_get_context(C, &ac) == 0)
343                 return OPERATOR_CANCELLED;
344                 
345         /* get useful pointers from animation context data */
346         snla = (SpaceNla *)ac.sl;
347         ar = ac.ar;
348         v2d = &ar->v2d;
349         
350         /* select mode is either replace (deselect all, then add) or add/extend */
351         if (RNA_boolean_get(op->ptr, "extend"))
352                 selectmode = SELECT_INVERT;
353         else
354                 selectmode = SELECT_REPLACE;
355         
356         /* figure out which channel user clicked in 
357          * Note: although channels technically start at y= NLACHANNEL_FIRST, we need to adjust by half a channel's height
358          *              so that the tops of channels get caught ok. Since NLACHANNEL_FIRST is really NLACHANNEL_HEIGHT, we simply use
359          *              NLACHANNEL_HEIGHT_HALF.
360          */
361         UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, &y);
362         UI_view2d_listview_view_to_cell(v2d, NLACHANNEL_NAMEWIDTH, NLACHANNEL_STEP(snla), 0, (float)NLACHANNEL_HEIGHT_HALF(snla), x, y, NULL, &channel_index);
363         
364         /* handle mouse-click in the relevant channel then */
365         notifierFlags = mouse_nla_channels(&ac, x, channel_index, selectmode);
366         
367         /* set notifier that things have changed */
368         WM_event_add_notifier(C, NC_ANIMATION | notifierFlags, NULL);
369         
370         return OPERATOR_FINISHED;
371 }
372  
373 void NLA_OT_channels_click(wmOperatorType *ot)
374 {
375         PropertyRNA *prop;
376         
377         /* identifiers */
378         ot->name = "Mouse Click on NLA Channels";
379         ot->idname = "NLA_OT_channels_click";
380         ot->description = "Handle clicks to select NLA channels";
381         
382         /* api callbacks */
383         ot->invoke = nlachannels_mouseclick_invoke;
384         ot->poll = ED_operator_nla_active;
385         
386         /* flags */
387         ot->flag = OPTYPE_UNDO;
388         
389         /* props */
390         prop = RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", ""); // SHIFTKEY
391         RNA_def_property_flag(prop, PROP_SKIP_SAVE);
392 }
393
394 /* *********************************************** */
395 /* Special Operators */
396
397 /* ******************** Add Tracks Operator ***************************** */
398 /* Add NLA Tracks to the same AnimData block as a selected track, or above the selected tracks */
399
400 /* helper - add NLA Tracks alongside existing ones */
401 static bool nlaedit_add_tracks_existing(bAnimContext *ac, bool above_sel)
402 {
403         ListBase anim_data = {NULL, NULL};
404         bAnimListElem *ale;
405         int filter;
406         AnimData *lastAdt = NULL;
407         bool added = false;
408         
409         /* get a list of the (selected) NLA Tracks being shown in the NLA */
410         filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_NODUPLIS);
411         ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
412         
413         /* add tracks... */
414         for (ale = anim_data.first; ale; ale = ale->next) {
415                 if (ale->type == ANIMTYPE_NLATRACK) {
416                         NlaTrack *nlt = (NlaTrack *)ale->data;
417                         AnimData *adt = ale->adt;
418                         
419                         /* check if just adding a new track above this one,
420                          * or whether we're adding a new one to the top of the stack that this one belongs to
421                          */
422                         if (above_sel) {
423                                 /* just add a new one above this one */
424                                 add_nlatrack(adt, nlt);
425                                 added = true;
426                         }
427                         else if ((lastAdt == NULL) || (adt != lastAdt)) {
428                                 /* add one track to the top of the owning AnimData's stack, then don't add anymore to this stack */
429                                 add_nlatrack(adt, NULL);
430                                 lastAdt = adt;
431                                 added = true;
432                         }
433                 }
434         }
435         
436         /* free temp data */
437         BLI_freelistN(&anim_data);
438         
439         return added;
440 }
441
442 /* helper - add NLA Tracks to empty (and selected) AnimData blocks */
443 static bool nlaedit_add_tracks_empty(bAnimContext *ac)
444 {
445         ListBase anim_data = {NULL, NULL};
446         bAnimListElem *ale;
447         int filter;
448         bool added = false;
449         
450         /* get a list of the selected AnimData blocks in the NLA */
451         filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_ANIMDATA | ANIMFILTER_SEL | ANIMFILTER_NODUPLIS);
452         ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
453         
454         /* check if selected AnimData blocks are empty, and add tracks if so... */
455         for (ale = anim_data.first; ale; ale = ale->next) {
456                 AnimData *adt = ale->adt;
457                 
458                 /* sanity check */
459                 BLI_assert(adt->flag & ADT_UI_SELECTED);
460                 
461                 /* ensure it is empty */
462                 if (adt->nla_tracks.first == NULL) {
463                         /* add new track to this AnimData block then */
464                         add_nlatrack(adt, NULL);
465                         added = true;
466                 }
467         }
468         
469         /* cleanup */
470         BLI_freelistN(&anim_data);
471         
472         return added;
473 }
474
475 /* ----- */
476
477 static int nlaedit_add_tracks_exec(bContext *C, wmOperator *op)
478 {
479         bAnimContext ac;
480         bool above_sel = RNA_boolean_get(op->ptr, "above_selected");
481         bool op_done = false;
482         
483         /* get editor data */
484         if (ANIM_animdata_get_context(C, &ac) == 0)
485                 return OPERATOR_CANCELLED;
486                 
487         /* perform adding in two passes - existing first so that we don't double up for empty */
488         op_done |= nlaedit_add_tracks_existing(&ac, above_sel);
489         op_done |= nlaedit_add_tracks_empty(&ac);
490         
491         /* done? */
492         if (op_done) {
493                 /* set notifier that things have changed */
494                 WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
495                 
496                 /* done */
497                 return OPERATOR_FINISHED;
498         }
499         else {
500                 /* failed to add any tracks */
501                 BKE_report(op->reports, RPT_WARNING,
502                            "Select an existing NLA Track or an empty action line first");
503                 
504                 /* not done */
505                 return OPERATOR_CANCELLED;
506         }
507 }
508
509 void NLA_OT_tracks_add(wmOperatorType *ot)
510 {
511         /* identifiers */
512         ot->name = "Add Tracks";
513         ot->idname = "NLA_OT_tracks_add";
514         ot->description = "Add NLA-Tracks above/after the selected tracks";
515         
516         /* api callbacks */
517         ot->exec = nlaedit_add_tracks_exec;
518         ot->poll = nlaop_poll_tweakmode_off;
519         
520         /* flags */
521         ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
522         
523         /* properties */
524         RNA_def_boolean(ot->srna, "above_selected", 0, "Above Selected", "Add a new NLA Track above every existing selected one");
525 }
526
527 /* ******************** Delete Tracks Operator ***************************** */
528 /* Delete selected NLA Tracks */
529
530 static int nlaedit_delete_tracks_exec(bContext *C, wmOperator *UNUSED(op))
531 {
532         bAnimContext ac;
533         
534         ListBase anim_data = {NULL, NULL};
535         bAnimListElem *ale;
536         int filter;
537         
538         /* get editor data */
539         if (ANIM_animdata_get_context(C, &ac) == 0)
540                 return OPERATOR_CANCELLED;
541                 
542         /* get a list of the AnimData blocks being shown in the NLA */
543         filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_SEL);
544         ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
545         
546         /* delete tracks */
547         for (ale = anim_data.first; ale; ale = ale->next) {
548                 if (ale->type == ANIMTYPE_NLATRACK) {
549                         NlaTrack *nlt = (NlaTrack *)ale->data;
550                         AnimData *adt = ale->adt;
551                         
552                         /* if track is currently 'solo', then AnimData should have its
553                          * 'has solo' flag disabled
554                          */
555                         if (nlt->flag & NLATRACK_SOLO)
556                                 adt->flag &= ~ADT_NLA_SOLO_TRACK;
557                         
558                         /* call delete on this track - deletes all strips too */
559                         free_nlatrack(&adt->nla_tracks, nlt);
560                 }
561         }
562         
563         /* free temp data */
564         BLI_freelistN(&anim_data);
565         
566         /* set notifier that things have changed */
567         WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
568         
569         /* done */
570         return OPERATOR_FINISHED;
571 }
572
573 void NLA_OT_tracks_delete(wmOperatorType *ot)
574 {
575         /* identifiers */
576         ot->name = "Delete Tracks";
577         ot->idname = "NLA_OT_tracks_delete";
578         ot->description = "Delete selected NLA-Tracks and the strips they contain";
579         
580         /* api callbacks */
581         ot->exec = nlaedit_delete_tracks_exec;
582         ot->poll = nlaop_poll_tweakmode_off;
583         
584         /* flags */
585         ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
586 }
587
588 /* *********************************************** */
589 /* AnimData Related Operators */
590
591 /* ******************** Include Objects Operator ***************************** */
592 /* Include selected objects in NLA Editor, by giving them AnimData blocks 
593  * NOTE: This doesn't help for non-object AnimData, where we do not have any effective
594  *       selection mechanism in place. Unfortunately, this means that non-object AnimData
595  *       once again becomes a second-class citizen here. However, at least for the most 
596  *       common use case, we now have a nice shortcut again.
597  */
598
599 static int nlaedit_objects_add_exec(bContext *C, wmOperator *UNUSED(op))
600 {
601         bAnimContext ac;
602         SpaceNla *snla;
603         
604         /* get editor data */
605         if (ANIM_animdata_get_context(C, &ac) == 0)
606                 return OPERATOR_CANCELLED;
607         
608         /* ensure that filters are set so that the effect will be immediately visible */
609         snla = (SpaceNla *)ac.sl;
610         if (snla && snla->ads) {
611                 snla->ads->filterflag &= ~ADS_FILTER_NLA_NOACT;
612         }
613         
614         /* operate on selected objects... */    
615         CTX_DATA_BEGIN (C, Object *, ob, selected_objects)
616         {
617                 /* ensure that object has AnimData... that's all */
618                 BKE_id_add_animdata(&ob->id);
619         }
620         CTX_DATA_END;
621         
622         /* set notifier that things have changed */
623         WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
624         
625         /* done */
626         return OPERATOR_FINISHED;
627 }
628
629 void NLA_OT_selected_objects_add(wmOperatorType *ot)
630 {
631         /* identifiers */
632         ot->name = "Include Selected Objects";
633         ot->idname = "NLA_OT_selected_objects_add";
634         ot->description = "Make selected objects appear in NLA Editor by adding Animation Data";
635         
636         /* api callbacks */
637         ot->exec = nlaedit_objects_add_exec;
638         ot->poll = nlaop_poll_tweakmode_off;
639         
640         /* flags */
641         ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
642 }
643
644 /* *********************************************** */