diff options
author | YimingWu <xp8110@outlook.com> | 2021-06-29 06:29:51 +0300 |
---|---|---|
committer | YimingWu <xp8110@outlook.com> | 2021-06-29 06:40:59 +0300 |
commit | 91b31173e9a35fbc651dcdc62baf8e6053cbe831 (patch) | |
tree | 97eba4af38d12fff1829abdc804c0694c5a3cc0f /source | |
parent | 34b213d60472e139897395a84e0fff40b82a4a0b (diff) |
LineArt Cleanup: Rename floating->loose
see comment in https://developer.blender.org/rB841df831e89dfc4011c323203c2efb8265dc1878
Diffstat (limited to 'source')
6 files changed, 42 insertions, 38 deletions
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c index 99f2592030e..2a1eec80dd1 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c @@ -305,7 +305,7 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel) uiLayout *col = uiLayoutColumnWithHeading(layout, true, IFACE_("Edge Types")); uiItemR(col, ptr, "use_contour", 0, IFACE_("Contour"), ICON_NONE); - uiItemR(col, ptr, "use_floating", 0, IFACE_("Floating"), ICON_NONE); + uiItemR(col, ptr, "use_loose", 0, IFACE_("Loose"), ICON_NONE); uiItemR(col, ptr, "use_material", 0, IFACE_("Material Borders"), ICON_NONE); uiItemR(col, ptr, "use_edge_mark", 0, IFACE_("Edge Marks"), ICON_NONE); uiItemR(col, ptr, "use_intersection", 0, IFACE_("Intersections"), ICON_NONE); @@ -369,7 +369,7 @@ static void options_panel_draw(const bContext *UNUSED(C), Panel *panel) uiItemR(col, ptr, "use_edge_overlap", 0, IFACE_("Overlapping Edges As Contour"), ICON_NONE); uiItemR(col, ptr, "use_object_instances", 0, NULL, ICON_NONE); uiItemR(col, ptr, "use_clip_plane_boundaries", 0, NULL, ICON_NONE); - uiItemR(col, ptr, "allow_overlap_edge_types", 0, NULL, ICON_NONE); + uiItemR(col, ptr, "use_overlap_edge_type_support", 0, NULL, ICON_NONE); } static void style_panel_draw(const bContext *UNUSED(C), Panel *panel) @@ -504,7 +504,7 @@ static void chaining_panel_draw(const bContext *UNUSED(C), Panel *panel) const bool is_baked = RNA_boolean_get(ptr, "is_baked"); const bool use_cache = RNA_boolean_get(ptr, "use_cache"); const bool is_first = BKE_gpencil_is_first_lineart_in_stack(ob_ptr.data, ptr->data); - const bool is_geom = RNA_boolean_get(ptr, "chain_geometry_space"); + const bool is_geom = RNA_boolean_get(ptr, "use_geometry_space_chain"); uiLayoutSetPropSep(layout, true); uiLayoutSetEnabled(layout, !is_baked); @@ -517,9 +517,9 @@ 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, IFACE_("Floating Edges"), ICON_NONE); - uiItemR(col, ptr, "floating_as_contour", 0, NULL, ICON_NONE); - uiItemR(col, ptr, "chain_geometry_space", 0, NULL, ICON_NONE); + uiItemR(col, ptr, "use_loose_edge_chain", 0, IFACE_("Loose Edges"), ICON_NONE); + uiItemR(col, ptr, "use_loose_as_contour", 0, NULL, ICON_NONE); + uiItemR(col, ptr, "use_geometry_space_chain", 0, NULL, ICON_NONE); uiItemR(layout, ptr, diff --git a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h index 090c9d0f8fc..debfabae869 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h +++ b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h @@ -284,16 +284,16 @@ typedef struct LineartRenderBuffer { bool use_material; bool use_edge_marks; bool use_intersections; - bool use_floating; + bool use_loose; bool fuzzy_intersections; bool fuzzy_everything; bool allow_boundaries; bool allow_overlapping_edges; bool allow_duplicated_types; bool remove_doubles; - bool floating_as_contour; - bool chain_floating_edges; - bool chain_geometry_space; + bool use_loose_as_contour; + bool use_loose_edge_chain; + bool use_geometry_space_chain; 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 d14f0e0c7bf..a9f290eb6fa 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c +++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c @@ -729,8 +729,8 @@ static LineartChainRegisterEntry *lineart_chain_get_closest_cre(LineartRenderBuf } } - float new_len = rb->chain_geometry_space ? len_v3v3(cre->eci->gpos, eci->gpos) : - len_v2v2(cre->eci->pos, eci->pos); + float new_len = rb->use_geometry_space_chain ? len_v3v3(cre->eci->gpos, eci->gpos) : + len_v2v2(cre->eci->pos, eci->pos); if (new_len < dist) { closest_cre = cre; dist = new_len; @@ -801,7 +801,7 @@ void MOD_lineart_chain_connect(LineartRenderBuffer *rb) } BLI_addtail(&rb->chains, ec); - if (ec->type == LRT_EDGE_FLAG_FLOATING && (!rb->chain_floating_edges)) { + if (ec->type == LRT_EDGE_FLAG_LOOSE && (!rb->use_loose_edge_chain)) { continue; } diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c index fbfbb5145e6..e9f398093a7 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c +++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c @@ -1463,6 +1463,10 @@ static uint16_t lineart_identify_feature_line(LineartRenderBuffer *rb, lr = e->l->radial_next; } + if (!ll && !lr) { + return LRT_EDGE_FLAG_LOOSE; + } + FreestyleEdge *fel, *fer; bool face_mark_filtered = false; uint16_t edge_flag_result = 0; @@ -1563,6 +1567,9 @@ static void lineart_add_edge_to_list(LineartRenderBuffer *rb, LineartEdge *e) case LRT_EDGE_FLAG_INTERSECTION: lineart_prepend_edge_direct(&rb->intersection.first, e); break; + case LRT_EDGE_FLAG_LOOSE: + lineart_prepend_edge_direct(&rb->floating.first, e); + break; } } @@ -1590,7 +1597,7 @@ static void lineart_add_edge_to_list_thread(LineartObjectInfo *obi, LineartEdge case LRT_EDGE_FLAG_INTERSECTION: LRT_ASSIGN_EDGE(intersection); break; - case LRT_EDGE_FLAG_FLOATING: + case LRT_EDGE_FLAG_LOOSE: LRT_ASSIGN_EDGE(floating); break; } @@ -1632,7 +1639,7 @@ static int lineart_edge_type_duplication_count(char eflag) { int count = 0; /* See eLineartEdgeFlag for details. */ - for (int i = 0; i < LRT_EDGE_FLAG_FLOATING; i++) { + for (int i = 0; i < 6; i++) { if (eflag & (1 << i)) { count++; } @@ -1868,7 +1875,7 @@ static void lineart_geometry_object_load(LineartObjectInfo *obi, LineartRenderBu bool edge_added = false; /* See eLineartEdgeFlag for details. */ - for (int flag_bit = 0; flag_bit < LRT_EDGE_FLAG_FLOATING; flag_bit++) { + for (int flag_bit = 0; flag_bit < 6; flag_bit++) { char use_type = 1 << flag_bit; if (!(use_type & e->head.hflag)) { continue; @@ -3033,9 +3040,9 @@ static LineartRenderBuffer *lineart_create_render_buffer(Scene *scene, rb->fuzzy_everything = (lmd->calculation_flags & LRT_EVERYTHING_AS_CONTOUR) != 0; 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; - rb->chain_geometry_space = (lmd->calculation_flags & LRT_CHAIN_GEOMETRY_SPACE) != 0; + rb->use_loose_as_contour = (lmd->calculation_flags & LRT_LOOSE_AS_CONTOUR) != 0; + rb->use_loose_edge_chain = (lmd->calculation_flags & LRT_CHAIN_LOOSE_EDGES) != 0; + rb->use_geometry_space_chain = (lmd->calculation_flags & LRT_CHAIN_GEOMETRY_SPACE) != 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; @@ -3049,7 +3056,7 @@ static LineartRenderBuffer *lineart_create_render_buffer(Scene *scene, rb->use_material = (edge_types & LRT_EDGE_FLAG_MATERIAL) != 0; rb->use_edge_marks = (edge_types & LRT_EDGE_FLAG_EDGE_MARK) != 0; rb->use_intersections = (edge_types & LRT_EDGE_FLAG_INTERSECTION) != 0; - rb->use_floating = (edge_types & LRT_EDGE_FLAG_FLOATING) != 0; + rb->use_loose = (edge_types & LRT_EDGE_FLAG_LOOSE) != 0; rb->filter_face_mark_invert = (lmd->calculation_flags & LRT_FILTER_FACE_MARK_INVERT) != 0; rb->filter_face_mark = (lmd->calculation_flags & LRT_FILTER_FACE_MARK) != 0; @@ -4168,7 +4175,7 @@ static int UNUSED_FUNCTION(lineart_rb_edge_types)(LineartRenderBuffer *rb) types |= rb->use_material ? LRT_EDGE_FLAG_MATERIAL : 0; types |= rb->use_edge_marks ? LRT_EDGE_FLAG_EDGE_MARK : 0; types |= rb->use_intersections ? LRT_EDGE_FLAG_INTERSECTION : 0; - types |= rb->use_floating ? LRT_EDGE_FLAG_FLOATING : 0; + types |= rb->use_loose ? LRT_EDGE_FLAG_LOOSE : 0; return types; } diff --git a/source/blender/makesdna/DNA_lineart_types.h b/source/blender/makesdna/DNA_lineart_types.h index 3a3af622dd5..d7e62d04af2 100644 --- a/source/blender/makesdna/DNA_lineart_types.h +++ b/source/blender/makesdna/DNA_lineart_types.h @@ -47,13 +47,13 @@ typedef enum eLineartMainFlags { LRT_ALLOW_OVERLAPPING_EDGES = (1 << 3), LRT_ALLOW_CLIPPING_BOUNDARIES = (1 << 4), LRT_REMOVE_DOUBLES = (1 << 5), - LRT_FLOATING_AS_CONTOUR = (1 << 6), + LRT_LOOSE_AS_CONTOUR = (1 << 6), LRT_GPENCIL_INVERT_SOURCE_VGROUP = (1 << 7), LRT_GPENCIL_MATCH_OUTPUT_VGROUP = (1 << 8), 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 << 12), + LRT_CHAIN_LOOSE_EDGES = (1 << 12), LRT_CHAIN_GEOMETRY_SPACE = (1 << 13), LRT_ALLOW_OVERLAP_EDGE_TYPES = (1 << 14), } eLineartMainFlags; @@ -64,9 +64,7 @@ typedef enum eLineartEdgeFlag { LRT_EDGE_FLAG_CREASE = (1 << 2), LRT_EDGE_FLAG_MATERIAL = (1 << 3), LRT_EDGE_FLAG_INTERSECTION = (1 << 4), - /** Floating edge, unimplemented yet. */ - LRT_EDGE_FLAG_FLOATING = (1 << 5), - /** Also used as discarded line mark. */ + LRT_EDGE_FLAG_LOOSE = (1 << 5), LRT_EDGE_FLAG_CHAIN_PICKED = (1 << 6), LRT_EDGE_FLAG_CLIPPED = (1 << 7), /** Limited to 8 bits, DON'T ADD ANYMORE until improvements on the data structure. */ diff --git a/source/blender/makesrna/intern/rna_gpencil_modifier.c b/source/blender/makesrna/intern/rna_gpencil_modifier.c index 1fc4923d894..24b1e66bbb5 100644 --- a/source/blender/makesrna/intern/rna_gpencil_modifier.c +++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c @@ -2812,9 +2812,9 @@ 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, "floating_as_contour", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "calculation_flags", LRT_FLOATING_AS_CONTOUR); - RNA_def_property_ui_text(prop, "Floating As Contour", "Floating edges will have contour type"); + prop = RNA_def_property(srna, "use_loose_as_contour", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "calculation_flags", LRT_LOOSE_AS_CONTOUR); + RNA_def_property_ui_text(prop, "Loose As Contour", "Loose edges will have contour type"); RNA_def_property_update(prop, NC_SCENE, "rna_GpencilModifier_update"); prop = RNA_def_property(srna, "invert_source_vertex_group", PROP_BOOLEAN, PROP_NONE); @@ -2853,19 +2853,18 @@ 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"); + prop = RNA_def_property(srna, "use_loose_edge_chain", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "calculation_flags", LRT_CHAIN_LOOSE_EDGES); + RNA_def_property_ui_text(prop, "Chain Loose Edges", "Allow loose edges to be chained together"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); - prop = RNA_def_property(srna, "chain_geometry_space", PROP_BOOLEAN, PROP_NONE); + prop = RNA_def_property(srna, "use_geometry_space_chain", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "calculation_flags", LRT_CHAIN_GEOMETRY_SPACE); RNA_def_property_ui_text( prop, "Use Geometry Space", "Use geometry distance for chaining instead of image space"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); - prop = RNA_def_property(srna, "allow_overlap_edge_types", PROP_BOOLEAN, PROP_NONE); + prop = RNA_def_property(srna, "use_overlap_edge_type_support", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "calculation_flags", LRT_ALLOW_OVERLAP_EDGE_TYPES); RNA_def_property_ui_text(prop, "Overlapping Edge Types", @@ -2898,9 +2897,9 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Use Contour", "Generate strokes from contours lines"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); - prop = RNA_def_property(srna, "use_floating", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "edge_types", LRT_EDGE_FLAG_FLOATING); - RNA_def_property_ui_text(prop, "Use Floating", "Generate strokes from floating edges"); + prop = RNA_def_property(srna, "use_loose", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "edge_types", LRT_EDGE_FLAG_LOOSE); + RNA_def_property_ui_text(prop, "Use Loose", "Generate strokes from loose edges"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); prop = RNA_def_property(srna, "use_crease", PROP_BOOLEAN, PROP_NONE); |