More AnimData selection fixes
authorJoshua Leung <aligorith@gmail.com>
Thu, 14 Mar 2013 05:44:56 +0000 (05:44 +0000)
committerJoshua Leung <aligorith@gmail.com>
Thu, 14 Mar 2013 05:44:56 +0000 (05:44 +0000)
* Not all supported datatypes would show up in the NLA Properties Region when
selected
* Clicking on the name part of the "Active Action" tracks now selects the
AnimData block that action is attached to

source/blender/editors/space_nla/nla_buttons.c
source/blender/editors/space_nla/nla_channels.c

index eb7de0720437f5bd13af9554f16217785615565d..1e0d8437150bb9cfed07b5dc8359786ef98bf89b 100644 (file)
@@ -131,7 +131,6 @@ static int nla_panel_context(const bContext *C, PointerRNA *adt_ptr, PointerRNA
                                
                        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:
@@ -142,6 +141,9 @@ static int nla_panel_context(const bContext *C, PointerRNA *adt_ptr, PointerRNA
                        case ANIMTYPE_DSPART:
                        case ANIMTYPE_DSMBALL:
                        case ANIMTYPE_DSARM:
+                       case ANIMTYPE_DSMESH:
+                       case ANIMTYPE_DSTEX:
+                       case ANIMTYPE_DSLAT:
                        case ANIMTYPE_DSSPK:
                        {
                                /* for these channels, we only do AnimData */
index 07e6d9bca119373c2c9fb9b68c03bf56c9b9ab2c..ba1a3accf93b1e11dc423e8e64f05597fac1d8a0 100644 (file)
@@ -265,6 +265,7 @@ static int mouse_nla_channels(bAnimContext *ac, float x, int channel_index, shor
                {
                        AnimData *adt = BKE_animdata_from_id(ale->id);
                        
+                       /* button area... */
                        if (x >= (v2d->cur.xmax - NLACHANNEL_BUTTON_WIDTH)) {
                                if (nlaedit_is_tweakmode_on(ac) == 0) {
                                        /* 'push-down' action - only usable when not in TweakMode */
@@ -280,6 +281,30 @@ static int mouse_nla_channels(bAnimContext *ac, float x, int channel_index, shor
                                /* changes to NLA-Action occurred */
                                notifierFlags |= ND_NLA_ACTCHANGE;
                        }
+                       /* OR rest of name... */
+                       else {
+                               /* NOTE: rest of NLA-Action name doubles for operating on the AnimData block 
+                                * - this is useful when there's no clear divider, and makes more sense in
+                                *   the case of users trying to use this to change actions
+                                */
+                               
+                               /* select/deselect */
+                               if (selectmode == SELECT_INVERT) {
+                                       /* inverse selection status of this AnimData block only */
+                                       adt->flag ^= ADT_UI_SELECTED;
+                               }
+                               else {
+                                       /* select AnimData block by itself */
+                                       ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR);
+                                       adt->flag |= ADT_UI_SELECTED;
+                               }
+                               
+                               /* set active? */
+                               if (adt->flag & ADT_UI_SELECTED)
+                                       adt->flag |= ADT_UI_ACTIVE;
+                               
+                               notifierFlags |= (ND_ANIMCHAN | NA_SELECTED);
+                       }
                }
                break;