Skip to content

Commit

Permalink
⚠ Warnings with unsupported styles
Browse files Browse the repository at this point in the history
  • Loading branch information
javitonino committed Nov 21, 2022
1 parent b5f3a3f commit 538ce26
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions converter/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ def convert_border(fig_node: dict, fig_border: dict) -> Border:


def convert_fill(fig_node: dict, fig_fill: dict) -> Fill:
if fig_fill.get("blendMode", "NORMAL") != "NORMAL":
utils.log_conversion_warning("STY003", fig_node)

match fig_fill:
case {"type": "EMOJI"}:
raise Exception("Unsupported fill: EMOJI")
Expand All @@ -98,6 +101,11 @@ def convert_fill(fig_node: dict, fig_fill: dict) -> Fill:
isEnabled=fig_fill["visible"],
)
case {"type": "IMAGE"}:
if "transform" in fig_fill and fig_fill["transform"] != Matrix(
[[1, 0, 0], [0, 1, 0], [0, 0, 1]]
):
utils.log_conversion_warning("STY004", fig_node)

return Fill.Image(
f'images/{fig_fill["image"]["filename"]}',
patternFillType=PATTERN_FILL_TYPE[fig_fill["imageScaleMode"]],
Expand Down
2 changes: 2 additions & 0 deletions converter/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ def get_style_table_override(fig_item):
"SHP001": "contains a line with at least one 'Reversed triangle' end. This type of marker does not exist in Sketch. It has been converted to a 'Line' type marker",
"STY001": "contains a layer blur and a background blur. Only one will be converted",
"STY002": "contains a DIAMOND gradient, which is not supported. It is converted to a RADIAL gradient",
"STY003": "contains a fill with a non-standard blend mode, which is not supported at the fill level (us the layer blend mode instead). It will be ignored",
"STY004": "has a cropped image background, which is not supported yet. It will be set to stretch",
"SYM001": "references an invalid symbol. It will be converted to an empty placeholder group",
"SYM002": "overrides unsupported properties: {props}. The override will be ignored",
"SYM003": "overrides unsupported properties: {props}. The instance will be detached",
Expand Down

0 comments on commit 538ce26

Please sign in to comment.