[Bf-blender-cvs] [87932500745] temp-lineart-contained: Revert "LineArt: Remove geometry space chaining and clean up vertex group selection code."

YimingWu noreply at git.blender.org
Fri Mar 19 13:28:53 CET 2021


Commit: 87932500745645bf140de3aead75a6572e6d19e2
Author: YimingWu
Date:   Fri Mar 19 20:28:39 2021 +0800
Branches: temp-lineart-contained
https://developer.blender.org/rB87932500745645bf140de3aead75a6572e6d19e2

Revert "LineArt: Remove geometry space chaining and clean up vertex group selection code."

This reverts commit b51554bb9378983031d15089439cc0f9f1a81eb1.

# Conflicts:
#	source/blender/makesdna/DNA_gpencil_modifier_defaults.h

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

M	release/datafiles/locale
M	release/scripts/addons
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/gpencil_modifiers/intern/lineart/lineart_ops.c
M	source/blender/makesdna/DNA_gpencil_modifier_defaults.h
M	source/blender/makesdna/DNA_gpencil_modifier_types.h
M	source/blender/makesrna/intern/rna_gpencil_modifier.c

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

diff --git a/release/datafiles/locale b/release/datafiles/locale
index 8a05b618f03..ef74c1b861a 160000
--- a/release/datafiles/locale
+++ b/release/datafiles/locale
@@ -1 +1 @@
-Subproject commit 8a05b618f031582c006c6f62b9e60619ab3eef8b
+Subproject commit ef74c1b861a1b05c2483a2c045a6380704167491
diff --git a/release/scripts/addons b/release/scripts/addons
index 67f1fbca148..6dfba915743 160000
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit 67f1fbca1482d9d9362a4001332e785c3fd5d230
+Subproject commit 6dfba915743b67aff99ddcc19c0807d339a87c96
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
index 5a82869c357..95d01fb710e 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
@@ -110,8 +110,7 @@ static void generate_strokes_actual(
       lmd->resample_length,
       lmd->source_vertex_group,
       lmd->vgname,
-      lmd->flags,
-      lmd->weight_threshold);
+      lmd->flags);
 }
 
 static bool isModifierDisabled(GpencilModifierData *md)
@@ -390,7 +389,8 @@ static void chaining_panel_draw(const bContext *UNUSED(C), Panel *panel)
   uiItemR(col, ptr, "fuzzy_everything", 0, NULL, ICON_NONE);
 
   col = uiLayoutColumn(layout, true);
-  uiItemR(col, ptr, "chaining_threshold", 0, NULL, ICON_NONE);
+  uiItemR(col, ptr, "chaining_geometry_threshold", 0, NULL, ICON_NONE);
+  uiItemR(col, ptr, "chaining_image_threshold", 0, NULL, ICON_NONE);
 
   uiItemR(layout, ptr, "resample_length", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
 
@@ -423,13 +423,7 @@ static void vgroup_panel_draw(const bContext *UNUSED(C), Panel *panel)
         col, ptr, "vertex_group", &ob_ptr, "vertex_groups", IFACE_("Target"), ICON_NONE);
   }
 
-  col = uiLayoutColumn(layout, true);
-  uiItemR(col, ptr, "binary_weights", 0, NULL, ICON_NONE);
-
-  const bool binary_weights = RNA_boolean_get(ptr, "binary_weights");
-  if (binary_weights) {
-    uiItemR(col, ptr, "weight_threshold", 0, IFACE_("Threshold"), ICON_NONE);
-  }
+  uiItemR(col, ptr, "soft_selection", 0, NULL, ICON_NONE);
 }
 
 static void baking_panel_draw(const bContext *UNUSED(C), Panel *panel)
diff --git a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
index dfa8d4c1b6f..c01b1a4c86b 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
+++ b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
@@ -288,7 +288,8 @@ typedef struct LineartRenderBuffer {
   double near_clip, far_clip;
   float shift_x, shift_y;
   float crease_threshold;
-  float chaining_threshold;
+  float chaining_image_threshold;
+  float chaining_geometry_threshold;
   float angle_splitting_threshold;
 
   /* FIXME: (Yiming) Temporary solution for speeding up calculation by not including lines that
@@ -511,7 +512,7 @@ void MOD_lineart_destroy_render_data(struct LineartGpencilModifierData *lmd);
 
 void MOD_lineart_chain_feature_lines(LineartRenderBuffer *rb);
 void MOD_lineart_chain_split_for_fixed_occlusion(LineartRenderBuffer *rb);
-void MOD_lineart_chain_connect(LineartRenderBuffer *rb);
+void MOD_lineart_chain_connect(LineartRenderBuffer *rb, const bool do_geometry_space);
 void MOD_lineart_chain_discard_short(LineartRenderBuffer *rb, const float threshold);
 void MOD_lineart_chain_split_angle(LineartRenderBuffer *rb, float angle_threshold_rad);
 
@@ -551,8 +552,7 @@ void MOD_lineart_gpencil_generate(LineartRenderBuffer *rb,
                                   float resample_length,
                                   const char *source_vgname,
                                   const char *vgname,
-                                  int modifier_flags,
-                                  float weight_threshold);
+                                  int modifier_flags);
 
 float MOD_lineart_chain_compute_length(LineartLineChain *rlc);
 
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c
index 99a316de33a..fae5bcd7c2e 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c
@@ -694,7 +694,8 @@ static LineartChainRegisterEntry *lineart_chain_get_closest_cre(LineartRenderBuf
                                                                 int occlusion,
                                                                 unsigned char transparency_mask,
                                                                 float dist,
-                                                                float *new_dist,
+                                                                int do_geometry_space,
+                                                                float *result_new_len,
                                                                 LineartBoundingArea *caller_ba)
 {
 
@@ -738,12 +739,13 @@ static LineartChainRegisterEntry *lineart_chain_get_closest_cre(LineartRenderBuf
       }
     }
 
-    float newd = len_v2v2(cre->rlci->pos, rlci->pos);
-    if (newd < dist) {
+    float new_len = do_geometry_space ? len_v3v3(cre->rlci->gpos, rlci->gpos) :
+                                        len_v2v2(cre->rlci->pos, rlci->pos);
+    if (new_len < dist) {
       closest_cre = cre;
-      dist = newd;
-      if (new_dist) {
-        (*new_dist) = newd;
+      dist = new_len;
+      if (result_new_len) {
+        (*result_new_len) = new_len;
       }
     }
   }
@@ -756,22 +758,30 @@ static LineartChainRegisterEntry *lineart_chain_get_closest_cre(LineartRenderBuf
   if (dist_to < dist && dist_to > 0) { \
     LISTBASE_FOREACH (LinkData *, ld, list) { \
       LineartBoundingArea *sba = (LineartBoundingArea *)ld->data; \
-      adjacent_closest = lineart_chain_get_closest_cre( \
-          rb, sba, rlc, rlci, occlusion, transparency_mask, dist, &adjacent_new_len, ba); \
+      adjacent_closest = lineart_chain_get_closest_cre(rb, \
+                                                       sba, \
+                                                       rlc, \
+                                                       rlci, \
+                                                       occlusion, \
+                                                       transparency_mask, \
+                                                       dist, \
+                                                       do_geometry_space, \
+                                                       &adjacent_new_len, \
+                                                       ba); \
       if (adjacent_new_len < dist) { \
         dist = adjacent_new_len; \
         closest_cre = adjacent_closest; \
       } \
     } \
   }
-  if (!caller_ba) {
+  if (!do_geometry_space && !caller_ba) {
     LRT_TEST_ADJACENT_AREAS(rlci->pos[0] - ba->l, &ba->lp);
     LRT_TEST_ADJACENT_AREAS(ba->r - rlci->pos[0], &ba->rp);
     LRT_TEST_ADJACENT_AREAS(ba->u - rlci->pos[1], &ba->up);
     LRT_TEST_ADJACENT_AREAS(rlci->pos[1] - ba->b, &ba->bp);
   }
-  if (new_dist) {
-    (*new_dist) = dist;
+  if (result_new_len) {
+    (*result_new_len) = dist;
   }
   return closest_cre;
 }
@@ -779,19 +789,20 @@ static LineartChainRegisterEntry *lineart_chain_get_closest_cre(LineartRenderBuf
 /* This function only connects two different chains. It will not do any clean up or smart chaining.
  * So no: removing overlapping chains, removal of short isolated segments, and no loop reduction is
  * implemented yet. */
-void MOD_lineart_chain_connect(LineartRenderBuffer *rb)
+void MOD_lineart_chain_connect(LineartRenderBuffer *rb, const bool do_geometry_space)
 {
   LineartLineChain *rlc;
   LineartLineChainItem *rlci_l, *rlci_r;
   LineartBoundingArea *ba_l, *ba_r;
   LineartChainRegisterEntry *closest_cre_l, *closest_cre_r, *closest_cre;
-  float dist = rb->chaining_threshold;
+  float dist = do_geometry_space ? rb->chaining_geometry_threshold : rb->chaining_image_threshold;
   float dist_l, dist_r;
   int occlusion, reverse_main;
   unsigned char transparency_mask;
   ListBase swap = {0};
 
-  if ((rb->chaining_threshold < 0.00001)) {
+  if ((!do_geometry_space && rb->chaining_image_threshold < 0.0001) ||
+      (do_geometry_space && rb->chaining_geometry_threshold < 0.0001)) {
     return;
   }
 
@@ -814,10 +825,26 @@ void MOD_lineart_chain_connect(LineartRenderBuffer *rb)
     rlci_r = rlc->chain.last;
     while ((ba_l = lineart_bounding_area_get_end_point(rb, rlci_l)) &&
            (ba_r = lineart_bounding_area_get_end_point(rb, rlci_r))) {
-      closest_cre_l = lineart_chain_get_closest_cre(
-          rb, ba_l, rlc, rlci_l, occlusion, transparency_mask, dist, &dist_l, NULL);
-      closest_cre_r = lineart_chain_get_closest_cre(
-          rb, ba_r, rlc, rlci_r, occlusion, transparency_mask, dist, &dist_r, NULL);
+      closest_cre_l = lineart_chain_get_closest_cre(rb,
+                                                    ba_l,
+                                                    rlc,
+                                                    rlci_l,
+                                                    occlusion,
+                                                    transparency_mask,
+                                                    dist,
+                                                    do_geometry_space,
+                                                    &dist_l,
+                                                    NULL);
+      closest_cre_r = lineart_chain_get_closest_cre(rb,
+                                                    ba_r,
+                                                    rlc,
+                                                    rlci_r,
+                                                    occlusion,
+                                                    transparency_mask,
+                                                    dist,
+                                                    do_geometry_space,
+                                                    &dist_r,
+                                                    NULL);
       if 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list