Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYimingWu <xp8110@outlook.com>2022-08-06 06:06:34 +0300
committerYimingWu <xp8110@outlook.com>2022-08-06 07:20:15 +0300
commit8dadc091d02a7a046a73f77757766ef6fdeffda9 (patch)
tree4c4a013bd54f26dd5594f5e132bc3c3a4b7c2677 /source/blender/gpencil_modifiers
parentbefe38fe1dfbbdac9ed9ef61853800426e5966c5 (diff)
LineArt: Usability improvement for "Enclosed Shapes".
This patch removes the [rather confusing] separate checkbox for enclosed shapes in favour of integrating that option into illumination filtering, with the benefit of not limiting the selection to cached result. Reviewed By: Sebastian Parborg (zeddb) Differential Revision: https://developer.blender.org/D15327
Diffstat (limited to 'source/blender/gpencil_modifiers')
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c13
-rw-r--r--source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h7
-rw-r--r--source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c29
-rw-r--r--source/blender/gpencil_modifiers/intern/lineart/lineart_shadow.c5
4 files changed, 32 insertions, 22 deletions
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
index 77616ae13b6..6bb59f29b98 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
@@ -373,19 +373,16 @@ static void edge_types_panel_draw(const bContext *UNUSED(C), Panel *panel)
}
sub = uiLayoutRow(col, false);
- uiItemR(sub, ptr, "use_crease", 0, "", ICON_NONE);
- entry = uiLayoutColumn(sub, false);
- uiItemL(entry, IFACE_("Crease"), ICON_NONE);
- uiLayoutSetActive(entry, RNA_boolean_get(ptr, "use_crease") || is_first);
if (use_cache && !is_first) {
- uiItemL(entry, IFACE_("Crease Angle Cached"), ICON_INFO);
+ uiItemR(sub, ptr, "use_crease", 0, IFACE_("Crease (Angle Cached)"), ICON_NONE);
}
else {
- uiItemR(entry,
+ uiItemR(sub, ptr, "use_crease", 0, "", ICON_NONE);
+ uiItemR(sub,
ptr,
"crease_threshold",
UI_ITEM_R_SLIDER | UI_ITEM_R_FORCE_BLANK_DECORATE,
- IFACE_("Default Angle"),
+ NULL,
ICON_NONE);
}
@@ -447,8 +444,6 @@ static void options_light_reference_draw(const bContext *UNUSED(C), Panel *panel
uiLayout *col = uiLayoutColumn(remaining, true);
uiItemR(col, ptr, "shadow_camera_near", 0, "Near", ICON_NONE);
uiItemR(col, ptr, "shadow_camera_far", 0, "Far", ICON_NONE);
-
- uiItemR(layout, ptr, "use_shadow_enclosed_shapes", 0, IFACE_("Enclosed Shapes"), ICON_NONE);
}
static void options_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 5dd833fb12b..224146d0032 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
+++ b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
@@ -439,12 +439,17 @@ typedef enum eLineartTriangleFlags {
} eLineartTriangleFlags;
#define LRT_SHADOW_MASK_UNDEFINED 0
-#define LRT_SHADOW_MASK_LIT (1 << 0)
+#define LRT_SHADOW_MASK_ILLUMINATED (1 << 0)
#define LRT_SHADOW_MASK_SHADED (1 << 1)
#define LRT_SHADOW_MASK_ENCLOSED_SHAPE (1 << 2)
#define LRT_SHADOW_MASK_INHIBITED (1 << 3)
#define LRT_SHADOW_SILHOUETTE_ERASED_GROUP (1 << 4)
#define LRT_SHADOW_SILHOUETTE_ERASED_OBJECT (1 << 5)
+#define LRT_SHADOW_MASK_ILLUMINATED_SHAPE (1 << 6)
+
+#define LRT_SHADOW_TEST_SHAPE_BITS \
+ (LRT_SHADOW_MASK_ILLUMINATED | LRT_SHADOW_MASK_SHADED | LRT_SHADOW_MASK_INHIBITED | \
+ LRT_SHADOW_MASK_ILLUMINATED_SHAPE)
/**
* Controls how many edges a worker thread is processing at one request.
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
index 874da3b88c9..011c79025c4 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
@@ -304,13 +304,12 @@ void lineart_edge_cut(LineartData *ld,
/* The enclosed shape flag will override regular lit/shaded
* flags. See LineartEdgeSegment::shadow_mask_bits for details. */
if (shadow_bits == LRT_SHADOW_MASK_ENCLOSED_SHAPE) {
- if (seg->shadow_mask_bits & LRT_SHADOW_MASK_LIT || e->flags & LRT_EDGE_FLAG_LIGHT_CONTOUR) {
- seg->shadow_mask_bits &= ~LRT_SHADOW_MASK_LIT;
+ if (seg->shadow_mask_bits & LRT_SHADOW_MASK_ILLUMINATED ||
+ e->flags & LRT_EDGE_FLAG_LIGHT_CONTOUR) {
seg->shadow_mask_bits |= LRT_SHADOW_MASK_INHIBITED;
}
else if (seg->shadow_mask_bits & LRT_SHADOW_MASK_SHADED) {
- seg->shadow_mask_bits &= ~LRT_SHADOW_MASK_SHADED;
- seg->shadow_mask_bits |= LRT_SHADOW_MASK_LIT;
+ seg->shadow_mask_bits |= LRT_SHADOW_MASK_ILLUMINATED_SHAPE;
}
}
else {
@@ -3643,7 +3642,8 @@ static LineartData *lineart_create_render_buffer(Scene *scene,
(lmd->light_contour_object != NULL));
ld->conf.shadow_selection = lmd->shadow_selection_override;
- ld->conf.shadow_enclose_shapes = (lmd->calculation_flags & LRT_SHADOW_ENCLOSED_SHAPES) != 0;
+ ld->conf.shadow_enclose_shapes = lmd->shadow_selection_override ==
+ LRT_SHADOW_FILTER_ILLUMINATED_ENCLOSED_SHAPES;
ld->conf.shadow_use_silhouette = lmd->shadow_use_silhouette_override != 0;
ld->conf.use_back_face_culling = (lmd->calculation_flags & LRT_USE_BACK_FACE_CULLING) != 0;
@@ -5227,13 +5227,22 @@ static void lineart_gpencil_generate(LineartCache *cache,
}
if (shaodow_selection) {
if (ec->shadow_mask_bits != LRT_SHADOW_MASK_UNDEFINED) {
- /* TODO(@Yiming): Give a behavior option for how to display undefined shadow info. */
- if ((shaodow_selection == LRT_SHADOW_FILTER_LIT &&
- (!(ec->shadow_mask_bits & LRT_SHADOW_MASK_LIT))) ||
- (shaodow_selection == LRT_SHADOW_FILTER_SHADED &&
- (!(ec->shadow_mask_bits & LRT_SHADOW_MASK_SHADED)))) {
+ /* TODO(Yiming): Give a behaviour option for how to display undefined shadow info. */
+ if ((shaodow_selection == LRT_SHADOW_FILTER_ILLUMINATED &&
+ (!(ec->shadow_mask_bits & LRT_SHADOW_MASK_ILLUMINATED)))) {
continue;
}
+ else if ((shaodow_selection == LRT_SHADOW_FILTER_SHADED &&
+ (!(ec->shadow_mask_bits & LRT_SHADOW_MASK_SHADED)))) {
+ continue;
+ }
+ else if (shaodow_selection == LRT_SHADOW_FILTER_ILLUMINATED_ENCLOSED_SHAPES) {
+ uint32_t test_bits = ec->shadow_mask_bits & LRT_SHADOW_TEST_SHAPE_BITS;
+ if ((test_bits != LRT_SHADOW_MASK_ILLUMINATED) &&
+ (test_bits != (LRT_SHADOW_MASK_SHADED | LRT_SHADOW_MASK_ILLUMINATED_SHAPE))) {
+ continue;
+ }
+ }
}
}
if (silhouette_mode && (ec->type & (LRT_EDGE_FLAG_CONTOUR))) {
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_shadow.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_shadow.c
index ad0137fe0f0..24762ce921d 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_shadow.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_shadow.c
@@ -109,9 +109,10 @@ void lineart_register_shadow_cuts(LineartData *ld, LineartEdge *e, LineartEdge *
la2 = la2 * e->v2->fbcoord[3] /
(e->v1->fbcoord[3] - la2 * (e->v1->fbcoord[3] - e->v2->fbcoord[3]));
unsigned char shadow_bits = (es->occlusion != 0) ? LRT_SHADOW_MASK_SHADED :
- LRT_SHADOW_MASK_LIT;
+ LRT_SHADOW_MASK_ILLUMINATED;
- if (lineart_contour_viewed_from_dark_side(ld, e) && shadow_bits == LRT_SHADOW_MASK_LIT) {
+ if (lineart_contour_viewed_from_dark_side(ld, e) &&
+ shadow_bits == LRT_SHADOW_MASK_ILLUMINATED) {
shadow_bits = LRT_SHADOW_MASK_SHADED;
}