Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2009-09-27 08:22:04 +0400
committerJoshua Leung <aligorith@gmail.com>2009-09-27 08:22:04 +0400
commitfbfa8d2f812095eef100b1fdd67ce766bf884844 (patch)
tree10addf45adc73c262fbb2b5e2c2f3096a6fcf8ff /source/blender/editors/space_nla/nla_buttons.c
parent69995bb1b32a081dab987926e0c9f3b94cd63209 (diff)
2.5 - Assorted Animation UI/Editing Tweaks
Main Feature: * It is now possible to choose which AnimData block is the 'active' one for editing, and/or select them too. AnimData blocks are generally the dark blue and lighter-blue expanders (i.e. Scene, Object, Camera, Lamp, Curve, Armature, etc.) * Objects are no longer selected/deselected when AKEY is used to toggle selection of channels. This was getting a bit annoying. * Following on from selection of AnimData blocks, it is now possible to select/make active an AnimData block in the animation editors, and change the active action for that block via the 'Animation Data' panel in NLA Editor's properties region. --> Be aware that user-counts are not totally handled correctly there yet, so some funky behaviour might be seen... --> It is possible to assign a new action, or to assign an existing one, allowing to switch between actions as in the past with Actions/IPO Editors... Other tweaks: * Some code tweaks towards making the 'Euler Filter' feature for Graph Editor working sometime soon * Added some backend code for snapping the values of keyframes to a single value. Still need to work out some UI for it though. * Shuffled the code for ACT_OT_new() around, and removed the poll() callback so that it worked in NLA too. * Fixed some more notifier bugs with deleting bones and a few other editmode operations for Armatures.
Diffstat (limited to 'source/blender/editors/space_nla/nla_buttons.c')
-rw-r--r--source/blender/editors/space_nla/nla_buttons.c83
1 files changed, 59 insertions, 24 deletions
diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c
index a5ba63fd15d..b193b89d65a 100644
--- a/source/blender/editors/space_nla/nla_buttons.c
+++ b/source/blender/editors/space_nla/nla_buttons.c
@@ -114,34 +114,69 @@ static int nla_panel_context(const bContext *C, PointerRNA *adt_ptr, PointerRNA
if (ANIM_animdata_get_context(C, &ac) == 0)
return 0;
- /* extract list of active channel(s), of which we should only take the first one (expecting it to be an NLA track) */
- filter= (ANIMFILTER_VISIBLE|ANIMFILTER_ACTIVE);
+ /* extract list of active channel(s), of which we should only take the first one
+ * - we need the channels flag to get the active AnimData block when there are no NLA Tracks
+ */
+ filter= (ANIMFILTER_VISIBLE|ANIMFILTER_ACTIVE|ANIMFILTER_CHANNELS);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
for (ale= anim_data.first; ale; ale= ale->next) {
- // TODO: need some way to select active animdata too...
- if (ale->type == ANIMTYPE_NLATRACK) {
- NlaTrack *nlt= (NlaTrack *)ale->data;
- AnimData *adt= ale->adt;
-
- /* found it, now set the pointers */
- if (adt_ptr) {
- /* AnimData pointer */
- RNA_pointer_create(ale->id, &RNA_AnimData, adt, adt_ptr);
- }
- if (nlt_ptr) {
- /* NLA-Track pointer */
- RNA_pointer_create(ale->id, &RNA_NlaTrack, nlt, nlt_ptr);
- }
- if (strip_ptr) {
- /* NLA-Strip pointer */
- NlaStrip *strip= BKE_nlastrip_find_active(nlt);
- RNA_pointer_create(ale->id, &RNA_NlaStrip, strip, strip_ptr);
+ switch (ale->type) {
+ case ANIMTYPE_NLATRACK: /* NLA Track - The primary data type which should get caught */
+ {
+ NlaTrack *nlt= (NlaTrack *)ale->data;
+ AnimData *adt= ale->adt;
+
+ /* found it, now set the pointers */
+ if (adt_ptr) {
+ /* AnimData pointer */
+ RNA_pointer_create(ale->id, &RNA_AnimData, adt, adt_ptr);
+ }
+ if (nlt_ptr) {
+ /* NLA-Track pointer */
+ RNA_pointer_create(ale->id, &RNA_NlaTrack, nlt, nlt_ptr);
+ }
+ if (strip_ptr) {
+ /* NLA-Strip pointer */
+ NlaStrip *strip= BKE_nlastrip_find_active(nlt);
+ RNA_pointer_create(ale->id, &RNA_NlaStrip, strip, strip_ptr);
+ }
+
+ found= 1;
}
-
- found= 1;
- break;
+ break;
+
+ case ANIMTYPE_SCENE: /* Top-Level Widgets doubling up as datablocks */
+ case ANIMTYPE_OBJECT:
+ case ANIMTYPE_FILLACTD: /* Action Expander */
+ case ANIMTYPE_DSMAT: /* Datablock AnimData Expanders */
+ case ANIMTYPE_DSLAM:
+ case ANIMTYPE_DSCAM:
+ case ANIMTYPE_DSCUR:
+ case ANIMTYPE_DSSKEY:
+ case ANIMTYPE_DSWOR:
+ case ANIMTYPE_DSPART:
+ case ANIMTYPE_DSMBALL:
+ case ANIMTYPE_DSARM:
+ {
+ /* for these channels, we only do AnimData */
+ if (ale->id && ale->adt) {
+ if (adt_ptr) {
+ /* AnimData pointer */
+ RNA_pointer_create(ale->id, &RNA_AnimData, ale->adt, adt_ptr);
+
+ /* set found status to -1, since setting to 1 would break the loop
+ * and potentially skip an active NLA-Track in some cases...
+ */
+ found= -1;
+ }
+ }
+ }
+ break;
}
+
+ if (found > 0)
+ break;
}
/* free temp data */
@@ -211,7 +246,7 @@ static void nla_panel_animdata (const bContext *C, Panel *pa)
/* Active Action Properties ------------------------------------- */
/* action */
row= uiLayoutRow(layout, 1);
- uiTemplateID(row, (bContext *)C, &adt_ptr, "action", NULL /*"ACT_OT_new"*/, NULL, NULL /*"ACT_OT_unlink"*/); // XXX: need to make these operators
+ uiTemplateID(row, (bContext *)C, &adt_ptr, "action", "ACT_OT_new", NULL, NULL /*"ACT_OT_unlink"*/); // XXX: need to make these operators
/* extrapolation */
row= uiLayoutRow(layout, 1);