GPencil: Add Sample parameter to Convert curve

This allows to resample the stroke to avoid too dense geometry.
This commit is contained in:
2020-08-12 12:35:52 +02:00
parent 9abdafe840
commit 504c257dae
4 changed files with 24 additions and 7 deletions

View File

@@ -715,7 +715,8 @@ bool rna_Object_generate_gpencil_strokes(Object *ob,
Object *ob_gpencil,
bool gpencil_lines,
bool use_collections,
float scale_thickness)
float scale_thickness,
float sample)
{
if (ob->type != OB_CURVE) {
BKE_reportf(reports,
@@ -727,8 +728,15 @@ bool rna_Object_generate_gpencil_strokes(Object *ob,
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
BKE_gpencil_convert_curve(
bmain, scene, ob_gpencil, ob, gpencil_lines, use_collections, false, scale_thickness);
BKE_gpencil_convert_curve(bmain,
scene,
ob_gpencil,
ob,
gpencil_lines,
use_collections,
false,
scale_thickness,
sample);
WM_main_add_notifier(NC_GPENCIL | ND_DATA, NULL);
@@ -1202,6 +1210,8 @@ void RNA_api_object(StructRNA *srna)
parm = RNA_def_boolean(func, "use_collections", true, "", "Use Collections");
parm = RNA_def_float(
func, "scale_thickness", 1.0f, 0.0f, FLT_MAX, "", "Thickness scaling factor", 0.0f, 100.0f);
parm = RNA_def_float(
func, "sample", 0.0f, 0.0f, FLT_MAX, "", "Sample distance, zero to disable", 0.0f, 100.0f);
parm = RNA_def_boolean(func, "result", 0, "", "Result");
RNA_def_function_return(func, parm);
}