From fa92e111ab5dfb3f386ad53317fea0103111cfbb Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Sun, 11 Dec 2022 10:41:23 +0000 Subject: Make Entities layer optional. It can also be disabled using "visible" flag in tiled. Closes issue #19 --- tools/map.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'tools/map.py') diff --git a/tools/map.py b/tools/map.py index 60ef887..476c1cd 100755 --- a/tools/map.py +++ b/tools/map.py @@ -220,8 +220,16 @@ def main(): # ents size placeholder 0 out[i] = [size & 0xFF, size >> 8, 0] + out[i] - entities_layer = find_name(data["layers"], "Entities") - if len(entities_layer): + try: + entities_layer = find_name(data["layers"], "Entities") + except ValueError: + entities_layer = [] + if not args.quiet: + print( + "%s: warning: 'Entities' layer not found" % path.basename(sys.argv[0]), + file=sys.stderr, + ) + if len(entities_layer) and entities_layer["visible"]: map_ents = defaultdict(list) map_ents_w = defaultdict(int) map_ents_bytes = defaultdict(int) -- cgit v1.2.3