Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/gpencil/drawgpencil.c50
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c28
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c155
-rw-r--r--source/blender/editors/include/ED_gpencil.h2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_buttons.c18
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c11
-rw-r--r--source/blender/editors/space_sequencer/sequencer_intern.h2
-rw-r--r--source/blender/editors/space_sequencer/space_sequencer.c14
-rw-r--r--source/blender/makesrna/intern/rna_space.c25
9 files changed, 109 insertions, 196 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;
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 71cbabe9114..7094aa086ba 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -80,6 +80,7 @@
/* Get pointer to active Grease Pencil datablock, and an RNA-pointer to trace back to whatever owns it */
bGPdata **gpencil_data_get_pointers(bContext *C, PointerRNA *ptr)
{
+ ID *screen_id = (ID *)CTX_wm_screen(C);
Scene *scene = CTX_data_scene(C);
ScrArea *sa = CTX_wm_area(C);
@@ -122,9 +123,12 @@ bGPdata **gpencil_data_get_pointers(bContext *C, PointerRNA *ptr)
case SPACE_SEQ: /* Sequencer */
{
- //SpaceSeq *sseq= (SpaceSeq *)CTX_wm_space_data(C);
+ SpaceSeq *sseq = (SpaceSeq *)CTX_wm_space_data(C);
- /* return the GP data for the active strips/image/etc. */
+ /* for now, Grease Pencil data is associated with the space (actually preview region only) */
+ // XXX our convention for everything else is to link to data though...
+ if (ptr) RNA_pointer_create(screen_id, &RNA_SpaceSequenceEditor, sseq, ptr);
+ return &sseq->gpd;
}
break;
@@ -134,7 +138,7 @@ bGPdata **gpencil_data_get_pointers(bContext *C, PointerRNA *ptr)
/* for now, Grease Pencil data is associated with the space... */
// XXX our convention for everything else is to link to data though...
- if (ptr) RNA_pointer_create((ID *)CTX_wm_screen(C), &RNA_SpaceImageEditor, sima, ptr);
+ if (ptr) RNA_pointer_create(screen_id, &RNA_SpaceImageEditor, sima, ptr);
return &sima->gpd;
}
break;
@@ -143,7 +147,7 @@ bGPdata **gpencil_data_get_pointers(bContext *C, PointerRNA *ptr)
{
SpaceClip *sc = (SpaceClip *)CTX_wm_space_data(C);
MovieClip *clip = ED_space_clip(sc);
-
+
if (clip) {
if (sc->gpencil_src == SC_GPENCIL_SRC_TRACK) {
MovieTrackingTrack *track = BKE_tracking_active_track(&clip->tracking);
@@ -214,7 +218,7 @@ static int gp_data_add_exec(bContext *C, wmOperator *op)
else {
/* decrement user count and add new datablock */
bGPdata *gpd = (*gpd_ptr);
-
+
id_us_min(&gpd->id);
*gpd_ptr = gpencil_data_addnew("GPencil");
}
@@ -479,7 +483,7 @@ static int gp_camera_view_subrect(bContext *C, rctf *subrect)
if (v3d) {
RegionView3D *rv3d = ar->regiondata;
-
+
/* for camera view set the subrect */
if (rv3d->persp == RV3D_CAMOB) {
Scene *scene = CTX_data_scene(C);
@@ -523,26 +527,26 @@ static void gp_stroke_to_bezier(bContext *C, bGPDlayer *gpl, bGPDstroke *gps, Cu
/* add points */
for (i = 0, bezt = nu->bezt; i < tot; i++, pt++, bezt++) {
float h1[3], h2[3];
-
+
if (i) interp_v3_v3v3(h1, p3d_cur, p3d_prev, 0.3);
else interp_v3_v3v3(h1, p3d_cur, p3d_next, -0.3);
-
+
if (i < tot - 1) interp_v3_v3v3(h2, p3d_cur, p3d_next, 0.3);
else interp_v3_v3v3(h2, p3d_cur, p3d_prev, -0.3);
-
+
copy_v3_v3(bezt->vec[0], h1);
copy_v3_v3(bezt->vec[1], p3d_cur);
copy_v3_v3(bezt->vec[2], h2);
-
+
/* set settings */
bezt->h1 = bezt->h2 = HD_FREE;
bezt->f1 = bezt->f2 = bezt->f3 = SELECT;
bezt->radius = bezt->weight = pt->pressure * gpl->thickness * 0.1f;
-
+
/* shift coord vects */
copy_v3_v3(p3d_prev, p3d_cur);
copy_v3_v3(p3d_cur, p3d_next);
-
+
if (i + 2 < tot) {
gp_strokepoint_convertcoords(C, gps, pt + 2, p3d_next, subrect);
}
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 89d8ed9c465..5eef34f4afe 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -79,15 +79,6 @@ typedef struct tGPsdata {
rctf *subrect; /* for using the camera rect within the 3d view */
rctf subrect_data;
-
-#if 0 // XXX review this 2d image stuff...
- ImBuf *ibuf; /* needed for GP_STROKE_2DIMAGE */
- struct IBufViewSettings {
- int offsx, offsy; /* offsets */
- int sizex, sizey; /* dimensions to use as scale-factor */
- } im2d_settings; /* needed for GP_STROKE_2DIMAGE */
-#endif
-
PointerRNA ownerPtr; /* pointer to owner of gp-datablock */
bGPdata *gpd; /* gp-datablock layer comes from */
bGPDlayer *gpl; /* layer we're working on */
@@ -269,7 +260,7 @@ static void gp_stroke_convertcoords(tGPsdata *p, const int mval[2], float out[3]
int mval_prj[2];
float rvec[3], dvec[3];
float mval_f[2];
-
+
/* Current method just converts each point in screen-coordinates to
* 3D-coordinates using the 3D-cursor as reference. In general, this
* works OK, but it could of course be improved.
@@ -283,7 +274,7 @@ static void gp_stroke_convertcoords(tGPsdata *p, const int mval[2], float out[3]
/* method taken from editview.c - mouse_cursor() */
project_int_noclip(p->ar, rvec, mval_prj);
-
+
VECSUB2D(mval_f, mval_prj, mval);
ED_view3d_win_to_delta(p->ar, mval_f, dvec);
sub_v3_v3v3(out, rvec, dvec);
@@ -296,25 +287,6 @@ static void gp_stroke_convertcoords(tGPsdata *p, const int mval[2], float out[3]
mul_v3_m4v3(out, p->imat, out);
}
-#if 0
- /* 2d - on image 'canvas' (assume that p->v2d is set) */
- else if (gpd->sbuffer_sflag & GP_STROKE_2DIMAGE) {
- int sizex, sizey, offsx, offsy;
-
- /* get stored settings
- * - assume that these have been set already (there are checks that set sane 'defaults' just in case)
- */
- sizex = p->im2d_settings.sizex;
- sizey = p->im2d_settings.sizey;
- offsx = p->im2d_settings.offsx;
- offsy = p->im2d_settings.offsy;
-
- /* calculate new points */
- out[0] = (float)(mval[0] - offsx) / (float)sizex;
- out[1] = (float)(mval[1] - offsy) / (float)sizey;
- }
-#endif
-
/* 2d - relative to screen (viewport area) */
else {
if (p->subrect == NULL) { /* normal 3D view */
@@ -393,11 +365,11 @@ static short gp_stroke_addpoint(tGPsdata *p, const int mval[2], float pressure)
else if (p->paintmode == GP_PAINTMODE_DRAW_POLY) {
/* get pointer to destination point */
pt = (tGPspoint *)(gpd->sbuffer);
-
+
/* store settings */
copy_v2_v2_int(&pt->x, mval);
pt->pressure = pressure;
-
+
/* if there's stroke for this poly line session add (or replace last) point
* to stroke. This allows to draw lines more interactively (see new segment
* during mouse slide, i.e.)
@@ -405,36 +377,36 @@ static short gp_stroke_addpoint(tGPsdata *p, const int mval[2], float pressure)
if (gp_stroke_added_check(p)) {
bGPDstroke *gps = p->gpf->strokes.last;
bGPDspoint *pts;
-
+
/* first time point is adding to temporary buffer -- need to allocate new point in stroke */
if (gpd->sbuffer_size == 0) {
gps->points = MEM_reallocN(gps->points, sizeof(bGPDspoint) * (gps->totpoints + 1));
gps->totpoints++;
}
-
+
pts = &gps->points[gps->totpoints - 1];
-
+
/* special case for poly lines: normally, depth is needed only when creating new stroke from buffer,
* but poly lines are converting to stroke instantly, so initialize depth buffer before converting coordinates
*/
if (gpencil_project_check(p)) {
View3D *v3d = p->sa->spacedata.first;
-
+
view3d_region_operator_needs_opengl(p->win, p->ar);
ED_view3d_autodist_init(p->scene, p->ar, v3d, (p->gpd->flag & GP_DATA_DEPTH_STROKE) ? 1 : 0);
}
-
+
/* convert screen-coordinates to appropriate coordinates (and store them) */
gp_stroke_convertcoords(p, &pt->x, &pts->x, NULL);
-
+
/* copy pressure */
pts->pressure = pt->pressure;
}
-
+
/* increment counters */
if (gpd->sbuffer_size == 0)
gpd->sbuffer_size++;
-
+
return GP_STROKEADD_NORMAL;
}
@@ -482,7 +454,7 @@ static void gp_stroke_smooth(tGPsdata *p)
/* second pass: apply smoothed coordinates */
for (i = 0, spc = smoothArray; i < gpd->sbuffer_size; i++, spc++) {
tGPspoint *pc = (((tGPspoint *)gpd->sbuffer) + i);
-
+
copy_v2_v2_int(&pc->x, &spc->x);
}
@@ -639,10 +611,10 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
else if (p->paintmode == GP_PAINTMODE_DRAW_POLY) {
/* first point */
ptc = gpd->sbuffer;
-
+
/* convert screen-coordinates to appropriate coordinates (and store them) */
gp_stroke_convertcoords(p, &ptc->x, &pt->x, NULL);
-
+
/* copy pressure */
pt->pressure = ptc->pressure;
}
@@ -656,10 +628,10 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
int found_depth = 0;
depth_arr = MEM_mallocN(sizeof(float) * gpd->sbuffer_size, "depth_points");
-
+
for (i = 0, ptc = gpd->sbuffer; i < gpd->sbuffer_size; i++, ptc++, pt++) {
copy_v2_v2_int(mval, &ptc->x);
-
+
if ((ED_view3d_autodist_depth(p->ar, mval, depth_margin, depth_arr + i) == 0) &&
(i && (ED_view3d_autodist_depth_seg(p->ar, mval, mval_prev, depth_margin + 1, depth_arr + i) == 0)))
{
@@ -668,7 +640,7 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
else {
found_depth = TRUE;
}
-
+
copy_v2_v2_int(mval_prev, mval);
}
@@ -835,21 +807,6 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p, int mval[], int mvalo[], shor
else if (gps->flag & GP_STROKE_2DSPACE) {
UI_view2d_view_to_region(p->v2d, gps->points->x, gps->points->y, &x0, &y0);
}
-#if 0
- else if (gps->flag & GP_STROKE_2DIMAGE) {
- int offsx, offsy, sizex, sizey;
-
- /* get stored settings */
- sizex = p->im2d_settings.sizex;
- sizey = p->im2d_settings.sizey;
- offsx = p->im2d_settings.offsx;
- offsy = p->im2d_settings.offsy;
-
- /* calculate new points */
- x0 = (int)((gps->points->x * sizex) + offsx);
- y0 = (int)((gps->points->y * sizey) + offsy);
- }
-#endif
else {
if (p->subrect == NULL) { /* normal 3D view */
x0 = (int)(gps->points->x / 100 * p->ar->winx);
@@ -895,24 +852,6 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p, int mval[], int mvalo[], shor
UI_view2d_view_to_region(p->v2d, pt2->x, pt2->y, &x1, &y1);
}
-#if 0
- else if (gps->flag & GP_STROKE_2DIMAGE) {
- int offsx, offsy, sizex, sizey;
-
- /* get stored settings */
- sizex = p->im2d_settings.sizex;
- sizey = p->im2d_settings.sizey;
- offsx = p->im2d_settings.offsx;
- offsy = p->im2d_settings.offsy;
-
- /* calculate new points */
- x0 = (int)((pt1->x * sizex) + offsx);
- y0 = (int)((pt1->y * sizey) + offsy);
-
- x1 = (int)((pt2->x * sizex) + offsx);
- y1 = (int)((pt2->y * sizey) + offsy);
- }
-#endif
else {
if (p->subrect == NULL) { /* normal 3D view */
x0 = (int)(pt1->x / 100 * p->ar->winx);
@@ -1062,7 +1001,6 @@ static int gp_session_initdata(bContext *C, tGPsdata *p)
#endif
}
break;
-#if 0 // XXX these other spaces will come over time...
case SPACE_SEQ:
{
SpaceSeq *sseq = curarea->spacedata.first;
@@ -1079,15 +1017,16 @@ static int gp_session_initdata(bContext *C, tGPsdata *p)
printf("Error: In active view (sequencer), active mode doesn't support Grease Pencil\n");
return 0;
}
+#if 0 // XXX will this sort of antiquated stuff be restored?
if ((sseq->flag & SEQ_DRAW_GPENCIL) == 0) {
p->status = GP_STATUS_ERROR;
if (G.debug & G_DEBUG)
printf("Error: In active view, Grease Pencil not shown\n");
return 0;
}
+#endif
}
break;
-#endif
case SPACE_IMAGE:
{
//SpaceImage *sima= curarea->spacedata.first;
@@ -1173,12 +1112,6 @@ static int gp_session_initdata(bContext *C, tGPsdata *p)
/* clear out buffer (stored in gp-data), in case something contaminated it */
gp_session_validatebuffer(p);
-#if 0
- /* set 'default' im2d_settings just in case something that uses this doesn't set it */
- p->im2d_settings.sizex = 1;
- p->im2d_settings.sizey = 1;
-#endif
-
return 1;
}
@@ -1260,7 +1193,7 @@ static void gp_paint_initstroke(tGPsdata *p, short paintmode)
if (p->sa->spacetype == SPACE_VIEW3D) {
View3D *v3d = p->sa->spacedata.first;
RegionView3D *rv3d = p->ar->regiondata;
-
+
/* for camera view set the subrect */
if (rv3d->persp == RV3D_CAMOB) {
ED_view3d_calc_camera_border(p->scene, p->ar, v3d, rv3d, &p->subrect_data, TRUE); /* no shift */
@@ -1290,41 +1223,13 @@ static void gp_paint_initstroke(tGPsdata *p, short paintmode)
p->gpd->sbuffer_sflag |= GP_STROKE_2DSPACE;
}
break;
-#if 0 // XXX other spacetypes to be restored in due course
+
case SPACE_SEQ:
{
- SpaceSeq *sseq = (SpaceSeq *)p->sa->spacedata.first;
- int rectx, recty;
- float zoom, zoomx, zoomy;
-
- /* set draw 2d-stroke flag */
- p->gpd->sbuffer_sflag |= GP_STROKE_2DIMAGE;
-
- /* calculate zoom factor */
- zoom = (float)(SEQ_ZOOM_FAC(sseq->zoom));
- if (sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
- zoomx = zoom * (p->scene->r.xasp / p->scene->r.yasp);
- zoomy = zoom;
- }
- else
- zoomx = zoomy = zoom;
-
- /* calculate rect size to use to calculate the size of the drawing area
- * - We use the size of the output image not the size of the ibuf being shown
- * as it is too messy getting the ibuf (and could be too slow). This should be
- * a reasonable for most cases anyway.
- */
- rectx = (p->scene->r.size * p->scene->r.xsch) / 100;
- recty = (p->scene->r.size * p->scene->r.ysch) / 100;
-
- /* set offset and scale values for opertations to use */
- p->im2d_settings.sizex = (int)(zoomx * rectx);
- p->im2d_settings.sizey = (int)(zoomy * recty);
- p->im2d_settings.offsx = (int)((p->sa->winx - p->im2d_settings.sizex) / 2 + sseq->xof);
- p->im2d_settings.offsy = (int)((p->sa->winy - p->im2d_settings.sizey) / 2 + sseq->yof);
+ p->gpd->sbuffer_sflag |= GP_STROKE_2DSPACE;
}
break;
-#endif
+
case SPACE_IMAGE:
{
SpaceImage *sima = (SpaceImage *)p->sa->spacedata.first;
@@ -1743,13 +1648,13 @@ static int gpencil_draw_invoke(bContext *C, wmOperator *op, wmEvent *event)
}
/* gpencil modal operator stores area, which can be removed while using it (like fullscreen) */
-static int gpencil_area_exists(bContext *C, ScrArea *satest)
+static int gpencil_area_exists(bContext *C, ScrArea *sa_test)
{
bScreen *sc = CTX_wm_screen(C);
ScrArea *sa;
for (sa = sc->areabase.first; sa; sa = sa->next) {
- if (sa == satest)
+ if (sa == sa_test)
return 1;
}
@@ -1839,7 +1744,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, wmEvent *event)
sketch |= GPENCIL_SKETCH_SESSIONS_ON(p->scene);
/* polyline drawing is also 'sketching' -- all knots should be added during one session */
sketch |= p->paintmode == GP_PAINTMODE_DRAW_POLY;
-
+
if (sketch) {
/* end stroke only, and then wait to resume painting soon */
//printf("\t\tGP - end stroke only\n");
@@ -1847,7 +1752,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, wmEvent *event)
/* we've just entered idling state, so this event was processed (but no others yet) */
estate = OPERATOR_RUNNING_MODAL;
-
+
/* stroke could be smoothed, send notifier to refresh screen */
WM_event_add_notifier(C, NC_SCREEN | ND_GPENCIL | NA_EDITED, NULL);
}
@@ -1860,7 +1765,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, wmEvent *event)
else if (event->val == KM_PRESS) {
/* not painting, so start stroke (this should be mouse-button down) */
p = gpencil_stroke_begin(C, op);
-
+
if (p->status == GP_STATUS_ERROR) {
estate = OPERATOR_CANCELLED;
}
@@ -1916,7 +1821,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, wmEvent *event)
case OPERATOR_CANCELLED:
gpencil_draw_exit(C, op);
break;
-
+
case OPERATOR_RUNNING_MODAL | OPERATOR_PASS_THROUGH:
/* event doesn't need to be handled */
//printf("unhandled event -> %d (mmb? = %d | mmv? = %d)\n", event->type, event->type == MIDDLEMOUSE, event->type==MOUSEMOVE);
diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h
index 32eb63a26d5..8a480271635 100644
--- a/source/blender/editors/include/ED_gpencil.h
+++ b/source/blender/editors/include/ED_gpencil.h
@@ -76,7 +76,7 @@ void ED_operatortypes_gpencil(void);
/* ------------ Grease-Pencil Drawing API ------------------ */
/* drawgpencil.c */
-void draw_gpencil_2dimage(struct bContext *C /* , struct ImBuf *ibuf */);
+void draw_gpencil_2dimage(struct bContext *C);
void draw_gpencil_view2d(struct bContext *C, short onlyv2d);
void draw_gpencil_view3d(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, short only3d);
diff --git a/source/blender/editors/space_sequencer/sequencer_buttons.c b/source/blender/editors/space_sequencer/sequencer_buttons.c
index aeedafa9992..1e452f2052d 100644
--- a/source/blender/editors/space_sequencer/sequencer_buttons.c
+++ b/source/blender/editors/space_sequencer/sequencer_buttons.c
@@ -25,8 +25,6 @@
* \ingroup spseq
*/
-
-
#include <string.h>
#include <stdio.h>
@@ -36,10 +34,13 @@
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
+
#include "BKE_context.h"
#include "BKE_screen.h"
#include "ED_screen.h"
+#include "ED_gpencil.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -48,6 +49,19 @@
#include "sequencer_intern.h"
+/* **************************** buttons ********************************* */
+
+void sequencer_buttons_register(ARegionType *art)
+{
+ PanelType *pt;
+
+ pt = MEM_callocN(sizeof(PanelType), "spacetype sequencer panel gpencil");
+ strcpy(pt->idname, "SEQUENCER_PT_gpencil");
+ strcpy(pt->label, N_("Grease Pencil"));
+ pt->draw= gpencil_panel_standard;
+ BLI_addtail(&art->paneltypes, pt);
+}
+
/* **************** operator to open/close properties view ************* */
static int sequencer_properties(bContext *C, wmOperator *UNUSED(op))
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index b674943b2dc..3119c2d44f8 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -58,6 +58,7 @@
#include "BIF_glutil.h"
#include "ED_anim_api.h"
+#include "ED_gpencil.h"
#include "ED_markers.h"
#include "ED_mask.h"
#include "ED_types.h"
@@ -976,16 +977,16 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
/* draw grease-pencil (image aligned) */
// if (sseq->flag & SEQ_DRAW_GPENCIL)
-// XXX draw_gpencil_2dimage(sa, ibuf);
+ draw_gpencil_2dimage(C);
IMB_freeImBuf(ibuf);
- /* draw grease-pencil (screen aligned) */
-// if (sseq->flag & SEQ_DRAW_GPENCIL)
-// XXX draw_gpencil_view2d(sa, 0);
-
/* ortho at pixel level */
UI_view2d_view_restore(C);
+
+ /* draw grease-pencil (screen aligned) */
+// if (sseq->flag & SEQ_DRAW_GPENCIL)
+ draw_gpencil_view2d(C, 0);
//if (sc->mode == SC_MODE_MASKEDIT) {
if (sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h
index 25a322c6905..14d2ccdbbbe 100644
--- a/source/blender/editors/space_sequencer/sequencer_intern.h
+++ b/source/blender/editors/space_sequencer/sequencer_intern.h
@@ -174,7 +174,7 @@ struct ImBuf *make_zebra_view_from_ibuf(struct ImBuf * ibuf, float perc);
struct ImBuf *make_histogram_view_from_ibuf(struct ImBuf * ibuf);
/* sequencer_buttons.c */
-
+void sequencer_buttons_register(struct ARegionType *art);
void SEQUENCER_OT_properties(struct wmOperatorType *ot);
#endif /* __SEQUENCER_INTERN_H__ */
diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c
index 3643f92d334..dbfc554007a 100644
--- a/source/blender/editors/space_sequencer/space_sequencer.c
+++ b/source/blender/editors/space_sequencer/space_sequencer.c
@@ -485,6 +485,11 @@ static void sequencer_preview_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
switch (wmn->category) {
+ case NC_SCREEN:
+ if (wmn->data == ND_GPENCIL) {
+ ED_region_tag_redraw(ar);
+ }
+ break;
case NC_SCENE:
switch (wmn->data) {
case ND_FRAME:
@@ -534,6 +539,11 @@ static void sequencer_buttons_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
switch (wmn->category) {
+ case NC_SCREEN:
+ if (wmn->data == ND_GPENCIL) {
+ ED_region_tag_redraw(ar);
+ }
+ break;
case NC_SCENE:
switch (wmn->data) {
case ND_FRAME:
@@ -590,7 +600,7 @@ void ED_spacetype_sequencer(void)
art->init = sequencer_preview_area_init;
art->draw = sequencer_preview_area_draw;
art->listener = sequencer_preview_area_listener;
- art->keymapflag = ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_ANIMATION;
+ art->keymapflag = ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_GPENCIL;
BLI_addhead(&st->regiontypes, art);
/* regions: listview/buttons */
@@ -602,6 +612,8 @@ void ED_spacetype_sequencer(void)
art->init = sequencer_buttons_area_init;
art->draw = sequencer_buttons_area_draw;
BLI_addhead(&st->regiontypes, art);
+
+ sequencer_buttons_register(art);
/* regions: header */
art = MEM_callocN(sizeof(ARegionType), "spacetype sequencer region");
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 3d01f5ba082..3ff54076f82 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -1970,10 +1970,12 @@ static void rna_def_space_image(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Grease Pencil", "Grease pencil data for this space");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
+#if 0 // XXX: unused - old stuff which may not be restored
prop = RNA_def_property(srna, "use_grease_pencil", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DISPGP);
RNA_def_property_ui_text(prop, "Use Grease Pencil",
"Display and edit the grease pencil freehand annotations overlay");
+#endif
/* update */
prop = RNA_def_property(srna, "use_realtime_update", PROP_BOOLEAN, PROP_NONE);
@@ -2050,7 +2052,7 @@ static void rna_def_space_sequencer(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Display Mode", "View mode to use for displaying sequencer output");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
- /* flag's */
+ /* flags */
prop = RNA_def_property(srna, "show_frame_indicator", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SEQ_NO_DRAW_CFRANUM);
RNA_def_property_ui_text(prop, "Show Frame Number Indicator",
@@ -2077,23 +2079,10 @@ static void rna_def_space_sequencer(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Safe Margin", "Draw title safe margins in preview");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
- prop = RNA_def_property(srna, "use_grease_pencil", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_DRAW_GPENCIL);
- RNA_def_property_ui_text(prop, "Use Grease Pencil",
- "Display and edit the grease pencil freehand annotations overlay");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
-
prop = RNA_def_property(srna, "show_seconds", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SEQ_DRAWFRAMES);
RNA_def_property_ui_text(prop, "Show Seconds", "Show timing in seconds not frames");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
-
- /* grease pencil */
- prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "gpd");
- RNA_def_property_struct_type(prop, "UnknownType");
- RNA_def_property_ui_text(prop, "Grease Pencil", "Grease pencil data for this space");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
prop = RNA_def_property(srna, "display_channel", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "chanshown");
@@ -2114,6 +2103,14 @@ static void rna_def_space_sequencer(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Proxy render size",
"Draw preview using full resolution or different proxy resolutions");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
+
+ /* grease pencil */
+ prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "gpd");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "GreasePencil");
+ RNA_def_property_ui_text(prop, "Grease Pencil", "Grease pencil data for this space");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
}
static void rna_def_space_text(BlenderRNA *brna)