[Bf-blender-cvs] [4c706e90f96] temp-lineart-contained: LineArt: Floating edge chaining option

YimingWu noreply at git.blender.org
Mon May 10 07:47:50 CEST 2021


Commit: 4c706e90f9695fef8f050115545f1f6d07dde02a
Author: YimingWu
Date:   Mon May 10 13:47:38 2021 +0800
Branches: temp-lineart-contained
https://developer.blender.org/rB4c706e90f9695fef8f050115545f1f6d07dde02a

LineArt: Floating edge chaining option

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

M	source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
M	source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
M	source/blender/gpencil_modifiers/intern/lineart/lineart_chain.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 0401a7ab5c7..f77b301677c 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
@@ -540,6 +540,7 @@ static void chaining_panel_draw(const bContext *UNUSED(C), Panel *panel)
   uiLayout *col = uiLayoutColumnWithHeading(layout, true, IFACE_("Chain"));
   uiItemR(col, ptr, "use_fuzzy_intersections", 0, NULL, ICON_NONE);
   uiItemR(col, ptr, "use_fuzzy_all", 0, NULL, ICON_NONE);
+  uiItemR(col, ptr, "chain_floating_edges", 0, NULL, ICON_NONE);
 
   uiItemR(layout, ptr, "chaining_image_threshold", 0, NULL, ICON_NONE);
 
diff --git a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
index 46888d5fe75..5092045a307 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
+++ b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
@@ -304,6 +304,7 @@ typedef struct LineartRenderBuffer {
   bool allow_overlapping_edges;
   bool remove_doubles;
   bool floating_as_contour;
+  bool chain_floating_edges;
 
   bool filter_face_mark;
   bool filter_face_mark_invert;
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c
index da5d3f12fd7..d28b4dc73f5 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c
@@ -811,6 +811,10 @@ void MOD_lineart_chain_connect(LineartRenderBuffer *rb)
     }
     BLI_addtail(&rb->chains, rlc);
 
+    if (rlc->type == LRT_EDGE_FLAG_FLOATING && (!rb->chain_floating_edges)) {
+      continue;
+    }
+
     occlusion = rlc->level;
     trans_mask = rlc->transparency_mask;
     isec_mask = rlc->intersection_mask;
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
index adc77fbd25c..6c3858c9fdd 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
@@ -3011,6 +3011,7 @@ static LineartRenderBuffer *lineart_create_render_buffer(Scene *scene,
   rb->allow_boundaries = (lmd->calculation_flags & LRT_ALLOW_CLIPPING_BOUNDARIES) != 0;
   rb->remove_doubles = (lmd->calculation_flags & LRT_REMOVE_DOUBLES) != 0;
   rb->floating_as_contour = (lmd->calculation_flags & LRT_FLOATING_AS_CONTOUR) != 0;
+  rb->chain_floating_edges = (lmd->calculation_flags & LRT_CHAIN_FLOATING_EDGES) != 0;
 
   /* See lineart_edge_from_triangle() for how this option may impact performance. */
   rb->allow_overlapping_edges = (lmd->calculation_flags & LRT_ALLOW_OVERLAPPING_EDGES) != 0;
diff --git a/source/blender/makesdna/DNA_lineart_types.h b/source/blender/makesdna/DNA_lineart_types.h
index 57eca40b579..6e086180596 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 = (1 << 9),
   LRT_FILTER_FACE_MARK_INVERT = (1 << 10),
   LRT_FILTER_FACE_MARK_BOUNDARIES = (1 << 11),
+  LRT_CHAIN_FLOATING_EDGES = (1 << 11),
 } 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 c33a741e7d7..b81335f7342 100644
--- a/source/blender/makesrna/intern/rna_gpencil_modifier.c
+++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c
@@ -2798,6 +2798,12 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna)
   RNA_def_property_range(prop, 0.0f, 0.3f);
   RNA_def_property_update(prop, NC_SCENE, "rna_GpencilModifier_update");
 
+  prop = RNA_def_property(srna, "chain_floating_edges", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "calculation_flags", LRT_CHAIN_FLOATING_EDGES);
+  RNA_def_property_ui_text(
+      prop, "Chain Floating Edges", "Allow floating edges to be chained together");
+  RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
   prop = RNA_def_property(srna, "stroke_offset", PROP_FLOAT, PROP_DISTANCE);
   RNA_def_property_ui_text(prop,
                            "Stroke Offset",



More information about the Bf-blender-cvs mailing list