-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Added export to GameMaker Studio 2 #2979
Conversation
For exporting to GameMaker Studio 2.
* Added exporting of tile layers as GMRTileLayer * Added exporting of tile objects as GMRSpriteGraphic or GMRGraphic * Added exporting of image layers as GMRBackgroundLayer * Added exporting of group layers as GMRLayer * Numerous fixes and formatting tweaks
We can no longer assume bottom-left alignment for tiles.
Broke compile against Qt 5.9, used for the snap package.
* Make sure doubles always include at least one decimal. It shouldn't matter for JSON, which has just one "number" type, but this is to match the behavior of GameMaker. * Write out sequenceId as "null" instead of "0". * Avoid allocation of QByteArray for writing keys. Relying on plain "const char *" for now, since we don't have QByteArrayView yet (needs Qt 6.0).
Split the export into two steps, where first all the layers are iterated and converted to GameMaker structures. Serializing stuff to the file happens as second step. This allows moving the data around as needed more easily. As a result of this change, it was now easy to handle a tile layer where multiple tilesets are used, which will now create a group layer with a child tile layer for each tileset. Similarly, this way we can write out asset, instance and path layers for a single group layer. However, writing of paths and instances is not fully supported yet. Also, all 8 views are now always written, as done by GameMaker.
Pretty much the same way as was done in the GMX plugin.
* Layer names are now sanitized, so that they only contain 0-9, a-z, A-Z or _. * Sprite and tileset names are now sanitized as well, so there's a higher chance they'll match the default naming they get when importing their images into GMS 2. * IDs like spriteId, tilesetId and such now export as "null" instead of with empty paths, when they're not set. * An empty tile layer exports as an empty GMRTileLayer instead of an empty GMRLayer (and an empty object layer as an empty GMRInstanceLayer).
* Fixed the order of color channels to be AABBGGRR. * Reversed the layer order. * Better names for child layers. * Default "visible" property to layer's visible state. * Support flipped tile objects exported as GMRGraphic.
More or less Critical:
Nice to have:
EDIT: Added the two InstanceCreationOrder points |
Any unrecognized custom properties are now assumed to override properties defined on the object. Overriding properties of parent objects is not supported for now. For the views, a custom "objectId" property can now be used to set the object that the view should follow.
Supports custom int property "creationOrder" for controlling the creation order of instances.
There are a number of features that can't be supported on a GMRTileLayer: * Image collection tilesets * Tilesets with a tile size different from the grid size * Non-orthogonal tile layers This change falls back to exporting the tiles to an asset layer in such cases instead, adding support for all the above features. A number of warnings have been added as well. The "ignore" property for instances is now set to true for invisible objects by default. Simplified a little the logic of assigning unique names.
Tile objects with custom origin would not export to the right location when scaled, both when exported as assets and as instances. Assets created based on tiles from an image collection tileset were not taking the origin into account in determining their position. There are still some remaining issues, but I'll have to revisit those later.
This applies wherever a sprite is referenced, which includes the tileset sprite, a tile sprite (in case of image collection tileset) and the image layer sprite.
Replicated the same behaviour as seen in GMS 2. Also added custom layer property "noExport" for making the export skip the entire layer (and its children, in case of group layer).
* Avoid code duplication for writing GMResource properties and initializing a GMRGraphic * Don't write out "tags" as GMOverriddenProperty * Sort the used tilesets by name, to avoid random GMRTileLayer order
And a bit more cleanup regarding the depth property.
Closes #1642
Quite a bit of work done, but some tasks remain and no testing was done at all yet.
GMRTileLayer
(single tileset per layer)GMRSpriteGraphic
orGMRGraphic
onGMRAssetLayer
GMRBackgroundLayer
GMRLayer
GMRInstanceLayer
GMPath
asset and aGMRPathLayer