diff options
7 files changed, 19 insertions, 77 deletions
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c index b66e970b107..27c1c40066e 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c @@ -387,9 +387,7 @@ static void chaining_panel_draw(const bContext *UNUSED(C), Panel *panel) uiItemR(col, ptr, "fuzzy_intersections", 0, NULL, ICON_NONE); uiItemR(col, ptr, "fuzzy_everything", 0, NULL, ICON_NONE); - col = uiLayoutColumn(layout, true); - uiItemR(col, ptr, "chaining_geometry_threshold", 0, NULL, ICON_NONE); - uiItemR(col, ptr, "chaining_image_threshold", 0, NULL, ICON_NONE); + uiItemR(layout, ptr, "chaining_image_threshold", 0, NULL, ICON_NONE); uiItemR(layout, ptr, "resample_length", UI_ITEM_R_SLIDER, 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 c01b1a4c86b..79dc584065c 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h +++ b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h @@ -289,7 +289,6 @@ typedef struct LineartRenderBuffer { float shift_x, shift_y; float crease_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 @@ -512,7 +511,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, const bool do_geometry_space); +void MOD_lineart_chain_connect(LineartRenderBuffer *rb); void MOD_lineart_chain_discard_short(LineartRenderBuffer *rb, const float threshold); void MOD_lineart_chain_split_angle(LineartRenderBuffer *rb, float angle_threshold_rad); diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c index fae5bcd7c2e..3ac8ec378a2 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c +++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c @@ -694,7 +694,6 @@ static LineartChainRegisterEntry *lineart_chain_get_closest_cre(LineartRenderBuf int occlusion, unsigned char transparency_mask, float dist, - int do_geometry_space, float *result_new_len, LineartBoundingArea *caller_ba) { @@ -739,8 +738,7 @@ static LineartChainRegisterEntry *lineart_chain_get_closest_cre(LineartRenderBuf } } - float new_len = do_geometry_space ? len_v3v3(cre->rlci->gpos, rlci->gpos) : - len_v2v2(cre->rlci->pos, rlci->pos); + float new_len = len_v2v2(cre->rlci->pos, rlci->pos); if (new_len < dist) { closest_cre = cre; dist = new_len; @@ -758,23 +756,15 @@ 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, \ - do_geometry_space, \ - &adjacent_new_len, \ - ba); \ + adjacent_closest = lineart_chain_get_closest_cre( \ + rb, sba, rlc, rlci, occlusion, transparency_mask, dist, &adjacent_new_len, ba); \ if (adjacent_new_len < dist) { \ dist = adjacent_new_len; \ closest_cre = adjacent_closest; \ } \ } \ } - if (!do_geometry_space && !caller_ba) { + if (!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); @@ -789,20 +779,19 @@ 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, const bool do_geometry_space) +void MOD_lineart_chain_connect(LineartRenderBuffer *rb) { LineartLineChain *rlc; LineartLineChainItem *rlci_l, *rlci_r; LineartBoundingArea *ba_l, *ba_r; LineartChainRegisterEntry *closest_cre_l, *closest_cre_r, *closest_cre; - float dist = do_geometry_space ? rb->chaining_geometry_threshold : rb->chaining_image_threshold; + float dist = rb->chaining_image_threshold; float dist_l, dist_r; int occlusion, reverse_main; unsigned char transparency_mask; ListBase swap = {0}; - if ((!do_geometry_space && rb->chaining_image_threshold < 0.0001) || - (do_geometry_space && rb->chaining_geometry_threshold < 0.0001)) { + if (rb->chaining_image_threshold < 0.0001) { return; } @@ -825,26 +814,10 @@ void MOD_lineart_chain_connect(LineartRenderBuffer *rb, const bool do_geometry_s 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, - 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); + 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); if (closest_cre_l && closest_cre_r) { if (dist_l < dist_r) { closest_cre = closest_cre_l; diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c index 77de09a5526..7d79ce46c1a 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c +++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c @@ -2645,7 +2645,6 @@ static LineartRenderBuffer *lineart_create_render_buffer(Scene *scene, rb->crease_threshold = cos(M_PI - lmd->crease_threshold); rb->angle_splitting_threshold = lmd->angle_splitting_threshold; rb->chaining_image_threshold = lmd->chaining_image_threshold; - rb->chaining_geometry_threshold = lmd->chaining_geometry_threshold; rb->fuzzy_intersections = (lmd->calculation_flags & LRT_INTERSECTION_AS_CONTOUR) != 0; rb->fuzzy_everything = (lmd->calculation_flags & LRT_EVERYTHING_AS_CONTOUR) != 0; @@ -3676,32 +3675,18 @@ int MOD_lineart_compute_feature_lines(Depsgraph *depsgraph, LineartGpencilModifi * spit, where the splitting point could be any cut in e->segments. */ MOD_lineart_chain_split_for_fixed_occlusion(rb); - /* Then we connect chains based on the _proximity_ of their end points in geometry or image - * space, here's the place threashold value gets involved. */ - - /* If both chaining thresholds are zero, then we allow at least image space chaining to do a - * little bit of work so we don't end up in fragmented strokes. */ - float *t_image = &lmd->chaining_image_threshold; - float *t_geom = &lmd->chaining_geometry_threshold; - if (*t_image < FLT_EPSILON && *t_geom < FLT_EPSILON) { - *t_geom = 0.0f; - *t_image = 0.001f; - } + /* Then we connect chains based on the _proximity_ of their end points in image space, here's + * the place threashold value gets involved. */ /* do_geometry_space = true. */ - MOD_lineart_chain_connect(rb, true); + MOD_lineart_chain_connect(rb); - /* After chaining, we need to clear flags so we can do another round in image space. */ - MOD_lineart_chain_clear_picked_flag(rb); - - /* do_geometry_space = false (it's image_space). */ - MOD_lineart_chain_connect(rb, false); - - /* Clear again so we don't confuse GPencil generation calls. */ + /* After chaining, we need to clear flags so we don't confuse GPencil generation calls. */ MOD_lineart_chain_clear_picked_flag(rb); + float *t_image = &lmd->chaining_image_threshold; /* This configuration ensures there won't be accidental lost of short unchained segments. */ - MOD_lineart_chain_discard_short(rb, MIN3(*t_image, *t_geom, 0.001f) - FLT_EPSILON); + MOD_lineart_chain_discard_short(rb, MIN2(*t_image, 0.001f) - FLT_EPSILON); if (rb->angle_splitting_threshold > FLT_EPSILON) { MOD_lineart_chain_split_angle(rb, rb->angle_splitting_threshold); diff --git a/source/blender/makesdna/DNA_gpencil_modifier_defaults.h b/source/blender/makesdna/DNA_gpencil_modifier_defaults.h index f6d57291951..4f6ef6ab7ce 100644 --- a/source/blender/makesdna/DNA_gpencil_modifier_defaults.h +++ b/source/blender/makesdna/DNA_gpencil_modifier_defaults.h @@ -292,7 +292,6 @@ .crease_threshold = DEG2RAD(140.0f), \ .calculation_flags = LRT_ALLOW_DUPLI_OBJECTS | LRT_REMOVE_DOUBLES | LRT_ALLOW_OVERLAPPING_EDGES | LRT_ALLOW_CLIPPING_BOUNDARIES, \ .angle_splitting_threshold = DEG2RAD(60.0f), \ - .chaining_geometry_threshold = 0.001f, \ .chaining_image_threshold = 0.001f, \ } diff --git a/source/blender/makesdna/DNA_gpencil_modifier_types.h b/source/blender/makesdna/DNA_gpencil_modifier_types.h index 31f8c64d486..19555d93964 100644 --- a/source/blender/makesdna/DNA_gpencil_modifier_types.h +++ b/source/blender/makesdna/DNA_gpencil_modifier_types.h @@ -864,7 +864,6 @@ typedef struct LineartGpencilModifierData { float angle_splitting_threshold; /* CPU mode */ - float chaining_geometry_threshold; float chaining_image_threshold; float resample_length; @@ -875,8 +874,6 @@ typedef struct LineartGpencilModifierData { /* Additional Switches. */ int flags; - int _pad; - /* Runtime only. */ void *render_buffer; diff --git a/source/blender/makesrna/intern/rna_gpencil_modifier.c b/source/blender/makesrna/intern/rna_gpencil_modifier.c index f6b52f80128..7e6d83cdbdd 100644 --- a/source/blender/makesrna/intern/rna_gpencil_modifier.c +++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c @@ -2388,15 +2388,6 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna) prop, "Remove Doubles", "Remove doubles from the source geometry before generating stokes"); RNA_def_property_update(prop, NC_SCENE, "rna_GpencilModifier_update"); - prop = RNA_def_property(srna, "chaining_geometry_threshold", PROP_FLOAT, PROP_DISTANCE); - RNA_def_property_ui_text(prop, - "Geometry Threshold", - "Segments with a geometric distance between them lower than this " - "will be chained together"); - RNA_def_property_ui_range(prop, 0.0f, 0.5f, 0.001f, 3); - RNA_def_property_range(prop, 0.0f, 0.5f); - RNA_def_property_update(prop, NC_SCENE, "rna_GpencilModifier_update"); - prop = RNA_def_property(srna, "chaining_image_threshold", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_ui_text( prop, |