diff options
author | Joshua Leung <aligorith@gmail.com> | 2012-06-11 04:21:50 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2012-06-11 04:21:50 +0400 |
commit | 0df68aacb10a7f947673d925e09a539ee8c4bb9c (patch) | |
tree | c19679d63689445aa770bdfc2b421a71229235e2 /source/blender/editors/gpencil/drawgpencil.c | |
parent | f305261f14254656c888438205887769ad45b8bd (diff) |
Grease Pencil - Support for Grease Pencil in the Sequence Editor preview/image
space works again
This commit restores the support for using Grease Pencil in the Sequence Editor
image preview region, making it possible to scribble on footage for review
purposes again. Due to internal changes in how the Sequencer handles the image
drawing for this stuff (i.e. it is now fully based on View2D instead of trying
to implement its own little crazy offset+zoom stuff), a lot of the old code for
handling those offsets is no longer needed. Instead, one of the "standard" cases
is now used, and works quite well.
Bugfixes:
* View-space Grease Pencil drawing was done in wrong place (before view2d
restore)
* Grease Pencil entry in RNA had wrong/missing type
Credits:
* DingTo - initial patch/attempt at restoring support
* Aligorith - solved the "offset problems"
Diffstat (limited to 'source/blender/editors/gpencil/drawgpencil.c')
-rw-r--r-- | source/blender/editors/gpencil/drawgpencil.c | 50 |
1 files changed, 15 insertions, 35 deletions
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index 1823bbce3a1..e4a24f13a0e 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -37,10 +37,8 @@ #include "BLO_sys_types.h" -#include "IMB_imbuf_types.h" - -#include "BLI_math.h" #include "BLI_blenlib.h" +#include "BLI_math.h" #include "BLI_utildefines.h" #include "DNA_gpencil_types.h" @@ -53,8 +51,6 @@ #include "BKE_global.h" #include "BKE_gpencil.h" - - #include "WM_api.h" #include "BIF_gl.h" @@ -64,7 +60,6 @@ #include "ED_sequencer.h" #include "ED_view3d.h" - #include "gpencil_intern.h" /* ************************************************** */ @@ -225,7 +220,7 @@ static void gp_draw_stroke_3d(bGPDspoint *points, int totpoints, short thickness /* need to roll-back one point to ensure that there are no gaps in the stroke */ if (i != 0) glVertex3fv(&(pt - 1)->x); - + /* now the point we want... */ glVertex3fv(&pt->x); @@ -340,7 +335,7 @@ static void gp_draw_stroke(bGPDspoint *points, int totpoints, short thickness_s, mt[1] = m2[1] * pthick * 0.5f; sc[0] = s0[0] - (m1[0] * pthick * 0.75f); sc[1] = s0[1] - (m1[1] * pthick * 0.75f); - + t0[0] = sc[0] - mt[0]; t0[1] = sc[1] - mt[1]; t1[0] = sc[0] + mt[0]; @@ -382,7 +377,7 @@ static void gp_draw_stroke(bGPDspoint *points, int totpoints, short thickness_s, mt[1] = mb[1] * pthick; athick = len_v2(mt); dfac = pthick - (athick * 2); - + if (((athick * 2.0f) < pthick) && (IS_EQF(athick, pthick) == 0)) { mt[0] += (mb[0] * dfac); mt[1] += (mb[1] * dfac); @@ -429,7 +424,7 @@ static void gp_draw_stroke(bGPDspoint *points, int totpoints, short thickness_s, mt[1] = m2[1] * pthick * 0.5f; sc[0] = s1[0] + (m1[0] * pthick * 0.75f); sc[1] = s1[1] + (m1[1] * pthick * 0.75f); - + t0[0] = sc[0] - mt[0]; t0[1] = sc[1] - mt[1]; t1[0] = sc[0] + mt[0]; @@ -669,7 +664,7 @@ static void gp_draw_data(bGPdata *gpd, int offsx, int offsy, int winx, int winy, // ............................ /* draw grease-pencil sketches to specified 2d-view that uses ibuf corrections */ -void draw_gpencil_2dimage(bContext *C /* , ImBuf *ibuf */) +void draw_gpencil_2dimage(bContext *C) { ScrArea *sa = CTX_wm_area(C); ARegion *ar = CTX_wm_region(C); @@ -699,35 +694,20 @@ void draw_gpencil_2dimage(bContext *C /* , ImBuf *ibuf */) dflag |= GP_DRAWDATA_ONLYV2D | GP_DRAWDATA_IEDITHACK; } break; -#if 0 /* removed since 2.5x, needs to be added back */ case SPACE_SEQ: /* sequence */ { - SpaceSeq *sseq = (SpaceSeq *)sa->spacedata.first; - float zoom, zoomx, zoomy; - - /* check that we have grease-pencil stuff to draw */ - if (ELEM(NULL, sa, ibuf)) return; - - /* calculate accessory values */ - zoom = (float)(SEQ_ZOOM_FAC(sseq->zoom)); - if (sseq->mainb == SEQ_DRAW_IMG_IMBUF) { - /* XXX sequencer zoom should store it? */ - zoomx = zoom; // * (G.scene->r.xasp / G.scene->r.yasp); - zoomy = zoom; - } - else - zoomx = zoomy = zoom; - - /* calculate transforms (Note: we use ibuf here, as we have it) */ - sizex = (int)(zoomx * ibuf->x); - sizey = (int)(zoomy * ibuf->y); - offsx = (int)( (ar->winx - sizex) / 2 + sseq->xof); - offsy = (int)( (ar->winy - sizey) / 2 + sseq->yof); + /* just draw using standard scaling (settings here are currently ignored anyways) */ + offsx = 0; + offsy = 0; + sizex = ar->winx; + sizey = ar->winy; - dflag |= GP_DRAWDATA_ONLYI2D; + /* NOTE: I2D was used in 2.4x, but the old settings for that have been deprecated + * and everything moved to standard View2d + */ + dflag |= GP_DRAWDATA_ONLYV2D; } break; -#endif default: /* for spacetype not yet handled */ offsx = 0; offsy = 0; |