[Bf-blender-cvs] [6fb70a29dea] lanpr-under-gp: LineArt: Deg representation of crease threashold.

YimingWu noreply at git.blender.org
Sun Sep 27 09:15:31 CEST 2020


Commit: 6fb70a29dea921eef2b0e6c17a92961f3ad761c5
Author: YimingWu
Date:   Sun Sep 27 15:13:14 2020 +0800
Branches: lanpr-under-gp
https://developer.blender.org/rB6fb70a29dea921eef2b0e6c17a92961f3ad761c5

LineArt: Deg representation of crease threashold.

===================================================================

M	source/blender/editors/lineart/lineart_cpu.c
M	source/blender/makesrna/intern/rna_object.c
M	source/blender/makesrna/intern/rna_scene.c

===================================================================

diff --git a/source/blender/editors/lineart/lineart_cpu.c b/source/blender/editors/lineart/lineart_cpu.c
index aec28906cb0..2571d678292 100644
--- a/source/blender/editors/lineart/lineart_cpu.c
+++ b/source/blender/editors/lineart/lineart_cpu.c
@@ -1590,7 +1590,7 @@ static void lineart_geometry_object_load(Depsgraph *dg,
     reln->element_count = bm->totedge;
     reln->object_ref = orig_ob;
     if (ob->lineart.flags & OBJECT_LRT_OWN_CREASE) {
-      reln->crease_threshold = ob->lineart.crease_threshold;
+      reln->crease_threshold = cosf(DEG2RAD(180.0f - ob->lineart.crease_threshold));
     }
     else {
       reln->crease_threshold = rb->crease_threshold;
@@ -2664,7 +2664,7 @@ LineartRenderBuffer *ED_lineart_create_render_buffer(Scene *scene)
     rb->shift_y = (asp <= 1) ? c->shifty : c->shifty * asp;
   }
 
-  rb->crease_threshold = scene->lineart.crease_threshold;
+  rb->crease_threshold = cos(DEG2RAD(180.0f - scene->lineart.crease_threshold));
   rb->angle_splitting_threshold = scene->lineart.angle_splitting_threshold;
   rb->chaining_image_threshold = scene->lineart.chaining_image_threshold;
   rb->chaining_geometry_threshold = scene->lineart.chaining_geometry_threshold;
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 1156271b0e7..f6ec9f304d7 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -2651,8 +2651,9 @@ static void rna_def_object_lineart(BlenderRNA *brna)
   RNA_def_property_update(prop, 0, "rna_object_lineart_update");
 
   prop = RNA_def_property(srna, "crease_threshold", PROP_FLOAT, PROP_NONE);
-  RNA_def_property_range(prop, 0, 1);
-  RNA_def_property_float_default(prop, 0.9);
+  RNA_def_property_float_default(prop, 140);
+  RNA_def_property_range(prop, 0, 180);
+  RNA_def_property_ui_range(prop, 0.0f, 180.0f, 0.01f, 1);
   RNA_def_property_ui_text(prop, "Own Crease", "Use own crease setting to overwrite scene global");
   RNA_def_property_update(prop, 0, "rna_object_lineart_update");
 }
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index e795439c802..e51ff5b13de 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -7402,10 +7402,10 @@ static void rna_def_scene_lineart(BlenderRNA *brna)
   RNA_def_property_update(prop, NC_SCENE, "rna_lineart_update");
 
   prop = RNA_def_property(srna, "crease_threshold", PROP_FLOAT, PROP_NONE);
-  RNA_def_property_float_default(prop, 0.5f);
+  RNA_def_property_range(prop, 0, 180);
+  RNA_def_property_float_default(prop, 140);
+  RNA_def_property_ui_range(prop, 0.0f, 180.0f, 0.01f, 1);
   RNA_def_property_ui_text(prop, "Crease Threshold", "Cosine value of face angle");
-  RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.01f, 2);
-  RNA_def_property_flag(prop, PROP_EDITABLE);
   RNA_def_property_update(prop, NC_SCENE, "rna_lineart_update");
 
   prop = RNA_def_property(srna, "angle_splitting_threshold", PROP_FLOAT, PROP_ANGLE);
@@ -7413,7 +7413,6 @@ static void rna_def_scene_lineart(BlenderRNA *brna)
   RNA_def_property_ui_text(prop, "Angle Splitting", "Angle splitting threshold");
   /*  Don't allow value very close to PI, or we get a lot of small segments.*/
   RNA_def_property_ui_range(prop, 0.0f, DEG2RAD(179), 0.01f, 2);
-  RNA_def_property_flag(prop, PROP_EDITABLE);
   RNA_def_property_update(prop, NC_SCENE, "rna_lineart_update");
 
   /* types */



More information about the Bf-blender-cvs mailing list