Skip to content

Commit

Permalink
Black formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Cleptomania committed Aug 23, 2024
1 parent adc918c commit 2e2f970
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
4 changes: 2 additions & 2 deletions pytiled_parser/parsers/json/tiled_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,13 +325,13 @@ def parse(
raw_object["properties"] = []

for prop in loaded_template["properties"]:

found = False
for prop2 in raw_object["properties"]:
if prop2["name"] == prop["name"]:
found = True
break

if not found:
raw_object["properties"].append(prop)
else:
Expand Down
24 changes: 13 additions & 11 deletions pytiled_parser/parsers/tmx/tiled_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,24 +277,26 @@ def parse(raw_object: etree.Element, parent_dir: Optional[Path] = None) -> Tiled
continue
new_object.attrib[key] = val


properties_element = raw_object.find("./properties")
temp_properties_element = new_object.find("./properties")
if properties_element is not None and temp_properties_element is None:
new_object.append(properties_element)
elif properties_element is None and temp_properties_element is not None:
pass
elif properties_element is not None and temp_properties_element is not None:
elif (
properties_element is not None
and temp_properties_element is not None
):
for prop in temp_properties_element:
found = False
for prop2 in properties_element:
if prop.attrib["name"] == prop2.attrib["name"]:
found = True
break
if not found:
properties_element.append(prop)

found = False
for prop2 in properties_element:
if prop.attrib["name"] == prop2.attrib["name"]:
found = True
break

if not found:
properties_element.append(prop)
new_object.remove(temp_properties_element)
new_object.append(properties_element)

Expand Down

0 comments on commit 2e2f970

Please sign in to comment.