Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass custom property types through #188

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

joereynolds
Copy link

@joereynolds joereynolds commented Aug 13, 2024

Entirely piggybacking off of @xivol by raising this but this fixes issues with custom types and custom classes.

I have tested it via Tiled.

In Tiled I have the following objects and its custom classes:

image

And here a demo of the custom classes working (i.e. being read from pytmx)

figs-custom-glass.mp4

Closes #184

@joereynolds
Copy link
Author

joereynolds commented Aug 14, 2024

There is a further issue with this which I believe we can fix forward.

If a custom class is defined and nested inside another custom class with its default behaviour, then the values do not get pulled through.

As an example:

This
image

Yields the following XML

image

However, if we modifiy the component (notice the bold)
image

The XML is now

image

Obviously this isn't handled anywhere currently in PyTMX. You can workaround this by modifying the value of the custom class but that's a workaround rather than a fix.

A proposed fix would be to pull in the default values if none have been overridden

@joereynolds
Copy link
Author

On second thought I'm not sure if above is even a bug. It might be a config option:

image

Haven't had time to take a look but I don't think it should stop the PR going out either way

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom Types Support
1 participant