Merge branch 'blender-v2.83-release'
This commit is contained in:
commit
363f18c8b5
|
@ -57,10 +57,18 @@ struct Brush *BKE_brush_copy(struct Main *bmain, const struct Brush *brush);
|
|||
|
||||
void BKE_brush_sculpt_reset(struct Brush *brush);
|
||||
|
||||
void BKE_brush_gpencil_paint_presets(struct Main *bmain, struct ToolSettings *ts);
|
||||
void BKE_brush_gpencil_vertex_presets(struct Main *bmain, struct ToolSettings *ts);
|
||||
void BKE_brush_gpencil_sculpt_presets(struct Main *bmain, struct ToolSettings *ts);
|
||||
void BKE_brush_gpencil_weight_presets(struct Main *bmain, struct ToolSettings *ts);
|
||||
void BKE_brush_gpencil_paint_presets(struct Main *bmain,
|
||||
struct ToolSettings *ts,
|
||||
const bool reset);
|
||||
void BKE_brush_gpencil_vertex_presets(struct Main *bmain,
|
||||
struct ToolSettings *ts,
|
||||
const bool reset);
|
||||
void BKE_brush_gpencil_sculpt_presets(struct Main *bmain,
|
||||
struct ToolSettings *ts,
|
||||
const bool reset);
|
||||
void BKE_brush_gpencil_weight_presets(struct Main *bmain,
|
||||
struct ToolSettings *ts,
|
||||
const bool reset);
|
||||
void BKE_gpencil_brush_preset_set(struct Main *bmain, struct Brush *brush, const short type);
|
||||
|
||||
/* image icon function */
|
||||
|
|
|
@ -1063,14 +1063,20 @@ void BKE_gpencil_brush_preset_set(Main *bmain, Brush *brush, const short type)
|
|||
}
|
||||
}
|
||||
|
||||
static Brush *gpencil_brush_ensure(Main *bmain,
|
||||
ToolSettings *ts,
|
||||
const char *brush_name,
|
||||
eObjectMode mode)
|
||||
static Brush *gpencil_brush_ensure(
|
||||
Main *bmain, ToolSettings *ts, const char *brush_name, eObjectMode mode, bool *r_new)
|
||||
{
|
||||
*r_new = false;
|
||||
Brush *brush = BLI_findstring(&bmain->brushes, brush_name, offsetof(ID, name) + 2);
|
||||
|
||||
/* If the brush exist, but the type is not GPencil or the mode is wrong, create a new one. */
|
||||
if ((brush != NULL) && ((brush->gpencil_settings == NULL) || (brush->ob_mode != mode))) {
|
||||
brush = NULL;
|
||||
}
|
||||
|
||||
if (brush == NULL) {
|
||||
brush = BKE_brush_add_gpencil(bmain, ts, brush_name, mode);
|
||||
*r_new = true;
|
||||
}
|
||||
|
||||
if (brush->gpencil_settings == NULL) {
|
||||
|
@ -1081,160 +1087,222 @@ static Brush *gpencil_brush_ensure(Main *bmain,
|
|||
}
|
||||
|
||||
/* Create a set of grease pencil Drawing presets. */
|
||||
void BKE_brush_gpencil_paint_presets(Main *bmain, ToolSettings *ts)
|
||||
void BKE_brush_gpencil_paint_presets(Main *bmain, ToolSettings *ts, const bool reset)
|
||||
{
|
||||
bool r_new = false;
|
||||
|
||||
Paint *paint = &ts->gp_paint->paint;
|
||||
|
||||
Brush *brush, *deft_draw;
|
||||
/* Airbrush brush. */
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Airbrush", OB_MODE_PAINT_GPENCIL);
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_AIRBRUSH);
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Airbrush", OB_MODE_PAINT_GPENCIL, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_AIRBRUSH);
|
||||
}
|
||||
|
||||
/* Ink Pen brush. */
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Ink Pen", OB_MODE_PAINT_GPENCIL);
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_INK_PEN);
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Ink Pen", OB_MODE_PAINT_GPENCIL, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_INK_PEN);
|
||||
}
|
||||
|
||||
/* Ink Pen Rough brush. */
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Ink Pen Rough", OB_MODE_PAINT_GPENCIL);
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_INK_PEN_ROUGH);
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Ink Pen Rough", OB_MODE_PAINT_GPENCIL, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_INK_PEN_ROUGH);
|
||||
}
|
||||
|
||||
/* Marker Bold brush. */
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Marker Bold", OB_MODE_PAINT_GPENCIL);
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_MARKER_BOLD);
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Marker Bold", OB_MODE_PAINT_GPENCIL, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_MARKER_BOLD);
|
||||
}
|
||||
|
||||
/* Marker Chisel brush. */
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Marker Chisel", OB_MODE_PAINT_GPENCIL);
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_MARKER_CHISEL);
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Marker Chisel", OB_MODE_PAINT_GPENCIL, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_MARKER_CHISEL);
|
||||
}
|
||||
|
||||
/* Pen brush. */
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Pen", OB_MODE_PAINT_GPENCIL);
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_PEN);
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Pen", OB_MODE_PAINT_GPENCIL, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_PEN);
|
||||
}
|
||||
|
||||
/* Pencil Soft brush. */
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Pencil Soft", OB_MODE_PAINT_GPENCIL);
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_PENCIL_SOFT);
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Pencil Soft", OB_MODE_PAINT_GPENCIL, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_PENCIL_SOFT);
|
||||
}
|
||||
|
||||
/* Pencil brush. */
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Pencil", OB_MODE_PAINT_GPENCIL);
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_PENCIL);
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Pencil", OB_MODE_PAINT_GPENCIL, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_PENCIL);
|
||||
}
|
||||
deft_draw = brush; /* save default brush. */
|
||||
|
||||
/* Fill brush. */
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Fill Area", OB_MODE_PAINT_GPENCIL);
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_FILL_AREA);
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Fill Area", OB_MODE_PAINT_GPENCIL, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_FILL_AREA);
|
||||
}
|
||||
|
||||
/* Soft Eraser brush. */
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Eraser Soft", OB_MODE_PAINT_GPENCIL);
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_ERASER_SOFT);
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Eraser Soft", OB_MODE_PAINT_GPENCIL, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_ERASER_SOFT);
|
||||
}
|
||||
|
||||
/* Hard Eraser brush. */
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Eraser Hard", OB_MODE_PAINT_GPENCIL);
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_ERASER_HARD);
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Eraser Hard", OB_MODE_PAINT_GPENCIL, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_ERASER_HARD);
|
||||
}
|
||||
|
||||
/* Point Eraser brush. */
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Eraser Point", OB_MODE_PAINT_GPENCIL);
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_ERASER_POINT);
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Eraser Point", OB_MODE_PAINT_GPENCIL, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_ERASER_POINT);
|
||||
}
|
||||
|
||||
/* Stroke Eraser brush. */
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Eraser Stroke", OB_MODE_PAINT_GPENCIL);
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_ERASER_STROKE);
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Eraser Stroke", OB_MODE_PAINT_GPENCIL, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_ERASER_STROKE);
|
||||
}
|
||||
|
||||
/* Tint brush. */
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Tint", OB_MODE_PAINT_GPENCIL);
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_TINT);
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Tint", OB_MODE_PAINT_GPENCIL, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_TINT);
|
||||
}
|
||||
|
||||
/* Set default Draw brush. */
|
||||
BKE_paint_brush_set(paint, deft_draw);
|
||||
}
|
||||
|
||||
/* Create a set of grease pencil Vertex Paint presets. */
|
||||
void BKE_brush_gpencil_vertex_presets(Main *bmain, ToolSettings *ts)
|
||||
void BKE_brush_gpencil_vertex_presets(Main *bmain, ToolSettings *ts, const bool reset)
|
||||
{
|
||||
bool r_new = false;
|
||||
|
||||
Paint *vertexpaint = &ts->gp_vertexpaint->paint;
|
||||
|
||||
Brush *brush, *deft_vertex;
|
||||
/* Vertex Draw brush. */
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Vertex Draw", OB_MODE_VERTEX_GPENCIL);
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_VERTEX_DRAW);
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Vertex Draw", OB_MODE_VERTEX_GPENCIL, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_VERTEX_DRAW);
|
||||
}
|
||||
deft_vertex = brush; /* save default brush. */
|
||||
|
||||
/* Vertex Blur brush. */
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Vertex Blur", OB_MODE_VERTEX_GPENCIL);
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_VERTEX_BLUR);
|
||||
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Vertex Blur", OB_MODE_VERTEX_GPENCIL, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_VERTEX_BLUR);
|
||||
}
|
||||
/* Vertex Average brush. */
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Vertex Average", OB_MODE_VERTEX_GPENCIL);
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_VERTEX_AVERAGE);
|
||||
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Vertex Average", OB_MODE_VERTEX_GPENCIL, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_VERTEX_AVERAGE);
|
||||
}
|
||||
/* Vertex Smear brush. */
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Vertex Smear", OB_MODE_VERTEX_GPENCIL);
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_VERTEX_SMEAR);
|
||||
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Vertex Smear", OB_MODE_VERTEX_GPENCIL, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_VERTEX_SMEAR);
|
||||
}
|
||||
/* Vertex Replace brush. */
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Vertex Replace", OB_MODE_VERTEX_GPENCIL);
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_VERTEX_REPLACE);
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Vertex Replace", OB_MODE_VERTEX_GPENCIL, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_VERTEX_REPLACE);
|
||||
}
|
||||
|
||||
/* Set default Vertex brush. */
|
||||
BKE_paint_brush_set(vertexpaint, deft_vertex);
|
||||
}
|
||||
|
||||
/* Create a set of grease pencil Sculpt Paint presets. */
|
||||
void BKE_brush_gpencil_sculpt_presets(Main *bmain, ToolSettings *ts)
|
||||
void BKE_brush_gpencil_sculpt_presets(Main *bmain, ToolSettings *ts, const bool reset)
|
||||
{
|
||||
bool r_new = false;
|
||||
|
||||
Paint *sculptpaint = &ts->gp_sculptpaint->paint;
|
||||
Brush *brush, *deft_sculpt;
|
||||
|
||||
/* Smooth brush. */
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Smooth Stroke", OB_MODE_SCULPT_GPENCIL);
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_SMOOTH_STROKE);
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Smooth Stroke", OB_MODE_SCULPT_GPENCIL, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_SMOOTH_STROKE);
|
||||
}
|
||||
deft_sculpt = brush;
|
||||
|
||||
/* Strength brush. */
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Strength Stroke", OB_MODE_SCULPT_GPENCIL);
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_STRENGTH_STROKE);
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Strength Stroke", OB_MODE_SCULPT_GPENCIL, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_STRENGTH_STROKE);
|
||||
}
|
||||
|
||||
/* Thickness brush. */
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Thickness Stroke", OB_MODE_SCULPT_GPENCIL);
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_THICKNESS_STROKE);
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Thickness Stroke", OB_MODE_SCULPT_GPENCIL, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_THICKNESS_STROKE);
|
||||
}
|
||||
|
||||
/* Grab brush. */
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Grab Stroke", OB_MODE_SCULPT_GPENCIL);
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_GRAB_STROKE);
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Grab Stroke", OB_MODE_SCULPT_GPENCIL, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_GRAB_STROKE);
|
||||
}
|
||||
|
||||
/* Push brush. */
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Push Stroke", OB_MODE_SCULPT_GPENCIL);
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_PUSH_STROKE);
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Push Stroke", OB_MODE_SCULPT_GPENCIL, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_PUSH_STROKE);
|
||||
}
|
||||
|
||||
/* Twist brush. */
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Twist Stroke", OB_MODE_SCULPT_GPENCIL);
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_TWIST_STROKE);
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Twist Stroke", OB_MODE_SCULPT_GPENCIL, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_TWIST_STROKE);
|
||||
}
|
||||
|
||||
/* Pinch brush. */
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Pinch Stroke", OB_MODE_SCULPT_GPENCIL);
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_PINCH_STROKE);
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Pinch Stroke", OB_MODE_SCULPT_GPENCIL, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_PINCH_STROKE);
|
||||
}
|
||||
|
||||
/* Randomize brush. */
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Randomize Stroke", OB_MODE_SCULPT_GPENCIL);
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_RANDOMIZE_STROKE);
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Randomize Stroke", OB_MODE_SCULPT_GPENCIL, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_RANDOMIZE_STROKE);
|
||||
}
|
||||
|
||||
/* Clone brush. */
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Clone Stroke", OB_MODE_SCULPT_GPENCIL);
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_CLONE_STROKE);
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Clone Stroke", OB_MODE_SCULPT_GPENCIL, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_CLONE_STROKE);
|
||||
}
|
||||
|
||||
/* Set default brush. */
|
||||
BKE_paint_brush_set(sculptpaint, deft_sculpt);
|
||||
}
|
||||
|
||||
/* Create a set of grease pencil Weight Paint presets. */
|
||||
void BKE_brush_gpencil_weight_presets(Main *bmain, ToolSettings *ts)
|
||||
void BKE_brush_gpencil_weight_presets(Main *bmain, ToolSettings *ts, const bool reset)
|
||||
{
|
||||
bool r_new = false;
|
||||
|
||||
Paint *weightpaint = &ts->gp_weightpaint->paint;
|
||||
|
||||
Brush *brush, *deft_weight;
|
||||
/* Vertex Draw brush. */
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Draw Weight", OB_MODE_WEIGHT_GPENCIL);
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_DRAW_WEIGHT);
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Draw Weight", OB_MODE_WEIGHT_GPENCIL, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_DRAW_WEIGHT);
|
||||
}
|
||||
deft_weight = brush; /* save default brush. */
|
||||
|
||||
/* Set default brush. */
|
||||
|
|
|
@ -1748,7 +1748,18 @@ void BKE_gpencil_palette_ensure(Main *bmain, Scene *scene)
|
|||
GpPaint *gp_paint = ts->gp_paint;
|
||||
Paint *paint = &gp_paint->paint;
|
||||
|
||||
if (paint->palette != NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
paint->palette = BLI_findstring(&bmain->palettes, "Palette", offsetof(ID, name) + 2);
|
||||
/* Try with first palette. */
|
||||
if (bmain->palettes.first != NULL) {
|
||||
paint->palette = bmain->palettes.first;
|
||||
ts->gp_vertexpaint->paint.palette = paint->palette;
|
||||
return;
|
||||
}
|
||||
|
||||
if (paint->palette == NULL) {
|
||||
paint->palette = BKE_palette_add(bmain, "Palette");
|
||||
ts->gp_vertexpaint->paint.palette = paint->palette;
|
||||
|
|
|
@ -5192,6 +5192,15 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Set Brush default color for grease pencil. */
|
||||
LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
|
||||
if (brush->gpencil_settings) {
|
||||
brush->rgb[0] = 0.498f;
|
||||
brush->rgb[1] = 1.0f;
|
||||
brush->rgb[2] = 0.498f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -463,7 +463,7 @@ void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
|
|||
|
||||
/* Reset all grease pencil brushes. */
|
||||
Scene *scene = bmain->scenes.first;
|
||||
BKE_brush_gpencil_paint_presets(bmain, scene->toolsettings);
|
||||
BKE_brush_gpencil_paint_presets(bmain, scene->toolsettings, true);
|
||||
|
||||
/* Ensure new Paint modes. */
|
||||
BKE_paint_ensure_from_paintmode(scene, PAINT_MODE_VERTEX_GPENCIL);
|
||||
|
|
|
@ -1907,19 +1907,19 @@ static int gp_brush_reset_all_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
|
||||
switch (mode) {
|
||||
case CTX_MODE_PAINT_GPENCIL: {
|
||||
BKE_brush_gpencil_paint_presets(bmain, ts);
|
||||
BKE_brush_gpencil_paint_presets(bmain, ts, true);
|
||||
break;
|
||||
}
|
||||
case CTX_MODE_SCULPT_GPENCIL: {
|
||||
BKE_brush_gpencil_sculpt_presets(bmain, ts);
|
||||
BKE_brush_gpencil_sculpt_presets(bmain, ts, true);
|
||||
break;
|
||||
}
|
||||
case CTX_MODE_WEIGHT_GPENCIL: {
|
||||
BKE_brush_gpencil_weight_presets(bmain, ts);
|
||||
BKE_brush_gpencil_weight_presets(bmain, ts, true);
|
||||
break;
|
||||
}
|
||||
case CTX_MODE_VERTEX_GPENCIL: {
|
||||
BKE_brush_gpencil_vertex_presets(bmain, ts);
|
||||
BKE_brush_gpencil_vertex_presets(bmain, ts, true);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
|
|
|
@ -354,6 +354,10 @@ static int gpencil_paintmode_toggle_exec(bContext *C, wmOperator *op)
|
|||
/* set mode */
|
||||
if (gpd->flag & GP_DATA_STROKE_PAINTMODE) {
|
||||
mode = OB_MODE_PAINT_GPENCIL;
|
||||
BKE_brush_gpencil_paint_presets(bmain, ts, false);
|
||||
|
||||
/* Ensure Palette by default. */
|
||||
BKE_gpencil_palette_ensure(bmain, CTX_data_scene(C));
|
||||
}
|
||||
else {
|
||||
mode = OB_MODE_OBJECT;
|
||||
|
@ -374,7 +378,7 @@ static int gpencil_paintmode_toggle_exec(bContext *C, wmOperator *op)
|
|||
Paint *paint = &ts->gp_paint->paint;
|
||||
/* if not exist, create a new one */
|
||||
if ((paint->brush == NULL) || (paint->brush->gpencil_settings == NULL)) {
|
||||
BKE_brush_gpencil_paint_presets(bmain, ts);
|
||||
BKE_brush_gpencil_paint_presets(bmain, ts, true);
|
||||
}
|
||||
BKE_paint_toolslots_brush_validate(bmain, &ts->gp_paint->paint);
|
||||
}
|
||||
|
@ -462,6 +466,7 @@ static int gpencil_sculptmode_toggle_exec(bContext *C, wmOperator *op)
|
|||
/* set mode */
|
||||
if (gpd->flag & GP_DATA_STROKE_SCULPTMODE) {
|
||||
mode = OB_MODE_SCULPT_GPENCIL;
|
||||
BKE_brush_gpencil_sculpt_presets(bmain, ts, false);
|
||||
}
|
||||
else {
|
||||
mode = OB_MODE_OBJECT;
|
||||
|
@ -567,6 +572,7 @@ static int gpencil_weightmode_toggle_exec(bContext *C, wmOperator *op)
|
|||
/* set mode */
|
||||
if (gpd->flag & GP_DATA_STROKE_WEIGHTMODE) {
|
||||
mode = OB_MODE_WEIGHT_GPENCIL;
|
||||
BKE_brush_gpencil_weight_presets(bmain, ts, false);
|
||||
}
|
||||
else {
|
||||
mode = OB_MODE_OBJECT;
|
||||
|
@ -669,6 +675,10 @@ static int gpencil_vertexmode_toggle_exec(bContext *C, wmOperator *op)
|
|||
/* set mode */
|
||||
if (gpd->flag & GP_DATA_STROKE_VERTEXMODE) {
|
||||
mode = OB_MODE_VERTEX_GPENCIL;
|
||||
BKE_brush_gpencil_vertex_presets(bmain, ts, false);
|
||||
|
||||
/* Ensure Palette by default. */
|
||||
BKE_gpencil_palette_ensure(bmain, CTX_data_scene(C));
|
||||
}
|
||||
else {
|
||||
mode = OB_MODE_OBJECT;
|
||||
|
|
|
@ -117,7 +117,7 @@ static bGPDstroke *gpencil_prepare_stroke(bContext *C, wmOperator *op, int totpo
|
|||
/* if not exist, create a new one */
|
||||
if ((paint->brush == NULL) || (paint->brush->gpencil_settings == NULL)) {
|
||||
/* create new brushes */
|
||||
BKE_brush_gpencil_paint_presets(bmain, ts);
|
||||
BKE_brush_gpencil_paint_presets(bmain, ts, false);
|
||||
}
|
||||
Brush *brush = paint->brush;
|
||||
|
||||
|
|
|
@ -1814,7 +1814,7 @@ static void gp_init_drawing_brush(bContext *C, tGPsdata *p)
|
|||
/* if not exist, create a new one */
|
||||
if ((paint->brush == NULL) || (paint->brush->gpencil_settings == NULL)) {
|
||||
/* create new brushes */
|
||||
BKE_brush_gpencil_paint_presets(bmain, ts);
|
||||
BKE_brush_gpencil_paint_presets(bmain, ts, true);
|
||||
changed = true;
|
||||
}
|
||||
/* Be sure curves are initializated. */
|
||||
|
|
|
@ -1178,7 +1178,7 @@ static void gpencil_primitive_init(bContext *C, wmOperator *op)
|
|||
|
||||
/* if brush doesn't exist, create a new set (fix damaged files from old versions) */
|
||||
if ((paint->brush == NULL) || (paint->brush->gpencil_settings == NULL)) {
|
||||
BKE_brush_gpencil_paint_presets(bmain, ts);
|
||||
BKE_brush_gpencil_paint_presets(bmain, ts, true);
|
||||
}
|
||||
|
||||
/* Set Draw brush. */
|
||||
|
|
|
@ -1365,7 +1365,7 @@ void ED_gpencil_add_defaults(bContext *C, Object *ob)
|
|||
/* if not exist, create a new one */
|
||||
if ((paint->brush == NULL) || (paint->brush->gpencil_settings == NULL)) {
|
||||
/* create new brushes */
|
||||
BKE_brush_gpencil_paint_presets(bmain, ts);
|
||||
BKE_brush_gpencil_paint_presets(bmain, ts, true);
|
||||
}
|
||||
|
||||
/* ensure a color exists and is assigned to object */
|
||||
|
|
Loading…
Reference in New Issue