-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
Automatic custom enum parsing doesn't work with "Save as String" #64
Comments
Great detail here, nice! Yeah, I'm aware of this limitation regarding enums. Is there any way to have enum properties without having them being defined as custom types? Because if not, then it feels more natural to have a hard requirement in DotTiled that those custom enum types are also defined properly with However, if there's a way to have enum properties without having them defined (like how you can input arbitrary strings in What do you think? |
It's a great feature, and the enums are much easier than classes to implement, so it's definitely manageable as a requirement. My personal preference would be to have strings as a backup option however, because why not? The string is right there. From my perspective in this case, I get a crash on load with one storage type and not the other, so it feels more like a bug than a limitation. So I'm curious what's going on data-wise with the "Save As Integer" option selected. Is that integer available? If so, why make the string unavailable? I think part of what i was getting at with my original issue about classes has to do with the process of iteratively coding a game. You make some maps, put some data into the maps, and then you might want to launch the game and see some fraction of that working before you implement all of the data you have in the map file. It's iterative, and not being able to load and view a map before a ton of stuff is perfectly in place can be frustrating. This is especially true if you're learning to use all these tools simultaneously. Not to rag on the custom classes again, but in that case that would have been a total deal-breaker for me using this library a couple years ago. |
You make a good point. I agree that it should be as frictionless as possible to use DotTiled in an iterative development process. Let's go over the 4 combinations of enums that you can have in the
<property name="customenumstringprop" propertytype="CustomEnumString" value="CustomEnumString_2"/> In this case, there's no problem with providing just the string value with a
<property name="customenumstringflagsprop" propertytype="CustomEnumStringFlags" value="CustomEnumStringFlags_1,CustomEnumStringFlags_2"/> Can provide this string too as a
<property name="customenumintprop" type="int" propertytype="CustomEnumInt" value="3"/> Can provide as
<property name="customenumintflagsprop" type="int" propertytype="CustomEnumIntFlags" value="6"/> We can provide this as an Essentially, this behaviour would be to use whatever The only problem that I can see is that we will be providing different types of properties ( Do you think this is an acceptable way to change the behaviour? It would allow users to freely use custom enums, load maps that use them without crashing, and check their values without having to define them as custom enum definitions. The only caveat is the different storage type -> different property type in DotTiled. |
Yes, this sounds straightforward enough! I think getting the exact same data out regardless of setup is a noble goal but limiting in this case. You could add a warning in these cases I suppose. |
Great, there's a PR up with a fix for this issue. Is it possible for you to verify it against something you were experiencing a problem with? #65 |
Ah, apologies, I thought I responded already. The PR seems to work as expected! Tested with several permutations. |
I'm working from the "dev" branch.
To reproduce:
So, for thoroughness, this is what is in the .tiled-project:
This is what is in the .tmx:
The text was updated successfully, but these errors were encountered: