[Bf-blender-cvs] [04e2dd49dd7] greasepencil-object: GPencil: Spread option removed
Antonio Vazquez
noreply at git.blender.org
Thu Jan 14 15:10:29 CET 2021
Commit: 04e2dd49dd7d5aa50b3d9a394aba63dfb1ebab16
Author: Antonio Vazquez
Date: Thu Jan 14 15:09:42 2021 +0100
Branches: greasepencil-object
https://developer.blender.org/rB04e2dd49dd7d5aa50b3d9a394aba63dfb1ebab16
GPencil: Spread option removed
This was an experimental feature and the result is not what we expected.
===================================================================
M release/scripts/startup/bl_ui/space_view3d_toolbar.py
M source/blender/editors/gpencil/gpencil_paint.c
M source/blender/editors/gpencil/gpencil_utils.c
M source/blender/editors/include/ED_gpencil.h
M source/blender/makesdna/DNA_brush_types.h
M source/blender/makesrna/intern/rna_brush.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index ecee4be3c79..577f9678a62 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -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"
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 59af210922d..14313a50118 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -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 */
diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index 7886455a4a3..9bc6661c2e0 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -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);
- }
-}
diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h
index 509b0ae0ad1..1b7caf27ecf 100644
--- a/source/blender/editors/include/ED_gpencil.h
+++ b/source/blender/editors/include/ED_gpencil.h
@@ -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,
diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h
index 7fcf30555d9..4b020019062 100644
--- a/source/blender/makesdna/DNA_brush_types.h
+++ b/source/blender/makesdna/DNA_brush_types.h
@@ -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. */
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 2bda7acf792..2af6c04147c 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -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");
More information about the Bf-blender-cvs
mailing list