Skip to content

Commit

Permalink
add py2 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
wo1fsea committed Feb 14, 2024
1 parent f3f2c9e commit 00eb073
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions PyTexturePacker/Utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def get_atlas_data_ext(atlas_format):
if len(parameters) >= 2 and required_args <= 2:
return '.txt'

raise ValueError(f"Unsupported file format: {atlas_format}")
raise ValueError("Unsupported file format: %s" % atlas_format)


def save_atlas_data(data_dict, file_path, atlas_format):
Expand All @@ -98,7 +98,7 @@ def save_atlas_data(data_dict, file_path, atlas_format):
if len(parameters) >= 2 and required_args <= 2:
return atlas_format(data_dict, file_path)

raise ValueError(f"Unsupported file format: {atlas_format}")
raise ValueError("Unsupported file format: %s" % atlas_format)


def save_csv(data_dict, file_path):
Expand All @@ -112,9 +112,13 @@ def save_csv(data_dict, file_path):
for name, data in data_dict['frames'].items():
frame = data['frame']
source = data['spriteSourceSize']
fp.write(f'{name},{frame["x"]},{frame["y"]},{frame["w"]},{frame["h"]},'
f'{source["x"]},{source["y"]},{source["w"]},{source["h"]},'
f'{data["rotated"]},{data["trimed"]}\n')

# fp.write(f'{name},{frame["x"]},{frame["y"]},{frame["w"]},{frame["h"]},'
# f'{source["x"]},{source["y"]},{source["w"]},{source["h"]},'
# f'{data["rotated"]},{data["trimed"]}\n')
fp.write('%s,%d,%d,%d,%d,%d,%d,%d,%d,%s,%s\n' % (name, frame["x"], frame["y"], frame["w"], frame["h"],
source["x"], source["y"], source["w"], source["h"],
data["rotated"], data["trimed"]))


def save_json(data_dict, file_path):
Expand Down

0 comments on commit 00eb073

Please sign in to comment.