Skip to content

Commit 5b58c0f

Browse files
committed
For Borderless Showcase: add content aware fill toggle, backup masks from all top level layers, fix text layer creation for creatures when using automatic text sizing
1 parent 1753266 commit 5b58c0f

2 files changed

Lines changed: 31 additions & 12 deletions

File tree

config/BorderlessShowcaseTemplate.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
[ART]
2+
title = "Art Options"
3+
4+
[ART."Content.Aware.Fill"]
5+
title = "Content Aware Fill"
6+
desc = """When enabled, the area not covered by the source image is filled using Content Aware Fill."""
7+
type = "bool"
8+
default = 1
9+
110
[COLORS]
211
title = "Color Options"
312

py/borderless_showcase.py

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,12 @@ def predefined_textbox_heights(self) -> dict[str, int]:
117117

118118
# region Settings
119119

120+
@cached_property
121+
def is_content_aware_enabled(self) -> bool:
122+
return bool(
123+
CFG.get_setting(section="ART", key="Content.Aware.Fill", default=True)
124+
)
125+
120126
@cached_property
121127
def color_limit(self) -> int:
122128
setting = CFG.get_setting(
@@ -447,7 +453,9 @@ def pre_render_methods(self) -> list[Callable[[], None]]:
447453

448454
@cached_property
449455
def layers_to_seek_masks_from(self) -> Iterable[ArtLayer | LayerSet | None]:
450-
return (self.pinlines_group,)
456+
if self.docref:
457+
return (*self.docref.layerSets, *self.docref.artLayers)
458+
return []
451459

452460
# endregion Backup
453461

@@ -1087,23 +1095,25 @@ def text_layer_rules(self) -> ArtLayer | None:
10871095
and (self.is_creature or self.has_flipside_pt)
10881096
and layer
10891097
and self.pt_text_reference
1098+
and self.textbox_reference_base
10901099
):
1091-
textbox_ref_copy = self.textbox_reference_base.duplicate(
1092-
self.textbox_reference_base, ElementPlacement.PlaceBefore
1093-
)
1094-
textbox_ref_shape = merge_shapes(
1095-
self.pt_text_reference.duplicate(
1096-
textbox_ref_copy, ElementPlacement.PlaceBefore
1100+
base_dims = get_layer_dimensions(self.textbox_reference_base)
1101+
textbox_ref_shape = create_shape_layer(
1102+
(
1103+
{"x": base_dims["left"], "y": base_dims["top"]},
1104+
{"x": base_dims["right"], "y": base_dims["top"]},
1105+
{"x": base_dims["right"], "y": self.doc_height},
1106+
{"x": base_dims["left"], "y": self.doc_height},
10971107
),
1098-
textbox_ref_copy,
1099-
operation=ShapeOperation.SubtractFront,
1108+
relative_layer=self.textbox_reference_base,
1109+
placement=ElementPlacement.PlaceBefore,
11001110
)
11011111
textbox_ref_shape = merge_shapes(
1102-
textbox_ref_shape,
1103-
self.textbox_overflow_reference.duplicate(
1112+
self.pt_text_reference.duplicate(
11041113
textbox_ref_shape, ElementPlacement.PlaceBefore
11051114
),
1106-
operation=ShapeOperation.Unite,
1115+
textbox_ref_shape,
1116+
operation=ShapeOperation.SubtractFront,
11071117
)
11081118
layer = create_text_layer_with_path(textbox_ref_shape, layer)
11091119
return layer

0 commit comments

Comments
 (0)