Skip to content

UniversesBeyondTemplate

src.templates.normal.UniversesBeyondTemplate

Bases: VectorTransformMod, VectorTemplate

Template used for crossover sets like WH40K, Transformers, Street Fighter, etc. This template is built using the Silvan style of creating vector shapes and applying the colors and textures in the form of clipping masks. It's a little more involved, but it demonstrates an alternative way to build a highly complex template which can work for multiple card types. Credit to Kyle of Card Conjurer, WarpDandy, SilvanMTG, Chilli and MrTeferi.

Source code in src\templates\normal.py
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
class UniversesBeyondTemplate(VectorTransformMod, VectorTemplate):
    """
    Template used for crossover sets like WH40K, Transformers, Street Fighter, etc.
    This template is built using the Silvan style of creating vector shapes and applying the colors
    and textures in the form of clipping masks. It's a little more involved, but it demonstrates
    an alternative way to build a highly complex template which can work for multiple card types.
    Credit to Kyle of Card Conjurer, WarpDandy, SilvanMTG, Chilli and MrTeferi.
    """
    template_suffix = 'Universes Beyond'

    # Color Maps
    pinlines_color_map = {
        **pinlines_color_map.copy(),
        'W': [246, 247, 241],
        'U': [0, 131, 193],
        'B': [44, 40, 33],
        'R': [237, 66, 31],
        'G': [5, 129, 64],
        'Gold': [239, 209, 107],
        'Land': [165, 150, 132],
        'Artifact': [227, 228, 230],
        'Colorless': [227, 228, 230]}

    """
    * Colors
    """

    @auto_prop_cached
    def pt_colors(self) -> str:
        """str: Layer texture name, supports Vehicle PT but doesn't need white text."""
        return LAYERS.VEHICLE if self.is_vehicle == LAYERS.VEHICLE else self.twins

    @auto_prop_cached
    def crown_colors(self) -> Union[list[int], list[dict]]:
        """list[int] | list[dict]: Solid color or gradient adjustment layer notation."""
        return psd.get_pinline_gradient(self.pinlines, color_map=self.crown_color_map)

    """
    * Groups
    """

    @auto_prop_cached
    def background_group(self) -> Optional[LayerSet]:
        """Optional[LayerSet]: No background for 'Colorless' cards."""
        if self.is_colorless:
            return
        return super().background_group

    """
    * Masks
    """

    @auto_prop_cached
    def enabled_masks(self) -> list[Union[dict, list, ArtLayer, LayerSet, None]]:
        """Masks enabled or copied."""
        return [
            # Pinlines mask, supports Transform Front
            [psd.getLayer(
                LAYERS.TRANSFORM_FRONT if self.is_transform and self.is_front else LAYERS.NORMAL,
                [self.mask_group, LAYERS.PINLINES]
            ), self.pinlines_group]
        ]

    """
    * Shapes
    """

    @auto_prop_cached
    def pinlines_shape(self) -> Optional[LayerSet]:
        # Support Normal and Transform Front
        name = (
            LAYERS.TRANSFORM_FRONT if self.is_front else LAYERS.TRANSFORM_BACK
        ) if self.is_transform else LAYERS.NORMAL
        return psd.getLayerSet(name, [self.pinlines_group, LAYERS.SHAPE])

    """
    * Methods
    """

    def enable_frame_layers(self) -> None:
        super().enable_frame_layers()

        # Translucent colorless shapes
        if self.is_colorless and self.twins_shape and self.textbox_shape:
            psd.set_fill_opacity(60, self.twins_group)
            psd.set_fill_opacity(60, self.textbox_group)

    def enable_crown(self) -> None:

        # Generate a solid color or gradient layer for the crown group
        self.crown_group.visible = True
        self.generate_layer(
            group=self.crown_group,
            colors=self.crown_colors)

        # Enable Legendary pinline connector
        psd.getLayerSet(
            LAYERS.LEGENDARY,
            self.pinlines_shape.parent
        ).visible = True

    """
    * Transform Methods
    """

    def enable_transform_layers_back(self) -> None:
        super().enable_transform_layers_back()

        # Enable brightness shift on back face layers
        psd.getLayerSet(LAYERS.BACK, self.pt_group).visible = True
        psd.getLayerSet(LAYERS.BACK, self.twins_group).visible = True
        psd.getLayer(LAYERS.BACK, self.textbox_group).visible = True

Attributes

pinlines_color_map = {None: pinlines_color_map.copy(), 'W': [246, 247, 241], 'U': [0, 131, 193], 'B': [44, 40, 33], 'R': [237, 66, 31], 'G': [5, 129, 64], 'Gold': [239, 209, 107], 'Land': [165, 150, 132], 'Artifact': [227, 228, 230], 'Colorless': [227, 228, 230]}

  • Colors

Functions

background_group() -> Optional[LayerSet]

Optional[LayerSet]: No background for 'Colorless' cards.

Source code in src\templates\normal.py
903
904
905
906
907
908
@auto_prop_cached
def background_group(self) -> Optional[LayerSet]:
    """Optional[LayerSet]: No background for 'Colorless' cards."""
    if self.is_colorless:
        return
    return super().background_group

crown_colors() -> Union[list[int], list[dict]]

list[int] | list[dict]: Solid color or gradient adjustment layer notation.

Source code in src\templates\normal.py
894
895
896
897
@auto_prop_cached
def crown_colors(self) -> Union[list[int], list[dict]]:
    """list[int] | list[dict]: Solid color or gradient adjustment layer notation."""
    return psd.get_pinline_gradient(self.pinlines, color_map=self.crown_color_map)

enabled_masks() -> list[Union[dict, list, ArtLayer, LayerSet, None]]

Masks enabled or copied.

Source code in src\templates\normal.py
914
915
916
917
918
919
920
921
922
923
@auto_prop_cached
def enabled_masks(self) -> list[Union[dict, list, ArtLayer, LayerSet, None]]:
    """Masks enabled or copied."""
    return [
        # Pinlines mask, supports Transform Front
        [psd.getLayer(
            LAYERS.TRANSFORM_FRONT if self.is_transform and self.is_front else LAYERS.NORMAL,
            [self.mask_group, LAYERS.PINLINES]
        ), self.pinlines_group]
    ]

pt_colors() -> str

Source code in src\templates\normal.py
889
890
891
892
@auto_prop_cached
def pt_colors(self) -> str:
    """str: Layer texture name, supports Vehicle PT but doesn't need white text."""
    return LAYERS.VEHICLE if self.is_vehicle == LAYERS.VEHICLE else self.twins