Revision: 14594
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14594
Author:   aligorith
Date:     2008-04-28 14:26:41 +0200 (Mon, 28 Apr 2008)

Log Message:
-----------
Bugfix:

Restored Border-Select in the Action Editor for Action Channels. Was removed 
when doing the recode and never added back, hence a regression.

Modified Paths:
--------------
    trunk/blender/source/blender/include/BIF_editaction.h
    trunk/blender/source/blender/src/editaction.c
    trunk/blender/source/blender/src/header_action.c

Modified: trunk/blender/source/blender/include/BIF_editaction.h
===================================================================
--- trunk/blender/source/blender/include/BIF_editaction.h       2008-04-28 
12:22:28 UTC (rev 14593)
+++ trunk/blender/source/blender/include/BIF_editaction.h       2008-04-28 
12:26:41 UTC (rev 14594)
@@ -160,6 +160,7 @@
 
 /* Select */
 void borderselect_action(void);
+void borderselect_actionchannels(void);
 void deselect_action_keys(short test, short sel);
 void deselect_action_channels(short mode);
 void deselect_actionchannels(struct bAction *act, short mode);

Modified: trunk/blender/source/blender/src/editaction.c
===================================================================
--- trunk/blender/source/blender/src/editaction.c       2008-04-28 12:22:28 UTC 
(rev 14593)
+++ trunk/blender/source/blender/src/editaction.c       2008-04-28 12:26:41 UTC 
(rev 14594)
@@ -3207,6 +3207,106 @@
        BLI_freelistN(&elems);
 }
 
+/* borderselect: for action-channels */
+void borderselect_actionchannels (void)
+{
+       ListBase act_data = {NULL, NULL};
+       bActListElem *ale;
+       int filter;
+       void *data;
+       short datatype;
+       
+       rcti rect;
+       rctf rectf;
+       int val, selectmode;
+       short mval[2];
+       float ymin, ymax;
+       
+       /* determine what type of data we are operating on */
+       data = get_action_context(&datatype);
+       if (data == NULL) return;
+       if (datatype != ACTCONT_ACTION) return;
+       
+       /* draw and handle the borderselect stuff (ui) and get the select rect 
*/
+       if ( (val = get_border(&rect, 3)) ) {
+               selectmode= ((val==LEFTMOUSE) ? SELECT_ADD : SELECT_SUBTRACT);
+               
+               mval[0]= rect.xmin;
+               mval[1]= rect.ymin+2;
+               areamouseco_to_ipoco(G.v2d, mval, &rectf.xmin, &rectf.ymin);
+               mval[0]= rect.xmax;
+               mval[1]= rect.ymax-2;
+               areamouseco_to_ipoco(G.v2d, mval, &rectf.xmax, &rectf.ymax);
+               
+               ymax = CHANNELHEIGHT/2;
+               
+               /* filter data */
+               filter= (ACTFILTER_VISIBLE | ACTFILTER_CHANNELS);
+               actdata_filter(&act_data, filter, data, datatype);
+               
+               /* loop over data, doing border select */
+               for (ale= act_data.first; ale; ale= ale->next) {
+                       ymin=ymax-(CHANNELHEIGHT+CHANNELSKIP);
+                       
+                       /* if channel is within border-select region, alter it 
*/
+                       if (!((ymax < rectf.ymin) || (ymin > rectf.ymax))) {
+                               /* only the following types can be selected */
+                               switch (ale->type) {
+                                       case ACTTYPE_GROUP: /* action group */
+                                       {
+                                               bActionGroup *agrp= 
(bActionGroup *)ale->data;
+                                               
+                                               if (selectmode == SELECT_ADD)
+                                                       agrp->flag |= 
AGRP_SELECTED;
+                                               else
+                                                       agrp->flag &= 
~AGRP_SELECTED;
+                                       }
+                                               break;
+                                       case ACTTYPE_ACHAN: /* action channel */
+                                       {
+                                               bActionChannel *achan= 
(bActionChannel *)ale->data;
+                                               
+                                               if (selectmode == SELECT_ADD)
+                                                       achan->flag |= 
ACHAN_SELECTED;
+                                               else
+                                                       achan->flag &= 
~ACHAN_SELECTED;
+                                       }
+                                               break;
+                                       case ACTTYPE_CONCHAN: /* constraint 
channel */
+                                       {
+                                               bConstraintChannel *conchan = 
(bConstraintChannel *)ale->data;
+                                               
+                                               if (selectmode == SELECT_ADD)
+                                                       conchan->flag |= 
CONSTRAINT_CHANNEL_SELECT;
+                                               else
+                                                       conchan->flag &= 
~CONSTRAINT_CHANNEL_SELECT;
+                                       }
+                                               break;
+                                       case ACTTYPE_ICU: /* ipo-curve channel 
*/
+                                       {
+                                               IpoCurve *icu = (IpoCurve 
*)ale->data;
+                                               
+                                               if (selectmode == SELECT_ADD)
+                                                       icu->flag |= IPO_SELECT;
+                                               else
+                                                       icu->flag &= 
~IPO_SELECT;
+                                       }
+                                               break;
+                               }
+                       }
+                       
+                       ymax=ymin;
+               }
+               
+               /* cleanup */
+               BLI_freelistN(&act_data);
+               
+               BIF_undo_push("Border Select Action");
+               allqueue(REDRAWIPO, 0);
+               allqueue(REDRAWACTION, 0);
+               allqueue(REDRAWNLA, 0);
+       }
+}
 
 /* some quick defines for borderselect modes */
 enum {
@@ -4410,7 +4510,9 @@
                                borderselect_markers();
                        }
                        else {
-                               if (mval[0] >= ACTWIDTH)
+                               if (mval[0] <= ACTWIDTH)
+                                       borderselect_actionchannels();
+                               else
                                        borderselect_action();
                        }
                        break;

Modified: trunk/blender/source/blender/src/header_action.c
===================================================================
--- trunk/blender/source/blender/src/header_action.c    2008-04-28 12:22:28 UTC 
(rev 14593)
+++ trunk/blender/source/blender/src/header_action.c    2008-04-28 12:26:41 UTC 
(rev 14594)
@@ -100,6 +100,7 @@
 
 enum {
        ACTMENU_SEL_BORDER = 0,
+       ACTMENU_SEL_BORDERC,
        ACTMENU_SEL_BORDERM,
        ACTMENU_SEL_ALL_KEYS,
        ACTMENU_SEL_ALL_CHAN,
@@ -550,10 +551,14 @@
                        borderselect_action();
                        break;
                        
+               case ACTMENU_SEL_BORDERC: /* Border Select */
+                       borderselect_actionchannels();
+                       break;
+                       
                case ACTMENU_SEL_BORDERM: /* Border Select */
                        borderselect_markers();
                        break;
-
+                       
                case ACTMENU_SEL_ALL_KEYS: /* Select/Deselect All Keys */
                        deselect_action_keys(1, 1);
                        BIF_undo_push("(De)Select Keys");
@@ -561,7 +566,7 @@
                        allqueue(REDRAWNLA, 0);
                        allqueue(REDRAWIPO, 0);
                        break;
-
+                       
                case ACTMENU_SEL_ALL_CHAN: /* Select/Deselect All Channels */
                        deselect_action_channels(1);
                        BIF_undo_push("(De)Select Action Channels");
@@ -624,6 +629,10 @@
                                         menuwidth, 19, NULL, 0.0, 0.0, 0, 
                                         ACTMENU_SEL_BORDER, "");
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, 
+                                        "Border Select Channels|B", 0, 
yco-=20, 
+                                        menuwidth, 19, NULL, 0.0, 0.0, 0, 
+                                        ACTMENU_SEL_BORDERC, "");
+       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, 
                                         "Border Select Markers|Ctrl B", 0, 
yco-=20, 
                                         menuwidth, 19, NULL, 0.0, 0.0, 0, 
                                         ACTMENU_SEL_BORDERM, "");


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to