2.5 - Animation related tweaks
authorJoshua Leung <aligorith@gmail.com>
Sun, 1 Mar 2009 05:45:44 +0000 (05:45 +0000)
committerJoshua Leung <aligorith@gmail.com>
Sun, 1 Mar 2009 05:45:44 +0000 (05:45 +0000)
* Scrollers for zoomable views are now always shown again. The previous method was quite bad for these, as there would be flickering as the view was zoomed + panned. Also, the old method was not suggestive of the drag-zoom features on the scrollers, which was provided by the shaded bars. (Non-zoomable views will still only show scrollers where appropriate).

* Insert-Key in 3d-view (i.e. the 'temp' operator which still needs to be ported to use builtin relative keyingsets) had a bug where the wrong keyframe were being inserted (rotation in instead of location, scaling instead of rotation) for bones.

source/blender/editors/animation/keyframing.c
source/blender/editors/interface/view2d.c

index 3a42dcdcb9bd95423b6b7c4e652f91339462b037..f490fb774389c9dd6fa83cdf05c7cae7c7bddd4b 100644 (file)
@@ -135,8 +135,6 @@ FCurve *verify_fcurve (ID *id, const char group[], const char rna_path[], const
                                
                                BLI_addtail(&act->groups, grp);
                                BLI_uniquename(&act->groups, grp, "Group", offsetof(bActionGroup, name), 64);
-                               
-                               set_active_action_group(act, grp, 1);
                        }
                        
                        /* add F-Curve to group */
@@ -2144,7 +2142,7 @@ static int insert_key_old_exec (bContext *C, wmOperator *op)
                                        success+= insertkey(id, "Object Transforms", "rotation", 1, cfra, 0);
                                        success+= insertkey(id, "Object Transforms", "rotation", 2, cfra, 0);
                                        break;
-                               case 1: /* object location */
+                               default: /* object location */
                                        success+= insertkey(id, "Object Transforms", "location", 0, cfra, 0);
                                        success+= insertkey(id, "Object Transforms", "location", 1, cfra, 0);
                                        success+= insertkey(id, "Object Transforms", "location", 2, cfra, 0);
@@ -2163,13 +2161,13 @@ static int insert_key_old_exec (bContext *C, wmOperator *op)
                                                char buf[512];
                                                
                                                switch (mode) {
-                                               case 6: /* pchan scale */
+                                               case 7: /* pchan scale */
                                                        sprintf(buf, "pose.pose_channels[\"%s\"].scale", pchan->name);
                                                        success+= insertkey(id, pchan->name, buf, 0, cfra, 0);
                                                        success+= insertkey(id, pchan->name, buf, 1, cfra, 0);
                                                        success+= insertkey(id, pchan->name, buf, 2, cfra, 0);
                                                        break;
-                                               case 5: /* pchan rotation */
+                                               case 6: /* pchan rotation */
                                                        if (pchan->rotmode == PCHAN_ROT_QUAT) {
                                                                sprintf(buf, "pose.pose_channels[\"%s\"].rotation", pchan->name);
                                                                success+= insertkey(id, pchan->name, buf, 0, cfra, 0);
index 15b345e5992a90623ee1e2e23f5458da5f68bba2..693f540128f8f7863c20a53757d149916e0a711b 100644 (file)
@@ -1375,61 +1375,65 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
                /* scroller 'button' 
                 *      - if view is zoomable in x, draw handles too 
                 *      - handles are drawn darker
-                *  - no slider when view is > total
+                *      - no slider when view is > total for non-zoomable views
+                *        (otherwise, zoomable ones tend to flicker)
                 */
-               if (v2d->tot.xmax-v2d->tot.xmin <= v2d->cur.xmax-v2d->cur.xmin); 
-               else if (v2d->keepzoom & V2D_LOCKZOOM_X) {
-                       /* draw base bar as rounded shape */
-                       UI_ThemeColorShade(TH_SHADE1, dark);
-                       uiSetRoundBox(15);
-                       
-                       /* check that box is large enough for round drawing */
-                       if ((vs->hor_max - vs->hor_min) < (V2D_SCROLLCAP_RAD * 2)) {
-                               /* Rounded box still gets drawn at the minimum size limit
-                                * This doesn't represent extreme scaling well, but looks nicer...
-                                */
-                               float mid= 0.5f * (vs->hor_max + vs->hor_min);
+               if ( (v2d->scroll & V2D_SCROLL_SCALE_HORIZONTAL) ||
+                        ((v2d->tot.xmax - v2d->tot.xmin) > (v2d->cur.xmax - v2d->cur.xmin)) ) 
+               { 
+                       if (v2d->keepzoom & V2D_LOCKZOOM_X) {
+                               /* draw base bar as rounded shape */
+                               UI_ThemeColorShade(TH_SHADE1, dark);
+                               uiSetRoundBox(15);
                                
-                               gl_round_box_shade(GL_POLYGON, 
-                                       mid-V2D_SCROLLCAP_RAD, (float)hor.ymin+2, 
-                                       mid+V2D_SCROLLCAP_RAD, (float)hor.ymax-2, 
-                                       V2D_SCROLLCAP_RAD, V2D_SCROLLBAR_SHADE, -V2D_SCROLLBAR_SHADE);
+                               /* check that box is large enough for round drawing */
+                               if ((vs->hor_max - vs->hor_min) < (V2D_SCROLLCAP_RAD * 2)) {
+                                       /* Rounded box still gets drawn at the minimum size limit
+                                        * This doesn't represent extreme scaling well, but looks nicer...
+                                        */
+                                       float mid= 0.5f * (vs->hor_max + vs->hor_min);
+                                       
+                                       gl_round_box_shade(GL_POLYGON, 
+                                               mid-V2D_SCROLLCAP_RAD, (float)hor.ymin+2, 
+                                               mid+V2D_SCROLLCAP_RAD, (float)hor.ymax-2, 
+                                               V2D_SCROLLCAP_RAD, V2D_SCROLLBAR_SHADE, -V2D_SCROLLBAR_SHADE);
+                               }
+                               else {
+                                       /* draw rounded box as per normal */
+                                       gl_round_box_shade(GL_POLYGON, 
+                                               (float)vs->hor_min, (float)hor.ymin+2, 
+                                               (float)vs->hor_max, (float)hor.ymax-2, 
+                                               V2D_SCROLLCAP_RAD, V2D_SCROLLBAR_SHADE, -V2D_SCROLLBAR_SHADE);
+                               }
                        }
                        else {
-                               /* draw rounded box as per normal */
+                               /* base bar drawn as shaded rect */
+                               UI_ThemeColorShade(TH_SHADE1, dark);
+                               uiSetRoundBox(0);
                                gl_round_box_shade(GL_POLYGON, 
                                        (float)vs->hor_min, (float)hor.ymin+2, 
                                        (float)vs->hor_max, (float)hor.ymax-2, 
                                        V2D_SCROLLCAP_RAD, V2D_SCROLLBAR_SHADE, -V2D_SCROLLBAR_SHADE);
+                               
+                               /* 'minimum' handle */
+                               uiSetRoundBox(9);
+                               UI_ThemeColorShade(TH_SHADE1, darker);
+                               
+                               gl_round_box_shade(GL_POLYGON, 
+                                       (float)vs->hor_min-V2D_SCROLLER_HANDLE_SIZE, (float)hor.ymin+2, 
+                                       (float)vs->hor_min+V2D_SCROLLER_HANDLE_SIZE, (float)hor.ymax-2, 
+                                       V2D_SCROLLCAP_RAD, V2D_SCROLLCAP_SHADE, -V2D_SCROLLCAP_SHADE);
+                               
+                               /* maximum handle */
+                               uiSetRoundBox(6);
+                               UI_ThemeColorShade(TH_SHADE1, darker);
+                               
+                               gl_round_box_shade(GL_POLYGON, 
+                                       (float)vs->hor_max-V2D_SCROLLER_HANDLE_SIZE, (float)hor.ymin+2, 
+                                       (float)vs->hor_max+V2D_SCROLLER_HANDLE_SIZE, (float)hor.ymax-2, 
+                                       V2D_SCROLLCAP_RAD, V2D_SCROLLCAP_SHADE, -V2D_SCROLLCAP_SHADE);
                        }
                }
-               else {
-                       /* base bar drawn as shaded rect */
-                       UI_ThemeColorShade(TH_SHADE1, dark);
-                       uiSetRoundBox(0);
-                       gl_round_box_shade(GL_POLYGON, 
-                               (float)vs->hor_min, (float)hor.ymin+2, 
-                               (float)vs->hor_max, (float)hor.ymax-2, 
-                               V2D_SCROLLCAP_RAD, V2D_SCROLLBAR_SHADE, -V2D_SCROLLBAR_SHADE);
-                       
-                       /* 'minimum' handle */
-                       uiSetRoundBox(9);
-                       UI_ThemeColorShade(TH_SHADE1, darker);
-                       
-                       gl_round_box_shade(GL_POLYGON, 
-                               (float)vs->hor_min-V2D_SCROLLER_HANDLE_SIZE, (float)hor.ymin+2, 
-                               (float)vs->hor_min+V2D_SCROLLER_HANDLE_SIZE, (float)hor.ymax-2, 
-                               V2D_SCROLLCAP_RAD, V2D_SCROLLCAP_SHADE, -V2D_SCROLLCAP_SHADE);
-                       
-                       /* maximum handle */
-                       uiSetRoundBox(6);
-                       UI_ThemeColorShade(TH_SHADE1, darker);
-                       
-                       gl_round_box_shade(GL_POLYGON, 
-                               (float)vs->hor_max-V2D_SCROLLER_HANDLE_SIZE, (float)hor.ymin+2, 
-                               (float)vs->hor_max+V2D_SCROLLER_HANDLE_SIZE, (float)hor.ymax-2, 
-                               V2D_SCROLLCAP_RAD, V2D_SCROLLCAP_SHADE, -V2D_SCROLLCAP_SHADE);
-               }
                
                /* scale indicators */
                // XXX will need to update the font drawing when the new stuff comes in
@@ -1512,60 +1516,65 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
                /* scroller 'button' 
                 *      - if view is zoomable in y, draw handles too 
                 *      - handles are drawn darker
+                *      - no slider when view is > total for non-zoomable views
+                *        (otherwise, zoomable ones tend to flicker)
                 */
-               if (v2d->tot.ymax-v2d->tot.ymin <= v2d->cur.ymax-v2d->cur.ymin); 
-               else if (v2d->keepzoom & V2D_LOCKZOOM_Y) {
-                       /* draw base bar as rounded shape */
-                       UI_ThemeColorShade(TH_SHADE1, dark);
-                       uiSetRoundBox(15);
-                       
-                       /* check that box is large enough for round drawing */
-                       if ((vs->vert_max - vs->vert_min) < (V2D_SCROLLCAP_RAD * 2)) {
-                               /* Rounded box still gets drawn at the minimum size limit
-                                * This doesn't represent extreme scaling well, but looks nicer...
-                                */
-                               float mid= 0.5f * (vs->vert_max + vs->vert_min);
+               if ( (v2d->scroll & V2D_SCROLL_SCALE_VERTICAL) ||
+                        ((v2d->tot.ymax - v2d->tot.ymin) > (v2d->cur.ymax - v2d->cur.ymin)) ) 
+               { 
+                       if (v2d->keepzoom & V2D_LOCKZOOM_Y) {
+                               /* draw base bar as rounded shape */
+                               UI_ThemeColorShade(TH_SHADE1, dark);
+                               uiSetRoundBox(15);
                                
-                               gl_round_box_vertical_shade(GL_POLYGON, 
-                                       (float)vert.xmin+2, mid-V2D_SCROLLCAP_RAD, 
-                                       (float)vert.xmax-2, mid+V2D_SCROLLCAP_RAD, 
-                                       V2D_SCROLLCAP_RAD, V2D_SCROLLBAR_SHADE, -V2D_SCROLLBAR_SHADE);
+                               /* check that box is large enough for round drawing */
+                               if ((vs->vert_max - vs->vert_min) < (V2D_SCROLLCAP_RAD * 2)) {
+                                       /* Rounded box still gets drawn at the minimum size limit
+                                        * This doesn't represent extreme scaling well, but looks nicer...
+                                        */
+                                       float mid= 0.5f * (vs->vert_max + vs->vert_min);
+                                       
+                                       gl_round_box_vertical_shade(GL_POLYGON, 
+                                               (float)vert.xmin+2, mid-V2D_SCROLLCAP_RAD, 
+                                               (float)vert.xmax-2, mid+V2D_SCROLLCAP_RAD, 
+                                               V2D_SCROLLCAP_RAD, V2D_SCROLLBAR_SHADE, -V2D_SCROLLBAR_SHADE);
+                               }
+                               else {
+                                       /* draw rounded box as per normal */
+                                       gl_round_box_vertical_shade(GL_POLYGON, 
+                                               (float)vert.xmin+2, (float)vs->vert_min, 
+                                               (float)vert.xmax-2, (float)vs->vert_max, 
+                                               V2D_SCROLLCAP_RAD, V2D_SCROLLBAR_SHADE, -V2D_SCROLLBAR_SHADE);
+                               }
                        }
                        else {
-                               /* draw rounded box as per normal */
+                               /* base bar drawn as shaded rect */
+                               UI_ThemeColorShade(TH_SHADE1, dark);
+                               uiSetRoundBox(0);
                                gl_round_box_vertical_shade(GL_POLYGON, 
                                        (float)vert.xmin+2, (float)vs->vert_min, 
-                                       (float)vert.xmax-2, (float)vs->vert_max, 
+                                       (float)vert.xmax-2, (float)vs->vert_max,
                                        V2D_SCROLLCAP_RAD, V2D_SCROLLBAR_SHADE, -V2D_SCROLLBAR_SHADE);
+                               
+                               /* 'minimum' handle */
+                               UI_ThemeColorShade(TH_SHADE1, darker);
+                               uiSetRoundBox(12);
+                               
+                               gl_round_box_vertical_shade(GL_POLYGON, 
+                                       (float)vert.xmin+2, (float)vs->vert_min-V2D_SCROLLER_HANDLE_SIZE, 
+                                       (float)vert.xmax-2, (float)vs->vert_min+V2D_SCROLLER_HANDLE_SIZE, 
+                                       V2D_SCROLLCAP_RAD, V2D_SCROLLCAP_SHADE, -V2D_SCROLLCAP_SHADE);
+                               
+                               /* maximum handle */
+                               UI_ThemeColorShade(TH_SHADE1, darker);
+                               uiSetRoundBox(3);
+                               
+                               gl_round_box_vertical_shade(GL_POLYGON, 
+                                       (float)vert.xmin+2, (float)vs->vert_max-V2D_SCROLLER_HANDLE_SIZE, 
+                                       (float)vert.xmax-2, (float)vs->vert_max+V2D_SCROLLER_HANDLE_SIZE, 
+                                       V2D_SCROLLCAP_RAD, V2D_SCROLLCAP_SHADE, -V2D_SCROLLCAP_SHADE);
                        }
                }
-               else {
-                       /* base bar drawn as shaded rect */
-                       UI_ThemeColorShade(TH_SHADE1, dark);
-                       uiSetRoundBox(0);
-                       gl_round_box_vertical_shade(GL_POLYGON, 
-                               (float)vert.xmin+2, (float)vs->vert_min, 
-                               (float)vert.xmax-2, (float)vs->vert_max,
-                               V2D_SCROLLCAP_RAD, V2D_SCROLLBAR_SHADE, -V2D_SCROLLBAR_SHADE);
-                       
-                       /* 'minimum' handle */
-                       UI_ThemeColorShade(TH_SHADE1, darker);
-                       uiSetRoundBox(12);
-                       
-                       gl_round_box_vertical_shade(GL_POLYGON, 
-                               (float)vert.xmin+2, (float)vs->vert_min-V2D_SCROLLER_HANDLE_SIZE, 
-                               (float)vert.xmax-2, (float)vs->vert_min+V2D_SCROLLER_HANDLE_SIZE, 
-                               V2D_SCROLLCAP_RAD, V2D_SCROLLCAP_SHADE, -V2D_SCROLLCAP_SHADE);
-                       
-                       /* maximum handle */
-                       UI_ThemeColorShade(TH_SHADE1, darker);
-                       uiSetRoundBox(3);
-                       
-                       gl_round_box_vertical_shade(GL_POLYGON, 
-                               (float)vert.xmin+2, (float)vs->vert_max-V2D_SCROLLER_HANDLE_SIZE, 
-                               (float)vert.xmax-2, (float)vs->vert_max+V2D_SCROLLER_HANDLE_SIZE, 
-                               V2D_SCROLLCAP_RAD, V2D_SCROLLCAP_SHADE, -V2D_SCROLLCAP_SHADE);
-               }
                
                /* scale indiators */
                // XXX will need to update the font drawing when the new stuff comes in