Cleanup: Use BKE_gpencil prefix
This is a good point to change this as grease-pencil-v2 branch was just merged, so I hope merge conflicts with other branches are minimal.
This commit is contained in:
		@@ -43,36 +43,36 @@ struct Main;
 | 
			
		||||
 | 
			
		||||
/* ------------ Grease-Pencil API ------------------ */
 | 
			
		||||
 | 
			
		||||
void free_gpencil_stroke(struct bGPDstroke *gps);
 | 
			
		||||
bool free_gpencil_strokes(struct bGPDframe *gpf);
 | 
			
		||||
void free_gpencil_frames(struct bGPDlayer *gpl);
 | 
			
		||||
void free_gpencil_layers(struct ListBase *list);
 | 
			
		||||
void free_gpencil_brushes(struct ListBase *list);
 | 
			
		||||
void free_gpencil_palettes(struct ListBase *list);
 | 
			
		||||
void BKE_gpencil_free_stroke(struct bGPDstroke *gps);
 | 
			
		||||
bool BKE_gpencil_free_strokes(struct bGPDframe *gpf);
 | 
			
		||||
void BKE_gpencil_free_frames(struct bGPDlayer *gpl);
 | 
			
		||||
void BKE_gpencil_free_layers(struct ListBase *list);
 | 
			
		||||
void BKE_gpencil_free_brushes(struct ListBase *list);
 | 
			
		||||
void BKE_gpencil_free_palettes(struct ListBase *list);
 | 
			
		||||
void BKE_gpencil_free(struct bGPdata *gpd, bool free_palettes);
 | 
			
		||||
 | 
			
		||||
void gpencil_stroke_sync_selection(struct bGPDstroke *gps);
 | 
			
		||||
void BKE_gpencil_stroke_sync_selection(struct bGPDstroke *gps);
 | 
			
		||||
 | 
			
		||||
struct bGPDframe *gpencil_frame_addnew(struct bGPDlayer *gpl, int cframe);
 | 
			
		||||
struct bGPDframe *gpencil_frame_addcopy(struct bGPDlayer *gpl, int cframe);
 | 
			
		||||
struct bGPDlayer *gpencil_layer_addnew(struct bGPdata *gpd, const char *name, bool setactive);
 | 
			
		||||
struct bGPdata *gpencil_data_addnew(const char name[]);
 | 
			
		||||
struct bGPDframe *BKE_gpencil_frame_addnew(struct bGPDlayer *gpl, int cframe);
 | 
			
		||||
struct bGPDframe *BKE_gpencil_frame_addcopy(struct bGPDlayer *gpl, int cframe);
 | 
			
		||||
struct bGPDlayer *BKE_gpencil_layer_addnew(struct bGPdata *gpd, const char *name, bool setactive);
 | 
			
		||||
struct bGPdata   *BKE_gpencil_data_addnew(const char name[]);
 | 
			
		||||
 | 
			
		||||
struct bGPDframe *gpencil_frame_duplicate(const struct bGPDframe *gpf_src);
 | 
			
		||||
struct bGPDlayer *gpencil_layer_duplicate(const struct bGPDlayer *gpl_src);
 | 
			
		||||
struct bGPdata *gpencil_data_duplicate(struct Main *bmain, struct bGPdata *gpd, bool internal_copy);
 | 
			
		||||
struct bGPDframe *BKE_gpencil_frame_duplicate(const struct bGPDframe *gpf_src);
 | 
			
		||||
struct bGPDlayer *BKE_gpencil_layer_duplicate(const struct bGPDlayer *gpl_src);
 | 
			
		||||
struct bGPdata   *BKE_gpencil_data_duplicate(struct Main *bmain, struct bGPdata *gpd, bool internal_copy);
 | 
			
		||||
 | 
			
		||||
void BKE_gpencil_make_local(struct Main *bmain, struct bGPdata *gpd, const bool lib_local);
 | 
			
		||||
 | 
			
		||||
void gpencil_frame_delete_laststroke(struct bGPDlayer *gpl, struct bGPDframe *gpf);
 | 
			
		||||
void BKE_gpencil_frame_delete_laststroke(struct bGPDlayer *gpl, struct bGPDframe *gpf);
 | 
			
		||||
 | 
			
		||||
struct bGPDpalette *gpencil_palette_addnew(struct bGPdata *gpd, const char *name, bool setactive);
 | 
			
		||||
struct bGPDpalette *gpencil_palette_duplicate(const struct bGPDpalette *palette_src);
 | 
			
		||||
struct bGPDpalettecolor *gpencil_palettecolor_addnew(struct bGPDpalette *palette, const char *name, bool setactive);
 | 
			
		||||
struct bGPDpalette *BKE_gpencil_palette_addnew(struct bGPdata *gpd, const char *name, bool setactive);
 | 
			
		||||
struct bGPDpalette *BKE_gpencil_palette_duplicate(const struct bGPDpalette *palette_src);
 | 
			
		||||
struct bGPDpalettecolor *BKE_gpencil_palettecolor_addnew(struct bGPDpalette *palette, const char *name, bool setactive);
 | 
			
		||||
 | 
			
		||||
struct bGPDbrush *gpencil_brush_addnew(struct ToolSettings *ts, const char *name, bool setactive);
 | 
			
		||||
struct bGPDbrush *gpencil_brush_duplicate(const struct bGPDbrush *brush_src);
 | 
			
		||||
void gpencil_brush_init_presets(struct ToolSettings *ts);
 | 
			
		||||
struct bGPDbrush *BKE_gpencil_brush_addnew(struct ToolSettings *ts, const char *name, bool setactive);
 | 
			
		||||
struct bGPDbrush *BKE_gpencil_brush_duplicate(const struct bGPDbrush *brush_src);
 | 
			
		||||
void BKE_gpencil_brush_init_presets(struct ToolSettings *ts);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* Stroke and Fill - Alpha Visibility Threshold */
 | 
			
		||||
@@ -94,28 +94,28 @@ typedef enum eGP_GetFrame_Mode {
 | 
			
		||||
	GP_GETFRAME_ADD_COPY  = 2
 | 
			
		||||
} eGP_GetFrame_Mode;
 | 
			
		||||
 | 
			
		||||
struct bGPDframe *gpencil_layer_getframe(struct bGPDlayer *gpl, int cframe, eGP_GetFrame_Mode addnew);
 | 
			
		||||
struct bGPDframe *BKE_gpencil_layer_getframe(struct bGPDlayer *gpl, int cframe, eGP_GetFrame_Mode addnew);
 | 
			
		||||
struct bGPDframe *BKE_gpencil_layer_find_frame(struct bGPDlayer *gpl, int cframe);
 | 
			
		||||
bool gpencil_layer_delframe(struct bGPDlayer *gpl, struct bGPDframe *gpf);
 | 
			
		||||
bool BKE_gpencil_layer_delframe(struct bGPDlayer *gpl, struct bGPDframe *gpf);
 | 
			
		||||
 | 
			
		||||
struct bGPDlayer *gpencil_layer_getactive(struct bGPdata *gpd);
 | 
			
		||||
void gpencil_layer_setactive(struct bGPdata *gpd, struct bGPDlayer *active);
 | 
			
		||||
void gpencil_layer_delete(struct bGPdata *gpd, struct bGPDlayer *gpl);
 | 
			
		||||
struct bGPDlayer *BKE_gpencil_layer_getactive(struct bGPdata *gpd);
 | 
			
		||||
void BKE_gpencil_layer_setactive(struct bGPdata *gpd, struct bGPDlayer *active);
 | 
			
		||||
void BKE_gpencil_layer_delete(struct bGPdata *gpd, struct bGPDlayer *gpl);
 | 
			
		||||
 | 
			
		||||
struct bGPDbrush *gpencil_brush_getactive(struct ToolSettings *ts);
 | 
			
		||||
void gpencil_brush_setactive(struct ToolSettings *ts, struct bGPDbrush *active);
 | 
			
		||||
void gpencil_brush_delete(struct ToolSettings *ts, struct bGPDbrush *palette);
 | 
			
		||||
struct bGPDbrush *BKE_gpencil_brush_getactive(struct ToolSettings *ts);
 | 
			
		||||
void BKE_gpencil_brush_setactive(struct ToolSettings *ts, struct bGPDbrush *active);
 | 
			
		||||
void BKE_gpencil_brush_delete(struct ToolSettings *ts, struct bGPDbrush *palette);
 | 
			
		||||
 | 
			
		||||
struct bGPDpalette *gpencil_palette_getactive(struct bGPdata *gpd);
 | 
			
		||||
void gpencil_palette_setactive(struct bGPdata *gpd, struct bGPDpalette *active);
 | 
			
		||||
void gpencil_palette_delete(struct bGPdata *gpd, struct bGPDpalette *palette);
 | 
			
		||||
void gpencil_palette_change_strokes(struct bGPdata *gpd);
 | 
			
		||||
struct bGPDpalette *BKE_gpencil_palette_getactive(struct bGPdata *gpd);
 | 
			
		||||
void BKE_gpencil_palette_setactive(struct bGPdata *gpd, struct bGPDpalette *active);
 | 
			
		||||
void BKE_gpencil_palette_delete(struct bGPdata *gpd, struct bGPDpalette *palette);
 | 
			
		||||
void BKE_gpencil_palette_change_strokes(struct bGPdata *gpd);
 | 
			
		||||
 | 
			
		||||
struct bGPDpalettecolor *gpencil_palettecolor_getactive(struct bGPDpalette *palette);
 | 
			
		||||
void gpencil_palettecolor_setactive(struct bGPDpalette *palette, struct bGPDpalettecolor *active);
 | 
			
		||||
void gpencil_palettecolor_delete(struct bGPDpalette *palette, struct bGPDpalettecolor *palcolor);
 | 
			
		||||
struct bGPDpalettecolor *gpencil_palettecolor_getbyname(struct bGPDpalette *palette, char *name);
 | 
			
		||||
void gpencil_palettecolor_changename(struct bGPdata *gpd, char *oldname, const char *newname);
 | 
			
		||||
void gpencil_palettecolor_delete_strokes(struct bGPdata *gpd, char *name);
 | 
			
		||||
struct bGPDpalettecolor *BKE_gpencil_palettecolor_getactive(struct bGPDpalette *palette);
 | 
			
		||||
void BKE_gpencil_palettecolor_setactive(struct bGPDpalette *palette, struct bGPDpalettecolor *active);
 | 
			
		||||
void BKE_gpencil_palettecolor_delete(struct bGPDpalette *palette, struct bGPDpalettecolor *palcolor);
 | 
			
		||||
struct bGPDpalettecolor *BKE_gpencil_palettecolor_getbyname(struct bGPDpalette *palette, char *name);
 | 
			
		||||
void BKE_gpencil_palettecolor_changename(struct bGPdata *gpd, char *oldname, const char *newname);
 | 
			
		||||
void BKE_gpencil_palettecolor_delete_strokes(struct bGPdata *gpd, char *name);
 | 
			
		||||
 | 
			
		||||
#endif /*  __BKE_GPENCIL_H__ */
 | 
			
		||||
 
 | 
			
		||||
@@ -60,7 +60,7 @@
 | 
			
		||||
/* --------- Memory Management ------------ */
 | 
			
		||||
 | 
			
		||||
/* free stroke, doesn't unlink from any listbase */
 | 
			
		||||
void free_gpencil_stroke(bGPDstroke *gps)
 | 
			
		||||
void BKE_gpencil_free_stroke(bGPDstroke *gps)
 | 
			
		||||
{
 | 
			
		||||
	if (gps == NULL) {
 | 
			
		||||
		return;
 | 
			
		||||
@@ -76,7 +76,7 @@ void free_gpencil_stroke(bGPDstroke *gps)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Free strokes belonging to a gp-frame */
 | 
			
		||||
bool free_gpencil_strokes(bGPDframe *gpf)
 | 
			
		||||
bool BKE_gpencil_free_strokes(bGPDframe *gpf)
 | 
			
		||||
{
 | 
			
		||||
	bGPDstroke *gps_next;
 | 
			
		||||
	bool changed = (BLI_listbase_is_empty(&gpf->strokes) == false);
 | 
			
		||||
@@ -84,7 +84,7 @@ bool free_gpencil_strokes(bGPDframe *gpf)
 | 
			
		||||
	/* free strokes */
 | 
			
		||||
	for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps_next) {
 | 
			
		||||
		gps_next = gps->next;
 | 
			
		||||
		free_gpencil_stroke(gps);
 | 
			
		||||
		BKE_gpencil_free_stroke(gps);
 | 
			
		||||
	}
 | 
			
		||||
	BLI_listbase_clear(&gpf->strokes);
 | 
			
		||||
 | 
			
		||||
@@ -92,7 +92,7 @@ bool free_gpencil_strokes(bGPDframe *gpf)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Free all of a gp-layer's frames */
 | 
			
		||||
void free_gpencil_frames(bGPDlayer *gpl)
 | 
			
		||||
void BKE_gpencil_free_frames(bGPDlayer *gpl)
 | 
			
		||||
{
 | 
			
		||||
	bGPDframe *gpf_next;
 | 
			
		||||
	
 | 
			
		||||
@@ -104,7 +104,7 @@ void free_gpencil_frames(bGPDlayer *gpl)
 | 
			
		||||
		gpf_next = gpf->next;
 | 
			
		||||
		
 | 
			
		||||
		/* free strokes and their associated memory */
 | 
			
		||||
		free_gpencil_strokes(gpf);
 | 
			
		||||
		BKE_gpencil_free_strokes(gpf);
 | 
			
		||||
		BLI_freelinkN(&gpl->frames, gpf);
 | 
			
		||||
	}
 | 
			
		||||
	gpl->actframe = NULL;
 | 
			
		||||
@@ -123,7 +123,7 @@ static void free_gpencil_colors(bGPDpalette *palette)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Free all of the gp-palettes and colors */
 | 
			
		||||
void free_gpencil_palettes(ListBase *list)
 | 
			
		||||
void BKE_gpencil_free_palettes(ListBase *list)
 | 
			
		||||
{
 | 
			
		||||
	bGPDpalette *palette_next;
 | 
			
		||||
 | 
			
		||||
@@ -144,7 +144,7 @@ void free_gpencil_palettes(ListBase *list)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Free all of the gp-brushes for a viewport (list should be &gpd->brushes or so) */
 | 
			
		||||
void free_gpencil_brushes(ListBase *list)
 | 
			
		||||
void BKE_gpencil_free_brushes(ListBase *list)
 | 
			
		||||
{
 | 
			
		||||
	bGPDbrush *brush_next;
 | 
			
		||||
 | 
			
		||||
@@ -173,7 +173,7 @@ void free_gpencil_brushes(ListBase *list)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Free all of the gp-layers for a viewport (list should be &gpd->layers or so) */
 | 
			
		||||
void free_gpencil_layers(ListBase *list)
 | 
			
		||||
void BKE_gpencil_free_layers(ListBase *list)
 | 
			
		||||
{
 | 
			
		||||
	bGPDlayer *gpl_next;
 | 
			
		||||
	
 | 
			
		||||
@@ -185,7 +185,7 @@ void free_gpencil_layers(ListBase *list)
 | 
			
		||||
		gpl_next = gpl->next;
 | 
			
		||||
		
 | 
			
		||||
		/* free layers and their data */
 | 
			
		||||
		free_gpencil_frames(gpl);
 | 
			
		||||
		BKE_gpencil_free_frames(gpl);
 | 
			
		||||
		BLI_freelinkN(list, gpl);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -196,18 +196,18 @@ void BKE_gpencil_free(bGPdata *gpd, bool free_palettes)
 | 
			
		||||
	BKE_animdata_free(&gpd->id, false);
 | 
			
		||||
 | 
			
		||||
	/* free layers */
 | 
			
		||||
	free_gpencil_layers(&gpd->layers);
 | 
			
		||||
	BKE_gpencil_free_layers(&gpd->layers);
 | 
			
		||||
 | 
			
		||||
	/* free palettes */
 | 
			
		||||
	if (free_palettes) {
 | 
			
		||||
		free_gpencil_palettes(&gpd->palettes);
 | 
			
		||||
		BKE_gpencil_free_palettes(&gpd->palettes);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* -------- Container Creation ---------- */
 | 
			
		||||
 | 
			
		||||
/* add a new gp-frame to the given layer */
 | 
			
		||||
bGPDframe *gpencil_frame_addnew(bGPDlayer *gpl, int cframe)
 | 
			
		||||
bGPDframe *BKE_gpencil_frame_addnew(bGPDlayer *gpl, int cframe)
 | 
			
		||||
{
 | 
			
		||||
	bGPDframe *gpf = NULL, *gf = NULL;
 | 
			
		||||
	short state = 0;
 | 
			
		||||
@@ -259,7 +259,7 @@ bGPDframe *gpencil_frame_addnew(bGPDlayer *gpl, int cframe)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* add a copy of the active gp-frame to the given layer */
 | 
			
		||||
bGPDframe *gpencil_frame_addcopy(bGPDlayer *gpl, int cframe)
 | 
			
		||||
bGPDframe *BKE_gpencil_frame_addcopy(bGPDlayer *gpl, int cframe)
 | 
			
		||||
{
 | 
			
		||||
	bGPDframe *new_frame;
 | 
			
		||||
	bool found = false;
 | 
			
		||||
@@ -271,11 +271,11 @@ bGPDframe *gpencil_frame_addcopy(bGPDlayer *gpl, int cframe)
 | 
			
		||||
	}
 | 
			
		||||
	else if (gpl->actframe == NULL) {
 | 
			
		||||
		/* no active frame, so just create a new one from scratch */
 | 
			
		||||
		return gpencil_frame_addnew(gpl, cframe);
 | 
			
		||||
		return BKE_gpencil_frame_addnew(gpl, cframe);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	/* Create a copy of the frame */
 | 
			
		||||
	new_frame = gpencil_frame_duplicate(gpl->actframe);
 | 
			
		||||
	new_frame = BKE_gpencil_frame_duplicate(gpl->actframe);
 | 
			
		||||
	
 | 
			
		||||
	/* Find frame to insert it before */
 | 
			
		||||
	for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) {
 | 
			
		||||
@@ -290,7 +290,7 @@ bGPDframe *gpencil_frame_addcopy(bGPDlayer *gpl, int cframe)
 | 
			
		||||
			/* This only happens when we're editing with framelock on...
 | 
			
		||||
			 * - Delete the new frame and don't do anything else here...
 | 
			
		||||
			 */
 | 
			
		||||
			free_gpencil_strokes(new_frame);
 | 
			
		||||
			BKE_gpencil_free_strokes(new_frame);
 | 
			
		||||
			MEM_freeN(new_frame);
 | 
			
		||||
			new_frame = NULL;
 | 
			
		||||
			
 | 
			
		||||
@@ -314,7 +314,7 @@ bGPDframe *gpencil_frame_addcopy(bGPDlayer *gpl, int cframe)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* add a new gp-layer and make it the active layer */
 | 
			
		||||
bGPDlayer *gpencil_layer_addnew(bGPdata *gpd, const char *name, bool setactive)
 | 
			
		||||
bGPDlayer *BKE_gpencil_layer_addnew(bGPdata *gpd, const char *name, bool setactive)
 | 
			
		||||
{
 | 
			
		||||
	bGPDlayer *gpl;
 | 
			
		||||
	
 | 
			
		||||
@@ -353,14 +353,14 @@ bGPDlayer *gpencil_layer_addnew(bGPdata *gpd, const char *name, bool setactive)
 | 
			
		||||
	
 | 
			
		||||
	/* make this one the active one */
 | 
			
		||||
	if (setactive)
 | 
			
		||||
		gpencil_layer_setactive(gpd, gpl);
 | 
			
		||||
		BKE_gpencil_layer_setactive(gpd, gpl);
 | 
			
		||||
	
 | 
			
		||||
	/* return layer */
 | 
			
		||||
	return gpl;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* add a new gp-palette and make it the active */
 | 
			
		||||
bGPDpalette *gpencil_palette_addnew(bGPdata *gpd, const char *name, bool setactive)
 | 
			
		||||
bGPDpalette *BKE_gpencil_palette_addnew(bGPdata *gpd, const char *name, bool setactive)
 | 
			
		||||
{
 | 
			
		||||
	bGPDpalette *palette;
 | 
			
		||||
 | 
			
		||||
@@ -383,7 +383,7 @@ bGPDpalette *gpencil_palette_addnew(bGPdata *gpd, const char *name, bool setacti
 | 
			
		||||
 | 
			
		||||
	/* make this one the active one */
 | 
			
		||||
	if (setactive) {
 | 
			
		||||
		gpencil_palette_setactive(gpd, palette);
 | 
			
		||||
		BKE_gpencil_palette_setactive(gpd, palette);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* return palette */
 | 
			
		||||
@@ -391,11 +391,11 @@ bGPDpalette *gpencil_palette_addnew(bGPdata *gpd, const char *name, bool setacti
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* create a set of default drawing brushes with predefined presets */
 | 
			
		||||
void gpencil_brush_init_presets(ToolSettings *ts)
 | 
			
		||||
void BKE_gpencil_brush_init_presets(ToolSettings *ts)
 | 
			
		||||
{
 | 
			
		||||
	bGPDbrush *brush;
 | 
			
		||||
	/* Basic brush */
 | 
			
		||||
	brush = gpencil_brush_addnew(ts, "Basic", true);
 | 
			
		||||
	brush = BKE_gpencil_brush_addnew(ts, "Basic", true);
 | 
			
		||||
	brush->thickness = 3.0f;
 | 
			
		||||
	brush->flag &= ~GP_BRUSH_USE_RANDOM_PRESSURE;
 | 
			
		||||
	brush->draw_sensitivity = 1.0f;
 | 
			
		||||
@@ -419,7 +419,7 @@ void gpencil_brush_init_presets(ToolSettings *ts)
 | 
			
		||||
	brush->draw_random_sub = 0.0f;
 | 
			
		||||
 | 
			
		||||
	/* Pencil brush */
 | 
			
		||||
	brush = gpencil_brush_addnew(ts, "Pencil", false);
 | 
			
		||||
	brush = BKE_gpencil_brush_addnew(ts, "Pencil", false);
 | 
			
		||||
	brush->thickness = 7.0f;
 | 
			
		||||
	brush->flag &= ~GP_BRUSH_USE_RANDOM_PRESSURE;
 | 
			
		||||
	brush->draw_sensitivity = 1.0f;
 | 
			
		||||
@@ -443,7 +443,7 @@ void gpencil_brush_init_presets(ToolSettings *ts)
 | 
			
		||||
	brush->draw_random_sub = 0.0f;
 | 
			
		||||
 | 
			
		||||
	/* Ink brush */
 | 
			
		||||
	brush = gpencil_brush_addnew(ts, "Ink", false);
 | 
			
		||||
	brush = BKE_gpencil_brush_addnew(ts, "Ink", false);
 | 
			
		||||
	brush->thickness = 7.0f;
 | 
			
		||||
	brush->flag &= ~GP_BRUSH_USE_RANDOM_PRESSURE;
 | 
			
		||||
	brush->draw_sensitivity = 1.6f;
 | 
			
		||||
@@ -467,7 +467,7 @@ void gpencil_brush_init_presets(ToolSettings *ts)
 | 
			
		||||
	brush->draw_random_sub = 0.0f;
 | 
			
		||||
 | 
			
		||||
	/* Ink Noise brush */
 | 
			
		||||
	brush = gpencil_brush_addnew(ts, "Ink noise", false);
 | 
			
		||||
	brush = BKE_gpencil_brush_addnew(ts, "Ink noise", false);
 | 
			
		||||
	brush->thickness = 6.0f;
 | 
			
		||||
	brush->flag |= GP_BRUSH_USE_RANDOM_PRESSURE;
 | 
			
		||||
	brush->draw_sensitivity = 1.611f;
 | 
			
		||||
@@ -491,7 +491,7 @@ void gpencil_brush_init_presets(ToolSettings *ts)
 | 
			
		||||
	brush->draw_random_sub = 0.0f;
 | 
			
		||||
 | 
			
		||||
	/* Marker brush */
 | 
			
		||||
	brush = gpencil_brush_addnew(ts, "Marker", false);
 | 
			
		||||
	brush = BKE_gpencil_brush_addnew(ts, "Marker", false);
 | 
			
		||||
	brush->thickness = 10.0f;
 | 
			
		||||
	brush->flag &= ~GP_BRUSH_USE_RANDOM_PRESSURE;
 | 
			
		||||
	brush->draw_sensitivity = 2.0f;
 | 
			
		||||
@@ -515,7 +515,7 @@ void gpencil_brush_init_presets(ToolSettings *ts)
 | 
			
		||||
	brush->draw_random_sub = 0.0f;
 | 
			
		||||
 | 
			
		||||
	/* Crayon brush */
 | 
			
		||||
	brush = gpencil_brush_addnew(ts, "Crayon", false);
 | 
			
		||||
	brush = BKE_gpencil_brush_addnew(ts, "Crayon", false);
 | 
			
		||||
	brush->thickness = 10.0f;
 | 
			
		||||
	brush->flag &= ~GP_BRUSH_USE_RANDOM_PRESSURE;
 | 
			
		||||
	brush->draw_sensitivity = 3.0f;
 | 
			
		||||
@@ -541,7 +541,7 @@ void gpencil_brush_init_presets(ToolSettings *ts)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* add a new gp-brush and make it the active */
 | 
			
		||||
bGPDbrush *gpencil_brush_addnew(ToolSettings *ts, const char *name, bool setactive)
 | 
			
		||||
bGPDbrush *BKE_gpencil_brush_addnew(ToolSettings *ts, const char *name, bool setactive)
 | 
			
		||||
{
 | 
			
		||||
	bGPDbrush *brush;
 | 
			
		||||
 | 
			
		||||
@@ -577,7 +577,7 @@ bGPDbrush *gpencil_brush_addnew(ToolSettings *ts, const char *name, bool setacti
 | 
			
		||||
 | 
			
		||||
	/* make this one the active one */
 | 
			
		||||
	if (setactive) {
 | 
			
		||||
		gpencil_brush_setactive(ts, brush);
 | 
			
		||||
		BKE_gpencil_brush_setactive(ts, brush);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* return brush */
 | 
			
		||||
@@ -585,7 +585,7 @@ bGPDbrush *gpencil_brush_addnew(ToolSettings *ts, const char *name, bool setacti
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* add a new gp-palettecolor and make it the active */
 | 
			
		||||
bGPDpalettecolor *gpencil_palettecolor_addnew(bGPDpalette *palette, const char *name, bool setactive)
 | 
			
		||||
bGPDpalettecolor *BKE_gpencil_palettecolor_addnew(bGPDpalette *palette, const char *name, bool setactive)
 | 
			
		||||
{
 | 
			
		||||
	bGPDpalettecolor *palcolor;
 | 
			
		||||
 | 
			
		||||
@@ -612,7 +612,7 @@ bGPDpalettecolor *gpencil_palettecolor_addnew(bGPDpalette *palette, const char *
 | 
			
		||||
 | 
			
		||||
	/* make this one the active one */
 | 
			
		||||
	if (setactive) {
 | 
			
		||||
		gpencil_palettecolor_setactive(palette, palcolor);
 | 
			
		||||
		BKE_gpencil_palettecolor_setactive(palette, palcolor);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* return palette color */
 | 
			
		||||
@@ -620,7 +620,7 @@ bGPDpalettecolor *gpencil_palettecolor_addnew(bGPDpalette *palette, const char *
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* add a new gp-datablock */
 | 
			
		||||
bGPdata *gpencil_data_addnew(const char name[])
 | 
			
		||||
bGPdata *BKE_gpencil_data_addnew(const char name[])
 | 
			
		||||
{
 | 
			
		||||
	bGPdata *gpd;
 | 
			
		||||
	
 | 
			
		||||
@@ -641,7 +641,7 @@ bGPdata *gpencil_data_addnew(const char name[])
 | 
			
		||||
/* -------- Data Duplication ---------- */
 | 
			
		||||
 | 
			
		||||
/* make a copy of a given gpencil frame */
 | 
			
		||||
bGPDframe *gpencil_frame_duplicate(const bGPDframe *gpf_src)
 | 
			
		||||
bGPDframe *BKE_gpencil_frame_duplicate(const bGPDframe *gpf_src)
 | 
			
		||||
{
 | 
			
		||||
	bGPDstroke *gps_dst;
 | 
			
		||||
	bGPDframe *gpf_dst;
 | 
			
		||||
@@ -671,7 +671,7 @@ bGPDframe *gpencil_frame_duplicate(const bGPDframe *gpf_src)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* make a copy of a given gpencil brush */
 | 
			
		||||
bGPDbrush *gpencil_brush_duplicate(const bGPDbrush *brush_src)
 | 
			
		||||
bGPDbrush *BKE_gpencil_brush_duplicate(const bGPDbrush *brush_src)
 | 
			
		||||
{
 | 
			
		||||
	bGPDbrush *brush_dst;
 | 
			
		||||
 | 
			
		||||
@@ -693,7 +693,7 @@ bGPDbrush *gpencil_brush_duplicate(const bGPDbrush *brush_src)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* make a copy of a given gpencil palette */
 | 
			
		||||
bGPDpalette *gpencil_palette_duplicate(const bGPDpalette *palette_src)
 | 
			
		||||
bGPDpalette *BKE_gpencil_palette_duplicate(const bGPDpalette *palette_src)
 | 
			
		||||
{
 | 
			
		||||
	bGPDpalette *palette_dst;
 | 
			
		||||
	const bGPDpalettecolor *palcolor_src;
 | 
			
		||||
@@ -720,7 +720,7 @@ bGPDpalette *gpencil_palette_duplicate(const bGPDpalette *palette_src)
 | 
			
		||||
	return palette_dst;
 | 
			
		||||
}
 | 
			
		||||
/* make a copy of a given gpencil layer */
 | 
			
		||||
bGPDlayer *gpencil_layer_duplicate(const bGPDlayer *gpl_src)
 | 
			
		||||
bGPDlayer *BKE_gpencil_layer_duplicate(const bGPDlayer *gpl_src)
 | 
			
		||||
{
 | 
			
		||||
	const bGPDframe *gpf_src;
 | 
			
		||||
	bGPDframe *gpf_dst;
 | 
			
		||||
@@ -739,7 +739,7 @@ bGPDlayer *gpencil_layer_duplicate(const bGPDlayer *gpl_src)
 | 
			
		||||
	BLI_listbase_clear(&gpl_dst->frames);
 | 
			
		||||
	for (gpf_src = gpl_src->frames.first; gpf_src; gpf_src = gpf_src->next) {
 | 
			
		||||
		/* make a copy of source frame */
 | 
			
		||||
		gpf_dst = gpencil_frame_duplicate(gpf_src);
 | 
			
		||||
		gpf_dst = BKE_gpencil_frame_duplicate(gpf_src);
 | 
			
		||||
		BLI_addtail(&gpl_dst->frames, gpf_dst);
 | 
			
		||||
		
 | 
			
		||||
		/* if source frame was the current layer's 'active' frame, reassign that too */
 | 
			
		||||
@@ -752,7 +752,7 @@ bGPDlayer *gpencil_layer_duplicate(const bGPDlayer *gpl_src)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* make a copy of a given gpencil datablock */
 | 
			
		||||
bGPdata *gpencil_data_duplicate(Main *bmain, bGPdata *gpd_src, bool internal_copy)
 | 
			
		||||
bGPdata *BKE_gpencil_data_duplicate(Main *bmain, bGPdata *gpd_src, bool internal_copy)
 | 
			
		||||
{
 | 
			
		||||
	const bGPDlayer *gpl_src;
 | 
			
		||||
	bGPDlayer *gpl_dst;
 | 
			
		||||
@@ -777,7 +777,7 @@ bGPdata *gpencil_data_duplicate(Main *bmain, bGPdata *gpd_src, bool internal_cop
 | 
			
		||||
	BLI_listbase_clear(&gpd_dst->layers);
 | 
			
		||||
	for (gpl_src = gpd_src->layers.first; gpl_src; gpl_src = gpl_src->next) {
 | 
			
		||||
		/* make a copy of source layer and its data */
 | 
			
		||||
		gpl_dst = gpencil_layer_duplicate(gpl_src);
 | 
			
		||||
		gpl_dst = BKE_gpencil_layer_duplicate(gpl_src);
 | 
			
		||||
		BLI_addtail(&gpd_dst->layers, gpl_dst);
 | 
			
		||||
	}
 | 
			
		||||
	if (!internal_copy) {
 | 
			
		||||
@@ -785,7 +785,7 @@ bGPdata *gpencil_data_duplicate(Main *bmain, bGPdata *gpd_src, bool internal_cop
 | 
			
		||||
		bGPDpalette *palette_src, *palette_dst;
 | 
			
		||||
		BLI_listbase_clear(&gpd_dst->palettes);
 | 
			
		||||
		for (palette_src = gpd_src->palettes.first; palette_src; palette_src = palette_src->next) {
 | 
			
		||||
			palette_dst = gpencil_palette_duplicate(palette_src);
 | 
			
		||||
			palette_dst = BKE_gpencil_palette_duplicate(palette_src);
 | 
			
		||||
			BLI_addtail(&gpd_dst->palettes, palette_dst);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
@@ -802,7 +802,7 @@ void BKE_gpencil_make_local(Main *bmain, bGPdata *gpd, const bool lib_local)
 | 
			
		||||
/* -------- GP-Stroke API --------- */
 | 
			
		||||
 | 
			
		||||
/* ensure selection status of stroke is in sync with its points */
 | 
			
		||||
void gpencil_stroke_sync_selection(bGPDstroke *gps)
 | 
			
		||||
void BKE_gpencil_stroke_sync_selection(bGPDstroke *gps)
 | 
			
		||||
{
 | 
			
		||||
	bGPDspoint *pt;
 | 
			
		||||
	int i;
 | 
			
		||||
@@ -827,7 +827,7 @@ void gpencil_stroke_sync_selection(bGPDstroke *gps)
 | 
			
		||||
/* -------- GP-Frame API ---------- */
 | 
			
		||||
 | 
			
		||||
/* delete the last stroke of the given frame */
 | 
			
		||||
void gpencil_frame_delete_laststroke(bGPDlayer *gpl, bGPDframe *gpf)
 | 
			
		||||
void BKE_gpencil_frame_delete_laststroke(bGPDlayer *gpl, bGPDframe *gpf)
 | 
			
		||||
{
 | 
			
		||||
	bGPDstroke *gps = (gpf) ? gpf->strokes.last : NULL;
 | 
			
		||||
	int cfra = (gpf) ? gpf->framenum : 0; /* assume that the current frame was not locked */
 | 
			
		||||
@@ -843,8 +843,8 @@ void gpencil_frame_delete_laststroke(bGPDlayer *gpl, bGPDframe *gpf)
 | 
			
		||||
	
 | 
			
		||||
	/* if frame has no strokes after this, delete it */
 | 
			
		||||
	if (BLI_listbase_is_empty(&gpf->strokes)) {
 | 
			
		||||
		gpencil_layer_delframe(gpl, gpf);
 | 
			
		||||
		gpencil_layer_getframe(gpl, cfra, 0);
 | 
			
		||||
		BKE_gpencil_layer_delframe(gpl, gpf);
 | 
			
		||||
		BKE_gpencil_layer_getframe(gpl, cfra, 0);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -892,7 +892,7 @@ bGPDframe *BKE_gpencil_layer_find_frame(bGPDlayer *gpl, int cframe)
 | 
			
		||||
 *	- this sets the layer's actframe var (if allowed to)
 | 
			
		||||
 *	- extension beyond range (if first gp-frame is after all frame in interest and cannot add)
 | 
			
		||||
 */
 | 
			
		||||
bGPDframe *gpencil_layer_getframe(bGPDlayer *gpl, int cframe, eGP_GetFrame_Mode addnew)
 | 
			
		||||
bGPDframe *BKE_gpencil_layer_getframe(bGPDlayer *gpl, int cframe, eGP_GetFrame_Mode addnew)
 | 
			
		||||
{
 | 
			
		||||
	bGPDframe *gpf = NULL;
 | 
			
		||||
	short found = 0;
 | 
			
		||||
@@ -931,9 +931,9 @@ bGPDframe *gpencil_layer_getframe(bGPDlayer *gpl, int cframe, eGP_GetFrame_Mode
 | 
			
		||||
				if ((found) && (gpf->framenum == cframe))
 | 
			
		||||
					gpl->actframe = gpf;
 | 
			
		||||
				else if (addnew == GP_GETFRAME_ADD_COPY)
 | 
			
		||||
					gpl->actframe = gpencil_frame_addcopy(gpl, cframe);
 | 
			
		||||
					gpl->actframe = BKE_gpencil_frame_addcopy(gpl, cframe);
 | 
			
		||||
				else
 | 
			
		||||
					gpl->actframe = gpencil_frame_addnew(gpl, cframe);
 | 
			
		||||
					gpl->actframe = BKE_gpencil_frame_addnew(gpl, cframe);
 | 
			
		||||
			}
 | 
			
		||||
			else if (found)
 | 
			
		||||
				gpl->actframe = gpf;
 | 
			
		||||
@@ -953,9 +953,9 @@ bGPDframe *gpencil_layer_getframe(bGPDlayer *gpl, int cframe, eGP_GetFrame_Mode
 | 
			
		||||
				if ((found) && (gpf->framenum == cframe))
 | 
			
		||||
					gpl->actframe = gpf;
 | 
			
		||||
				else if (addnew == GP_GETFRAME_ADD_COPY)
 | 
			
		||||
					gpl->actframe = gpencil_frame_addcopy(gpl, cframe);
 | 
			
		||||
					gpl->actframe = BKE_gpencil_frame_addcopy(gpl, cframe);
 | 
			
		||||
				else
 | 
			
		||||
					gpl->actframe = gpencil_frame_addnew(gpl, cframe);
 | 
			
		||||
					gpl->actframe = BKE_gpencil_frame_addnew(gpl, cframe);
 | 
			
		||||
			}
 | 
			
		||||
			else if (found)
 | 
			
		||||
				gpl->actframe = gpf;
 | 
			
		||||
@@ -992,7 +992,7 @@ bGPDframe *gpencil_layer_getframe(bGPDlayer *gpl, int cframe, eGP_GetFrame_Mode
 | 
			
		||||
			if ((found) && (gpf->framenum == cframe))
 | 
			
		||||
				gpl->actframe = gpf;
 | 
			
		||||
			else
 | 
			
		||||
				gpl->actframe = gpencil_frame_addnew(gpl, cframe);
 | 
			
		||||
				gpl->actframe = BKE_gpencil_frame_addnew(gpl, cframe);
 | 
			
		||||
		}
 | 
			
		||||
		else if (found)
 | 
			
		||||
			gpl->actframe = gpf;
 | 
			
		||||
@@ -1005,7 +1005,7 @@ bGPDframe *gpencil_layer_getframe(bGPDlayer *gpl, int cframe, eGP_GetFrame_Mode
 | 
			
		||||
	else {
 | 
			
		||||
		/* currently no frames (add if allowed to) */
 | 
			
		||||
		if (addnew)
 | 
			
		||||
			gpl->actframe = gpencil_frame_addnew(gpl, cframe);
 | 
			
		||||
			gpl->actframe = BKE_gpencil_frame_addnew(gpl, cframe);
 | 
			
		||||
		else {
 | 
			
		||||
			/* don't do anything... this may be when no frames yet! */
 | 
			
		||||
			/* gpl->actframe should still be NULL */
 | 
			
		||||
@@ -1017,7 +1017,7 @@ bGPDframe *gpencil_layer_getframe(bGPDlayer *gpl, int cframe, eGP_GetFrame_Mode
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* delete the given frame from a layer */
 | 
			
		||||
bool gpencil_layer_delframe(bGPDlayer *gpl, bGPDframe *gpf)
 | 
			
		||||
bool BKE_gpencil_layer_delframe(bGPDlayer *gpl, bGPDframe *gpf)
 | 
			
		||||
{
 | 
			
		||||
	bool changed = false;
 | 
			
		||||
	
 | 
			
		||||
@@ -1034,14 +1034,14 @@ bool gpencil_layer_delframe(bGPDlayer *gpl, bGPDframe *gpf)
 | 
			
		||||
		gpl->actframe = NULL;
 | 
			
		||||
	
 | 
			
		||||
	/* free the frame and its data */
 | 
			
		||||
	changed = free_gpencil_strokes(gpf);
 | 
			
		||||
	changed = BKE_gpencil_free_strokes(gpf);
 | 
			
		||||
	BLI_freelinkN(&gpl->frames, gpf);
 | 
			
		||||
	
 | 
			
		||||
	return changed;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* get the active gp-layer for editing */
 | 
			
		||||
bGPDlayer *gpencil_layer_getactive(bGPdata *gpd)
 | 
			
		||||
bGPDlayer *BKE_gpencil_layer_getactive(bGPdata *gpd)
 | 
			
		||||
{
 | 
			
		||||
	bGPDlayer *gpl;
 | 
			
		||||
	
 | 
			
		||||
@@ -1060,7 +1060,7 @@ bGPDlayer *gpencil_layer_getactive(bGPdata *gpd)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* set the active gp-layer */
 | 
			
		||||
void gpencil_layer_setactive(bGPdata *gpd, bGPDlayer *active)
 | 
			
		||||
void BKE_gpencil_layer_setactive(bGPdata *gpd, bGPDlayer *active)
 | 
			
		||||
{
 | 
			
		||||
	bGPDlayer *gpl;
 | 
			
		||||
	
 | 
			
		||||
@@ -1077,20 +1077,20 @@ void gpencil_layer_setactive(bGPdata *gpd, bGPDlayer *active)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* delete the active gp-layer */
 | 
			
		||||
void gpencil_layer_delete(bGPdata *gpd, bGPDlayer *gpl)
 | 
			
		||||
void BKE_gpencil_layer_delete(bGPdata *gpd, bGPDlayer *gpl)
 | 
			
		||||
{
 | 
			
		||||
	/* error checking */
 | 
			
		||||
	if (ELEM(NULL, gpd, gpl)) 
 | 
			
		||||
		return;
 | 
			
		||||
	
 | 
			
		||||
	/* free layer */
 | 
			
		||||
	free_gpencil_frames(gpl);
 | 
			
		||||
	BKE_gpencil_free_frames(gpl);
 | 
			
		||||
	BLI_freelinkN(&gpd->layers, gpl);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* ************************************************** */
 | 
			
		||||
/* get the active gp-brush for editing */
 | 
			
		||||
bGPDbrush *gpencil_brush_getactive(ToolSettings *ts)
 | 
			
		||||
bGPDbrush *BKE_gpencil_brush_getactive(ToolSettings *ts)
 | 
			
		||||
{
 | 
			
		||||
	bGPDbrush *brush;
 | 
			
		||||
 | 
			
		||||
@@ -1111,7 +1111,7 @@ bGPDbrush *gpencil_brush_getactive(ToolSettings *ts)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* set the active gp-brush */
 | 
			
		||||
void gpencil_brush_setactive(ToolSettings *ts, bGPDbrush *active)
 | 
			
		||||
void BKE_gpencil_brush_setactive(ToolSettings *ts, bGPDbrush *active)
 | 
			
		||||
{
 | 
			
		||||
	bGPDbrush *brush;
 | 
			
		||||
 | 
			
		||||
@@ -1130,7 +1130,7 @@ void gpencil_brush_setactive(ToolSettings *ts, bGPDbrush *active)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* delete the active gp-brush */
 | 
			
		||||
void gpencil_brush_delete(ToolSettings *ts, bGPDbrush *brush)
 | 
			
		||||
void BKE_gpencil_brush_delete(ToolSettings *ts, bGPDbrush *brush)
 | 
			
		||||
{
 | 
			
		||||
	/* error checking */
 | 
			
		||||
	if (ELEM(NULL, ts, brush)) {
 | 
			
		||||
@@ -1154,7 +1154,7 @@ void gpencil_brush_delete(ToolSettings *ts, bGPDbrush *brush)
 | 
			
		||||
 | 
			
		||||
/* ************************************************** */
 | 
			
		||||
/* get the active gp-palette for editing */
 | 
			
		||||
bGPDpalette *gpencil_palette_getactive(bGPdata *gpd)
 | 
			
		||||
bGPDpalette *BKE_gpencil_palette_getactive(bGPdata *gpd)
 | 
			
		||||
{
 | 
			
		||||
	bGPDpalette *palette;
 | 
			
		||||
 | 
			
		||||
@@ -1174,7 +1174,7 @@ bGPDpalette *gpencil_palette_getactive(bGPdata *gpd)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* set the active gp-palette */
 | 
			
		||||
void gpencil_palette_setactive(bGPdata *gpd, bGPDpalette *active)
 | 
			
		||||
void BKE_gpencil_palette_setactive(bGPdata *gpd, bGPDpalette *active)
 | 
			
		||||
{
 | 
			
		||||
	bGPDpalette *palette;
 | 
			
		||||
 | 
			
		||||
@@ -1191,11 +1191,11 @@ void gpencil_palette_setactive(bGPdata *gpd, bGPDpalette *active)
 | 
			
		||||
	/* set as active one */
 | 
			
		||||
	active->flag |= PL_PALETTE_ACTIVE;
 | 
			
		||||
	/* force color recalc */
 | 
			
		||||
	gpencil_palette_change_strokes(gpd);
 | 
			
		||||
	BKE_gpencil_palette_change_strokes(gpd);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* delete the active gp-palette */
 | 
			
		||||
void gpencil_palette_delete(bGPdata *gpd, bGPDpalette *palette)
 | 
			
		||||
void BKE_gpencil_palette_delete(bGPdata *gpd, bGPDpalette *palette)
 | 
			
		||||
{
 | 
			
		||||
	/* error checking */
 | 
			
		||||
	if (ELEM(NULL, gpd, palette)) {
 | 
			
		||||
@@ -1206,11 +1206,11 @@ void gpencil_palette_delete(bGPdata *gpd, bGPDpalette *palette)
 | 
			
		||||
	free_gpencil_colors(palette);
 | 
			
		||||
	BLI_freelinkN(&gpd->palettes, palette);
 | 
			
		||||
	/* force color recalc */
 | 
			
		||||
	gpencil_palette_change_strokes(gpd);
 | 
			
		||||
	BKE_gpencil_palette_change_strokes(gpd);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Set all strokes to recalc the palette color */
 | 
			
		||||
void gpencil_palette_change_strokes(bGPdata *gpd)
 | 
			
		||||
void BKE_gpencil_palette_change_strokes(bGPdata *gpd)
 | 
			
		||||
{
 | 
			
		||||
	bGPDlayer *gpl;
 | 
			
		||||
	bGPDframe *gpf;
 | 
			
		||||
@@ -1227,7 +1227,7 @@ void gpencil_palette_change_strokes(bGPdata *gpd)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* get the active gp-palettecolor for editing */
 | 
			
		||||
bGPDpalettecolor *gpencil_palettecolor_getactive(bGPDpalette *palette)
 | 
			
		||||
bGPDpalettecolor *BKE_gpencil_palettecolor_getactive(bGPDpalette *palette)
 | 
			
		||||
{
 | 
			
		||||
	bGPDpalettecolor *palcolor;
 | 
			
		||||
 | 
			
		||||
@@ -1247,7 +1247,7 @@ bGPDpalettecolor *gpencil_palettecolor_getactive(bGPDpalette *palette)
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
/* get the gp-palettecolor looking for name */
 | 
			
		||||
bGPDpalettecolor *gpencil_palettecolor_getbyname(bGPDpalette *palette, char *name)
 | 
			
		||||
bGPDpalettecolor *BKE_gpencil_palettecolor_getbyname(bGPDpalette *palette, char *name)
 | 
			
		||||
{
 | 
			
		||||
	/* error checking */
 | 
			
		||||
	if (ELEM(NULL, palette, name)) {
 | 
			
		||||
@@ -1258,7 +1258,7 @@ bGPDpalettecolor *gpencil_palettecolor_getbyname(bGPDpalette *palette, char *nam
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Change color name in all strokes */
 | 
			
		||||
void gpencil_palettecolor_changename(bGPdata *gpd, char *oldname, const char *newname)
 | 
			
		||||
void BKE_gpencil_palettecolor_changename(bGPdata *gpd, char *oldname, const char *newname)
 | 
			
		||||
{
 | 
			
		||||
	bGPDlayer *gpl;
 | 
			
		||||
	bGPDframe *gpf;
 | 
			
		||||
@@ -1277,7 +1277,7 @@ void gpencil_palettecolor_changename(bGPdata *gpd, char *oldname, const char *ne
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Delete all strokes of the color */
 | 
			
		||||
void gpencil_palettecolor_delete_strokes(struct bGPdata *gpd, char *name)
 | 
			
		||||
void BKE_gpencil_palettecolor_delete_strokes(struct bGPdata *gpd, char *name)
 | 
			
		||||
{
 | 
			
		||||
	bGPDlayer *gpl;
 | 
			
		||||
	bGPDframe *gpf;
 | 
			
		||||
@@ -1300,7 +1300,7 @@ void gpencil_palettecolor_delete_strokes(struct bGPdata *gpd, char *name)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* set the active gp-palettecolor */
 | 
			
		||||
void gpencil_palettecolor_setactive(bGPDpalette *palette, bGPDpalettecolor *active)
 | 
			
		||||
void BKE_gpencil_palettecolor_setactive(bGPDpalette *palette, bGPDpalettecolor *active)
 | 
			
		||||
{
 | 
			
		||||
	bGPDpalettecolor *palcolor;
 | 
			
		||||
 | 
			
		||||
@@ -1319,7 +1319,7 @@ void gpencil_palettecolor_setactive(bGPDpalette *palette, bGPDpalettecolor *acti
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* delete the active gp-palettecolor */
 | 
			
		||||
void gpencil_palettecolor_delete(bGPDpalette *palette, bGPDpalettecolor *palcolor)
 | 
			
		||||
void BKE_gpencil_palettecolor_delete(bGPDpalette *palette, bGPDpalettecolor *palcolor)
 | 
			
		||||
{
 | 
			
		||||
	/* error checking */
 | 
			
		||||
	if (ELEM(NULL, palette, palcolor)) {
 | 
			
		||||
 
 | 
			
		||||
@@ -510,7 +510,7 @@ bool id_copy(Main *bmain, ID *id, ID **newid, bool test)
 | 
			
		||||
			if (!test) *newid = (ID *)BKE_particlesettings_copy(bmain, (ParticleSettings *)id);
 | 
			
		||||
			return true;
 | 
			
		||||
		case ID_GD:
 | 
			
		||||
			if (!test) *newid = (ID *)gpencil_data_duplicate(bmain, (bGPdata *)id, false);
 | 
			
		||||
			if (!test) *newid = (ID *)BKE_gpencil_data_duplicate(bmain, (bGPdata *)id, false);
 | 
			
		||||
			return true;
 | 
			
		||||
		case ID_MC:
 | 
			
		||||
			if (!test) *newid = (ID *)BKE_movieclip_copy(bmain, (MovieClip *)id);
 | 
			
		||||
 
 | 
			
		||||
@@ -290,7 +290,7 @@ Scene *BKE_scene_copy(Main *bmain, Scene *sce, int type)
 | 
			
		||||
		/* duplicate Grease Pencil Drawing Brushes */
 | 
			
		||||
		BLI_listbase_clear(&ts->gp_brushes);
 | 
			
		||||
		for (bGPDbrush *brush = sce->toolsettings->gp_brushes.first; brush; brush = brush->next) {
 | 
			
		||||
			bGPDbrush *newbrush = gpencil_brush_duplicate(brush);
 | 
			
		||||
			bGPDbrush *newbrush = BKE_gpencil_brush_duplicate(brush);
 | 
			
		||||
			BLI_addtail(&ts->gp_brushes, newbrush);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@@ -342,7 +342,7 @@ Scene *BKE_scene_copy(Main *bmain, Scene *sce, int type)
 | 
			
		||||
	/* grease pencil */
 | 
			
		||||
	if (scen->gpd) {
 | 
			
		||||
		if (type == SCE_COPY_FULL) {
 | 
			
		||||
			scen->gpd = gpencil_data_duplicate(bmain, scen->gpd, false);
 | 
			
		||||
			scen->gpd = BKE_gpencil_data_duplicate(bmain, scen->gpd, false);
 | 
			
		||||
		}
 | 
			
		||||
		else if (type == SCE_COPY_EMPTY) {
 | 
			
		||||
			scen->gpd = NULL;
 | 
			
		||||
@@ -441,7 +441,7 @@ void BKE_scene_free(Scene *sce)
 | 
			
		||||
			MEM_freeN(sce->toolsettings->uvsculpt);
 | 
			
		||||
		}
 | 
			
		||||
		/* free Grease Pencil Drawing Brushes */
 | 
			
		||||
		free_gpencil_brushes(&sce->toolsettings->gp_brushes);
 | 
			
		||||
		BKE_gpencil_free_brushes(&sce->toolsettings->gp_brushes);
 | 
			
		||||
		BLI_freelistN(&sce->toolsettings->gp_brushes);
 | 
			
		||||
 | 
			
		||||
		BKE_paint_free(&sce->toolsettings->imapaint.paint);
 | 
			
		||||
 
 | 
			
		||||
@@ -1270,7 +1270,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
 | 
			
		||||
				for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
 | 
			
		||||
					ToolSettings *ts = scene->toolsettings;
 | 
			
		||||
					if (BLI_listbase_is_empty(&ts->gp_brushes)) {
 | 
			
		||||
						gpencil_brush_init_presets(ts);
 | 
			
		||||
						BKE_gpencil_brush_init_presets(ts);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
@@ -1280,10 +1280,10 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
 | 
			
		||||
			for (bGPdata *gpd = main->gpencil.first; gpd; gpd = gpd->id.next) {
 | 
			
		||||
				if (BLI_listbase_is_empty(&gpd->palettes)) {
 | 
			
		||||
					/* create palette */
 | 
			
		||||
					bGPDpalette *palette = gpencil_palette_addnew(gpd, "GP_Palette", true);
 | 
			
		||||
					bGPDpalette *palette = BKE_gpencil_palette_addnew(gpd, "GP_Palette", true);
 | 
			
		||||
					for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
 | 
			
		||||
						/* create color using layer name */
 | 
			
		||||
						bGPDpalettecolor *palcolor = gpencil_palettecolor_addnew(palette, gpl->info, true);
 | 
			
		||||
						bGPDpalettecolor *palcolor = BKE_gpencil_palettecolor_addnew(palette, gpl->info, true);
 | 
			
		||||
						if (palcolor != NULL) {
 | 
			
		||||
							/* set color attributes */
 | 
			
		||||
							copy_v4_v4(palcolor->color, gpl->color);
 | 
			
		||||
@@ -1314,7 +1314,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
 | 
			
		||||
					}
 | 
			
		||||
					/* set first color as active */
 | 
			
		||||
					if (palette->colors.first)
 | 
			
		||||
						gpencil_palettecolor_setactive(palette, palette->colors.first);
 | 
			
		||||
						BKE_gpencil_palettecolor_setactive(palette, palette->colors.first);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
@@ -1686,7 +1686,7 @@ static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op))
 | 
			
		||||
				bGPDlayer *gpl = (bGPDlayer *)ale->data;
 | 
			
		||||
				
 | 
			
		||||
				/* try to delete the layer's data and the layer itself */
 | 
			
		||||
				free_gpencil_frames(gpl);
 | 
			
		||||
				BKE_gpencil_free_frames(gpl);
 | 
			
		||||
				BLI_freelinkN(&gpd->layers, gpl);
 | 
			
		||||
				break;
 | 
			
		||||
			}
 | 
			
		||||
 
 | 
			
		||||
@@ -1359,7 +1359,7 @@ static void gp_draw_data_layers(
 | 
			
		||||
			continue;
 | 
			
		||||
		
 | 
			
		||||
		/* get frame to draw */
 | 
			
		||||
		gpf = gpencil_layer_getframe(gpl, cfra, 0);
 | 
			
		||||
		gpf = BKE_gpencil_layer_getframe(gpl, cfra, 0);
 | 
			
		||||
		if (gpf == NULL)
 | 
			
		||||
			continue;
 | 
			
		||||
		
 | 
			
		||||
@@ -1533,7 +1533,7 @@ static void gp_draw_data_all(Scene *scene, bGPdata *gpd, int offsx, int offsy, i
 | 
			
		||||
		
 | 
			
		||||
		if (gpd_source) {
 | 
			
		||||
			ToolSettings *ts = scene->toolsettings;
 | 
			
		||||
			bGPDbrush *brush = gpencil_brush_getactive(ts);
 | 
			
		||||
			bGPDbrush *brush = BKE_gpencil_brush_getactive(ts);
 | 
			
		||||
			if (brush != NULL) {
 | 
			
		||||
				gp_draw_data(brush, ts->gp_sculpt.alpha, gpd_source,
 | 
			
		||||
				             offsx, offsy, winx, winy, cfra, dflag);
 | 
			
		||||
@@ -1546,7 +1546,7 @@ static void gp_draw_data_all(Scene *scene, bGPdata *gpd, int offsx, int offsy, i
 | 
			
		||||
	 * if gpd_source == gpd, we don't have any object/track data and we can skip */
 | 
			
		||||
	if (gpd_source == NULL || (gpd_source && gpd_source != gpd)) {
 | 
			
		||||
		ToolSettings *ts = scene->toolsettings;
 | 
			
		||||
		bGPDbrush *brush = gpencil_brush_getactive(ts);
 | 
			
		||||
		bGPDbrush *brush = BKE_gpencil_brush_getactive(ts);
 | 
			
		||||
		if (brush != NULL) {
 | 
			
		||||
			gp_draw_data(brush, ts->gp_sculpt.alpha, gpd,
 | 
			
		||||
			             offsx, offsy, winx, winy, cfra, dflag);
 | 
			
		||||
 
 | 
			
		||||
@@ -253,7 +253,7 @@ bool ED_gplayer_frames_delete(bGPDlayer *gpl)
 | 
			
		||||
		gpfn = gpf->next;
 | 
			
		||||
		
 | 
			
		||||
		if (gpf->flag & GP_FRAME_SELECT)
 | 
			
		||||
			changed |= gpencil_layer_delframe(gpl, gpf);
 | 
			
		||||
			changed |= BKE_gpencil_layer_delframe(gpl, gpf);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	return changed;
 | 
			
		||||
@@ -277,7 +277,7 @@ void ED_gplayer_frames_duplicate(bGPDlayer *gpl)
 | 
			
		||||
			bGPDframe *gpfd;
 | 
			
		||||
			
 | 
			
		||||
			/* duplicate frame, and deselect self */
 | 
			
		||||
			gpfd = gpencil_frame_duplicate(gpf);
 | 
			
		||||
			gpfd = BKE_gpencil_frame_duplicate(gpf);
 | 
			
		||||
			gpf->flag &= ~GP_FRAME_SELECT;
 | 
			
		||||
			
 | 
			
		||||
			BLI_insertlinkafter(&gpl->frames, gpf, gpfd);
 | 
			
		||||
@@ -323,7 +323,7 @@ static int gp_anim_copy_cfra       =  0;
 | 
			
		||||
/* This function frees any MEM_calloc'ed copy/paste buffer data */
 | 
			
		||||
void ED_gpencil_anim_copybuf_free(void)
 | 
			
		||||
{
 | 
			
		||||
	free_gpencil_layers(&gp_anim_copybuf);
 | 
			
		||||
	BKE_gpencil_free_layers(&gp_anim_copybuf);
 | 
			
		||||
	BLI_listbase_clear(&gp_anim_copybuf);
 | 
			
		||||
	
 | 
			
		||||
	gp_anim_copy_firstframe =  999999999;
 | 
			
		||||
@@ -364,7 +364,7 @@ bool ED_gpencil_anim_copybuf_copy(bAnimContext *ac)
 | 
			
		||||
			/* if frame is selected, make duplicate it and its strokes */
 | 
			
		||||
			if (gpf->flag & GP_FRAME_SELECT) {
 | 
			
		||||
				/* make a copy of this frame */
 | 
			
		||||
				bGPDframe *new_frame = gpencil_frame_duplicate(gpf);
 | 
			
		||||
				bGPDframe *new_frame = BKE_gpencil_frame_duplicate(gpf);
 | 
			
		||||
				BLI_addtail(&copied_frames, new_frame);
 | 
			
		||||
				
 | 
			
		||||
				/* extend extents for keyframes encountered */
 | 
			
		||||
@@ -475,7 +475,7 @@ bool ED_gpencil_anim_copybuf_paste(bAnimContext *ac, const short offset_mode)
 | 
			
		||||
			gpfs->framenum += offset;
 | 
			
		||||
			
 | 
			
		||||
			/* get frame to copy data into (if no frame returned, then just ignore) */
 | 
			
		||||
			gpf = gpencil_layer_getframe(gpld, gpfs->framenum, 1);
 | 
			
		||||
			gpf = BKE_gpencil_layer_getframe(gpld, gpfs->framenum, 1);
 | 
			
		||||
			if (gpf) {
 | 
			
		||||
				bGPDstroke *gps, *gpsn;
 | 
			
		||||
				
 | 
			
		||||
@@ -498,7 +498,7 @@ bool ED_gpencil_anim_copybuf_paste(bAnimContext *ac, const short offset_mode)
 | 
			
		||||
				
 | 
			
		||||
				/* if no strokes (i.e. new frame) added, free gpf */
 | 
			
		||||
				if (BLI_listbase_is_empty(&gpf->strokes))
 | 
			
		||||
					gpencil_layer_delframe(gpld, gpf);
 | 
			
		||||
					BKE_gpencil_layer_delframe(gpld, gpf);
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			/* unapply offset from buffer-frame */
 | 
			
		||||
 
 | 
			
		||||
@@ -841,7 +841,7 @@ static void gp_brush_clone_add(bContext *C, tGP_BrushEditData *gso)
 | 
			
		||||
	
 | 
			
		||||
	Scene *scene = gso->scene;
 | 
			
		||||
	bGPDlayer *gpl = CTX_data_active_gpencil_layer(C);
 | 
			
		||||
	bGPDframe *gpf = gpencil_layer_getframe(gpl, CFRA, true);
 | 
			
		||||
	bGPDframe *gpf = BKE_gpencil_layer_getframe(gpl, CFRA, true);
 | 
			
		||||
	bGPDstroke *gps;
 | 
			
		||||
	
 | 
			
		||||
	float delta[3];
 | 
			
		||||
@@ -1185,7 +1185,7 @@ static void gpsculpt_brush_init_stroke(tGP_BrushEditData *gso)
 | 
			
		||||
			 */
 | 
			
		||||
			// XXX: should this be allowed when framelock is enabled?
 | 
			
		||||
			if (gpf->framenum != cfra) {
 | 
			
		||||
				gpencil_frame_addcopy(gpl, cfra);
 | 
			
		||||
				BKE_gpencil_frame_addcopy(gpl, cfra);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -1123,7 +1123,7 @@ static void gp_layer_to_curve(bContext *C, ReportList *reports, bGPdata *gpd, bG
 | 
			
		||||
	struct Main *bmain = CTX_data_main(C);
 | 
			
		||||
	View3D *v3d = CTX_wm_view3d(C);  /* may be NULL */
 | 
			
		||||
	Scene *scene = CTX_data_scene(C);
 | 
			
		||||
	bGPDframe *gpf = gpencil_layer_getframe(gpl, CFRA, 0);
 | 
			
		||||
	bGPDframe *gpf = BKE_gpencil_layer_getframe(gpl, CFRA, 0);
 | 
			
		||||
	bGPDstroke *gps, *prev_gps = NULL;
 | 
			
		||||
	Object *ob;
 | 
			
		||||
	Curve *cu;
 | 
			
		||||
@@ -1235,7 +1235,7 @@ static bool gp_convert_check_has_valid_timing(bContext *C, bGPDlayer *gpl, wmOpe
 | 
			
		||||
	int i;
 | 
			
		||||
	bool valid = true;
 | 
			
		||||
	
 | 
			
		||||
	if (!gpl || !(gpf = gpencil_layer_getframe(gpl, CFRA, 0)) || !(gps = gpf->strokes.first))
 | 
			
		||||
	if (!gpl || !(gpf = BKE_gpencil_layer_getframe(gpl, CFRA, 0)) || !(gps = gpf->strokes.first))
 | 
			
		||||
		return false;
 | 
			
		||||
	
 | 
			
		||||
	do {
 | 
			
		||||
@@ -1292,8 +1292,8 @@ static int gp_convert_poll(bContext *C)
 | 
			
		||||
	 * and if we are not in edit mode!
 | 
			
		||||
	 */
 | 
			
		||||
	return ((sa && sa->spacetype == SPACE_VIEW3D) &&
 | 
			
		||||
	        (gpl = gpencil_layer_getactive(gpd)) &&
 | 
			
		||||
	        (gpf = gpencil_layer_getframe(gpl, CFRA, 0)) &&
 | 
			
		||||
	        (gpl = BKE_gpencil_layer_getactive(gpd)) &&
 | 
			
		||||
	        (gpf = BKE_gpencil_layer_getframe(gpl, CFRA, 0)) &&
 | 
			
		||||
	        (gpf->strokes.first) &&
 | 
			
		||||
	        (scene->obedit == NULL));
 | 
			
		||||
}
 | 
			
		||||
@@ -1302,7 +1302,7 @@ static int gp_convert_layer_exec(bContext *C, wmOperator *op)
 | 
			
		||||
{
 | 
			
		||||
	PropertyRNA *prop = RNA_struct_find_property(op->ptr, "use_timing_data");
 | 
			
		||||
	bGPdata *gpd = ED_gpencil_data_get_active(C);
 | 
			
		||||
	bGPDlayer *gpl = gpencil_layer_getactive(gpd);
 | 
			
		||||
	bGPDlayer *gpl = BKE_gpencil_layer_getactive(gpd);
 | 
			
		||||
	Scene *scene = CTX_data_scene(C);
 | 
			
		||||
	const int mode = RNA_enum_get(op->ptr, "type");
 | 
			
		||||
	const bool norm_weights = RNA_boolean_get(op->ptr, "use_normalize_weights");
 | 
			
		||||
 
 | 
			
		||||
@@ -97,7 +97,7 @@ static int gp_data_add_exec(bContext *C, wmOperator *op)
 | 
			
		||||
		bGPdata *gpd = (*gpd_ptr);
 | 
			
		||||
		
 | 
			
		||||
		id_us_min(&gpd->id);
 | 
			
		||||
		*gpd_ptr = gpencil_data_addnew(DATA_("GPencil"));
 | 
			
		||||
		*gpd_ptr = BKE_gpencil_data_addnew(DATA_("GPencil"));
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	/* notifiers */
 | 
			
		||||
@@ -184,10 +184,10 @@ static int gp_layer_add_exec(bContext *C, wmOperator *op)
 | 
			
		||||
		return OPERATOR_CANCELLED;
 | 
			
		||||
	}
 | 
			
		||||
	if (*gpd_ptr == NULL)
 | 
			
		||||
		*gpd_ptr = gpencil_data_addnew(DATA_("GPencil"));
 | 
			
		||||
		*gpd_ptr = BKE_gpencil_data_addnew(DATA_("GPencil"));
 | 
			
		||||
	
 | 
			
		||||
	/* add new layer now */
 | 
			
		||||
	gpencil_layer_addnew(*gpd_ptr, DATA_("GP_Layer"), true);
 | 
			
		||||
	BKE_gpencil_layer_addnew(*gpd_ptr, DATA_("GP_Layer"), true);
 | 
			
		||||
	
 | 
			
		||||
	/* notifiers */
 | 
			
		||||
	WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
 | 
			
		||||
@@ -214,7 +214,7 @@ void GPENCIL_OT_layer_add(wmOperatorType *ot)
 | 
			
		||||
static int gp_layer_remove_exec(bContext *C, wmOperator *op)
 | 
			
		||||
{
 | 
			
		||||
	bGPdata *gpd = ED_gpencil_data_get_active(C);
 | 
			
		||||
	bGPDlayer *gpl = gpencil_layer_getactive(gpd);
 | 
			
		||||
	bGPDlayer *gpl = BKE_gpencil_layer_getactive(gpd);
 | 
			
		||||
	
 | 
			
		||||
	/* sanity checks */
 | 
			
		||||
	if (ELEM(NULL, gpd, gpl))
 | 
			
		||||
@@ -230,12 +230,12 @@ static int gp_layer_remove_exec(bContext *C, wmOperator *op)
 | 
			
		||||
	 * - if this is the only layer, this naturally becomes NULL
 | 
			
		||||
	 */
 | 
			
		||||
	if (gpl->prev)
 | 
			
		||||
		gpencil_layer_setactive(gpd, gpl->prev);
 | 
			
		||||
		BKE_gpencil_layer_setactive(gpd, gpl->prev);
 | 
			
		||||
	else
 | 
			
		||||
		gpencil_layer_setactive(gpd, gpl->next);
 | 
			
		||||
		BKE_gpencil_layer_setactive(gpd, gpl->next);
 | 
			
		||||
	
 | 
			
		||||
	/* delete the layer now... */
 | 
			
		||||
	gpencil_layer_delete(gpd, gpl);
 | 
			
		||||
	BKE_gpencil_layer_delete(gpd, gpl);
 | 
			
		||||
	
 | 
			
		||||
	/* notifiers */
 | 
			
		||||
	WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
 | 
			
		||||
@@ -267,7 +267,7 @@ enum {
 | 
			
		||||
static int gp_layer_move_exec(bContext *C, wmOperator *op)
 | 
			
		||||
{
 | 
			
		||||
	bGPdata *gpd = ED_gpencil_data_get_active(C);
 | 
			
		||||
	bGPDlayer *gpl = gpencil_layer_getactive(gpd);
 | 
			
		||||
	bGPDlayer *gpl = BKE_gpencil_layer_getactive(gpd);
 | 
			
		||||
	
 | 
			
		||||
	int direction = RNA_enum_get(op->ptr, "type");
 | 
			
		||||
	
 | 
			
		||||
@@ -321,7 +321,7 @@ void GPENCIL_OT_layer_move(wmOperatorType *ot)
 | 
			
		||||
static int gp_layer_copy_exec(bContext *C, wmOperator *UNUSED(op))
 | 
			
		||||
{
 | 
			
		||||
	bGPdata *gpd = ED_gpencil_data_get_active(C);
 | 
			
		||||
	bGPDlayer *gpl = gpencil_layer_getactive(gpd);
 | 
			
		||||
	bGPDlayer *gpl = BKE_gpencil_layer_getactive(gpd);
 | 
			
		||||
	bGPDlayer *new_layer;
 | 
			
		||||
	
 | 
			
		||||
	/* sanity checks */
 | 
			
		||||
@@ -329,12 +329,12 @@ static int gp_layer_copy_exec(bContext *C, wmOperator *UNUSED(op))
 | 
			
		||||
		return OPERATOR_CANCELLED;
 | 
			
		||||
	
 | 
			
		||||
	/* make copy of layer, and add it immediately after the existing layer */
 | 
			
		||||
	new_layer = gpencil_layer_duplicate(gpl);
 | 
			
		||||
	new_layer = BKE_gpencil_layer_duplicate(gpl);
 | 
			
		||||
	BLI_insertlinkafter(&gpd->layers, gpl, new_layer);
 | 
			
		||||
	
 | 
			
		||||
	/* ensure new layer has a unique name, and is now the active layer */
 | 
			
		||||
	BLI_uniquename(&gpd->layers, new_layer, DATA_("GP_Layer"), '.', offsetof(bGPDlayer, info), sizeof(new_layer->info));
 | 
			
		||||
	gpencil_layer_setactive(gpd, new_layer);
 | 
			
		||||
	BKE_gpencil_layer_setactive(gpd, new_layer);
 | 
			
		||||
	
 | 
			
		||||
	/* notifiers */
 | 
			
		||||
	WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
 | 
			
		||||
@@ -362,7 +362,7 @@ void GPENCIL_OT_layer_duplicate(wmOperatorType *ot)
 | 
			
		||||
static int gp_hide_exec(bContext *C, wmOperator *op)
 | 
			
		||||
{
 | 
			
		||||
	bGPdata *gpd = ED_gpencil_data_get_active(C);
 | 
			
		||||
	bGPDlayer *layer = gpencil_layer_getactive(gpd);
 | 
			
		||||
	bGPDlayer *layer = BKE_gpencil_layer_getactive(gpd);
 | 
			
		||||
	bool unselected = RNA_boolean_get(op->ptr, "unselected");
 | 
			
		||||
	
 | 
			
		||||
	/* sanity checks */
 | 
			
		||||
@@ -530,7 +530,7 @@ void GPENCIL_OT_unlock_all(wmOperatorType *ot)
 | 
			
		||||
static int gp_isolate_layer_exec(bContext *C, wmOperator *op)
 | 
			
		||||
{
 | 
			
		||||
	bGPdata *gpd = ED_gpencil_data_get_active(C);
 | 
			
		||||
	bGPDlayer *layer = gpencil_layer_getactive(gpd);
 | 
			
		||||
	bGPDlayer *layer = BKE_gpencil_layer_getactive(gpd);
 | 
			
		||||
	bGPDlayer *gpl;
 | 
			
		||||
	int flags = GP_LAYER_LOCKED;
 | 
			
		||||
	bool isolate = false;
 | 
			
		||||
@@ -606,7 +606,7 @@ void GPENCIL_OT_layer_isolate(wmOperatorType *ot)
 | 
			
		||||
static int gp_merge_layer_exec(bContext *C, wmOperator *op)
 | 
			
		||||
{
 | 
			
		||||
	bGPdata *gpd = ED_gpencil_data_get_active(C);
 | 
			
		||||
	bGPDlayer *gpl_current = gpencil_layer_getactive(gpd);
 | 
			
		||||
	bGPDlayer *gpl_current = BKE_gpencil_layer_getactive(gpd);
 | 
			
		||||
	bGPDlayer *gpl_next = gpl_current->next;
 | 
			
		||||
 | 
			
		||||
	if (ELEM(NULL, gpd, gpl_current, gpl_next)) {
 | 
			
		||||
@@ -626,13 +626,13 @@ static int gp_merge_layer_exec(bContext *C, wmOperator *op)
 | 
			
		||||
		bGPDframe *frame = BLI_ghash_lookup(gh_frames_cur, SET_INT_IN_POINTER(gpf->framenum));
 | 
			
		||||
		if (!frame) {
 | 
			
		||||
			/* nothing found, create new */
 | 
			
		||||
			frame = gpencil_frame_addnew(gpl_current, gpf->framenum);
 | 
			
		||||
			frame = BKE_gpencil_frame_addnew(gpl_current, gpf->framenum);
 | 
			
		||||
		}
 | 
			
		||||
		/* add to tail all strokes */
 | 
			
		||||
		BLI_movelisttolist(&frame->strokes, &gpf->strokes);
 | 
			
		||||
	}
 | 
			
		||||
	/* Now delete next layer */
 | 
			
		||||
	gpencil_layer_delete(gpd, gpl_next);
 | 
			
		||||
	BKE_gpencil_layer_delete(gpd, gpl_next);
 | 
			
		||||
	BLI_ghash_free(gh_frames_cur, NULL, NULL);
 | 
			
		||||
 | 
			
		||||
	/* notifiers */
 | 
			
		||||
@@ -681,7 +681,7 @@ static int gp_layer_change_exec(bContext *C, wmOperator *op)
 | 
			
		||||
	/* Get layer or create new one */
 | 
			
		||||
	if (layer_num == -1) {
 | 
			
		||||
		/* Create layer */
 | 
			
		||||
		gpl = gpencil_layer_addnew(gpd, DATA_("GP_Layer"), true);
 | 
			
		||||
		gpl = BKE_gpencil_layer_addnew(gpd, DATA_("GP_Layer"), true);
 | 
			
		||||
	}
 | 
			
		||||
	else {
 | 
			
		||||
		/* Try to get layer */
 | 
			
		||||
@@ -694,7 +694,7 @@ static int gp_layer_change_exec(bContext *C, wmOperator *op)
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	/* Set active layer */
 | 
			
		||||
	gpencil_layer_setactive(gpd, gpl);
 | 
			
		||||
	BKE_gpencil_layer_setactive(gpd, gpl);
 | 
			
		||||
	
 | 
			
		||||
	/* updates */
 | 
			
		||||
	WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
 | 
			
		||||
@@ -736,7 +736,7 @@ enum {
 | 
			
		||||
static int gp_stroke_arrange_exec(bContext *C, wmOperator *op)
 | 
			
		||||
{
 | 
			
		||||
	bGPdata *gpd = ED_gpencil_data_get_active(C);
 | 
			
		||||
	bGPDlayer *gpl = gpencil_layer_getactive(gpd);
 | 
			
		||||
	bGPDlayer *gpl = BKE_gpencil_layer_getactive(gpd);
 | 
			
		||||
	bGPDstroke *gps;
 | 
			
		||||
 | 
			
		||||
	/* sanity checks */
 | 
			
		||||
@@ -861,8 +861,8 @@ static int gp_stroke_change_color_exec(bContext *C, wmOperator *UNUSED(op))
 | 
			
		||||
		return OPERATOR_CANCELLED;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	palette = gpencil_palette_getactive(gpd);
 | 
			
		||||
	color = gpencil_palettecolor_getactive(palette);
 | 
			
		||||
	palette = BKE_gpencil_palette_getactive(gpd);
 | 
			
		||||
	color = BKE_gpencil_palettecolor_getactive(palette);
 | 
			
		||||
	if (ELEM(NULL, palette, color)) {
 | 
			
		||||
		return OPERATOR_CANCELLED;
 | 
			
		||||
	}
 | 
			
		||||
@@ -919,7 +919,7 @@ static int gp_stroke_lock_color_exec(bContext *C, wmOperator *UNUSED(op))
 | 
			
		||||
	if (ELEM(NULL, gpd))
 | 
			
		||||
		return OPERATOR_CANCELLED;
 | 
			
		||||
 | 
			
		||||
	palette = gpencil_palette_getactive(gpd);
 | 
			
		||||
	palette = BKE_gpencil_palette_getactive(gpd);
 | 
			
		||||
	if (ELEM(NULL, palette))
 | 
			
		||||
		return OPERATOR_CANCELLED;
 | 
			
		||||
 | 
			
		||||
@@ -970,7 +970,7 @@ void GPENCIL_OT_stroke_lock_color(wmOperatorType *ot)
 | 
			
		||||
static int gp_stroke_apply_thickness_exec(bContext *C, wmOperator *UNUSED(op))
 | 
			
		||||
{
 | 
			
		||||
	bGPdata *gpd = ED_gpencil_data_get_active(C);
 | 
			
		||||
	bGPDlayer *gpl = gpencil_layer_getactive(gpd);
 | 
			
		||||
	bGPDlayer *gpl = BKE_gpencil_layer_getactive(gpd);
 | 
			
		||||
 | 
			
		||||
	/* sanity checks */
 | 
			
		||||
	if (ELEM(NULL, gpd, gpl, gpl->frames.first))
 | 
			
		||||
@@ -1213,10 +1213,10 @@ enum {
 | 
			
		||||
static int gp_stroke_join_exec(bContext *C, wmOperator *op)
 | 
			
		||||
{
 | 
			
		||||
	bGPdata *gpd = ED_gpencil_data_get_active(C);
 | 
			
		||||
	bGPDlayer *activegpl = gpencil_layer_getactive(gpd);
 | 
			
		||||
	bGPDlayer *activegpl = BKE_gpencil_layer_getactive(gpd);
 | 
			
		||||
	bGPDstroke *gps, *gpsn;
 | 
			
		||||
	bGPDpalette *palette = gpencil_palette_getactive(gpd);
 | 
			
		||||
	bGPDpalettecolor *palcolor = gpencil_palettecolor_getactive(palette);
 | 
			
		||||
	bGPDpalette *palette = BKE_gpencil_palette_getactive(gpd);
 | 
			
		||||
	bGPDpalettecolor *palcolor = BKE_gpencil_palettecolor_getactive(palette);
 | 
			
		||||
 | 
			
		||||
	bGPDframe *gpf_a = NULL;
 | 
			
		||||
	bGPDstroke *stroke_a = NULL;
 | 
			
		||||
@@ -1283,12 +1283,12 @@ static int gp_stroke_join_exec(bContext *C, wmOperator *op)
 | 
			
		||||
						if (stroke_a) {
 | 
			
		||||
							BLI_insertlinkbefore(&gpf_a->strokes, stroke_a, new_stroke);
 | 
			
		||||
							BLI_remlink(&gpf->strokes, stroke_a);
 | 
			
		||||
							free_gpencil_stroke(stroke_a);
 | 
			
		||||
							BKE_gpencil_free_stroke(stroke_a);
 | 
			
		||||
							stroke_a = NULL;
 | 
			
		||||
						}
 | 
			
		||||
						if (stroke_b) {
 | 
			
		||||
							BLI_remlink(&gpf->strokes, stroke_b);
 | 
			
		||||
							free_gpencil_stroke(stroke_b);
 | 
			
		||||
							BKE_gpencil_free_stroke(stroke_b);
 | 
			
		||||
							stroke_b = NULL;
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
@@ -1302,7 +1302,7 @@ static int gp_stroke_join_exec(bContext *C, wmOperator *op)
 | 
			
		||||
		if (new_stroke) {
 | 
			
		||||
			/* Add a new frame if needed */
 | 
			
		||||
			if (activegpl->actframe == NULL)
 | 
			
		||||
				activegpl->actframe = gpencil_frame_addnew(activegpl, gpf_a->framenum);
 | 
			
		||||
				activegpl->actframe = BKE_gpencil_frame_addnew(activegpl, gpf_a->framenum);
 | 
			
		||||
 | 
			
		||||
			BLI_addtail(&activegpl->actframe->strokes, new_stroke);
 | 
			
		||||
		}
 | 
			
		||||
@@ -1405,7 +1405,7 @@ static int gp_brush_add_exec(bContext *C, wmOperator *op)
 | 
			
		||||
		return OPERATOR_CANCELLED;
 | 
			
		||||
	}
 | 
			
		||||
	/* add new brush now */
 | 
			
		||||
	gpencil_brush_addnew(ts, DATA_("GP_Brush"), true);
 | 
			
		||||
	BKE_gpencil_brush_addnew(ts, DATA_("GP_Brush"), true);
 | 
			
		||||
 | 
			
		||||
	/* notifiers */
 | 
			
		||||
	WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
 | 
			
		||||
@@ -1432,7 +1432,7 @@ void GPENCIL_OT_brush_add(wmOperatorType *ot)
 | 
			
		||||
static int gp_brush_remove_exec(bContext *C, wmOperator *op)
 | 
			
		||||
{
 | 
			
		||||
	ToolSettings *ts = CTX_data_tool_settings(C);
 | 
			
		||||
	bGPDbrush *brush = gpencil_brush_getactive(ts);
 | 
			
		||||
	bGPDbrush *brush = BKE_gpencil_brush_getactive(ts);
 | 
			
		||||
 | 
			
		||||
	/* sanity checks */
 | 
			
		||||
	if (ELEM(NULL, ts, brush))
 | 
			
		||||
@@ -1449,12 +1449,12 @@ static int gp_brush_remove_exec(bContext *C, wmOperator *op)
 | 
			
		||||
	 * - if this is the only brush, this naturally becomes NULL
 | 
			
		||||
	 */
 | 
			
		||||
	if (brush->prev)
 | 
			
		||||
		gpencil_brush_setactive(ts, brush->prev);
 | 
			
		||||
		BKE_gpencil_brush_setactive(ts, brush->prev);
 | 
			
		||||
	else
 | 
			
		||||
		gpencil_brush_setactive(ts, brush->next);
 | 
			
		||||
		BKE_gpencil_brush_setactive(ts, brush->next);
 | 
			
		||||
 | 
			
		||||
	/* delete the brush now... */
 | 
			
		||||
	gpencil_brush_delete(ts, brush);
 | 
			
		||||
	BKE_gpencil_brush_delete(ts, brush);
 | 
			
		||||
 | 
			
		||||
	/* notifiers */
 | 
			
		||||
	WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
 | 
			
		||||
@@ -1501,7 +1501,7 @@ static int gp_brush_change_exec(bContext *C, wmOperator *op)
 | 
			
		||||
	/* Get brush or create new one */
 | 
			
		||||
	if (brush_num == -1) {
 | 
			
		||||
		/* Create brush */
 | 
			
		||||
		brush = gpencil_brush_addnew(ts, DATA_("GP_Brush"), true);
 | 
			
		||||
		brush = BKE_gpencil_brush_addnew(ts, DATA_("GP_Brush"), true);
 | 
			
		||||
	}
 | 
			
		||||
	else {
 | 
			
		||||
		/* Try to get brush */
 | 
			
		||||
@@ -1514,7 +1514,7 @@ static int gp_brush_change_exec(bContext *C, wmOperator *op)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* Set active brush */
 | 
			
		||||
	gpencil_brush_setactive(ts, brush);
 | 
			
		||||
	BKE_gpencil_brush_setactive(ts, brush);
 | 
			
		||||
 | 
			
		||||
	/* updates */
 | 
			
		||||
	WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
 | 
			
		||||
@@ -1552,7 +1552,7 @@ enum {
 | 
			
		||||
static int gp_brush_move_exec(bContext *C, wmOperator *op)
 | 
			
		||||
{
 | 
			
		||||
	ToolSettings *ts = CTX_data_tool_settings(C);
 | 
			
		||||
	bGPDbrush *brush = gpencil_brush_getactive(ts);
 | 
			
		||||
	bGPDbrush *brush = BKE_gpencil_brush_getactive(ts);
 | 
			
		||||
 | 
			
		||||
	int direction = RNA_enum_get(op->ptr, "type");
 | 
			
		||||
 | 
			
		||||
@@ -1610,7 +1610,7 @@ void GPENCIL_OT_brush_move(wmOperatorType *ot)
 | 
			
		||||
static int gp_brush_presets_create_exec(bContext *C, wmOperator *UNUSED(op))
 | 
			
		||||
{
 | 
			
		||||
	ToolSettings *ts = CTX_data_tool_settings(C);
 | 
			
		||||
	gpencil_brush_init_presets(ts);
 | 
			
		||||
	BKE_gpencil_brush_init_presets(ts);
 | 
			
		||||
 | 
			
		||||
	/* notifiers */
 | 
			
		||||
	WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
 | 
			
		||||
@@ -1645,7 +1645,7 @@ static int gp_brush_copy_exec(bContext *C, wmOperator *op)
 | 
			
		||||
		return OPERATOR_CANCELLED;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	bGPDbrush *brush = gpencil_brush_getactive(ts);
 | 
			
		||||
	bGPDbrush *brush = BKE_gpencil_brush_getactive(ts);
 | 
			
		||||
	bGPDbrush *newbrush;
 | 
			
		||||
 | 
			
		||||
	/* sanity checks */
 | 
			
		||||
@@ -1653,7 +1653,7 @@ static int gp_brush_copy_exec(bContext *C, wmOperator *op)
 | 
			
		||||
		return OPERATOR_CANCELLED;
 | 
			
		||||
 | 
			
		||||
	/* create a brush and duplicate data */
 | 
			
		||||
	newbrush = gpencil_brush_addnew(ts, brush->info, true);
 | 
			
		||||
	newbrush = BKE_gpencil_brush_addnew(ts, brush->info, true);
 | 
			
		||||
	newbrush->thickness = brush->thickness;
 | 
			
		||||
	newbrush->draw_smoothfac = brush->draw_smoothfac;
 | 
			
		||||
	newbrush->draw_smoothlvl = brush->draw_smoothlvl;
 | 
			
		||||
@@ -1677,7 +1677,7 @@ static int gp_brush_copy_exec(bContext *C, wmOperator *op)
 | 
			
		||||
	newbrush->cur_strength = curvemapping_copy(brush->cur_strength);
 | 
			
		||||
	newbrush->cur_jitter = curvemapping_copy(brush->cur_jitter);
 | 
			
		||||
 | 
			
		||||
	gpencil_brush_setactive(ts, newbrush);
 | 
			
		||||
	BKE_gpencil_brush_setactive(ts, newbrush);
 | 
			
		||||
	/* notifiers */
 | 
			
		||||
	WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
 | 
			
		||||
 | 
			
		||||
@@ -1718,7 +1718,7 @@ static int gp_brush_select_exec(bContext *C, wmOperator *op)
 | 
			
		||||
		return OPERATOR_CANCELLED;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	gpencil_brush_setactive(ts, brush);
 | 
			
		||||
	BKE_gpencil_brush_setactive(ts, brush);
 | 
			
		||||
 | 
			
		||||
	/* notifiers */
 | 
			
		||||
	WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
 | 
			
		||||
@@ -1760,10 +1760,10 @@ static int gp_palette_add_exec(bContext *C, wmOperator *op)
 | 
			
		||||
		return OPERATOR_CANCELLED;
 | 
			
		||||
	}
 | 
			
		||||
	if (*gpd_ptr == NULL)
 | 
			
		||||
		*gpd_ptr = gpencil_data_addnew(DATA_("GPencil"));
 | 
			
		||||
		*gpd_ptr = BKE_gpencil_data_addnew(DATA_("GPencil"));
 | 
			
		||||
 | 
			
		||||
	/* add new palette now */
 | 
			
		||||
	gpencil_palette_addnew(*gpd_ptr, DATA_("GP_Palette"), true);
 | 
			
		||||
	BKE_gpencil_palette_addnew(*gpd_ptr, DATA_("GP_Palette"), true);
 | 
			
		||||
 | 
			
		||||
	/* notifiers */
 | 
			
		||||
	WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
 | 
			
		||||
@@ -1790,7 +1790,7 @@ void GPENCIL_OT_palette_add(wmOperatorType *ot)
 | 
			
		||||
static int gp_palette_remove_exec(bContext *C, wmOperator *op)
 | 
			
		||||
{
 | 
			
		||||
	bGPdata *gpd = ED_gpencil_data_get_active(C);
 | 
			
		||||
	bGPDpalette *palette = gpencil_palette_getactive(gpd);
 | 
			
		||||
	bGPDpalette *palette = BKE_gpencil_palette_getactive(gpd);
 | 
			
		||||
 | 
			
		||||
	/* sanity checks */
 | 
			
		||||
	if (ELEM(NULL, gpd, palette))
 | 
			
		||||
@@ -1807,12 +1807,12 @@ static int gp_palette_remove_exec(bContext *C, wmOperator *op)
 | 
			
		||||
	 * - if this is the only palette, this naturally becomes NULL
 | 
			
		||||
	 */
 | 
			
		||||
	if (palette->prev)
 | 
			
		||||
		gpencil_palette_setactive(gpd, palette->prev);
 | 
			
		||||
		BKE_gpencil_palette_setactive(gpd, palette->prev);
 | 
			
		||||
	else
 | 
			
		||||
		gpencil_palette_setactive(gpd, palette->next);
 | 
			
		||||
		BKE_gpencil_palette_setactive(gpd, palette->next);
 | 
			
		||||
 | 
			
		||||
	/* delete the palette now... */
 | 
			
		||||
	gpencil_palette_delete(gpd, palette);
 | 
			
		||||
	BKE_gpencil_palette_delete(gpd, palette);
 | 
			
		||||
 | 
			
		||||
	/* notifiers */
 | 
			
		||||
	WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
 | 
			
		||||
@@ -1859,7 +1859,7 @@ static int gp_palette_change_exec(bContext *C, wmOperator *op)
 | 
			
		||||
	/* Get palette or create new one */
 | 
			
		||||
	if (palette_num == -1) {
 | 
			
		||||
		/* Create palette */
 | 
			
		||||
		palette = gpencil_palette_addnew(gpd, DATA_("GP_Palette"), true);
 | 
			
		||||
		palette = BKE_gpencil_palette_addnew(gpd, DATA_("GP_Palette"), true);
 | 
			
		||||
	}
 | 
			
		||||
	else {
 | 
			
		||||
		/* Try to get palette */
 | 
			
		||||
@@ -1872,7 +1872,7 @@ static int gp_palette_change_exec(bContext *C, wmOperator *op)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* Set active palette */
 | 
			
		||||
	gpencil_palette_setactive(gpd, palette);
 | 
			
		||||
	BKE_gpencil_palette_setactive(gpd, palette);
 | 
			
		||||
 | 
			
		||||
	/* updates */
 | 
			
		||||
	WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
 | 
			
		||||
@@ -1911,7 +1911,7 @@ static int gp_palette_lock_layer_exec(bContext *C, wmOperator *UNUSED(op))
 | 
			
		||||
	if (ELEM(NULL, gpd))
 | 
			
		||||
		return OPERATOR_CANCELLED;
 | 
			
		||||
 | 
			
		||||
	palette = gpencil_palette_getactive(gpd);
 | 
			
		||||
	palette = BKE_gpencil_palette_getactive(gpd);
 | 
			
		||||
	if (ELEM(NULL, palette))
 | 
			
		||||
		return OPERATOR_CANCELLED;
 | 
			
		||||
 | 
			
		||||
@@ -1972,15 +1972,15 @@ static int gp_palettecolor_add_exec(bContext *C, wmOperator *op)
 | 
			
		||||
		return OPERATOR_CANCELLED;
 | 
			
		||||
	}
 | 
			
		||||
	if (*gpd_ptr == NULL)
 | 
			
		||||
		*gpd_ptr = gpencil_data_addnew(DATA_("GPencil"));
 | 
			
		||||
		*gpd_ptr = BKE_gpencil_data_addnew(DATA_("GPencil"));
 | 
			
		||||
 | 
			
		||||
	/* verify palette */
 | 
			
		||||
	bGPDpalette *palette = gpencil_palette_getactive(*gpd_ptr);
 | 
			
		||||
	bGPDpalette *palette = BKE_gpencil_palette_getactive(*gpd_ptr);
 | 
			
		||||
	if (palette == NULL)
 | 
			
		||||
		palette = gpencil_palette_addnew(*gpd_ptr, DATA_("GP_Palette"), true);
 | 
			
		||||
		palette = BKE_gpencil_palette_addnew(*gpd_ptr, DATA_("GP_Palette"), true);
 | 
			
		||||
 | 
			
		||||
	/* add new palette color now */
 | 
			
		||||
	gpencil_palettecolor_addnew(palette, DATA_("Color"), true);
 | 
			
		||||
	BKE_gpencil_palettecolor_addnew(palette, DATA_("Color"), true);
 | 
			
		||||
 | 
			
		||||
	/* notifiers */
 | 
			
		||||
	WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
 | 
			
		||||
@@ -2007,8 +2007,8 @@ void GPENCIL_OT_palettecolor_add(wmOperatorType *ot)
 | 
			
		||||
static int gp_palettecolor_remove_exec(bContext *C, wmOperator *UNUSED(op))
 | 
			
		||||
{
 | 
			
		||||
	bGPdata *gpd = ED_gpencil_data_get_active(C);
 | 
			
		||||
	bGPDpalette *palette = gpencil_palette_getactive(gpd);
 | 
			
		||||
	bGPDpalettecolor *color = gpencil_palettecolor_getactive(palette);
 | 
			
		||||
	bGPDpalette *palette = BKE_gpencil_palette_getactive(gpd);
 | 
			
		||||
	bGPDpalettecolor *color = BKE_gpencil_palettecolor_getactive(palette);
 | 
			
		||||
 | 
			
		||||
	/* sanity checks */
 | 
			
		||||
	if (ELEM(NULL, gpd, palette, color))
 | 
			
		||||
@@ -2019,15 +2019,15 @@ static int gp_palettecolor_remove_exec(bContext *C, wmOperator *UNUSED(op))
 | 
			
		||||
	 * - if this is the only color, this naturally becomes NULL
 | 
			
		||||
	 */
 | 
			
		||||
	if (color->prev)
 | 
			
		||||
		gpencil_palettecolor_setactive(palette, color->prev);
 | 
			
		||||
		BKE_gpencil_palettecolor_setactive(palette, color->prev);
 | 
			
		||||
	else
 | 
			
		||||
		gpencil_palettecolor_setactive(palette, color->next);
 | 
			
		||||
		BKE_gpencil_palettecolor_setactive(palette, color->next);
 | 
			
		||||
 | 
			
		||||
	/* delete the strokes */
 | 
			
		||||
	gpencil_palettecolor_delete_strokes(gpd, color->info);
 | 
			
		||||
	BKE_gpencil_palettecolor_delete_strokes(gpd, color->info);
 | 
			
		||||
 | 
			
		||||
	/* delete the palette color now... */
 | 
			
		||||
	gpencil_palettecolor_delete(palette, color);
 | 
			
		||||
	BKE_gpencil_palettecolor_delete(palette, color);
 | 
			
		||||
 | 
			
		||||
	/* notifiers */
 | 
			
		||||
	WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
 | 
			
		||||
@@ -2054,8 +2054,8 @@ void GPENCIL_OT_palettecolor_remove(wmOperatorType *ot)
 | 
			
		||||
static int gp_isolate_palettecolor_exec(bContext *C, wmOperator *op)
 | 
			
		||||
{
 | 
			
		||||
	bGPdata *gpd = ED_gpencil_data_get_active(C);
 | 
			
		||||
	bGPDpalette *palette = gpencil_palette_getactive(gpd);
 | 
			
		||||
	bGPDpalettecolor *active_color = gpencil_palettecolor_getactive(palette);
 | 
			
		||||
	bGPDpalette *palette = BKE_gpencil_palette_getactive(gpd);
 | 
			
		||||
	bGPDpalettecolor *active_color = BKE_gpencil_palettecolor_getactive(palette);
 | 
			
		||||
	bGPDpalettecolor *palcolor;
 | 
			
		||||
 | 
			
		||||
	int flags = PC_COLOR_LOCKED;
 | 
			
		||||
@@ -2131,8 +2131,8 @@ void GPENCIL_OT_palettecolor_isolate(wmOperatorType *ot)
 | 
			
		||||
static int gp_palettecolor_hide_exec(bContext *C, wmOperator *op)
 | 
			
		||||
{
 | 
			
		||||
	bGPdata *gpd = ED_gpencil_data_get_active(C);
 | 
			
		||||
	bGPDpalette *palette = gpencil_palette_getactive(gpd);
 | 
			
		||||
	bGPDpalettecolor *palcolor = gpencil_palettecolor_getactive(palette);
 | 
			
		||||
	bGPDpalette *palette = BKE_gpencil_palette_getactive(gpd);
 | 
			
		||||
	bGPDpalettecolor *palcolor = BKE_gpencil_palettecolor_getactive(palette);
 | 
			
		||||
 | 
			
		||||
	bool unselected = RNA_boolean_get(op->ptr, "unselected");
 | 
			
		||||
 | 
			
		||||
@@ -2190,7 +2190,7 @@ static int gp_palettecolor_reveal_poll(bContext *C)
 | 
			
		||||
static int gp_palettecolor_reveal_exec(bContext *C, wmOperator *UNUSED(op))
 | 
			
		||||
{
 | 
			
		||||
	bGPdata *gpd = ED_gpencil_data_get_active(C);
 | 
			
		||||
	bGPDpalette *palette = gpencil_palette_getactive(gpd);
 | 
			
		||||
	bGPDpalette *palette = BKE_gpencil_palette_getactive(gpd);
 | 
			
		||||
	bGPDpalettecolor *palcolor;
 | 
			
		||||
 | 
			
		||||
	/* sanity checks */
 | 
			
		||||
@@ -2228,7 +2228,7 @@ void GPENCIL_OT_palettecolor_reveal(wmOperatorType *ot)
 | 
			
		||||
static int gp_palettecolor_lock_all_exec(bContext *C, wmOperator *UNUSED(op))
 | 
			
		||||
{
 | 
			
		||||
	bGPdata *gpd = ED_gpencil_data_get_active(C);
 | 
			
		||||
	bGPDpalette *palette = gpencil_palette_getactive(gpd);
 | 
			
		||||
	bGPDpalette *palette = BKE_gpencil_palette_getactive(gpd);
 | 
			
		||||
	bGPDpalettecolor *palcolor;
 | 
			
		||||
 | 
			
		||||
	/* sanity checks */
 | 
			
		||||
@@ -2266,7 +2266,7 @@ void GPENCIL_OT_palettecolor_lock_all(wmOperatorType *ot)
 | 
			
		||||
static int gp_palettecolor_unlock_all_exec(bContext *C, wmOperator *UNUSED(op))
 | 
			
		||||
{
 | 
			
		||||
	bGPdata *gpd = ED_gpencil_data_get_active(C);
 | 
			
		||||
	bGPDpalette *palette = gpencil_palette_getactive(gpd);
 | 
			
		||||
	bGPDpalette *palette = BKE_gpencil_palette_getactive(gpd);
 | 
			
		||||
	bGPDpalettecolor *palcolor;
 | 
			
		||||
 | 
			
		||||
	/* sanity checks */
 | 
			
		||||
@@ -2309,8 +2309,8 @@ enum {
 | 
			
		||||
static int gp_palettecolor_move_exec(bContext *C, wmOperator *op)
 | 
			
		||||
{
 | 
			
		||||
	bGPdata *gpd = ED_gpencil_data_get_active(C);
 | 
			
		||||
	bGPDpalette *palette = gpencil_palette_getactive(gpd);
 | 
			
		||||
	bGPDpalettecolor *palcolor = gpencil_palettecolor_getactive(palette);
 | 
			
		||||
	bGPDpalette *palette = BKE_gpencil_palette_getactive(gpd);
 | 
			
		||||
	bGPDpalettecolor *palcolor = BKE_gpencil_palettecolor_getactive(palette);
 | 
			
		||||
 | 
			
		||||
	int direction = RNA_enum_get(op->ptr, "direction");
 | 
			
		||||
 | 
			
		||||
@@ -2367,8 +2367,8 @@ void GPENCIL_OT_palettecolor_move(wmOperatorType *ot)
 | 
			
		||||
static int gp_palettecolor_select_exec(bContext *C, wmOperator *UNUSED(op))
 | 
			
		||||
{
 | 
			
		||||
	bGPdata *gpd = ED_gpencil_data_get_active(C);
 | 
			
		||||
	bGPDpalette *palette = gpencil_palette_getactive(gpd);
 | 
			
		||||
	bGPDpalettecolor *palcolor = gpencil_palettecolor_getactive(palette);
 | 
			
		||||
	bGPDpalette *palette = BKE_gpencil_palette_getactive(gpd);
 | 
			
		||||
	bGPDpalettecolor *palcolor = BKE_gpencil_palettecolor_getactive(palette);
 | 
			
		||||
 | 
			
		||||
	/* sanity checks */
 | 
			
		||||
	if (ELEM(NULL, gpd, palette, palcolor))
 | 
			
		||||
@@ -2426,8 +2426,8 @@ void GPENCIL_OT_palettecolor_select(wmOperatorType *ot)
 | 
			
		||||
static int gp_palettecolor_copy_exec(bContext *C, wmOperator *UNUSED(op))
 | 
			
		||||
{
 | 
			
		||||
	bGPdata *gpd = ED_gpencil_data_get_active(C);
 | 
			
		||||
	bGPDpalette *palette = gpencil_palette_getactive(gpd);
 | 
			
		||||
	bGPDpalettecolor *palcolor = gpencil_palettecolor_getactive(palette);
 | 
			
		||||
	bGPDpalette *palette = BKE_gpencil_palette_getactive(gpd);
 | 
			
		||||
	bGPDpalettecolor *palcolor = BKE_gpencil_palettecolor_getactive(palette);
 | 
			
		||||
	bGPDpalettecolor *newcolor;
 | 
			
		||||
 | 
			
		||||
	/* sanity checks */
 | 
			
		||||
@@ -2435,7 +2435,7 @@ static int gp_palettecolor_copy_exec(bContext *C, wmOperator *UNUSED(op))
 | 
			
		||||
		return OPERATOR_CANCELLED;
 | 
			
		||||
 | 
			
		||||
	/* create a new color and duplicate data */
 | 
			
		||||
	newcolor = gpencil_palettecolor_addnew(palette, palcolor->info, true);
 | 
			
		||||
	newcolor = BKE_gpencil_palettecolor_addnew(palette, palcolor->info, true);
 | 
			
		||||
	copy_v4_v4(newcolor->color, palcolor->color);
 | 
			
		||||
	copy_v4_v4(newcolor->fill, palcolor->fill);
 | 
			
		||||
	newcolor->flag = palcolor->flag;
 | 
			
		||||
 
 | 
			
		||||
@@ -462,7 +462,7 @@ static int gp_strokes_paste_exec(bContext *C, wmOperator *op)
 | 
			
		||||
	}
 | 
			
		||||
	else if (gpl == NULL) {
 | 
			
		||||
		/* no active layer - let's just create one */
 | 
			
		||||
		gpl = gpencil_layer_addnew(gpd, DATA_("GP_Layer"), true);
 | 
			
		||||
		gpl = BKE_gpencil_layer_addnew(gpd, DATA_("GP_Layer"), true);
 | 
			
		||||
	}
 | 
			
		||||
	else if ((gpencil_layer_is_editable(gpl) == false) && (type == GP_COPY_MERGE)) {
 | 
			
		||||
		BKE_report(op->reports, RPT_ERROR, "Can not paste strokes when active layer is hidden or locked");
 | 
			
		||||
@@ -525,7 +525,7 @@ static int gp_strokes_paste_exec(bContext *C, wmOperator *op)
 | 
			
		||||
						gpl = CTX_data_active_gpencil_layer(C);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				gpf = gpencil_layer_getframe(gpl, CFRA, true);
 | 
			
		||||
				gpf = BKE_gpencil_layer_getframe(gpl, CFRA, true);
 | 
			
		||||
				if (gpf) {
 | 
			
		||||
					bGPDstroke *new_stroke = MEM_dupallocN(gps);
 | 
			
		||||
					new_stroke->tmp_layerinfo[0] = '\0';
 | 
			
		||||
@@ -597,7 +597,7 @@ static int gp_move_to_layer_exec(bContext *C, wmOperator *op)
 | 
			
		||||
	/* Get layer or create new one */
 | 
			
		||||
	if (layer_num == -1) {
 | 
			
		||||
		/* Create layer */
 | 
			
		||||
		target_layer = gpencil_layer_addnew(gpd, DATA_("GP_Layer"), true);
 | 
			
		||||
		target_layer = BKE_gpencil_layer_addnew(gpd, DATA_("GP_Layer"), true);
 | 
			
		||||
	}
 | 
			
		||||
	else {
 | 
			
		||||
		/* Try to get layer */
 | 
			
		||||
@@ -642,7 +642,7 @@ static int gp_move_to_layer_exec(bContext *C, wmOperator *op)
 | 
			
		||||
	/* Paste them all in one go */
 | 
			
		||||
	if (strokes.first) {
 | 
			
		||||
		Scene *scene = CTX_data_scene(C);
 | 
			
		||||
		bGPDframe *gpf = gpencil_layer_getframe(target_layer, CFRA, true);
 | 
			
		||||
		bGPDframe *gpf = BKE_gpencil_layer_getframe(target_layer, CFRA, true);
 | 
			
		||||
		
 | 
			
		||||
		BLI_movelisttolist(&gpf->strokes, &strokes);
 | 
			
		||||
		BLI_assert((strokes.first == strokes.last) && (strokes.first == NULL));
 | 
			
		||||
@@ -679,7 +679,7 @@ void GPENCIL_OT_move_to_layer(wmOperatorType *ot)
 | 
			
		||||
static int gp_actframe_delete_poll(bContext *C)
 | 
			
		||||
{
 | 
			
		||||
	bGPdata *gpd = ED_gpencil_data_get_active(C);
 | 
			
		||||
	bGPDlayer *gpl = gpencil_layer_getactive(gpd);
 | 
			
		||||
	bGPDlayer *gpl = BKE_gpencil_layer_getactive(gpd);
 | 
			
		||||
	
 | 
			
		||||
	/* only if there's an active layer with an active frame */
 | 
			
		||||
	return (gpl && gpl->actframe);
 | 
			
		||||
@@ -690,8 +690,8 @@ static int gp_actframe_delete_exec(bContext *C, wmOperator *op)
 | 
			
		||||
{
 | 
			
		||||
	Scene *scene = CTX_data_scene(C);
 | 
			
		||||
	bGPdata *gpd = ED_gpencil_data_get_active(C);
 | 
			
		||||
	bGPDlayer *gpl = gpencil_layer_getactive(gpd);
 | 
			
		||||
	bGPDframe *gpf = gpencil_layer_getframe(gpl, CFRA, 0);
 | 
			
		||||
	bGPDlayer *gpl = BKE_gpencil_layer_getactive(gpd);
 | 
			
		||||
	bGPDframe *gpf = BKE_gpencil_layer_getframe(gpl, CFRA, 0);
 | 
			
		||||
	
 | 
			
		||||
	/* if there's no existing Grease-Pencil data there, add some */
 | 
			
		||||
	if (gpd == NULL) {
 | 
			
		||||
@@ -704,7 +704,7 @@ static int gp_actframe_delete_exec(bContext *C, wmOperator *op)
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	/* delete it... */
 | 
			
		||||
	gpencil_layer_delframe(gpl, gpf);
 | 
			
		||||
	BKE_gpencil_layer_delframe(gpl, gpf);
 | 
			
		||||
	
 | 
			
		||||
	/* notifiers */
 | 
			
		||||
	WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
 | 
			
		||||
@@ -746,13 +746,13 @@ static int gp_actframe_delete_all_exec(bContext *C, wmOperator *op)
 | 
			
		||||
	CTX_DATA_BEGIN(C, bGPDlayer *, gpl, editable_gpencil_layers)
 | 
			
		||||
	{
 | 
			
		||||
		/* try to get the "active" frame - but only if it actually occurs on this frame */
 | 
			
		||||
		bGPDframe *gpf = gpencil_layer_getframe(gpl, CFRA, 0);
 | 
			
		||||
		bGPDframe *gpf = BKE_gpencil_layer_getframe(gpl, CFRA, 0);
 | 
			
		||||
		
 | 
			
		||||
		if (gpf == NULL)
 | 
			
		||||
			continue;
 | 
			
		||||
		
 | 
			
		||||
		/* delete it... */
 | 
			
		||||
		gpencil_layer_delframe(gpl, gpf);
 | 
			
		||||
		BKE_gpencil_layer_delframe(gpl, gpf);
 | 
			
		||||
		
 | 
			
		||||
		/* we successfully modified something */
 | 
			
		||||
		success = true;
 | 
			
		||||
 
 | 
			
		||||
@@ -544,7 +544,7 @@ static short gp_stroke_addpoint(tGPsdata *p, const int mval[2], float pressure,
 | 
			
		||||
	}
 | 
			
		||||
	else if (p->paintmode == GP_PAINTMODE_DRAW_POLY) {
 | 
			
		||||
		
 | 
			
		||||
		bGPDlayer *gpl = gpencil_layer_getactive(gpd);
 | 
			
		||||
		bGPDlayer *gpl = BKE_gpencil_layer_getactive(gpd);
 | 
			
		||||
		/* get pointer to destination point */
 | 
			
		||||
		pt = (tGPspoint *)(gpd->sbuffer);
 | 
			
		||||
		
 | 
			
		||||
@@ -920,8 +920,8 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
 | 
			
		||||
			MEM_freeN(depth_arr);
 | 
			
		||||
	}
 | 
			
		||||
	/* Save palette color */
 | 
			
		||||
	bGPDpalette *palette = gpencil_palette_getactive(p->gpd);
 | 
			
		||||
	bGPDpalettecolor *palcolor = gpencil_palettecolor_getactive(palette);
 | 
			
		||||
	bGPDpalette *palette = BKE_gpencil_palette_getactive(p->gpd);
 | 
			
		||||
	bGPDpalettecolor *palcolor = BKE_gpencil_palettecolor_getactive(palette);
 | 
			
		||||
	gps->palcolor = palcolor;
 | 
			
		||||
	strcpy(gps->colorname, palcolor->info);
 | 
			
		||||
 | 
			
		||||
@@ -1221,7 +1221,7 @@ static bGPDpalettecolor *gp_create_new_color(bGPDpalette *palette)
 | 
			
		||||
{
 | 
			
		||||
	bGPDpalettecolor *palcolor;
 | 
			
		||||
 | 
			
		||||
	palcolor = gpencil_palettecolor_addnew(palette, DATA_("Color"), true);
 | 
			
		||||
	palcolor = BKE_gpencil_palettecolor_addnew(palette, DATA_("Color"), true);
 | 
			
		||||
	
 | 
			
		||||
	return palcolor;
 | 
			
		||||
}
 | 
			
		||||
@@ -1234,12 +1234,12 @@ static void gp_init_drawing_brush(ToolSettings *ts, tGPsdata *p)
 | 
			
		||||
	/* if not exist, create a new one */
 | 
			
		||||
	if (BLI_listbase_is_empty(&ts->gp_brushes)) {
 | 
			
		||||
		/* create new brushes */
 | 
			
		||||
		gpencil_brush_init_presets(ts);
 | 
			
		||||
		brush = gpencil_brush_getactive(ts);
 | 
			
		||||
		BKE_gpencil_brush_init_presets(ts);
 | 
			
		||||
		brush = BKE_gpencil_brush_getactive(ts);
 | 
			
		||||
	}
 | 
			
		||||
	else {
 | 
			
		||||
		/* Use the current */
 | 
			
		||||
		brush = gpencil_brush_getactive(ts);
 | 
			
		||||
		brush = BKE_gpencil_brush_getactive(ts);
 | 
			
		||||
	}
 | 
			
		||||
	/* be sure curves are initializated */
 | 
			
		||||
	curvemapping_initialize(brush->cur_sensitivity);
 | 
			
		||||
@@ -1263,23 +1263,23 @@ static void gp_init_palette(tGPsdata *p)
 | 
			
		||||
	/* if not exist, create a new palette */
 | 
			
		||||
	if (BLI_listbase_is_empty(&gpd->palettes)) {
 | 
			
		||||
		/* create new palette */
 | 
			
		||||
		palette = gpencil_palette_addnew(gpd, DATA_("GP_Palette"), true);
 | 
			
		||||
		palette = BKE_gpencil_palette_addnew(gpd, DATA_("GP_Palette"), true);
 | 
			
		||||
		/* now create a default color */
 | 
			
		||||
		palcolor = gp_create_new_color(palette);
 | 
			
		||||
	}
 | 
			
		||||
	else {
 | 
			
		||||
		/* Use the current palette and color */
 | 
			
		||||
		palette = gpencil_palette_getactive(gpd);
 | 
			
		||||
		palette = BKE_gpencil_palette_getactive(gpd);
 | 
			
		||||
		/* the palette needs one color */
 | 
			
		||||
		if (BLI_listbase_is_empty(&palette->colors)) {
 | 
			
		||||
			palcolor = gp_create_new_color(palette);
 | 
			
		||||
		}
 | 
			
		||||
		else {
 | 
			
		||||
			palcolor = gpencil_palettecolor_getactive(palette);
 | 
			
		||||
			palcolor = BKE_gpencil_palettecolor_getactive(palette);
 | 
			
		||||
		}
 | 
			
		||||
		/* in some situations can be null, so use first */
 | 
			
		||||
		if (palcolor == NULL) {
 | 
			
		||||
			gpencil_palettecolor_setactive(palette, palette->colors.first);
 | 
			
		||||
			BKE_gpencil_palettecolor_setactive(palette, palette->colors.first);
 | 
			
		||||
			palcolor = palette->colors.first;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
@@ -1439,7 +1439,7 @@ static bool gp_session_initdata(bContext *C, tGPsdata *p)
 | 
			
		||||
	else {
 | 
			
		||||
		/* if no existing GPencil block exists, add one */
 | 
			
		||||
		if (*gpd_ptr == NULL)
 | 
			
		||||
			*gpd_ptr = gpencil_data_addnew("GPencil");
 | 
			
		||||
			*gpd_ptr = BKE_gpencil_data_addnew("GPencil");
 | 
			
		||||
		p->gpd = *gpd_ptr;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
@@ -1514,9 +1514,9 @@ static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode)
 | 
			
		||||
	ToolSettings *ts = scene->toolsettings;
 | 
			
		||||
	
 | 
			
		||||
	/* get active layer (or add a new one if non-existent) */
 | 
			
		||||
	p->gpl = gpencil_layer_getactive(p->gpd);
 | 
			
		||||
	p->gpl = BKE_gpencil_layer_getactive(p->gpd);
 | 
			
		||||
	if (p->gpl == NULL) {
 | 
			
		||||
		p->gpl = gpencil_layer_addnew(p->gpd, "GP_Layer", true);
 | 
			
		||||
		p->gpl = BKE_gpencil_layer_addnew(p->gpd, "GP_Layer", true);
 | 
			
		||||
		
 | 
			
		||||
		if (p->custom_color[3])
 | 
			
		||||
			copy_v3_v3(p->gpl->color, p->custom_color);
 | 
			
		||||
@@ -1544,7 +1544,7 @@ static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode)
 | 
			
		||||
			/* Add a new frame if needed (and based off the active frame,
 | 
			
		||||
			 * as we need some existing strokes to erase)
 | 
			
		||||
			 */
 | 
			
		||||
			gpl->actframe = gpencil_layer_getframe(gpl, CFRA, GP_GETFRAME_ADD_COPY);
 | 
			
		||||
			gpl->actframe = BKE_gpencil_layer_getframe(gpl, CFRA, GP_GETFRAME_ADD_COPY);
 | 
			
		||||
			
 | 
			
		||||
			/* XXX: we omit GP_FRAME_PAINT here for now,
 | 
			
		||||
			 * as it is only really useful for doing
 | 
			
		||||
@@ -1580,7 +1580,7 @@ static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode)
 | 
			
		||||
		else
 | 
			
		||||
			add_frame_mode = GP_GETFRAME_ADD_NEW;
 | 
			
		||||
			
 | 
			
		||||
		p->gpf = gpencil_layer_getframe(p->gpl, CFRA, add_frame_mode);
 | 
			
		||||
		p->gpf = BKE_gpencil_layer_getframe(p->gpl, CFRA, add_frame_mode);
 | 
			
		||||
		
 | 
			
		||||
		if (p->gpf == NULL) {
 | 
			
		||||
			p->status = GP_STATUS_ERROR;
 | 
			
		||||
 
 | 
			
		||||
@@ -266,7 +266,7 @@ static void gp_select_same_layer(bContext *C)
 | 
			
		||||
	
 | 
			
		||||
	CTX_DATA_BEGIN(C, bGPDlayer *, gpl, editable_gpencil_layers)
 | 
			
		||||
	{
 | 
			
		||||
		bGPDframe *gpf = gpencil_layer_getframe(gpl, CFRA, 0);
 | 
			
		||||
		bGPDframe *gpf = BKE_gpencil_layer_getframe(gpl, CFRA, 0);
 | 
			
		||||
		bGPDstroke *gps;
 | 
			
		||||
		bool found = false;
 | 
			
		||||
		
 | 
			
		||||
@@ -709,7 +709,7 @@ static bool gp_stroke_do_circle_sel(
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		/* Ensure that stroke selection is in sync with its points */
 | 
			
		||||
		gpencil_stroke_sync_selection(gps);
 | 
			
		||||
		BKE_gpencil_stroke_sync_selection(gps);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	return changed;
 | 
			
		||||
@@ -871,7 +871,7 @@ static int gpencil_border_select_exec(bContext *C, wmOperator *op)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		/* Ensure that stroke selection is in sync with its points */
 | 
			
		||||
		gpencil_stroke_sync_selection(gps);
 | 
			
		||||
		BKE_gpencil_stroke_sync_selection(gps);
 | 
			
		||||
	}
 | 
			
		||||
	GP_EDITABLE_STROKES_END;
 | 
			
		||||
 | 
			
		||||
@@ -981,7 +981,7 @@ static int gpencil_lasso_select_exec(bContext *C, wmOperator *op)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		/* Ensure that stroke selection is in sync with its points */
 | 
			
		||||
		gpencil_stroke_sync_selection(gps);
 | 
			
		||||
		BKE_gpencil_stroke_sync_selection(gps);
 | 
			
		||||
	}
 | 
			
		||||
	GP_EDITABLE_STROKES_END;
 | 
			
		||||
 | 
			
		||||
@@ -1152,7 +1152,7 @@ static int gpencil_select_exec(bContext *C, wmOperator *op)
 | 
			
		||||
			hit_point->flag &= ~GP_SPOINT_SELECT;
 | 
			
		||||
			
 | 
			
		||||
			/* ensure that stroke is selected correctly */
 | 
			
		||||
			gpencil_stroke_sync_selection(hit_stroke);
 | 
			
		||||
			BKE_gpencil_stroke_sync_selection(hit_stroke);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
 
 | 
			
		||||
@@ -100,14 +100,14 @@ int ED_undo_gpencil_step(bContext *C, int step, const char *name)
 | 
			
		||||
				bGPdata *gpd = *gpd_ptr;
 | 
			
		||||
				bGPDlayer *gpl, *gpld;
 | 
			
		||||
				
 | 
			
		||||
				free_gpencil_layers(&gpd->layers);
 | 
			
		||||
				BKE_gpencil_free_layers(&gpd->layers);
 | 
			
		||||
				
 | 
			
		||||
				/* copy layers */
 | 
			
		||||
				BLI_listbase_clear(&gpd->layers);
 | 
			
		||||
				
 | 
			
		||||
				for (gpl = new_gpd->layers.first; gpl; gpl = gpl->next) {
 | 
			
		||||
					/* make a copy of source layer and its data */
 | 
			
		||||
					gpld = gpencil_layer_duplicate(gpl);
 | 
			
		||||
					gpld = BKE_gpencil_layer_duplicate(gpl);
 | 
			
		||||
					BLI_addtail(&gpd->layers, gpld);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
@@ -153,7 +153,7 @@ void gpencil_undo_push(bGPdata *gpd)
 | 
			
		||||
	
 | 
			
		||||
	/* create new undo node */
 | 
			
		||||
	undo_node = MEM_callocN(sizeof(bGPundonode), "gpencil undo node");
 | 
			
		||||
	undo_node->gpd = gpencil_data_duplicate(G.main, gpd, true);
 | 
			
		||||
	undo_node->gpd = BKE_gpencil_data_duplicate(G.main, gpd, true);
 | 
			
		||||
	
 | 
			
		||||
	cur_node = undo_node;
 | 
			
		||||
	
 | 
			
		||||
 
 | 
			
		||||
@@ -225,7 +225,7 @@ bool ED_gpencil_has_keyframe_v3d(Scene *scene, Object *ob, int cfra)
 | 
			
		||||
	/* just check both for now... */
 | 
			
		||||
	// XXX: this could get confusing (e.g. if only on the object, but other places don't show this)
 | 
			
		||||
	if (scene->gpd) {
 | 
			
		||||
		bGPDlayer *gpl = gpencil_layer_getactive(scene->gpd);
 | 
			
		||||
		bGPDlayer *gpl = BKE_gpencil_layer_getactive(scene->gpd);
 | 
			
		||||
		if (gpl) {
 | 
			
		||||
			if (gpl->actframe) {
 | 
			
		||||
				// XXX: assumes that frame has been fetched already
 | 
			
		||||
@@ -239,7 +239,7 @@ bool ED_gpencil_has_keyframe_v3d(Scene *scene, Object *ob, int cfra)
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	if (ob && ob->gpd) {
 | 
			
		||||
		bGPDlayer *gpl = gpencil_layer_getactive(ob->gpd);
 | 
			
		||||
		bGPDlayer *gpl = BKE_gpencil_layer_getactive(ob->gpd);
 | 
			
		||||
		if (gpl) {
 | 
			
		||||
			if (gpl->actframe) {
 | 
			
		||||
				// XXX: assumes that frame has been fetched already
 | 
			
		||||
@@ -269,7 +269,7 @@ int gp_add_poll(bContext *C)
 | 
			
		||||
int gp_active_layer_poll(bContext *C)
 | 
			
		||||
{
 | 
			
		||||
	bGPdata *gpd = ED_gpencil_data_get_active(C);
 | 
			
		||||
	bGPDlayer *gpl = gpencil_layer_getactive(gpd);
 | 
			
		||||
	bGPDlayer *gpl = BKE_gpencil_layer_getactive(gpd);
 | 
			
		||||
	
 | 
			
		||||
	return (gpl != NULL);
 | 
			
		||||
}
 | 
			
		||||
@@ -278,7 +278,7 @@ int gp_active_layer_poll(bContext *C)
 | 
			
		||||
int gp_active_brush_poll(bContext *C)
 | 
			
		||||
{
 | 
			
		||||
	ToolSettings *ts = CTX_data_tool_settings(C);
 | 
			
		||||
	bGPDbrush *brush = gpencil_brush_getactive(ts);
 | 
			
		||||
	bGPDbrush *brush = BKE_gpencil_brush_getactive(ts);
 | 
			
		||||
 | 
			
		||||
	return (brush != NULL);
 | 
			
		||||
}
 | 
			
		||||
@@ -287,7 +287,7 @@ int gp_active_brush_poll(bContext *C)
 | 
			
		||||
int gp_active_palette_poll(bContext *C)
 | 
			
		||||
{
 | 
			
		||||
	bGPdata *gpd = ED_gpencil_data_get_active(C);
 | 
			
		||||
	bGPDpalette *palette = gpencil_palette_getactive(gpd);
 | 
			
		||||
	bGPDpalette *palette = BKE_gpencil_palette_getactive(gpd);
 | 
			
		||||
 | 
			
		||||
	return (palette != NULL);
 | 
			
		||||
}
 | 
			
		||||
@@ -296,8 +296,8 @@ int gp_active_palette_poll(bContext *C)
 | 
			
		||||
int gp_active_palettecolor_poll(bContext *C)
 | 
			
		||||
{
 | 
			
		||||
	bGPdata *gpd = ED_gpencil_data_get_active(C);
 | 
			
		||||
	bGPDpalette *palette = gpencil_palette_getactive(gpd);
 | 
			
		||||
	bGPDpalettecolor *palcolor = gpencil_palettecolor_getactive(palette);
 | 
			
		||||
	bGPDpalette *palette = BKE_gpencil_palette_getactive(gpd);
 | 
			
		||||
	bGPDpalettecolor *palcolor = BKE_gpencil_palettecolor_getactive(palette);
 | 
			
		||||
 | 
			
		||||
	return (palcolor != NULL);
 | 
			
		||||
}
 | 
			
		||||
@@ -470,20 +470,20 @@ bGPDpalettecolor *ED_gpencil_stroke_getcolor(bGPdata *gpd, bGPDstroke *gps)
 | 
			
		||||
		return gps->palcolor;
 | 
			
		||||
 | 
			
		||||
	/* get palette */
 | 
			
		||||
	palette = gpencil_palette_getactive(gpd);
 | 
			
		||||
	palette = BKE_gpencil_palette_getactive(gpd);
 | 
			
		||||
	if (palette == NULL) {
 | 
			
		||||
		palette = gpencil_palette_addnew(gpd, DATA_("GP_Palette"), true);
 | 
			
		||||
		palette = BKE_gpencil_palette_addnew(gpd, DATA_("GP_Palette"), true);
 | 
			
		||||
	}
 | 
			
		||||
	/* get color */
 | 
			
		||||
	palcolor = gpencil_palettecolor_getbyname(palette, gps->colorname);
 | 
			
		||||
	palcolor = BKE_gpencil_palettecolor_getbyname(palette, gps->colorname);
 | 
			
		||||
	if (palcolor == NULL) {
 | 
			
		||||
		if (gps->palcolor == NULL) {
 | 
			
		||||
			palcolor = gpencil_palettecolor_addnew(palette, DATA_("Color"), true);
 | 
			
		||||
			palcolor = BKE_gpencil_palettecolor_addnew(palette, DATA_("Color"), true);
 | 
			
		||||
			/* set to a different color */
 | 
			
		||||
			ARRAY_SET_ITEMS(palcolor->color, 1.0f, 0.0f, 1.0f, 0.9f);
 | 
			
		||||
		}
 | 
			
		||||
		else {
 | 
			
		||||
			palcolor = gpencil_palettecolor_addnew(palette, gps->colorname, true);
 | 
			
		||||
			palcolor = BKE_gpencil_palettecolor_addnew(palette, gps->colorname, true);
 | 
			
		||||
			/* set old color and attributes */
 | 
			
		||||
			bGPDpalettecolor *gpscolor = gps->palcolor;
 | 
			
		||||
			copy_v4_v4(palcolor->color, gpscolor->color);
 | 
			
		||||
 
 | 
			
		||||
@@ -467,7 +467,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
 | 
			
		||||
		bGPdata *gpd = ED_gpencil_data_get_active_direct((ID *)sc, scene, sa, obact);
 | 
			
		||||
		
 | 
			
		||||
		if (gpd) {
 | 
			
		||||
			bGPDlayer *gpl = gpencil_layer_getactive(gpd);
 | 
			
		||||
			bGPDlayer *gpl = BKE_gpencil_layer_getactive(gpd);
 | 
			
		||||
			
 | 
			
		||||
			if (gpl) {
 | 
			
		||||
				CTX_data_pointer_set(result, &gpd->id, &RNA_GPencilLayer, gpl);
 | 
			
		||||
@@ -480,7 +480,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
 | 
			
		||||
		bGPdata *gpd = ED_gpencil_data_get_active_direct((ID *)sc, scene, sa, obact);
 | 
			
		||||
 | 
			
		||||
		if (gpd) {
 | 
			
		||||
			bGPDpalette *palette = gpencil_palette_getactive(gpd);
 | 
			
		||||
			bGPDpalette *palette = BKE_gpencil_palette_getactive(gpd);
 | 
			
		||||
 | 
			
		||||
			if (palette) {
 | 
			
		||||
				CTX_data_pointer_set(result, &gpd->id, &RNA_GPencilPalette, palette);
 | 
			
		||||
@@ -493,10 +493,10 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
 | 
			
		||||
		bGPdata *gpd = ED_gpencil_data_get_active_direct((ID *)sc, scene, sa, obact);
 | 
			
		||||
 | 
			
		||||
		if (gpd) {
 | 
			
		||||
			bGPDpalette *palette = gpencil_palette_getactive(gpd);
 | 
			
		||||
			bGPDpalette *palette = BKE_gpencil_palette_getactive(gpd);
 | 
			
		||||
 | 
			
		||||
			if (palette) {
 | 
			
		||||
				bGPDpalettecolor *palcolor = gpencil_palettecolor_getactive(palette);
 | 
			
		||||
				bGPDpalettecolor *palcolor = BKE_gpencil_palettecolor_getactive(palette);
 | 
			
		||||
				if (palcolor) {
 | 
			
		||||
					CTX_data_pointer_set(result, &gpd->id, &RNA_GPencilPaletteColor, palcolor);
 | 
			
		||||
					return 1;
 | 
			
		||||
@@ -506,7 +506,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
 | 
			
		||||
	}
 | 
			
		||||
	else if (CTX_data_equals(member, "active_gpencil_brush")) {
 | 
			
		||||
		/* XXX: see comment for gpencil_data case... */
 | 
			
		||||
		bGPDbrush *brush = gpencil_brush_getactive(scene->toolsettings);
 | 
			
		||||
		bGPDbrush *brush = BKE_gpencil_brush_getactive(scene->toolsettings);
 | 
			
		||||
 | 
			
		||||
		if (brush) {
 | 
			
		||||
			CTX_data_pointer_set(result, NULL, &RNA_GPencilBrush, brush);
 | 
			
		||||
@@ -518,7 +518,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
 | 
			
		||||
		bGPdata *gpd = ED_gpencil_data_get_active_direct((ID *)sc, scene, sa, obact);
 | 
			
		||||
		
 | 
			
		||||
		if (gpd) {
 | 
			
		||||
			bGPDlayer *gpl = gpencil_layer_getactive(gpd);
 | 
			
		||||
			bGPDlayer *gpl = BKE_gpencil_layer_getactive(gpd);
 | 
			
		||||
			
 | 
			
		||||
			if (gpl) {
 | 
			
		||||
				CTX_data_pointer_set(result, &gpd->id, &RNA_GPencilLayer, gpl->actframe);
 | 
			
		||||
 
 | 
			
		||||
@@ -750,7 +750,7 @@ static void insert_gpencil_keys(bAnimContext *ac, short mode)
 | 
			
		||||
	/* insert gp frames */
 | 
			
		||||
	for (ale = anim_data.first; ale; ale = ale->next) {
 | 
			
		||||
		bGPDlayer *gpl = (bGPDlayer *)ale->data;
 | 
			
		||||
		gpencil_layer_getframe(gpl, CFRA, add_frame_mode);
 | 
			
		||||
		BKE_gpencil_layer_getframe(gpl, CFRA, add_frame_mode);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	ANIM_animdata_update(ac, &anim_data);
 | 
			
		||||
 
 | 
			
		||||
@@ -302,18 +302,18 @@ static bool view3d_ruler_to_gpencil(bContext *C, RulerInfo *ruler_info)
 | 
			
		||||
	bool changed = false;
 | 
			
		||||
 | 
			
		||||
	if (scene->gpd == NULL) {
 | 
			
		||||
		scene->gpd = gpencil_data_addnew("GPencil");
 | 
			
		||||
		scene->gpd = BKE_gpencil_data_addnew("GPencil");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	gpl = BLI_findstring(&scene->gpd->layers, ruler_name, offsetof(bGPDlayer, info));
 | 
			
		||||
	if (gpl == NULL) {
 | 
			
		||||
		gpl = gpencil_layer_addnew(scene->gpd, ruler_name, false);
 | 
			
		||||
		gpl = BKE_gpencil_layer_addnew(scene->gpd, ruler_name, false);
 | 
			
		||||
		gpl->thickness = 1;
 | 
			
		||||
		gpl->flag |= GP_LAYER_HIDE;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	gpf = gpencil_layer_getframe(gpl, CFRA, true);
 | 
			
		||||
	free_gpencil_strokes(gpf);
 | 
			
		||||
	gpf = BKE_gpencil_layer_getframe(gpl, CFRA, true);
 | 
			
		||||
	BKE_gpencil_free_strokes(gpf);
 | 
			
		||||
 | 
			
		||||
	for (ruler_item = ruler_info->items.first; ruler_item; ruler_item = ruler_item->next) {
 | 
			
		||||
		bGPDspoint *pt;
 | 
			
		||||
@@ -360,7 +360,7 @@ static bool view3d_ruler_from_gpencil(bContext *C, RulerInfo *ruler_info)
 | 
			
		||||
		gpl = BLI_findstring(&scene->gpd->layers, ruler_name, offsetof(bGPDlayer, info));
 | 
			
		||||
		if (gpl) {
 | 
			
		||||
			bGPDframe *gpf;
 | 
			
		||||
			gpf = gpencil_layer_getframe(gpl, CFRA, false);
 | 
			
		||||
			gpf = BKE_gpencil_layer_getframe(gpl, CFRA, false);
 | 
			
		||||
			if (gpf) {
 | 
			
		||||
				bGPDstroke *gps;
 | 
			
		||||
				for (gps = gpf->strokes.first; gps; gps = gps->next) {
 | 
			
		||||
 
 | 
			
		||||
@@ -3292,7 +3292,7 @@ static void posttrans_gpd_clean(bGPdata *gpd)
 | 
			
		||||
			for (gpf = gpl->frames.first; gpf; gpf = gpfn) {
 | 
			
		||||
				gpfn = gpf->next;
 | 
			
		||||
				if (gpfn && gpf->framenum == gpfn->framenum) {
 | 
			
		||||
					gpencil_layer_delframe(gpl, gpf);
 | 
			
		||||
					BKE_gpencil_layer_delframe(gpl, gpf);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
@@ -7755,7 +7755,7 @@ static void createTransGPencil(bContext *C, TransInfo *t)
 | 
			
		||||
			 */
 | 
			
		||||
			// XXX: should this be allowed when framelock is enabled?
 | 
			
		||||
			if (gpf->framenum != cfra) {
 | 
			
		||||
				gpf = gpencil_frame_addcopy(gpl, cfra);
 | 
			
		||||
				gpf = BKE_gpencil_frame_addcopy(gpl, cfra);
 | 
			
		||||
				/* in some weird situations (framelock enabled) return NULL */
 | 
			
		||||
				if (gpf == NULL) {
 | 
			
		||||
					continue;
 | 
			
		||||
 
 | 
			
		||||
@@ -323,7 +323,7 @@ static void rna_GPencil_active_layer_set(PointerRNA *ptr, PointerRNA value)
 | 
			
		||||
static int rna_GPencil_active_layer_index_get(PointerRNA *ptr)
 | 
			
		||||
{
 | 
			
		||||
	bGPdata *gpd = (bGPdata *)ptr->id.data;
 | 
			
		||||
	bGPDlayer *gpl = gpencil_layer_getactive(gpd);
 | 
			
		||||
	bGPDlayer *gpl = BKE_gpencil_layer_getactive(gpd);
 | 
			
		||||
	
 | 
			
		||||
	return BLI_findindex(&gpd->layers, gpl);
 | 
			
		||||
}
 | 
			
		||||
@@ -333,7 +333,7 @@ static void rna_GPencil_active_layer_index_set(PointerRNA *ptr, int value)
 | 
			
		||||
	bGPdata *gpd   = (bGPdata *)ptr->id.data;
 | 
			
		||||
	bGPDlayer *gpl = BLI_findlink(&gpd->layers, value);
 | 
			
		||||
 | 
			
		||||
	gpencil_layer_setactive(gpd, gpl);
 | 
			
		||||
	BKE_gpencil_layer_setactive(gpd, gpl);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void rna_GPencil_active_layer_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
 | 
			
		||||
@@ -366,7 +366,7 @@ static void rna_GPencil_use_onion_skinning_set(PointerRNA *ptr, const int value)
 | 
			
		||||
	/* set new value */
 | 
			
		||||
	if (value) {
 | 
			
		||||
		/* enable on active layer (it's the one that's most likely to be of interest right now) */
 | 
			
		||||
		gpl = gpencil_layer_getactive(gpd);
 | 
			
		||||
		gpl = BKE_gpencil_layer_getactive(gpd);
 | 
			
		||||
		if (gpl) {
 | 
			
		||||
			gpl->flag |= GP_LAYER_ONIONSKIN;
 | 
			
		||||
		}
 | 
			
		||||
@@ -435,7 +435,7 @@ static void rna_GPencil_stroke_point_select_set(PointerRNA *ptr, const int value
 | 
			
		||||
			pt->flag &= ~GP_SPOINT_SELECT;
 | 
			
		||||
		
 | 
			
		||||
		/* Check if the stroke should be selected or not... */
 | 
			
		||||
		gpencil_stroke_sync_selection(gps);
 | 
			
		||||
		BKE_gpencil_stroke_sync_selection(gps);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -534,7 +534,7 @@ static bGPDframe *rna_GPencil_frame_new(bGPDlayer *layer, ReportList *reports, i
 | 
			
		||||
		return NULL;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	frame = gpencil_frame_addnew(layer, frame_number);
 | 
			
		||||
	frame = BKE_gpencil_frame_addnew(layer, frame_number);
 | 
			
		||||
 | 
			
		||||
	WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
 | 
			
		||||
 | 
			
		||||
@@ -549,7 +549,7 @@ static void rna_GPencil_frame_remove(bGPDlayer *layer, ReportList *reports, Poin
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	gpencil_layer_delframe(layer, frame);
 | 
			
		||||
	BKE_gpencil_layer_delframe(layer, frame);
 | 
			
		||||
	RNA_POINTER_INVALIDATE(frame_ptr);
 | 
			
		||||
 | 
			
		||||
	WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
 | 
			
		||||
@@ -557,7 +557,7 @@ static void rna_GPencil_frame_remove(bGPDlayer *layer, ReportList *reports, Poin
 | 
			
		||||
 | 
			
		||||
static bGPDframe *rna_GPencil_frame_copy(bGPDlayer *layer, bGPDframe *src)
 | 
			
		||||
{
 | 
			
		||||
	bGPDframe *frame = gpencil_frame_duplicate(src);
 | 
			
		||||
	bGPDframe *frame = BKE_gpencil_frame_duplicate(src);
 | 
			
		||||
 | 
			
		||||
	while (BKE_gpencil_layer_find_frame(layer, frame->framenum)) {
 | 
			
		||||
		frame->framenum++;
 | 
			
		||||
@@ -572,7 +572,7 @@ static bGPDframe *rna_GPencil_frame_copy(bGPDlayer *layer, bGPDframe *src)
 | 
			
		||||
 | 
			
		||||
static bGPDlayer *rna_GPencil_layer_new(bGPdata *gpd, const char *name, int setactive)
 | 
			
		||||
{
 | 
			
		||||
	bGPDlayer *gl = gpencil_layer_addnew(gpd, name, setactive != 0);
 | 
			
		||||
	bGPDlayer *gl = BKE_gpencil_layer_addnew(gpd, name, setactive != 0);
 | 
			
		||||
 | 
			
		||||
	WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
 | 
			
		||||
 | 
			
		||||
@@ -587,7 +587,7 @@ static void rna_GPencil_layer_remove(bGPdata *gpd, ReportList *reports, PointerR
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	gpencil_layer_delete(gpd, layer);
 | 
			
		||||
	BKE_gpencil_layer_delete(gpd, layer);
 | 
			
		||||
	RNA_POINTER_INVALIDATE(layer_ptr);
 | 
			
		||||
 | 
			
		||||
	WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
 | 
			
		||||
@@ -595,21 +595,21 @@ static void rna_GPencil_layer_remove(bGPdata *gpd, ReportList *reports, PointerR
 | 
			
		||||
 | 
			
		||||
static void rna_GPencil_frame_clear(bGPDframe *frame)
 | 
			
		||||
{
 | 
			
		||||
	free_gpencil_strokes(frame);
 | 
			
		||||
	BKE_gpencil_free_strokes(frame);
 | 
			
		||||
 | 
			
		||||
	WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void rna_GPencil_layer_clear(bGPDlayer *layer)
 | 
			
		||||
{
 | 
			
		||||
	free_gpencil_frames(layer);
 | 
			
		||||
	BKE_gpencil_free_frames(layer);
 | 
			
		||||
 | 
			
		||||
	WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void rna_GPencil_clear(bGPdata *gpd)
 | 
			
		||||
{
 | 
			
		||||
	free_gpencil_layers(&gpd->layers);
 | 
			
		||||
	BKE_gpencil_free_layers(&gpd->layers);
 | 
			
		||||
 | 
			
		||||
	WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
 | 
			
		||||
}
 | 
			
		||||
@@ -617,7 +617,7 @@ static void rna_GPencil_clear(bGPdata *gpd)
 | 
			
		||||
/* Palettes */
 | 
			
		||||
static bGPDpalette *rna_GPencil_palette_new(bGPdata *gpd, const char *name, int setactive)
 | 
			
		||||
{
 | 
			
		||||
	bGPDpalette *palette = gpencil_palette_addnew(gpd, name, setactive != 0);
 | 
			
		||||
	bGPDpalette *palette = BKE_gpencil_palette_addnew(gpd, name, setactive != 0);
 | 
			
		||||
 | 
			
		||||
	WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
 | 
			
		||||
 | 
			
		||||
@@ -632,7 +632,7 @@ static void rna_GPencil_palette_remove(bGPdata *gpd, ReportList *reports, Pointe
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	gpencil_palette_delete(gpd, palette);
 | 
			
		||||
	BKE_gpencil_palette_delete(gpd, palette);
 | 
			
		||||
	RNA_POINTER_INVALIDATE(palette_ptr);
 | 
			
		||||
 | 
			
		||||
	WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
 | 
			
		||||
@@ -675,7 +675,7 @@ static void rna_GPencil_active_palette_set(PointerRNA *ptr, PointerRNA value)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		/* force color recalc */
 | 
			
		||||
		gpencil_palette_change_strokes(gpd);
 | 
			
		||||
		BKE_gpencil_palette_change_strokes(gpd);
 | 
			
		||||
 | 
			
		||||
		WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
 | 
			
		||||
	}
 | 
			
		||||
@@ -684,7 +684,7 @@ static void rna_GPencil_active_palette_set(PointerRNA *ptr, PointerRNA value)
 | 
			
		||||
static int rna_GPencilPalette_index_get(PointerRNA *ptr)
 | 
			
		||||
{
 | 
			
		||||
	bGPdata *gpd = (bGPdata *)ptr->id.data;
 | 
			
		||||
	bGPDpalette *palette = gpencil_palette_getactive(gpd);
 | 
			
		||||
	bGPDpalette *palette = BKE_gpencil_palette_getactive(gpd);
 | 
			
		||||
 | 
			
		||||
	return BLI_findindex(&gpd->palettes, palette);
 | 
			
		||||
}
 | 
			
		||||
@@ -694,7 +694,7 @@ static void rna_GPencilPalette_index_set(PointerRNA *ptr, int value)
 | 
			
		||||
	bGPdata *gpd   = (bGPdata *)ptr->id.data;
 | 
			
		||||
	bGPDpalette *palette = BLI_findlink(&gpd->palettes, value);
 | 
			
		||||
 | 
			
		||||
	gpencil_palette_setactive(gpd, palette);
 | 
			
		||||
	BKE_gpencil_palette_setactive(gpd, palette);
 | 
			
		||||
	WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -712,7 +712,7 @@ static void rna_GPencilPalette_index_range(PointerRNA *ptr, int *min, int *max,
 | 
			
		||||
/* Palette colors */
 | 
			
		||||
static bGPDpalettecolor *rna_GPencilPalette_color_new(bGPDpalette *palette)
 | 
			
		||||
{
 | 
			
		||||
	bGPDpalettecolor *color = gpencil_palettecolor_addnew(palette, DATA_("Color"), true);
 | 
			
		||||
	bGPDpalettecolor *color = BKE_gpencil_palettecolor_addnew(palette, DATA_("Color"), true);
 | 
			
		||||
 | 
			
		||||
	return color;
 | 
			
		||||
}
 | 
			
		||||
@@ -726,7 +726,7 @@ static void rna_GPencilPalette_color_remove(bGPDpalette *palette, ReportList *re
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	gpencil_palettecolor_delete(palette, color);
 | 
			
		||||
	BKE_gpencil_palettecolor_delete(palette, color);
 | 
			
		||||
	RNA_POINTER_INVALIDATE(color_ptr);
 | 
			
		||||
 | 
			
		||||
	WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
 | 
			
		||||
@@ -755,7 +755,7 @@ static void rna_GPencilPalette_active_color_set(PointerRNA *ptr, PointerRNA valu
 | 
			
		||||
	bGPDpalette *palette = (bGPDpalette *)ptr->data;
 | 
			
		||||
	bGPDpalettecolor *color = value.data;
 | 
			
		||||
 | 
			
		||||
	gpencil_palettecolor_setactive(palette, color);
 | 
			
		||||
	BKE_gpencil_palettecolor_setactive(palette, color);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void rna_GPencilPalette_info_set(PointerRNA *ptr, const char *value)
 | 
			
		||||
@@ -773,7 +773,7 @@ static void rna_GPencilPalette_info_set(PointerRNA *ptr, const char *value)
 | 
			
		||||
static char *rna_GPencilPalette_color_path(PointerRNA *ptr)
 | 
			
		||||
{
 | 
			
		||||
	bGPdata *gpd = ptr->id.data;
 | 
			
		||||
	bGPDpalette *palette = gpencil_palette_getactive(gpd);
 | 
			
		||||
	bGPDpalette *palette = BKE_gpencil_palette_getactive(gpd);
 | 
			
		||||
	bGPDpalettecolor *palcolor = ptr->data;
 | 
			
		||||
 | 
			
		||||
	char name_palette[sizeof(palette->info) * 2];
 | 
			
		||||
@@ -788,11 +788,11 @@ static char *rna_GPencilPalette_color_path(PointerRNA *ptr)
 | 
			
		||||
static void rna_GPencilPaletteColor_info_set(PointerRNA *ptr, const char *value)
 | 
			
		||||
{
 | 
			
		||||
	bGPdata *gpd = ptr->id.data;
 | 
			
		||||
	bGPDpalette *palette = gpencil_palette_getactive(gpd);
 | 
			
		||||
	bGPDpalette *palette = BKE_gpencil_palette_getactive(gpd);
 | 
			
		||||
	bGPDpalettecolor *palcolor = ptr->data;
 | 
			
		||||
 | 
			
		||||
	/* rename all strokes */
 | 
			
		||||
	gpencil_palettecolor_changename(gpd, palcolor->info, value);
 | 
			
		||||
	BKE_gpencil_palettecolor_changename(gpd, palcolor->info, value);
 | 
			
		||||
 | 
			
		||||
	/* copy the new name into the name slot */
 | 
			
		||||
	BLI_strncpy_utf8(palcolor->info, value, sizeof(palcolor->info));
 | 
			
		||||
@@ -824,7 +824,7 @@ static int rna_GPencilPaletteColor_is_fill_visible_get(PointerRNA *ptr)
 | 
			
		||||
static int rna_GPencilPaletteColor_index_get(PointerRNA *ptr)
 | 
			
		||||
{
 | 
			
		||||
	bGPDpalette *palette = (bGPDpalette *)ptr->data;
 | 
			
		||||
	bGPDpalettecolor *pcolor = gpencil_palettecolor_getactive(palette);
 | 
			
		||||
	bGPDpalettecolor *pcolor = BKE_gpencil_palettecolor_getactive(palette);
 | 
			
		||||
 | 
			
		||||
	return BLI_findindex(&palette->colors, pcolor);
 | 
			
		||||
}
 | 
			
		||||
@@ -833,7 +833,7 @@ static void rna_GPencilPaletteColor_index_set(PointerRNA *ptr, int value)
 | 
			
		||||
{
 | 
			
		||||
	bGPDpalette *palette = (bGPDpalette *)ptr->data;
 | 
			
		||||
	bGPDpalettecolor *pcolor = BLI_findlink(&palette->colors, value);
 | 
			
		||||
	gpencil_palettecolor_setactive(palette, pcolor);
 | 
			
		||||
	BKE_gpencil_palettecolor_setactive(palette, pcolor);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void rna_GPencilPaletteColor_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
 | 
			
		||||
 
 | 
			
		||||
@@ -1564,7 +1564,7 @@ void RNA_def_main_gpencil(BlenderRNA *brna, PropertyRNA *cprop)
 | 
			
		||||
	parm = RNA_def_boolean(func, "value", 0, "Value", "");
 | 
			
		||||
	RNA_def_property_flag(parm, PROP_REQUIRED);
 | 
			
		||||
 | 
			
		||||
	func = RNA_def_function(srna, "new", "gpencil_data_addnew");
 | 
			
		||||
	func = RNA_def_function(srna, "new", "BKE_gpencil_data_addnew");
 | 
			
		||||
	RNA_def_function_flag(func, FUNC_NO_SELF);
 | 
			
		||||
	parm = RNA_def_string(func, "name", "GreasePencil", 0, "", "New name for the data-block");
 | 
			
		||||
	RNA_def_property_flag(parm, PROP_REQUIRED);
 | 
			
		||||
 
 | 
			
		||||
@@ -454,7 +454,7 @@ EnumPropertyItem rna_enum_bake_pass_filter_type_items[] = {
 | 
			
		||||
/* Grease pencil Drawing Brushes */
 | 
			
		||||
static bGPDbrush *rna_GPencil_brush_new(ToolSettings *ts, const char *name, int setactive)
 | 
			
		||||
{
 | 
			
		||||
	bGPDbrush *brush = gpencil_brush_addnew(ts, name, setactive != 0);
 | 
			
		||||
	bGPDbrush *brush = BKE_gpencil_brush_addnew(ts, name, setactive != 0);
 | 
			
		||||
 | 
			
		||||
	WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
 | 
			
		||||
 | 
			
		||||
@@ -469,7 +469,7 @@ static void rna_GPencil_brush_remove(ToolSettings *ts, ReportList *reports, Poin
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	gpencil_brush_delete(ts, brush);
 | 
			
		||||
	BKE_gpencil_brush_delete(ts, brush);
 | 
			
		||||
	RNA_POINTER_INVALIDATE(brush_ptr);
 | 
			
		||||
 | 
			
		||||
	WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
 | 
			
		||||
@@ -514,7 +514,7 @@ static void rna_GPencil_active_brush_set(PointerRNA *ptr, PointerRNA value)
 | 
			
		||||
static int rna_GPencilBrush_index_get(PointerRNA *ptr)
 | 
			
		||||
{
 | 
			
		||||
	ToolSettings *ts = (ToolSettings *) ptr->data;
 | 
			
		||||
	bGPDbrush *brush = gpencil_brush_getactive(ts);
 | 
			
		||||
	bGPDbrush *brush = BKE_gpencil_brush_getactive(ts);
 | 
			
		||||
 | 
			
		||||
	return BLI_findindex(&ts->gp_brushes, brush);
 | 
			
		||||
}
 | 
			
		||||
@@ -525,7 +525,7 @@ static void rna_GPencilBrush_index_set(PointerRNA *ptr, int value)
 | 
			
		||||
 | 
			
		||||
	bGPDbrush *brush = BLI_findlink(&ts->gp_brushes, value);
 | 
			
		||||
 | 
			
		||||
	gpencil_brush_setactive(ts, brush);
 | 
			
		||||
	BKE_gpencil_brush_setactive(ts, brush);
 | 
			
		||||
	WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user