Code cleanup - Removing/commenting out various bits of legacy cruft related to
old Grease Pencil stuff
This commit is contained in:
@@ -664,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)
|
||||
void draw_gpencil_2dimage(const bContext *C)
|
||||
{
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
@@ -726,7 +726,7 @@ void draw_gpencil_2dimage(bContext *C)
|
||||
/* draw grease-pencil sketches to specified 2d-view assuming that matrices are already set correctly
|
||||
* Note: this gets called twice - first time with onlyv2d=1 to draw 'canvas' strokes, second time with onlyv2d=0 for screen-aligned strokes
|
||||
*/
|
||||
void draw_gpencil_view2d(bContext *C, short onlyv2d)
|
||||
void draw_gpencil_view2d(const bContext *C, short onlyv2d)
|
||||
{
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
/* Context Wrangling... */
|
||||
|
||||
/* 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)
|
||||
bGPdata **gpencil_data_get_pointers(const bContext *C, PointerRNA *ptr)
|
||||
{
|
||||
ID *screen_id = (ID *)CTX_wm_screen(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
@@ -181,7 +181,7 @@ bGPdata **gpencil_data_get_pointers(bContext *C, PointerRNA *ptr)
|
||||
}
|
||||
|
||||
/* Get the active Grease Pencil datablock */
|
||||
bGPdata *gpencil_data_get_active(bContext *C)
|
||||
bGPdata *gpencil_data_get_active(const bContext *C)
|
||||
{
|
||||
bGPdata **gpd_ptr = gpencil_data_get_pointers(C, NULL);
|
||||
return (gpd_ptr) ? *(gpd_ptr) : NULL;
|
||||
|
||||
@@ -968,16 +968,6 @@ static int gp_session_initdata(bContext *C, tGPsdata *p)
|
||||
printf("Error: 3D-View active region doesn't have any region data, so cannot be drawable\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if 0 // XXX will this sort of antiquated stuff be restored?
|
||||
/* check that gpencil data is allowed to be drawn */
|
||||
if ((v3d->flag2 & V3D_DISPGP) == 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;
|
||||
|
||||
@@ -989,16 +979,6 @@ static int gp_session_initdata(bContext *C, tGPsdata *p)
|
||||
p->sa = curarea;
|
||||
p->ar = ar;
|
||||
p->v2d = &ar->v2d;
|
||||
|
||||
#if 0 // XXX will this sort of antiquated stuff be restored?
|
||||
/* check that gpencil data is allowed to be drawn */
|
||||
if ((snode->flag & SNODE_DISPGP) == 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;
|
||||
case SPACE_SEQ:
|
||||
@@ -1017,14 +997,6 @@ 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;
|
||||
case SPACE_IMAGE:
|
||||
@@ -1035,48 +1007,36 @@ static int gp_session_initdata(bContext *C, tGPsdata *p)
|
||||
p->sa = curarea;
|
||||
p->ar = ar;
|
||||
p->v2d = &ar->v2d;
|
||||
//p->ibuf= BKE_image_get_ibuf(sima->image, &sima->iuser);
|
||||
|
||||
#if 0 // XXX disabled for now
|
||||
/* check that gpencil data is allowed to be drawn */
|
||||
if ((sima->flag & SI_DISPGP) == 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;
|
||||
case SPACE_CLIP:
|
||||
{
|
||||
SpaceClip *sc = curarea->spacedata.first;
|
||||
|
||||
|
||||
/* set the current area */
|
||||
p->sa = curarea;
|
||||
p->ar = ar;
|
||||
p->v2d = &ar->v2d;
|
||||
//p->ibuf= BKE_image_get_ibuf(sima->image, &sima->iuser);
|
||||
|
||||
|
||||
invert_m4_m4(p->imat, sc->unistabmat);
|
||||
|
||||
|
||||
/* custom color for new layer */
|
||||
p->custom_color[0] = 1.0f;
|
||||
p->custom_color[1] = 0.0f;
|
||||
p->custom_color[2] = 0.5f;
|
||||
p->custom_color[3] = 0.9f;
|
||||
|
||||
|
||||
if (sc->gpencil_src == SC_GPENCIL_SRC_TRACK) {
|
||||
int framenr = sc->user.framenr;
|
||||
MovieTrackingTrack *track = BKE_tracking_active_track(&sc->clip->tracking);
|
||||
MovieTrackingMarker *marker = BKE_tracking_exact_marker(track, framenr);
|
||||
|
||||
|
||||
p->imat[3][0] -= marker->pos[0];
|
||||
p->imat[3][1] -= marker->pos[1];
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
/* unsupported views */
|
||||
default:
|
||||
{
|
||||
@@ -1157,7 +1117,7 @@ static void gp_paint_initstroke(tGPsdata *p, short paintmode)
|
||||
p->gpl = gpencil_layer_getactive(p->gpd);
|
||||
if (p->gpl == NULL) {
|
||||
p->gpl = gpencil_layer_addnew(p->gpd);
|
||||
|
||||
|
||||
if (p->custom_color[3])
|
||||
copy_v3_v3(p->gpl->color, p->custom_color);
|
||||
}
|
||||
@@ -1465,8 +1425,9 @@ static void gpencil_draw_apply_event(wmOperator *op, wmEvent *event)
|
||||
float mousef[2];
|
||||
int tablet = 0;
|
||||
|
||||
/* convert from window-space to area-space mouse coordintes */
|
||||
// NOTE: float to ints conversions, +1 factor is probably used to ensure a bit more accurate rounding...
|
||||
/* convert from window-space to area-space mouse coordintes
|
||||
* NOTE: float to ints conversions, +1 factor is probably used to ensure a bit more accurate rounding...
|
||||
*/
|
||||
p->mval[0] = event->mval[0] + 1;
|
||||
p->mval[1] = event->mval[1] + 1;
|
||||
|
||||
|
||||
@@ -64,8 +64,8 @@ typedef struct tGPspoint {
|
||||
|
||||
/* ----------- Grease Pencil Tools/Context ------------- */
|
||||
|
||||
struct bGPdata **gpencil_data_get_pointers(struct bContext *C, struct PointerRNA *ptr);
|
||||
struct bGPdata *gpencil_data_get_active(struct bContext *C);
|
||||
struct bGPdata **gpencil_data_get_pointers(const struct bContext *C, struct PointerRNA *ptr);
|
||||
struct bGPdata *gpencil_data_get_active(const struct bContext *C);
|
||||
struct bGPdata *gpencil_data_get_active_v3d(struct Scene *scene); /* for offscreen rendering */
|
||||
|
||||
/* ----------- Grease Pencil Operators ----------------- */
|
||||
@@ -76,8 +76,8 @@ void ED_operatortypes_gpencil(void);
|
||||
/* ------------ Grease-Pencil Drawing API ------------------ */
|
||||
/* drawgpencil.c */
|
||||
|
||||
void draw_gpencil_2dimage(struct bContext *C);
|
||||
void draw_gpencil_view2d(struct bContext *C, short onlyv2d);
|
||||
void draw_gpencil_2dimage(const struct bContext *C);
|
||||
void draw_gpencil_view2d(const struct bContext *C, short onlyv2d);
|
||||
void draw_gpencil_view3d(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, short only3d);
|
||||
|
||||
void gpencil_panel_standard(const struct bContext *C, struct Panel *pa);
|
||||
|
||||
@@ -27,8 +27,6 @@
|
||||
#ifndef __ED_SEQUENCER_H__
|
||||
#define __ED_SEQUENCER_H__
|
||||
|
||||
#define SEQ_ZOOM_FAC(szoom) ((szoom) > 0.0f) ? (szoom) : ((szoom) == 0.0f) ? (1.0f) : (-1.0f / (szoom))
|
||||
|
||||
struct Scene;
|
||||
struct Sequence;
|
||||
|
||||
|
||||
@@ -565,7 +565,6 @@ void draw_image_grease_pencil(bContext *C, short onlyv2d)
|
||||
/* draw in View2D space? */
|
||||
if (onlyv2d) {
|
||||
/* draw grease-pencil ('image' strokes) */
|
||||
//if (sima->flag & SI_DISPGP)
|
||||
draw_gpencil_2dimage(C);
|
||||
}
|
||||
else {
|
||||
@@ -573,7 +572,6 @@ void draw_image_grease_pencil(bContext *C, short onlyv2d)
|
||||
//SpaceImage *sima= (SpaceImage *)CTX_wm_space_data(C);
|
||||
|
||||
/* draw grease-pencil ('screen' strokes) */
|
||||
//if (sima->flag & SI_DISPGP)
|
||||
draw_gpencil_view2d(C, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1138,15 +1138,15 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
|
||||
glDisable(GL_BLEND);
|
||||
|
||||
/* draw grease-pencil ('canvas' strokes) */
|
||||
if (/*(snode->flag & SNODE_DISPGP) &&*/ (snode->nodetree))
|
||||
draw_gpencil_view2d((bContext*)C, 1);
|
||||
if (snode->nodetree)
|
||||
draw_gpencil_view2d(C, 1);
|
||||
|
||||
/* reset view matrix */
|
||||
UI_view2d_view_restore(C);
|
||||
|
||||
/* draw grease-pencil (screen strokes, and also paintbuffer) */
|
||||
if (/*(snode->flag & SNODE_DISPGP) && */(snode->nodetree))
|
||||
draw_gpencil_view2d((bContext*)C, 0);
|
||||
if (snode->nodetree)
|
||||
draw_gpencil_view2d(C, 0);
|
||||
|
||||
/* scrollers */
|
||||
scrollers= UI_view2d_scrollers_calc(C, v2d, 10, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
|
||||
|
||||
@@ -976,7 +976,6 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
|
||||
}
|
||||
|
||||
/* draw grease-pencil (image aligned) */
|
||||
// if (sseq->flag & SEQ_DRAW_GPENCIL)
|
||||
draw_gpencil_2dimage(C);
|
||||
|
||||
IMB_freeImBuf(ibuf);
|
||||
@@ -985,7 +984,6 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
|
||||
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) {
|
||||
|
||||
@@ -491,7 +491,7 @@ typedef enum eSpaceSeq_Flag {
|
||||
SEQ_MARKER_TRANS = (1 << 1),
|
||||
SEQ_DRAW_COLOR_SEPARATED = (1 << 2),
|
||||
SEQ_DRAW_SAFE_MARGINS = (1 << 3),
|
||||
SEQ_DRAW_GPENCIL = (1 << 4), /* DEPRECATED */
|
||||
/* SEQ_DRAW_GPENCIL = (1 << 4), */ /* DEPRECATED */
|
||||
SEQ_NO_DRAW_CFRANUM = (1 << 5),
|
||||
} eSpaceSeq_Flag;
|
||||
|
||||
@@ -746,7 +746,7 @@ typedef enum eSpaceImage_Flag {
|
||||
SI_DRAW_TILE = (1 << 19),
|
||||
SI_SMOOTH_UV = (1 << 20),
|
||||
SI_DRAW_STRETCH = (1 << 21),
|
||||
SI_DISPGP = (1 << 22), /* DEPRECATED */
|
||||
/* SI_DISPGP = (1 << 22), */ /* DEPRECATED */
|
||||
SI_DRAW_OTHER = (1 << 23),
|
||||
|
||||
SI_COLOR_CORRECTION = (1 << 24),
|
||||
@@ -876,7 +876,7 @@ typedef struct SpaceNode {
|
||||
/* snode->flag */
|
||||
typedef enum eSpaceNode_Flag {
|
||||
SNODE_BACKDRAW = (1 << 1),
|
||||
SNODE_DISPGP = (1 << 2), /* XXX: Grease Pencil - deprecated? */
|
||||
/* SNODE_DISPGP = (1 << 2), */ /* XXX: Grease Pencil - deprecated? */
|
||||
SNODE_USE_ALPHA = (1 << 3),
|
||||
SNODE_SHOW_ALPHA = (1 << 4),
|
||||
SNODE_AUTO_RENDER = (1 << 5),
|
||||
|
||||
@@ -1969,14 +1969,7 @@ static void rna_def_space_image(BlenderRNA *brna)
|
||||
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_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);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "lock", 0);
|
||||
|
||||
Reference in New Issue
Block a user