-
Notifications
You must be signed in to change notification settings - Fork 916
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
feat: add support for LDtk tilemap #4575
Conversation
Looks great! I'm reviewing this today :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just did a quick review but so far only a few minor comments.
@4ian From my todo, let's start with the resources loading. When adding a LDtk map, here what I would like to do:
What do you think about it? The issue with that approach is external map (not copied into the project), we can't really refactor them to our need. |
That's a way to do it yes, parse the map and import as resources the other files... but as you said this implies to also update the map.. I wonder if there is something we could do that would work as a "mapping", stored in the object, that using as:
So when you import a LDtk file in the editor:
This way, the LDtk map does not need to be modified. This will allow this approach to work for example with LDtk maps stored in URLs for the web-app. Do you think this could work? |
Yes, I like that. |
Sounds like an excellent idea (and if it does not work it can always go back in the object). Do this into a field in the metadata (so like the metadata looks like: This will probably need some special work when the resource is imported, you can set it up at some place and we can then ensure it's applied everywhere resources can be imported in the editor. |
Thanks for working on this, it will make a lot of people happy 😃 |
@4ian In the end, I've named metadata as I have a issue with |
To add support for |
I've tried your modifs. Here my results:
I will search why...
I can make the changes but:
|
- Adapt property groups to show that the tilemap is all that is needed for LDtk - Add missing parameter after merge - Robustify instance renderer code against malformed metadata in a resource - Remove useless parameter in ExposeEmbeddeds - Code format JsExtension.js
…other resources + add test for it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have to make a last pass on the IDE changes (newIDE/app/src/ResourcesList/EmbeddedResourceSources.js
...) and we should be good.
Tested and it works well. Looks like magic to add a ldtk file and get the atlas image imported :) Also fixed renaming the resources.
I wonder if at some point we should make the "embedded resource mapping" a first class concept. For now we can keep it in metadata.
If I understand correctly, this may be valuable later on if a Music Tracker is ever added, since I believe it can need/embed instrument audio files. Nothing crucial right now, but speaks to it being valuable long term. |
@@ -364,10 +364,11 @@ const defineTileMap = function ( | |||
.setFunctionName('getLayerIndex'); | |||
|
|||
object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nicely done 👍
- Use a different data types to represent different part of the process of importing embedded resources - Remove useless properties - Avoid some branching - Rename functions and some properties to clarify the data being handled
Alright I did a few other changes and merged this! Thanks a lot for all the work done here @daiyam! 🎉 Awesome to see LDtk maps now direclty supported by GDevelop tilemaps. This will be appreciated by a large number of users and will make their life way easier :) |
@daiyam Was there any particular blocker for this? Feel free to go through the JsExtension.js file, setting up |
The issue is that when editing existing tilemaps, the existing resources are of type |
@Silver-Streak I think it is doable but the decision on how to handle it should be made by the main developers. |
What is "this" exactly, to be sure of the scope?
For a few versions, we'll use a "fallback" allowing to display json in the selector of tilemap/tileset resources. Let's check on the other PR that this is working. |
Sorry, speaking specifically to the item daiyam mentioned directly above mine, as far as them being detected as json rather than tilemap resources. |
This PR adds support for LDtk tilemap.
Caveats:
Todo:
resources loading or importing, to be validated what to do.support.ldtk
files(only(* there is any issue with existing tilemap).json
for now)closes #2434