[Bf-blender-cvs] [78389c021fe] temp-lineart-contained: LineArt: Ortho tolerance switch

YimingWu noreply at git.blender.org
Wed Nov 17 08:21:23 CET 2021


Commit: 78389c021fe7cc89414a35e98b5aedae3516b5cf
Author: YimingWu
Date:   Wed Nov 17 15:18:24 2021 +0800
Branches: temp-lineart-contained
https://developer.blender.org/rB78389c021fe7cc89414a35e98b5aedae3516b5cf

LineArt: Ortho tolerance switch

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

M	source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
M	source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
M	source/blender/makesdna/DNA_lineart_types.h
M	source/blender/makesrna/intern/rna_gpencil_modifier.c

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

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
index dfcda2b57f7..833456e31e5 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
@@ -412,6 +412,7 @@ static void options_panel_draw(const bContext *UNUSED(C), Panel *panel)
   uiLayoutSetPropSep(subrow, true);
   uiItemR(subrow, ptr, "source_camera", 0, "", ICON_OBJECT_DATA);
 
+  uiItemR(layout, ptr, "use_ortho_tolerance", 0, NULL, ICON_NONE);
   uiItemR(layout, ptr, "use_remove_doubles", 0, NULL, ICON_NONE);
   uiItemR(layout, ptr, "use_edge_overlap", 0, IFACE_("Overlapping Edges As Contour"), ICON_NONE);
   uiItemR(layout, ptr, "use_object_instances", 0, NULL, ICON_NONE);
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
index 7697e129ce9..a7f04c1d2c5 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
@@ -3190,6 +3190,13 @@ static LineartRenderBuffer *lineart_create_render_buffer(Scene *scene,
     copy_v3db_v3fl(rb->active_camera_pos, active_camera->obmat[3]);
   }
   copy_m4_m4(rb->cam_obmat, camera->obmat);
+
+  if (c->type == CAM_ORTHO && lmd->calculation_flags & LRT_USE_ORTHO_TOLERANCE) {
+    rotate_m4(rb->cam_obmat, 'X', DEG2RAD(0.1f));
+    rotate_m4(rb->cam_obmat, 'Y', DEG2RAD(0.1f));
+    rotate_m4(rb->cam_obmat, 'Z', DEG2RAD(0.1f));
+  }
+
   rb->cam_is_persp = (c->type == CAM_PERSP);
   rb->near_clip = c->clip_start + clipping_offset;
   rb->far_clip = c->clip_end - clipping_offset;
diff --git a/source/blender/makesdna/DNA_lineart_types.h b/source/blender/makesdna/DNA_lineart_types.h
index 1c9620a9b81..a412e5999d2 100644
--- a/source/blender/makesdna/DNA_lineart_types.h
+++ b/source/blender/makesdna/DNA_lineart_types.h
@@ -53,6 +53,7 @@ typedef enum eLineartMainFlags {
   LRT_FILTER_FACE_MARK_KEEP_CONTOUR = (1 << 18),
   LRT_USE_BACK_FACE_CULLING = (1 << 19),
   LRT_USE_IMAGE_BOUNDARY_TRIMMING = (1 << 20),
+  LRT_USE_ORTHO_TOLERANCE = (1 << 21),
 } eLineartMainFlags;
 
 typedef enum eLineartEdgeFlag {
diff --git a/source/blender/makesrna/intern/rna_gpencil_modifier.c b/source/blender/makesrna/intern/rna_gpencil_modifier.c
index 31556025b3e..20993aee740 100644
--- a/source/blender/makesrna/intern/rna_gpencil_modifier.c
+++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c
@@ -3451,6 +3451,14 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna)
       "Trim all edges right at the boundary of image(including overscan region)");
   RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
 
+  prop = RNA_def_property(srna, "use_ortho_tolerance", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "calculation_flags", LRT_USE_ORTHO_TOLERANCE);
+  RNA_def_property_ui_text(
+      prop,
+      "Use Ortho Tolerance",
+      "Internally rotate the camera slightly to comphensate for the precision of the algorithm");
+  RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
   RNA_define_lib_overridable(false);
 }



More information about the Bf-blender-cvs mailing list