Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions pytiled_parser/parsers/tmx/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ def parse(raw_properties: etree.Element) -> Properties:
for raw_property in raw_properties.findall("property"):
type_ = raw_property.attrib.get("type")

if "value" not in raw_property.attrib:
value_ = raw_property.attrib.get("value", raw_property.text)
if value_ is None:
continue

value_ = raw_property.attrib["value"]

if type_ == "file":
value = Path(value_)
elif type_ == "color":
Expand Down
4 changes: 4 additions & 0 deletions tests/test_tiled_object_tmx.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@
<property name="float property" type="float" value="42.1"/>
<property name="int property" type="int" value="8675309"/>
<property name="string property" value="pytiled_parser rulez!1!!"/>
<property name="multiline string property">Hi
I can write multiple lines in here
That's pretty great</property>
</properties>
</object>
""",
Expand All @@ -144,6 +147,7 @@
"float property": 42.1,
"int property": 8675309,
"string property": "pytiled_parser rulez!1!!",
"multiline string property": "Hi\nI can write multiple lines in here\nThat's pretty great",
},
),
),
Expand Down