Cleanup: reserve "r_" prefix for return arguments
This commit is contained in:
parent
0ce1102147
commit
9a7b767226
@ -1346,9 +1346,9 @@ 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, bool *r_new)
|
||||
Main *bmain, ToolSettings *ts, const char *brush_name, eObjectMode mode, bool *r_is_new)
|
||||
{
|
||||
*r_new = false;
|
||||
*r_is_new = false;
|
||||
Brush *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. */
|
||||
@ -1358,7 +1358,7 @@ static Brush *gpencil_brush_ensure(
|
||||
|
||||
if (brush == nullptr) {
|
||||
brush = BKE_brush_add_gpencil(bmain, ts, brush_name, mode);
|
||||
*r_new = true;
|
||||
*r_is_new = true;
|
||||
}
|
||||
|
||||
if (brush->gpencil_settings == nullptr) {
|
||||
@ -1370,93 +1370,93 @@ static Brush *gpencil_brush_ensure(
|
||||
|
||||
void BKE_brush_gpencil_paint_presets(Main *bmain, ToolSettings *ts, const bool reset)
|
||||
{
|
||||
bool r_new = false;
|
||||
bool is_new = false;
|
||||
|
||||
Paint *paint = &ts->gp_paint->paint;
|
||||
Brush *brush_prev = paint->brush;
|
||||
Brush *brush, *deft_draw;
|
||||
/* Airbrush brush. */
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Airbrush", OB_MODE_PAINT_GPENCIL_LEGACY, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Airbrush", OB_MODE_PAINT_GPENCIL_LEGACY, &is_new);
|
||||
if ((reset) || (is_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_LEGACY, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Ink Pen", OB_MODE_PAINT_GPENCIL_LEGACY, &is_new);
|
||||
if ((reset) || (is_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_LEGACY, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Ink Pen Rough", OB_MODE_PAINT_GPENCIL_LEGACY, &is_new);
|
||||
if ((reset) || (is_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_LEGACY, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Marker Bold", OB_MODE_PAINT_GPENCIL_LEGACY, &is_new);
|
||||
if ((reset) || (is_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_LEGACY, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Marker Chisel", OB_MODE_PAINT_GPENCIL_LEGACY, &is_new);
|
||||
if ((reset) || (is_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_LEGACY, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Pen", OB_MODE_PAINT_GPENCIL_LEGACY, &is_new);
|
||||
if ((reset) || (is_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_LEGACY, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Pencil Soft", OB_MODE_PAINT_GPENCIL_LEGACY, &is_new);
|
||||
if ((reset) || (is_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_LEGACY, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Pencil", OB_MODE_PAINT_GPENCIL_LEGACY, &is_new);
|
||||
if ((reset) || (is_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_LEGACY, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Fill Area", OB_MODE_PAINT_GPENCIL_LEGACY, &is_new);
|
||||
if ((reset) || (is_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_LEGACY, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Eraser Soft", OB_MODE_PAINT_GPENCIL_LEGACY, &is_new);
|
||||
if ((reset) || (is_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_LEGACY, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Eraser Hard", OB_MODE_PAINT_GPENCIL_LEGACY, &is_new);
|
||||
if ((reset) || (is_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_LEGACY, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Eraser Point", OB_MODE_PAINT_GPENCIL_LEGACY, &is_new);
|
||||
if ((reset) || (is_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_LEGACY, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Eraser Stroke", OB_MODE_PAINT_GPENCIL_LEGACY, &is_new);
|
||||
if ((reset) || (is_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_LEGACY, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Tint", OB_MODE_PAINT_GPENCIL_LEGACY, &is_new);
|
||||
if ((reset) || (is_new)) {
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_TINT);
|
||||
}
|
||||
|
||||
@ -1471,36 +1471,38 @@ void BKE_brush_gpencil_paint_presets(Main *bmain, ToolSettings *ts, const bool r
|
||||
|
||||
void BKE_brush_gpencil_vertex_presets(Main *bmain, ToolSettings *ts, const bool reset)
|
||||
{
|
||||
bool r_new = false;
|
||||
bool is_new = false;
|
||||
|
||||
Paint *vertexpaint = &ts->gp_vertexpaint->paint;
|
||||
Brush *brush_prev = vertexpaint->brush;
|
||||
Brush *brush, *deft_vertex;
|
||||
/* Vertex Draw brush. */
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Vertex Draw", OB_MODE_VERTEX_GPENCIL_LEGACY, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Vertex Draw", OB_MODE_VERTEX_GPENCIL_LEGACY, &is_new);
|
||||
if ((reset) || (is_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_LEGACY, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Vertex Blur", OB_MODE_VERTEX_GPENCIL_LEGACY, &is_new);
|
||||
if ((reset) || (is_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_LEGACY, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
brush = gpencil_brush_ensure(
|
||||
bmain, ts, "Vertex Average", OB_MODE_VERTEX_GPENCIL_LEGACY, &is_new);
|
||||
if ((reset) || (is_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_LEGACY, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Vertex Smear", OB_MODE_VERTEX_GPENCIL_LEGACY, &is_new);
|
||||
if ((reset) || (is_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_LEGACY, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
brush = gpencil_brush_ensure(
|
||||
bmain, ts, "Vertex Replace", OB_MODE_VERTEX_GPENCIL_LEGACY, &is_new);
|
||||
if ((reset) || (is_new)) {
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_VERTEX_REPLACE);
|
||||
}
|
||||
|
||||
@ -1517,67 +1519,67 @@ void BKE_brush_gpencil_vertex_presets(Main *bmain, ToolSettings *ts, const bool
|
||||
|
||||
void BKE_brush_gpencil_sculpt_presets(Main *bmain, ToolSettings *ts, const bool reset)
|
||||
{
|
||||
bool r_new = false;
|
||||
bool is_new = false;
|
||||
|
||||
Paint *sculptpaint = &ts->gp_sculptpaint->paint;
|
||||
Brush *brush_prev = sculptpaint->brush;
|
||||
Brush *brush, *deft_sculpt;
|
||||
|
||||
/* Smooth brush. */
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Smooth Stroke", OB_MODE_SCULPT_GPENCIL_LEGACY, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Smooth Stroke", OB_MODE_SCULPT_GPENCIL_LEGACY, &is_new);
|
||||
if ((reset) || (is_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_LEGACY, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
bmain, ts, "Strength Stroke", OB_MODE_SCULPT_GPENCIL_LEGACY, &is_new);
|
||||
if ((reset) || (is_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_LEGACY, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
bmain, ts, "Thickness Stroke", OB_MODE_SCULPT_GPENCIL_LEGACY, &is_new);
|
||||
if ((reset) || (is_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_LEGACY, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Grab Stroke", OB_MODE_SCULPT_GPENCIL_LEGACY, &is_new);
|
||||
if ((reset) || (is_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_LEGACY, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Push Stroke", OB_MODE_SCULPT_GPENCIL_LEGACY, &is_new);
|
||||
if ((reset) || (is_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_LEGACY, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Twist Stroke", OB_MODE_SCULPT_GPENCIL_LEGACY, &is_new);
|
||||
if ((reset) || (is_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_LEGACY, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Pinch Stroke", OB_MODE_SCULPT_GPENCIL_LEGACY, &is_new);
|
||||
if ((reset) || (is_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_LEGACY, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
bmain, ts, "Randomize Stroke", OB_MODE_SCULPT_GPENCIL_LEGACY, &is_new);
|
||||
if ((reset) || (is_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_LEGACY, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Clone Stroke", OB_MODE_SCULPT_GPENCIL_LEGACY, &is_new);
|
||||
if ((reset) || (is_new)) {
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_CLONE_STROKE);
|
||||
}
|
||||
|
||||
@ -1594,34 +1596,35 @@ void BKE_brush_gpencil_sculpt_presets(Main *bmain, ToolSettings *ts, const bool
|
||||
|
||||
void BKE_brush_gpencil_weight_presets(Main *bmain, ToolSettings *ts, const bool reset)
|
||||
{
|
||||
bool r_new = false;
|
||||
bool is_new = false;
|
||||
|
||||
Paint *weightpaint = &ts->gp_weightpaint->paint;
|
||||
Brush *brush_prev = weightpaint->brush;
|
||||
Brush *brush, *deft_weight;
|
||||
|
||||
/* Weight Draw brush. */
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Weight Draw", OB_MODE_WEIGHT_GPENCIL_LEGACY, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Weight Draw", OB_MODE_WEIGHT_GPENCIL_LEGACY, &is_new);
|
||||
if ((reset) || (is_new)) {
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_WEIGHT_DRAW);
|
||||
}
|
||||
deft_weight = brush; /* save default brush. */
|
||||
|
||||
/* Weight Blur brush. */
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Weight Blur", OB_MODE_WEIGHT_GPENCIL_LEGACY, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Weight Blur", OB_MODE_WEIGHT_GPENCIL_LEGACY, &is_new);
|
||||
if ((reset) || (is_new)) {
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_WEIGHT_BLUR);
|
||||
}
|
||||
|
||||
/* Weight Average brush. */
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Weight Average", OB_MODE_WEIGHT_GPENCIL_LEGACY, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
brush = gpencil_brush_ensure(
|
||||
bmain, ts, "Weight Average", OB_MODE_WEIGHT_GPENCIL_LEGACY, &is_new);
|
||||
if ((reset) || (is_new)) {
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_WEIGHT_AVERAGE);
|
||||
}
|
||||
|
||||
/* Weight Smear brush. */
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Weight Smear", OB_MODE_WEIGHT_GPENCIL_LEGACY, &r_new);
|
||||
if ((reset) || (r_new)) {
|
||||
brush = gpencil_brush_ensure(bmain, ts, "Weight Smear", OB_MODE_WEIGHT_GPENCIL_LEGACY, &is_new);
|
||||
if ((reset) || (is_new)) {
|
||||
BKE_gpencil_brush_preset_set(bmain, brush, GP_BRUSH_PRESET_WEIGHT_SMEAR);
|
||||
}
|
||||
|
||||
|
@ -142,9 +142,9 @@ static Material *gpencil_add_from_curve_material(Main *bmain,
|
||||
const float fill_color[4],
|
||||
const bool stroke,
|
||||
const bool fill,
|
||||
int *r_idx)
|
||||
int *r_index)
|
||||
{
|
||||
Material *mat_gp = BKE_gpencil_object_material_new(bmain, ob_gp, "Material", r_idx);
|
||||
Material *mat_gp = BKE_gpencil_object_material_new(bmain, ob_gp, "Material", r_index);
|
||||
MaterialGPencilStyle *gp_style = mat_gp->gp_style;
|
||||
|
||||
/* Stroke color. */
|
||||
@ -267,12 +267,12 @@ static int gpencil_get_stroke_material_fromcurve(
|
||||
copy_v4_v4(color_fill, &mat_curve_fill->r);
|
||||
}
|
||||
|
||||
int r_idx = gpencil_check_same_material_color(
|
||||
int index = gpencil_check_same_material_color(
|
||||
ob_gp, color_stroke, color_fill, *r_do_stroke, *r_do_fill, &mat_gp);
|
||||
|
||||
if ((ob_gp->totcol < r_idx) || (r_idx < 0)) {
|
||||
if ((ob_gp->totcol < index) || (index < 0)) {
|
||||
mat_gp = gpencil_add_from_curve_material(
|
||||
bmain, ob_gp, color_stroke, color_fill, *r_do_stroke, *r_do_fill, &r_idx);
|
||||
bmain, ob_gp, color_stroke, color_fill, *r_do_stroke, *r_do_fill, &index);
|
||||
}
|
||||
|
||||
/* Set fill and stroke depending of curve type (3D or 2D). */
|
||||
@ -285,7 +285,7 @@ static int gpencil_get_stroke_material_fromcurve(
|
||||
mat_gp->gp_style->flag |= GP_MATERIAL_FILL_SHOW;
|
||||
}
|
||||
|
||||
return r_idx;
|
||||
return index;
|
||||
}
|
||||
|
||||
/* Helper: Convert one spline to grease pencil stroke. */
|
||||
@ -333,11 +333,11 @@ static void gpencil_convert_spline(Main *bmain,
|
||||
* Notice: The color of the material is the color of viewport and not the final shader color.
|
||||
*/
|
||||
bool do_stroke, do_fill;
|
||||
int r_idx = gpencil_get_stroke_material_fromcurve(bmain, ob_gp, ob_cu, &do_stroke, &do_fill);
|
||||
CLAMP_MIN(r_idx, 0);
|
||||
int index = gpencil_get_stroke_material_fromcurve(bmain, ob_gp, ob_cu, &do_stroke, &do_fill);
|
||||
CLAMP_MIN(index, 0);
|
||||
|
||||
/* Assign material index to stroke. */
|
||||
gps->mat_nr = r_idx;
|
||||
gps->mat_nr = index;
|
||||
|
||||
/* Add stroke to frame. */
|
||||
BLI_addtail(&gpf->strokes, gps);
|
||||
|
@ -749,21 +749,21 @@ static uint get_material_type(MaterialGPencilStyle *gp_style,
|
||||
char *name,
|
||||
size_t name_maxncpy)
|
||||
{
|
||||
uint r_i = 0;
|
||||
uint i = 0;
|
||||
if ((use_stroke) && (use_fill)) {
|
||||
switch (gp_style->mode) {
|
||||
case GP_MATERIAL_MODE_LINE: {
|
||||
r_i = 1;
|
||||
i = 1;
|
||||
BLI_strncpy(name, "Line Stroke-Fill", name_maxncpy);
|
||||
break;
|
||||
}
|
||||
case GP_MATERIAL_MODE_DOT: {
|
||||
r_i = 2;
|
||||
i = 2;
|
||||
BLI_strncpy(name, "Dots Stroke-Fill", name_maxncpy);
|
||||
break;
|
||||
}
|
||||
case GP_MATERIAL_MODE_SQUARE: {
|
||||
r_i = 3;
|
||||
i = 3;
|
||||
BLI_strncpy(name, "Squares Stroke-Fill", name_maxncpy);
|
||||
break;
|
||||
}
|
||||
@ -774,17 +774,17 @@ static uint get_material_type(MaterialGPencilStyle *gp_style,
|
||||
else if (use_stroke) {
|
||||
switch (gp_style->mode) {
|
||||
case GP_MATERIAL_MODE_LINE: {
|
||||
r_i = 4;
|
||||
i = 4;
|
||||
BLI_strncpy(name, "Line Stroke", name_maxncpy);
|
||||
break;
|
||||
}
|
||||
case GP_MATERIAL_MODE_DOT: {
|
||||
r_i = 5;
|
||||
i = 5;
|
||||
BLI_strncpy(name, "Dots Stroke", name_maxncpy);
|
||||
break;
|
||||
}
|
||||
case GP_MATERIAL_MODE_SQUARE: {
|
||||
r_i = 6;
|
||||
i = 6;
|
||||
BLI_strncpy(name, "Squares Stroke", name_maxncpy);
|
||||
break;
|
||||
}
|
||||
@ -793,20 +793,20 @@ static uint get_material_type(MaterialGPencilStyle *gp_style,
|
||||
}
|
||||
}
|
||||
else {
|
||||
r_i = 7;
|
||||
i = 7;
|
||||
BLI_strncpy(name, "Solid Fill", name_maxncpy);
|
||||
}
|
||||
|
||||
/* Create key TSSSSFFFF (T: Type S: Stroke Alpha F: Fill Alpha) */
|
||||
r_i *= 1e8;
|
||||
i *= 1e8;
|
||||
if (use_stroke) {
|
||||
r_i += gp_style->stroke_rgba[3] * 1e7;
|
||||
i += gp_style->stroke_rgba[3] * 1e7;
|
||||
}
|
||||
if (use_fill) {
|
||||
r_i += gp_style->fill_rgba[3] * 1e3;
|
||||
i += gp_style->fill_rgba[3] * 1e3;
|
||||
}
|
||||
|
||||
return r_i;
|
||||
return i;
|
||||
}
|
||||
|
||||
static bool gpencil_material_to_vertex_poll(bContext *C)
|
||||
|
@ -76,11 +76,11 @@ int OBJCurve::total_spline_control_points(const int spline_index) const
|
||||
int degree = nurb->type == CU_POLY ? 1 : nurb->orderu - 1;
|
||||
/* Total control points = Number of points in the curve (+ degree of the
|
||||
* curve if it is cyclic). */
|
||||
int r_tot_control_points = nurb->pntsv * nurb->pntsu;
|
||||
int tot_control_points = nurb->pntsv * nurb->pntsu;
|
||||
if (nurb->flagu & CU_NURB_CYCLIC) {
|
||||
r_tot_control_points += degree;
|
||||
tot_control_points += degree;
|
||||
}
|
||||
return r_tot_control_points;
|
||||
return tot_control_points;
|
||||
}
|
||||
|
||||
int OBJCurve::get_nurbs_degree(const int spline_index) const
|
||||
|
Loading…
Reference in New Issue
Block a user