GPencil: Spread option removed
This was an experimental feature and the result is not what we expected.
This commit is contained in:
@@ -1653,9 +1653,6 @@ class VIEW3D_PT_tools_grease_pencil_brush_random(View3DPanel, Panel):
|
||||
col.template_curve_mapping(gp_settings, "curve_jitter", brush=True,
|
||||
use_negative_slope=True)
|
||||
|
||||
row = col.row(align=True)
|
||||
row.prop(gp_settings, "pen_spread")
|
||||
|
||||
|
||||
class VIEW3D_PT_tools_grease_pencil_brush_paint_falloff(GreasePencilBrushFalloff, Panel, View3DPaintPanel):
|
||||
bl_context = ".greasepencil_paint"
|
||||
|
@@ -912,11 +912,6 @@ static short gpencil_stroke_addpoint(tGPsdata *p,
|
||||
}
|
||||
}
|
||||
|
||||
/* Spread points. */
|
||||
if (brush_settings->flag & GP_BRUSH_GROUP_RANDOM) {
|
||||
ED_gpencil_stroke_buffer_spread(brush, &p->gsc);
|
||||
}
|
||||
|
||||
/* Update evaluated data. */
|
||||
ED_gpencil_sbuffer_update_eval(gpd, p->ob_eval);
|
||||
|
||||
@@ -3789,9 +3784,6 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
for (int r = 0; r < 5; r++) {
|
||||
gpencil_smooth_segment(p->gpd, 0.15f, size_before - 1, size_after - 1);
|
||||
}
|
||||
/* Spread the points if needed. */
|
||||
ED_gpencil_stroke_buffer_spread_segment(
|
||||
p->brush, &p->gsc, size_before - 1, size_after - 1);
|
||||
}
|
||||
|
||||
/* finish painting operation if anything went wrong just now */
|
||||
|
@@ -3402,88 +3402,3 @@ static void gpencil_copy_buffer_point(tGPspoint *pt_from, tGPspoint *pt_dst)
|
||||
pt_dst->rnd_dirty = pt_from->rnd_dirty;
|
||||
copy_v4_v4(pt_dst->vert_color, pt_from->vert_color);
|
||||
}
|
||||
|
||||
/**
|
||||
* Spread last buffer point to get more topology
|
||||
* @param brush Current brush
|
||||
* @param gpd Current datablock
|
||||
*/
|
||||
void ED_gpencil_stroke_buffer_spread(Brush *brush, GP_SpaceConversion *gsc)
|
||||
{
|
||||
bGPdata *gpd = gsc->gpd;
|
||||
const int spread = brush->gpencil_settings->draw_spread;
|
||||
if (spread == 0) {
|
||||
return;
|
||||
}
|
||||
const int last_index = gpd->runtime.sbuffer_used - 1;
|
||||
|
||||
/* Increase the buffer size to hold the new points.
|
||||
* As the function add 1, add only spread point minus 1. */
|
||||
gpd->runtime.sbuffer_used += spread - 1;
|
||||
gpd->runtime.sbuffer = ED_gpencil_sbuffer_ensure(
|
||||
gpd->runtime.sbuffer, &gpd->runtime.sbuffer_size, &gpd->runtime.sbuffer_used, false);
|
||||
/* Increment counters after expand buffer. */
|
||||
gpd->runtime.sbuffer_used++;
|
||||
|
||||
/* Duplicate las point to the new point. */
|
||||
tGPspoint *pt_orig = ((tGPspoint *)(gpd->runtime.sbuffer) + last_index);
|
||||
for (int i = 0; i < spread; i++) {
|
||||
tGPspoint *pt = ((tGPspoint *)(gpd->runtime.sbuffer) + last_index + i + 1);
|
||||
gpencil_copy_buffer_point(pt_orig, pt);
|
||||
}
|
||||
/* Spread the points. */
|
||||
gpencil_spread_points(brush, gsc, spread, last_index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Spread a segment of buffer points to get more topology.
|
||||
* This function assumes the segment is at the end of the stroke.
|
||||
*
|
||||
* @param brush Current brush
|
||||
* @param gpd Current datablock
|
||||
* @param from_index Index of the first point to spread
|
||||
* @param to_index Index of the last point to spread
|
||||
*/
|
||||
void ED_gpencil_stroke_buffer_spread_segment(struct Brush *brush,
|
||||
struct GP_SpaceConversion *gsc,
|
||||
int from_index,
|
||||
int to_index)
|
||||
{
|
||||
bGPdata *gpd = gsc->gpd;
|
||||
const int spread = brush->gpencil_settings->draw_spread;
|
||||
if (spread == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const int totpoints = to_index - from_index - 1;
|
||||
|
||||
/* Increase the buffer size to hold the new points.
|
||||
* As the function add 1, add only spread point minus 1. */
|
||||
gpd->runtime.sbuffer_used += (spread * totpoints) - 1;
|
||||
gpd->runtime.sbuffer = ED_gpencil_sbuffer_ensure(
|
||||
gpd->runtime.sbuffer, &gpd->runtime.sbuffer_size, &gpd->runtime.sbuffer_used, false);
|
||||
/* Increment counters after expand buffer. */
|
||||
gpd->runtime.sbuffer_used++;
|
||||
|
||||
/* Move original points to the right index depending of spread value. */
|
||||
int step = spread + 1;
|
||||
int offset = gpd->runtime.sbuffer_used - 1;
|
||||
for (int i = totpoints; i > 0; i--) {
|
||||
tGPspoint *pt_orig = ((tGPspoint *)(gpd->runtime.sbuffer) + from_index + i + 1);
|
||||
tGPspoint *pt_dst = ((tGPspoint *)(gpd->runtime.sbuffer) + offset);
|
||||
gpencil_copy_buffer_point(pt_orig, pt_dst);
|
||||
offset -= step;
|
||||
}
|
||||
|
||||
/* Copy each point to its segment. */
|
||||
for (int i = 0; i < totpoints; i++) {
|
||||
int idx = from_index + (step * i) + 1;
|
||||
tGPspoint *pt_orig = ((tGPspoint *)(gpd->runtime.sbuffer) + idx);
|
||||
for (int x = 0; x < spread; x++) {
|
||||
tGPspoint *pt_dst = ((tGPspoint *)(gpd->runtime.sbuffer) + idx + x + 1);
|
||||
gpencil_copy_buffer_point(pt_orig, pt_dst);
|
||||
}
|
||||
/* Spread the points. */
|
||||
gpencil_spread_points(brush, gsc, spread, idx);
|
||||
}
|
||||
}
|
||||
|
@@ -367,12 +367,6 @@ bool ED_gpencil_stroke_point_is_inside(struct bGPDstroke *gps,
|
||||
int mouse[2],
|
||||
const float diff_mat[4][4]);
|
||||
|
||||
void ED_gpencil_stroke_buffer_spread(struct Brush *brush, struct GP_SpaceConversion *gsc);
|
||||
void ED_gpencil_stroke_buffer_spread_segment(struct Brush *brush,
|
||||
struct GP_SpaceConversion *gsc,
|
||||
int from_index,
|
||||
int to_index);
|
||||
|
||||
struct bGPDstroke *ED_gpencil_stroke_nearest_to_ends(struct bContext *C,
|
||||
struct GP_SpaceConversion *gsc,
|
||||
struct bGPDlayer *gpl,
|
||||
|
@@ -50,8 +50,7 @@ typedef struct BrushClone {
|
||||
typedef struct BrushGpencilSettings {
|
||||
/** Amount of smoothing to apply to newly created strokes. */
|
||||
float draw_smoothfac;
|
||||
/** Spread of points to increase topology density. */
|
||||
int draw_spread;
|
||||
char _pad2[4];
|
||||
/** Amount of alpha strength to apply to newly created strokes. */
|
||||
float draw_strength;
|
||||
/** Amount of jitter to apply to newly created strokes. */
|
||||
|
@@ -1304,14 +1304,6 @@ static void rna_def_gpencil_options(BlenderRNA *brna)
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
|
||||
|
||||
/* Spread value. */
|
||||
prop = RNA_def_property(srna, "pen_spread", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "draw_spread");
|
||||
RNA_def_property_range(prop, 0, 8);
|
||||
RNA_def_property_ui_text(prop, "Spread", "Number of points spread by point");
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
|
||||
|
||||
/* Randomnes factor for pressure */
|
||||
prop = RNA_def_property(srna, "random_pressure", PROP_FLOAT, PROP_FACTOR);
|
||||
RNA_def_property_float_sdna(prop, NULL, "draw_random_press");
|
||||
|
Reference in New Issue
Block a user