Skip to content

Commit

Permalink
Fix a lack of backward-compatibility with .tileset.json files created…
Browse files Browse the repository at this point in the history
… before v0.2
  • Loading branch information
Sambo3975 committed Jun 14, 2021
1 parent c9bf491 commit 62c7933
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
10 changes: 2 additions & 8 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,8 @@

# Changes in the next release
# ----------------------------------
# Features:
# * The maximum width and height of the displayed image are now configurable. These options can be accessed through
# File > Preferences. The default dimensions have also been lowered to 400x300 pixels to resolve issues on smaller
# screens.
# * The .exe should now work on Windows 7
# Bugfixes:
# * Fixed a crash that was occurring when Pixel Scale was changed after creating tiles.
# * Made the Grid Size entry a bit wider to accommodate differing grid width and height.

# TODO: Encode text-based files in UTF-8.

import os
import pathlib
Expand Down
6 changes: 5 additions & 1 deletion tile.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def draw_passthrough(c, x1, y1, x2, y2):
'tile_id': '',
'tile_name': '',
'tile_description': '',
'grid_size': 32, # The grid size as the tile was created (only used if grid_padding is nonzero)
'grid_size': (32, 32), # The grid size as the tile was created (only used if grid_padding is nonzero)
'grid_padding': 0, # The grid padding as the tile was created (used w/grid_size in _slice_n_splice)

# Animation
Expand Down Expand Up @@ -498,6 +498,10 @@ def __init__(self, canvas, x1, y1, x2, y2, *, outline=None, width=None, scale=1,
"""
self.error_image = PhotoImage(file=resource_path('data/tile_error.png'))

# For backward compatibility with .tileset.json files created before v0.2.
if 'grid_size' in kwargs and type(old_val := kwargs['grid_size']) == int:
kwargs['grid_size'] = (old_val, old_val)

data = {}
for k in defaults.keys():
if k in kwargs:
Expand Down

0 comments on commit 62c7933

Please sign in to comment.