[Bf-blender-cvs] [0c96ae67247] lanpr-under-gp: LineArt: Pre-sample in the modifier.
YimingWu
noreply at git.blender.org
Sun Jul 26 06:07:50 CEST 2020
Commit: 0c96ae67247f852c10977c71c6b960ea485aa328
Author: YimingWu
Date: Sun Jul 26 12:07:24 2020 +0800
Branches: lanpr-under-gp
https://developer.blender.org/rB0c96ae67247f852c10977c71c6b960ea485aa328
LineArt: Pre-sample in the modifier.
===================================================================
M source/blender/editors/include/ED_lineart.h
M source/blender/editors/lineart/lineart_cpu.c
M source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
M source/blender/makesdna/DNA_gpencil_modifier_types.h
M source/blender/makesdna/DNA_scene_types.h
M source/blender/makesrna/intern/rna_gpencil_modifier.c
===================================================================
diff --git a/source/blender/editors/include/ED_lineart.h b/source/blender/editors/include/ED_lineart.h
index d27bf2bfabf..408959a843a 100644
--- a/source/blender/editors/include/ED_lineart.h
+++ b/source/blender/editors/include/ED_lineart.h
@@ -525,7 +525,8 @@ void ED_lineart_gpencil_generate_from_chain(struct Depsgraph *depsgraph,
struct Collection *col,
int types,
short thickness,
- float opacity);
+ float opacity,
+ float pre_sample_length);
void ED_lineart_gpencil_generate_strokes_direct(struct Depsgraph *depsgraph,
struct Object *ob,
struct bGPDlayer *gpl,
@@ -537,7 +538,8 @@ void ED_lineart_gpencil_generate_strokes_direct(struct Depsgraph *depsgraph,
int mat_nr,
short line_types,
short thickness,
- float opacity);
+ float opacity,
+ float pre_sample_length);
struct bContext;
diff --git a/source/blender/editors/lineart/lineart_cpu.c b/source/blender/editors/lineart/lineart_cpu.c
index 88246260009..208c098f863 100644
--- a/source/blender/editors/lineart/lineart_cpu.c
+++ b/source/blender/editors/lineart/lineart_cpu.c
@@ -3626,7 +3626,8 @@ void ED_lineart_gpencil_generate_from_chain(Depsgraph *depsgraph,
Collection *col,
int types,
short thickness,
- float opacity)
+ float opacity,
+ float pre_sample_length)
{
LineartRenderBuffer *rb = lineart_share.render_buffer_shared;
@@ -3710,6 +3711,9 @@ void ED_lineart_gpencil_generate_from_chain(Depsgraph *depsgraph,
BKE_gpencil_stroke_add_points(gps, stroke_data, count, mat);
gps->mat_nr = material_nr;
+ if (pre_sample_length > 0.0001) {
+ BKE_gpencil_stroke_sample(gps, pre_sample_length, false);
+ }
if (G.debug_value == 4000) {
BKE_gpencil_stroke_set_random_color(gps);
}
@@ -3752,7 +3756,8 @@ void ED_lineart_gpencil_generate_strokes_direct(Depsgraph *depsgraph,
int mat_nr,
short line_types,
short thickness,
- float opacity)
+ float opacity,
+ float pre_sample_length)
{
if (!gpl || !gpf || !source_reference || !ob) {
@@ -3781,7 +3786,8 @@ void ED_lineart_gpencil_generate_strokes_direct(Depsgraph *depsgraph,
source_collection,
use_types,
thickness,
- opacity);
+ opacity,
+ pre_sample_length);
}
static int lineart_gpencil_update_strokes_exec(bContext *C, wmOperator *UNUSED(op))
@@ -3878,7 +3884,8 @@ static int lineart_gpencil_bake_strokes_exec(bContext *C, wmOperator *UNUSED(op)
0,
lmd->line_types,
lmd->thickness,
- lmd->opacity);
+ lmd->opacity,
+ lmd->pre_sample_length);
}
}
}
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
index fdadaf91077..ea471e592a0 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
@@ -102,7 +102,8 @@ static void generate_strokes_actual(
lmd->target_material ? BKE_gpencil_object_material_index_get(ob, lmd->target_material) : 0,
lmd->line_types,
lmd->thickness,
- lmd->opacity);
+ lmd->opacity,
+ lmd->pre_sample_length);
}
static bool isModifierDisabled(GpencilModifierData *md)
@@ -355,6 +356,8 @@ static void occlusion_panel_draw(const bContext *C, Panel *panel)
uiItemR(layout, &ptr, "thickness", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(layout, &ptr, "opacity", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
+ uiItemR(layout, &ptr, "pre_sample_length", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
+
bool use_multiple_levels = RNA_boolean_get(&ptr, "use_multiple_levels");
uiItemR(layout, &ptr, "use_multiple_levels", 0, "Multiple Levels", ICON_NONE);
diff --git a/source/blender/makesdna/DNA_gpencil_modifier_types.h b/source/blender/makesdna/DNA_gpencil_modifier_types.h
index 11f2d03498d..22e3d266fcc 100644
--- a/source/blender/makesdna/DNA_gpencil_modifier_types.h
+++ b/source/blender/makesdna/DNA_gpencil_modifier_types.h
@@ -828,6 +828,9 @@ typedef struct LineartGpencilModifierData {
short thickness;
short _pad;
+ float pre_sample_length;
+ int _pad2;
+
} LineartGpencilModifierData;
#endif /* __DNA_GPENCIL_MODIFIER_TYPES_H__ */
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 39b822726c7..a67009ee6d2 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1717,15 +1717,22 @@ typedef enum eLineartMainFlags {
typedef struct SceneLineart {
int flags;
- /* line_types is used to select line types in global scope, especially when Fuzzy chaining is
+ /** line_types is used to select line types in global scope, especially when Fuzzy chaining is
* enabled. See DNA_lineart_types.h for edge flags.
*/
int line_types;
- /* shared */
+ /* Shared */
+ /** Reserved for suggestive contour */
+ float contour_fade;
- float contour_fade; /* for dpix contour fading,reserved for future usage */
- float crease_threshold; /* 0-1 range for cosine angle */
+ /** 0-1 range for cosine angle */
+ float crease_threshold;
+
+ int _pad;
+
+ /** cosine angle, for splitting strokes at sharp points */
+ float separation_angle;
/* CPU mode */
float chaining_geometry_threshold;
diff --git a/source/blender/makesrna/intern/rna_gpencil_modifier.c b/source/blender/makesrna/intern/rna_gpencil_modifier.c
index 5281d92f3a4..e1e3e73b2cf 100644
--- a/source/blender/makesrna/intern/rna_gpencil_modifier.c
+++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c
@@ -2422,6 +2422,13 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna)
RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.01f, 2);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "pre_sample_length", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_default(prop, 0.0f);
+ RNA_def_property_ui_text(prop, "Pre Sample Length", "Sample strokes before sending out.");
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.01f, 2);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
}
void RNA_def_greasepencil_modifier(BlenderRNA *brna)
More information about the Bf-blender-cvs
mailing list