Grease Pencil Bugfixes:
authorJoshua Leung <aligorith@gmail.com>
Tue, 14 Oct 2008 09:36:08 +0000 (09:36 +0000)
committerJoshua Leung <aligorith@gmail.com>
Tue, 14 Oct 2008 09:36:08 +0000 (09:36 +0000)
* Onion-skinning with GStep > 0 was not showing enough of a noticable difference between ghosts. Improved method of calculating this.

* Clicking in a Grease-Pencil datablock channel in the Action Editor would crash

source/blender/src/drawgpencil.c
source/blender/src/editaction.c

index 5f9df666c6741bdd00ff68467ad79959b6984cf3..9c12871aa54155d1a3674ad86c17d16dcea68c0e 100644 (file)
@@ -801,14 +801,15 @@ static void gp_draw_data (bGPdata *gpd, int offsx, int offsy, int winx, int winy
                        /* drawing method - only immediately surrounding (gstep = 0), or within a frame range on either side (gstep > 0)*/                      
                        if (gpl->gstep) {
                                bGPDframe *gf;
-                               short i;
+                               float fac;
                                
                                /* draw previous frames first */
-                               for (gf=gpf->prev, i=0; gf; gf=gf->prev, i++) {
+                               for (gf=gpf->prev; gf; gf=gf->prev) {
                                        /* check if frame is drawable */
                                        if ((gpf->framenum - gf->framenum) <= gpl->gstep) {
                                                /* alpha decreases with distance from curframe index */
-                                               tcolor[3] = color[3] - (i/gpl->gstep);
+                                               fac= (float)(gpf->framenum - gf->framenum) / (float)gpl->gstep;
+                                               tcolor[3] = color[3] - fac;
                                                gp_draw_strokes(gf, offsx, offsy, winx, winy, dflag, debug, lthick, tcolor);
                                        }
                                        else 
@@ -816,11 +817,12 @@ static void gp_draw_data (bGPdata *gpd, int offsx, int offsy, int winx, int winy
                                }
                                
                                /* now draw next frames */
-                               for (gf= gpf->next, i=0; gf; gf=gf->next, i++) {
+                               for (gf= gpf->next; gf; gf=gf->next) {
                                        /* check if frame is drawable */
                                        if ((gf->framenum - gpf->framenum) <= gpl->gstep) {
                                                /* alpha decreases with distance from curframe index */
-                                               tcolor[3] = color[3] - (i/gpl->gstep);
+                                               fac= (float)(gf->framenum - gpf->framenum) / (float)gpl->gstep;
+                                               tcolor[3] = color[3] - fac;
                                                gp_draw_strokes(gf, offsx, offsy, winx, winy, dflag, debug, lthick, tcolor);
                                        }
                                        else 
index d10f354ed7a07548db53f85f1d203382e9674cfb..4d3e9c236ca8c1648ec8936b0bfad1ab7dce7e7d 100644 (file)
@@ -803,6 +803,14 @@ static void *get_nearest_action_key (float *selx, short *sel, short *ret_type, b
                                bActionGroup *agrp= (bActionGroup *)ale->data;
                                agroup_to_keylist(agrp, &act_keys, NULL, NULL);
                        }
+                       else if (ale->type == ACTTYPE_GPDATABLOCK) {
+                               /* cleanup */
+                               BLI_freelistN(&act_data);
+                               
+                               /* this channel currently doens't have any keyframes... must ignore! */
+                               *ret_type= ACTTYPE_NONE;
+                               return NULL;
+                       }
                        else if (ale->type == ACTTYPE_GPLAYER) {
                                bGPDlayer *gpl= (bGPDlayer *)ale->data;
                                gpl_to_keylist(gpl, &act_keys, NULL, NULL);