diff --git a/docs/archives/1.3.4/CHANGELOG.md b/docs/archives/1.3.4/CHANGELOG.md new file mode 100644 index 000000000..3cd69866f --- /dev/null +++ b/docs/archives/1.3.4/CHANGELOG.md @@ -0,0 +1,1186 @@ +# 1.3.4 + + - You can now use the mouse MIDDLE button to reset any custom field input to its default value. + - Added customizable entity fields colors (each entity field can have its own custom color) + - Added a new app setting to adjust the "single-layer mode" intensity. + - Added customizable default entity width/height (in Project settings) + - LDtk will now properly finish its "long tasks" while the app is minimized (eg. loading, saving, updating auto-layer rules etc.) + - Entity min width and min height now default to width and height respectively. + - Better color display for level names in world view + - Better default display in the new Select modal + - Fixed newly created custom fields that have a display scale of 0% + - Fixed empty list of values in Rule Editor window, in pure auto-layers + - Fixed rules randomization of flipped tiles + - Fixed the preview of tiles generated by a given rule + - Added entities worldX/Y pixel coordinates to JSON + +# 1.3.3 + + - **Added custom UI icons for IntGrid layer values.** + - **Added custom min/max size limits to entities when then are resizables.** + - **If you change the "grid size" of a Layer or a Tileset, LDtk will now try to remap all existing data to this new grid size (if that's possible).** + - Added an option to allow/disallow tiles stacking in the Rules Assistant window. + - Added multi-columns view to auto-layer rule editor. + - When using the "Single layer mode", the others layers are now faded away a bit more. + - Hiding details (`CTRL-H`) now also hides the grid + - Added quick search for IntGrid palettes in the left sidebar. + - Fixed visibility icon in layer list when hiding details + - Fixed various minor bugs in the new tool options from the left panel. + - Renaming a project will now also rename sibling `.meta` files (Unity) accordingly. + - Fixed message dialog size + - Updated old sample maps + +# 1.3.2 + + - Fixed invisible auto-layer tiles when loading pre-1.3.1 projects + - Removed tiny debug message (oops) + +# 1.3.1 + + - **Added customizable UI color of layers** + - **Added custom alpha per auto-layer rule: this alpha will affect the opacity of the resulting tile.** + - **Added an option to fit current tileset in the editor side bar.** + - **New "top-down" example map** + - Re-organized all buttons near the tileset in the editor side bar. + - Added sliders to all inputs in the rule Modulo window + - Added sliders to inputs in the rule Perlin window + - Added an option to disable the "grayed out" effect on the LDtk window when it is not focused. + - Re-organized auto-layer rules options + - Moved Checker mode from auto-layer rules to the Modulo window + - Fixed a display bug with Float custom fields + - Added "duplicate group" action to rule groups context menu + - Fixed popped-out tile palette not closing quickly enough + - Fixed missing intGrid values in mass out-of-bounds policy editor + + +# 1.3.0 - Multi-worlds and Quality of life + +## Experimental Multi-worlds support! +![](1.3.0/multiWorlds.png) + +The new multi-worlds feature is now available as a preview. + +Multi-worlds allow you to have multiple distinct worlds in the same LDtk project. + +Each world can have its own set of levels using a specific layout. However, they all share the same definitions (layers, entities, enums etc). + +**IMPORTANT: to use this feature in your projects, you will need to make sure that your importer is up-to-date and fully supports it.** Multi-worlds projects cannot be imported using older loaders. + +To enable this experimental support, open your Project settings (`P` shortcut), scroll down to the advanced options and enable Multi-worlds there. **PLEASE BACKUP YOUR PROJECTS BEFORE TRYING IT!** + +When enabled, various new buttons will be available in the UI, like in the World panel (`W` shortcut). + +![](1.3.0/multiWorldsOption.png) + +## Rule tiles X and Y offsets + +![](1.3.0/ruleTilesOffsets2.png) + +You can now offset the resulting tile(s) of any rules, either using fixed X/Y values, or using random ranges for more variety. +This will make much easier creation of organic elements like vegetation, dirt etc. + +## Better drop-down UI component +![](1.3.0/advancedSelect.png) + +The new DropDown UI component supports: + + - Quick searching + - List or Grid view + - Icons + - Colors + +## Customizable backup directory +![](1.3.0/backupDir.png) + +You can now customize the location of your backups. + +Please note that, to restore a backup, you should use LDtk and not copy files by yourself manually from your File Explorer / Finder. + +## Collapsable tags +![](1.3.0/collapsableTag.png) + +Tags are now behaving like "folders" and can be collapsed/opened accordingly in UI. + + +## Lists quick search +![](1.3.0/filter.png) + +You can quick search most lists from the interface: + + - recent files on the Home screen, + - entities, enums, layers, etc. + + +## Customizable recent files colors +![](1.3.0/homeColors.png) + +You can now customize colors for all your recent projects on your Home screen. + + + +## Better compact mode +![](1.3.0/compactMode.png) + +Just press `TAB` to switch between **normal** and **compact** UI modes. The reworked compact mode is now even more... well.. compact. + + +## Other changes + + - Added "Repeat" option for level background images (thanks to [Lojemiru pull request](https://github.com/deepnight/ldtk/pull/853)) + - Added "Display scale" option to all custom fields + - Added support for CastleDB icons import. + - Enum tiles can now be any rectangle from the tileset. + - Added quick search to Home + - Added colors to entities in the list from the Entity panel + - If you have a "Tile" custom field in your level, you may now use it as a replacement for the rendering of the level in the world view. + - Added "Specific entity type" constraint for Entity References + - Added a context menu to layers list in the main panel + - Added a context menu on all custom fields to edit their definition + - Added "colored flags" icons to the embedded atlas + - Better pivot editor design + - Sections of the World panel can now be collapsed (world settings, current level properties and level custom fields). + - Fixed the size of Reset buttons in custom field forms + - Fixed entity render update when zooming in/out + - Fixed the "World IID" values that changed randomly in the JSON, if the project isn't in Multi-Worlds mode. + - Fixed a crash when switching to world mode during a rule edit + - Fixed a very old rules bug that prevented Symetric rules to not re-apply in the same grid cell, if it applied there previously. + - Fixed a crash when opening wizard on an improperly defined auto-layer + - Fixed crash when moving a deleted tile + + +# 1.2.5 + + - Added custom user documentation for Entities and Layers + - Entity width and height no longer work as minimal values for resizable entities + - Updated mouse cursor for entity resizing handles + - Removed some useless tooltips in Rules panel + - Fixed a crash when adding a value to an array of Int in an Entity + - Fixed escaping of user docs strings in JSON + - Fixed a crash with specific level background images + - Fixed isolated "collapser" in Entity panel + - Removed the help block at the top of all panels to make more room for content. + +# 1.2.4 + + - Added a new **Table of content** to the JSON, which lists all instances of any given entity. + For example, this is especially useful if you want to have a quick access to the location of all PlayerStart entities in your game without parsing all your levels manually. + To enable it, just check the "Add to table of content" option of an Entity definition. + - Fixed lags in world view when using the fields render mode "Outlined text". + - Fixed `A` key when using `WASD` navigation. + - Fixed opacity inputs (icon, border and fill) in Entity panel. + - Fixed incorrect main value when editing an existing group using Rules Assistant + - Fixed an error with Haxe API when a tileset is not defined in layer definition. + - Fixed the auto-layer assitant resize as you pan. + +# 1.2.3 + + - Entity definition properties can now be collapsed to give more room to the custom fields. + - Fixed "FixedArray limit reached" crash + - Fixed the wrong error message when duplicating an entity (ie. "You cannot have more than 0 Entity") + - Added a big warning when creating a new project right in the app dir (any user files in the app dir are lost during updates) + - Better warning when saving an existing project in the app dir. + - Changed the way automatic colors are picked for new enum values, entities, intGrid values etc. + +# 1.2.2 + + - Added an option to use the old-school "opaque tables" visuals for Entity fields (see in the application settings, `F12` shortcut) + - You can now pick an "outer" IntGrid value in the rules assistant. This allows to use the assistant to create transitions tiles between 2 specific IntGrid values (eg. grass/dirt) + - Re-designed the [JSON online documentation](https://ldtk.io/json) to be *way* easier to use. + - Updated the application settings window + - Fixed `A` keyboard shortcut for non-WASD keyboards + - Fixed external links in Release Notes window + - The color of IntGrid values in the Rules Assistant are now shown in the pattern palette, in the lower-left corner of the window. + - macOS builds are now "universal" like the Windows ones. This means that the official macOS release should now install properly on both Intel and Apple Silicon architectures. The downside is that the installer is now larger than before. + +# 1.2.1 + + - Fixed entity arrows not pointing at their target properly, if the source entity was resizable. + - Better display of hotfixes vs major updates in the Release Notes window + - Fixed position of the window listing all LDtk versions + - Fixed macOS build + +# 1.2.0 - Auto-layer rules assistant + +## Auto-layer rules assistant + +The new Assistant makes the creation of standard auto-tiles rules super easy! + +Fill the layouts on the left using your own tiles and LDtk will create all the rules accordingly. By default, if you don't have all the orientations drawn, the assistant will automatically just use symmetrical rules to fill the gaps. + +And if you forget something or want to make a change, you can simply edit the layout again to update the rules automatically. + +![](1.2.0/rulesWizard.gif) + +## WASD controls + +You can now navigate through your current tool values using WASD keys. + - In IntGrid layers, this will cycle through values, + - In Entity layers, `W/S` will cycle through values, while `A/D` will quickly jump between tags + - In Tiles layers, this will navigate in the current tileset. The selection will automatically use any previously "saved selection" to smartly navigate through your predefined group of tiles. + +Because of this change, the following keyboard shortcuts were modified: + - Switch to World mode: `SHIFT+W` or `~` (previously `W`) + - Toggle single layer mode: `SHIFT+A` (previously `A`) + - Save current tile selection: `SHIFT+S` (previously `S`) + - Flip horizontaly currently selected tiles: `X` (previously `X` or `Z`) + +![](1.2.0/wasd.gif) + +## Entity fields visuals + +The visuals of entity fields have been reworked again to increase clarity and reduce cluttering. +However, keep in mind it's always better to not display *everything*. The less, the better ;) + +![](1.2.0/fields.png) + +## Arrows +You can now customize the design of arrows used in Point or Entity Reference fields. + +![](1.2.0/arrows.png) + +## Auto-layer rules remapping + +**TLDR; This new tool makes the creation of variations of Auto-layer rules very fast.** + +For example, if you've created a bunch of rules that use the IntGrid value 1 to paint "Stone walls" tiles, you may duplicate and remap them to use IntGrid value 2 and, say, "Metal walls" tiles. + +Right click on **a group of rules** in an Auto-layer to **Duplicate and remap it**. +This new tool allows you to make a copy of these rules, while doing the following operations: + - replace IntGrid values they refer with another ones, + - transpose the tiles they produce to another part of the tileset. + +![](1.2.0/remap.png) + +## Icons +New useful icons were added to the embed icons atlas, like keys, locks, and various shapes to be used with the 9-slices scaling feature of entities. + +![](1.2.0/icons.png) + +## Enum tags display + +A new option allows to visualize "Enum tags" attached to tiles in the Editor context (thanks to [Keith Clark](https://github.com/deepnight/ldtk/pull/707)). Just press the new "Show/Hide enums" button near the Layers list. + +In the following example, all tiles were tagged with a Material enum (stone, grass, metal etc.) and the result can be displayed right in the editor context. + +![](1.2.0/enumTags.png) + +## Custom commands + +You can now define custom commands to be executed at various moments (when the project is loaded, saved etc.). These commands can be used for whatever your own production pipeline requires. Here are some typical examples: + +- After saving, run a script that parses the JSON and extract all the texts for future localization. +- When pressing CTRL-R, run your game. +- After saving, parse the project JSON and check if all levels are properly connected, from your game logic perspective. + +For obvious security reasons, LDtk will always ask you first if you trust the project and want to allow commands from it. + +![](1.2.0/customCommands.png) + +## Misc + + - You can add user-defined documentation to any entity or level field. + - You can right click on a group of rules to modify the "out-of-bounds policy" of all its rules in a single batch. + - Added nicer default colors for various elements (eg. int grid values, entities, enum values etc.). The palette is "*Endesga32*" by Endesga (https://lospec.com/palette-list/endesga-32) + - Added a Color blind option in app settings: for now, this will only affect the colors automatically picked for new Entities, IntGrid values, Enums etc.) + - Hold SHIFT to disable snapping when moving levels around in the world view. + - You can now manually enter custom values for Entity pivots. + - Many Load button in the UI will now remember properly their last folder + - Added extra info to the Simplified Export JSON file (level custom fields, identifiers etc). + - Added a new layer option to prevent selections when the layer is not active. + - Fixed entity duplication that broke entity count limits. + - Many UI fixes (thanks to [IrishBruse](https://github.com/deepnight/ldtk/pull/770)) to remove unnecessary borders and align things. + - Added a "reset" button near any entity/level field that isn't using its default value. + - Fixed duplicate identifiers when inserting a level in Horizontal/Vertical layouts + - Fixed a crash when duplicating a point from an Entity. + - Duplicating a selection containing Entities no longer ignores the limit counts defined for these entities. + - Added support for proper Point duplication for entities that have an Array of Points field. + - Fixed default multilines values that dropped newline characters. + - Fixed the default tile of an entity when one of its fields is a Tile, but it is not set to override the entity tile itself. + - Fixed the Rule editor window when the layer has no IntGrid value. + - Fixed embed icons reloading when the image was resized. + - Fixed useless scrollbar in context menus. + - Fixed Haxe enum importer regex. + - Fixed levels BgColor in JSON not updating when changing project default + - Updated the design of the home. + +## JSON changes + +The following fields deprecated in update 1.0.0 were removed from the JSON in 1.2.0: + + - Removed `LayerDef.autoTilesetDefUid` (use `tilesetDefUid` instead). + - Removed `EntityDef.tileId` (use `tileRect` instead). + - Removed `NeighbourLevel.levelUid` (use `levelIid` instead). + +## Haxe API + + - Added definition JSON access to Layers and Entities + - Removed irrelevant entity arrays in layers that have "required tags" or "forbidden tags". + - Fixed an exception with null defs. + - Added `pxWid`/`pxHei` to layers + +# 1.1.3 + + - Fixed a crash on Home screen for macOS + - Fixed path to samples on macOS + +# 1.1.2 + +## Import enums from JSON and text files + +You may now import project Enums directly from an external file (previously, only Haxe and CastleDB). This enum will be updated as you edit the file and LDtk will take care of value losses or renamings. + +The following formats are now accepted : + + - **JSON**: expected format is + ```json + { + "MyEnum1" : "a,b,c", + "MyEnum2" : "a b c", + "MyEnum3" : [ "a", "b", "c" ] + } + ``` + - **Text file**: one enum per line. Each line should use one of these formats: + - `MyEnum : valueA, valueB, valueB` + - `MyEnum : valueA valueB valueB` + - `MyEnum : valueA ; valueB ; valueB` + +## Better imported enums + +The sync window for External Enums was completely reworked: + - better UI, + - added support for enums and values renaming. + +You can now also import and sync Enums from a **Castle DB** file (http://castledb.org). + +![](1.1.2/sync.png) + +## Samples list + +For new LDtk users, the samples are now much more visible in the default UI. Feel free to hide them by clicking on the [x] button. + +![](1.1.2/samples.png) + +## Other changes + +- Fixed a crash when pressing `Delete` key while having no active selection. +- Fixed a crash when duplicating a level containing Entity references. +- Fixed incorrect entity ref description in Entity instance panel. + +# 1.1.1 + +- *Super Simple Export* now also creates one **CSV file per IntGrid layer**. +- You can right click on a folder on the Home screen to create a new project there. +- Fixed IID's values and Entity references when duplicating a level. +- Fixed unexpected fill color for "hollow" Entities that use a Tile as a texture. + +# 1.1.0 - Introducing the Super Simple export + +## Super Simple export + +**I know: for every new tool out there, there is this moment when you need to write the importer for your favorite game engine.** + +I’ve been there too, so LDtk offers a *Super simple export* option. You can enable it from the **Project settings panel**. + +You will get: + + - **One PNG per layer** in each level + - A **composite” PNG per level** (ie. all layers merged together) + - A very simple, straightforward and optional **JSON** file per level, if you want to access your Entities data or other information. + + More information on [how it works here](https://ldtk.io/go/simple). + +![](1.0.1/simplifiedFormat.png) + +## Other changes + + - Updated the look of notifications in the bottom right corner. Errors and Warnings will now also blink once to catch more user's attention, as needed. + - Added a shortcut link to previous major version notes in "Release Notes" window + - If you have "Open last project" enabled, but close current project, then re-opening LDtk will now bring you back to Home screen. + - Removed recommendation to enable "External levels" in Project Settings panel. + - Fixed missing coordinates display after going to World view. + - Fixed `intGridValue` presence in JSON for non-IntGrid layers + +# 1.0.0 - Gone gold! + +## A few words from the author + +**When I started working on LDtk about 1 year ago (which was known as *LEd* back then), I would not have imagined how far and how big this would get.** LDtk was a critical part of my personal game dev plan, because I knew I needed a modern, fast and user-friendly level editor for my future projects. + +Along the way, a passionate community of level designers, aspiring game devs and tech enthousiasts gathered around the project, providing an incredible support and lots of precious feedback. + +**To all of you, thank you.** + +This 1.0 step is obviously a *major* milestone. It is the *biggest* update so far and it pushes LDtk to the next level (pun intended): + + - New entity reference system + - Great performance boost for large projects + - Integrated icons and many quality-of-life changes + - New world layers + - User interface reworks + +I hope you will like it, as much as I enjoyed making it :) + +## Entity references + +This new "field" type is available to all Entities and is used to store a reference to another Entity. + +A typical example is a *Button* entity with a Reference field pointing to another Entity, like a *Door*. + +You can create arrays of References, or define restrictions to which kind of Entity they can point at. This new powerful feature unlocks lots of new exciting possibilities in a very user-friendly interface. + +![](1.0.0/entityRefs.png) + +## Integrated icons + +LDtk now has an integrated icon tileset to make your Entities easier to read in the editor. + +Please note that these icons were provided courtesy of their author, **FinalBossBlues**, and are to be used *only* in the editor environment. + +If you want to use them in your game directly, you will need to license it from its author FinalBossBlue ([itch.io](https://finalbossblues.itch.io/icons)). He's a nice person, feel free to send an e-mail to get in touch :) + +![](1.0.0/icons.png) + + +## General performances + +Thanks to major optimizations, general performances will see a big boost, while reducing CPU usage, especially on large projects. + +Loading and Saving operations were also vastly improved: + - **Saving time** for large projects is much faster (approx. 8-15 times!) by caching elements that weren't modified. + - **Progress bars** provide better feedback when working on large projects. + - **Backup** system are faster and more reliable. + +![](1.0.0/saving.gif) + + +## Editing performances + +The way auto-layer rules are calculated was reworked (and a few bugs were fixed), making their rendering significantly faster, especially in large levels. + +![](1.0.0/rulesPerf.gif) + + +## Undo/redo + +The undo/redo engine was complitely rewritten in a much more simple and optimized fashion. This results in a huge performance boost for large levels, while also fixing some existing issues when undoing a Selection move. + +![](1.0.0/undoRedo.gif) + + +## Rectangle of tiles for Entities + +Entities (and levels too, actually) can use a new Custom Field type which can store a rectangle of tiles from any Tileset. This can be used as an alternative skin, an array of animation frames, an "opened" visual state for a a chest etc. + +![](1.0.0/tileRect.gif) + +## Copy and paste (work in progress) + +For now, this crazy futuristic feature is only available for interface panels (eg. Layer definitions, Auto-layer rules etc.) but will be soon expanded to data in levels, such as entities or large chunks of layer elements. + +You can right click on an element with a context menu to copy/cut/paste/duplicate definitions! LDtk just entered modern era. + +![](1.0.0/ruleCopy.gif) + +## Simplified world layers + +Levels can now be organized in "depth" to support stacked levels. + +![](1.0.0/worldLayers.gif) + +## Reworked toolbar and shortcuts + +The main editor toolbar was reorganized to be a little bit more logical: + + - `Level` button is now near the `World` button. They also share the same color. + - The `Project` button is now brown and near the four Definition buttons. + - The keyboard shortcuts for the various panels are now: + - `P`: project settings panel + - `L`: layers panel + - `E`: entities panel (replacing the previous "Select empty spaces" option) + - `U`: enums panel + - `T`: tilesets panel (replacing the previous "Toggle tile stacking" option) + - `F1` to `F10` keys are now associated with layers selection (replacing the previous `0-9` keys shortcuts) + +![](1.0.0/mainBar.png) + + +## User interface improvements + +The **`Space`** key now fulfills various roles: + - Hit `SPACE` once to recenter view on current level or on the whole world (depends on where you are). + - Hold `SPACE` and drag with `Left mouse button` to scroll the view. + - Hold `SPACE` and drag with `Right mouse button` to zoom in/out. + +The editor UI **font** nows uses *Noto* which offers better readability. While I was at it, I also fixed various font size issues with 2K and 4K monitors. + +Enums and Tilesets can now be organized using **user defined tags**: + +![](1.0.0/tags.png) + +Errors in entities, such as a "null" custom field while being defined as "required", are now much more visible in the level view. + +![](1.0.0/error.gif) + +Contextual **help tips** were also reworked and streamlined in every existing panels. You now have a single small "?" indicator that gives all useful info you need for pretty much every editor options. + +![](1.0.0/help.gif) + +## Code signing on Windows + +LDtk executable is now properly signed on Windows, which should ultimately get rid of "This application could destroy your computer" warning. + +![](1.0.0/codeSign.gif) + +## Other major changes + + - **IntGrid values sorting**: that's right, you can now sort your IntGrid values. Please note that re-organizing values will not remap them: so moving value "1" down, for example, will not modify it ("1" value stays "1"), only values order changes. + - **Image reloading bug fixes**: + - Reloading of images (tilesets, backgrounds etc.) will no longer occur if the app is not focused. As soon as LDtk is focused, images are updated. + - Fixed a critical crash when reloading an image which has a different width/height. + - You are no longer limited to deleting the last IntGrid value. + - **Project colors**: when you pick a color, a list of all colors used in this project will be displayed, to make consistent color usage easier. + - **"Identifier" format policy**: you can now pick your prefered "Identifier case policy" (default is "1st letter uppercased"). + + +## File format changes + +### Worlds + + - Added `worlds` array and `World` JSON structure to the docs. This was added as a preview for the upcoming new feature "Multiple Worlds in a single project". Learn more about that here: https://github.com/deepnight/ldtk/issues/231 + +### JSON changes + + - All new projects will now discard by default the deprecated data of IntGrid layers (ie. the **pre-"CSV format" data**). More informations here: https://github.com/deepnight/ldtk/issues/358 + - **IntGridValues** array index should no longer be used to guess IntGrid values, since the array can be manually sorted by users. See https://github.com/deepnight/ldtk/issues/553 + - To avoid unnecessary file changes and renamings (bad for versioning systems), the following changes have been made: + - Irrelevant worldX/worldY values are now "-1" for all levels if the world layout is Horizontal or Vertical + - Irrelevant __neighbours array is now empty for all levels if the world layout is Horizontal or Vertical + - `tileId` in Entity Definitions has been replaced by `tileRect` to support multiple tiles instead of just single ones. The `tileId` will still be exported for now, but will be removed completely soon. + - `levelUid` in Neighbours arrays has been replaced by `levelIid` (new string based IID). The `levelUid` will still be exported for now, but will be removed completely soon. + - Merged the `autoTilesetDefUid` into `tilesetDefUid` for all Layer Definitions. This should have no impact if you properly used the `__tilesetDefUid` found in Layer Instances, as recommended in the docs. The `autoTilesetDefUid` will be dropped completely in a later update. + - Added `__smartColor` to Entity instance JSON. + - Fixed format of value "type" in JSON (now, it's always a String) + - Fixed unexpected `intGridValues` in JSON for non-IntGrid layers + - Fixed nullable Floats fields to now be really null in JSON. + + +## Multi-worlds experimental preview + +You can try multi-worlds using debug menu. Please note that this feature is highly experimental and will probably evolve a lot in upcoming updates. Don't use for production. + - Open an existing project, + - Open debug menu (`CTRL+SHIFT+D`), + - Create a new world, + - Navigate through worlds using the context menu in empty spaces between levels. + - Right click on an existing level in World view to move it between worlds. + +### Other changes + + - External level files will no longer be prefixed with their index in array to avoid unnecessary renamings when inserting new levels. This can be re-enabled in Project panel, using an Advanced Option at the bottom. + - Fixed `enumTags` and `customTileData` typing in QuickTypes files. + - LDtk logs are now stored in a more legitimate location, depending on your OS. To locate your log file, just open settings (`F12` key) and look for the Log File line. + +## UI + + - Entities can now use rectangle of tiles for their representation instead of just single tiles. + - Added support for **9-slice scaling** mode for Entity tiles (how it works: https://en.wikipedia.org/wiki/9-slice_scaling). + - New dialog to configure auto-layer Rules modulo, with support for X/Y offsets. + - You can now use `up`/`down` arrow keys to quickly increment/decrement an input value + - You can now freely adjust fill/outline/tile opacities of Entities. + - Current Level properties can now be edited directly from world view. + - Entity and Level custom fields that are not using default value are now much more visible in forms. + - Added a new optional "guide" grid per layer. This customizable grid is not used for snapping, and only serves as a visual guide. + - Better display of entities that have error(s) in their field values. + - Grid lines in levels are now truly 1 screen pixel thick. + - Added a new option (`CTRL-H`) to hide everything except Tiles in layers (entities, labels, intGrids etc.) + - Added an "App Settings" button to the main panel in editor + - Added a "*" near level names if they were modified but not saved. + - Added an error message when exporting to Tiled while having unsupported Aseprite images. + - Added `PAGEUP`/`PAGEDOWN` keyboard shortcuts to zoom in/out + - Added a unit selector (pixels/cells) near coordinates/size fields of entity instances + - Tiles that overflow outisde of a level are now properly visually cropped. + - Hold `SPACE` + Right mouse click to zoom in/out + - Better support of trackpad pinch gestures to zoom in/out + - Added a "Rename project" button in Project panel + - Added Youtube video tutorials to the Help panel + - Added "Release notes" button in Help panel + - Added a "click trap" to prevent miss-clicks while the app is not focused. Previously, if you clicked on the LDtk window to re-focus it, you would edit some layer or click a UI element accidentally. + - Changed `T` shortcut to `SHIFT-T` for "Tile stacking" + - Changed `E` shortcut to `SHIFT-E` for "Select empty spaces" + - Reworked the Enum panel and fixed many UX issues + - Removed the "CPU throttling" option from the app settings. The CPU throttling has been reworked and should not longer be noticeable at all. Therefore, it is now always enabled to reduce battery usage on laptops and energy consumption in general. + - Removed the "Tile Flickering Fix" option from the app settings: it was costly and inefficient. + - Replaced the dashed lines used to connect points by a smoother zig-zag line + - Entity fields and related visuals will now be faded away when not working in their layer. + - Entity fields width will now be limited by their entity width (this greatly reduces screen clutter when having many fields displayed) + - Custom fields of type Integer or Float can now have an optional text prefix/suffix to display in editor. Useful to display a unit near a value, like "0.5sec" or "$17". + - Added more values for App UI scaling setting. + - Added a Layer option to fade it away when it's not currently selected + - Added a Layer option to hide it from the layers list + - Moving mouse over UI components no longer interrupt view panning (Middle mouse click or Space+click) + - The "collapsed/expanded" status of a group of auto-layer rules is no longer saved in the project file: all rule groups will now be collapsed by default when loading a project. + - You can now manually reload any image asset (tileset, background etc.) using their "↻" button. + - Tool tips are now larger and easier to read. + - Mouse-overing entire rule blocks in the panel will no longer preview affected cells in the level. Now, to preview affected cells, you have to move your mouse over either the group name, or the "pattern" block. + - You can now manually edit X,Y coords and width,height values of an existing Entity. + - If you open a Backup copy of a project, all panels will be locked, preventing any edit. You may only Restore the backup. + - Level identifiers are now displayed in the top-left corner of levels in World view + - Better Level identifiers rendering in World view (they should now be easier to read in general) + - Clicking on the "New Tileset" button immediately invokes the "Pick image file" dialog. + - Creating a new Rule group will now immediately offer to rename it. + - Changed the "Help" button color in the main editor bar. + - Changed the aspect of various help-related elements. + - Zooming out a lot now has a subtle dimming effect. + - Added scrollbars to dialogs that are larger than app window (this could happen for example when using excessively big App UI scaling settings) + - Reorganized the debug menu (`CTRL-SHIFT-D`) + + +## Bug fixes & misc + + - Fixed a crash that could happen during reloading of an image, if it was being used by another app. + - Fixed "Locate file" buttons opening Windows explorer in the background + - Fixed tile picker centering animation when picking a tile from a level (using ALT-click) + - Fixed unnecessary re-rendering of all project layers when enabling/disabling optional group of layers + - Fixed "Smart CPU throttling" slowing down long operations (eg. saving a large project, or updating many auto-layer rules) while the app isn't focused. + - Fixed "hollow" entity selection which was kind of... erratic. + - Fixed entity "resizing handles" not updating properly when duplicating/moving an Entity + - Fixed the progress bar when saving large projects + - Fixed TAB key behavior when an Entity instance panel is open + - Fixed weird behaviors when clicking on overlapped levels. + - Fixed a crash when clicking on a partial tile in the Tilesets panel + - Fixed a crash when deleting the last level + - Fixed a crash when moving an Entity with a null "point" field value + - Fixed a rare crash when loading Aseprite files + - Fixed a crash related to Regular Expressions in String fields (thanks to Clement Duranti) + - Fixed a bug when reloading a tileset while its width changed. + - Fixed layers list not being properly updated when leaving world mode. + - Fixed a crash when using a field containing an array of null enums. + - Fixed various Quicktype generation issues. + - Fixed opacity of layers when exporting PNGs + - Added "Type" value for entities in Tiled exported files + - Updated sample maps + - Fixed project assets path resolution when starting LDtk from command line and providing just the project file name as an argument (eg. `/path/to/app/LDtk myProject.ldtk`) + - Many minor bug fixes. + +# 0.9.3 - Ludum Dare 48 edition + + - **Aseprite support**: you can now load an Aseprite image directly as a tileset or as a level background. It will be automatically reloaded if it changes on the disk, just like any another image. + - **Level PNG export**: it's now possible to export a single flattened PNG per level, making the "*Easy to integrate with your game engine*"-thing even easier. You can still export one PNG per layer per level if you prefer. + - Fixed offseted "Close project" button + - Fixed "textLanguageMode" typo in JSON + - Minor bug & doc fixes + +# 0.9.2 + + - Added a tiny "(...)" above entities with fields when they are hidden + - Fixed "re-open last project" that could sometime reset app settings + - Fixed rule editor not updating when changing pivot + - Fixed incorrect "Perlin noise" preview when right click on the Perlin option in Rules panel. + - Fixed "shrinking" tileset view when panning it + - Fixed discarded "levelPaths" array when importing OGMO projects + +# 0.9.1 + + - **Fixed broken "New project" button. Sorry!** + - Added an option to **re-open last project** when starting LDtk (open Settings with `F12`) + - Hold `CTRL` to disable preview when moving mouse over auto-layer rules. + - Fixed missing tooltips in rules panel. + - Fixed tooltips staying on screen in rules panel. + + +# 0.9.0 - Biomes and tags + +## New features + + - **Optional auto-layer rules**: this new key feature allows to create "biome" and "variations" by defining group of rules that only apply to specific levels. Please check the new sample "`AutoLayers_5_OptionalRules`". How it works: simply right click on a group of rules in the Rules panel to mark it as `Optional`. This group will then be disabled by default everywhere, and you'll be able to manually enable it in some specific levels only. + - **Tile tags**: you can now associate an Enum to a Tileset, then "paint" values from this Enum freely on each tiles in the tileset. This could be useful to mark collisions, water tiles, surface sounds or whatever tag you could think of. To use this new feature, just open the Tileset panel, select an existing Enum for a tileset, and start tagging directly. + - **Tile custom data**: you can add totally custom text values to each tile in any tileset. This could be plain text, JSON, XML, etc. + - **Auto level naming**: you can let LDtk name your level identifiers automatically using a **custom pattern**, as defined from the Project settings panel. Some examples: + - default pattern "`Level_%idx`" will name levels "Level_0", "Level_1" etc, based on their order of creation (or order in array, in Horizontal/Vertical world layouts) + - with the pattern `MyLevel_%gx_%gy`, each level will be named using the world grid X/Y coordinates (only applies to GridVania world layouts). + - **Auto-layers tileset switching**: in each level and for each layer, you can now switch the tileset on-the-fly. + - Added "Isolated points" as new display option for points in Entities (thanks to *Stuart Adams*) + - Each **enum value** can now be associated with a custom color for easier reading in the UI. + - Re-worked the **Rules panel** to have less buttons and lost space. Some actions where moved to the context menu (eg. renaming a group of rules) + - Array of Points in Entities can now be displayed as "**looping paths**". + +## JSON format + + - **WARNING**: last call before the removal of the deprecated value `intGrid` in `Layer instances`! If not done yet, please switch to the `intGridCsv` value. The old value will be removed on 1.0.0 update. + - Added **tileset tags**: new array `enumTags` in `Tileset definition JSON` (see https://ldtk.io/json/) + +## Other + + - Completely reworked the way the "Auto-layer rules" panel was updated. This should reduce UI flickering and slow-downs while editing rules. + - Tilesets can now be manually sorted in Tilesets panel + - Added a new "Optional rules" sample map. + - Double click on Entities to automatically select all their connected Points. + - Added a one-time "enable backup" recommendation popup for medium/large projects. + - Added a "Create level" button in world panel. + - Added an error message when trying to create a new project in an invalid folder. + - Added a warning notification when moving an Entity or a Point out of level bounds + - Added a "close" button on Home screen, when in fullscreen mode + - Added a popup with various options when project saving goes wrong. + - Increased max width/height for Entities + - The keyboard shortcut to toggle auto-layers rendering is now `SHIFT-R`. + - Reduced tile flickering while zooming in/out (this reduction can be disabled from the app settings) + - Adjusted custom fields scaling policy (especially for multi-lines fields). + - Disabled level dimming while editing an auto-layer Rule. + - Extended app logging limit (from 500 to 5000 lines) + - Fixed default "smart" color of entities. It uses the first color value found among fields, in order of appearance, otherwise it defaults to entity main color. + - Fixed fullscreen not applying at startup on Debian (not tested, hope it'll work!) + - Fixed entity handles not disappearing when movin a resizable entity out of level bounds + - Fixed a rare crash when saving a project without providing file extension. + - Fixed various rare minor errors while saving. + - Fixed "Create group" button in Auto-layer Rules panel + - Fixed a crash when adding a single entity point + - Fixed Enum value renaming in Level fields + - Fixed Enum value renaming in Entity fields + - Fixed button color in extern enums list + - Fixed Save or Update operations going super slow while the app wasn't focused + - Fixed incorrect values listed in the "out-of-bounds policy" select in pure auto-layers rules + - Fixed email address on contact links + - Fixed auto-layers baking giving different results if they contained any stacked tiles. + - Updated various internal libs + +# 0.8.1 + + - **Fullscreen mode**: just press `F11` to toggle this mode. + - **New entity tile display modes**: entity tile can now be displayed in more ways: **Repeat** (ie. repeat tile to cover entity bounds), **Cover** (ie. covers the full entity bounds), **Fit Inside** (stretched to fit inside entity bounds). + - Removed deprecated "Crop" from Entity tile render modes + - Added an option in LDtk settings to start the app in fullscreen mode + - Fixed cursor position while zooming + - Fixed "close" button in Rules panel + - Fixed scrollbar in Help panel + - Updated README + +# 0.8.0 - Level custom fields, resizable entities and more! + +**Note for developers:** *IntGrid layers* JSON format changed in this update. For now, retro-compatibility is maintained with old importers, but this will be dropped after update 0.9.0, breaking outdated importers. Please read all the details here: https://github.com/deepnight/ldtk/issues/358 + + - **UI rework**: many interface elements were reworked and cleaned up (less lines, less gutters). This includes panels, main side-bar, custom fields editor, etc. Also, the world panel is now separated from the "current level" panel, so it's no longer mandatory to go to "world view" to edit your active level settings. I hope you'll enjoy the changes :) + - **Level custom fields**: just like Entities, you can now add custom properties to your levels and edit values per-level. For example, add some FilePath field, name it "music", filter allowed files with "mp3 ogg" and you get a custom music picker in each of your levels. + - **Custom fields** have been visually re-organized to be easier to read in-editor. Labels and background are now aligned, and various minor display bugs were fixed. + - **Resizable entities**: Entities can now be marked as resizable horizontally and/or vertically. This new feature opens the possibility of creating "Region" entities (ie. a custom rectangle or ellipses), with fully customizable properties. + - **Entity tags**: tags are labels that can be freely added to any Entity definition. They can be used to group entities in the editor (ie. actors, regions, interactives etc.) and to filter allowed entities per layers (eg. a "*Region*" layer that can only contain "*region*" tagged entities). + - **CPU optimizations**: the app CPU usage should now be close to 0% while its window is minimized or not focused. Also, a new setting "Smart CPU throttling" (*enabled* by default, recommended) will also reduce CPU usage while doing "not too demanding" actions in the editor. All these should greatly reduce battery drain on laptops. + - **Ogmo 3 import**: you can now import Ogmo 3 projects to LDtk. Most features are supported, but feel free to drop a message on GitHub issues if you have any specific needs :) + - The **UI scaling** has been fixed for 4K and 8K displays. You can now adjust the general application scale factor from the app settings (press `F12`). + - **CodeMirror**: editing of "multi-lines" fields in entities (and levels) is now done using an almost fullscreen text editor based on *CodeMirror* library. This allows syntax highlighting, basic completion and various quality of life features. Supported types include XML, JSON, Markdown, LUA, JS, C# etc. Feel free to ask for more languages on GitHub issues. + - **Debug menu**: you can now open a debug menu by pressing `Ctrl+Shift+D`. It will contain some commands that could be useful if you encountered some specific bug types. Commands inside this debug menu are *harmless*, so you can use them *without any risk* (unless some in-app message says the opposite). + - Tileset can now be changed on-the-fly in each Tile layer. + - The Windows **setup file** is now twice bigger. Yeah, I know this isn't an actual feature, nor a great change. *But* this opens support for both 32 and 64bits environments. Please note that the *installed* version size hasn't increased, only the *Setup* executable. + - Moved buttons to the top of project Panels. + - Removed all "Delete" buttons in project panels + - It's now possible to associate icons with external enum values from a Haxe HX file. + - Added a *Preset* button to quickly create a "Region" entity. + - Entities can now be marked as "Hollow", which will allow editor mouse clicks to pass through, except on edges. + - You can now show/hide multiple layers at once by holding left mouse button over visibility icons (Photoshop style). + - Use `Shift` + left click on a visibility icon to Show or hide all other layers except the current one. + - Added a button to access previous changelogs in "Update" window, on Home screen. + - An Entity count can now limited per world or per layer. This is especially useful for elements like Player start position, which should be unique in the world. + - A suggestion to enable Backups will now appear when opening a large project file. + - The visibility status of a layer is now saved with the project. + - When baking an Auto-layer (ie. flattening it), you are now given choices on what to do with the original baked auto-layer (delete, empty or keep). + - Level background is now faded away in "Single layer mode". + - Smarter auto-naming when duplicating something (ie. a copy of an Entity named "foo50" will now be "foo51", "foo52" etc.) + - Each Entity field type now has an associated color, making field list easier to read. + - The default size of a new level can now be customized from the World settings (press `W`, then open settings). + - **Mouse wheel** can now be used to switch to world mode (and vice versa) automatically. A new related option has been to app settings (`F12`). + - Fixed zoom speed using mouse wheel. + - Fixed Point fields in entities where clicking the same coordinate twice added multiple identical points. + - Fixed Rule "pink" preview being stuck when moving mouse over a level + - Fixed incorrect default tile when creating a new Enum value. + - Fixed "New project" dialog opening twice on Home screen + - Disabled "New level" context menu when holding `Shift` or `Alt` + - Fixed layer order for "simplified" level render in World view + - Entity fields are now slightly faded out when not currently on an Entity layer + - Fixed a "pink square" on Entities when reloading a texture modified outside of LDtk + - Fixed entity instance editor not closing when switching level + - Fixed a bug when adding *new Entity fields*, where some existing entity *instances* were not properly updated in the JSON file. + - Fixed sorting of arrays in entity fields + - The default behaviour when limiting an entity count is now to "Move the last one" instead "Discard the oldest one". + +# 0.7.2 + + - Added a setting to change font size in Editor UI. + - You can now press `F12` to open app settings from almost anywhere. + - Added a button to delete crash recovery files on Home screen + - Added file naming customization for layers exported as PNG + - Fixed selection color (when using `ALT+SHIFT`) + - More robust JSON parsing with invalid integer numbers + - Fixed a crash with empty tilesets + - Fixed a crash loop on Home screen + - Minor visual fix on splash screen + +# 0.7.1 + + - Fixed a crash when saving separate level files. + - Fixed a crash with FilePath fields in Tiled export. + - Fixed removal of empty dirs when saving a project. + - Added a new "settings" button to LDtk home screen. + - Fixed useless autoRuleGroups array in JSON + - Added an option to force the app to always use the best GPU. + +# 0.7.0 - Getting serious + +This update features many important changes to make LDtk **production ready** and **future proof**. These changes will allow better support for large projects, better API creation and maintenance, and smoother user adoption. + +**We are getting really close to 1.0!** + +## Changes + + - **New home layout**: the app home screen has been re-organized to focus on what's really important. + - **Separate level files**: when enabled, LDtk will save separately the project JSON and one file per level. A much needed feature to reduce JSON size and optimize parsing times! The option is in Project settings (press `F1`): "Separate level files". + + When enabled, all the project **settings** and **definitions** will still be stored in the `*.ldtk` file, and all level data will now be saved to separate files (one per level) in a sub-folder, in `*.ldtkl` files (notice the extra `l` letter at the end of the extension). + + **Important notes**: this new feature might not be supported in all current existing APIs and loaders. Also, this option isn't enabled by default, but this might change on 1.0. + - **Save layers as PNG**: if you *really* don't want to bother with the LDtk JSON, you can check this new option in your project settings to export all your layers as PNG images (note: only supported layers will be exported, that is those with tiles). + - **Backups**: automatically keep extra copies of your project in a sub-folder every time you save (enable backups in your project settings). **Important**: LDtk only keeps up to 10 backup files per project. + - **Crash backups**: if, for some reasons, LDtk crashes, it will try to backup your unsaved work automatically. Obviously, this works even if the backup setting isn't enabled. + - **Level background image**: each level can now have a custom background image (PNG, GIF or JPEG) that can be resized and aligned in various ways. + - **New font**: replaced the often hard-to-read pixel font with a sleeker "Roboto" font (this change affects entity fields and floating level informations). + - **New APIs**: LDtk JSON files can now be easily parsed in many languages, including **C#**, **Python**, **Rust**, **C++**, **Javascript**, using QuickType.io generator. These parsers are based on latest JSON schema file (see below) and are super easy to keep updated. You can check [existing APIs on the LDtk website](https://ldtk.io/api/). + - **JSON Schema**: a schema file is now directly generated from source code (ie. a JSON that describes the LDtk project file format). It's available on [LDtk.io/json](https://ldtk.io/json) and contains a schema following Draft 7 standard from [Json-schema.org](https://json-schema.org/). This file describes all fields from LDtk json files (value types and descriptions). The great thing about JSON schema is that it allows **JSON "parser" generation** using *QuickType*. That's right: you can now generate Rust, C#, JS or Python parsers easily, right from the file format. + - **HaxeFlixel support**: the HaxeFlixel game framework has been added to the official [LDtk Haxe API](https://github.com/deepnight/ldtk-haxe-api). You can now easily load and display a LDtk project in your game. + - Moving your mouse cursor over a **Rule group** in an auto-layer will now reveal all layer cells affected by the rules in this group. + - If the auto-layer rule panel is open, moving your mouse over the level will now also highlight rules affecting the current coordinate. + - The [JSON documentation](https://ldtk.io/json) now shows clearly what parts are useful for game devs and what parts aren't (trying to make your dev life even easier!). + - The app home now shows a **list of recently opened folders** along with recently opened project files. + - Optimized the rule pattern editor to update less UI stuff when being edited. + - Tiled TMX files are now exported in a sub folder (along with other optional external files, like levels or layer PNGs) + - Better organized world panel (shortcut `W`) + - Better level name display in Linear world layouts. + - Fixed reloading of tileset images. + - Fixed Electron related security policy. + - Fixed "Lost external enum file" dialog when loading a project. + - Many UI tweaks + - Bug fixes + +# 0.6.2 + + - Added an optional **Regular Expression** that can be tested against a `String` field in an Entity. Any unmatched character in a string value will just be discarded. This allows the creation of custom field type (that needs to follow some specific pattern), while still having a safety net (the editor cleans up invalid parts). + - Fixed missing "world grid size" inputs in Grid Vania layouts. They should now appear in the World panel. + - Fixed level creation in "Linear" world layouts that only contain 1 level + - Fixed loading of null multiline fields + - Fixed a crash on layer removal + - Added "internal" (ie. "only for editor use") indicator for undocumented fields in Json + - Fixed Json doc typo + - Fixed Travis unit tests + - Fixed new level creation in "Linear" layouts that only contained 1 level + - Minor changes & fixes on Home and Support pages + +# 0.6.1 + + - **New website URL: [LDtk.io](https://ldtk.io)** + - New Json schema URL: [LDtk.io/json](https://ldtk.io/json) + - Updated in-app URLs + - Fixed a crash when editing Entity points and switching layer + - Fixed a crash in Tiled TMX exporter caused by tilesets without image + - Fixed macOS build (didn't start properly). + - Fixed long auto-update error message on Linux and macOS versions. + - Fixed entities being destroyed when dragged near level limits + - Fixed *samples* folder location on macOS + - Updated buttons on app home page + - Minor update to app logo + +# 0.6.0 - Take over the world! + +## 💬 Discord + +We now have an official **Discord**! Come join us, we have cookies 🤗 Feel free to share the invite URL: **https://ldtk.io/go/discord** + +## 🌍 World map + +Levels in your project can now be organized in various ways: + - freely on a vast 2D map, + - in a large grid system (aka "grid-vania"), + - horizontally, + - vertically. + +Just hit the `W` or `F2` key to switch to world view, and start re-arranging your creations as you wish! While in world mode, you can `right click` to reveal a context menu. + +## 📑 Other changes + + - **New splash screen**: to reduce screen flickering and dirty window flashes on startup, a new splash screen was added, among other minor changes. The app window should now feel a little more "stable". + - **Smooth zooming/panning**: automatic zooming and panning (eg. when pressing `F` key) are now animated and smoother. + - **New rule editor window**: this UI component really needed some love, so it now features a more streamlined interface and a much better integrated help. + - **User settings** are now stored in AppData OS folder to prevent from losing them on each future update. Unfortunately, this will only apply starting from this version, so settings will be reset one last time :) Sorry! + - **End of beta**: LDtk is no longer considered *Beta* as it's now stable & mature enough to be used in production. + - **"File path" field**: this new field type allow you to refer to an external file directly from an Entity instance (many thanks to [Yanrishatum](https://github.com/Yanrishatum)!) + - Many *under-the-hood* optimizations to support the new World map feature. + - Removed the "double" *Fit* mode when pressing `F`. Now pressing this key just fits the whole level in the viewport. + - Unified R & Shift-R shortcuts: just press R to toggle all auto-layers rendering. + - Fixed loading of files with spaces in name, when using file association on Windows + - Better "invalid value" error display in entity fields (previously, you only had ``). + - Application samples will now display a warning if you try to save them (not recommended as they will be overwritten by future app updates). + - Better Entity panel layout + - Better default entity Field naming when creating a new one + - Fixed a bug in Entity panel that went crazy when containing too many entities. + - Sample maps are no longer added to "recent projects" list + - Updated the Enum panel icon. + - Better display of samples in recent files list on app Home. + - Added a "Close" button to Project panel + - Removed "Loaded" useless notification + - You can now right-click external URL links in LDtk to copy them. + - Fixed "new level" spot suggestion in Free and Gridvania worlds. + - Fixed middle clicks on URL links. + - Fixed many many issues with rules that didn't update properly after some specific changes (eg. perlin, checker mode, modulos etc.) + - Added a "locate project" button to Project panel + - Fixed an infinite loop when resizing a level + - Fixed corrupted auto-layers when resizing a level using the width/height form fields. + - Fixed a bug with files stored in a path containing some special characters (eg. ~ or %) + - Updated the LDtk website + - Updated all sample maps + +# 0.5.2-beta + + - Fixed a crash when loading a project with a "lost" tileset image (ie. path not found). + - Fixed crash window that looped forever + - Better crash report window + +# 0.5.1-beta + + - Added "top-down" sample map + - Fixed "File not found" message at startup + - Fixed a potential crash at startup + - Fixed auto-reloading of modified tileset images + - Minor bug fixes + - Updated external libs used by LDtk (Electron, NodeJS etc.) + + +# 0.5.0-beta - LDtk: it's about tile! + +**Level Designer Toolkit** (*LDtk*) is now the new app name :) I hope you'll like it! The logo was updated, as well as source code, GitHub repo and various other things. + +Because of the renaming, users of the Haxe API will have to run the following commands: + +``` +haxelib remove led-haxe-api +haxelib install ldtk-haxe-api +``` + +You might also need to **manually uninstall any previous installation of LEd**. + + - **Tiles flipping**: in Tile Layers, you can mirror tiles before painting them by pressing `X` or `Y` (or `Z`). This also works from group of tiles. + - **Tiles stacking**: you can now optionaly *stack multiple tiles in a single cell of a Tile layer*, reducing the need for multiple layers. For example, you could paint a brick wall, then enable stack mode (`T`), and add details like cracks or vines over the same wall. Be careful though: erasing of stacked elements can be tricky, so you should use a mix of multiple layers and stacking to get the best results. + - **New editing options bar**: *Grid locking*, *Single layer mode* and *Empty space selection* moved to a new more streamlined button bar. + - **File association**: project files now use the extension `*.ldtk` instead of `*.json`. Therefore, on Windows, double-clicking such files will open the app accordingly. If you prefer the `.json` extension, you can force it in each project settings (but will lose benefit of the file association). + - **Auto-layer rule preview**: when you move your mouse over a rule, you will now see which cells in the current layer are affected, making their testing *MUCH* easier. + - **Tiled (TMX) export**: this optional export now generates proper standard tile layers. However, to support LDtk stacked tiles feature (see above), multiple Tiled layers might be generated per single LDtk layer. Also, IntGrid layers are now properly exported to Tiled (as standard tile layers, with an auto-generated tileset image). + - **New color picker**: it supports copy/paste, manual hex value editing and a much better UI (thanks to [simple-color-picker](https://github.com/superguigui/simple-color-picker)). + - **Flood-fill fixes**: if you hold `SHIFT` while clicking in a Tile layer, it will flood-fill the area using currently selected tiles (randomly, or by stamping group of tiles, depending on the current mode). + - **Flood-fill erasing**: just use `SHIFT`+`Right click` to erase a whole contiguous area. + - The layer Rule editor now overlaps left panel and allows level editing while being open (makes rule testing much easier). Press `Escape` to close it. + - In Tile layers, you can press `L` to load a saved tileset selection (using `S` key) + - Renamed the *Level* panel to *World* (for the 0.6.x future update). + - It's now possible to change the tileset or even the source layer of an Auto-Layer without loosing your rules. + - **Auto-layer baking**: turn a complex Auto-Layer into a standard Tile layer (think of it as the *flatten* feature in Photoshop). Be careful, it's a one-way operation. + - Unified "Show/hide grid" and "Grid locking" options. You can now just press `G` to toggle grid (which also implies "grid locking" in supported layer types). + - All options (such as "Grid on/off", or "Compact panel mode") are now saved to a JSON file in your app folder, in `userSettings/`. + - Help window is now a side panel. + - Opaque tiles are detected in tilesets for use in various optimizations (mostly related to the new tile stacking feature). + - Fixed a crash when deleting IntGrid layer while an AutoLayer uses it as source. + - Added some colors to UI buttons + - New exit button icon. + +# 0.4.1-beta + + - Fixed a jQuery related crash + - Smarter extern Enum file update (ie. silent if changes don't break anything). + - Better logging in case of crash + - Open/save dialogs are now modal to the application + - Fixed distorted left panel in new projects + +# 0.4.0-beta - Selections + + - Experimental **Ubuntu** and **MacOS** versions (thanks to the community!) + - **Selections**: you can now select any element in a level by using `ALT` + left click. You can move it around by holding left click. To select a **rectangle area**, use `ALT` + `SHIFT` + left click. + - **Duplicate**: you can duplicate any element in the level by drag it with `CTRL`+`ALT` keys. + + **NOTE: For now, "undoing" a *selection move or duplication* will require multiple undos (one per affected layer).** Undo/Redo features need a *major* rework, but this will only happen in a future update (see [#151](https://github.com/deepnight/led/issues/151)). Sorry for the inconvenience until this update! + + - **Duplicate definitions**: you can duplicate any *Definition* (layers, enums, entities etc.) by using the new context menu (right click or use "3-dots" buttons) in all panels. + - **Duplicate rules or rule groups**: another much needed addition. + - **Multi-lines texts** added to Entity custom field types. + - **Type conversions**: Entity fields can now be converted to different types (like turning an *Integer* value to a *Float*, or into an *Array*). Some conversions might not be lossless. + + - Renamed the old *Enhance active layer* option to **Single layer mode** + - `Alt`+`left click` now picks elements in *all* layers. If you have the *Single layer mode* activated (`A` key), it will pick in current layer only. + - Added an option to allow selection of empty spaces + - Better mouse coordinates display in editor footer + - Added *rectangle selection size* to editor footer + - Use `DELETE` key to delete selected elements + - Use `CTRL`+`A` shortcut to select everything (limited to current layer in *Single Layer Mode*). + - Optimized the JSON format to reduce its size (should be approximately 40-50% smaller). + - Added the up-to-date *JSON format doc* to the app Home page. + - Added fullscreen button to view Home *changelogs* + - Pressing `ENTER` on the Home screen now opens last edited map. + - Side bar is now more compact + - Better "Enum sync" window + - Fixed "Enum value in use" detection + - Removed duplicate sample map file + - Fixed mouse wheel zoom limits + - Fixed "color" field size in Entity instance editor when the value wasn't default. + - Updated help window + - Pressing `Escape` key now leaves focused inputs first instead of closing panels. + - Many bug fixes & minor enhancements + +# 0.3.2-beta + + - Fixed a crash when resizing level with an Entity having a null Point value + - Added button icons in Help window + +# 0.3.1-beta - Tiled import + + - **Tiled (TMX) export option**: from the project settings (`F1`), check the *Tiled export* option to save Tiled compatible files along with the LEd JSON. + + **DISCLAIMER**: this export is limited because Tiled doesn't support some core features from LEd, like different grid sizes in the same level or Array of properties in Entities. This export is only meant as a short-term solution to quickly load LEd data in a framework only supporting TMX files. See [documentation](https://ldtk.io/docs/general/exporting-tiled-tmx/) for more informations. + + - Better active/inactive visual state for rules and groups of rules in auto-layers + - Inactive rules are no longer exported in the JSON file + - Pressing `F` key twice fits the current level in view but with less padding + - Added an automated JSON format documentation generator (see [JSON_DOC.md](https://github.com/deepnight/led/blob/master/JSON_DOC.md) in sources) + - Added version badges in the JSON doc to quickly identify changes per versions. + - Updated home page + - Updated `sample` maps + +# 0.3.0-beta + + - **Group of tiles in auto-layer rules**: this new feature allows you to place larger objects (eg. *a tree, a big rock, etc.*) made of multiple tiles using just auto-layer rules. + - Added **Modulo** options for auto-layer rules: this allows a rule to only apply every X columns or Y rows. + - Added **Checker mode** for auto-layer rules: this makes effects like "brick walls" or "Sonic checker effect" possible ;) + - **Better hot-reloading**: when a tileset images changes on the disk, LEd will automatically remap tile coordinates if the image size changes. This feature now also works to remap auto-layer tiles. + - **JSON changes**: please check the new [JSON_CHANGELOG.md](https://github.com/deepnight/led/blob/master/JSON_CHANGELOG.md) for up-to-date changes to JSON format. + - Fixed image import that failed if the image file was standing on a different drive than the project file. + - Fixed rule `random` function giving identical results for different rules + - Fixed a crash while editing rules in *pure* auto-layers. + - Fixed a crash when Undo history reaches its max (might need more rework). + - Prepared support for Mac & Linux versions + - Minor fixes for Linux builds + - Updated `Samples` + - Bug fixes + + +# 0.2.1-beta + + - Added `F1`-`F6` key shortcuts for all editor panels + - Updated JSON file format with some extra dev-friendly values + - Added a JSON changelog file for devs working on importers + - Add JSON changelog to app start page + +# 0.2.0-beta - Beta version + + - **Beta version!**: LEd is now stable enough to be used in production and retro-compatibility will be guaranteed from now on. + - **Radius**: Integer and Float entity fields can now be displayed as a radius around the entity (eg. a "lightRadius" Float value can now be displayed accordingly right in the editor display). See `Samples` for some examples. + - **Smart color use**: if you have a Color field in an entity, it will be used when displaying various values in the editor (eg. having a "lightColor" field will affect the color of the circle around the entity). + - Added support for **tile spacing** and **padding** in Tilesets images. + - Entity **Arrays** can now be sorted manually + - Entity tiles can now be displayed as "stretched" (default) or "cropped". + - A preview of the "Perlin noise" is displayed while editing the settings of an auto-layer rule perlin. + - Added **mouse coords** in the bottom-right corner of the window. + - Updated appearance of selected entities + - Added a field display option to use Enum tiles in place of Entity tiles + - Added a new option for entities with count limits ("move last one instead of adding"). + - "Enhance active layer" option is now false by default (press `A` to toggle) + - Entities can now be displayed as "Crosses" + - Various UI fixes in "Compact" mode (when pressing `TAB`) + - Fixed relative paths remapping when "Saving As" project + - Fixed level resize issues which moved Entities and their Point fields in a strange way + - Fixed panels/windows not closing during app update + - Fixed SaveAs shortcut (`CTRL+SHIFT+S`) + - Better entity tile picking UI + - Updated `Samples` + - Bug fixes + +# 0.1.7-alpha + + - **Array of entity fields**: any field type in an Entity can now be an Array. For example, you could have an Array of Enums to represent the items hidden inside a Cratebox entity. See `Samples` for some examples. + - **Point coordinates & paths**: this new entity field type allows you to pick a grid coordinates. And if you combine this with the new Array support, you can even build paths of points! See `Samples` for some examples. + - Added a confirmation when trying to update the app while having unsaved changes + - UI tweaks & fixes + - Added some click tolerance when picking entities + - Swapped "Tileset" and "Enum" buttons in main toolbar + - Fixed an infinite loop on undo/redo in some levels + - Updated Haxe API + - Bug fixes + +# 0.1.6-alpha + + - **"Pure" auto-layers**: these layers only have rules and use a separate IntGrid layer as source for their value checks. Very useful to have a separate auto-layer that contains drop-shadows of walls, for example. You can have any number of pure auto-layers using the same single IntGrid source. + - Grid lock (formerly grid snap) now uses `L` key shortcut instead of G + - Grid visibility can be toggled using `G` key shortcut + - Added `SHIFT-R` shortcut to show/hide all auto-layers + - Updated sample projects + - Updated "help" window + - Added quick notifications for some user actions + - Fixed render issues when deleting or updating auto-layer rules + - Fixed Haxe API issues + - Fixed bugs + - Added some internal app logging for debugging purpose (no sensitive data, don't worry) + +# 0.1.5-alpha - Auto layers + + - **Auto-layers**: IntGrid layers can now render themselves automatically by drawing tiles based on their content. You can create "patterns of IntGrid values" (called **Rules**) to decide when a specific tile, or group of random tiles, should appear. It can for example be used to: + - add random grass or rocks on top of platforms, + - add random ceiling props under platforms, + - render ground/water/lava area, + - etc. + - Auto-layer rules can be organized in groups. + - *`Samples`*: click on the `Samples` button on home page to load some example projects. + - **Smarter warning** when deleting something in a panel. ie. If the value you're removing isn't actually used in your project, you will get a "softer" warning. + - **Large levels optimizations**: started an important rework of the way levels are rendered on-screen to make room for future optimizations on large levels. For now, it's still recommended to work on levels with smaller dimensions. + - Added a project option to minify the JSON file. + - Smarter extern Enum sync: the removal of unused enums will be shown as low-risks operations. + - Added perlin noise support to Auto-layers rules (a rule can apply to only a random area). + - Changed version number to 0.1.x because no one could stop me from doing it + - Better element sorting (levels, layers etc.) experience using SortableJS lib + - Closing a panel with a color picker will now validate color before closing the panel. + - Better viewport centering when opening a level. + - Fixed `0-9` keyboard shortcuts while focusing a field + - Fixed save/load notifications + - Many UI/UX fixes + - Bug fixes + +# 0.0.4-alpha + + - Added nice **movement animations** to the tool palette when picking a value with the ALT+click shortcut + - Reworked the code of the tool palette to be much simpler + - Clicking an existing Entity now automatically picks it + - Nicer pixel font for Rulers around the level canvas + - Added **0 to 9 key shortcuts** to quickly select layers + - Added a convenient Edit link in Entity instance editor + - Fixed `CTRL-W` shortcut (should only close current app page) + - Added `CTRL-Q` shortcut to close the app + - Added `F` shortcut to fit current level in screen + - Fixed file path display in Enum panel + - Fixed image path sometime disappearing in Tileset panel + - Fixed load/save notifications + - Updated home + - Many minor **UI polishing** + +# 0.0.3-alpha + + - Better **Entity instance fields editor** + - Better **auto-update UI** + - Enhanced ALT-click picking cursor + - Fixed Changelog display on Home page + - ALT+click picking no longer picks in other layers by default (you can hold `SHIFT` key to pick in any layer) + - Fixed window closing not working sometimes + - Added a brief notification when switching layers using picking + - Code: Electron cleanup + +# 0.0.2-alpha + + - **Release notes**: added release notes to app Home page + - Adjusted grid opacity + - Bug fixes + - Dev scripts cleanup + +# 0.0.1-alpha - First public alpha + + - **Alpha release**: this version is only for early testing & feedback purpose. + - **Auto updater**: Added support for built-in Electron auto-updater + - Packaged app with a NSIS setup + - Added Changelog doc + - Code: major GIT repo cleaning diff --git a/docs/archives/1.3.4/JSON_DOC.md b/docs/archives/1.3.4/JSON_DOC.md new file mode 100644 index 000000000..a2049c317 --- /dev/null +++ b/docs/archives/1.3.4/JSON_DOC.md @@ -0,0 +1,412 @@ +# LDtk Json structure (version 1.3.4) + + + +## 1. LDtk Json root +This is the root of any Project JSON file. It contains: + +- the project settings, +- an array of levels, +- a group of definitions (that can probably be safely ignored for most users). + +Value | Type | Description +-- | -- | -- +`bgColor` | String
*Hex color "#rrggbb"* | Project background color +`defs` | [Definitions](#ldtk-DefinitionsJson) | A structure containing all the definitions of this project +`externalLevels`
![Generic badge](https://img.shields.io/badge/Added_0.7.0-gray.svg) | Bool | If TRUE, one file will be saved for the project (incl. all its definitions) and one file in a sub-folder for each level. +`iid`
![Generic badge](https://img.shields.io/badge/Added_1.2.0-gray.svg) | String | Unique project identifier +`jsonVersion` | String | File format version +`levels` | Array of [Level](#ldtk-LevelJson) | All levels. The order of this array is only relevant in `LinearHorizontal` and `linearVertical` world layouts (see `worldLayout` value).
Otherwise, you should refer to the `worldX`,`worldY` coordinates of each Level. +`toc`
![Generic badge](https://img.shields.io/badge/Added_1.2.4-gray.svg) | Array of Object | All instances of entities that have their `exportToToc` flag enabled are listed in this array.
This array contains objects with the following fields:
+`worldGridHeight`
Only *'GridVania' layouts*
![Generic badge](https://img.shields.io/badge/Changed_1.0.0-gray.svg) | Int *(can be `null`)* | **WARNING**: this field will move to the `worlds` array after the "multi-worlds" update. It will then be `null`. You can enable the Multi-worlds advanced project option to enable the change immediately.

Height of the world grid in pixels. +`worldGridWidth`
Only *'GridVania' layouts*
![Generic badge](https://img.shields.io/badge/Changed_1.0.0-gray.svg) | Int *(can be `null`)* | **WARNING**: this field will move to the `worlds` array after the "multi-worlds" update. It will then be `null`. You can enable the Multi-worlds advanced project option to enable the change immediately.

Width of the world grid in pixels. +`worldLayout`
![Generic badge](https://img.shields.io/badge/Changed_1.0.0-gray.svg) | Enum *(can be `null`)* | **WARNING**: this field will move to the `worlds` array after the "multi-worlds" update. It will then be `null`. You can enable the Multi-worlds advanced project option to enable the change immediately.

An enum that describes how levels are organized in this project (ie. linearly or in a 2D space).
Possible values: <`null`>, `Free`, `GridVania`, `LinearHorizontal`, `LinearVertical` +`worlds`
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | Array of [World](#ldtk-WorldJson) | This array will be empty, unless you enable the Multi-Worlds in the project advanced settings.

- in current version, a LDtk project file can only contain a single world with multiple levels in it. In this case, levels and world layout related settings are stored in the root of the JSON.
- with "Multi-worlds" enabled, there will be a `worlds` array in root, each world containing levels and layout settings. Basically, it's pretty much only about moving the `levels` array to the `worlds` array, along with world layout related values (eg. `worldGridWidth` etc).

If you want to start supporting this future update easily, please refer to this documentation: https://github.com/deepnight/ldtk/issues/231 +`appBuildId`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | Float | LDtk application build identifier.
This is only used to identify the LDtk version that generated this particular project file, which can be useful for specific bug fixing. Note that the build identifier is just the date of the release, so it's not unique to each user (one single global ID per LDtk public release), and as a result, completely anonymous. +`backupLimit`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_0.7.0-gray.svg) | Int | Number of backup files to keep, if the `backupOnSave` is TRUE +`backupOnSave`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_0.7.0-gray.svg) | Bool | If TRUE, an extra copy of the project will be created in a sub folder, when saving. +`backupRelPath`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.3.0-green.svg) | String *(can be `null`)* | Target relative path to store backup files +`customCommands`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.2.0-gray.svg) | Array of Object | An array of command lines that can be ran manually by the user
This array contains objects with the following fields:
+`defaultEntityHeight`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.3.4-green.svg) | Int | Default height for new entities +`defaultEntityWidth`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.3.4-green.svg) | Int | Default width for new entities +`defaultGridSize`
*Only used by editor* | Int | Default grid size for new layers +`defaultLevelBgColor`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_0.6.0-gray.svg) | String
*Hex color "#rrggbb"* | Default background color of levels +`defaultLevelHeight`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Changed_1.0.0-gray.svg) | Int *(can be `null`)* | **WARNING**: this field will move to the `worlds` array after the "multi-worlds" update. It will then be `null`. You can enable the Multi-worlds advanced project option to enable the change immediately.

Default new level height +`defaultLevelWidth`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Changed_1.0.0-gray.svg) | Int *(can be `null`)* | **WARNING**: this field will move to the `worlds` array after the "multi-worlds" update. It will then be `null`. You can enable the Multi-worlds advanced project option to enable the change immediately.

Default new level width +`defaultPivotX`
*Only used by editor* | Float | Default X pivot (0 to 1) for new entities +`defaultPivotY`
*Only used by editor* | Float | Default Y pivot (0 to 1) for new entities +`dummyWorldIid`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.3.0-green.svg) | String | If the project isn't in MultiWorlds mode, this is the IID of the internal "dummy" World. +`exportLevelBg`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.2.0-gray.svg) | Bool | If TRUE, the exported PNGs will include the level background (color or image). +`exportTiled`
*Only used by editor* | Bool | If TRUE, a Tiled compatible file will also be generated along with the LDtk JSON file (default is FALSE) +`flags`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_0.8.0-gray.svg) | Array of Enum | An array containing various advanced flags (ie. options or other states).
Possible values: `DiscardPreCsvIntGrid`, `ExportPreCsvIntGridFormat`, `IgnoreBackupSuggest`, `PrependIndexToLevelFileNames`, `MultiWorlds`, `UseMultilinesType` +`identifierStyle`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | Enum | Naming convention for Identifiers (first-letter uppercase, full uppercase etc.)
Possible values: `Capitalize`, `Uppercase`, `Lowercase`, `Free` +`imageExportMode`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_0.9.3-gray.svg) | Enum | "Image export" option when saving project.
Possible values: `None`, `OneImagePerLayer`, `OneImagePerLevel`, `LayersAndLevels` +`levelNamePattern`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_0.9.0-gray.svg) | String | The default naming convention for level identifiers. +`minifyJson`
*Only used by editor* | Bool | If TRUE, the Json is partially minified (no indentation, nor line breaks, default is FALSE) +`nextUid`
*Only used by editor* | Int | Next Unique integer ID available +`pngFilePattern`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_0.7.2-gray.svg) | String *(can be `null`)* | File naming pattern for exported PNGs +`simplifiedExport`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.1.0-gray.svg) | Bool | If TRUE, a very simplified will be generated on saving, for quicker & easier engine integration. +`tutorialDesc`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | String *(can be `null`)* | This optional description is used by LDtk Samples to show up some informations and instructions. +~~`exportPng`~~
*Only used by editor*
*DEPRECATED!*
![Generic badge](https://img.shields.io/badge/Removed_0.9.3-gray.svg) | Bool *(can be `null`)* | **WARNING**: this deprecated value is no longer exported since version 0.9.3

Replaced by: `imageExportMode` + + +## 1.1. World ![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) +**IMPORTANT**: this type is available as a preview. You can rely on it to update your importers, for when it will be officially available. + +A World contains multiple levels, and it has its own layout settings. + +Value | Type | Description +-- | -- | -- +`identifier`
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | String | User defined unique identifier +`iid`
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | String | Unique instance identifer +`levels`
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | Array of [Level](#ldtk-LevelJson) | All levels from this world. The order of this array is only relevant in `LinearHorizontal` and `linearVertical` world layouts (see `worldLayout` value). Otherwise, you should refer to the `worldX`,`worldY` coordinates of each Level. +`worldGridHeight`
Only *'GridVania' layouts*
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | Int | Height of the world grid in pixels. +`worldGridWidth`
Only *'GridVania' layouts*
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | Int | Width of the world grid in pixels. +`worldLayout`
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | Enum | An enum that describes how levels are organized in this project (ie. linearly or in a 2D space).
Possible values: `Free`, `GridVania`, `LinearHorizontal`, `LinearVertical` +`defaultLevelHeight`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | Int | Default new level height +`defaultLevelWidth`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | Int | Default new level width + + +## 2. Level +This section contains all the level data. It can be found in 2 distinct forms, depending on Project current settings: + +- If "*Separate level files*" is **disabled** (default): full level data is *embedded* inside the main Project JSON file, +- If "*Separate level files*" is **enabled**: level data is stored in *separate* standalone `.ldtkl` files (one per level). In this case, the main Project JSON file will still contain most level data, except heavy sections, like the `layerInstances` array (which will be null). The `externalRelPath` string points to the `ldtkl` file. + +A `ldtkl` file is just a JSON file containing exactly what is described below. + +Value | Type | Description +-- | -- | -- +`__bgColor`
![Generic badge](https://img.shields.io/badge/Added_0.6.0-gray.svg) | String
*Hex color "#rrggbb"* | Background color of the level (same as `bgColor`, except the default value is automatically used here if its value is `null`) +`__bgPos`
Only *If background image exists*
![Generic badge](https://img.shields.io/badge/Added_0.7.0-gray.svg) | Object *(can be `null`)* | Position informations of the background image, if there is one.
This object contains the following fields:
+`__neighbours`
![Generic badge](https://img.shields.io/badge/Added_0.6.0-gray.svg) ![Generic badge](https://img.shields.io/badge/Changed_1.0.0-gray.svg) | Array of Object | An array listing all other levels touching this one on the world map.
Only relevant for world layouts where level spatial positioning is manual (ie. GridVania, Free). For Horizontal and Vertical layouts, this array is always empty.
This array contains objects with the following fields:
+`bgRelPath`
![Generic badge](https://img.shields.io/badge/Added_0.7.0-gray.svg) | String *(can be `null`)* | The *optional* relative path to the level background image. +`externalRelPath`
![Generic badge](https://img.shields.io/badge/Added_0.7.0-gray.svg) | String *(can be `null`)* | This value is not null if the project option "*Save levels separately*" is enabled. In this case, this **relative** path points to the level Json file. +`fieldInstances`
![Generic badge](https://img.shields.io/badge/Changed_0.8.0-gray.svg) | Array of [Field instance](#ldtk-FieldInstanceJson) | An array containing this level custom field values. +`identifier` | String | User defined unique identifier +`iid`
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | String | Unique instance identifier +`layerInstances`
![Generic badge](https://img.shields.io/badge/Changed_0.7.0-gray.svg) | Array of [Layer instance](#ldtk-LayerInstanceJson) *(can be `null`)* | An array containing all Layer instances. **IMPORTANT**: if the project option "*Save levels separately*" is enabled, this field will be `null`.
This array is **sorted in display order**: the 1st layer is the top-most and the last is behind. +`pxHei` | Int | Height of the level in pixels +`pxWid` | Int | Width of the level in pixels +`uid` | Int | Unique Int identifier +`worldDepth`
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | Int | Index that represents the "depth" of the level in the world. Default is 0, greater means "above", lower means "below".
This value is mostly used for display only and is intended to make stacking of levels easier to manage. +`worldX`
![Generic badge](https://img.shields.io/badge/Added_0.6.0-gray.svg) ![Generic badge](https://img.shields.io/badge/Changed_1.0.0-gray.svg) | Int | World X coordinate in pixels.
Only relevant for world layouts where level spatial positioning is manual (ie. GridVania, Free). For Horizontal and Vertical layouts, the value is always -1 here. +`worldY`
![Generic badge](https://img.shields.io/badge/Added_0.6.0-gray.svg) ![Generic badge](https://img.shields.io/badge/Changed_1.0.0-gray.svg) | Int | World Y coordinate in pixels.
Only relevant for world layouts where level spatial positioning is manual (ie. GridVania, Free). For Horizontal and Vertical layouts, the value is always -1 here. +`__smartColor`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | String
*Hex color "#rrggbb"* | The "guessed" color for this level in the editor, decided using either the background color or an existing custom field. +`bgColor`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_0.6.0-gray.svg) | String *(can be `null`)*
*Hex color "#rrggbb"* | Background color of the level. If `null`, the project `defaultLevelBgColor` should be used. +`bgPivotX`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_0.7.0-gray.svg) | Float | Background image X pivot (0-1) +`bgPivotY`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_0.7.0-gray.svg) | Float | Background image Y pivot (0-1) +`bgPos`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_0.7.0-gray.svg) | Enum *(can be `null`)* | An enum defining the way the background image (if any) is positioned on the level. See `__bgPos` for resulting position info.
Possible values: <`null`>, `Unscaled`, `Contain`, `Cover`, `CoverDirty`, `Repeat` +`useAutoIdentifier`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_0.9.0-gray.svg) | Bool | If TRUE, the level identifier will always automatically use the naming pattern as defined in `Project.levelNamePattern`. Becomes FALSE if the identifier is manually modified by user. + + +## 2.1. Layer instance +Value | Type | Description +-- | -- | -- +`__cHei` | Int | Grid-based height +`__cWid` | Int | Grid-based width +`__gridSize` | Int | Grid size +`__identifier` | String | Layer definition identifier +`__opacity`
![Generic badge](https://img.shields.io/badge/Added_0.4.0-gray.svg) | Float | Layer opacity as Float [0-1] +`__pxTotalOffsetX`
![Generic badge](https://img.shields.io/badge/Added_0.5.0-gray.svg) | Int | Total layer X pixel offset, including both instance and definition offsets. +`__pxTotalOffsetY`
![Generic badge](https://img.shields.io/badge/Added_0.5.0-gray.svg) | Int | Total layer Y pixel offset, including both instance and definition offsets. +`__tilesetDefUid`
Only *Tile layers, Auto-layers*
![Generic badge](https://img.shields.io/badge/Added_0.6.0-gray.svg) | Int *(can be `null`)* | The definition UID of corresponding Tileset, if any. +`__tilesetRelPath`
Only *Tile layers, Auto-layers*
![Generic badge](https://img.shields.io/badge/Added_0.6.0-gray.svg) | String *(can be `null`)* | The relative path to corresponding Tileset, if any. +`__type` | String | Layer type (possible values: IntGrid, Entities, Tiles or AutoLayer) +`autoLayerTiles`
Only *Auto-layers*
![Generic badge](https://img.shields.io/badge/Added_0.4.0-gray.svg) | Array of [Tile instance](#ldtk-Tile) | An array containing all tiles generated by Auto-layer rules. The array is already sorted in display order (ie. 1st tile is beneath 2nd, which is beneath 3rd etc.).

Note: if multiple tiles are stacked in the same cell as the result of different rules, all tiles behind opaque ones will be discarded. +`entityInstances`
Only *Entity layers* | Array of [Entity instance](#ldtk-EntityInstanceJson) | +`gridTiles`
Only *Tile layers* | Array of [Tile instance](#ldtk-Tile) | +`iid` | String | Unique layer instance identifier +`intGridCsv`
Only *IntGrid layers*
![Generic badge](https://img.shields.io/badge/Added_0.8.0-gray.svg) | Array of Int | A list of all values in the IntGrid layer, stored in CSV format (Comma Separated Values).
Order is from left to right, and top to bottom (ie. first row from left to right, followed by second row, etc).
`0` means "empty cell" and IntGrid values start at 1.
The array size is `__cWid` x `__cHei` cells. +`layerDefUid` | Int | Reference the Layer definition UID +`levelId` | Int | Reference to the UID of the level containing this layer instance +`overrideTilesetUid`
Only *Tile layers* | Int *(can be `null`)* | This layer can use another tileset by overriding the tileset UID here. +`pxOffsetX`
![Generic badge](https://img.shields.io/badge/Changed_0.5.0-gray.svg) | Int | X offset in pixels to render this layer, usually 0 (IMPORTANT: this should be added to the `LayerDef` optional offset, so you should probably prefer using `__pxTotalOffsetX` which contains the total offset value) +`pxOffsetY`
![Generic badge](https://img.shields.io/badge/Changed_0.5.0-gray.svg) | Int | Y offset in pixels to render this layer, usually 0 (IMPORTANT: this should be added to the `LayerDef` optional offset, so you should probably prefer using `__pxTotalOffsetX` which contains the total offset value) +`visible`
![Generic badge](https://img.shields.io/badge/Added_0.8.0-gray.svg) | Bool | Layer instance visibility +`optionalRules`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_0.9.0-gray.svg) | Array of Int | An Array containing the UIDs of optional rules that were enabled in this specific layer instance. +`seed`
Only *Auto-layers*
*Only used by editor* | Int | Random seed used for Auto-Layers rendering +~~`intGrid`~~
Only *IntGrid layers*
*DEPRECATED!*
![Generic badge](https://img.shields.io/badge/Removed_1.0.0-gray.svg) | Array of Object *(can be `null`)* | **WARNING**: this deprecated value is no longer exported since version 1.0.0

Replaced by: `intGridCsv` + + +## 2.1.1. Tile instance ![Generic badge](https://img.shields.io/badge/Added_0.4.0-gray.svg) +This structure represents a single tile from a given Tileset. + +Value | Type | Description +-- | -- | -- +`a`
![Generic badge](https://img.shields.io/badge/Added_1.3.1-green.svg) | Float | Alpha/opacity of the tile (0-1, defaults to 1) +`f` | Int | "Flip bits", a 2-bits integer to represent the mirror transformations of the tile.
- Bit 0 = X flip
- Bit 1 = Y flip
Examples: f=0 (no flip), f=1 (X flip only), f=2 (Y flip only), f=3 (both flips) +`px`
![Generic badge](https://img.shields.io/badge/Changed_0.5.0-gray.svg) | Array of Int | Pixel coordinates of the tile in the **layer** (`[x,y]` format). Don't forget optional layer offsets, if they exist! +`src` | Array of Int | Pixel coordinates of the tile in the **tileset** (`[x,y]` format) +`t`
![Generic badge](https://img.shields.io/badge/Added_0.6.0-gray.svg) | Int | The *Tile ID* in the corresponding tileset. +`d`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Changed_0.6.0-gray.svg) | Array of Int | Internal data used by the editor.
For auto-layer tiles: `[ruleId, coordId]`.
For tile-layer tiles: `[coordId]`. + + +## 2.2. Entity instance +Value | Type | Description +-- | -- | -- +`__grid`
![Generic badge](https://img.shields.io/badge/Changed_0.4.0-gray.svg) | Array of Int | Grid-based coordinates (`[x,y]` format) +`__identifier` | String | Entity definition identifier +`__pivot`
![Generic badge](https://img.shields.io/badge/Added_0.7.0-gray.svg) | Array of Float | Pivot coordinates (`[x,y]` format, values are from 0 to 1) of the Entity +`__smartColor`
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | String | The entity "smart" color, guessed from either Entity definition, or one its field instances. +`__tags`
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | Array of String | Array of tags defined in this Entity definition +`__tile`
![Generic badge](https://img.shields.io/badge/Added_0.4.0-gray.svg) ![Generic badge](https://img.shields.io/badge/Changed_1.0.0-gray.svg) | [Tileset rectangle](#ldtk-TilesetRect) *(can be `null`)* | Optional TilesetRect used to display this entity (it could either be the default Entity tile, or some tile provided by a field value, like an Enum). +`__worldX`
![Generic badge](https://img.shields.io/badge/Added_1.3.4-green.svg) | Int | X world coordinate in pixels +`__worldY`
![Generic badge](https://img.shields.io/badge/Added_1.3.4-green.svg) | Int | Y world coordinate in pixels +`defUid` | Int | Reference of the **Entity definition** UID +`fieldInstances` | Array of [Field instance](#ldtk-FieldInstanceJson) | An array of all custom fields and their values. +`height`
![Generic badge](https://img.shields.io/badge/Added_0.8.0-gray.svg) | Int | Entity height in pixels. For non-resizable entities, it will be the same as Entity definition. +`iid`
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | String | Unique instance identifier +`px`
![Generic badge](https://img.shields.io/badge/Changed_0.4.0-gray.svg) | Array of Int | Pixel coordinates (`[x,y]` format) in current level coordinate space. Don't forget optional layer offsets, if they exist! +`width`
![Generic badge](https://img.shields.io/badge/Added_0.8.0-gray.svg) | Int | Entity width in pixels. For non-resizable entities, it will be the same as Entity definition. + + +## 2.3. Field instance +Value | Type | Description +-- | -- | -- +`__identifier` | String | Field definition identifier +`__tile`
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | [Tileset rectangle](#ldtk-TilesetRect) *(can be `null`)* | Optional TilesetRect used to display this field (this can be the field own Tile, or some other Tile guessed from the value, like an Enum). +`__type` | String | Type of the field, such as `Int`, `Float`, `String`, `Enum(my_enum_name)`, `Bool`, etc.
NOTE: if you enable the advanced option **Use Multilines type**, you will have "*Multilines*" instead of "*String*" when relevant. +`__value` | Various possible types | Actual value of the field instance. The value type varies, depending on `__type`:
- For **classic types** (ie. Integer, Float, Boolean, String, Text and FilePath), you just get the actual value with the expected type.
- For **Color**, the value is an hexadecimal string using "#rrggbb" format.
- For **Enum**, the value is a String representing the selected enum value.
- For **Point**, the value is a [GridPoint](#ldtk-GridPoint) object.
- For **Tile**, the value is a [TilesetRect](#ldtk-TilesetRect) object.
- For **EntityRef**, the value is an [EntityReferenceInfos](#ldtk-EntityReferenceInfos) object.

If the field is an array, then this `__value` will also be a JSON array. +`defUid` | Int | Reference of the **Field definition** UID +`realEditorValues`
*Only used by editor* | Array of Enum *(can be `null`)* | Editor internal raw values + + +## 2.3.1. Reference to an Entity instance ![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) +This object describes the "location" of an Entity instance in the project worlds. + +Value | Type | Description +-- | -- | -- +`entityIid`
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | String | IID of the refered EntityInstance +`layerIid`
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | String | IID of the LayerInstance containing the refered EntityInstance +`levelIid`
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | String | IID of the Level containing the refered EntityInstance +`worldIid`
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | String | IID of the World containing the refered EntityInstance + + +## 2.3.2. Grid point ![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) +This object is just a grid-based coordinate used in Field values. + +Value | Type | Description +-- | -- | -- +`cx`
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | Int | X grid-based coordinate +`cy`
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | Int | Y grid-based coordinate + + +## 3. Definitions +If you're writing your own LDtk importer, you should probably just ignore *most* stuff in the `defs` section, as it contains data that are mostly important to the editor. To keep you away from the `defs` section and avoid some unnecessary JSON parsing, important data from definitions is often duplicated in fields prefixed with a double underscore (eg. `__identifier` or `__type`). + +The 2 only definition types you might need here are **Tilesets** and **Enums**. + +Value | Type | Description +-- | -- | -- +`entities` | Array of [Entity definition](#ldtk-EntityDefJson) | All entities definitions, including their custom fields +`enums` | Array of [Enum definition](#ldtk-EnumDefJson) | All internal enums +`externalEnums` | Array of [Enum definition](#ldtk-EnumDefJson) | Note: external enums are exactly the same as `enums`, except they have a `relPath` to point to an external source file. +`layers` | Array of [Layer definition](#ldtk-LayerDefJson) | All layer definitions +`levelFields`
![Generic badge](https://img.shields.io/badge/Added_0.8.0-gray.svg) | Array of [Field definition](#ldtk-FieldDefJson) | All custom fields available to all levels. +`tilesets` | Array of [Tileset definition](#ldtk-TilesetDefJson) | All tilesets + + +## 3.1. Layer definition +Value | Type | Description +-- | -- | -- +`__type` | String | Type of the layer (*IntGrid, Entities, Tiles or AutoLayer*) +`autoSourceLayerDefUid`
Only *Auto-layers* | Int *(can be `null`)* | +`displayOpacity` | Float | Opacity of the layer (0 to 1.0) +`gridSize` | Int | Width and height of the grid in pixels +`identifier` | String | User defined unique identifier +`intGridValues`
Only *IntGrid layer*
![Generic badge](https://img.shields.io/badge/Changed_1.0.0-gray.svg) | Array of Object | An array that defines extra optional info for each IntGrid value.
WARNING: the array order is not related to actual IntGrid values! As user can re-order IntGrid values freely, you may value "2" before value "1" in this array.
This array contains objects with the following fields:
+`parallaxFactorX`
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | Float | Parallax horizontal factor (from -1 to 1, defaults to 0) which affects the scrolling speed of this layer, creating a fake 3D (parallax) effect. +`parallaxFactorY`
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | Float | Parallax vertical factor (from -1 to 1, defaults to 0) which affects the scrolling speed of this layer, creating a fake 3D (parallax) effect. +`parallaxScaling`
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | Bool | If true (default), a layer with a parallax factor will also be scaled up/down accordingly. +`pxOffsetX`
![Generic badge](https://img.shields.io/badge/Added_0.5.0-gray.svg) | Int | X offset of the layer, in pixels (IMPORTANT: this should be added to the `LayerInstance` optional offset) +`pxOffsetY`
![Generic badge](https://img.shields.io/badge/Added_0.5.0-gray.svg) | Int | Y offset of the layer, in pixels (IMPORTANT: this should be added to the `LayerInstance` optional offset) +`tilesetDefUid`
Only *Tile layers, Auto-layers*
![Generic badge](https://img.shields.io/badge/Changed_1.0.0-gray.svg) | Int *(can be `null`)* | Reference to the default Tileset UID being used by this layer definition.
**WARNING**: some layer *instances* might use a different tileset. So most of the time, you should probably use the `__tilesetDefUid` value found in layer instances.
Note: since version 1.0.0, the old `autoTilesetDefUid` was removed and merged into this value. +`uid` | Int | Unique Int identifier +`autoRuleGroups`
Only *Auto-layers*
*Only used by editor* | Array of Object | Contains all the auto-layer rule definitions.
This array contains objects with the following fields:
+`canSelectWhenInactive`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.1.4-gray.svg) | Bool | Allow editor selections when the layer is not currently active. +`doc`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.2.5-gray.svg) | String *(can be `null`)* | User defined documentation for this element to provide help/tips to level designers. +`excludedTags`
Only *Entity layer*
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_0.8.0-gray.svg) | Array of String | An array of tags to forbid some Entities in this layer +`guideGridHei`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | Int | Height of the optional "guide" grid in pixels +`guideGridWid`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | Int | Width of the optional "guide" grid in pixels +`hideFieldsWhenInactive`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | Bool | +`hideInList`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | Bool | Hide the layer from the list on the side of the editor view. +`inactiveOpacity`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | Float | Alpha of this layer when it is not the active one. +`renderInWorldView`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.3.1-green.svg) | Bool | If TRUE, the content of this layer will be used when rendering levels in a simplified way for the world view +`requiredTags`
Only *Entity layer*
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_0.8.0-gray.svg) | Array of String | An array of tags to filter Entities that can be added to this layer +`tilePivotX`
Only *Tile layers*
*Only used by editor* | Float | If the tiles are smaller or larger than the layer grid, the pivot value will be used to position the tile relatively its grid cell. +`tilePivotY`
Only *Tile layers*
*Only used by editor* | Float | If the tiles are smaller or larger than the layer grid, the pivot value will be used to position the tile relatively its grid cell. +`type`
*Only used by editor* | Enum | Type of the layer as Haxe Enum
Possible values: `IntGrid`, `Entities`, `Tiles`, `AutoLayer` +`uiColor`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.3.1-green.svg) | String *(can be `null`)* | User defined color for the UI +~~`autoTilesetDefUid`~~
Only *Auto-layers*
*DEPRECATED!*
![Generic badge](https://img.shields.io/badge/Removed_1.2.0-gray.svg) | Int *(can be `null`)* | **WARNING**: this deprecated value is no longer exported since version 1.2.0

Replaced by: `tilesetDefUid` + + +## 3.1.1. Auto-layer rule definition +This complex section isn't meant to be used by game devs at all, as these rules are completely resolved internally by the editor before any saving. You should just ignore this part. + +Value | Type | Description +-- | -- | -- +`active`
*Only used by editor* | Bool | If FALSE, the rule effect isn't applied, and no tiles are generated. +`alpha`
*Only used by editor* | Float | +`breakOnMatch`
*Only used by editor* | Bool | When TRUE, the rule will prevent other rules to be applied in the same cell if it matches (TRUE by default). +`chance`
*Only used by editor* | Float | Chances for this rule to be applied (0 to 1) +`checker`
*Only used by editor* | Enum | Checker mode
Possible values: `None`, `Horizontal`, `Vertical` +`flipX`
*Only used by editor* | Bool | If TRUE, allow rule to be matched by flipping its pattern horizontally +`flipY`
*Only used by editor* | Bool | If TRUE, allow rule to be matched by flipping its pattern vertically +`outOfBoundsValue`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_0.9.0-gray.svg) | Int *(can be `null`)* | Default IntGrid value when checking cells outside of level bounds +`pattern`
*Only used by editor* | Array of Int | Rule pattern (size x size) +`perlinActive`
*Only used by editor* | Bool | If TRUE, enable Perlin filtering to only apply rule on specific random area +`perlinOctaves`
*Only used by editor* | Float | +`perlinScale`
*Only used by editor* | Float | +`perlinSeed`
*Only used by editor* | Float | +`pivotX`
Only *'Stamp' tile mode*
*Only used by editor* | Float | X pivot of a tile stamp (0-1) +`pivotY`
Only *'Stamp' tile mode*
*Only used by editor* | Float | Y pivot of a tile stamp (0-1) +`size`
*Only used by editor* | Int | Pattern width & height. Should only be 1,3,5 or 7. +`tileIds`
*Only used by editor* | Array of Int | Array of all the tile IDs. They are used randomly or as stamps, based on `tileMode` value. +`tileMode`
*Only used by editor* | Enum | Defines how tileIds array is used
Possible values: `Single`, `Stamp` +`tileRandomXMax`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.3.0-green.svg) | Int | Max random offset for X tile pos +`tileRandomXMin`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.3.0-green.svg) | Int | Min random offset for X tile pos +`tileRandomYMax`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.3.0-green.svg) | Int | Max random offset for Y tile pos +`tileRandomYMin`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.3.0-green.svg) | Int | Min random offset for Y tile pos +`tileXOffset`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.3.0-green.svg) | Int | Tile X offset +`tileYOffset`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.3.0-green.svg) | Int | Tile Y offset +`uid`
*Only used by editor* | Int | Unique Int identifier +`xModulo`
*Only used by editor* | Int | X cell coord modulo +`xOffset`
*Only used by editor* | Int | X cell start offset +`yModulo`
*Only used by editor* | Int | Y cell coord modulo +`yOffset`
*Only used by editor* | Int | Y cell start offset + + +## 3.2. Entity definition +Value | Type | Description +-- | -- | -- +`color` | String
*Hex color "#rrggbb"* | Base entity color +`height` | Int | Pixel height +`identifier` | String | User defined unique identifier +`nineSliceBorders`
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | Array of Int | An array of 4 dimensions for the up/right/down/left borders (in this order) when using 9-slice mode for `tileRenderMode`.
If the tileRenderMode is not NineSlice, then this array is empty.
See: https://en.wikipedia.org/wiki/9-slice_scaling +`pivotX` | Float | Pivot X coordinate (from 0 to 1.0) +`pivotY` | Float | Pivot Y coordinate (from 0 to 1.0) +`tileRect`
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | [Tileset rectangle](#ldtk-TilesetRect) *(can be `null`)* | An object representing a rectangle from an existing Tileset +`tileRenderMode`
![Generic badge](https://img.shields.io/badge/Changed_0.8.1-gray.svg) | Enum | An enum describing how the the Entity tile is rendered inside the Entity bounds.
Possible values: `Cover`, `FitInside`, `Repeat`, `Stretch`, `FullSizeCropped`, `FullSizeUncropped`, `NineSlice` +`tilesetId` | Int *(can be `null`)* | Tileset ID used for optional tile display +`uid` | Int | Unique Int identifier +`width` | Int | Pixel width +`doc`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.2.5-gray.svg) | String *(can be `null`)* | User defined documentation for this element to provide help/tips to level designers. +`exportToToc`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.2.4-gray.svg) | Bool | If enabled, all instances of this entity will be listed in the project "Table of content" object. +`fieldDefs`
*Only used by editor* | Array of [Field definition](#ldtk-FieldDefJson) | Array of field definitions +`fillOpacity`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_0.8.0-gray.svg) | Float | +`hollow`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_0.8.0-gray.svg) | Bool | +`keepAspectRatio`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_0.8.0-gray.svg) | Bool | Only applies to entities resizable on both X/Y. If TRUE, the entity instance width/height will keep the same aspect ratio as the definition. +`limitBehavior`
*Only used by editor* | Enum | Possible values: `DiscardOldOnes`, `PreventAdding`, `MoveLastOne` +`limitScope`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_0.8.0-gray.svg) | Enum | If TRUE, the maxCount is a "per world" limit, if FALSE, it's a "per level".
Possible values: `PerLayer`, `PerLevel`, `PerWorld` +`lineOpacity`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_0.8.0-gray.svg) | Float | +`maxCount`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Changed_0.8.0-gray.svg) | Int | Max instances count +`maxHeight`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.3.3-green.svg) | Int *(can be `null`)* | Max pixel height (only applies if the entity is resizable on Y) +`maxWidth`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.3.3-green.svg) | Int *(can be `null`)* | Max pixel width (only applies if the entity is resizable on X) +`minHeight`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.3.3-green.svg) | Int *(can be `null`)* | Min pixel height (only applies if the entity is resizable on Y) +`minWidth`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.3.3-green.svg) | Int *(can be `null`)* | Min pixel width (only applies if the entity is resizable on X) +`renderMode`
*Only used by editor* | Enum | Possible values: `Rectangle`, `Ellipse`, `Tile`, `Cross` +`resizableX`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_0.8.0-gray.svg) | Bool | If TRUE, the entity instances will be resizable horizontally +`resizableY`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_0.8.0-gray.svg) | Bool | If TRUE, the entity instances will be resizable vertically +`showName`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_0.4.0-gray.svg) | Bool | Display entity name in editor +`tags`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_0.8.0-gray.svg) | Array of String | An array of strings that classifies this entity +`tileOpacity`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | Float | +~~`tileId`~~
*DEPRECATED!*
![Generic badge](https://img.shields.io/badge/Removed_1.2.0-gray.svg) | Int *(can be `null`)* | **WARNING**: this deprecated value is no longer exported since version 1.2.0

Replaced by: `tileRect` + + +## 3.2.1. Field definition ![Generic badge](https://img.shields.io/badge/Added_0.6.0-gray.svg) +This section is mostly only intended for the LDtk editor app itself. You can safely ignore it. + +Value | Type | Description +-- | -- | -- +`__type`
*Only used by editor* | String | Human readable value type. Possible values: `Int, Float, String, Bool, Color, ExternEnum.XXX, LocalEnum.XXX, Point, FilePath`.
If the field is an array, this field will look like `Array<...>` (eg. `Array`, `Array` etc.)
NOTE: if you enable the advanced option **Use Multilines type**, you will have "*Multilines*" instead of "*String*" when relevant. +`acceptFileTypes`
Only *FilePath*
*Only used by editor* | Array of String *(can be `null`)* | Optional list of accepted file extensions for FilePath value type. Includes the dot: `.ext` +`arrayMaxLength`
Only *Array*
*Only used by editor* | Int *(can be `null`)* | Array max length +`arrayMinLength`
Only *Array*
*Only used by editor* | Int *(can be `null`)* | Array min length +`canBeNull`
*Only used by editor* | Bool | TRUE if the value can be null. For arrays, TRUE means it can contain null values (exception: array of Points can't have null values). +`defaultOverride`
*Only used by editor* | Enum *(can be `null`)* | Default value if selected value is null or invalid. +`doc`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.2.0-gray.svg) | String *(can be `null`)* | User defined documentation for this field to provide help/tips to level designers about accepted values. +`identifier`
*Only used by editor* | String | User defined unique identifier +`isArray`
*Only used by editor* | Bool | TRUE if the value is an array of multiple values +`max`
Only *Int, Float*
*Only used by editor* | Float *(can be `null`)* | Max limit for value, if applicable +`min`
Only *Int, Float*
*Only used by editor* | Float *(can be `null`)* | Min limit for value, if applicable +`regex`
Only *String*
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_0.6.2-gray.svg) | String *(can be `null`)* | Optional regular expression that needs to be matched to accept values. Expected format: `/some_reg_ex/g`, with optional "i" flag. +`type`
*Only used by editor* | String | Internal enum representing the possible field types. Possible values: F_Int, F_Float, F_String, F_Text, F_Bool, F_Color, F_Enum(...), F_Point, F_Path, F_EntityRef, F_Tile +`uid`
*Only used by editor* | Int | Unique Int identifier +`allowOutOfLevelRef`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | Bool | +`allowedRefTags`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | Array of String | +`allowedRefs`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | Enum | Possible values: `Any`, `OnlySame`, `OnlyTags`, `OnlySpecificEntity` +`allowedRefsEntityUid`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.3.0-green.svg) | Int *(can be `null`)* | +`autoChainRef`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | Bool | +`editorAlwaysShow`
*Only used by editor* | Bool | +`editorCutLongValues`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_0.8.0-gray.svg) | Bool | +`editorDisplayColor`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.3.4-green.svg) | String *(can be `null`)* | +`editorDisplayMode`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Changed_1.0.0-gray.svg) | Enum | Possible values: `Hidden`, `ValueOnly`, `NameAndValue`, `EntityTile`, `LevelTile`, `Points`, `PointStar`, `PointPath`, `PointPathLoop`, `RadiusPx`, `RadiusGrid`, `ArrayCountWithLabel`, `ArrayCountNoLabel`, `RefLinkBetweenPivots`, `RefLinkBetweenCenters` +`editorDisplayPos`
*Only used by editor* | Enum | Possible values: `Above`, `Center`, `Beneath` +`editorDisplayScale`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Changed_1.3.0-green.svg) | Float | +`editorLinkStyle`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.1.4-gray.svg) | Enum | Possible values: `ZigZag`, `StraightArrow`, `CurvedArrow`, `ArrowsLine`, `DashedLine` +`editorShowInWorld`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.1.4-gray.svg) | Bool | +`editorTextPrefix`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | String *(can be `null`)* | +`editorTextSuffix`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | String *(can be `null`)* | +`symmetricalRef`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | Bool | +`textLanguageMode`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Changed_0.9.3-gray.svg) | Enum *(can be `null`)* | Possible values: <`null`>, `LangPython`, `LangRuby`, `LangJS`, `LangLua`, `LangC`, `LangHaxe`, `LangMarkdown`, `LangJson`, `LangXml`, `LangLog` +`tilesetUid`
Only *Tile*
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | Int *(can be `null`)* | UID of the tileset used for a Tile +`useForSmartColor`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | Bool | If TRUE, the color associated with this field will override the Entity or Level default color in the editor UI. For Enum fields, this would be the color associated to their values. + + +## 3.3. Tileset definition +The `Tileset` definition is the most important part among project definitions. It contains some extra informations about each integrated tileset. If you only had to parse one definition section, that would be the one. + +Value | Type | Description +-- | -- | -- +`__cHei`
![Generic badge](https://img.shields.io/badge/Added_0.9.0-gray.svg) | Int | Grid-based height +`__cWid`
![Generic badge](https://img.shields.io/badge/Added_0.9.0-gray.svg) | Int | Grid-based width +`customData`
![Generic badge](https://img.shields.io/badge/Added_0.9.0-gray.svg) | Array of Object | An array of custom tile metadata
This array contains objects with the following fields:
  • **`data`** **(String**)
  • **`tileId`** **(Int**)
+`embedAtlas`
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | Enum *(can be `null`)* | If this value is set, then it means that this atlas uses an internal LDtk atlas image instead of a loaded one.
Possible values: <`null`>, `LdtkIcons` +`enumTags`
![Generic badge](https://img.shields.io/badge/Added_0.9.0-gray.svg) | Array of Object | Tileset tags using Enum values specified by `tagsSourceEnumId`. This array contains 1 element per Enum value, which contains an array of all Tile IDs that are tagged with it.
This array contains objects with the following fields:
  • **`enumValueId`** **(String**)
  • **`tileIds`** **(Array of Int**)
+`identifier` | String | User defined unique identifier +`padding` | Int | Distance in pixels from image borders +`pxHei` | Int | Image height in pixels +`pxWid` | Int | Image width in pixels +`relPath` | String *(can be `null`)* | Path to the source file, relative to the current project JSON file
It can be null if no image was provided, or when using an embed atlas. +`spacing` | Int | Space in pixels between all tiles +`tags`
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | Array of String | An array of user-defined tags to organize the Tilesets +`tagsSourceEnumUid`
![Generic badge](https://img.shields.io/badge/Added_0.9.0-gray.svg) | Int *(can be `null`)* | Optional Enum definition UID used for this tileset meta-data +`tileGridSize` | Int | +`uid` | Int | Unique Intidentifier +`cachedPixelData`
*Only used by editor*
![Generic badge](https://img.shields.io/badge/Added_0.6.0-gray.svg) | Object *(can be `null`)* | The following data is used internally for various optimizations. It's always synced with source image changes.
This object contains the following fields:
  • **`averageColors`** **(String *(can be `null`)***) ![Generic badge](https://img.shields.io/badge/Added_0.6.0-gray.svg) : *Average color codes for each tileset tile (ARGB format)*
  • **`opaqueTiles`** **(String**) ![Generic badge](https://img.shields.io/badge/Changed_0.6.0-gray.svg) : *An array of 0/1 bytes, encoded in Base64, that tells if a specific TileID is fully opaque (1) or not (0)*
+`savedSelections`
*Only used by editor* | Array of Object | Array of group of tiles selections, only meant to be used in the editor
This array contains objects with the following fields:
  • **`ids`** **(Array of Int**)
  • **`mode`** **(Enum**)
+ + +## 3.3.1. Tileset rectangle ![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) +This object represents a custom sub rectangle in a Tileset image. + +Value | Type | Description +-- | -- | -- +`h`
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | Int | Height in pixels +`tilesetUid`
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | Int | UID of the tileset +`w`
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | Int | Width in pixels +`x`
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | Int | X pixels coordinate of the top-left corner in the Tileset image +`y`
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | Int | Y pixels coordinate of the top-left corner in the Tileset image + + +## 3.4. Enum definition +Value | Type | Description +-- | -- | -- +`externalRelPath` | String *(can be `null`)* | Relative path to the external file providing this Enum +`iconTilesetUid` | Int *(can be `null`)* | Tileset UID if provided +`identifier` | String | User defined unique identifier +`tags`
![Generic badge](https://img.shields.io/badge/Added_1.0.0-gray.svg) | Array of String | An array of user-defined tags to organize the Enums +`uid` | Int | Unique Int identifier +`values` | Array of [Enum value definition](#ldtk-EnumDefValues) | All possible enum values, with their optional Tile infos. +`externalFileChecksum`
*Only used by editor* | String *(can be `null`)* | + + +## 3.4.1. Enum value definition +Value | Type | Description +-- | -- | -- +`color`
![Generic badge](https://img.shields.io/badge/Added_0.9.0-gray.svg) | Int | Optional color +`id` | String | Enum value +`tileRect`
![Generic badge](https://img.shields.io/badge/Added_1.3.0-green.svg) | [Tileset rectangle](#ldtk-TilesetRect) *(can be `null`)* | Optional tileset rectangle to represents this value +~~`tileId`~~
*DEPRECATED!*
| Int *(can be `null`)* | **WARNING**: this deprecated value will be *removed* completely on version 1.4.0+

Replaced by: `tileRect` +~~`__tileSrcRect`~~
*DEPRECATED!*
![Generic badge](https://img.shields.io/badge/Added_0.4.0-gray.svg) | Array of Int *(can be `null`)* | **WARNING**: this deprecated value will be *removed* completely on version 1.4.0+

Replaced by: `tileRect` \ No newline at end of file diff --git a/docs/archives/1.3.4/JSON_SCHEMA.json b/docs/archives/1.3.4/JSON_SCHEMA.json new file mode 100644 index 000000000..15cc7471f --- /dev/null +++ b/docs/archives/1.3.4/JSON_SCHEMA.json @@ -0,0 +1,2907 @@ +{ + "description": "This file is a JSON schema of files created by LDtk level editor (https://ldtk.io).", + "title": "LDtk 1.3.4 JSON schema", + "$schema": "https://json-schema.org/draft-07/schema#", + "$ref": "#/LdtkJsonRoot", + "version": "1.3.4", + "LdtkJsonRoot": { + "description": "This is the root of any Project JSON file. It contains: - the project settings, - an array of levels, - a group of definitions (that can probably be safely ignored for most users).", + "title": "LDtk Json root", + "required": [ + "bgColor", + "defs", + "externalLevels", + "iid", + "jsonVersion", + "levels", + "toc", + "worlds", + "appBuildId", + "backupLimit", + "backupOnSave", + "customCommands", + "defaultEntityHeight", + "defaultEntityWidth", + "defaultGridSize", + "defaultLevelBgColor", + "defaultPivotX", + "defaultPivotY", + "dummyWorldIid", + "exportLevelBg", + "exportTiled", + "flags", + "identifierStyle", + "imageExportMode", + "levelNamePattern", + "minifyJson", + "nextUid", + "simplifiedExport" + ], + "properties": { + "backupLimit": { + "description": "Number of backup files to keep, if the `backupOnSave` is TRUE", + "type": [ + "integer" + ] + }, + "defaultEntityWidth": { + "description": "Default width for new entities", + "type": [ + "integer" + ] + }, + "backupOnSave": { + "description": "If TRUE, an extra copy of the project will be created in a sub folder, when saving.", + "type": [ + "boolean" + ] + }, + "worldGridWidth": { + "description": "**WARNING**: this field will move to the `worlds` array after the \"multi-worlds\" update. It will then be `null`. You can enable the Multi-worlds advanced project option to enable the change immediately.

Width of the world grid in pixels.", + "type": [ + "integer", + "null" + ] + }, + "iid": { + "description": "Unique project identifier", + "type": [ + "string" + ] + }, + "defaultLevelBgColor": { + "description": "Default background color of levels", + "type": [ + "string" + ] + }, + "bgColor": { + "description": "Project background color", + "type": [ + "string" + ] + }, + "worlds": { + "description": "This array will be empty, unless you enable the Multi-Worlds in the project advanced settings.

- in current version, a LDtk project file can only contain a single world with multiple levels in it. In this case, levels and world layout related settings are stored in the root of the JSON.
- with \"Multi-worlds\" enabled, there will be a `worlds` array in root, each world containing levels and layout settings. Basically, it's pretty much only about moving the `levels` array to the `worlds` array, along with world layout related values (eg. `worldGridWidth` etc).

If you want to start supporting this future update easily, please refer to this documentation: https://github.com/deepnight/ldtk/issues/231", + "items": { + "$ref": "#/otherTypes/World" + }, + "type": [ + "array" + ] + }, + "toc": { + "description": "All instances of entities that have their `exportToToc` flag enabled are listed in this array.", + "items": { + "$ref": "#/otherTypes/TableOfContentEntry" + }, + "type": [ + "array" + ] + }, + "nextUid": { + "description": "Next Unique integer ID available", + "type": [ + "integer" + ] + }, + "imageExportMode": { + "description": "\"Image export\" option when saving project. Possible values: `None`, `OneImagePerLayer`, `OneImagePerLevel`, `LayersAndLevels`", + "enum": [ + "None", + "OneImagePerLayer", + "OneImagePerLevel", + "LayersAndLevels" + ] + }, + "identifierStyle": { + "description": "Naming convention for Identifiers (first-letter uppercase, full uppercase etc.) Possible values: `Capitalize`, `Uppercase`, `Lowercase`, `Free`", + "enum": [ + "Capitalize", + "Uppercase", + "Lowercase", + "Free" + ] + }, + "defaultPivotY": { + "description": "Default Y pivot (0 to 1) for new entities", + "type": [ + "number" + ] + }, + "dummyWorldIid": { + "description": "If the project isn't in MultiWorlds mode, this is the IID of the internal \"dummy\" World.", + "type": [ + "string" + ] + }, + "customCommands": { + "description": "An array of command lines that can be ran manually by the user", + "items": { + "$ref": "#/otherTypes/CustomCommand" + }, + "type": [ + "array" + ] + }, + "worldGridHeight": { + "description": "**WARNING**: this field will move to the `worlds` array after the \"multi-worlds\" update. It will then be `null`. You can enable the Multi-worlds advanced project option to enable the change immediately.

Height of the world grid in pixels.", + "type": [ + "integer", + "null" + ] + }, + "appBuildId": { + "description": "LDtk application build identifier.
This is only used to identify the LDtk version that generated this particular project file, which can be useful for specific bug fixing. Note that the build identifier is just the date of the release, so it's not unique to each user (one single global ID per LDtk public release), and as a result, completely anonymous.", + "type": [ + "number" + ] + }, + "defaultGridSize": { + "description": "Default grid size for new layers", + "type": [ + "integer" + ] + }, + "worldLayout": { + "description": "**WARNING**: this field will move to the `worlds` array after the \"multi-worlds\" update. It will then be `null`. You can enable the Multi-worlds advanced project option to enable the change immediately.

An enum that describes how levels are organized in this project (ie. linearly or in a 2D space). Possible values: <`null`>, `Free`, `GridVania`, `LinearHorizontal`, `LinearVertical`", + "enum": [ + "Free", + "GridVania", + "LinearHorizontal", + "LinearVertical", + null + ] + }, + "flags": { + "description": "An array containing various advanced flags (ie. options or other states). Possible values: `DiscardPreCsvIntGrid`, `ExportPreCsvIntGridFormat`, `IgnoreBackupSuggest`, `PrependIndexToLevelFileNames`, `MultiWorlds`, `UseMultilinesType`", + "items": { + "enum": [ + "DiscardPreCsvIntGrid", + "ExportPreCsvIntGridFormat", + "IgnoreBackupSuggest", + "PrependIndexToLevelFileNames", + "MultiWorlds", + "UseMultilinesType" + ] + }, + "type": [ + "array" + ] + }, + "levelNamePattern": { + "description": "The default naming convention for level identifiers.", + "type": [ + "string" + ] + }, + "exportPng": { + "description": "**WARNING**: this deprecated value is no longer exported since version 0.9.3 Replaced by: `imageExportMode`", + "type": [ + "boolean", + "null" + ] + }, + "defaultLevelWidth": { + "description": "**WARNING**: this field will move to the `worlds` array after the \"multi-worlds\" update. It will then be `null`. You can enable the Multi-worlds advanced project option to enable the change immediately.

Default new level width", + "type": [ + "integer", + "null" + ] + }, + "pngFilePattern": { + "description": "File naming pattern for exported PNGs", + "type": [ + "string", + "null" + ] + }, + "__FORCED_REFS": { + "description": "This object is not actually used by LDtk. It ONLY exists to force explicit references to all types, to make sure QuickType finds them and integrate all of them. Otherwise, Quicktype will drop types that are not explicitely used.", + "properties": { + "TilesetRect": { + "$ref": "#/otherTypes/TilesetRect" + }, + "FieldInstance": { + "$ref": "#/otherTypes/FieldInstance" + }, + "EntityInstance": { + "$ref": "#/otherTypes/EntityInstance" + }, + "Definitions": { + "$ref": "#/otherTypes/Definitions" + }, + "EnumTagValue": { + "$ref": "#/otherTypes/EnumTagValue" + }, + "AutoRuleDef": { + "$ref": "#/otherTypes/AutoRuleDef" + }, + "FieldDef": { + "$ref": "#/otherTypes/FieldDef" + }, + "CustomCommand": { + "$ref": "#/otherTypes/CustomCommand" + }, + "EntityDef": { + "$ref": "#/otherTypes/EntityDef" + }, + "AutoLayerRuleGroup": { + "$ref": "#/otherTypes/AutoLayerRuleGroup" + }, + "IntGridValueInstance": { + "$ref": "#/otherTypes/IntGridValueInstance" + }, + "NeighbourLevel": { + "$ref": "#/otherTypes/NeighbourLevel" + }, + "LayerInstance": { + "$ref": "#/otherTypes/LayerInstance" + }, + "World": { + "$ref": "#/otherTypes/World" + }, + "EntityReferenceInfos": { + "$ref": "#/otherTypes/EntityReferenceInfos" + }, + "TileCustomMetadata": { + "$ref": "#/otherTypes/TileCustomMetadata" + }, + "TilesetDef": { + "$ref": "#/otherTypes/TilesetDef" + }, + "EnumDefValues": { + "$ref": "#/otherTypes/EnumDefValues" + }, + "Tile": { + "$ref": "#/otherTypes/Tile" + }, + "LayerDef": { + "$ref": "#/otherTypes/LayerDef" + }, + "LevelBgPosInfos": { + "$ref": "#/otherTypes/LevelBgPosInfos" + }, + "Level": { + "$ref": "#/otherTypes/Level" + }, + "TableOfContentEntry": { + "$ref": "#/otherTypes/TableOfContentEntry" + }, + "EnumDef": { + "$ref": "#/otherTypes/EnumDef" + }, + "GridPoint": { + "$ref": "#/otherTypes/GridPoint" + }, + "IntGridValueDef": { + "$ref": "#/otherTypes/IntGridValueDef" + } + }, + "type": [ + "object" + ] + }, + "exportTiled": { + "description": "If TRUE, a Tiled compatible file will also be generated along with the LDtk JSON file (default is FALSE)", + "type": [ + "boolean" + ] + }, + "defs": { + "description": "A structure containing all the definitions of this project", + "$ref": "#/otherTypes/Definitions" + }, + "levels": { + "description": "All levels. The order of this array is only relevant in `LinearHorizontal` and `linearVertical` world layouts (see `worldLayout` value).
Otherwise, you should refer to the `worldX`,`worldY` coordinates of each Level.", + "items": { + "$ref": "#/otherTypes/Level" + }, + "type": [ + "array" + ] + }, + "jsonVersion": { + "description": "File format version", + "type": [ + "string" + ] + }, + "defaultEntityHeight": { + "description": "Default height for new entities", + "type": [ + "integer" + ] + }, + "defaultPivotX": { + "description": "Default X pivot (0 to 1) for new entities", + "type": [ + "number" + ] + }, + "defaultLevelHeight": { + "description": "**WARNING**: this field will move to the `worlds` array after the \"multi-worlds\" update. It will then be `null`. You can enable the Multi-worlds advanced project option to enable the change immediately.

Default new level height", + "type": [ + "integer", + "null" + ] + }, + "simplifiedExport": { + "description": "If TRUE, a very simplified will be generated on saving, for quicker & easier engine integration.", + "type": [ + "boolean" + ] + }, + "externalLevels": { + "description": "If TRUE, one file will be saved for the project (incl. all its definitions) and one file in a sub-folder for each level.", + "type": [ + "boolean" + ] + }, + "tutorialDesc": { + "description": "This optional description is used by LDtk Samples to show up some informations and instructions.", + "type": [ + "string", + "null" + ] + }, + "minifyJson": { + "description": "If TRUE, the Json is partially minified (no indentation, nor line breaks, default is FALSE)", + "type": [ + "boolean" + ] + }, + "exportLevelBg": { + "description": "If TRUE, the exported PNGs will include the level background (color or image).", + "type": [ + "boolean" + ] + }, + "backupRelPath": { + "description": "Target relative path to store backup files", + "type": [ + "string", + "null" + ] + } + }, + "type": [ + "object" + ] + }, + "otherTypes": { + "TilesetRect": { + "description": "This object represents a custom sub rectangle in a Tileset image.", + "title": "Tileset rectangle", + "required": [ + "h", + "tilesetUid", + "w", + "x", + "y" + ], + "additionalProperties": false, + "properties": { + "tilesetUid": { + "description": "UID of the tileset", + "type": [ + "integer" + ] + }, + "h": { + "description": "Height in pixels", + "type": [ + "integer" + ] + }, + "x": { + "description": "X pixels coordinate of the top-left corner in the Tileset image", + "type": [ + "integer" + ] + }, + "y": { + "description": "Y pixels coordinate of the top-left corner in the Tileset image", + "type": [ + "integer" + ] + }, + "w": { + "description": "Width in pixels", + "type": [ + "integer" + ] + } + }, + "type": [ + "object" + ] + }, + "FieldInstance": { + "title": "Field instance", + "required": [ + "__identifier", + "__type", + "__value", + "defUid", + "realEditorValues" + ], + "additionalProperties": false, + "properties": { + "__type": { + "description": "Type of the field, such as `Int`, `Float`, `String`, `Enum(my_enum_name)`, `Bool`, etc.
NOTE: if you enable the advanced option **Use Multilines type**, you will have \"*Multilines*\" instead of \"*String*\" when relevant.", + "type": [ + "string" + ] + }, + "defUid": { + "description": "Reference of the **Field definition** UID", + "type": [ + "integer" + ] + }, + "__identifier": { + "description": "Field definition identifier", + "type": [ + "string" + ] + }, + "__tile": { + "description": "Optional TilesetRect used to display this field (this can be the field own Tile, or some other Tile guessed from the value, like an Enum).", + "oneOf": [ + { + "type": [ + "null" + ] + }, + { + "$ref": "#/otherTypes/TilesetRect" + } + ] + }, + "realEditorValues": { + "description": "Editor internal raw values", + "items" : {}, + "type": [ + "array" + ] + }, + "__value": { + "description": "Actual value of the field instance. The value type varies, depending on `__type`:
- For **classic types** (ie. Integer, Float, Boolean, String, Text and FilePath), you just get the actual value with the expected type.
- For **Color**, the value is an hexadecimal string using \"#rrggbb\" format.
- For **Enum**, the value is a String representing the selected enum value.
- For **Point**, the value is a [GridPoint](#ldtk-GridPoint) object.
- For **Tile**, the value is a [TilesetRect](#ldtk-TilesetRect) object.
- For **EntityRef**, the value is an [EntityReferenceInfos](#ldtk-EntityReferenceInfos) object.

If the field is an array, then this `__value` will also be a JSON array." + } + }, + "type": [ + "object" + ] + }, + "EntityInstance": { + "title": "Entity instance", + "required": [ + "__grid", + "__identifier", + "__pivot", + "__smartColor", + "__tags", + "__worldX", + "__worldY", + "defUid", + "fieldInstances", + "height", + "iid", + "px", + "width" + ], + "additionalProperties": false, + "properties": { + "iid": { + "description": "Unique instance identifier", + "type": [ + "string" + ] + }, + "defUid": { + "description": "Reference of the **Entity definition** UID", + "type": [ + "integer" + ] + }, + "__identifier": { + "description": "Entity definition identifier", + "type": [ + "string" + ] + }, + "__tile": { + "description": "Optional TilesetRect used to display this entity (it could either be the default Entity tile, or some tile provided by a field value, like an Enum).", + "oneOf": [ + { + "type": [ + "null" + ] + }, + { + "$ref": "#/otherTypes/TilesetRect" + } + ] + }, + "px": { + "description": "Pixel coordinates (`[x,y]` format) in current level coordinate space. Don't forget optional layer offsets, if they exist!", + "items": { + "type": [ + "integer" + ] + }, + "type": [ + "array" + ] + }, + "__worldX": { + "description": "X world coordinate in pixels", + "type": [ + "integer" + ] + }, + "__worldY": { + "description": "Y world coordinate in pixels", + "type": [ + "integer" + ] + }, + "__smartColor": { + "description": "The entity \"smart\" color, guessed from either Entity definition, or one its field instances.", + "type": [ + "string" + ] + }, + "__grid": { + "description": "Grid-based coordinates (`[x,y]` format)", + "items": { + "type": [ + "integer" + ] + }, + "type": [ + "array" + ] + }, + "__pivot": { + "description": "Pivot coordinates (`[x,y]` format, values are from 0 to 1) of the Entity", + "items": { + "type": [ + "number" + ] + }, + "type": [ + "array" + ] + }, + "fieldInstances": { + "description": "An array of all custom fields and their values.", + "items": { + "$ref": "#/otherTypes/FieldInstance" + }, + "type": [ + "array" + ] + }, + "height": { + "description": "Entity height in pixels. For non-resizable entities, it will be the same as Entity definition.", + "type": [ + "integer" + ] + }, + "__tags": { + "description": "Array of tags defined in this Entity definition", + "items": { + "type": [ + "string" + ] + }, + "type": [ + "array" + ] + }, + "width": { + "description": "Entity width in pixels. For non-resizable entities, it will be the same as Entity definition.", + "type": [ + "integer" + ] + } + }, + "type": [ + "object" + ] + }, + "Definitions": { + "description": "If you're writing your own LDtk importer, you should probably just ignore *most* stuff in the `defs` section, as it contains data that are mostly important to the editor. To keep you away from the `defs` section and avoid some unnecessary JSON parsing, important data from definitions is often duplicated in fields prefixed with a double underscore (eg. `__identifier` or `__type`). The 2 only definition types you might need here are **Tilesets** and **Enums**.", + "title": "Definitions", + "required": [ + "entities", + "enums", + "externalEnums", + "layers", + "levelFields", + "tilesets" + ], + "additionalProperties": false, + "properties": { + "tilesets": { + "description": "All tilesets", + "items": { + "$ref": "#/otherTypes/TilesetDef" + }, + "type": [ + "array" + ] + }, + "layers": { + "description": "All layer definitions", + "items": { + "$ref": "#/otherTypes/LayerDef" + }, + "type": [ + "array" + ] + }, + "levelFields": { + "description": "All custom fields available to all levels.", + "items": { + "$ref": "#/otherTypes/FieldDef" + }, + "type": [ + "array" + ] + }, + "enums": { + "description": "All internal enums", + "items": { + "$ref": "#/otherTypes/EnumDef" + }, + "type": [ + "array" + ] + }, + "entities": { + "description": "All entities definitions, including their custom fields", + "items": { + "$ref": "#/otherTypes/EntityDef" + }, + "type": [ + "array" + ] + }, + "externalEnums": { + "description": "Note: external enums are exactly the same as `enums`, except they have a `relPath` to point to an external source file.", + "items": { + "$ref": "#/otherTypes/EnumDef" + }, + "type": [ + "array" + ] + } + }, + "type": [ + "object" + ] + }, + "EnumTagValue": { + "description": "In a tileset definition, enum based tag infos", + "title": "Enum tag value", + "required": [ + "enumValueId", + "tileIds" + ], + "additionalProperties": false, + "properties": { + "tileIds": { + "description": "", + "items": { + "type": [ + "integer" + ] + }, + "type": [ + "array" + ] + }, + "enumValueId": { + "description": "", + "type": [ + "string" + ] + } + }, + "type": [ + "object" + ] + }, + "AutoRuleDef": { + "description": "This complex section isn't meant to be used by game devs at all, as these rules are completely resolved internally by the editor before any saving. You should just ignore this part.", + "title": "Auto-layer rule definition", + "required": [ + "active", + "alpha", + "breakOnMatch", + "chance", + "checker", + "flipX", + "flipY", + "pattern", + "perlinActive", + "perlinOctaves", + "perlinScale", + "perlinSeed", + "pivotX", + "pivotY", + "size", + "tileIds", + "tileMode", + "tileRandomXMax", + "tileRandomXMin", + "tileRandomYMax", + "tileRandomYMin", + "tileXOffset", + "tileYOffset", + "uid", + "xModulo", + "xOffset", + "yModulo", + "yOffset" + ], + "additionalProperties": false, + "properties": { + "flipX": { + "description": "If TRUE, allow rule to be matched by flipping its pattern horizontally", + "type": [ + "boolean" + ] + }, + "pivotX": { + "description": "X pivot of a tile stamp (0-1)", + "type": [ + "number" + ] + }, + "perlinActive": { + "description": "If TRUE, enable Perlin filtering to only apply rule on specific random area", + "type": [ + "boolean" + ] + }, + "perlinScale": { + "description": "", + "type": [ + "number" + ] + }, + "outOfBoundsValue": { + "description": "Default IntGrid value when checking cells outside of level bounds", + "type": [ + "integer", + "null" + ] + }, + "pattern": { + "description": "Rule pattern (size x size)", + "items": { + "type": [ + "integer" + ] + }, + "type": [ + "array" + ] + }, + "tileRandomXMin": { + "description": "Min random offset for X tile pos", + "type": [ + "integer" + ] + }, + "checker": { + "description": "Checker mode Possible values: `None`, `Horizontal`, `Vertical`", + "enum": [ + "None", + "Horizontal", + "Vertical" + ] + }, + "perlinOctaves": { + "description": "", + "type": [ + "number" + ] + }, + "tileIds": { + "description": "Array of all the tile IDs. They are used randomly or as stamps, based on `tileMode` value.", + "items": { + "type": [ + "integer" + ] + }, + "type": [ + "array" + ] + }, + "alpha": { + "description": "", + "type": [ + "number" + ] + }, + "tileXOffset": { + "description": "Tile X offset", + "type": [ + "integer" + ] + }, + "xModulo": { + "description": "X cell coord modulo", + "type": [ + "integer" + ] + }, + "size": { + "description": "Pattern width & height. Should only be 1,3,5 or 7.", + "type": [ + "integer" + ] + }, + "chance": { + "description": "Chances for this rule to be applied (0 to 1)", + "type": [ + "number" + ] + }, + "breakOnMatch": { + "description": "When TRUE, the rule will prevent other rules to be applied in the same cell if it matches (TRUE by default).", + "type": [ + "boolean" + ] + }, + "tileYOffset": { + "description": "Tile Y offset", + "type": [ + "integer" + ] + }, + "uid": { + "description": "Unique Int identifier", + "type": [ + "integer" + ] + }, + "perlinSeed": { + "description": "", + "type": [ + "number" + ] + }, + "yOffset": { + "description": "Y cell start offset", + "type": [ + "integer" + ] + }, + "tileRandomYMax": { + "description": "Max random offset for Y tile pos", + "type": [ + "integer" + ] + }, + "tileRandomYMin": { + "description": "Min random offset for Y tile pos", + "type": [ + "integer" + ] + }, + "tileMode": { + "description": "Defines how tileIds array is used Possible values: `Single`, `Stamp`", + "enum": [ + "Single", + "Stamp" + ] + }, + "flipY": { + "description": "If TRUE, allow rule to be matched by flipping its pattern vertically", + "type": [ + "boolean" + ] + }, + "tileRandomXMax": { + "description": "Max random offset for X tile pos", + "type": [ + "integer" + ] + }, + "pivotY": { + "description": "Y pivot of a tile stamp (0-1)", + "type": [ + "number" + ] + }, + "yModulo": { + "description": "Y cell coord modulo", + "type": [ + "integer" + ] + }, + "active": { + "description": "If FALSE, the rule effect isn't applied, and no tiles are generated.", + "type": [ + "boolean" + ] + }, + "xOffset": { + "description": "X cell start offset", + "type": [ + "integer" + ] + } + }, + "type": [ + "object" + ] + }, + "FieldDef": { + "description": "This section is mostly only intended for the LDtk editor app itself. You can safely ignore it.", + "title": "Field definition", + "required": [ + "__type", + "canBeNull", + "identifier", + "isArray", + "type", + "uid", + "allowOutOfLevelRef", + "allowedRefTags", + "allowedRefs", + "autoChainRef", + "editorAlwaysShow", + "editorCutLongValues", + "editorDisplayMode", + "editorDisplayPos", + "editorDisplayScale", + "editorLinkStyle", + "editorShowInWorld", + "symmetricalRef", + "useForSmartColor" + ], + "additionalProperties": false, + "properties": { + "acceptFileTypes": { + "description": "Optional list of accepted file extensions for FilePath value type. Includes the dot: `.ext`", + "items": { + "type": [ + "string" + ] + }, + "type": [ + "array", + "null" + ] + }, + "editorDisplayScale": { + "description": "", + "type": [ + "number" + ] + }, + "useForSmartColor": { + "description": "If TRUE, the color associated with this field will override the Entity or Level default color in the editor UI. For Enum fields, this would be the color associated to their values.", + "type": [ + "boolean" + ] + }, + "editorShowInWorld": { + "description": "", + "type": [ + "boolean" + ] + }, + "allowedRefs": { + "description": "Possible values: `Any`, `OnlySame`, `OnlyTags`, `OnlySpecificEntity`", + "enum": [ + "Any", + "OnlySame", + "OnlyTags", + "OnlySpecificEntity" + ] + }, + "editorAlwaysShow": { + "description": "", + "type": [ + "boolean" + ] + }, + "arrayMinLength": { + "description": "Array min length", + "type": [ + "integer", + "null" + ] + }, + "editorTextSuffix": { + "description": "", + "type": [ + "string", + "null" + ] + }, + "min": { + "description": "Min limit for value, if applicable", + "type": [ + "number", + "null" + ] + }, + "__type": { + "description": "Human readable value type. Possible values: `Int, Float, String, Bool, Color, ExternEnum.XXX, LocalEnum.XXX, Point, FilePath`.
If the field is an array, this field will look like `Array<...>` (eg. `Array`, `Array` etc.)
NOTE: if you enable the advanced option **Use Multilines type**, you will have \"*Multilines*\" instead of \"*String*\" when relevant.", + "type": [ + "string" + ] + }, + "editorDisplayMode": { + "description": "Possible values: `Hidden`, `ValueOnly`, `NameAndValue`, `EntityTile`, `LevelTile`, `Points`, `PointStar`, `PointPath`, `PointPathLoop`, `RadiusPx`, `RadiusGrid`, `ArrayCountWithLabel`, `ArrayCountNoLabel`, `RefLinkBetweenPivots`, `RefLinkBetweenCenters`", + "enum": [ + "Hidden", + "ValueOnly", + "NameAndValue", + "EntityTile", + "LevelTile", + "Points", + "PointStar", + "PointPath", + "PointPathLoop", + "RadiusPx", + "RadiusGrid", + "ArrayCountWithLabel", + "ArrayCountNoLabel", + "RefLinkBetweenPivots", + "RefLinkBetweenCenters" + ] + }, + "editorDisplayColor": { + "description": "", + "type": [ + "string", + "null" + ] + }, + "canBeNull": { + "description": "TRUE if the value can be null. For arrays, TRUE means it can contain null values (exception: array of Points can't have null values).", + "type": [ + "boolean" + ] + }, + "autoChainRef": { + "description": "", + "type": [ + "boolean" + ] + }, + "doc": { + "description": "User defined documentation for this field to provide help/tips to level designers about accepted values.", + "type": [ + "string", + "null" + ] + }, + "allowedRefsEntityUid": { + "description": "", + "type": [ + "integer", + "null" + ] + }, + "tilesetUid": { + "description": "UID of the tileset used for a Tile", + "type": [ + "integer", + "null" + ] + }, + "allowedRefTags": { + "description": "", + "items": { + "type": [ + "string" + ] + }, + "type": [ + "array" + ] + }, + "symmetricalRef": { + "description": "", + "type": [ + "boolean" + ] + }, + "uid": { + "description": "Unique Int identifier", + "type": [ + "integer" + ] + }, + "editorTextPrefix": { + "description": "", + "type": [ + "string", + "null" + ] + }, + "isArray": { + "description": "TRUE if the value is an array of multiple values", + "type": [ + "boolean" + ] + }, + "editorDisplayPos": { + "description": "Possible values: `Above`, `Center`, `Beneath`", + "enum": [ + "Above", + "Center", + "Beneath" + ] + }, + "textLanguageMode": { + "description": "Possible values: <`null`>, `LangPython`, `LangRuby`, `LangJS`, `LangLua`, `LangC`, `LangHaxe`, `LangMarkdown`, `LangJson`, `LangXml`, `LangLog`", + "enum": [ + "LangPython", + "LangRuby", + "LangJS", + "LangLua", + "LangC", + "LangHaxe", + "LangMarkdown", + "LangJson", + "LangXml", + "LangLog", + null + ] + }, + "max": { + "description": "Max limit for value, if applicable", + "type": [ + "number", + "null" + ] + }, + "allowOutOfLevelRef": { + "description": "", + "type": [ + "boolean" + ] + }, + "editorCutLongValues": { + "description": "", + "type": [ + "boolean" + ] + }, + "defaultOverride": { + "description": "Default value if selected value is null or invalid." + }, + "editorLinkStyle": { + "description": "Possible values: `ZigZag`, `StraightArrow`, `CurvedArrow`, `ArrowsLine`, `DashedLine`", + "enum": [ + "ZigZag", + "StraightArrow", + "CurvedArrow", + "ArrowsLine", + "DashedLine" + ] + }, + "regex": { + "description": "Optional regular expression that needs to be matched to accept values. Expected format: `/some_reg_ex/g`, with optional \"i\" flag.", + "type": [ + "string", + "null" + ] + }, + "type": { + "description": "Internal enum representing the possible field types. Possible values: F_Int, F_Float, F_String, F_Text, F_Bool, F_Color, F_Enum(...), F_Point, F_Path, F_EntityRef, F_Tile", + "type": [ + "string" + ] + }, + "identifier": { + "description": "User defined unique identifier", + "type": [ + "string" + ] + }, + "arrayMaxLength": { + "description": "Array max length", + "type": [ + "integer", + "null" + ] + } + }, + "type": [ + "object" + ] + }, + "CustomCommand": { + "title": "ldtk.CustomCommand", + "required": [ + "command", + "when" + ], + "additionalProperties": false, + "properties": { + "when": { + "description": "Possible values: `Manual`, `AfterLoad`, `BeforeSave`, `AfterSave`", + "enum": [ + "Manual", + "AfterLoad", + "BeforeSave", + "AfterSave" + ] + }, + "command": { + "description": "", + "type": [ + "string" + ] + } + }, + "type": [ + "object" + ] + }, + "EntityDef": { + "title": "Entity definition", + "required": [ + "color", + "height", + "identifier", + "nineSliceBorders", + "pivotX", + "pivotY", + "tileRenderMode", + "uid", + "width", + "exportToToc", + "fieldDefs", + "fillOpacity", + "hollow", + "keepAspectRatio", + "limitBehavior", + "limitScope", + "lineOpacity", + "maxCount", + "renderMode", + "resizableX", + "resizableY", + "showName", + "tags", + "tileOpacity" + ], + "additionalProperties": false, + "properties": { + "tileId": { + "description": "**WARNING**: this deprecated value is no longer exported since version 1.2.0 Replaced by: `tileRect`", + "type": [ + "integer", + "null" + ] + }, + "showName": { + "description": "Display entity name in editor", + "type": [ + "boolean" + ] + }, + "tilesetId": { + "description": "Tileset ID used for optional tile display", + "type": [ + "integer", + "null" + ] + }, + "maxHeight": { + "description": "Max pixel height (only applies if the entity is resizable on Y)", + "type": [ + "integer", + "null" + ] + }, + "limitScope": { + "description": "If TRUE, the maxCount is a \"per world\" limit, if FALSE, it's a \"per level\". Possible values: `PerLayer`, `PerLevel`, `PerWorld`", + "enum": [ + "PerLayer", + "PerLevel", + "PerWorld" + ] + }, + "pivotX": { + "description": "Pivot X coordinate (from 0 to 1.0)", + "type": [ + "number" + ] + }, + "maxCount": { + "description": "Max instances count", + "type": [ + "integer" + ] + }, + "hollow": { + "description": "", + "type": [ + "boolean" + ] + }, + "minHeight": { + "description": "Min pixel height (only applies if the entity is resizable on Y)", + "type": [ + "integer", + "null" + ] + }, + "keepAspectRatio": { + "description": "Only applies to entities resizable on both X/Y. If TRUE, the entity instance width/height will keep the same aspect ratio as the definition.", + "type": [ + "boolean" + ] + }, + "color": { + "description": "Base entity color", + "type": [ + "string" + ] + }, + "minWidth": { + "description": "Min pixel width (only applies if the entity is resizable on X)", + "type": [ + "integer", + "null" + ] + }, + "tileRect": { + "description": "An object representing a rectangle from an existing Tileset", + "oneOf": [ + { + "type": [ + "null" + ] + }, + { + "$ref": "#/otherTypes/TilesetRect" + } + ] + }, + "doc": { + "description": "User defined documentation for this element to provide help/tips to level designers.", + "type": [ + "string", + "null" + ] + }, + "fieldDefs": { + "description": "Array of field definitions", + "items": { + "$ref": "#/otherTypes/FieldDef" + }, + "type": [ + "array" + ] + }, + "tileRenderMode": { + "description": "An enum describing how the the Entity tile is rendered inside the Entity bounds. Possible values: `Cover`, `FitInside`, `Repeat`, `Stretch`, `FullSizeCropped`, `FullSizeUncropped`, `NineSlice`", + "enum": [ + "Cover", + "FitInside", + "Repeat", + "Stretch", + "FullSizeCropped", + "FullSizeUncropped", + "NineSlice" + ] + }, + "limitBehavior": { + "description": "Possible values: `DiscardOldOnes`, `PreventAdding`, `MoveLastOne`", + "enum": [ + "DiscardOldOnes", + "PreventAdding", + "MoveLastOne" + ] + }, + "tileOpacity": { + "description": "", + "type": [ + "number" + ] + }, + "nineSliceBorders": { + "description": "An array of 4 dimensions for the up/right/down/left borders (in this order) when using 9-slice mode for `tileRenderMode`.
If the tileRenderMode is not NineSlice, then this array is empty.
See: https://en.wikipedia.org/wiki/9-slice_scaling", + "items": { + "type": [ + "integer" + ] + }, + "type": [ + "array" + ] + }, + "resizableX": { + "description": "If TRUE, the entity instances will be resizable horizontally", + "type": [ + "boolean" + ] + }, + "uid": { + "description": "Unique Int identifier", + "type": [ + "integer" + ] + }, + "lineOpacity": { + "description": "", + "type": [ + "number" + ] + }, + "maxWidth": { + "description": "Max pixel width (only applies if the entity is resizable on X)", + "type": [ + "integer", + "null" + ] + }, + "resizableY": { + "description": "If TRUE, the entity instances will be resizable vertically", + "type": [ + "boolean" + ] + }, + "exportToToc": { + "description": "If enabled, all instances of this entity will be listed in the project \"Table of content\" object.", + "type": [ + "boolean" + ] + }, + "fillOpacity": { + "description": "", + "type": [ + "number" + ] + }, + "height": { + "description": "Pixel height", + "type": [ + "integer" + ] + }, + "identifier": { + "description": "User defined unique identifier", + "type": [ + "string" + ] + }, + "pivotY": { + "description": "Pivot Y coordinate (from 0 to 1.0)", + "type": [ + "number" + ] + }, + "renderMode": { + "description": "Possible values: `Rectangle`, `Ellipse`, `Tile`, `Cross`", + "enum": [ + "Rectangle", + "Ellipse", + "Tile", + "Cross" + ] + }, + "tags": { + "description": "An array of strings that classifies this entity", + "items": { + "type": [ + "string" + ] + }, + "type": [ + "array" + ] + }, + "width": { + "description": "Pixel width", + "type": [ + "integer" + ] + } + }, + "type": [ + "object" + ] + }, + "AutoLayerRuleGroup": { + "title": "Auto-layer rule group", + "required": [ + "active", + "isOptional", + "name", + "rules", + "uid", + "usesWizard" + ], + "additionalProperties": false, + "properties": { + "name": { + "description": "", + "type": [ + "string" + ] + }, + "collapsed": { + "description": "*This field was removed in 1.0.0 and should no longer be used.*", + "type": [ + "boolean", + "null" + ] + }, + "isOptional": { + "description": "", + "type": [ + "boolean" + ] + }, + "usesWizard": { + "description": "", + "type": [ + "boolean" + ] + }, + "uid": { + "description": "", + "type": [ + "integer" + ] + }, + "active": { + "description": "", + "type": [ + "boolean" + ] + }, + "rules": { + "description": "", + "items": { + "$ref": "#/otherTypes/AutoRuleDef" + }, + "type": [ + "array" + ] + } + }, + "type": [ + "object" + ] + }, + "IntGridValueInstance": { + "description": "IntGrid value instance", + "title": "IntGrid value instance", + "required": [ + "coordId", + "v" + ], + "additionalProperties": false, + "properties": { + "v": { + "description": "IntGrid value", + "type": [ + "integer" + ] + }, + "coordId": { + "description": "Coordinate ID in the layer grid", + "type": [ + "integer" + ] + } + }, + "type": [ + "object" + ] + }, + "NeighbourLevel": { + "description": "Nearby level info", + "title": "Neighbour level", + "required": [ + "dir", + "levelIid" + ], + "additionalProperties": false, + "properties": { + "levelIid": { + "description": "Neighbour Instance Identifier", + "type": [ + "string" + ] + }, + "levelUid": { + "description": "**WARNING**: this deprecated value is no longer exported since version 1.2.0 Replaced by: `levelIid`", + "type": [ + "integer", + "null" + ] + }, + "dir": { + "description": "A single lowercase character tipping on the level location (`n`orth, `s`outh, `w`est, `e`ast).", + "type": [ + "string" + ] + } + }, + "type": [ + "object" + ] + }, + "LayerInstance": { + "title": "Layer instance", + "required": [ + "__cHei", + "__cWid", + "__gridSize", + "__identifier", + "__opacity", + "__pxTotalOffsetX", + "__pxTotalOffsetY", + "__type", + "autoLayerTiles", + "entityInstances", + "gridTiles", + "iid", + "intGridCsv", + "layerDefUid", + "levelId", + "pxOffsetX", + "pxOffsetY", + "visible", + "optionalRules", + "seed" + ], + "additionalProperties": false, + "properties": { + "__cHei": { + "description": "Grid-based height", + "type": [ + "integer" + ] + }, + "pxOffsetX": { + "description": "X offset in pixels to render this layer, usually 0 (IMPORTANT: this should be added to the `LayerDef` optional offset, so you should probably prefer using `__pxTotalOffsetX` which contains the total offset value)", + "type": [ + "integer" + ] + }, + "__tilesetRelPath": { + "description": "The relative path to corresponding Tileset, if any.", + "type": [ + "string", + "null" + ] + }, + "iid": { + "description": "Unique layer instance identifier", + "type": [ + "string" + ] + }, + "levelId": { + "description": "Reference to the UID of the level containing this layer instance", + "type": [ + "integer" + ] + }, + "__type": { + "description": "Layer type (possible values: IntGrid, Entities, Tiles or AutoLayer)", + "type": [ + "string" + ] + }, + "autoLayerTiles": { + "description": "An array containing all tiles generated by Auto-layer rules. The array is already sorted in display order (ie. 1st tile is beneath 2nd, which is beneath 3rd etc.).

Note: if multiple tiles are stacked in the same cell as the result of different rules, all tiles behind opaque ones will be discarded.", + "items": { + "$ref": "#/otherTypes/Tile" + }, + "type": [ + "array" + ] + }, + "optionalRules": { + "description": "An Array containing the UIDs of optional rules that were enabled in this specific layer instance.", + "items": { + "type": [ + "integer" + ] + }, + "type": [ + "array" + ] + }, + "__identifier": { + "description": "Layer definition identifier", + "type": [ + "string" + ] + }, + "__gridSize": { + "description": "Grid size", + "type": [ + "integer" + ] + }, + "__pxTotalOffsetY": { + "description": "Total layer Y pixel offset, including both instance and definition offsets.", + "type": [ + "integer" + ] + }, + "intGridCsv": { + "description": "A list of all values in the IntGrid layer, stored in CSV format (Comma Separated Values).
Order is from left to right, and top to bottom (ie. first row from left to right, followed by second row, etc).
`0` means \"empty cell\" and IntGrid values start at 1.
The array size is `__cWid` x `__cHei` cells.", + "items": { + "type": [ + "integer" + ] + }, + "type": [ + "array" + ] + }, + "overrideTilesetUid": { + "description": "This layer can use another tileset by overriding the tileset UID here.", + "type": [ + "integer", + "null" + ] + }, + "visible": { + "description": "Layer instance visibility", + "type": [ + "boolean" + ] + }, + "entityInstances": { + "description": "", + "items": { + "$ref": "#/otherTypes/EntityInstance" + }, + "type": [ + "array" + ] + }, + "__opacity": { + "description": "Layer opacity as Float [0-1]", + "type": [ + "number" + ] + }, + "seed": { + "description": "Random seed used for Auto-Layers rendering", + "type": [ + "integer" + ] + }, + "layerDefUid": { + "description": "Reference the Layer definition UID", + "type": [ + "integer" + ] + }, + "__pxTotalOffsetX": { + "description": "Total layer X pixel offset, including both instance and definition offsets.", + "type": [ + "integer" + ] + }, + "__cWid": { + "description": "Grid-based width", + "type": [ + "integer" + ] + }, + "pxOffsetY": { + "description": "Y offset in pixels to render this layer, usually 0 (IMPORTANT: this should be added to the `LayerDef` optional offset, so you should probably prefer using `__pxTotalOffsetX` which contains the total offset value)", + "type": [ + "integer" + ] + }, + "__tilesetDefUid": { + "description": "The definition UID of corresponding Tileset, if any.", + "type": [ + "integer", + "null" + ] + }, + "gridTiles": { + "description": "", + "items": { + "$ref": "#/otherTypes/Tile" + }, + "type": [ + "array" + ] + }, + "intGrid": { + "description": "**WARNING**: this deprecated value is no longer exported since version 1.0.0 Replaced by: `intGridCsv`", + "items": { + "$ref": "#/otherTypes/IntGridValueInstance" + }, + "type": [ + "array", + "null" + ] + } + }, + "type": [ + "object" + ] + }, + "World": { + "description": "**IMPORTANT**: this type is available as a preview. You can rely on it to update your importers, for when it will be officially available. A World contains multiple levels, and it has its own layout settings.", + "title": "World", + "required": [ + "identifier", + "iid", + "levels", + "worldGridHeight", + "worldGridWidth", + "worldLayout", + "defaultLevelHeight", + "defaultLevelWidth" + ], + "additionalProperties": false, + "properties": { + "worldGridWidth": { + "description": "Width of the world grid in pixels.", + "type": [ + "integer" + ] + }, + "iid": { + "description": "Unique instance identifer", + "type": [ + "string" + ] + }, + "worldGridHeight": { + "description": "Height of the world grid in pixels.", + "type": [ + "integer" + ] + }, + "worldLayout": { + "description": "An enum that describes how levels are organized in this project (ie. linearly or in a 2D space). Possible values: `Free`, `GridVania`, `LinearHorizontal`, `LinearVertical`, `null`", + "enum": [ + "Free", + "GridVania", + "LinearHorizontal", + "LinearVertical", + null + ] + }, + "defaultLevelWidth": { + "description": "Default new level width", + "type": [ + "integer" + ] + }, + "levels": { + "description": "All levels from this world. The order of this array is only relevant in `LinearHorizontal` and `linearVertical` world layouts (see `worldLayout` value). Otherwise, you should refer to the `worldX`,`worldY` coordinates of each Level.", + "items": { + "$ref": "#/otherTypes/Level" + }, + "type": [ + "array" + ] + }, + "defaultLevelHeight": { + "description": "Default new level height", + "type": [ + "integer" + ] + }, + "identifier": { + "description": "User defined unique identifier", + "type": [ + "string" + ] + } + }, + "type": [ + "object" + ] + }, + "EntityReferenceInfos": { + "description": "This object describes the \"location\" of an Entity instance in the project worlds.", + "title": "Reference to an Entity instance", + "required": [ + "entityIid", + "layerIid", + "levelIid", + "worldIid" + ], + "additionalProperties": false, + "properties": { + "worldIid": { + "description": "IID of the World containing the refered EntityInstance", + "type": [ + "string" + ] + }, + "entityIid": { + "description": "IID of the refered EntityInstance", + "type": [ + "string" + ] + }, + "layerIid": { + "description": "IID of the LayerInstance containing the refered EntityInstance", + "type": [ + "string" + ] + }, + "levelIid": { + "description": "IID of the Level containing the refered EntityInstance", + "type": [ + "string" + ] + } + }, + "type": [ + "object" + ] + }, + "TileCustomMetadata": { + "description": "In a tileset definition, user defined meta-data of a tile.", + "title": "Tile custom metadata", + "required": [ + "data", + "tileId" + ], + "additionalProperties": false, + "properties": { + "tileId": { + "description": "", + "type": [ + "integer" + ] + }, + "data": { + "description": "", + "type": [ + "string" + ] + } + }, + "type": [ + "object" + ] + }, + "TilesetDef": { + "description": "The `Tileset` definition is the most important part among project definitions. It contains some extra informations about each integrated tileset. If you only had to parse one definition section, that would be the one.", + "title": "Tileset definition", + "required": [ + "__cHei", + "__cWid", + "customData", + "enumTags", + "identifier", + "padding", + "pxHei", + "pxWid", + "spacing", + "tags", + "tileGridSize", + "uid", + "savedSelections" + ], + "additionalProperties": false, + "properties": { + "cachedPixelData": { + "description": "The following data is used internally for various optimizations. It's always synced with source image changes.", + "type": [ + "object", + "null" + ] + }, + "__cHei": { + "description": "Grid-based height", + "type": [ + "integer" + ] + }, + "pxHei": { + "description": "Image height in pixels", + "type": [ + "integer" + ] + }, + "customData": { + "description": "An array of custom tile metadata", + "items": { + "$ref": "#/otherTypes/TileCustomMetadata" + }, + "type": [ + "array" + ] + }, + "tagsSourceEnumUid": { + "description": "Optional Enum definition UID used for this tileset meta-data", + "type": [ + "integer", + "null" + ] + }, + "uid": { + "description": "Unique Intidentifier", + "type": [ + "integer" + ] + }, + "padding": { + "description": "Distance in pixels from image borders", + "type": [ + "integer" + ] + }, + "enumTags": { + "description": "Tileset tags using Enum values specified by `tagsSourceEnumId`. This array contains 1 element per Enum value, which contains an array of all Tile IDs that are tagged with it.", + "items": { + "$ref": "#/otherTypes/EnumTagValue" + }, + "type": [ + "array" + ] + }, + "pxWid": { + "description": "Image width in pixels", + "type": [ + "integer" + ] + }, + "__cWid": { + "description": "Grid-based width", + "type": [ + "integer" + ] + }, + "spacing": { + "description": "Space in pixels between all tiles", + "type": [ + "integer" + ] + }, + "identifier": { + "description": "User defined unique identifier", + "type": [ + "string" + ] + }, + "savedSelections": { + "description": "Array of group of tiles selections, only meant to be used in the editor", + "items": { + "type": [ + "object" + ] + }, + "type": [ + "array" + ] + }, + "tags": { + "description": "An array of user-defined tags to organize the Tilesets", + "items": { + "type": [ + "string" + ] + }, + "type": [ + "array" + ] + }, + "embedAtlas": { + "description": "If this value is set, then it means that this atlas uses an internal LDtk atlas image instead of a loaded one. Possible values: <`null`>, `LdtkIcons`", + "enum": [ + "LdtkIcons", + null + ] + }, + "relPath": { + "description": "Path to the source file, relative to the current project JSON file
It can be null if no image was provided, or when using an embed atlas.", + "type": [ + "string", + "null" + ] + }, + "tileGridSize": { + "description": "", + "type": [ + "integer" + ] + } + }, + "type": [ + "object" + ] + }, + "EnumDefValues": { + "title": "Enum value definition", + "required": [ + "color", + "id" + ], + "additionalProperties": false, + "properties": { + "tileId": { + "description": "**WARNING**: this deprecated value will be *removed* completely on version 1.4.0+ Replaced by: `tileRect`", + "type": [ + "integer", + "null" + ] + }, + "color": { + "description": "Optional color", + "type": [ + "integer" + ] + }, + "tileRect": { + "description": "Optional tileset rectangle to represents this value", + "oneOf": [ + { + "type": [ + "null" + ] + }, + { + "$ref": "#/otherTypes/TilesetRect" + } + ] + }, + "id": { + "description": "Enum value", + "type": [ + "string" + ] + }, + "__tileSrcRect": { + "description": "**WARNING**: this deprecated value will be *removed* completely on version 1.4.0+ Replaced by: `tileRect`", + "items": { + "type": [ + "integer" + ] + }, + "type": [ + "array", + "null" + ] + } + }, + "type": [ + "object" + ] + }, + "Tile": { + "description": "This structure represents a single tile from a given Tileset.", + "title": "Tile instance", + "required": [ + "a", + "f", + "px", + "src", + "t", + "d" + ], + "additionalProperties": false, + "properties": { + "t": { + "description": "The *Tile ID* in the corresponding tileset.", + "type": [ + "integer" + ] + }, + "d": { + "description": "Internal data used by the editor.
For auto-layer tiles: `[ruleId, coordId]`.
For tile-layer tiles: `[coordId]`.", + "items": { + "type": [ + "integer" + ] + }, + "type": [ + "array" + ] + }, + "px": { + "description": "Pixel coordinates of the tile in the **layer** (`[x,y]` format). Don't forget optional layer offsets, if they exist!", + "items": { + "type": [ + "integer" + ] + }, + "type": [ + "array" + ] + }, + "a": { + "description": "Alpha/opacity of the tile (0-1, defaults to 1)", + "type": [ + "number" + ] + }, + "f": { + "description": "\"Flip bits\", a 2-bits integer to represent the mirror transformations of the tile.
- Bit 0 = X flip
- Bit 1 = Y flip
Examples: f=0 (no flip), f=1 (X flip only), f=2 (Y flip only), f=3 (both flips)", + "type": [ + "integer" + ] + }, + "src": { + "description": "Pixel coordinates of the tile in the **tileset** (`[x,y]` format)", + "items": { + "type": [ + "integer" + ] + }, + "type": [ + "array" + ] + } + }, + "type": [ + "object" + ] + }, + "LayerDef": { + "title": "Layer definition", + "required": [ + "__type", + "displayOpacity", + "gridSize", + "identifier", + "intGridValues", + "parallaxFactorX", + "parallaxFactorY", + "parallaxScaling", + "pxOffsetX", + "pxOffsetY", + "uid", + "autoRuleGroups", + "canSelectWhenInactive", + "excludedTags", + "guideGridHei", + "guideGridWid", + "hideFieldsWhenInactive", + "hideInList", + "inactiveOpacity", + "renderInWorldView", + "requiredTags", + "tilePivotX", + "tilePivotY", + "type" + ], + "additionalProperties": false, + "properties": { + "pxOffsetX": { + "description": "X offset of the layer, in pixels (IMPORTANT: this should be added to the `LayerInstance` optional offset)", + "type": [ + "integer" + ] + }, + "tilePivotX": { + "description": "If the tiles are smaller or larger than the layer grid, the pivot value will be used to position the tile relatively its grid cell.", + "type": [ + "number" + ] + }, + "displayOpacity": { + "description": "Opacity of the layer (0 to 1.0)", + "type": [ + "number" + ] + }, + "parallaxFactorY": { + "description": "Parallax vertical factor (from -1 to 1, defaults to 0) which affects the scrolling speed of this layer, creating a fake 3D (parallax) effect.", + "type": [ + "number" + ] + }, + "hideInList": { + "description": "Hide the layer from the list on the side of the editor view.", + "type": [ + "boolean" + ] + }, + "__type": { + "description": "Type of the layer (*IntGrid, Entities, Tiles or AutoLayer*)", + "type": [ + "string" + ] + }, + "guideGridHei": { + "description": "Height of the optional \"guide\" grid in pixels", + "type": [ + "integer" + ] + }, + "uiColor": { + "description": "User defined color for the UI", + "type": [ + "string", + "null" + ] + }, + "doc": { + "description": "User defined documentation for this element to provide help/tips to level designers.", + "type": [ + "string", + "null" + ] + }, + "tilesetDefUid": { + "description": "Reference to the default Tileset UID being used by this layer definition.
**WARNING**: some layer *instances* might use a different tileset. So most of the time, you should probably use the `__tilesetDefUid` value found in layer instances.
Note: since version 1.0.0, the old `autoTilesetDefUid` was removed and merged into this value.", + "type": [ + "integer", + "null" + ] + }, + "canSelectWhenInactive": { + "description": "Allow editor selections when the layer is not currently active.", + "type": [ + "boolean" + ] + }, + "autoSourceLayerDefUid": { + "description": "", + "type": [ + "integer", + "null" + ] + }, + "autoTilesetDefUid": { + "description": "**WARNING**: this deprecated value is no longer exported since version 1.2.0 Replaced by: `tilesetDefUid`", + "type": [ + "integer", + "null" + ] + }, + "parallaxScaling": { + "description": "If true (default), a layer with a parallax factor will also be scaled up/down accordingly.", + "type": [ + "boolean" + ] + }, + "renderInWorldView": { + "description": "If TRUE, the content of this layer will be used when rendering levels in a simplified way for the world view", + "type": [ + "boolean" + ] + }, + "inactiveOpacity": { + "description": "Alpha of this layer when it is not the active one.", + "type": [ + "number" + ] + }, + "uid": { + "description": "Unique Int identifier", + "type": [ + "integer" + ] + }, + "excludedTags": { + "description": "An array of tags to forbid some Entities in this layer", + "items": { + "type": [ + "string" + ] + }, + "type": [ + "array" + ] + }, + "hideFieldsWhenInactive": { + "description": "", + "type": [ + "boolean" + ] + }, + "intGridValues": { + "description": "An array that defines extra optional info for each IntGrid value.
WARNING: the array order is not related to actual IntGrid values! As user can re-order IntGrid values freely, you may value \"2\" before value \"1\" in this array.", + "items": { + "$ref": "#/otherTypes/IntGridValueDef" + }, + "type": [ + "array" + ] + }, + "autoRuleGroups": { + "description": "Contains all the auto-layer rule definitions.", + "items": { + "$ref": "#/otherTypes/AutoLayerRuleGroup" + }, + "type": [ + "array" + ] + }, + "type": { + "description": "Type of the layer as Haxe Enum Possible values: `IntGrid`, `Entities`, `Tiles`, `AutoLayer`", + "enum": [ + "IntGrid", + "Entities", + "Tiles", + "AutoLayer" + ] + }, + "identifier": { + "description": "User defined unique identifier", + "type": [ + "string" + ] + }, + "guideGridWid": { + "description": "Width of the optional \"guide\" grid in pixels", + "type": [ + "integer" + ] + }, + "requiredTags": { + "description": "An array of tags to filter Entities that can be added to this layer", + "items": { + "type": [ + "string" + ] + }, + "type": [ + "array" + ] + }, + "pxOffsetY": { + "description": "Y offset of the layer, in pixels (IMPORTANT: this should be added to the `LayerInstance` optional offset)", + "type": [ + "integer" + ] + }, + "tilePivotY": { + "description": "If the tiles are smaller or larger than the layer grid, the pivot value will be used to position the tile relatively its grid cell.", + "type": [ + "number" + ] + }, + "gridSize": { + "description": "Width and height of the grid in pixels", + "type": [ + "integer" + ] + }, + "parallaxFactorX": { + "description": "Parallax horizontal factor (from -1 to 1, defaults to 0) which affects the scrolling speed of this layer, creating a fake 3D (parallax) effect.", + "type": [ + "number" + ] + } + }, + "type": [ + "object" + ] + }, + "LevelBgPosInfos": { + "description": "Level background image position info", + "title": "Level background position", + "required": [ + "cropRect", + "scale", + "topLeftPx" + ], + "additionalProperties": false, + "properties": { + "cropRect": { + "description": "An array of 4 float values describing the cropped sub-rectangle of the displayed background image. This cropping happens when original is larger than the level bounds. Array format: `[ cropX, cropY, cropWidth, cropHeight ]`", + "items": { + "type": [ + "number" + ] + }, + "type": [ + "array" + ] + }, + "scale": { + "description": "An array containing the `[scaleX,scaleY]` values of the **cropped** background image, depending on `bgPos` option.", + "items": { + "type": [ + "number" + ] + }, + "type": [ + "array" + ] + }, + "topLeftPx": { + "description": "An array containing the `[x,y]` pixel coordinates of the top-left corner of the **cropped** background image, depending on `bgPos` option.", + "items": { + "type": [ + "integer" + ] + }, + "type": [ + "array" + ] + } + }, + "type": [ + "object" + ] + }, + "Level": { + "description": "This section contains all the level data. It can be found in 2 distinct forms, depending on Project current settings: - If \"*Separate level files*\" is **disabled** (default): full level data is *embedded* inside the main Project JSON file, - If \"*Separate level files*\" is **enabled**: level data is stored in *separate* standalone `.ldtkl` files (one per level). In this case, the main Project JSON file will still contain most level data, except heavy sections, like the `layerInstances` array (which will be null). The `externalRelPath` string points to the `ldtkl` file. A `ldtkl` file is just a JSON file containing exactly what is described below.", + "title": "Level", + "required": [ + "__bgColor", + "__neighbours", + "fieldInstances", + "identifier", + "iid", + "pxHei", + "pxWid", + "uid", + "worldDepth", + "worldX", + "worldY", + "__smartColor", + "bgPivotX", + "bgPivotY", + "useAutoIdentifier" + ], + "additionalProperties": false, + "properties": { + "__neighbours": { + "description": "An array listing all other levels touching this one on the world map.
Only relevant for world layouts where level spatial positioning is manual (ie. GridVania, Free). For Horizontal and Vertical layouts, this array is always empty.", + "items": { + "$ref": "#/otherTypes/NeighbourLevel" + }, + "type": [ + "array" + ] + }, + "__bgColor": { + "description": "Background color of the level (same as `bgColor`, except the default value is automatically used here if its value is `null`)", + "type": [ + "string" + ] + }, + "worldX": { + "description": "World X coordinate in pixels.
Only relevant for world layouts where level spatial positioning is manual (ie. GridVania, Free). For Horizontal and Vertical layouts, the value is always -1 here.", + "type": [ + "integer" + ] + }, + "externalRelPath": { + "description": "This value is not null if the project option \"*Save levels separately*\" is enabled. In this case, this **relative** path points to the level Json file.", + "type": [ + "string", + "null" + ] + }, + "useAutoIdentifier": { + "description": "If TRUE, the level identifier will always automatically use the naming pattern as defined in `Project.levelNamePattern`. Becomes FALSE if the identifier is manually modified by user.", + "type": [ + "boolean" + ] + }, + "iid": { + "description": "Unique instance identifier", + "type": [ + "string" + ] + }, + "bgColor": { + "description": "Background color of the level. If `null`, the project `defaultLevelBgColor` should be used.", + "type": [ + "string", + "null" + ] + }, + "bgPos": { + "description": "An enum defining the way the background image (if any) is positioned on the level. See `__bgPos` for resulting position info. Possible values: <`null`>, `Unscaled`, `Contain`, `Cover`, `CoverDirty`, `Repeat`", + "enum": [ + "Unscaled", + "Contain", + "Cover", + "CoverDirty", + "Repeat", + null + ] + }, + "pxHei": { + "description": "Height of the level in pixels", + "type": [ + "integer" + ] + }, + "worldY": { + "description": "World Y coordinate in pixels.
Only relevant for world layouts where level spatial positioning is manual (ie. GridVania, Free). For Horizontal and Vertical layouts, the value is always -1 here.", + "type": [ + "integer" + ] + }, + "__bgPos": { + "description": "Position informations of the background image, if there is one.", + "oneOf": [ + { + "type": [ + "null" + ] + }, + { + "$ref": "#/otherTypes/LevelBgPosInfos" + } + ] + }, + "uid": { + "description": "Unique Int identifier", + "type": [ + "integer" + ] + }, + "__smartColor": { + "description": "The \"guessed\" color for this level in the editor, decided using either the background color or an existing custom field.", + "type": [ + "string" + ] + }, + "fieldInstances": { + "description": "An array containing this level custom field values.", + "items": { + "$ref": "#/otherTypes/FieldInstance" + }, + "type": [ + "array" + ] + }, + "pxWid": { + "description": "Width of the level in pixels", + "type": [ + "integer" + ] + }, + "identifier": { + "description": "User defined unique identifier", + "type": [ + "string" + ] + }, + "bgPivotY": { + "description": "Background image Y pivot (0-1)", + "type": [ + "number" + ] + }, + "bgPivotX": { + "description": "Background image X pivot (0-1)", + "type": [ + "number" + ] + }, + "layerInstances": { + "description": "An array containing all Layer instances. **IMPORTANT**: if the project option \"*Save levels separately*\" is enabled, this field will be `null`.
This array is **sorted in display order**: the 1st layer is the top-most and the last is behind.", + "items": { + "$ref": "#/otherTypes/LayerInstance" + }, + "type": [ + "array", + "null" + ] + }, + "bgRelPath": { + "description": "The *optional* relative path to the level background image.", + "type": [ + "string", + "null" + ] + }, + "worldDepth": { + "description": "Index that represents the \"depth\" of the level in the world. Default is 0, greater means \"above\", lower means \"below\".
This value is mostly used for display only and is intended to make stacking of levels easier to manage.", + "type": [ + "integer" + ] + } + }, + "type": [ + "object" + ] + }, + "TableOfContentEntry": { + "title": "ldtk.TableOfContentEntry", + "required": [ + "identifier", + "instances" + ], + "additionalProperties": false, + "properties": { + "identifier": { + "description": "", + "type": [ + "string" + ] + }, + "instances": { + "description": "", + "items": { + "$ref": "#/otherTypes/EntityReferenceInfos" + }, + "type": [ + "array" + ] + } + }, + "type": [ + "object" + ] + }, + "EnumDef": { + "title": "Enum definition", + "required": [ + "identifier", + "tags", + "uid", + "values" + ], + "additionalProperties": false, + "properties": { + "externalFileChecksum": { + "description": "", + "type": [ + "string", + "null" + ] + }, + "externalRelPath": { + "description": "Relative path to the external file providing this Enum", + "type": [ + "string", + "null" + ] + }, + "uid": { + "description": "Unique Int identifier", + "type": [ + "integer" + ] + }, + "values": { + "description": "All possible enum values, with their optional Tile infos.", + "items": { + "$ref": "#/otherTypes/EnumDefValues" + }, + "type": [ + "array" + ] + }, + "iconTilesetUid": { + "description": "Tileset UID if provided", + "type": [ + "integer", + "null" + ] + }, + "identifier": { + "description": "User defined unique identifier", + "type": [ + "string" + ] + }, + "tags": { + "description": "An array of user-defined tags to organize the Enums", + "items": { + "type": [ + "string" + ] + }, + "type": [ + "array" + ] + } + }, + "type": [ + "object" + ] + }, + "GridPoint": { + "description": "This object is just a grid-based coordinate used in Field values.", + "title": "Grid point", + "required": [ + "cx", + "cy" + ], + "additionalProperties": false, + "properties": { + "cy": { + "description": "Y grid-based coordinate", + "type": [ + "integer" + ] + }, + "cx": { + "description": "X grid-based coordinate", + "type": [ + "integer" + ] + } + }, + "type": [ + "object" + ] + }, + "IntGridValueDef": { + "description": "IntGrid value definition", + "title": "IntGrid value definition", + "required": [ + "color", + "value" + ], + "additionalProperties": false, + "properties": { + "tile": { + "description": "", + "oneOf": [ + { + "type": [ + "null" + ] + }, + { + "$ref": "#/otherTypes/TilesetRect" + } + ] + }, + "color": { + "description": "", + "type": [ + "string" + ] + }, + "identifier": { + "description": "User defined unique identifier", + "type": [ + "string", + "null" + ] + }, + "value": { + "description": "The IntGrid value itself", + "type": [ + "integer" + ] + } + }, + "type": [ + "object" + ] + } + } +} \ No newline at end of file diff --git a/docs/archives/1.3.4/MINIMAL_JSON_SCHEMA.json b/docs/archives/1.3.4/MINIMAL_JSON_SCHEMA.json new file mode 100644 index 000000000..b7b241a31 --- /dev/null +++ b/docs/archives/1.3.4/MINIMAL_JSON_SCHEMA.json @@ -0,0 +1,1762 @@ +{ + "description": "This file is a JSON schema of files created by LDtk level editor (https://ldtk.io).", + "title": "LDtk 1.3.4 JSON schema", + "$schema": "https://json-schema.org/draft-07/schema#", + "$ref": "#/LdtkJsonRoot", + "version": "1.3.4", + "LdtkJsonRoot": { + "description": "This is the root of any Project JSON file. It contains: - the project settings, - an array of levels, - a group of definitions (that can probably be safely ignored for most users).", + "title": "LDtk Json root", + "required": [ + "bgColor", + "defs", + "externalLevels", + "iid", + "jsonVersion", + "levels", + "toc", + "worlds" + ], + "properties": { + "worldGridWidth": { + "description": "**WARNING**: this field will move to the `worlds` array after the \"multi-worlds\" update. It will then be `null`. You can enable the Multi-worlds advanced project option to enable the change immediately.

Width of the world grid in pixels.", + "type": [ + "integer", + "null" + ] + }, + "iid": { + "description": "Unique project identifier", + "type": [ + "string" + ] + }, + "bgColor": { + "description": "Project background color", + "type": [ + "string" + ] + }, + "worlds": { + "description": "This array will be empty, unless you enable the Multi-Worlds in the project advanced settings.

- in current version, a LDtk project file can only contain a single world with multiple levels in it. In this case, levels and world layout related settings are stored in the root of the JSON.
- with \"Multi-worlds\" enabled, there will be a `worlds` array in root, each world containing levels and layout settings. Basically, it's pretty much only about moving the `levels` array to the `worlds` array, along with world layout related values (eg. `worldGridWidth` etc).

If you want to start supporting this future update easily, please refer to this documentation: https://github.com/deepnight/ldtk/issues/231", + "items": { + "$ref": "#/otherTypes/World" + }, + "type": [ + "array" + ] + }, + "toc": { + "description": "All instances of entities that have their `exportToToc` flag enabled are listed in this array.", + "items": { + "$ref": "#/otherTypes/TableOfContentEntry" + }, + "type": [ + "array" + ] + }, + "worldGridHeight": { + "description": "**WARNING**: this field will move to the `worlds` array after the \"multi-worlds\" update. It will then be `null`. You can enable the Multi-worlds advanced project option to enable the change immediately.

Height of the world grid in pixels.", + "type": [ + "integer", + "null" + ] + }, + "worldLayout": { + "description": "**WARNING**: this field will move to the `worlds` array after the \"multi-worlds\" update. It will then be `null`. You can enable the Multi-worlds advanced project option to enable the change immediately.

An enum that describes how levels are organized in this project (ie. linearly or in a 2D space). Possible values: <`null`>, `Free`, `GridVania`, `LinearHorizontal`, `LinearVertical`, `null`", + "enum": [ + "Free", + "GridVania", + "LinearHorizontal", + "LinearVertical", + null, + null + ] + }, + "__FORCED_REFS": { + "description": "This object is not actually used by LDtk. It ONLY exists to force explicit references to all types, to make sure QuickType finds them and integrate all of them. Otherwise, Quicktype will drop types that are not explicitely used.", + "properties": { + "TilesetRect": { + "$ref": "#/otherTypes/TilesetRect" + }, + "FieldInstance": { + "$ref": "#/otherTypes/FieldInstance" + }, + "EntityInstance": { + "$ref": "#/otherTypes/EntityInstance" + }, + "Definitions": { + "$ref": "#/otherTypes/Definitions" + }, + "EnumTagValue": { + "$ref": "#/otherTypes/EnumTagValue" + }, + "AutoRuleDef": { + "$ref": "#/otherTypes/AutoRuleDef" + }, + "FieldDef": { + "$ref": "#/otherTypes/FieldDef" + }, + "CustomCommand": { + "$ref": "#/otherTypes/CustomCommand" + }, + "EntityDef": { + "$ref": "#/otherTypes/EntityDef" + }, + "AutoLayerRuleGroup": { + "$ref": "#/otherTypes/AutoLayerRuleGroup" + }, + "IntGridValueInstance": { + "$ref": "#/otherTypes/IntGridValueInstance" + }, + "NeighbourLevel": { + "$ref": "#/otherTypes/NeighbourLevel" + }, + "LayerInstance": { + "$ref": "#/otherTypes/LayerInstance" + }, + "World": { + "$ref": "#/otherTypes/World" + }, + "EntityReferenceInfos": { + "$ref": "#/otherTypes/EntityReferenceInfos" + }, + "TileCustomMetadata": { + "$ref": "#/otherTypes/TileCustomMetadata" + }, + "TilesetDef": { + "$ref": "#/otherTypes/TilesetDef" + }, + "EnumDefValues": { + "$ref": "#/otherTypes/EnumDefValues" + }, + "Tile": { + "$ref": "#/otherTypes/Tile" + }, + "LayerDef": { + "$ref": "#/otherTypes/LayerDef" + }, + "LevelBgPosInfos": { + "$ref": "#/otherTypes/LevelBgPosInfos" + }, + "Level": { + "$ref": "#/otherTypes/Level" + }, + "TableOfContentEntry": { + "$ref": "#/otherTypes/TableOfContentEntry" + }, + "EnumDef": { + "$ref": "#/otherTypes/EnumDef" + }, + "GridPoint": { + "$ref": "#/otherTypes/GridPoint" + }, + "IntGridValueDef": { + "$ref": "#/otherTypes/IntGridValueDef" + } + }, + "type": [ + "object" + ] + }, + "defs": { + "description": "A structure containing all the definitions of this project", + "$ref": "#/otherTypes/Definitions" + }, + "levels": { + "description": "All levels. The order of this array is only relevant in `LinearHorizontal` and `linearVertical` world layouts (see `worldLayout` value).
Otherwise, you should refer to the `worldX`,`worldY` coordinates of each Level.", + "items": { + "$ref": "#/otherTypes/Level" + }, + "type": [ + "array" + ] + }, + "jsonVersion": { + "description": "File format version", + "type": [ + "string" + ] + }, + "externalLevels": { + "description": "If TRUE, one file will be saved for the project (incl. all its definitions) and one file in a sub-folder for each level.", + "type": [ + "boolean" + ] + } + }, + "type": [ + "object" + ] + }, + "otherTypes": { + "TilesetRect": { + "description": "This object represents a custom sub rectangle in a Tileset image.", + "title": "Tileset rectangle", + "required": [ + "h", + "tilesetUid", + "w", + "x", + "y" + ], + "additionalProperties": false, + "properties": { + "tilesetUid": { + "description": "UID of the tileset", + "type": [ + "integer" + ] + }, + "h": { + "description": "Height in pixels", + "type": [ + "integer" + ] + }, + "x": { + "description": "X pixels coordinate of the top-left corner in the Tileset image", + "type": [ + "integer" + ] + }, + "y": { + "description": "Y pixels coordinate of the top-left corner in the Tileset image", + "type": [ + "integer" + ] + }, + "w": { + "description": "Width in pixels", + "type": [ + "integer" + ] + } + }, + "type": [ + "object" + ] + }, + "FieldInstance": { + "title": "Field instance", + "required": [ + "__identifier", + "__type", + "__value", + "defUid" + ], + "additionalProperties": false, + "properties": { + "__type": { + "description": "Type of the field, such as `Int`, `Float`, `String`, `Enum(my_enum_name)`, `Bool`, etc.
NOTE: if you enable the advanced option **Use Multilines type**, you will have \"*Multilines*\" instead of \"*String*\" when relevant.", + "type": [ + "string" + ] + }, + "defUid": { + "description": "Reference of the **Field definition** UID", + "type": [ + "integer" + ] + }, + "__identifier": { + "description": "Field definition identifier", + "type": [ + "string" + ] + }, + "__tile": { + "description": "Optional TilesetRect used to display this field (this can be the field own Tile, or some other Tile guessed from the value, like an Enum).", + "oneOf": [ + { + "type": [ + "null" + ] + }, + { + "$ref": "#/otherTypes/TilesetRect" + } + ] + }, + "__value": { + "description": "Actual value of the field instance. The value type varies, depending on `__type`:
- For **classic types** (ie. Integer, Float, Boolean, String, Text and FilePath), you just get the actual value with the expected type.
- For **Color**, the value is an hexadecimal string using \"#rrggbb\" format.
- For **Enum**, the value is a String representing the selected enum value.
- For **Point**, the value is a [GridPoint](#ldtk-GridPoint) object.
- For **Tile**, the value is a [TilesetRect](#ldtk-TilesetRect) object.
- For **EntityRef**, the value is an [EntityReferenceInfos](#ldtk-EntityReferenceInfos) object.

If the field is an array, then this `__value` will also be a JSON array." + } + }, + "type": [ + "object" + ] + }, + "EntityInstance": { + "title": "Entity instance", + "required": [ + "__grid", + "__identifier", + "__pivot", + "__smartColor", + "__tags", + "__worldX", + "__worldY", + "defUid", + "fieldInstances", + "height", + "iid", + "px", + "width" + ], + "additionalProperties": false, + "properties": { + "iid": { + "description": "Unique instance identifier", + "type": [ + "string" + ] + }, + "defUid": { + "description": "Reference of the **Entity definition** UID", + "type": [ + "integer" + ] + }, + "__identifier": { + "description": "Entity definition identifier", + "type": [ + "string" + ] + }, + "__tile": { + "description": "Optional TilesetRect used to display this entity (it could either be the default Entity tile, or some tile provided by a field value, like an Enum).", + "oneOf": [ + { + "type": [ + "null" + ] + }, + { + "$ref": "#/otherTypes/TilesetRect" + } + ] + }, + "px": { + "description": "Pixel coordinates (`[x,y]` format) in current level coordinate space. Don't forget optional layer offsets, if they exist!", + "items": { + "type": [ + "integer" + ] + }, + "type": [ + "array" + ] + }, + "__worldX": { + "description": "X world coordinate in pixels", + "type": [ + "integer" + ] + }, + "__worldY": { + "description": "Y world coordinate in pixels", + "type": [ + "integer" + ] + }, + "__smartColor": { + "description": "The entity \"smart\" color, guessed from either Entity definition, or one its field instances.", + "type": [ + "string" + ] + }, + "__grid": { + "description": "Grid-based coordinates (`[x,y]` format)", + "items": { + "type": [ + "integer" + ] + }, + "type": [ + "array" + ] + }, + "__pivot": { + "description": "Pivot coordinates (`[x,y]` format, values are from 0 to 1) of the Entity", + "items": { + "type": [ + "number" + ] + }, + "type": [ + "array" + ] + }, + "fieldInstances": { + "description": "An array of all custom fields and their values.", + "items": { + "$ref": "#/otherTypes/FieldInstance" + }, + "type": [ + "array" + ] + }, + "height": { + "description": "Entity height in pixels. For non-resizable entities, it will be the same as Entity definition.", + "type": [ + "integer" + ] + }, + "__tags": { + "description": "Array of tags defined in this Entity definition", + "items": { + "type": [ + "string" + ] + }, + "type": [ + "array" + ] + }, + "width": { + "description": "Entity width in pixels. For non-resizable entities, it will be the same as Entity definition.", + "type": [ + "integer" + ] + } + }, + "type": [ + "object" + ] + }, + "Definitions": { + "description": "If you're writing your own LDtk importer, you should probably just ignore *most* stuff in the `defs` section, as it contains data that are mostly important to the editor. To keep you away from the `defs` section and avoid some unnecessary JSON parsing, important data from definitions is often duplicated in fields prefixed with a double underscore (eg. `__identifier` or `__type`). The 2 only definition types you might need here are **Tilesets** and **Enums**.", + "title": "Definitions", + "required": [ + "entities", + "enums", + "externalEnums", + "layers", + "levelFields", + "tilesets" + ], + "additionalProperties": false, + "properties": { + "tilesets": { + "description": "All tilesets", + "items": { + "$ref": "#/otherTypes/TilesetDef" + }, + "type": [ + "array" + ] + }, + "layers": { + "description": "All layer definitions", + "items": { + "$ref": "#/otherTypes/LayerDef" + }, + "type": [ + "array" + ] + }, + "levelFields": { + "description": "All custom fields available to all levels.", + "items": { + "$ref": "#/otherTypes/FieldDef" + }, + "type": [ + "array" + ] + }, + "enums": { + "description": "All internal enums", + "items": { + "$ref": "#/otherTypes/EnumDef" + }, + "type": [ + "array" + ] + }, + "entities": { + "description": "All entities definitions, including their custom fields", + "items": { + "$ref": "#/otherTypes/EntityDef" + }, + "type": [ + "array" + ] + }, + "externalEnums": { + "description": "Note: external enums are exactly the same as `enums`, except they have a `relPath` to point to an external source file.", + "items": { + "$ref": "#/otherTypes/EnumDef" + }, + "type": [ + "array" + ] + } + }, + "type": [ + "object" + ] + }, + "EnumTagValue": { + "description": "In a tileset definition, enum based tag infos", + "title": "Enum tag value", + "required": [ + "enumValueId", + "tileIds" + ], + "additionalProperties": false, + "properties": { + "tileIds": { + "description": "", + "items": { + "type": [ + "integer" + ] + }, + "type": [ + "array" + ] + }, + "enumValueId": { + "description": "", + "type": [ + "string" + ] + } + }, + "type": [ + "object" + ] + }, + "AutoRuleDef": { + "description": "This complex section isn't meant to be used by game devs at all, as these rules are completely resolved internally by the editor before any saving. You should just ignore this part.", + "title": "Auto-layer rule definition", + "required": [], + "additionalProperties": false, + "properties" : {}, + "type": [ + "object" + ] + }, + "FieldDef": { + "description": "This section is mostly only intended for the LDtk editor app itself. You can safely ignore it.", + "title": "Field definition", + "required": [], + "additionalProperties": false, + "properties" : {}, + "type": [ + "object" + ] + }, + "CustomCommand": { + "title": "ldtk.CustomCommand", + "required": [ + "command", + "when" + ], + "additionalProperties": false, + "properties": { + "when": { + "description": "Possible values: `Manual`, `AfterLoad`, `BeforeSave`, `AfterSave`", + "enum": [ + "Manual", + "AfterLoad", + "BeforeSave", + "AfterSave" + ] + }, + "command": { + "description": "", + "type": [ + "string" + ] + } + }, + "type": [ + "object" + ] + }, + "EntityDef": { + "title": "Entity definition", + "required": [ + "color", + "height", + "identifier", + "nineSliceBorders", + "pivotX", + "pivotY", + "tileRenderMode", + "uid", + "width" + ], + "additionalProperties": false, + "properties": { + "tilesetId": { + "description": "Tileset ID used for optional tile display", + "type": [ + "integer", + "null" + ] + }, + "pivotX": { + "description": "Pivot X coordinate (from 0 to 1.0)", + "type": [ + "number" + ] + }, + "color": { + "description": "Base entity color", + "type": [ + "string" + ] + }, + "tileRect": { + "description": "An object representing a rectangle from an existing Tileset", + "oneOf": [ + { + "type": [ + "null" + ] + }, + { + "$ref": "#/otherTypes/TilesetRect" + } + ] + }, + "tileRenderMode": { + "description": "An enum describing how the the Entity tile is rendered inside the Entity bounds. Possible values: `Cover`, `FitInside`, `Repeat`, `Stretch`, `FullSizeCropped`, `FullSizeUncropped`, `NineSlice`", + "enum": [ + "Cover", + "FitInside", + "Repeat", + "Stretch", + "FullSizeCropped", + "FullSizeUncropped", + "NineSlice" + ] + }, + "nineSliceBorders": { + "description": "An array of 4 dimensions for the up/right/down/left borders (in this order) when using 9-slice mode for `tileRenderMode`.
If the tileRenderMode is not NineSlice, then this array is empty.
See: https://en.wikipedia.org/wiki/9-slice_scaling", + "items": { + "type": [ + "integer" + ] + }, + "type": [ + "array" + ] + }, + "uid": { + "description": "Unique Int identifier", + "type": [ + "integer" + ] + }, + "height": { + "description": "Pixel height", + "type": [ + "integer" + ] + }, + "identifier": { + "description": "User defined unique identifier", + "type": [ + "string" + ] + }, + "pivotY": { + "description": "Pivot Y coordinate (from 0 to 1.0)", + "type": [ + "number" + ] + }, + "width": { + "description": "Pixel width", + "type": [ + "integer" + ] + } + }, + "type": [ + "object" + ] + }, + "AutoLayerRuleGroup": { + "title": "Auto-layer rule group", + "required": [ + "active", + "isOptional", + "name", + "rules", + "uid", + "usesWizard" + ], + "additionalProperties": false, + "properties": { + "name": { + "description": "", + "type": [ + "string" + ] + }, + "isOptional": { + "description": "", + "type": [ + "boolean" + ] + }, + "usesWizard": { + "description": "", + "type": [ + "boolean" + ] + }, + "uid": { + "description": "", + "type": [ + "integer" + ] + }, + "active": { + "description": "", + "type": [ + "boolean" + ] + }, + "rules": { + "description": "", + "items": { + "$ref": "#/otherTypes/AutoRuleDef" + }, + "type": [ + "array" + ] + } + }, + "type": [ + "object" + ] + }, + "IntGridValueInstance": { + "description": "IntGrid value instance", + "title": "IntGrid value instance", + "required": [ + "coordId", + "v" + ], + "additionalProperties": false, + "properties": { + "v": { + "description": "IntGrid value", + "type": [ + "integer" + ] + }, + "coordId": { + "description": "Coordinate ID in the layer grid", + "type": [ + "integer" + ] + } + }, + "type": [ + "object" + ] + }, + "NeighbourLevel": { + "description": "Nearby level info", + "title": "Neighbour level", + "required": [ + "dir", + "levelIid" + ], + "additionalProperties": false, + "properties": { + "levelIid": { + "description": "Neighbour Instance Identifier", + "type": [ + "string" + ] + }, + "dir": { + "description": "A single lowercase character tipping on the level location (`n`orth, `s`outh, `w`est, `e`ast).", + "type": [ + "string" + ] + } + }, + "type": [ + "object" + ] + }, + "LayerInstance": { + "title": "Layer instance", + "required": [ + "__cHei", + "__cWid", + "__gridSize", + "__identifier", + "__opacity", + "__pxTotalOffsetX", + "__pxTotalOffsetY", + "__type", + "autoLayerTiles", + "entityInstances", + "gridTiles", + "iid", + "intGridCsv", + "layerDefUid", + "levelId", + "pxOffsetX", + "pxOffsetY", + "visible" + ], + "additionalProperties": false, + "properties": { + "__cHei": { + "description": "Grid-based height", + "type": [ + "integer" + ] + }, + "pxOffsetX": { + "description": "X offset in pixels to render this layer, usually 0 (IMPORTANT: this should be added to the `LayerDef` optional offset, so you should probably prefer using `__pxTotalOffsetX` which contains the total offset value)", + "type": [ + "integer" + ] + }, + "__tilesetRelPath": { + "description": "The relative path to corresponding Tileset, if any.", + "type": [ + "string", + "null" + ] + }, + "iid": { + "description": "Unique layer instance identifier", + "type": [ + "string" + ] + }, + "levelId": { + "description": "Reference to the UID of the level containing this layer instance", + "type": [ + "integer" + ] + }, + "__type": { + "description": "Layer type (possible values: IntGrid, Entities, Tiles or AutoLayer)", + "type": [ + "string" + ] + }, + "autoLayerTiles": { + "description": "An array containing all tiles generated by Auto-layer rules. The array is already sorted in display order (ie. 1st tile is beneath 2nd, which is beneath 3rd etc.).

Note: if multiple tiles are stacked in the same cell as the result of different rules, all tiles behind opaque ones will be discarded.", + "items": { + "$ref": "#/otherTypes/Tile" + }, + "type": [ + "array" + ] + }, + "__identifier": { + "description": "Layer definition identifier", + "type": [ + "string" + ] + }, + "__gridSize": { + "description": "Grid size", + "type": [ + "integer" + ] + }, + "__pxTotalOffsetY": { + "description": "Total layer Y pixel offset, including both instance and definition offsets.", + "type": [ + "integer" + ] + }, + "intGridCsv": { + "description": "A list of all values in the IntGrid layer, stored in CSV format (Comma Separated Values).
Order is from left to right, and top to bottom (ie. first row from left to right, followed by second row, etc).
`0` means \"empty cell\" and IntGrid values start at 1.
The array size is `__cWid` x `__cHei` cells.", + "items": { + "type": [ + "integer" + ] + }, + "type": [ + "array" + ] + }, + "overrideTilesetUid": { + "description": "This layer can use another tileset by overriding the tileset UID here.", + "type": [ + "integer", + "null" + ] + }, + "visible": { + "description": "Layer instance visibility", + "type": [ + "boolean" + ] + }, + "entityInstances": { + "description": "", + "items": { + "$ref": "#/otherTypes/EntityInstance" + }, + "type": [ + "array" + ] + }, + "__opacity": { + "description": "Layer opacity as Float [0-1]", + "type": [ + "number" + ] + }, + "layerDefUid": { + "description": "Reference the Layer definition UID", + "type": [ + "integer" + ] + }, + "__pxTotalOffsetX": { + "description": "Total layer X pixel offset, including both instance and definition offsets.", + "type": [ + "integer" + ] + }, + "__cWid": { + "description": "Grid-based width", + "type": [ + "integer" + ] + }, + "pxOffsetY": { + "description": "Y offset in pixels to render this layer, usually 0 (IMPORTANT: this should be added to the `LayerDef` optional offset, so you should probably prefer using `__pxTotalOffsetX` which contains the total offset value)", + "type": [ + "integer" + ] + }, + "__tilesetDefUid": { + "description": "The definition UID of corresponding Tileset, if any.", + "type": [ + "integer", + "null" + ] + }, + "gridTiles": { + "description": "", + "items": { + "$ref": "#/otherTypes/Tile" + }, + "type": [ + "array" + ] + } + }, + "type": [ + "object" + ] + }, + "World": { + "description": "**IMPORTANT**: this type is available as a preview. You can rely on it to update your importers, for when it will be officially available. A World contains multiple levels, and it has its own layout settings.", + "title": "World", + "required": [ + "identifier", + "iid", + "levels", + "worldGridHeight", + "worldGridWidth", + "worldLayout" + ], + "additionalProperties": false, + "properties": { + "worldGridWidth": { + "description": "Width of the world grid in pixels.", + "type": [ + "integer" + ] + }, + "iid": { + "description": "Unique instance identifer", + "type": [ + "string" + ] + }, + "worldGridHeight": { + "description": "Height of the world grid in pixels.", + "type": [ + "integer" + ] + }, + "worldLayout": { + "description": "An enum that describes how levels are organized in this project (ie. linearly or in a 2D space). Possible values: `Free`, `GridVania`, `LinearHorizontal`, `LinearVertical`, `null`, `null`", + "enum": [ + "Free", + "GridVania", + "LinearHorizontal", + "LinearVertical", + null, + null + ] + }, + "levels": { + "description": "All levels from this world. The order of this array is only relevant in `LinearHorizontal` and `linearVertical` world layouts (see `worldLayout` value). Otherwise, you should refer to the `worldX`,`worldY` coordinates of each Level.", + "items": { + "$ref": "#/otherTypes/Level" + }, + "type": [ + "array" + ] + }, + "identifier": { + "description": "User defined unique identifier", + "type": [ + "string" + ] + } + }, + "type": [ + "object" + ] + }, + "EntityReferenceInfos": { + "description": "This object describes the \"location\" of an Entity instance in the project worlds.", + "title": "Reference to an Entity instance", + "required": [ + "entityIid", + "layerIid", + "levelIid", + "worldIid" + ], + "additionalProperties": false, + "properties": { + "worldIid": { + "description": "IID of the World containing the refered EntityInstance", + "type": [ + "string" + ] + }, + "entityIid": { + "description": "IID of the refered EntityInstance", + "type": [ + "string" + ] + }, + "layerIid": { + "description": "IID of the LayerInstance containing the refered EntityInstance", + "type": [ + "string" + ] + }, + "levelIid": { + "description": "IID of the Level containing the refered EntityInstance", + "type": [ + "string" + ] + } + }, + "type": [ + "object" + ] + }, + "TileCustomMetadata": { + "description": "In a tileset definition, user defined meta-data of a tile.", + "title": "Tile custom metadata", + "required": [ + "data", + "tileId" + ], + "additionalProperties": false, + "properties": { + "tileId": { + "description": "", + "type": [ + "integer" + ] + }, + "data": { + "description": "", + "type": [ + "string" + ] + } + }, + "type": [ + "object" + ] + }, + "TilesetDef": { + "description": "The `Tileset` definition is the most important part among project definitions. It contains some extra informations about each integrated tileset. If you only had to parse one definition section, that would be the one.", + "title": "Tileset definition", + "required": [ + "__cHei", + "__cWid", + "customData", + "enumTags", + "identifier", + "padding", + "pxHei", + "pxWid", + "spacing", + "tags", + "tileGridSize", + "uid" + ], + "additionalProperties": false, + "properties": { + "__cHei": { + "description": "Grid-based height", + "type": [ + "integer" + ] + }, + "pxHei": { + "description": "Image height in pixels", + "type": [ + "integer" + ] + }, + "customData": { + "description": "An array of custom tile metadata", + "items": { + "$ref": "#/otherTypes/TileCustomMetadata" + }, + "type": [ + "array" + ] + }, + "tagsSourceEnumUid": { + "description": "Optional Enum definition UID used for this tileset meta-data", + "type": [ + "integer", + "null" + ] + }, + "uid": { + "description": "Unique Intidentifier", + "type": [ + "integer" + ] + }, + "padding": { + "description": "Distance in pixels from image borders", + "type": [ + "integer" + ] + }, + "enumTags": { + "description": "Tileset tags using Enum values specified by `tagsSourceEnumId`. This array contains 1 element per Enum value, which contains an array of all Tile IDs that are tagged with it.", + "items": { + "$ref": "#/otherTypes/EnumTagValue" + }, + "type": [ + "array" + ] + }, + "pxWid": { + "description": "Image width in pixels", + "type": [ + "integer" + ] + }, + "__cWid": { + "description": "Grid-based width", + "type": [ + "integer" + ] + }, + "spacing": { + "description": "Space in pixels between all tiles", + "type": [ + "integer" + ] + }, + "identifier": { + "description": "User defined unique identifier", + "type": [ + "string" + ] + }, + "tags": { + "description": "An array of user-defined tags to organize the Tilesets", + "items": { + "type": [ + "string" + ] + }, + "type": [ + "array" + ] + }, + "embedAtlas": { + "description": "If this value is set, then it means that this atlas uses an internal LDtk atlas image instead of a loaded one. Possible values: <`null`>, `LdtkIcons`, `null`", + "enum": [ + "LdtkIcons", + null, + null + ] + }, + "relPath": { + "description": "Path to the source file, relative to the current project JSON file
It can be null if no image was provided, or when using an embed atlas.", + "type": [ + "string", + "null" + ] + }, + "tileGridSize": { + "description": "", + "type": [ + "integer" + ] + } + }, + "type": [ + "object" + ] + }, + "EnumDefValues": { + "title": "Enum value definition", + "required": [ + "color", + "id" + ], + "additionalProperties": false, + "properties": { + "color": { + "description": "Optional color", + "type": [ + "integer" + ] + }, + "tileRect": { + "description": "Optional tileset rectangle to represents this value", + "oneOf": [ + { + "type": [ + "null" + ] + }, + { + "$ref": "#/otherTypes/TilesetRect" + } + ] + }, + "id": { + "description": "Enum value", + "type": [ + "string" + ] + } + }, + "type": [ + "object" + ] + }, + "Tile": { + "description": "This structure represents a single tile from a given Tileset.", + "title": "Tile instance", + "required": [ + "a", + "f", + "px", + "src", + "t" + ], + "additionalProperties": false, + "properties": { + "t": { + "description": "The *Tile ID* in the corresponding tileset.", + "type": [ + "integer" + ] + }, + "px": { + "description": "Pixel coordinates of the tile in the **layer** (`[x,y]` format). Don't forget optional layer offsets, if they exist!", + "items": { + "type": [ + "integer" + ] + }, + "type": [ + "array" + ] + }, + "a": { + "description": "Alpha/opacity of the tile (0-1, defaults to 1)", + "type": [ + "number" + ] + }, + "f": { + "description": "\"Flip bits\", a 2-bits integer to represent the mirror transformations of the tile.
- Bit 0 = X flip
- Bit 1 = Y flip
Examples: f=0 (no flip), f=1 (X flip only), f=2 (Y flip only), f=3 (both flips)", + "type": [ + "integer" + ] + }, + "src": { + "description": "Pixel coordinates of the tile in the **tileset** (`[x,y]` format)", + "items": { + "type": [ + "integer" + ] + }, + "type": [ + "array" + ] + } + }, + "type": [ + "object" + ] + }, + "LayerDef": { + "title": "Layer definition", + "required": [ + "__type", + "displayOpacity", + "gridSize", + "identifier", + "intGridValues", + "parallaxFactorX", + "parallaxFactorY", + "parallaxScaling", + "pxOffsetX", + "pxOffsetY", + "uid" + ], + "additionalProperties": false, + "properties": { + "pxOffsetX": { + "description": "X offset of the layer, in pixels (IMPORTANT: this should be added to the `LayerInstance` optional offset)", + "type": [ + "integer" + ] + }, + "displayOpacity": { + "description": "Opacity of the layer (0 to 1.0)", + "type": [ + "number" + ] + }, + "parallaxFactorY": { + "description": "Parallax vertical factor (from -1 to 1, defaults to 0) which affects the scrolling speed of this layer, creating a fake 3D (parallax) effect.", + "type": [ + "number" + ] + }, + "__type": { + "description": "Type of the layer (*IntGrid, Entities, Tiles or AutoLayer*)", + "type": [ + "string" + ] + }, + "tilesetDefUid": { + "description": "Reference to the default Tileset UID being used by this layer definition.
**WARNING**: some layer *instances* might use a different tileset. So most of the time, you should probably use the `__tilesetDefUid` value found in layer instances.
Note: since version 1.0.0, the old `autoTilesetDefUid` was removed and merged into this value.", + "type": [ + "integer", + "null" + ] + }, + "autoSourceLayerDefUid": { + "description": "", + "type": [ + "integer", + "null" + ] + }, + "parallaxScaling": { + "description": "If true (default), a layer with a parallax factor will also be scaled up/down accordingly.", + "type": [ + "boolean" + ] + }, + "uid": { + "description": "Unique Int identifier", + "type": [ + "integer" + ] + }, + "intGridValues": { + "description": "An array that defines extra optional info for each IntGrid value.
WARNING: the array order is not related to actual IntGrid values! As user can re-order IntGrid values freely, you may value \"2\" before value \"1\" in this array.", + "items": { + "$ref": "#/otherTypes/IntGridValueDef" + }, + "type": [ + "array" + ] + }, + "identifier": { + "description": "User defined unique identifier", + "type": [ + "string" + ] + }, + "pxOffsetY": { + "description": "Y offset of the layer, in pixels (IMPORTANT: this should be added to the `LayerInstance` optional offset)", + "type": [ + "integer" + ] + }, + "gridSize": { + "description": "Width and height of the grid in pixels", + "type": [ + "integer" + ] + }, + "parallaxFactorX": { + "description": "Parallax horizontal factor (from -1 to 1, defaults to 0) which affects the scrolling speed of this layer, creating a fake 3D (parallax) effect.", + "type": [ + "number" + ] + } + }, + "type": [ + "object" + ] + }, + "LevelBgPosInfos": { + "description": "Level background image position info", + "title": "Level background position", + "required": [ + "cropRect", + "scale", + "topLeftPx" + ], + "additionalProperties": false, + "properties": { + "cropRect": { + "description": "An array of 4 float values describing the cropped sub-rectangle of the displayed background image. This cropping happens when original is larger than the level bounds. Array format: `[ cropX, cropY, cropWidth, cropHeight ]`", + "items": { + "type": [ + "number" + ] + }, + "type": [ + "array" + ] + }, + "scale": { + "description": "An array containing the `[scaleX,scaleY]` values of the **cropped** background image, depending on `bgPos` option.", + "items": { + "type": [ + "number" + ] + }, + "type": [ + "array" + ] + }, + "topLeftPx": { + "description": "An array containing the `[x,y]` pixel coordinates of the top-left corner of the **cropped** background image, depending on `bgPos` option.", + "items": { + "type": [ + "integer" + ] + }, + "type": [ + "array" + ] + } + }, + "type": [ + "object" + ] + }, + "Level": { + "description": "This section contains all the level data. It can be found in 2 distinct forms, depending on Project current settings: - If \"*Separate level files*\" is **disabled** (default): full level data is *embedded* inside the main Project JSON file, - If \"*Separate level files*\" is **enabled**: level data is stored in *separate* standalone `.ldtkl` files (one per level). In this case, the main Project JSON file will still contain most level data, except heavy sections, like the `layerInstances` array (which will be null). The `externalRelPath` string points to the `ldtkl` file. A `ldtkl` file is just a JSON file containing exactly what is described below.", + "title": "Level", + "required": [ + "__bgColor", + "__neighbours", + "fieldInstances", + "identifier", + "iid", + "pxHei", + "pxWid", + "uid", + "worldDepth", + "worldX", + "worldY" + ], + "additionalProperties": false, + "properties": { + "__neighbours": { + "description": "An array listing all other levels touching this one on the world map.
Only relevant for world layouts where level spatial positioning is manual (ie. GridVania, Free). For Horizontal and Vertical layouts, this array is always empty.", + "items": { + "$ref": "#/otherTypes/NeighbourLevel" + }, + "type": [ + "array" + ] + }, + "__bgColor": { + "description": "Background color of the level (same as `bgColor`, except the default value is automatically used here if its value is `null`)", + "type": [ + "string" + ] + }, + "worldX": { + "description": "World X coordinate in pixels.
Only relevant for world layouts where level spatial positioning is manual (ie. GridVania, Free). For Horizontal and Vertical layouts, the value is always -1 here.", + "type": [ + "integer" + ] + }, + "externalRelPath": { + "description": "This value is not null if the project option \"*Save levels separately*\" is enabled. In this case, this **relative** path points to the level Json file.", + "type": [ + "string", + "null" + ] + }, + "iid": { + "description": "Unique instance identifier", + "type": [ + "string" + ] + }, + "pxHei": { + "description": "Height of the level in pixels", + "type": [ + "integer" + ] + }, + "worldY": { + "description": "World Y coordinate in pixels.
Only relevant for world layouts where level spatial positioning is manual (ie. GridVania, Free). For Horizontal and Vertical layouts, the value is always -1 here.", + "type": [ + "integer" + ] + }, + "__bgPos": { + "description": "Position informations of the background image, if there is one.", + "oneOf": [ + { + "type": [ + "null" + ] + }, + { + "$ref": "#/otherTypes/LevelBgPosInfos" + } + ] + }, + "uid": { + "description": "Unique Int identifier", + "type": [ + "integer" + ] + }, + "fieldInstances": { + "description": "An array containing this level custom field values.", + "items": { + "$ref": "#/otherTypes/FieldInstance" + }, + "type": [ + "array" + ] + }, + "pxWid": { + "description": "Width of the level in pixels", + "type": [ + "integer" + ] + }, + "identifier": { + "description": "User defined unique identifier", + "type": [ + "string" + ] + }, + "layerInstances": { + "description": "An array containing all Layer instances. **IMPORTANT**: if the project option \"*Save levels separately*\" is enabled, this field will be `null`.
This array is **sorted in display order**: the 1st layer is the top-most and the last is behind.", + "items": { + "$ref": "#/otherTypes/LayerInstance" + }, + "type": [ + "array", + "null" + ] + }, + "bgRelPath": { + "description": "The *optional* relative path to the level background image.", + "type": [ + "string", + "null" + ] + }, + "worldDepth": { + "description": "Index that represents the \"depth\" of the level in the world. Default is 0, greater means \"above\", lower means \"below\".
This value is mostly used for display only and is intended to make stacking of levels easier to manage.", + "type": [ + "integer" + ] + } + }, + "type": [ + "object" + ] + }, + "TableOfContentEntry": { + "title": "ldtk.TableOfContentEntry", + "required": [ + "identifier", + "instances" + ], + "additionalProperties": false, + "properties": { + "identifier": { + "description": "", + "type": [ + "string" + ] + }, + "instances": { + "description": "", + "items": { + "$ref": "#/otherTypes/EntityReferenceInfos" + }, + "type": [ + "array" + ] + } + }, + "type": [ + "object" + ] + }, + "EnumDef": { + "title": "Enum definition", + "required": [ + "identifier", + "tags", + "uid", + "values" + ], + "additionalProperties": false, + "properties": { + "externalRelPath": { + "description": "Relative path to the external file providing this Enum", + "type": [ + "string", + "null" + ] + }, + "uid": { + "description": "Unique Int identifier", + "type": [ + "integer" + ] + }, + "values": { + "description": "All possible enum values, with their optional Tile infos.", + "items": { + "$ref": "#/otherTypes/EnumDefValues" + }, + "type": [ + "array" + ] + }, + "iconTilesetUid": { + "description": "Tileset UID if provided", + "type": [ + "integer", + "null" + ] + }, + "identifier": { + "description": "User defined unique identifier", + "type": [ + "string" + ] + }, + "tags": { + "description": "An array of user-defined tags to organize the Enums", + "items": { + "type": [ + "string" + ] + }, + "type": [ + "array" + ] + } + }, + "type": [ + "object" + ] + }, + "GridPoint": { + "description": "This object is just a grid-based coordinate used in Field values.", + "title": "Grid point", + "required": [ + "cx", + "cy" + ], + "additionalProperties": false, + "properties": { + "cy": { + "description": "Y grid-based coordinate", + "type": [ + "integer" + ] + }, + "cx": { + "description": "X grid-based coordinate", + "type": [ + "integer" + ] + } + }, + "type": [ + "object" + ] + }, + "IntGridValueDef": { + "description": "IntGrid value definition", + "title": "IntGrid value definition", + "required": [ + "color", + "value" + ], + "additionalProperties": false, + "properties": { + "tile": { + "description": "", + "oneOf": [ + { + "type": [ + "null" + ] + }, + { + "$ref": "#/otherTypes/TilesetRect" + } + ] + }, + "color": { + "description": "", + "type": [ + "string" + ] + }, + "identifier": { + "description": "User defined unique identifier", + "type": [ + "string", + "null" + ] + }, + "value": { + "description": "The IntGrid value itself", + "type": [ + "integer" + ] + } + }, + "type": [ + "object" + ] + } + } +} \ No newline at end of file diff --git a/docs/archives/1.3.4/quicktype/.htaccess b/docs/archives/1.3.4/quicktype/.htaccess new file mode 100644 index 000000000..2f134288f --- /dev/null +++ b/docs/archives/1.3.4/quicktype/.htaccess @@ -0,0 +1 @@ +Options +Indexes \ No newline at end of file diff --git a/docs/archives/1.3.4/quicktype/LdtkJson.cpp b/docs/archives/1.3.4/quicktype/LdtkJson.cpp new file mode 100644 index 000000000..3c198a502 --- /dev/null +++ b/docs/archives/1.3.4/quicktype/LdtkJson.cpp @@ -0,0 +1,4466 @@ +// To parse this JSON data, first install +// +// Boost http://www.boost.org +// json.hpp https://github.com/nlohmann/json +// +// Then include this file, and then do +// +// LdtkJson data = nlohmann::json::parse(jsonString); + +#pragma once + +#include +#include "json.hpp" + +#include +#include +#include + +#ifndef NLOHMANN_OPT_HELPER +#define NLOHMANN_OPT_HELPER +namespace nlohmann { + template + struct adl_serializer> { + static void to_json(json & j, const std::shared_ptr & opt) { + if (!opt) j = nullptr; else j = *opt; + } + + static std::shared_ptr from_json(const json & j) { + if (j.is_null()) return std::make_shared(); else return std::make_shared(j.get()); + } + }; + template + struct adl_serializer> { + static void to_json(json & j, const boost::optional & opt) { + if (!opt) j = nullptr; else j = *opt; + } + + static boost::optional from_json(const json & j) { + if (j.is_null()) return boost::optional(); else return boost::optional(j.get()); + } + }; +} +#endif + +namespace quicktype { + using nlohmann::json; + + #ifndef NLOHMANN_UNTYPED_quicktype_HELPER + #define NLOHMANN_UNTYPED_quicktype_HELPER + inline json get_untyped(const json & j, const char * property) { + if (j.find(property) != j.end()) { + return j.at(property).get(); + } + return json(); + } + + inline json get_untyped(const json & j, std::string property) { + return get_untyped(j, property.data()); + } + #endif + + #ifndef NLOHMANN_OPTIONAL_quicktype_HELPER + #define NLOHMANN_OPTIONAL_quicktype_HELPER + template + inline std::shared_ptr get_heap_optional(const json & j, const char * property) { + auto it = j.find(property); + if (it != j.end() && !it->is_null()) { + return j.at(property).get>(); + } + return std::shared_ptr(); + } + + template + inline std::shared_ptr get_heap_optional(const json & j, std::string property) { + return get_heap_optional(j, property.data()); + } + template + inline boost::optional get_stack_optional(const json & j, const char * property) { + auto it = j.find(property); + if (it != j.end() && !it->is_null()) { + return j.at(property).get>(); + } + return boost::optional(); + } + + template + inline boost::optional get_stack_optional(const json & j, std::string property) { + return get_stack_optional(j, property.data()); + } + #endif + + /** + * Possible values: `Manual`, `AfterLoad`, `BeforeSave`, `AfterSave` + */ + enum class When : int { AFTER_LOAD, AFTER_SAVE, BEFORE_SAVE, MANUAL }; + + class LdtkCustomCommand { + public: + LdtkCustomCommand() = default; + virtual ~LdtkCustomCommand() = default; + + private: + std::string command; + When when; + + public: + const std::string & get_command() const { return command; } + std::string & get_mutable_command() { return command; } + void set_command(const std::string & value) { this->command = value; } + + /** + * Possible values: `Manual`, `AfterLoad`, `BeforeSave`, `AfterSave` + */ + const When & get_when() const { return when; } + When & get_mutable_when() { return when; } + void set_when(const When & value) { this->when = value; } + }; + + /** + * Possible values: `Any`, `OnlySame`, `OnlyTags`, `OnlySpecificEntity` + */ + enum class AllowedRefs : int { ANY, ONLY_SAME, ONLY_SPECIFIC_ENTITY, ONLY_TAGS }; + + /** + * Possible values: `Hidden`, `ValueOnly`, `NameAndValue`, `EntityTile`, `LevelTile`, + * `Points`, `PointStar`, `PointPath`, `PointPathLoop`, `RadiusPx`, `RadiusGrid`, + * `ArrayCountWithLabel`, `ArrayCountNoLabel`, `RefLinkBetweenPivots`, + * `RefLinkBetweenCenters` + */ + enum class EditorDisplayMode : int { ARRAY_COUNT_NO_LABEL, ARRAY_COUNT_WITH_LABEL, ENTITY_TILE, HIDDEN, LEVEL_TILE, NAME_AND_VALUE, POINTS, POINT_PATH, POINT_PATH_LOOP, POINT_STAR, RADIUS_GRID, RADIUS_PX, REF_LINK_BETWEEN_CENTERS, REF_LINK_BETWEEN_PIVOTS, VALUE_ONLY }; + + /** + * Possible values: `Above`, `Center`, `Beneath` + */ + enum class EditorDisplayPos : int { ABOVE, BENEATH, CENTER }; + + /** + * Possible values: `ZigZag`, `StraightArrow`, `CurvedArrow`, `ArrowsLine`, `DashedLine` + */ + enum class EditorLinkStyle : int { ARROWS_LINE, CURVED_ARROW, DASHED_LINE, STRAIGHT_ARROW, ZIG_ZAG }; + + enum class TextLanguageMode : int { LANG_C, LANG_HAXE, LANG_JS, LANG_JSON, LANG_LOG, LANG_LUA, LANG_MARKDOWN, LANG_PYTHON, LANG_RUBY, LANG_XML }; + + /** + * This section is mostly only intended for the LDtk editor app itself. You can safely + * ignore it. + */ + class FieldDefinition { + public: + FieldDefinition() = default; + virtual ~FieldDefinition() = default; + + private: + std::string type; + boost::optional> accept_file_types; + AllowedRefs allowed_refs; + boost::optional allowed_refs_entity_uid; + std::vector allowed_ref_tags; + bool allow_out_of_level_ref; + boost::optional array_max_length; + boost::optional array_min_length; + bool auto_chain_ref; + bool can_be_null; + nlohmann::json default_override; + boost::optional doc; + bool editor_always_show; + bool editor_cut_long_values; + boost::optional editor_display_color; + EditorDisplayMode editor_display_mode; + EditorDisplayPos editor_display_pos; + double editor_display_scale; + EditorLinkStyle editor_link_style; + bool editor_show_in_world; + boost::optional editor_text_prefix; + boost::optional editor_text_suffix; + std::string identifier; + bool is_array; + boost::optional max; + boost::optional min; + boost::optional regex; + bool symmetrical_ref; + boost::optional text_language_mode; + boost::optional tileset_uid; + std::string field_definition_type; + int64_t uid; + bool use_for_smart_color; + + public: + /** + * Human readable value type. Possible values: `Int, Float, String, Bool, Color, + * ExternEnum.XXX, LocalEnum.XXX, Point, FilePath`.
If the field is an array, this + * field will look like `Array<...>` (eg. `Array`, `Array` etc.)
NOTE: if + * you enable the advanced option **Use Multilines type**, you will have "*Multilines*" + * instead of "*String*" when relevant. + */ + const std::string & get_type() const { return type; } + std::string & get_mutable_type() { return type; } + void set_type(const std::string & value) { this->type = value; } + + /** + * Optional list of accepted file extensions for FilePath value type. Includes the dot: + * `.ext` + */ + boost::optional> get_accept_file_types() const { return accept_file_types; } + void set_accept_file_types(boost::optional> value) { this->accept_file_types = value; } + + /** + * Possible values: `Any`, `OnlySame`, `OnlyTags`, `OnlySpecificEntity` + */ + const AllowedRefs & get_allowed_refs() const { return allowed_refs; } + AllowedRefs & get_mutable_allowed_refs() { return allowed_refs; } + void set_allowed_refs(const AllowedRefs & value) { this->allowed_refs = value; } + + boost::optional get_allowed_refs_entity_uid() const { return allowed_refs_entity_uid; } + void set_allowed_refs_entity_uid(boost::optional value) { this->allowed_refs_entity_uid = value; } + + const std::vector & get_allowed_ref_tags() const { return allowed_ref_tags; } + std::vector & get_mutable_allowed_ref_tags() { return allowed_ref_tags; } + void set_allowed_ref_tags(const std::vector & value) { this->allowed_ref_tags = value; } + + const bool & get_allow_out_of_level_ref() const { return allow_out_of_level_ref; } + bool & get_mutable_allow_out_of_level_ref() { return allow_out_of_level_ref; } + void set_allow_out_of_level_ref(const bool & value) { this->allow_out_of_level_ref = value; } + + /** + * Array max length + */ + boost::optional get_array_max_length() const { return array_max_length; } + void set_array_max_length(boost::optional value) { this->array_max_length = value; } + + /** + * Array min length + */ + boost::optional get_array_min_length() const { return array_min_length; } + void set_array_min_length(boost::optional value) { this->array_min_length = value; } + + const bool & get_auto_chain_ref() const { return auto_chain_ref; } + bool & get_mutable_auto_chain_ref() { return auto_chain_ref; } + void set_auto_chain_ref(const bool & value) { this->auto_chain_ref = value; } + + /** + * TRUE if the value can be null. For arrays, TRUE means it can contain null values + * (exception: array of Points can't have null values). + */ + const bool & get_can_be_null() const { return can_be_null; } + bool & get_mutable_can_be_null() { return can_be_null; } + void set_can_be_null(const bool & value) { this->can_be_null = value; } + + /** + * Default value if selected value is null or invalid. + */ + const nlohmann::json & get_default_override() const { return default_override; } + nlohmann::json & get_mutable_default_override() { return default_override; } + void set_default_override(const nlohmann::json & value) { this->default_override = value; } + + /** + * User defined documentation for this field to provide help/tips to level designers about + * accepted values. + */ + boost::optional get_doc() const { return doc; } + void set_doc(boost::optional value) { this->doc = value; } + + const bool & get_editor_always_show() const { return editor_always_show; } + bool & get_mutable_editor_always_show() { return editor_always_show; } + void set_editor_always_show(const bool & value) { this->editor_always_show = value; } + + const bool & get_editor_cut_long_values() const { return editor_cut_long_values; } + bool & get_mutable_editor_cut_long_values() { return editor_cut_long_values; } + void set_editor_cut_long_values(const bool & value) { this->editor_cut_long_values = value; } + + boost::optional get_editor_display_color() const { return editor_display_color; } + void set_editor_display_color(boost::optional value) { this->editor_display_color = value; } + + /** + * Possible values: `Hidden`, `ValueOnly`, `NameAndValue`, `EntityTile`, `LevelTile`, + * `Points`, `PointStar`, `PointPath`, `PointPathLoop`, `RadiusPx`, `RadiusGrid`, + * `ArrayCountWithLabel`, `ArrayCountNoLabel`, `RefLinkBetweenPivots`, + * `RefLinkBetweenCenters` + */ + const EditorDisplayMode & get_editor_display_mode() const { return editor_display_mode; } + EditorDisplayMode & get_mutable_editor_display_mode() { return editor_display_mode; } + void set_editor_display_mode(const EditorDisplayMode & value) { this->editor_display_mode = value; } + + /** + * Possible values: `Above`, `Center`, `Beneath` + */ + const EditorDisplayPos & get_editor_display_pos() const { return editor_display_pos; } + EditorDisplayPos & get_mutable_editor_display_pos() { return editor_display_pos; } + void set_editor_display_pos(const EditorDisplayPos & value) { this->editor_display_pos = value; } + + const double & get_editor_display_scale() const { return editor_display_scale; } + double & get_mutable_editor_display_scale() { return editor_display_scale; } + void set_editor_display_scale(const double & value) { this->editor_display_scale = value; } + + /** + * Possible values: `ZigZag`, `StraightArrow`, `CurvedArrow`, `ArrowsLine`, `DashedLine` + */ + const EditorLinkStyle & get_editor_link_style() const { return editor_link_style; } + EditorLinkStyle & get_mutable_editor_link_style() { return editor_link_style; } + void set_editor_link_style(const EditorLinkStyle & value) { this->editor_link_style = value; } + + const bool & get_editor_show_in_world() const { return editor_show_in_world; } + bool & get_mutable_editor_show_in_world() { return editor_show_in_world; } + void set_editor_show_in_world(const bool & value) { this->editor_show_in_world = value; } + + boost::optional get_editor_text_prefix() const { return editor_text_prefix; } + void set_editor_text_prefix(boost::optional value) { this->editor_text_prefix = value; } + + boost::optional get_editor_text_suffix() const { return editor_text_suffix; } + void set_editor_text_suffix(boost::optional value) { this->editor_text_suffix = value; } + + /** + * User defined unique identifier + */ + const std::string & get_identifier() const { return identifier; } + std::string & get_mutable_identifier() { return identifier; } + void set_identifier(const std::string & value) { this->identifier = value; } + + /** + * TRUE if the value is an array of multiple values + */ + const bool & get_is_array() const { return is_array; } + bool & get_mutable_is_array() { return is_array; } + void set_is_array(const bool & value) { this->is_array = value; } + + /** + * Max limit for value, if applicable + */ + boost::optional get_max() const { return max; } + void set_max(boost::optional value) { this->max = value; } + + /** + * Min limit for value, if applicable + */ + boost::optional get_min() const { return min; } + void set_min(boost::optional value) { this->min = value; } + + /** + * Optional regular expression that needs to be matched to accept values. Expected format: + * `/some_reg_ex/g`, with optional "i" flag. + */ + boost::optional get_regex() const { return regex; } + void set_regex(boost::optional value) { this->regex = value; } + + const bool & get_symmetrical_ref() const { return symmetrical_ref; } + bool & get_mutable_symmetrical_ref() { return symmetrical_ref; } + void set_symmetrical_ref(const bool & value) { this->symmetrical_ref = value; } + + /** + * Possible values: <`null`>, `LangPython`, `LangRuby`, `LangJS`, `LangLua`, `LangC`, + * `LangHaxe`, `LangMarkdown`, `LangJson`, `LangXml`, `LangLog` + */ + boost::optional get_text_language_mode() const { return text_language_mode; } + void set_text_language_mode(boost::optional value) { this->text_language_mode = value; } + + /** + * UID of the tileset used for a Tile + */ + boost::optional get_tileset_uid() const { return tileset_uid; } + void set_tileset_uid(boost::optional value) { this->tileset_uid = value; } + + /** + * Internal enum representing the possible field types. Possible values: F_Int, F_Float, + * F_String, F_Text, F_Bool, F_Color, F_Enum(...), F_Point, F_Path, F_EntityRef, F_Tile + */ + const std::string & get_field_definition_type() const { return field_definition_type; } + std::string & get_mutable_field_definition_type() { return field_definition_type; } + void set_field_definition_type(const std::string & value) { this->field_definition_type = value; } + + /** + * Unique Int identifier + */ + const int64_t & get_uid() const { return uid; } + int64_t & get_mutable_uid() { return uid; } + void set_uid(const int64_t & value) { this->uid = value; } + + /** + * If TRUE, the color associated with this field will override the Entity or Level default + * color in the editor UI. For Enum fields, this would be the color associated to their + * values. + */ + const bool & get_use_for_smart_color() const { return use_for_smart_color; } + bool & get_mutable_use_for_smart_color() { return use_for_smart_color; } + void set_use_for_smart_color(const bool & value) { this->use_for_smart_color = value; } + }; + + /** + * Possible values: `DiscardOldOnes`, `PreventAdding`, `MoveLastOne` + */ + enum class LimitBehavior : int { DISCARD_OLD_ONES, MOVE_LAST_ONE, PREVENT_ADDING }; + + /** + * If TRUE, the maxCount is a "per world" limit, if FALSE, it's a "per level". Possible + * values: `PerLayer`, `PerLevel`, `PerWorld` + */ + enum class LimitScope : int { PER_LAYER, PER_LEVEL, PER_WORLD }; + + /** + * Possible values: `Rectangle`, `Ellipse`, `Tile`, `Cross` + */ + enum class RenderMode : int { CROSS, ELLIPSE, RECTANGLE, TILE }; + + /** + * This object represents a custom sub rectangle in a Tileset image. + */ + class TilesetRectangle { + public: + TilesetRectangle() = default; + virtual ~TilesetRectangle() = default; + + private: + int64_t h; + int64_t tileset_uid; + int64_t w; + int64_t x; + int64_t y; + + public: + /** + * Height in pixels + */ + const int64_t & get_h() const { return h; } + int64_t & get_mutable_h() { return h; } + void set_h(const int64_t & value) { this->h = value; } + + /** + * UID of the tileset + */ + const int64_t & get_tileset_uid() const { return tileset_uid; } + int64_t & get_mutable_tileset_uid() { return tileset_uid; } + void set_tileset_uid(const int64_t & value) { this->tileset_uid = value; } + + /** + * Width in pixels + */ + const int64_t & get_w() const { return w; } + int64_t & get_mutable_w() { return w; } + void set_w(const int64_t & value) { this->w = value; } + + /** + * X pixels coordinate of the top-left corner in the Tileset image + */ + const int64_t & get_x() const { return x; } + int64_t & get_mutable_x() { return x; } + void set_x(const int64_t & value) { this->x = value; } + + /** + * Y pixels coordinate of the top-left corner in the Tileset image + */ + const int64_t & get_y() const { return y; } + int64_t & get_mutable_y() { return y; } + void set_y(const int64_t & value) { this->y = value; } + }; + + /** + * An enum describing how the the Entity tile is rendered inside the Entity bounds. Possible + * values: `Cover`, `FitInside`, `Repeat`, `Stretch`, `FullSizeCropped`, + * `FullSizeUncropped`, `NineSlice` + */ + enum class TileRenderMode : int { COVER, FIT_INSIDE, FULL_SIZE_CROPPED, FULL_SIZE_UNCROPPED, NINE_SLICE, REPEAT, STRETCH }; + + class EntityDefinition { + public: + EntityDefinition() = default; + virtual ~EntityDefinition() = default; + + private: + std::string color; + boost::optional doc; + bool export_to_toc; + std::vector field_defs; + double fill_opacity; + int64_t height; + bool hollow; + std::string identifier; + bool keep_aspect_ratio; + LimitBehavior limit_behavior; + LimitScope limit_scope; + double line_opacity; + int64_t max_count; + boost::optional max_height; + boost::optional max_width; + boost::optional min_height; + boost::optional min_width; + std::vector nine_slice_borders; + double pivot_x; + double pivot_y; + RenderMode render_mode; + bool resizable_x; + bool resizable_y; + bool show_name; + std::vector tags; + boost::optional tile_id; + double tile_opacity; + boost::optional tile_rect; + TileRenderMode tile_render_mode; + boost::optional tileset_id; + int64_t uid; + int64_t width; + + public: + /** + * Base entity color + */ + const std::string & get_color() const { return color; } + std::string & get_mutable_color() { return color; } + void set_color(const std::string & value) { this->color = value; } + + /** + * User defined documentation for this element to provide help/tips to level designers. + */ + boost::optional get_doc() const { return doc; } + void set_doc(boost::optional value) { this->doc = value; } + + /** + * If enabled, all instances of this entity will be listed in the project "Table of content" + * object. + */ + const bool & get_export_to_toc() const { return export_to_toc; } + bool & get_mutable_export_to_toc() { return export_to_toc; } + void set_export_to_toc(const bool & value) { this->export_to_toc = value; } + + /** + * Array of field definitions + */ + const std::vector & get_field_defs() const { return field_defs; } + std::vector & get_mutable_field_defs() { return field_defs; } + void set_field_defs(const std::vector & value) { this->field_defs = value; } + + const double & get_fill_opacity() const { return fill_opacity; } + double & get_mutable_fill_opacity() { return fill_opacity; } + void set_fill_opacity(const double & value) { this->fill_opacity = value; } + + /** + * Pixel height + */ + const int64_t & get_height() const { return height; } + int64_t & get_mutable_height() { return height; } + void set_height(const int64_t & value) { this->height = value; } + + const bool & get_hollow() const { return hollow; } + bool & get_mutable_hollow() { return hollow; } + void set_hollow(const bool & value) { this->hollow = value; } + + /** + * User defined unique identifier + */ + const std::string & get_identifier() const { return identifier; } + std::string & get_mutable_identifier() { return identifier; } + void set_identifier(const std::string & value) { this->identifier = value; } + + /** + * Only applies to entities resizable on both X/Y. If TRUE, the entity instance width/height + * will keep the same aspect ratio as the definition. + */ + const bool & get_keep_aspect_ratio() const { return keep_aspect_ratio; } + bool & get_mutable_keep_aspect_ratio() { return keep_aspect_ratio; } + void set_keep_aspect_ratio(const bool & value) { this->keep_aspect_ratio = value; } + + /** + * Possible values: `DiscardOldOnes`, `PreventAdding`, `MoveLastOne` + */ + const LimitBehavior & get_limit_behavior() const { return limit_behavior; } + LimitBehavior & get_mutable_limit_behavior() { return limit_behavior; } + void set_limit_behavior(const LimitBehavior & value) { this->limit_behavior = value; } + + /** + * If TRUE, the maxCount is a "per world" limit, if FALSE, it's a "per level". Possible + * values: `PerLayer`, `PerLevel`, `PerWorld` + */ + const LimitScope & get_limit_scope() const { return limit_scope; } + LimitScope & get_mutable_limit_scope() { return limit_scope; } + void set_limit_scope(const LimitScope & value) { this->limit_scope = value; } + + const double & get_line_opacity() const { return line_opacity; } + double & get_mutable_line_opacity() { return line_opacity; } + void set_line_opacity(const double & value) { this->line_opacity = value; } + + /** + * Max instances count + */ + const int64_t & get_max_count() const { return max_count; } + int64_t & get_mutable_max_count() { return max_count; } + void set_max_count(const int64_t & value) { this->max_count = value; } + + /** + * Max pixel height (only applies if the entity is resizable on Y) + */ + boost::optional get_max_height() const { return max_height; } + void set_max_height(boost::optional value) { this->max_height = value; } + + /** + * Max pixel width (only applies if the entity is resizable on X) + */ + boost::optional get_max_width() const { return max_width; } + void set_max_width(boost::optional value) { this->max_width = value; } + + /** + * Min pixel height (only applies if the entity is resizable on Y) + */ + boost::optional get_min_height() const { return min_height; } + void set_min_height(boost::optional value) { this->min_height = value; } + + /** + * Min pixel width (only applies if the entity is resizable on X) + */ + boost::optional get_min_width() const { return min_width; } + void set_min_width(boost::optional value) { this->min_width = value; } + + /** + * An array of 4 dimensions for the up/right/down/left borders (in this order) when using + * 9-slice mode for `tileRenderMode`.
If the tileRenderMode is not NineSlice, then + * this array is empty.
See: https://en.wikipedia.org/wiki/9-slice_scaling + */ + const std::vector & get_nine_slice_borders() const { return nine_slice_borders; } + std::vector & get_mutable_nine_slice_borders() { return nine_slice_borders; } + void set_nine_slice_borders(const std::vector & value) { this->nine_slice_borders = value; } + + /** + * Pivot X coordinate (from 0 to 1.0) + */ + const double & get_pivot_x() const { return pivot_x; } + double & get_mutable_pivot_x() { return pivot_x; } + void set_pivot_x(const double & value) { this->pivot_x = value; } + + /** + * Pivot Y coordinate (from 0 to 1.0) + */ + const double & get_pivot_y() const { return pivot_y; } + double & get_mutable_pivot_y() { return pivot_y; } + void set_pivot_y(const double & value) { this->pivot_y = value; } + + /** + * Possible values: `Rectangle`, `Ellipse`, `Tile`, `Cross` + */ + const RenderMode & get_render_mode() const { return render_mode; } + RenderMode & get_mutable_render_mode() { return render_mode; } + void set_render_mode(const RenderMode & value) { this->render_mode = value; } + + /** + * If TRUE, the entity instances will be resizable horizontally + */ + const bool & get_resizable_x() const { return resizable_x; } + bool & get_mutable_resizable_x() { return resizable_x; } + void set_resizable_x(const bool & value) { this->resizable_x = value; } + + /** + * If TRUE, the entity instances will be resizable vertically + */ + const bool & get_resizable_y() const { return resizable_y; } + bool & get_mutable_resizable_y() { return resizable_y; } + void set_resizable_y(const bool & value) { this->resizable_y = value; } + + /** + * Display entity name in editor + */ + const bool & get_show_name() const { return show_name; } + bool & get_mutable_show_name() { return show_name; } + void set_show_name(const bool & value) { this->show_name = value; } + + /** + * An array of strings that classifies this entity + */ + const std::vector & get_tags() const { return tags; } + std::vector & get_mutable_tags() { return tags; } + void set_tags(const std::vector & value) { this->tags = value; } + + /** + * **WARNING**: this deprecated value is no longer exported since version 1.2.0 Replaced + * by: `tileRect` + */ + boost::optional get_tile_id() const { return tile_id; } + void set_tile_id(boost::optional value) { this->tile_id = value; } + + const double & get_tile_opacity() const { return tile_opacity; } + double & get_mutable_tile_opacity() { return tile_opacity; } + void set_tile_opacity(const double & value) { this->tile_opacity = value; } + + /** + * An object representing a rectangle from an existing Tileset + */ + boost::optional get_tile_rect() const { return tile_rect; } + void set_tile_rect(boost::optional value) { this->tile_rect = value; } + + /** + * An enum describing how the the Entity tile is rendered inside the Entity bounds. Possible + * values: `Cover`, `FitInside`, `Repeat`, `Stretch`, `FullSizeCropped`, + * `FullSizeUncropped`, `NineSlice` + */ + const TileRenderMode & get_tile_render_mode() const { return tile_render_mode; } + TileRenderMode & get_mutable_tile_render_mode() { return tile_render_mode; } + void set_tile_render_mode(const TileRenderMode & value) { this->tile_render_mode = value; } + + /** + * Tileset ID used for optional tile display + */ + boost::optional get_tileset_id() const { return tileset_id; } + void set_tileset_id(boost::optional value) { this->tileset_id = value; } + + /** + * Unique Int identifier + */ + const int64_t & get_uid() const { return uid; } + int64_t & get_mutable_uid() { return uid; } + void set_uid(const int64_t & value) { this->uid = value; } + + /** + * Pixel width + */ + const int64_t & get_width() const { return width; } + int64_t & get_mutable_width() { return width; } + void set_width(const int64_t & value) { this->width = value; } + }; + + class EnumValueDefinition { + public: + EnumValueDefinition() = default; + virtual ~EnumValueDefinition() = default; + + private: + boost::optional> tile_src_rect; + int64_t color; + std::string id; + boost::optional tile_id; + boost::optional tile_rect; + + public: + /** + * **WARNING**: this deprecated value will be *removed* completely on version 1.4.0+ + * Replaced by: `tileRect` + */ + boost::optional> get_tile_src_rect() const { return tile_src_rect; } + void set_tile_src_rect(boost::optional> value) { this->tile_src_rect = value; } + + /** + * Optional color + */ + const int64_t & get_color() const { return color; } + int64_t & get_mutable_color() { return color; } + void set_color(const int64_t & value) { this->color = value; } + + /** + * Enum value + */ + const std::string & get_id() const { return id; } + std::string & get_mutable_id() { return id; } + void set_id(const std::string & value) { this->id = value; } + + /** + * **WARNING**: this deprecated value will be *removed* completely on version 1.4.0+ + * Replaced by: `tileRect` + */ + boost::optional get_tile_id() const { return tile_id; } + void set_tile_id(boost::optional value) { this->tile_id = value; } + + /** + * Optional tileset rectangle to represents this value + */ + boost::optional get_tile_rect() const { return tile_rect; } + void set_tile_rect(boost::optional value) { this->tile_rect = value; } + }; + + class EnumDefinition { + public: + EnumDefinition() = default; + virtual ~EnumDefinition() = default; + + private: + boost::optional external_file_checksum; + boost::optional external_rel_path; + boost::optional icon_tileset_uid; + std::string identifier; + std::vector tags; + int64_t uid; + std::vector values; + + public: + boost::optional get_external_file_checksum() const { return external_file_checksum; } + void set_external_file_checksum(boost::optional value) { this->external_file_checksum = value; } + + /** + * Relative path to the external file providing this Enum + */ + boost::optional get_external_rel_path() const { return external_rel_path; } + void set_external_rel_path(boost::optional value) { this->external_rel_path = value; } + + /** + * Tileset UID if provided + */ + boost::optional get_icon_tileset_uid() const { return icon_tileset_uid; } + void set_icon_tileset_uid(boost::optional value) { this->icon_tileset_uid = value; } + + /** + * User defined unique identifier + */ + const std::string & get_identifier() const { return identifier; } + std::string & get_mutable_identifier() { return identifier; } + void set_identifier(const std::string & value) { this->identifier = value; } + + /** + * An array of user-defined tags to organize the Enums + */ + const std::vector & get_tags() const { return tags; } + std::vector & get_mutable_tags() { return tags; } + void set_tags(const std::vector & value) { this->tags = value; } + + /** + * Unique Int identifier + */ + const int64_t & get_uid() const { return uid; } + int64_t & get_mutable_uid() { return uid; } + void set_uid(const int64_t & value) { this->uid = value; } + + /** + * All possible enum values, with their optional Tile infos. + */ + const std::vector & get_values() const { return values; } + std::vector & get_mutable_values() { return values; } + void set_values(const std::vector & value) { this->values = value; } + }; + + /** + * Checker mode Possible values: `None`, `Horizontal`, `Vertical` + */ + enum class Checker : int { HORIZONTAL, NONE, VERTICAL }; + + /** + * Defines how tileIds array is used Possible values: `Single`, `Stamp` + */ + enum class TileMode : int { SINGLE, STAMP }; + + /** + * This complex section isn't meant to be used by game devs at all, as these rules are + * completely resolved internally by the editor before any saving. You should just ignore + * this part. + */ + class AutoLayerRuleDefinition { + public: + AutoLayerRuleDefinition() = default; + virtual ~AutoLayerRuleDefinition() = default; + + private: + bool active; + double alpha; + bool break_on_match; + double chance; + Checker checker; + bool flip_x; + bool flip_y; + boost::optional out_of_bounds_value; + std::vector pattern; + bool perlin_active; + double perlin_octaves; + double perlin_scale; + double perlin_seed; + double pivot_x; + double pivot_y; + int64_t size; + std::vector tile_ids; + TileMode tile_mode; + int64_t tile_random_x_max; + int64_t tile_random_x_min; + int64_t tile_random_y_max; + int64_t tile_random_y_min; + int64_t tile_x_offset; + int64_t tile_y_offset; + int64_t uid; + int64_t x_modulo; + int64_t x_offset; + int64_t y_modulo; + int64_t y_offset; + + public: + /** + * If FALSE, the rule effect isn't applied, and no tiles are generated. + */ + const bool & get_active() const { return active; } + bool & get_mutable_active() { return active; } + void set_active(const bool & value) { this->active = value; } + + const double & get_alpha() const { return alpha; } + double & get_mutable_alpha() { return alpha; } + void set_alpha(const double & value) { this->alpha = value; } + + /** + * When TRUE, the rule will prevent other rules to be applied in the same cell if it matches + * (TRUE by default). + */ + const bool & get_break_on_match() const { return break_on_match; } + bool & get_mutable_break_on_match() { return break_on_match; } + void set_break_on_match(const bool & value) { this->break_on_match = value; } + + /** + * Chances for this rule to be applied (0 to 1) + */ + const double & get_chance() const { return chance; } + double & get_mutable_chance() { return chance; } + void set_chance(const double & value) { this->chance = value; } + + /** + * Checker mode Possible values: `None`, `Horizontal`, `Vertical` + */ + const Checker & get_checker() const { return checker; } + Checker & get_mutable_checker() { return checker; } + void set_checker(const Checker & value) { this->checker = value; } + + /** + * If TRUE, allow rule to be matched by flipping its pattern horizontally + */ + const bool & get_flip_x() const { return flip_x; } + bool & get_mutable_flip_x() { return flip_x; } + void set_flip_x(const bool & value) { this->flip_x = value; } + + /** + * If TRUE, allow rule to be matched by flipping its pattern vertically + */ + const bool & get_flip_y() const { return flip_y; } + bool & get_mutable_flip_y() { return flip_y; } + void set_flip_y(const bool & value) { this->flip_y = value; } + + /** + * Default IntGrid value when checking cells outside of level bounds + */ + boost::optional get_out_of_bounds_value() const { return out_of_bounds_value; } + void set_out_of_bounds_value(boost::optional value) { this->out_of_bounds_value = value; } + + /** + * Rule pattern (size x size) + */ + const std::vector & get_pattern() const { return pattern; } + std::vector & get_mutable_pattern() { return pattern; } + void set_pattern(const std::vector & value) { this->pattern = value; } + + /** + * If TRUE, enable Perlin filtering to only apply rule on specific random area + */ + const bool & get_perlin_active() const { return perlin_active; } + bool & get_mutable_perlin_active() { return perlin_active; } + void set_perlin_active(const bool & value) { this->perlin_active = value; } + + const double & get_perlin_octaves() const { return perlin_octaves; } + double & get_mutable_perlin_octaves() { return perlin_octaves; } + void set_perlin_octaves(const double & value) { this->perlin_octaves = value; } + + const double & get_perlin_scale() const { return perlin_scale; } + double & get_mutable_perlin_scale() { return perlin_scale; } + void set_perlin_scale(const double & value) { this->perlin_scale = value; } + + const double & get_perlin_seed() const { return perlin_seed; } + double & get_mutable_perlin_seed() { return perlin_seed; } + void set_perlin_seed(const double & value) { this->perlin_seed = value; } + + /** + * X pivot of a tile stamp (0-1) + */ + const double & get_pivot_x() const { return pivot_x; } + double & get_mutable_pivot_x() { return pivot_x; } + void set_pivot_x(const double & value) { this->pivot_x = value; } + + /** + * Y pivot of a tile stamp (0-1) + */ + const double & get_pivot_y() const { return pivot_y; } + double & get_mutable_pivot_y() { return pivot_y; } + void set_pivot_y(const double & value) { this->pivot_y = value; } + + /** + * Pattern width & height. Should only be 1,3,5 or 7. + */ + const int64_t & get_size() const { return size; } + int64_t & get_mutable_size() { return size; } + void set_size(const int64_t & value) { this->size = value; } + + /** + * Array of all the tile IDs. They are used randomly or as stamps, based on `tileMode` value. + */ + const std::vector & get_tile_ids() const { return tile_ids; } + std::vector & get_mutable_tile_ids() { return tile_ids; } + void set_tile_ids(const std::vector & value) { this->tile_ids = value; } + + /** + * Defines how tileIds array is used Possible values: `Single`, `Stamp` + */ + const TileMode & get_tile_mode() const { return tile_mode; } + TileMode & get_mutable_tile_mode() { return tile_mode; } + void set_tile_mode(const TileMode & value) { this->tile_mode = value; } + + /** + * Max random offset for X tile pos + */ + const int64_t & get_tile_random_x_max() const { return tile_random_x_max; } + int64_t & get_mutable_tile_random_x_max() { return tile_random_x_max; } + void set_tile_random_x_max(const int64_t & value) { this->tile_random_x_max = value; } + + /** + * Min random offset for X tile pos + */ + const int64_t & get_tile_random_x_min() const { return tile_random_x_min; } + int64_t & get_mutable_tile_random_x_min() { return tile_random_x_min; } + void set_tile_random_x_min(const int64_t & value) { this->tile_random_x_min = value; } + + /** + * Max random offset for Y tile pos + */ + const int64_t & get_tile_random_y_max() const { return tile_random_y_max; } + int64_t & get_mutable_tile_random_y_max() { return tile_random_y_max; } + void set_tile_random_y_max(const int64_t & value) { this->tile_random_y_max = value; } + + /** + * Min random offset for Y tile pos + */ + const int64_t & get_tile_random_y_min() const { return tile_random_y_min; } + int64_t & get_mutable_tile_random_y_min() { return tile_random_y_min; } + void set_tile_random_y_min(const int64_t & value) { this->tile_random_y_min = value; } + + /** + * Tile X offset + */ + const int64_t & get_tile_x_offset() const { return tile_x_offset; } + int64_t & get_mutable_tile_x_offset() { return tile_x_offset; } + void set_tile_x_offset(const int64_t & value) { this->tile_x_offset = value; } + + /** + * Tile Y offset + */ + const int64_t & get_tile_y_offset() const { return tile_y_offset; } + int64_t & get_mutable_tile_y_offset() { return tile_y_offset; } + void set_tile_y_offset(const int64_t & value) { this->tile_y_offset = value; } + + /** + * Unique Int identifier + */ + const int64_t & get_uid() const { return uid; } + int64_t & get_mutable_uid() { return uid; } + void set_uid(const int64_t & value) { this->uid = value; } + + /** + * X cell coord modulo + */ + const int64_t & get_x_modulo() const { return x_modulo; } + int64_t & get_mutable_x_modulo() { return x_modulo; } + void set_x_modulo(const int64_t & value) { this->x_modulo = value; } + + /** + * X cell start offset + */ + const int64_t & get_x_offset() const { return x_offset; } + int64_t & get_mutable_x_offset() { return x_offset; } + void set_x_offset(const int64_t & value) { this->x_offset = value; } + + /** + * Y cell coord modulo + */ + const int64_t & get_y_modulo() const { return y_modulo; } + int64_t & get_mutable_y_modulo() { return y_modulo; } + void set_y_modulo(const int64_t & value) { this->y_modulo = value; } + + /** + * Y cell start offset + */ + const int64_t & get_y_offset() const { return y_offset; } + int64_t & get_mutable_y_offset() { return y_offset; } + void set_y_offset(const int64_t & value) { this->y_offset = value; } + }; + + class AutoLayerRuleGroup { + public: + AutoLayerRuleGroup() = default; + virtual ~AutoLayerRuleGroup() = default; + + private: + bool active; + boost::optional collapsed; + bool is_optional; + std::string name; + std::vector rules; + int64_t uid; + bool uses_wizard; + + public: + const bool & get_active() const { return active; } + bool & get_mutable_active() { return active; } + void set_active(const bool & value) { this->active = value; } + + /** + * *This field was removed in 1.0.0 and should no longer be used.* + */ + boost::optional get_collapsed() const { return collapsed; } + void set_collapsed(boost::optional value) { this->collapsed = value; } + + const bool & get_is_optional() const { return is_optional; } + bool & get_mutable_is_optional() { return is_optional; } + void set_is_optional(const bool & value) { this->is_optional = value; } + + const std::string & get_name() const { return name; } + std::string & get_mutable_name() { return name; } + void set_name(const std::string & value) { this->name = value; } + + const std::vector & get_rules() const { return rules; } + std::vector & get_mutable_rules() { return rules; } + void set_rules(const std::vector & value) { this->rules = value; } + + const int64_t & get_uid() const { return uid; } + int64_t & get_mutable_uid() { return uid; } + void set_uid(const int64_t & value) { this->uid = value; } + + const bool & get_uses_wizard() const { return uses_wizard; } + bool & get_mutable_uses_wizard() { return uses_wizard; } + void set_uses_wizard(const bool & value) { this->uses_wizard = value; } + }; + + /** + * IntGrid value definition + */ + class IntGridValueDefinition { + public: + IntGridValueDefinition() = default; + virtual ~IntGridValueDefinition() = default; + + private: + std::string color; + boost::optional identifier; + boost::optional tile; + int64_t value; + + public: + const std::string & get_color() const { return color; } + std::string & get_mutable_color() { return color; } + void set_color(const std::string & value) { this->color = value; } + + /** + * User defined unique identifier + */ + boost::optional get_identifier() const { return identifier; } + void set_identifier(boost::optional value) { this->identifier = value; } + + boost::optional get_tile() const { return tile; } + void set_tile(boost::optional value) { this->tile = value; } + + /** + * The IntGrid value itself + */ + const int64_t & get_value() const { return value; } + int64_t & get_mutable_value() { return value; } + void set_value(const int64_t & value) { this->value = value; } + }; + + /** + * Type of the layer as Haxe Enum Possible values: `IntGrid`, `Entities`, `Tiles`, + * `AutoLayer` + */ + enum class Type : int { AUTO_LAYER, ENTITIES, INT_GRID, TILES }; + + class LayerDefinition { + public: + LayerDefinition() = default; + virtual ~LayerDefinition() = default; + + private: + std::string type; + std::vector auto_rule_groups; + boost::optional auto_source_layer_def_uid; + boost::optional auto_tileset_def_uid; + bool can_select_when_inactive; + double display_opacity; + boost::optional doc; + std::vector excluded_tags; + int64_t grid_size; + int64_t guide_grid_hei; + int64_t guide_grid_wid; + bool hide_fields_when_inactive; + bool hide_in_list; + std::string identifier; + double inactive_opacity; + std::vector int_grid_values; + double parallax_factor_x; + double parallax_factor_y; + bool parallax_scaling; + int64_t px_offset_x; + int64_t px_offset_y; + bool render_in_world_view; + std::vector required_tags; + double tile_pivot_x; + double tile_pivot_y; + boost::optional tileset_def_uid; + Type layer_definition_type; + boost::optional ui_color; + int64_t uid; + + public: + /** + * Type of the layer (*IntGrid, Entities, Tiles or AutoLayer*) + */ + const std::string & get_type() const { return type; } + std::string & get_mutable_type() { return type; } + void set_type(const std::string & value) { this->type = value; } + + /** + * Contains all the auto-layer rule definitions. + */ + const std::vector & get_auto_rule_groups() const { return auto_rule_groups; } + std::vector & get_mutable_auto_rule_groups() { return auto_rule_groups; } + void set_auto_rule_groups(const std::vector & value) { this->auto_rule_groups = value; } + + boost::optional get_auto_source_layer_def_uid() const { return auto_source_layer_def_uid; } + void set_auto_source_layer_def_uid(boost::optional value) { this->auto_source_layer_def_uid = value; } + + /** + * **WARNING**: this deprecated value is no longer exported since version 1.2.0 Replaced + * by: `tilesetDefUid` + */ + boost::optional get_auto_tileset_def_uid() const { return auto_tileset_def_uid; } + void set_auto_tileset_def_uid(boost::optional value) { this->auto_tileset_def_uid = value; } + + /** + * Allow editor selections when the layer is not currently active. + */ + const bool & get_can_select_when_inactive() const { return can_select_when_inactive; } + bool & get_mutable_can_select_when_inactive() { return can_select_when_inactive; } + void set_can_select_when_inactive(const bool & value) { this->can_select_when_inactive = value; } + + /** + * Opacity of the layer (0 to 1.0) + */ + const double & get_display_opacity() const { return display_opacity; } + double & get_mutable_display_opacity() { return display_opacity; } + void set_display_opacity(const double & value) { this->display_opacity = value; } + + /** + * User defined documentation for this element to provide help/tips to level designers. + */ + boost::optional get_doc() const { return doc; } + void set_doc(boost::optional value) { this->doc = value; } + + /** + * An array of tags to forbid some Entities in this layer + */ + const std::vector & get_excluded_tags() const { return excluded_tags; } + std::vector & get_mutable_excluded_tags() { return excluded_tags; } + void set_excluded_tags(const std::vector & value) { this->excluded_tags = value; } + + /** + * Width and height of the grid in pixels + */ + const int64_t & get_grid_size() const { return grid_size; } + int64_t & get_mutable_grid_size() { return grid_size; } + void set_grid_size(const int64_t & value) { this->grid_size = value; } + + /** + * Height of the optional "guide" grid in pixels + */ + const int64_t & get_guide_grid_hei() const { return guide_grid_hei; } + int64_t & get_mutable_guide_grid_hei() { return guide_grid_hei; } + void set_guide_grid_hei(const int64_t & value) { this->guide_grid_hei = value; } + + /** + * Width of the optional "guide" grid in pixels + */ + const int64_t & get_guide_grid_wid() const { return guide_grid_wid; } + int64_t & get_mutable_guide_grid_wid() { return guide_grid_wid; } + void set_guide_grid_wid(const int64_t & value) { this->guide_grid_wid = value; } + + const bool & get_hide_fields_when_inactive() const { return hide_fields_when_inactive; } + bool & get_mutable_hide_fields_when_inactive() { return hide_fields_when_inactive; } + void set_hide_fields_when_inactive(const bool & value) { this->hide_fields_when_inactive = value; } + + /** + * Hide the layer from the list on the side of the editor view. + */ + const bool & get_hide_in_list() const { return hide_in_list; } + bool & get_mutable_hide_in_list() { return hide_in_list; } + void set_hide_in_list(const bool & value) { this->hide_in_list = value; } + + /** + * User defined unique identifier + */ + const std::string & get_identifier() const { return identifier; } + std::string & get_mutable_identifier() { return identifier; } + void set_identifier(const std::string & value) { this->identifier = value; } + + /** + * Alpha of this layer when it is not the active one. + */ + const double & get_inactive_opacity() const { return inactive_opacity; } + double & get_mutable_inactive_opacity() { return inactive_opacity; } + void set_inactive_opacity(const double & value) { this->inactive_opacity = value; } + + /** + * An array that defines extra optional info for each IntGrid value.
WARNING: the + * array order is not related to actual IntGrid values! As user can re-order IntGrid values + * freely, you may value "2" before value "1" in this array. + */ + const std::vector & get_int_grid_values() const { return int_grid_values; } + std::vector & get_mutable_int_grid_values() { return int_grid_values; } + void set_int_grid_values(const std::vector & value) { this->int_grid_values = value; } + + /** + * Parallax horizontal factor (from -1 to 1, defaults to 0) which affects the scrolling + * speed of this layer, creating a fake 3D (parallax) effect. + */ + const double & get_parallax_factor_x() const { return parallax_factor_x; } + double & get_mutable_parallax_factor_x() { return parallax_factor_x; } + void set_parallax_factor_x(const double & value) { this->parallax_factor_x = value; } + + /** + * Parallax vertical factor (from -1 to 1, defaults to 0) which affects the scrolling speed + * of this layer, creating a fake 3D (parallax) effect. + */ + const double & get_parallax_factor_y() const { return parallax_factor_y; } + double & get_mutable_parallax_factor_y() { return parallax_factor_y; } + void set_parallax_factor_y(const double & value) { this->parallax_factor_y = value; } + + /** + * If true (default), a layer with a parallax factor will also be scaled up/down accordingly. + */ + const bool & get_parallax_scaling() const { return parallax_scaling; } + bool & get_mutable_parallax_scaling() { return parallax_scaling; } + void set_parallax_scaling(const bool & value) { this->parallax_scaling = value; } + + /** + * X offset of the layer, in pixels (IMPORTANT: this should be added to the `LayerInstance` + * optional offset) + */ + const int64_t & get_px_offset_x() const { return px_offset_x; } + int64_t & get_mutable_px_offset_x() { return px_offset_x; } + void set_px_offset_x(const int64_t & value) { this->px_offset_x = value; } + + /** + * Y offset of the layer, in pixels (IMPORTANT: this should be added to the `LayerInstance` + * optional offset) + */ + const int64_t & get_px_offset_y() const { return px_offset_y; } + int64_t & get_mutable_px_offset_y() { return px_offset_y; } + void set_px_offset_y(const int64_t & value) { this->px_offset_y = value; } + + /** + * If TRUE, the content of this layer will be used when rendering levels in a simplified way + * for the world view + */ + const bool & get_render_in_world_view() const { return render_in_world_view; } + bool & get_mutable_render_in_world_view() { return render_in_world_view; } + void set_render_in_world_view(const bool & value) { this->render_in_world_view = value; } + + /** + * An array of tags to filter Entities that can be added to this layer + */ + const std::vector & get_required_tags() const { return required_tags; } + std::vector & get_mutable_required_tags() { return required_tags; } + void set_required_tags(const std::vector & value) { this->required_tags = value; } + + /** + * If the tiles are smaller or larger than the layer grid, the pivot value will be used to + * position the tile relatively its grid cell. + */ + const double & get_tile_pivot_x() const { return tile_pivot_x; } + double & get_mutable_tile_pivot_x() { return tile_pivot_x; } + void set_tile_pivot_x(const double & value) { this->tile_pivot_x = value; } + + /** + * If the tiles are smaller or larger than the layer grid, the pivot value will be used to + * position the tile relatively its grid cell. + */ + const double & get_tile_pivot_y() const { return tile_pivot_y; } + double & get_mutable_tile_pivot_y() { return tile_pivot_y; } + void set_tile_pivot_y(const double & value) { this->tile_pivot_y = value; } + + /** + * Reference to the default Tileset UID being used by this layer definition.
+ * **WARNING**: some layer *instances* might use a different tileset. So most of the time, + * you should probably use the `__tilesetDefUid` value found in layer instances.
Note: + * since version 1.0.0, the old `autoTilesetDefUid` was removed and merged into this value. + */ + boost::optional get_tileset_def_uid() const { return tileset_def_uid; } + void set_tileset_def_uid(boost::optional value) { this->tileset_def_uid = value; } + + /** + * Type of the layer as Haxe Enum Possible values: `IntGrid`, `Entities`, `Tiles`, + * `AutoLayer` + */ + const Type & get_layer_definition_type() const { return layer_definition_type; } + Type & get_mutable_layer_definition_type() { return layer_definition_type; } + void set_layer_definition_type(const Type & value) { this->layer_definition_type = value; } + + /** + * User defined color for the UI + */ + boost::optional get_ui_color() const { return ui_color; } + void set_ui_color(boost::optional value) { this->ui_color = value; } + + /** + * Unique Int identifier + */ + const int64_t & get_uid() const { return uid; } + int64_t & get_mutable_uid() { return uid; } + void set_uid(const int64_t & value) { this->uid = value; } + }; + + /** + * In a tileset definition, user defined meta-data of a tile. + */ + class TileCustomMetadata { + public: + TileCustomMetadata() = default; + virtual ~TileCustomMetadata() = default; + + private: + std::string data; + int64_t tile_id; + + public: + const std::string & get_data() const { return data; } + std::string & get_mutable_data() { return data; } + void set_data(const std::string & value) { this->data = value; } + + const int64_t & get_tile_id() const { return tile_id; } + int64_t & get_mutable_tile_id() { return tile_id; } + void set_tile_id(const int64_t & value) { this->tile_id = value; } + }; + + enum class EmbedAtlas : int { LDTK_ICONS }; + + /** + * In a tileset definition, enum based tag infos + */ + class EnumTagValue { + public: + EnumTagValue() = default; + virtual ~EnumTagValue() = default; + + private: + std::string enum_value_id; + std::vector tile_ids; + + public: + const std::string & get_enum_value_id() const { return enum_value_id; } + std::string & get_mutable_enum_value_id() { return enum_value_id; } + void set_enum_value_id(const std::string & value) { this->enum_value_id = value; } + + const std::vector & get_tile_ids() const { return tile_ids; } + std::vector & get_mutable_tile_ids() { return tile_ids; } + void set_tile_ids(const std::vector & value) { this->tile_ids = value; } + }; + + /** + * The `Tileset` definition is the most important part among project definitions. It + * contains some extra informations about each integrated tileset. If you only had to parse + * one definition section, that would be the one. + */ + class TilesetDefinition { + public: + TilesetDefinition() = default; + virtual ~TilesetDefinition() = default; + + private: + int64_t c_hei; + int64_t c_wid; + boost::optional> cached_pixel_data; + std::vector custom_data; + boost::optional embed_atlas; + std::vector enum_tags; + std::string identifier; + int64_t padding; + int64_t px_hei; + int64_t px_wid; + boost::optional rel_path; + std::vector> saved_selections; + int64_t spacing; + std::vector tags; + boost::optional tags_source_enum_uid; + int64_t tile_grid_size; + int64_t uid; + + public: + /** + * Grid-based height + */ + const int64_t & get_c_hei() const { return c_hei; } + int64_t & get_mutable_c_hei() { return c_hei; } + void set_c_hei(const int64_t & value) { this->c_hei = value; } + + /** + * Grid-based width + */ + const int64_t & get_c_wid() const { return c_wid; } + int64_t & get_mutable_c_wid() { return c_wid; } + void set_c_wid(const int64_t & value) { this->c_wid = value; } + + /** + * The following data is used internally for various optimizations. It's always synced with + * source image changes. + */ + boost::optional> get_cached_pixel_data() const { return cached_pixel_data; } + void set_cached_pixel_data(boost::optional> value) { this->cached_pixel_data = value; } + + /** + * An array of custom tile metadata + */ + const std::vector & get_custom_data() const { return custom_data; } + std::vector & get_mutable_custom_data() { return custom_data; } + void set_custom_data(const std::vector & value) { this->custom_data = value; } + + /** + * If this value is set, then it means that this atlas uses an internal LDtk atlas image + * instead of a loaded one. Possible values: <`null`>, `LdtkIcons` + */ + boost::optional get_embed_atlas() const { return embed_atlas; } + void set_embed_atlas(boost::optional value) { this->embed_atlas = value; } + + /** + * Tileset tags using Enum values specified by `tagsSourceEnumId`. This array contains 1 + * element per Enum value, which contains an array of all Tile IDs that are tagged with it. + */ + const std::vector & get_enum_tags() const { return enum_tags; } + std::vector & get_mutable_enum_tags() { return enum_tags; } + void set_enum_tags(const std::vector & value) { this->enum_tags = value; } + + /** + * User defined unique identifier + */ + const std::string & get_identifier() const { return identifier; } + std::string & get_mutable_identifier() { return identifier; } + void set_identifier(const std::string & value) { this->identifier = value; } + + /** + * Distance in pixels from image borders + */ + const int64_t & get_padding() const { return padding; } + int64_t & get_mutable_padding() { return padding; } + void set_padding(const int64_t & value) { this->padding = value; } + + /** + * Image height in pixels + */ + const int64_t & get_px_hei() const { return px_hei; } + int64_t & get_mutable_px_hei() { return px_hei; } + void set_px_hei(const int64_t & value) { this->px_hei = value; } + + /** + * Image width in pixels + */ + const int64_t & get_px_wid() const { return px_wid; } + int64_t & get_mutable_px_wid() { return px_wid; } + void set_px_wid(const int64_t & value) { this->px_wid = value; } + + /** + * Path to the source file, relative to the current project JSON file
It can be null + * if no image was provided, or when using an embed atlas. + */ + boost::optional get_rel_path() const { return rel_path; } + void set_rel_path(boost::optional value) { this->rel_path = value; } + + /** + * Array of group of tiles selections, only meant to be used in the editor + */ + const std::vector> & get_saved_selections() const { return saved_selections; } + std::vector> & get_mutable_saved_selections() { return saved_selections; } + void set_saved_selections(const std::vector> & value) { this->saved_selections = value; } + + /** + * Space in pixels between all tiles + */ + const int64_t & get_spacing() const { return spacing; } + int64_t & get_mutable_spacing() { return spacing; } + void set_spacing(const int64_t & value) { this->spacing = value; } + + /** + * An array of user-defined tags to organize the Tilesets + */ + const std::vector & get_tags() const { return tags; } + std::vector & get_mutable_tags() { return tags; } + void set_tags(const std::vector & value) { this->tags = value; } + + /** + * Optional Enum definition UID used for this tileset meta-data + */ + boost::optional get_tags_source_enum_uid() const { return tags_source_enum_uid; } + void set_tags_source_enum_uid(boost::optional value) { this->tags_source_enum_uid = value; } + + const int64_t & get_tile_grid_size() const { return tile_grid_size; } + int64_t & get_mutable_tile_grid_size() { return tile_grid_size; } + void set_tile_grid_size(const int64_t & value) { this->tile_grid_size = value; } + + /** + * Unique Intidentifier + */ + const int64_t & get_uid() const { return uid; } + int64_t & get_mutable_uid() { return uid; } + void set_uid(const int64_t & value) { this->uid = value; } + }; + + /** + * If you're writing your own LDtk importer, you should probably just ignore *most* stuff in + * the `defs` section, as it contains data that are mostly important to the editor. To keep + * you away from the `defs` section and avoid some unnecessary JSON parsing, important data + * from definitions is often duplicated in fields prefixed with a double underscore (eg. + * `__identifier` or `__type`). The 2 only definition types you might need here are + * **Tilesets** and **Enums**. + * + * A structure containing all the definitions of this project + */ + class Definitions { + public: + Definitions() = default; + virtual ~Definitions() = default; + + private: + std::vector entities; + std::vector enums; + std::vector external_enums; + std::vector layers; + std::vector level_fields; + std::vector tilesets; + + public: + /** + * All entities definitions, including their custom fields + */ + const std::vector & get_entities() const { return entities; } + std::vector & get_mutable_entities() { return entities; } + void set_entities(const std::vector & value) { this->entities = value; } + + /** + * All internal enums + */ + const std::vector & get_enums() const { return enums; } + std::vector & get_mutable_enums() { return enums; } + void set_enums(const std::vector & value) { this->enums = value; } + + /** + * Note: external enums are exactly the same as `enums`, except they have a `relPath` to + * point to an external source file. + */ + const std::vector & get_external_enums() const { return external_enums; } + std::vector & get_mutable_external_enums() { return external_enums; } + void set_external_enums(const std::vector & value) { this->external_enums = value; } + + /** + * All layer definitions + */ + const std::vector & get_layers() const { return layers; } + std::vector & get_mutable_layers() { return layers; } + void set_layers(const std::vector & value) { this->layers = value; } + + /** + * All custom fields available to all levels. + */ + const std::vector & get_level_fields() const { return level_fields; } + std::vector & get_mutable_level_fields() { return level_fields; } + void set_level_fields(const std::vector & value) { this->level_fields = value; } + + /** + * All tilesets + */ + const std::vector & get_tilesets() const { return tilesets; } + std::vector & get_mutable_tilesets() { return tilesets; } + void set_tilesets(const std::vector & value) { this->tilesets = value; } + }; + + enum class Flag : int { DISCARD_PRE_CSV_INT_GRID, EXPORT_PRE_CSV_INT_GRID_FORMAT, IGNORE_BACKUP_SUGGEST, MULTI_WORLDS, PREPEND_INDEX_TO_LEVEL_FILE_NAMES, USE_MULTILINES_TYPE }; + + class FieldInstance { + public: + FieldInstance() = default; + virtual ~FieldInstance() = default; + + private: + std::string identifier; + boost::optional tile; + std::string type; + nlohmann::json value; + int64_t def_uid; + std::vector real_editor_values; + + public: + /** + * Field definition identifier + */ + const std::string & get_identifier() const { return identifier; } + std::string & get_mutable_identifier() { return identifier; } + void set_identifier(const std::string & value) { this->identifier = value; } + + /** + * Optional TilesetRect used to display this field (this can be the field own Tile, or some + * other Tile guessed from the value, like an Enum). + */ + boost::optional get_tile() const { return tile; } + void set_tile(boost::optional value) { this->tile = value; } + + /** + * Type of the field, such as `Int`, `Float`, `String`, `Enum(my_enum_name)`, `Bool`, + * etc.
NOTE: if you enable the advanced option **Use Multilines type**, you will have + * "*Multilines*" instead of "*String*" when relevant. + */ + const std::string & get_type() const { return type; } + std::string & get_mutable_type() { return type; } + void set_type(const std::string & value) { this->type = value; } + + /** + * Actual value of the field instance. The value type varies, depending on `__type`:
+ * - For **classic types** (ie. Integer, Float, Boolean, String, Text and FilePath), you + * just get the actual value with the expected type.
- For **Color**, the value is an + * hexadecimal string using "#rrggbb" format.
- For **Enum**, the value is a String + * representing the selected enum value.
- For **Point**, the value is a + * [GridPoint](#ldtk-GridPoint) object.
- For **Tile**, the value is a + * [TilesetRect](#ldtk-TilesetRect) object.
- For **EntityRef**, the value is an + * [EntityReferenceInfos](#ldtk-EntityReferenceInfos) object.

If the field is an + * array, then this `__value` will also be a JSON array. + */ + const nlohmann::json & get_value() const { return value; } + nlohmann::json & get_mutable_value() { return value; } + void set_value(const nlohmann::json & value) { this->value = value; } + + /** + * Reference of the **Field definition** UID + */ + const int64_t & get_def_uid() const { return def_uid; } + int64_t & get_mutable_def_uid() { return def_uid; } + void set_def_uid(const int64_t & value) { this->def_uid = value; } + + /** + * Editor internal raw values + */ + const std::vector & get_real_editor_values() const { return real_editor_values; } + std::vector & get_mutable_real_editor_values() { return real_editor_values; } + void set_real_editor_values(const std::vector & value) { this->real_editor_values = value; } + }; + + class EntityInstance { + public: + EntityInstance() = default; + virtual ~EntityInstance() = default; + + private: + std::vector grid; + std::string identifier; + std::vector pivot; + std::string smart_color; + std::vector tags; + boost::optional tile; + int64_t world_x; + int64_t world_y; + int64_t def_uid; + std::vector field_instances; + int64_t height; + std::string iid; + std::vector px; + int64_t width; + + public: + /** + * Grid-based coordinates (`[x,y]` format) + */ + const std::vector & get_grid() const { return grid; } + std::vector & get_mutable_grid() { return grid; } + void set_grid(const std::vector & value) { this->grid = value; } + + /** + * Entity definition identifier + */ + const std::string & get_identifier() const { return identifier; } + std::string & get_mutable_identifier() { return identifier; } + void set_identifier(const std::string & value) { this->identifier = value; } + + /** + * Pivot coordinates (`[x,y]` format, values are from 0 to 1) of the Entity + */ + const std::vector & get_pivot() const { return pivot; } + std::vector & get_mutable_pivot() { return pivot; } + void set_pivot(const std::vector & value) { this->pivot = value; } + + /** + * The entity "smart" color, guessed from either Entity definition, or one its field + * instances. + */ + const std::string & get_smart_color() const { return smart_color; } + std::string & get_mutable_smart_color() { return smart_color; } + void set_smart_color(const std::string & value) { this->smart_color = value; } + + /** + * Array of tags defined in this Entity definition + */ + const std::vector & get_tags() const { return tags; } + std::vector & get_mutable_tags() { return tags; } + void set_tags(const std::vector & value) { this->tags = value; } + + /** + * Optional TilesetRect used to display this entity (it could either be the default Entity + * tile, or some tile provided by a field value, like an Enum). + */ + boost::optional get_tile() const { return tile; } + void set_tile(boost::optional value) { this->tile = value; } + + /** + * X world coordinate in pixels + */ + const int64_t & get_world_x() const { return world_x; } + int64_t & get_mutable_world_x() { return world_x; } + void set_world_x(const int64_t & value) { this->world_x = value; } + + /** + * Y world coordinate in pixels + */ + const int64_t & get_world_y() const { return world_y; } + int64_t & get_mutable_world_y() { return world_y; } + void set_world_y(const int64_t & value) { this->world_y = value; } + + /** + * Reference of the **Entity definition** UID + */ + const int64_t & get_def_uid() const { return def_uid; } + int64_t & get_mutable_def_uid() { return def_uid; } + void set_def_uid(const int64_t & value) { this->def_uid = value; } + + /** + * An array of all custom fields and their values. + */ + const std::vector & get_field_instances() const { return field_instances; } + std::vector & get_mutable_field_instances() { return field_instances; } + void set_field_instances(const std::vector & value) { this->field_instances = value; } + + /** + * Entity height in pixels. For non-resizable entities, it will be the same as Entity + * definition. + */ + const int64_t & get_height() const { return height; } + int64_t & get_mutable_height() { return height; } + void set_height(const int64_t & value) { this->height = value; } + + /** + * Unique instance identifier + */ + const std::string & get_iid() const { return iid; } + std::string & get_mutable_iid() { return iid; } + void set_iid(const std::string & value) { this->iid = value; } + + /** + * Pixel coordinates (`[x,y]` format) in current level coordinate space. Don't forget + * optional layer offsets, if they exist! + */ + const std::vector & get_px() const { return px; } + std::vector & get_mutable_px() { return px; } + void set_px(const std::vector & value) { this->px = value; } + + /** + * Entity width in pixels. For non-resizable entities, it will be the same as Entity + * definition. + */ + const int64_t & get_width() const { return width; } + int64_t & get_mutable_width() { return width; } + void set_width(const int64_t & value) { this->width = value; } + }; + + /** + * This object describes the "location" of an Entity instance in the project worlds. + */ + class ReferenceToAnEntityInstance { + public: + ReferenceToAnEntityInstance() = default; + virtual ~ReferenceToAnEntityInstance() = default; + + private: + std::string entity_iid; + std::string layer_iid; + std::string level_iid; + std::string world_iid; + + public: + /** + * IID of the refered EntityInstance + */ + const std::string & get_entity_iid() const { return entity_iid; } + std::string & get_mutable_entity_iid() { return entity_iid; } + void set_entity_iid(const std::string & value) { this->entity_iid = value; } + + /** + * IID of the LayerInstance containing the refered EntityInstance + */ + const std::string & get_layer_iid() const { return layer_iid; } + std::string & get_mutable_layer_iid() { return layer_iid; } + void set_layer_iid(const std::string & value) { this->layer_iid = value; } + + /** + * IID of the Level containing the refered EntityInstance + */ + const std::string & get_level_iid() const { return level_iid; } + std::string & get_mutable_level_iid() { return level_iid; } + void set_level_iid(const std::string & value) { this->level_iid = value; } + + /** + * IID of the World containing the refered EntityInstance + */ + const std::string & get_world_iid() const { return world_iid; } + std::string & get_mutable_world_iid() { return world_iid; } + void set_world_iid(const std::string & value) { this->world_iid = value; } + }; + + /** + * This object is just a grid-based coordinate used in Field values. + */ + class GridPoint { + public: + GridPoint() = default; + virtual ~GridPoint() = default; + + private: + int64_t cx; + int64_t cy; + + public: + /** + * X grid-based coordinate + */ + const int64_t & get_cx() const { return cx; } + int64_t & get_mutable_cx() { return cx; } + void set_cx(const int64_t & value) { this->cx = value; } + + /** + * Y grid-based coordinate + */ + const int64_t & get_cy() const { return cy; } + int64_t & get_mutable_cy() { return cy; } + void set_cy(const int64_t & value) { this->cy = value; } + }; + + /** + * IntGrid value instance + */ + class IntGridValueInstance { + public: + IntGridValueInstance() = default; + virtual ~IntGridValueInstance() = default; + + private: + int64_t coord_id; + int64_t v; + + public: + /** + * Coordinate ID in the layer grid + */ + const int64_t & get_coord_id() const { return coord_id; } + int64_t & get_mutable_coord_id() { return coord_id; } + void set_coord_id(const int64_t & value) { this->coord_id = value; } + + /** + * IntGrid value + */ + const int64_t & get_v() const { return v; } + int64_t & get_mutable_v() { return v; } + void set_v(const int64_t & value) { this->v = value; } + }; + + /** + * This structure represents a single tile from a given Tileset. + */ + class TileInstance { + public: + TileInstance() = default; + virtual ~TileInstance() = default; + + private: + double a; + std::vector d; + int64_t f; + std::vector px; + std::vector src; + int64_t t; + + public: + /** + * Alpha/opacity of the tile (0-1, defaults to 1) + */ + const double & get_a() const { return a; } + double & get_mutable_a() { return a; } + void set_a(const double & value) { this->a = value; } + + /** + * Internal data used by the editor.
For auto-layer tiles: `[ruleId, coordId]`.
+ * For tile-layer tiles: `[coordId]`. + */ + const std::vector & get_d() const { return d; } + std::vector & get_mutable_d() { return d; } + void set_d(const std::vector & value) { this->d = value; } + + /** + * "Flip bits", a 2-bits integer to represent the mirror transformations of the tile.
+ * - Bit 0 = X flip
- Bit 1 = Y flip
Examples: f=0 (no flip), f=1 (X flip + * only), f=2 (Y flip only), f=3 (both flips) + */ + const int64_t & get_f() const { return f; } + int64_t & get_mutable_f() { return f; } + void set_f(const int64_t & value) { this->f = value; } + + /** + * Pixel coordinates of the tile in the **layer** (`[x,y]` format). Don't forget optional + * layer offsets, if they exist! + */ + const std::vector & get_px() const { return px; } + std::vector & get_mutable_px() { return px; } + void set_px(const std::vector & value) { this->px = value; } + + /** + * Pixel coordinates of the tile in the **tileset** (`[x,y]` format) + */ + const std::vector & get_src() const { return src; } + std::vector & get_mutable_src() { return src; } + void set_src(const std::vector & value) { this->src = value; } + + /** + * The *Tile ID* in the corresponding tileset. + */ + const int64_t & get_t() const { return t; } + int64_t & get_mutable_t() { return t; } + void set_t(const int64_t & value) { this->t = value; } + }; + + class LayerInstance { + public: + LayerInstance() = default; + virtual ~LayerInstance() = default; + + private: + int64_t c_hei; + int64_t c_wid; + int64_t grid_size; + std::string identifier; + double opacity; + int64_t px_total_offset_x; + int64_t px_total_offset_y; + boost::optional tileset_def_uid; + boost::optional tileset_rel_path; + std::string type; + std::vector auto_layer_tiles; + std::vector entity_instances; + std::vector grid_tiles; + std::string iid; + boost::optional> int_grid; + std::vector int_grid_csv; + int64_t layer_def_uid; + int64_t level_id; + std::vector optional_rules; + boost::optional override_tileset_uid; + int64_t px_offset_x; + int64_t px_offset_y; + int64_t seed; + bool visible; + + public: + /** + * Grid-based height + */ + const int64_t & get_c_hei() const { return c_hei; } + int64_t & get_mutable_c_hei() { return c_hei; } + void set_c_hei(const int64_t & value) { this->c_hei = value; } + + /** + * Grid-based width + */ + const int64_t & get_c_wid() const { return c_wid; } + int64_t & get_mutable_c_wid() { return c_wid; } + void set_c_wid(const int64_t & value) { this->c_wid = value; } + + /** + * Grid size + */ + const int64_t & get_grid_size() const { return grid_size; } + int64_t & get_mutable_grid_size() { return grid_size; } + void set_grid_size(const int64_t & value) { this->grid_size = value; } + + /** + * Layer definition identifier + */ + const std::string & get_identifier() const { return identifier; } + std::string & get_mutable_identifier() { return identifier; } + void set_identifier(const std::string & value) { this->identifier = value; } + + /** + * Layer opacity as Float [0-1] + */ + const double & get_opacity() const { return opacity; } + double & get_mutable_opacity() { return opacity; } + void set_opacity(const double & value) { this->opacity = value; } + + /** + * Total layer X pixel offset, including both instance and definition offsets. + */ + const int64_t & get_px_total_offset_x() const { return px_total_offset_x; } + int64_t & get_mutable_px_total_offset_x() { return px_total_offset_x; } + void set_px_total_offset_x(const int64_t & value) { this->px_total_offset_x = value; } + + /** + * Total layer Y pixel offset, including both instance and definition offsets. + */ + const int64_t & get_px_total_offset_y() const { return px_total_offset_y; } + int64_t & get_mutable_px_total_offset_y() { return px_total_offset_y; } + void set_px_total_offset_y(const int64_t & value) { this->px_total_offset_y = value; } + + /** + * The definition UID of corresponding Tileset, if any. + */ + boost::optional get_tileset_def_uid() const { return tileset_def_uid; } + void set_tileset_def_uid(boost::optional value) { this->tileset_def_uid = value; } + + /** + * The relative path to corresponding Tileset, if any. + */ + boost::optional get_tileset_rel_path() const { return tileset_rel_path; } + void set_tileset_rel_path(boost::optional value) { this->tileset_rel_path = value; } + + /** + * Layer type (possible values: IntGrid, Entities, Tiles or AutoLayer) + */ + const std::string & get_type() const { return type; } + std::string & get_mutable_type() { return type; } + void set_type(const std::string & value) { this->type = value; } + + /** + * An array containing all tiles generated by Auto-layer rules. The array is already sorted + * in display order (ie. 1st tile is beneath 2nd, which is beneath 3rd etc.).

+ * Note: if multiple tiles are stacked in the same cell as the result of different rules, + * all tiles behind opaque ones will be discarded. + */ + const std::vector & get_auto_layer_tiles() const { return auto_layer_tiles; } + std::vector & get_mutable_auto_layer_tiles() { return auto_layer_tiles; } + void set_auto_layer_tiles(const std::vector & value) { this->auto_layer_tiles = value; } + + const std::vector & get_entity_instances() const { return entity_instances; } + std::vector & get_mutable_entity_instances() { return entity_instances; } + void set_entity_instances(const std::vector & value) { this->entity_instances = value; } + + const std::vector & get_grid_tiles() const { return grid_tiles; } + std::vector & get_mutable_grid_tiles() { return grid_tiles; } + void set_grid_tiles(const std::vector & value) { this->grid_tiles = value; } + + /** + * Unique layer instance identifier + */ + const std::string & get_iid() const { return iid; } + std::string & get_mutable_iid() { return iid; } + void set_iid(const std::string & value) { this->iid = value; } + + /** + * **WARNING**: this deprecated value is no longer exported since version 1.0.0 Replaced + * by: `intGridCsv` + */ + boost::optional> get_int_grid() const { return int_grid; } + void set_int_grid(boost::optional> value) { this->int_grid = value; } + + /** + * A list of all values in the IntGrid layer, stored in CSV format (Comma Separated + * Values).
Order is from left to right, and top to bottom (ie. first row from left to + * right, followed by second row, etc).
`0` means "empty cell" and IntGrid values + * start at 1.
The array size is `__cWid` x `__cHei` cells. + */ + const std::vector & get_int_grid_csv() const { return int_grid_csv; } + std::vector & get_mutable_int_grid_csv() { return int_grid_csv; } + void set_int_grid_csv(const std::vector & value) { this->int_grid_csv = value; } + + /** + * Reference the Layer definition UID + */ + const int64_t & get_layer_def_uid() const { return layer_def_uid; } + int64_t & get_mutable_layer_def_uid() { return layer_def_uid; } + void set_layer_def_uid(const int64_t & value) { this->layer_def_uid = value; } + + /** + * Reference to the UID of the level containing this layer instance + */ + const int64_t & get_level_id() const { return level_id; } + int64_t & get_mutable_level_id() { return level_id; } + void set_level_id(const int64_t & value) { this->level_id = value; } + + /** + * An Array containing the UIDs of optional rules that were enabled in this specific layer + * instance. + */ + const std::vector & get_optional_rules() const { return optional_rules; } + std::vector & get_mutable_optional_rules() { return optional_rules; } + void set_optional_rules(const std::vector & value) { this->optional_rules = value; } + + /** + * This layer can use another tileset by overriding the tileset UID here. + */ + boost::optional get_override_tileset_uid() const { return override_tileset_uid; } + void set_override_tileset_uid(boost::optional value) { this->override_tileset_uid = value; } + + /** + * X offset in pixels to render this layer, usually 0 (IMPORTANT: this should be added to + * the `LayerDef` optional offset, so you should probably prefer using `__pxTotalOffsetX` + * which contains the total offset value) + */ + const int64_t & get_px_offset_x() const { return px_offset_x; } + int64_t & get_mutable_px_offset_x() { return px_offset_x; } + void set_px_offset_x(const int64_t & value) { this->px_offset_x = value; } + + /** + * Y offset in pixels to render this layer, usually 0 (IMPORTANT: this should be added to + * the `LayerDef` optional offset, so you should probably prefer using `__pxTotalOffsetX` + * which contains the total offset value) + */ + const int64_t & get_px_offset_y() const { return px_offset_y; } + int64_t & get_mutable_px_offset_y() { return px_offset_y; } + void set_px_offset_y(const int64_t & value) { this->px_offset_y = value; } + + /** + * Random seed used for Auto-Layers rendering + */ + const int64_t & get_seed() const { return seed; } + int64_t & get_mutable_seed() { return seed; } + void set_seed(const int64_t & value) { this->seed = value; } + + /** + * Layer instance visibility + */ + const bool & get_visible() const { return visible; } + bool & get_mutable_visible() { return visible; } + void set_visible(const bool & value) { this->visible = value; } + }; + + /** + * Level background image position info + */ + class LevelBackgroundPosition { + public: + LevelBackgroundPosition() = default; + virtual ~LevelBackgroundPosition() = default; + + private: + std::vector crop_rect; + std::vector scale; + std::vector top_left_px; + + public: + /** + * An array of 4 float values describing the cropped sub-rectangle of the displayed + * background image. This cropping happens when original is larger than the level bounds. + * Array format: `[ cropX, cropY, cropWidth, cropHeight ]` + */ + const std::vector & get_crop_rect() const { return crop_rect; } + std::vector & get_mutable_crop_rect() { return crop_rect; } + void set_crop_rect(const std::vector & value) { this->crop_rect = value; } + + /** + * An array containing the `[scaleX,scaleY]` values of the **cropped** background image, + * depending on `bgPos` option. + */ + const std::vector & get_scale() const { return scale; } + std::vector & get_mutable_scale() { return scale; } + void set_scale(const std::vector & value) { this->scale = value; } + + /** + * An array containing the `[x,y]` pixel coordinates of the top-left corner of the + * **cropped** background image, depending on `bgPos` option. + */ + const std::vector & get_top_left_px() const { return top_left_px; } + std::vector & get_mutable_top_left_px() { return top_left_px; } + void set_top_left_px(const std::vector & value) { this->top_left_px = value; } + }; + + enum class BgPos : int { CONTAIN, COVER, COVER_DIRTY, REPEAT, UNSCALED }; + + /** + * Nearby level info + */ + class NeighbourLevel { + public: + NeighbourLevel() = default; + virtual ~NeighbourLevel() = default; + + private: + std::string dir; + std::string level_iid; + boost::optional level_uid; + + public: + /** + * A single lowercase character tipping on the level location (`n`orth, `s`outh, `w`est, + * `e`ast). + */ + const std::string & get_dir() const { return dir; } + std::string & get_mutable_dir() { return dir; } + void set_dir(const std::string & value) { this->dir = value; } + + /** + * Neighbour Instance Identifier + */ + const std::string & get_level_iid() const { return level_iid; } + std::string & get_mutable_level_iid() { return level_iid; } + void set_level_iid(const std::string & value) { this->level_iid = value; } + + /** + * **WARNING**: this deprecated value is no longer exported since version 1.2.0 Replaced + * by: `levelIid` + */ + boost::optional get_level_uid() const { return level_uid; } + void set_level_uid(boost::optional value) { this->level_uid = value; } + }; + + /** + * This section contains all the level data. It can be found in 2 distinct forms, depending + * on Project current settings: - If "*Separate level files*" is **disabled** (default): + * full level data is *embedded* inside the main Project JSON file, - If "*Separate level + * files*" is **enabled**: level data is stored in *separate* standalone `.ldtkl` files (one + * per level). In this case, the main Project JSON file will still contain most level data, + * except heavy sections, like the `layerInstances` array (which will be null). The + * `externalRelPath` string points to the `ldtkl` file. A `ldtkl` file is just a JSON file + * containing exactly what is described below. + */ + class Level { + public: + Level() = default; + virtual ~Level() = default; + + private: + std::string bg_color; + boost::optional bg_pos; + std::vector neighbours; + std::string smart_color; + boost::optional level_bg_color; + double bg_pivot_x; + double bg_pivot_y; + boost::optional level_bg_pos; + boost::optional bg_rel_path; + boost::optional external_rel_path; + std::vector field_instances; + std::string identifier; + std::string iid; + boost::optional> layer_instances; + int64_t px_hei; + int64_t px_wid; + int64_t uid; + bool use_auto_identifier; + int64_t world_depth; + int64_t world_x; + int64_t world_y; + + public: + /** + * Background color of the level (same as `bgColor`, except the default value is + * automatically used here if its value is `null`) + */ + const std::string & get_bg_color() const { return bg_color; } + std::string & get_mutable_bg_color() { return bg_color; } + void set_bg_color(const std::string & value) { this->bg_color = value; } + + /** + * Position informations of the background image, if there is one. + */ + boost::optional get_bg_pos() const { return bg_pos; } + void set_bg_pos(boost::optional value) { this->bg_pos = value; } + + /** + * An array listing all other levels touching this one on the world map.
Only relevant + * for world layouts where level spatial positioning is manual (ie. GridVania, Free). For + * Horizontal and Vertical layouts, this array is always empty. + */ + const std::vector & get_neighbours() const { return neighbours; } + std::vector & get_mutable_neighbours() { return neighbours; } + void set_neighbours(const std::vector & value) { this->neighbours = value; } + + /** + * The "guessed" color for this level in the editor, decided using either the background + * color or an existing custom field. + */ + const std::string & get_smart_color() const { return smart_color; } + std::string & get_mutable_smart_color() { return smart_color; } + void set_smart_color(const std::string & value) { this->smart_color = value; } + + /** + * Background color of the level. If `null`, the project `defaultLevelBgColor` should be + * used. + */ + boost::optional get_level_bg_color() const { return level_bg_color; } + void set_level_bg_color(boost::optional value) { this->level_bg_color = value; } + + /** + * Background image X pivot (0-1) + */ + const double & get_bg_pivot_x() const { return bg_pivot_x; } + double & get_mutable_bg_pivot_x() { return bg_pivot_x; } + void set_bg_pivot_x(const double & value) { this->bg_pivot_x = value; } + + /** + * Background image Y pivot (0-1) + */ + const double & get_bg_pivot_y() const { return bg_pivot_y; } + double & get_mutable_bg_pivot_y() { return bg_pivot_y; } + void set_bg_pivot_y(const double & value) { this->bg_pivot_y = value; } + + /** + * An enum defining the way the background image (if any) is positioned on the level. See + * `__bgPos` for resulting position info. Possible values: <`null`>, `Unscaled`, + * `Contain`, `Cover`, `CoverDirty`, `Repeat` + */ + boost::optional get_level_bg_pos() const { return level_bg_pos; } + void set_level_bg_pos(boost::optional value) { this->level_bg_pos = value; } + + /** + * The *optional* relative path to the level background image. + */ + boost::optional get_bg_rel_path() const { return bg_rel_path; } + void set_bg_rel_path(boost::optional value) { this->bg_rel_path = value; } + + /** + * This value is not null if the project option "*Save levels separately*" is enabled. In + * this case, this **relative** path points to the level Json file. + */ + boost::optional get_external_rel_path() const { return external_rel_path; } + void set_external_rel_path(boost::optional value) { this->external_rel_path = value; } + + /** + * An array containing this level custom field values. + */ + const std::vector & get_field_instances() const { return field_instances; } + std::vector & get_mutable_field_instances() { return field_instances; } + void set_field_instances(const std::vector & value) { this->field_instances = value; } + + /** + * User defined unique identifier + */ + const std::string & get_identifier() const { return identifier; } + std::string & get_mutable_identifier() { return identifier; } + void set_identifier(const std::string & value) { this->identifier = value; } + + /** + * Unique instance identifier + */ + const std::string & get_iid() const { return iid; } + std::string & get_mutable_iid() { return iid; } + void set_iid(const std::string & value) { this->iid = value; } + + /** + * An array containing all Layer instances. **IMPORTANT**: if the project option "*Save + * levels separately*" is enabled, this field will be `null`.
This array is **sorted + * in display order**: the 1st layer is the top-most and the last is behind. + */ + boost::optional> get_layer_instances() const { return layer_instances; } + void set_layer_instances(boost::optional> value) { this->layer_instances = value; } + + /** + * Height of the level in pixels + */ + const int64_t & get_px_hei() const { return px_hei; } + int64_t & get_mutable_px_hei() { return px_hei; } + void set_px_hei(const int64_t & value) { this->px_hei = value; } + + /** + * Width of the level in pixels + */ + const int64_t & get_px_wid() const { return px_wid; } + int64_t & get_mutable_px_wid() { return px_wid; } + void set_px_wid(const int64_t & value) { this->px_wid = value; } + + /** + * Unique Int identifier + */ + const int64_t & get_uid() const { return uid; } + int64_t & get_mutable_uid() { return uid; } + void set_uid(const int64_t & value) { this->uid = value; } + + /** + * If TRUE, the level identifier will always automatically use the naming pattern as defined + * in `Project.levelNamePattern`. Becomes FALSE if the identifier is manually modified by + * user. + */ + const bool & get_use_auto_identifier() const { return use_auto_identifier; } + bool & get_mutable_use_auto_identifier() { return use_auto_identifier; } + void set_use_auto_identifier(const bool & value) { this->use_auto_identifier = value; } + + /** + * Index that represents the "depth" of the level in the world. Default is 0, greater means + * "above", lower means "below".
This value is mostly used for display only and is + * intended to make stacking of levels easier to manage. + */ + const int64_t & get_world_depth() const { return world_depth; } + int64_t & get_mutable_world_depth() { return world_depth; } + void set_world_depth(const int64_t & value) { this->world_depth = value; } + + /** + * World X coordinate in pixels.
Only relevant for world layouts where level spatial + * positioning is manual (ie. GridVania, Free). For Horizontal and Vertical layouts, the + * value is always -1 here. + */ + const int64_t & get_world_x() const { return world_x; } + int64_t & get_mutable_world_x() { return world_x; } + void set_world_x(const int64_t & value) { this->world_x = value; } + + /** + * World Y coordinate in pixels.
Only relevant for world layouts where level spatial + * positioning is manual (ie. GridVania, Free). For Horizontal and Vertical layouts, the + * value is always -1 here. + */ + const int64_t & get_world_y() const { return world_y; } + int64_t & get_mutable_world_y() { return world_y; } + void set_world_y(const int64_t & value) { this->world_y = value; } + }; + + class LdtkTableOfContentEntry { + public: + LdtkTableOfContentEntry() = default; + virtual ~LdtkTableOfContentEntry() = default; + + private: + std::string identifier; + std::vector instances; + + public: + const std::string & get_identifier() const { return identifier; } + std::string & get_mutable_identifier() { return identifier; } + void set_identifier(const std::string & value) { this->identifier = value; } + + const std::vector & get_instances() const { return instances; } + std::vector & get_mutable_instances() { return instances; } + void set_instances(const std::vector & value) { this->instances = value; } + }; + + enum class WorldLayout : int { FREE, GRID_VANIA, LINEAR_HORIZONTAL, LINEAR_VERTICAL }; + + /** + * **IMPORTANT**: this type is available as a preview. You can rely on it to update your + * importers, for when it will be officially available. A World contains multiple levels, + * and it has its own layout settings. + */ + class World { + public: + World() = default; + virtual ~World() = default; + + private: + int64_t default_level_height; + int64_t default_level_width; + std::string identifier; + std::string iid; + std::vector levels; + int64_t world_grid_height; + int64_t world_grid_width; + boost::optional world_layout; + + public: + /** + * Default new level height + */ + const int64_t & get_default_level_height() const { return default_level_height; } + int64_t & get_mutable_default_level_height() { return default_level_height; } + void set_default_level_height(const int64_t & value) { this->default_level_height = value; } + + /** + * Default new level width + */ + const int64_t & get_default_level_width() const { return default_level_width; } + int64_t & get_mutable_default_level_width() { return default_level_width; } + void set_default_level_width(const int64_t & value) { this->default_level_width = value; } + + /** + * User defined unique identifier + */ + const std::string & get_identifier() const { return identifier; } + std::string & get_mutable_identifier() { return identifier; } + void set_identifier(const std::string & value) { this->identifier = value; } + + /** + * Unique instance identifer + */ + const std::string & get_iid() const { return iid; } + std::string & get_mutable_iid() { return iid; } + void set_iid(const std::string & value) { this->iid = value; } + + /** + * All levels from this world. The order of this array is only relevant in + * `LinearHorizontal` and `linearVertical` world layouts (see `worldLayout` value). + * Otherwise, you should refer to the `worldX`,`worldY` coordinates of each Level. + */ + const std::vector & get_levels() const { return levels; } + std::vector & get_mutable_levels() { return levels; } + void set_levels(const std::vector & value) { this->levels = value; } + + /** + * Height of the world grid in pixels. + */ + const int64_t & get_world_grid_height() const { return world_grid_height; } + int64_t & get_mutable_world_grid_height() { return world_grid_height; } + void set_world_grid_height(const int64_t & value) { this->world_grid_height = value; } + + /** + * Width of the world grid in pixels. + */ + const int64_t & get_world_grid_width() const { return world_grid_width; } + int64_t & get_mutable_world_grid_width() { return world_grid_width; } + void set_world_grid_width(const int64_t & value) { this->world_grid_width = value; } + + /** + * An enum that describes how levels are organized in this project (ie. linearly or in a 2D + * space). Possible values: `Free`, `GridVania`, `LinearHorizontal`, `LinearVertical`, `null` + */ + boost::optional get_world_layout() const { return world_layout; } + void set_world_layout(boost::optional value) { this->world_layout = value; } + }; + + /** + * This object is not actually used by LDtk. It ONLY exists to force explicit references to + * all types, to make sure QuickType finds them and integrate all of them. Otherwise, + * Quicktype will drop types that are not explicitely used. + */ + class ForcedRefs { + public: + ForcedRefs() = default; + virtual ~ForcedRefs() = default; + + private: + boost::optional auto_layer_rule_group; + boost::optional auto_rule_def; + boost::optional custom_command; + boost::optional definitions; + boost::optional entity_def; + boost::optional entity_instance; + boost::optional entity_reference_infos; + boost::optional enum_def; + boost::optional enum_def_values; + boost::optional enum_tag_value; + boost::optional field_def; + boost::optional field_instance; + boost::optional grid_point; + boost::optional int_grid_value_def; + boost::optional int_grid_value_instance; + boost::optional layer_def; + boost::optional layer_instance; + boost::optional level; + boost::optional level_bg_pos_infos; + boost::optional neighbour_level; + boost::optional table_of_content_entry; + boost::optional tile; + boost::optional tile_custom_metadata; + boost::optional tileset_def; + boost::optional tileset_rect; + boost::optional world; + + public: + boost::optional get_auto_layer_rule_group() const { return auto_layer_rule_group; } + void set_auto_layer_rule_group(boost::optional value) { this->auto_layer_rule_group = value; } + + boost::optional get_auto_rule_def() const { return auto_rule_def; } + void set_auto_rule_def(boost::optional value) { this->auto_rule_def = value; } + + boost::optional get_custom_command() const { return custom_command; } + void set_custom_command(boost::optional value) { this->custom_command = value; } + + boost::optional get_definitions() const { return definitions; } + void set_definitions(boost::optional value) { this->definitions = value; } + + boost::optional get_entity_def() const { return entity_def; } + void set_entity_def(boost::optional value) { this->entity_def = value; } + + boost::optional get_entity_instance() const { return entity_instance; } + void set_entity_instance(boost::optional value) { this->entity_instance = value; } + + boost::optional get_entity_reference_infos() const { return entity_reference_infos; } + void set_entity_reference_infos(boost::optional value) { this->entity_reference_infos = value; } + + boost::optional get_enum_def() const { return enum_def; } + void set_enum_def(boost::optional value) { this->enum_def = value; } + + boost::optional get_enum_def_values() const { return enum_def_values; } + void set_enum_def_values(boost::optional value) { this->enum_def_values = value; } + + boost::optional get_enum_tag_value() const { return enum_tag_value; } + void set_enum_tag_value(boost::optional value) { this->enum_tag_value = value; } + + boost::optional get_field_def() const { return field_def; } + void set_field_def(boost::optional value) { this->field_def = value; } + + boost::optional get_field_instance() const { return field_instance; } + void set_field_instance(boost::optional value) { this->field_instance = value; } + + boost::optional get_grid_point() const { return grid_point; } + void set_grid_point(boost::optional value) { this->grid_point = value; } + + boost::optional get_int_grid_value_def() const { return int_grid_value_def; } + void set_int_grid_value_def(boost::optional value) { this->int_grid_value_def = value; } + + boost::optional get_int_grid_value_instance() const { return int_grid_value_instance; } + void set_int_grid_value_instance(boost::optional value) { this->int_grid_value_instance = value; } + + boost::optional get_layer_def() const { return layer_def; } + void set_layer_def(boost::optional value) { this->layer_def = value; } + + boost::optional get_layer_instance() const { return layer_instance; } + void set_layer_instance(boost::optional value) { this->layer_instance = value; } + + boost::optional get_level() const { return level; } + void set_level(boost::optional value) { this->level = value; } + + boost::optional get_level_bg_pos_infos() const { return level_bg_pos_infos; } + void set_level_bg_pos_infos(boost::optional value) { this->level_bg_pos_infos = value; } + + boost::optional get_neighbour_level() const { return neighbour_level; } + void set_neighbour_level(boost::optional value) { this->neighbour_level = value; } + + boost::optional get_table_of_content_entry() const { return table_of_content_entry; } + void set_table_of_content_entry(boost::optional value) { this->table_of_content_entry = value; } + + boost::optional get_tile() const { return tile; } + void set_tile(boost::optional value) { this->tile = value; } + + boost::optional get_tile_custom_metadata() const { return tile_custom_metadata; } + void set_tile_custom_metadata(boost::optional value) { this->tile_custom_metadata = value; } + + boost::optional get_tileset_def() const { return tileset_def; } + void set_tileset_def(boost::optional value) { this->tileset_def = value; } + + boost::optional get_tileset_rect() const { return tileset_rect; } + void set_tileset_rect(boost::optional value) { this->tileset_rect = value; } + + boost::optional get_world() const { return world; } + void set_world(boost::optional value) { this->world = value; } + }; + + /** + * Naming convention for Identifiers (first-letter uppercase, full uppercase etc.) Possible + * values: `Capitalize`, `Uppercase`, `Lowercase`, `Free` + */ + enum class IdentifierStyle : int { CAPITALIZE, FREE, LOWERCASE, UPPERCASE }; + + /** + * "Image export" option when saving project. Possible values: `None`, `OneImagePerLayer`, + * `OneImagePerLevel`, `LayersAndLevels` + */ + enum class ImageExportMode : int { LAYERS_AND_LEVELS, NONE, ONE_IMAGE_PER_LAYER, ONE_IMAGE_PER_LEVEL }; + + /** + * This file is a JSON schema of files created by LDtk level editor (https://ldtk.io). + * + * This is the root of any Project JSON file. It contains: - the project settings, - an + * array of levels, - a group of definitions (that can probably be safely ignored for most + * users). + */ + class LdtkJson { + public: + LdtkJson() = default; + virtual ~LdtkJson() = default; + + private: + boost::optional forced_refs; + double app_build_id; + int64_t backup_limit; + bool backup_on_save; + boost::optional backup_rel_path; + std::string bg_color; + std::vector custom_commands; + int64_t default_entity_height; + int64_t default_entity_width; + int64_t default_grid_size; + std::string default_level_bg_color; + boost::optional default_level_height; + boost::optional default_level_width; + double default_pivot_x; + double default_pivot_y; + Definitions defs; + std::string dummy_world_iid; + bool export_level_bg; + boost::optional export_png; + bool export_tiled; + bool external_levels; + std::vector flags; + IdentifierStyle identifier_style; + std::string iid; + ImageExportMode image_export_mode; + std::string json_version; + std::string level_name_pattern; + std::vector levels; + bool minify_json; + int64_t next_uid; + boost::optional png_file_pattern; + bool simplified_export; + std::vector toc; + boost::optional tutorial_desc; + boost::optional world_grid_height; + boost::optional world_grid_width; + boost::optional world_layout; + std::vector worlds; + + public: + /** + * This object is not actually used by LDtk. It ONLY exists to force explicit references to + * all types, to make sure QuickType finds them and integrate all of them. Otherwise, + * Quicktype will drop types that are not explicitely used. + */ + boost::optional get_forced_refs() const { return forced_refs; } + void set_forced_refs(boost::optional value) { this->forced_refs = value; } + + /** + * LDtk application build identifier.
This is only used to identify the LDtk version + * that generated this particular project file, which can be useful for specific bug fixing. + * Note that the build identifier is just the date of the release, so it's not unique to + * each user (one single global ID per LDtk public release), and as a result, completely + * anonymous. + */ + const double & get_app_build_id() const { return app_build_id; } + double & get_mutable_app_build_id() { return app_build_id; } + void set_app_build_id(const double & value) { this->app_build_id = value; } + + /** + * Number of backup files to keep, if the `backupOnSave` is TRUE + */ + const int64_t & get_backup_limit() const { return backup_limit; } + int64_t & get_mutable_backup_limit() { return backup_limit; } + void set_backup_limit(const int64_t & value) { this->backup_limit = value; } + + /** + * If TRUE, an extra copy of the project will be created in a sub folder, when saving. + */ + const bool & get_backup_on_save() const { return backup_on_save; } + bool & get_mutable_backup_on_save() { return backup_on_save; } + void set_backup_on_save(const bool & value) { this->backup_on_save = value; } + + /** + * Target relative path to store backup files + */ + boost::optional get_backup_rel_path() const { return backup_rel_path; } + void set_backup_rel_path(boost::optional value) { this->backup_rel_path = value; } + + /** + * Project background color + */ + const std::string & get_bg_color() const { return bg_color; } + std::string & get_mutable_bg_color() { return bg_color; } + void set_bg_color(const std::string & value) { this->bg_color = value; } + + /** + * An array of command lines that can be ran manually by the user + */ + const std::vector & get_custom_commands() const { return custom_commands; } + std::vector & get_mutable_custom_commands() { return custom_commands; } + void set_custom_commands(const std::vector & value) { this->custom_commands = value; } + + /** + * Default height for new entities + */ + const int64_t & get_default_entity_height() const { return default_entity_height; } + int64_t & get_mutable_default_entity_height() { return default_entity_height; } + void set_default_entity_height(const int64_t & value) { this->default_entity_height = value; } + + /** + * Default width for new entities + */ + const int64_t & get_default_entity_width() const { return default_entity_width; } + int64_t & get_mutable_default_entity_width() { return default_entity_width; } + void set_default_entity_width(const int64_t & value) { this->default_entity_width = value; } + + /** + * Default grid size for new layers + */ + const int64_t & get_default_grid_size() const { return default_grid_size; } + int64_t & get_mutable_default_grid_size() { return default_grid_size; } + void set_default_grid_size(const int64_t & value) { this->default_grid_size = value; } + + /** + * Default background color of levels + */ + const std::string & get_default_level_bg_color() const { return default_level_bg_color; } + std::string & get_mutable_default_level_bg_color() { return default_level_bg_color; } + void set_default_level_bg_color(const std::string & value) { this->default_level_bg_color = value; } + + /** + * **WARNING**: this field will move to the `worlds` array after the "multi-worlds" update. + * It will then be `null`. You can enable the Multi-worlds advanced project option to enable + * the change immediately.

Default new level height + */ + boost::optional get_default_level_height() const { return default_level_height; } + void set_default_level_height(boost::optional value) { this->default_level_height = value; } + + /** + * **WARNING**: this field will move to the `worlds` array after the "multi-worlds" update. + * It will then be `null`. You can enable the Multi-worlds advanced project option to enable + * the change immediately.

Default new level width + */ + boost::optional get_default_level_width() const { return default_level_width; } + void set_default_level_width(boost::optional value) { this->default_level_width = value; } + + /** + * Default X pivot (0 to 1) for new entities + */ + const double & get_default_pivot_x() const { return default_pivot_x; } + double & get_mutable_default_pivot_x() { return default_pivot_x; } + void set_default_pivot_x(const double & value) { this->default_pivot_x = value; } + + /** + * Default Y pivot (0 to 1) for new entities + */ + const double & get_default_pivot_y() const { return default_pivot_y; } + double & get_mutable_default_pivot_y() { return default_pivot_y; } + void set_default_pivot_y(const double & value) { this->default_pivot_y = value; } + + /** + * A structure containing all the definitions of this project + */ + const Definitions & get_defs() const { return defs; } + Definitions & get_mutable_defs() { return defs; } + void set_defs(const Definitions & value) { this->defs = value; } + + /** + * If the project isn't in MultiWorlds mode, this is the IID of the internal "dummy" World. + */ + const std::string & get_dummy_world_iid() const { return dummy_world_iid; } + std::string & get_mutable_dummy_world_iid() { return dummy_world_iid; } + void set_dummy_world_iid(const std::string & value) { this->dummy_world_iid = value; } + + /** + * If TRUE, the exported PNGs will include the level background (color or image). + */ + const bool & get_export_level_bg() const { return export_level_bg; } + bool & get_mutable_export_level_bg() { return export_level_bg; } + void set_export_level_bg(const bool & value) { this->export_level_bg = value; } + + /** + * **WARNING**: this deprecated value is no longer exported since version 0.9.3 Replaced + * by: `imageExportMode` + */ + boost::optional get_export_png() const { return export_png; } + void set_export_png(boost::optional value) { this->export_png = value; } + + /** + * If TRUE, a Tiled compatible file will also be generated along with the LDtk JSON file + * (default is FALSE) + */ + const bool & get_export_tiled() const { return export_tiled; } + bool & get_mutable_export_tiled() { return export_tiled; } + void set_export_tiled(const bool & value) { this->export_tiled = value; } + + /** + * If TRUE, one file will be saved for the project (incl. all its definitions) and one file + * in a sub-folder for each level. + */ + const bool & get_external_levels() const { return external_levels; } + bool & get_mutable_external_levels() { return external_levels; } + void set_external_levels(const bool & value) { this->external_levels = value; } + + /** + * An array containing various advanced flags (ie. options or other states). Possible + * values: `DiscardPreCsvIntGrid`, `ExportPreCsvIntGridFormat`, `IgnoreBackupSuggest`, + * `PrependIndexToLevelFileNames`, `MultiWorlds`, `UseMultilinesType` + */ + const std::vector & get_flags() const { return flags; } + std::vector & get_mutable_flags() { return flags; } + void set_flags(const std::vector & value) { this->flags = value; } + + /** + * Naming convention for Identifiers (first-letter uppercase, full uppercase etc.) Possible + * values: `Capitalize`, `Uppercase`, `Lowercase`, `Free` + */ + const IdentifierStyle & get_identifier_style() const { return identifier_style; } + IdentifierStyle & get_mutable_identifier_style() { return identifier_style; } + void set_identifier_style(const IdentifierStyle & value) { this->identifier_style = value; } + + /** + * Unique project identifier + */ + const std::string & get_iid() const { return iid; } + std::string & get_mutable_iid() { return iid; } + void set_iid(const std::string & value) { this->iid = value; } + + /** + * "Image export" option when saving project. Possible values: `None`, `OneImagePerLayer`, + * `OneImagePerLevel`, `LayersAndLevels` + */ + const ImageExportMode & get_image_export_mode() const { return image_export_mode; } + ImageExportMode & get_mutable_image_export_mode() { return image_export_mode; } + void set_image_export_mode(const ImageExportMode & value) { this->image_export_mode = value; } + + /** + * File format version + */ + const std::string & get_json_version() const { return json_version; } + std::string & get_mutable_json_version() { return json_version; } + void set_json_version(const std::string & value) { this->json_version = value; } + + /** + * The default naming convention for level identifiers. + */ + const std::string & get_level_name_pattern() const { return level_name_pattern; } + std::string & get_mutable_level_name_pattern() { return level_name_pattern; } + void set_level_name_pattern(const std::string & value) { this->level_name_pattern = value; } + + /** + * All levels. The order of this array is only relevant in `LinearHorizontal` and + * `linearVertical` world layouts (see `worldLayout` value).
Otherwise, you should + * refer to the `worldX`,`worldY` coordinates of each Level. + */ + const std::vector & get_levels() const { return levels; } + std::vector & get_mutable_levels() { return levels; } + void set_levels(const std::vector & value) { this->levels = value; } + + /** + * If TRUE, the Json is partially minified (no indentation, nor line breaks, default is + * FALSE) + */ + const bool & get_minify_json() const { return minify_json; } + bool & get_mutable_minify_json() { return minify_json; } + void set_minify_json(const bool & value) { this->minify_json = value; } + + /** + * Next Unique integer ID available + */ + const int64_t & get_next_uid() const { return next_uid; } + int64_t & get_mutable_next_uid() { return next_uid; } + void set_next_uid(const int64_t & value) { this->next_uid = value; } + + /** + * File naming pattern for exported PNGs + */ + boost::optional get_png_file_pattern() const { return png_file_pattern; } + void set_png_file_pattern(boost::optional value) { this->png_file_pattern = value; } + + /** + * If TRUE, a very simplified will be generated on saving, for quicker & easier engine + * integration. + */ + const bool & get_simplified_export() const { return simplified_export; } + bool & get_mutable_simplified_export() { return simplified_export; } + void set_simplified_export(const bool & value) { this->simplified_export = value; } + + /** + * All instances of entities that have their `exportToToc` flag enabled are listed in this + * array. + */ + const std::vector & get_toc() const { return toc; } + std::vector & get_mutable_toc() { return toc; } + void set_toc(const std::vector & value) { this->toc = value; } + + /** + * This optional description is used by LDtk Samples to show up some informations and + * instructions. + */ + boost::optional get_tutorial_desc() const { return tutorial_desc; } + void set_tutorial_desc(boost::optional value) { this->tutorial_desc = value; } + + /** + * **WARNING**: this field will move to the `worlds` array after the "multi-worlds" update. + * It will then be `null`. You can enable the Multi-worlds advanced project option to enable + * the change immediately.

Height of the world grid in pixels. + */ + boost::optional get_world_grid_height() const { return world_grid_height; } + void set_world_grid_height(boost::optional value) { this->world_grid_height = value; } + + /** + * **WARNING**: this field will move to the `worlds` array after the "multi-worlds" update. + * It will then be `null`. You can enable the Multi-worlds advanced project option to enable + * the change immediately.

Width of the world grid in pixels. + */ + boost::optional get_world_grid_width() const { return world_grid_width; } + void set_world_grid_width(boost::optional value) { this->world_grid_width = value; } + + /** + * **WARNING**: this field will move to the `worlds` array after the "multi-worlds" update. + * It will then be `null`. You can enable the Multi-worlds advanced project option to enable + * the change immediately.

An enum that describes how levels are organized in + * this project (ie. linearly or in a 2D space). Possible values: <`null`>, `Free`, + * `GridVania`, `LinearHorizontal`, `LinearVertical` + */ + boost::optional get_world_layout() const { return world_layout; } + void set_world_layout(boost::optional value) { this->world_layout = value; } + + /** + * This array will be empty, unless you enable the Multi-Worlds in the project advanced + * settings.

- in current version, a LDtk project file can only contain a single + * world with multiple levels in it. In this case, levels and world layout related settings + * are stored in the root of the JSON.
- with "Multi-worlds" enabled, there will be a + * `worlds` array in root, each world containing levels and layout settings. Basically, it's + * pretty much only about moving the `levels` array to the `worlds` array, along with world + * layout related values (eg. `worldGridWidth` etc).

If you want to start + * supporting this future update easily, please refer to this documentation: + * https://github.com/deepnight/ldtk/issues/231 + */ + const std::vector & get_worlds() const { return worlds; } + std::vector & get_mutable_worlds() { return worlds; } + void set_worlds(const std::vector & value) { this->worlds = value; } + }; +} + +namespace quicktype { + void from_json(const json & j, LdtkCustomCommand & x); + void to_json(json & j, const LdtkCustomCommand & x); + + void from_json(const json & j, FieldDefinition & x); + void to_json(json & j, const FieldDefinition & x); + + void from_json(const json & j, TilesetRectangle & x); + void to_json(json & j, const TilesetRectangle & x); + + void from_json(const json & j, EntityDefinition & x); + void to_json(json & j, const EntityDefinition & x); + + void from_json(const json & j, EnumValueDefinition & x); + void to_json(json & j, const EnumValueDefinition & x); + + void from_json(const json & j, EnumDefinition & x); + void to_json(json & j, const EnumDefinition & x); + + void from_json(const json & j, AutoLayerRuleDefinition & x); + void to_json(json & j, const AutoLayerRuleDefinition & x); + + void from_json(const json & j, AutoLayerRuleGroup & x); + void to_json(json & j, const AutoLayerRuleGroup & x); + + void from_json(const json & j, IntGridValueDefinition & x); + void to_json(json & j, const IntGridValueDefinition & x); + + void from_json(const json & j, LayerDefinition & x); + void to_json(json & j, const LayerDefinition & x); + + void from_json(const json & j, TileCustomMetadata & x); + void to_json(json & j, const TileCustomMetadata & x); + + void from_json(const json & j, EnumTagValue & x); + void to_json(json & j, const EnumTagValue & x); + + void from_json(const json & j, TilesetDefinition & x); + void to_json(json & j, const TilesetDefinition & x); + + void from_json(const json & j, Definitions & x); + void to_json(json & j, const Definitions & x); + + void from_json(const json & j, FieldInstance & x); + void to_json(json & j, const FieldInstance & x); + + void from_json(const json & j, EntityInstance & x); + void to_json(json & j, const EntityInstance & x); + + void from_json(const json & j, ReferenceToAnEntityInstance & x); + void to_json(json & j, const ReferenceToAnEntityInstance & x); + + void from_json(const json & j, GridPoint & x); + void to_json(json & j, const GridPoint & x); + + void from_json(const json & j, IntGridValueInstance & x); + void to_json(json & j, const IntGridValueInstance & x); + + void from_json(const json & j, TileInstance & x); + void to_json(json & j, const TileInstance & x); + + void from_json(const json & j, LayerInstance & x); + void to_json(json & j, const LayerInstance & x); + + void from_json(const json & j, LevelBackgroundPosition & x); + void to_json(json & j, const LevelBackgroundPosition & x); + + void from_json(const json & j, NeighbourLevel & x); + void to_json(json & j, const NeighbourLevel & x); + + void from_json(const json & j, Level & x); + void to_json(json & j, const Level & x); + + void from_json(const json & j, LdtkTableOfContentEntry & x); + void to_json(json & j, const LdtkTableOfContentEntry & x); + + void from_json(const json & j, World & x); + void to_json(json & j, const World & x); + + void from_json(const json & j, ForcedRefs & x); + void to_json(json & j, const ForcedRefs & x); + + void from_json(const json & j, LdtkJson & x); + void to_json(json & j, const LdtkJson & x); + + void from_json(const json & j, When & x); + void to_json(json & j, const When & x); + + void from_json(const json & j, AllowedRefs & x); + void to_json(json & j, const AllowedRefs & x); + + void from_json(const json & j, EditorDisplayMode & x); + void to_json(json & j, const EditorDisplayMode & x); + + void from_json(const json & j, EditorDisplayPos & x); + void to_json(json & j, const EditorDisplayPos & x); + + void from_json(const json & j, EditorLinkStyle & x); + void to_json(json & j, const EditorLinkStyle & x); + + void from_json(const json & j, TextLanguageMode & x); + void to_json(json & j, const TextLanguageMode & x); + + void from_json(const json & j, LimitBehavior & x); + void to_json(json & j, const LimitBehavior & x); + + void from_json(const json & j, LimitScope & x); + void to_json(json & j, const LimitScope & x); + + void from_json(const json & j, RenderMode & x); + void to_json(json & j, const RenderMode & x); + + void from_json(const json & j, TileRenderMode & x); + void to_json(json & j, const TileRenderMode & x); + + void from_json(const json & j, Checker & x); + void to_json(json & j, const Checker & x); + + void from_json(const json & j, TileMode & x); + void to_json(json & j, const TileMode & x); + + void from_json(const json & j, Type & x); + void to_json(json & j, const Type & x); + + void from_json(const json & j, EmbedAtlas & x); + void to_json(json & j, const EmbedAtlas & x); + + void from_json(const json & j, Flag & x); + void to_json(json & j, const Flag & x); + + void from_json(const json & j, BgPos & x); + void to_json(json & j, const BgPos & x); + + void from_json(const json & j, WorldLayout & x); + void to_json(json & j, const WorldLayout & x); + + void from_json(const json & j, IdentifierStyle & x); + void to_json(json & j, const IdentifierStyle & x); + + void from_json(const json & j, ImageExportMode & x); + void to_json(json & j, const ImageExportMode & x); + + inline void from_json(const json & j, LdtkCustomCommand& x) { + x.set_command(j.at("command").get()); + x.set_when(j.at("when").get()); + } + + inline void to_json(json & j, const LdtkCustomCommand & x) { + j = json::object(); + j["command"] = x.get_command(); + j["when"] = x.get_when(); + } + + inline void from_json(const json & j, FieldDefinition& x) { + x.set_type(j.at("__type").get()); + x.set_accept_file_types(get_stack_optional>(j, "acceptFileTypes")); + x.set_allowed_refs(j.at("allowedRefs").get()); + x.set_allowed_refs_entity_uid(get_stack_optional(j, "allowedRefsEntityUid")); + x.set_allowed_ref_tags(j.at("allowedRefTags").get>()); + x.set_allow_out_of_level_ref(j.at("allowOutOfLevelRef").get()); + x.set_array_max_length(get_stack_optional(j, "arrayMaxLength")); + x.set_array_min_length(get_stack_optional(j, "arrayMinLength")); + x.set_auto_chain_ref(j.at("autoChainRef").get()); + x.set_can_be_null(j.at("canBeNull").get()); + x.set_default_override(get_untyped(j, "defaultOverride")); + x.set_doc(get_stack_optional(j, "doc")); + x.set_editor_always_show(j.at("editorAlwaysShow").get()); + x.set_editor_cut_long_values(j.at("editorCutLongValues").get()); + x.set_editor_display_color(get_stack_optional(j, "editorDisplayColor")); + x.set_editor_display_mode(j.at("editorDisplayMode").get()); + x.set_editor_display_pos(j.at("editorDisplayPos").get()); + x.set_editor_display_scale(j.at("editorDisplayScale").get()); + x.set_editor_link_style(j.at("editorLinkStyle").get()); + x.set_editor_show_in_world(j.at("editorShowInWorld").get()); + x.set_editor_text_prefix(get_stack_optional(j, "editorTextPrefix")); + x.set_editor_text_suffix(get_stack_optional(j, "editorTextSuffix")); + x.set_identifier(j.at("identifier").get()); + x.set_is_array(j.at("isArray").get()); + x.set_max(get_stack_optional(j, "max")); + x.set_min(get_stack_optional(j, "min")); + x.set_regex(get_stack_optional(j, "regex")); + x.set_symmetrical_ref(j.at("symmetricalRef").get()); + x.set_text_language_mode(get_stack_optional(j, "textLanguageMode")); + x.set_tileset_uid(get_stack_optional(j, "tilesetUid")); + x.set_field_definition_type(j.at("type").get()); + x.set_uid(j.at("uid").get()); + x.set_use_for_smart_color(j.at("useForSmartColor").get()); + } + + inline void to_json(json & j, const FieldDefinition & x) { + j = json::object(); + j["__type"] = x.get_type(); + j["acceptFileTypes"] = x.get_accept_file_types(); + j["allowedRefs"] = x.get_allowed_refs(); + j["allowedRefsEntityUid"] = x.get_allowed_refs_entity_uid(); + j["allowedRefTags"] = x.get_allowed_ref_tags(); + j["allowOutOfLevelRef"] = x.get_allow_out_of_level_ref(); + j["arrayMaxLength"] = x.get_array_max_length(); + j["arrayMinLength"] = x.get_array_min_length(); + j["autoChainRef"] = x.get_auto_chain_ref(); + j["canBeNull"] = x.get_can_be_null(); + j["defaultOverride"] = x.get_default_override(); + j["doc"] = x.get_doc(); + j["editorAlwaysShow"] = x.get_editor_always_show(); + j["editorCutLongValues"] = x.get_editor_cut_long_values(); + j["editorDisplayColor"] = x.get_editor_display_color(); + j["editorDisplayMode"] = x.get_editor_display_mode(); + j["editorDisplayPos"] = x.get_editor_display_pos(); + j["editorDisplayScale"] = x.get_editor_display_scale(); + j["editorLinkStyle"] = x.get_editor_link_style(); + j["editorShowInWorld"] = x.get_editor_show_in_world(); + j["editorTextPrefix"] = x.get_editor_text_prefix(); + j["editorTextSuffix"] = x.get_editor_text_suffix(); + j["identifier"] = x.get_identifier(); + j["isArray"] = x.get_is_array(); + j["max"] = x.get_max(); + j["min"] = x.get_min(); + j["regex"] = x.get_regex(); + j["symmetricalRef"] = x.get_symmetrical_ref(); + j["textLanguageMode"] = x.get_text_language_mode(); + j["tilesetUid"] = x.get_tileset_uid(); + j["type"] = x.get_field_definition_type(); + j["uid"] = x.get_uid(); + j["useForSmartColor"] = x.get_use_for_smart_color(); + } + + inline void from_json(const json & j, TilesetRectangle& x) { + x.set_h(j.at("h").get()); + x.set_tileset_uid(j.at("tilesetUid").get()); + x.set_w(j.at("w").get()); + x.set_x(j.at("x").get()); + x.set_y(j.at("y").get()); + } + + inline void to_json(json & j, const TilesetRectangle & x) { + j = json::object(); + j["h"] = x.get_h(); + j["tilesetUid"] = x.get_tileset_uid(); + j["w"] = x.get_w(); + j["x"] = x.get_x(); + j["y"] = x.get_y(); + } + + inline void from_json(const json & j, EntityDefinition& x) { + x.set_color(j.at("color").get()); + x.set_doc(get_stack_optional(j, "doc")); + x.set_export_to_toc(j.at("exportToToc").get()); + x.set_field_defs(j.at("fieldDefs").get>()); + x.set_fill_opacity(j.at("fillOpacity").get()); + x.set_height(j.at("height").get()); + x.set_hollow(j.at("hollow").get()); + x.set_identifier(j.at("identifier").get()); + x.set_keep_aspect_ratio(j.at("keepAspectRatio").get()); + x.set_limit_behavior(j.at("limitBehavior").get()); + x.set_limit_scope(j.at("limitScope").get()); + x.set_line_opacity(j.at("lineOpacity").get()); + x.set_max_count(j.at("maxCount").get()); + x.set_max_height(get_stack_optional(j, "maxHeight")); + x.set_max_width(get_stack_optional(j, "maxWidth")); + x.set_min_height(get_stack_optional(j, "minHeight")); + x.set_min_width(get_stack_optional(j, "minWidth")); + x.set_nine_slice_borders(j.at("nineSliceBorders").get>()); + x.set_pivot_x(j.at("pivotX").get()); + x.set_pivot_y(j.at("pivotY").get()); + x.set_render_mode(j.at("renderMode").get()); + x.set_resizable_x(j.at("resizableX").get()); + x.set_resizable_y(j.at("resizableY").get()); + x.set_show_name(j.at("showName").get()); + x.set_tags(j.at("tags").get>()); + x.set_tile_id(get_stack_optional(j, "tileId")); + x.set_tile_opacity(j.at("tileOpacity").get()); + x.set_tile_rect(get_stack_optional(j, "tileRect")); + x.set_tile_render_mode(j.at("tileRenderMode").get()); + x.set_tileset_id(get_stack_optional(j, "tilesetId")); + x.set_uid(j.at("uid").get()); + x.set_width(j.at("width").get()); + } + + inline void to_json(json & j, const EntityDefinition & x) { + j = json::object(); + j["color"] = x.get_color(); + j["doc"] = x.get_doc(); + j["exportToToc"] = x.get_export_to_toc(); + j["fieldDefs"] = x.get_field_defs(); + j["fillOpacity"] = x.get_fill_opacity(); + j["height"] = x.get_height(); + j["hollow"] = x.get_hollow(); + j["identifier"] = x.get_identifier(); + j["keepAspectRatio"] = x.get_keep_aspect_ratio(); + j["limitBehavior"] = x.get_limit_behavior(); + j["limitScope"] = x.get_limit_scope(); + j["lineOpacity"] = x.get_line_opacity(); + j["maxCount"] = x.get_max_count(); + j["maxHeight"] = x.get_max_height(); + j["maxWidth"] = x.get_max_width(); + j["minHeight"] = x.get_min_height(); + j["minWidth"] = x.get_min_width(); + j["nineSliceBorders"] = x.get_nine_slice_borders(); + j["pivotX"] = x.get_pivot_x(); + j["pivotY"] = x.get_pivot_y(); + j["renderMode"] = x.get_render_mode(); + j["resizableX"] = x.get_resizable_x(); + j["resizableY"] = x.get_resizable_y(); + j["showName"] = x.get_show_name(); + j["tags"] = x.get_tags(); + j["tileId"] = x.get_tile_id(); + j["tileOpacity"] = x.get_tile_opacity(); + j["tileRect"] = x.get_tile_rect(); + j["tileRenderMode"] = x.get_tile_render_mode(); + j["tilesetId"] = x.get_tileset_id(); + j["uid"] = x.get_uid(); + j["width"] = x.get_width(); + } + + inline void from_json(const json & j, EnumValueDefinition& x) { + x.set_tile_src_rect(get_stack_optional>(j, "__tileSrcRect")); + x.set_color(j.at("color").get()); + x.set_id(j.at("id").get()); + x.set_tile_id(get_stack_optional(j, "tileId")); + x.set_tile_rect(get_stack_optional(j, "tileRect")); + } + + inline void to_json(json & j, const EnumValueDefinition & x) { + j = json::object(); + j["__tileSrcRect"] = x.get_tile_src_rect(); + j["color"] = x.get_color(); + j["id"] = x.get_id(); + j["tileId"] = x.get_tile_id(); + j["tileRect"] = x.get_tile_rect(); + } + + inline void from_json(const json & j, EnumDefinition& x) { + x.set_external_file_checksum(get_stack_optional(j, "externalFileChecksum")); + x.set_external_rel_path(get_stack_optional(j, "externalRelPath")); + x.set_icon_tileset_uid(get_stack_optional(j, "iconTilesetUid")); + x.set_identifier(j.at("identifier").get()); + x.set_tags(j.at("tags").get>()); + x.set_uid(j.at("uid").get()); + x.set_values(j.at("values").get>()); + } + + inline void to_json(json & j, const EnumDefinition & x) { + j = json::object(); + j["externalFileChecksum"] = x.get_external_file_checksum(); + j["externalRelPath"] = x.get_external_rel_path(); + j["iconTilesetUid"] = x.get_icon_tileset_uid(); + j["identifier"] = x.get_identifier(); + j["tags"] = x.get_tags(); + j["uid"] = x.get_uid(); + j["values"] = x.get_values(); + } + + inline void from_json(const json & j, AutoLayerRuleDefinition& x) { + x.set_active(j.at("active").get()); + x.set_alpha(j.at("alpha").get()); + x.set_break_on_match(j.at("breakOnMatch").get()); + x.set_chance(j.at("chance").get()); + x.set_checker(j.at("checker").get()); + x.set_flip_x(j.at("flipX").get()); + x.set_flip_y(j.at("flipY").get()); + x.set_out_of_bounds_value(get_stack_optional(j, "outOfBoundsValue")); + x.set_pattern(j.at("pattern").get>()); + x.set_perlin_active(j.at("perlinActive").get()); + x.set_perlin_octaves(j.at("perlinOctaves").get()); + x.set_perlin_scale(j.at("perlinScale").get()); + x.set_perlin_seed(j.at("perlinSeed").get()); + x.set_pivot_x(j.at("pivotX").get()); + x.set_pivot_y(j.at("pivotY").get()); + x.set_size(j.at("size").get()); + x.set_tile_ids(j.at("tileIds").get>()); + x.set_tile_mode(j.at("tileMode").get()); + x.set_tile_random_x_max(j.at("tileRandomXMax").get()); + x.set_tile_random_x_min(j.at("tileRandomXMin").get()); + x.set_tile_random_y_max(j.at("tileRandomYMax").get()); + x.set_tile_random_y_min(j.at("tileRandomYMin").get()); + x.set_tile_x_offset(j.at("tileXOffset").get()); + x.set_tile_y_offset(j.at("tileYOffset").get()); + x.set_uid(j.at("uid").get()); + x.set_x_modulo(j.at("xModulo").get()); + x.set_x_offset(j.at("xOffset").get()); + x.set_y_modulo(j.at("yModulo").get()); + x.set_y_offset(j.at("yOffset").get()); + } + + inline void to_json(json & j, const AutoLayerRuleDefinition & x) { + j = json::object(); + j["active"] = x.get_active(); + j["alpha"] = x.get_alpha(); + j["breakOnMatch"] = x.get_break_on_match(); + j["chance"] = x.get_chance(); + j["checker"] = x.get_checker(); + j["flipX"] = x.get_flip_x(); + j["flipY"] = x.get_flip_y(); + j["outOfBoundsValue"] = x.get_out_of_bounds_value(); + j["pattern"] = x.get_pattern(); + j["perlinActive"] = x.get_perlin_active(); + j["perlinOctaves"] = x.get_perlin_octaves(); + j["perlinScale"] = x.get_perlin_scale(); + j["perlinSeed"] = x.get_perlin_seed(); + j["pivotX"] = x.get_pivot_x(); + j["pivotY"] = x.get_pivot_y(); + j["size"] = x.get_size(); + j["tileIds"] = x.get_tile_ids(); + j["tileMode"] = x.get_tile_mode(); + j["tileRandomXMax"] = x.get_tile_random_x_max(); + j["tileRandomXMin"] = x.get_tile_random_x_min(); + j["tileRandomYMax"] = x.get_tile_random_y_max(); + j["tileRandomYMin"] = x.get_tile_random_y_min(); + j["tileXOffset"] = x.get_tile_x_offset(); + j["tileYOffset"] = x.get_tile_y_offset(); + j["uid"] = x.get_uid(); + j["xModulo"] = x.get_x_modulo(); + j["xOffset"] = x.get_x_offset(); + j["yModulo"] = x.get_y_modulo(); + j["yOffset"] = x.get_y_offset(); + } + + inline void from_json(const json & j, AutoLayerRuleGroup& x) { + x.set_active(j.at("active").get()); + x.set_collapsed(get_stack_optional(j, "collapsed")); + x.set_is_optional(j.at("isOptional").get()); + x.set_name(j.at("name").get()); + x.set_rules(j.at("rules").get>()); + x.set_uid(j.at("uid").get()); + x.set_uses_wizard(j.at("usesWizard").get()); + } + + inline void to_json(json & j, const AutoLayerRuleGroup & x) { + j = json::object(); + j["active"] = x.get_active(); + j["collapsed"] = x.get_collapsed(); + j["isOptional"] = x.get_is_optional(); + j["name"] = x.get_name(); + j["rules"] = x.get_rules(); + j["uid"] = x.get_uid(); + j["usesWizard"] = x.get_uses_wizard(); + } + + inline void from_json(const json & j, IntGridValueDefinition& x) { + x.set_color(j.at("color").get()); + x.set_identifier(get_stack_optional(j, "identifier")); + x.set_tile(get_stack_optional(j, "tile")); + x.set_value(j.at("value").get()); + } + + inline void to_json(json & j, const IntGridValueDefinition & x) { + j = json::object(); + j["color"] = x.get_color(); + j["identifier"] = x.get_identifier(); + j["tile"] = x.get_tile(); + j["value"] = x.get_value(); + } + + inline void from_json(const json & j, LayerDefinition& x) { + x.set_type(j.at("__type").get()); + x.set_auto_rule_groups(j.at("autoRuleGroups").get>()); + x.set_auto_source_layer_def_uid(get_stack_optional(j, "autoSourceLayerDefUid")); + x.set_auto_tileset_def_uid(get_stack_optional(j, "autoTilesetDefUid")); + x.set_can_select_when_inactive(j.at("canSelectWhenInactive").get()); + x.set_display_opacity(j.at("displayOpacity").get()); + x.set_doc(get_stack_optional(j, "doc")); + x.set_excluded_tags(j.at("excludedTags").get>()); + x.set_grid_size(j.at("gridSize").get()); + x.set_guide_grid_hei(j.at("guideGridHei").get()); + x.set_guide_grid_wid(j.at("guideGridWid").get()); + x.set_hide_fields_when_inactive(j.at("hideFieldsWhenInactive").get()); + x.set_hide_in_list(j.at("hideInList").get()); + x.set_identifier(j.at("identifier").get()); + x.set_inactive_opacity(j.at("inactiveOpacity").get()); + x.set_int_grid_values(j.at("intGridValues").get>()); + x.set_parallax_factor_x(j.at("parallaxFactorX").get()); + x.set_parallax_factor_y(j.at("parallaxFactorY").get()); + x.set_parallax_scaling(j.at("parallaxScaling").get()); + x.set_px_offset_x(j.at("pxOffsetX").get()); + x.set_px_offset_y(j.at("pxOffsetY").get()); + x.set_render_in_world_view(j.at("renderInWorldView").get()); + x.set_required_tags(j.at("requiredTags").get>()); + x.set_tile_pivot_x(j.at("tilePivotX").get()); + x.set_tile_pivot_y(j.at("tilePivotY").get()); + x.set_tileset_def_uid(get_stack_optional(j, "tilesetDefUid")); + x.set_layer_definition_type(j.at("type").get()); + x.set_ui_color(get_stack_optional(j, "uiColor")); + x.set_uid(j.at("uid").get()); + } + + inline void to_json(json & j, const LayerDefinition & x) { + j = json::object(); + j["__type"] = x.get_type(); + j["autoRuleGroups"] = x.get_auto_rule_groups(); + j["autoSourceLayerDefUid"] = x.get_auto_source_layer_def_uid(); + j["autoTilesetDefUid"] = x.get_auto_tileset_def_uid(); + j["canSelectWhenInactive"] = x.get_can_select_when_inactive(); + j["displayOpacity"] = x.get_display_opacity(); + j["doc"] = x.get_doc(); + j["excludedTags"] = x.get_excluded_tags(); + j["gridSize"] = x.get_grid_size(); + j["guideGridHei"] = x.get_guide_grid_hei(); + j["guideGridWid"] = x.get_guide_grid_wid(); + j["hideFieldsWhenInactive"] = x.get_hide_fields_when_inactive(); + j["hideInList"] = x.get_hide_in_list(); + j["identifier"] = x.get_identifier(); + j["inactiveOpacity"] = x.get_inactive_opacity(); + j["intGridValues"] = x.get_int_grid_values(); + j["parallaxFactorX"] = x.get_parallax_factor_x(); + j["parallaxFactorY"] = x.get_parallax_factor_y(); + j["parallaxScaling"] = x.get_parallax_scaling(); + j["pxOffsetX"] = x.get_px_offset_x(); + j["pxOffsetY"] = x.get_px_offset_y(); + j["renderInWorldView"] = x.get_render_in_world_view(); + j["requiredTags"] = x.get_required_tags(); + j["tilePivotX"] = x.get_tile_pivot_x(); + j["tilePivotY"] = x.get_tile_pivot_y(); + j["tilesetDefUid"] = x.get_tileset_def_uid(); + j["type"] = x.get_layer_definition_type(); + j["uiColor"] = x.get_ui_color(); + j["uid"] = x.get_uid(); + } + + inline void from_json(const json & j, TileCustomMetadata& x) { + x.set_data(j.at("data").get()); + x.set_tile_id(j.at("tileId").get()); + } + + inline void to_json(json & j, const TileCustomMetadata & x) { + j = json::object(); + j["data"] = x.get_data(); + j["tileId"] = x.get_tile_id(); + } + + inline void from_json(const json & j, EnumTagValue& x) { + x.set_enum_value_id(j.at("enumValueId").get()); + x.set_tile_ids(j.at("tileIds").get>()); + } + + inline void to_json(json & j, const EnumTagValue & x) { + j = json::object(); + j["enumValueId"] = x.get_enum_value_id(); + j["tileIds"] = x.get_tile_ids(); + } + + inline void from_json(const json & j, TilesetDefinition& x) { + x.set_c_hei(j.at("__cHei").get()); + x.set_c_wid(j.at("__cWid").get()); + x.set_cached_pixel_data(get_stack_optional>(j, "cachedPixelData")); + x.set_custom_data(j.at("customData").get>()); + x.set_embed_atlas(get_stack_optional(j, "embedAtlas")); + x.set_enum_tags(j.at("enumTags").get>()); + x.set_identifier(j.at("identifier").get()); + x.set_padding(j.at("padding").get()); + x.set_px_hei(j.at("pxHei").get()); + x.set_px_wid(j.at("pxWid").get()); + x.set_rel_path(get_stack_optional(j, "relPath")); + x.set_saved_selections(j.at("savedSelections").get>>()); + x.set_spacing(j.at("spacing").get()); + x.set_tags(j.at("tags").get>()); + x.set_tags_source_enum_uid(get_stack_optional(j, "tagsSourceEnumUid")); + x.set_tile_grid_size(j.at("tileGridSize").get()); + x.set_uid(j.at("uid").get()); + } + + inline void to_json(json & j, const TilesetDefinition & x) { + j = json::object(); + j["__cHei"] = x.get_c_hei(); + j["__cWid"] = x.get_c_wid(); + j["cachedPixelData"] = x.get_cached_pixel_data(); + j["customData"] = x.get_custom_data(); + j["embedAtlas"] = x.get_embed_atlas(); + j["enumTags"] = x.get_enum_tags(); + j["identifier"] = x.get_identifier(); + j["padding"] = x.get_padding(); + j["pxHei"] = x.get_px_hei(); + j["pxWid"] = x.get_px_wid(); + j["relPath"] = x.get_rel_path(); + j["savedSelections"] = x.get_saved_selections(); + j["spacing"] = x.get_spacing(); + j["tags"] = x.get_tags(); + j["tagsSourceEnumUid"] = x.get_tags_source_enum_uid(); + j["tileGridSize"] = x.get_tile_grid_size(); + j["uid"] = x.get_uid(); + } + + inline void from_json(const json & j, Definitions& x) { + x.set_entities(j.at("entities").get>()); + x.set_enums(j.at("enums").get>()); + x.set_external_enums(j.at("externalEnums").get>()); + x.set_layers(j.at("layers").get>()); + x.set_level_fields(j.at("levelFields").get>()); + x.set_tilesets(j.at("tilesets").get>()); + } + + inline void to_json(json & j, const Definitions & x) { + j = json::object(); + j["entities"] = x.get_entities(); + j["enums"] = x.get_enums(); + j["externalEnums"] = x.get_external_enums(); + j["layers"] = x.get_layers(); + j["levelFields"] = x.get_level_fields(); + j["tilesets"] = x.get_tilesets(); + } + + inline void from_json(const json & j, FieldInstance& x) { + x.set_identifier(j.at("__identifier").get()); + x.set_tile(get_stack_optional(j, "__tile")); + x.set_type(j.at("__type").get()); + x.set_value(get_untyped(j, "__value")); + x.set_def_uid(j.at("defUid").get()); + x.set_real_editor_values(j.at("realEditorValues").get>()); + } + + inline void to_json(json & j, const FieldInstance & x) { + j = json::object(); + j["__identifier"] = x.get_identifier(); + j["__tile"] = x.get_tile(); + j["__type"] = x.get_type(); + j["__value"] = x.get_value(); + j["defUid"] = x.get_def_uid(); + j["realEditorValues"] = x.get_real_editor_values(); + } + + inline void from_json(const json & j, EntityInstance& x) { + x.set_grid(j.at("__grid").get>()); + x.set_identifier(j.at("__identifier").get()); + x.set_pivot(j.at("__pivot").get>()); + x.set_smart_color(j.at("__smartColor").get()); + x.set_tags(j.at("__tags").get>()); + x.set_tile(get_stack_optional(j, "__tile")); + x.set_world_x(j.at("__worldX").get()); + x.set_world_y(j.at("__worldY").get()); + x.set_def_uid(j.at("defUid").get()); + x.set_field_instances(j.at("fieldInstances").get>()); + x.set_height(j.at("height").get()); + x.set_iid(j.at("iid").get()); + x.set_px(j.at("px").get>()); + x.set_width(j.at("width").get()); + } + + inline void to_json(json & j, const EntityInstance & x) { + j = json::object(); + j["__grid"] = x.get_grid(); + j["__identifier"] = x.get_identifier(); + j["__pivot"] = x.get_pivot(); + j["__smartColor"] = x.get_smart_color(); + j["__tags"] = x.get_tags(); + j["__tile"] = x.get_tile(); + j["__worldX"] = x.get_world_x(); + j["__worldY"] = x.get_world_y(); + j["defUid"] = x.get_def_uid(); + j["fieldInstances"] = x.get_field_instances(); + j["height"] = x.get_height(); + j["iid"] = x.get_iid(); + j["px"] = x.get_px(); + j["width"] = x.get_width(); + } + + inline void from_json(const json & j, ReferenceToAnEntityInstance& x) { + x.set_entity_iid(j.at("entityIid").get()); + x.set_layer_iid(j.at("layerIid").get()); + x.set_level_iid(j.at("levelIid").get()); + x.set_world_iid(j.at("worldIid").get()); + } + + inline void to_json(json & j, const ReferenceToAnEntityInstance & x) { + j = json::object(); + j["entityIid"] = x.get_entity_iid(); + j["layerIid"] = x.get_layer_iid(); + j["levelIid"] = x.get_level_iid(); + j["worldIid"] = x.get_world_iid(); + } + + inline void from_json(const json & j, GridPoint& x) { + x.set_cx(j.at("cx").get()); + x.set_cy(j.at("cy").get()); + } + + inline void to_json(json & j, const GridPoint & x) { + j = json::object(); + j["cx"] = x.get_cx(); + j["cy"] = x.get_cy(); + } + + inline void from_json(const json & j, IntGridValueInstance& x) { + x.set_coord_id(j.at("coordId").get()); + x.set_v(j.at("v").get()); + } + + inline void to_json(json & j, const IntGridValueInstance & x) { + j = json::object(); + j["coordId"] = x.get_coord_id(); + j["v"] = x.get_v(); + } + + inline void from_json(const json & j, TileInstance& x) { + x.set_a(j.at("a").get()); + x.set_d(j.at("d").get>()); + x.set_f(j.at("f").get()); + x.set_px(j.at("px").get>()); + x.set_src(j.at("src").get>()); + x.set_t(j.at("t").get()); + } + + inline void to_json(json & j, const TileInstance & x) { + j = json::object(); + j["a"] = x.get_a(); + j["d"] = x.get_d(); + j["f"] = x.get_f(); + j["px"] = x.get_px(); + j["src"] = x.get_src(); + j["t"] = x.get_t(); + } + + inline void from_json(const json & j, LayerInstance& x) { + x.set_c_hei(j.at("__cHei").get()); + x.set_c_wid(j.at("__cWid").get()); + x.set_grid_size(j.at("__gridSize").get()); + x.set_identifier(j.at("__identifier").get()); + x.set_opacity(j.at("__opacity").get()); + x.set_px_total_offset_x(j.at("__pxTotalOffsetX").get()); + x.set_px_total_offset_y(j.at("__pxTotalOffsetY").get()); + x.set_tileset_def_uid(get_stack_optional(j, "__tilesetDefUid")); + x.set_tileset_rel_path(get_stack_optional(j, "__tilesetRelPath")); + x.set_type(j.at("__type").get()); + x.set_auto_layer_tiles(j.at("autoLayerTiles").get>()); + x.set_entity_instances(j.at("entityInstances").get>()); + x.set_grid_tiles(j.at("gridTiles").get>()); + x.set_iid(j.at("iid").get()); + x.set_int_grid(get_stack_optional>(j, "intGrid")); + x.set_int_grid_csv(j.at("intGridCsv").get>()); + x.set_layer_def_uid(j.at("layerDefUid").get()); + x.set_level_id(j.at("levelId").get()); + x.set_optional_rules(j.at("optionalRules").get>()); + x.set_override_tileset_uid(get_stack_optional(j, "overrideTilesetUid")); + x.set_px_offset_x(j.at("pxOffsetX").get()); + x.set_px_offset_y(j.at("pxOffsetY").get()); + x.set_seed(j.at("seed").get()); + x.set_visible(j.at("visible").get()); + } + + inline void to_json(json & j, const LayerInstance & x) { + j = json::object(); + j["__cHei"] = x.get_c_hei(); + j["__cWid"] = x.get_c_wid(); + j["__gridSize"] = x.get_grid_size(); + j["__identifier"] = x.get_identifier(); + j["__opacity"] = x.get_opacity(); + j["__pxTotalOffsetX"] = x.get_px_total_offset_x(); + j["__pxTotalOffsetY"] = x.get_px_total_offset_y(); + j["__tilesetDefUid"] = x.get_tileset_def_uid(); + j["__tilesetRelPath"] = x.get_tileset_rel_path(); + j["__type"] = x.get_type(); + j["autoLayerTiles"] = x.get_auto_layer_tiles(); + j["entityInstances"] = x.get_entity_instances(); + j["gridTiles"] = x.get_grid_tiles(); + j["iid"] = x.get_iid(); + j["intGrid"] = x.get_int_grid(); + j["intGridCsv"] = x.get_int_grid_csv(); + j["layerDefUid"] = x.get_layer_def_uid(); + j["levelId"] = x.get_level_id(); + j["optionalRules"] = x.get_optional_rules(); + j["overrideTilesetUid"] = x.get_override_tileset_uid(); + j["pxOffsetX"] = x.get_px_offset_x(); + j["pxOffsetY"] = x.get_px_offset_y(); + j["seed"] = x.get_seed(); + j["visible"] = x.get_visible(); + } + + inline void from_json(const json & j, LevelBackgroundPosition& x) { + x.set_crop_rect(j.at("cropRect").get>()); + x.set_scale(j.at("scale").get>()); + x.set_top_left_px(j.at("topLeftPx").get>()); + } + + inline void to_json(json & j, const LevelBackgroundPosition & x) { + j = json::object(); + j["cropRect"] = x.get_crop_rect(); + j["scale"] = x.get_scale(); + j["topLeftPx"] = x.get_top_left_px(); + } + + inline void from_json(const json & j, NeighbourLevel& x) { + x.set_dir(j.at("dir").get()); + x.set_level_iid(j.at("levelIid").get()); + x.set_level_uid(get_stack_optional(j, "levelUid")); + } + + inline void to_json(json & j, const NeighbourLevel & x) { + j = json::object(); + j["dir"] = x.get_dir(); + j["levelIid"] = x.get_level_iid(); + j["levelUid"] = x.get_level_uid(); + } + + inline void from_json(const json & j, Level& x) { + x.set_bg_color(j.at("__bgColor").get()); + x.set_bg_pos(get_stack_optional(j, "__bgPos")); + x.set_neighbours(j.at("__neighbours").get>()); + x.set_smart_color(j.at("__smartColor").get()); + x.set_level_bg_color(get_stack_optional(j, "bgColor")); + x.set_bg_pivot_x(j.at("bgPivotX").get()); + x.set_bg_pivot_y(j.at("bgPivotY").get()); + x.set_level_bg_pos(get_stack_optional(j, "bgPos")); + x.set_bg_rel_path(get_stack_optional(j, "bgRelPath")); + x.set_external_rel_path(get_stack_optional(j, "externalRelPath")); + x.set_field_instances(j.at("fieldInstances").get>()); + x.set_identifier(j.at("identifier").get()); + x.set_iid(j.at("iid").get()); + x.set_layer_instances(get_stack_optional>(j, "layerInstances")); + x.set_px_hei(j.at("pxHei").get()); + x.set_px_wid(j.at("pxWid").get()); + x.set_uid(j.at("uid").get()); + x.set_use_auto_identifier(j.at("useAutoIdentifier").get()); + x.set_world_depth(j.at("worldDepth").get()); + x.set_world_x(j.at("worldX").get()); + x.set_world_y(j.at("worldY").get()); + } + + inline void to_json(json & j, const Level & x) { + j = json::object(); + j["__bgColor"] = x.get_bg_color(); + j["__bgPos"] = x.get_bg_pos(); + j["__neighbours"] = x.get_neighbours(); + j["__smartColor"] = x.get_smart_color(); + j["bgColor"] = x.get_level_bg_color(); + j["bgPivotX"] = x.get_bg_pivot_x(); + j["bgPivotY"] = x.get_bg_pivot_y(); + j["bgPos"] = x.get_level_bg_pos(); + j["bgRelPath"] = x.get_bg_rel_path(); + j["externalRelPath"] = x.get_external_rel_path(); + j["fieldInstances"] = x.get_field_instances(); + j["identifier"] = x.get_identifier(); + j["iid"] = x.get_iid(); + j["layerInstances"] = x.get_layer_instances(); + j["pxHei"] = x.get_px_hei(); + j["pxWid"] = x.get_px_wid(); + j["uid"] = x.get_uid(); + j["useAutoIdentifier"] = x.get_use_auto_identifier(); + j["worldDepth"] = x.get_world_depth(); + j["worldX"] = x.get_world_x(); + j["worldY"] = x.get_world_y(); + } + + inline void from_json(const json & j, LdtkTableOfContentEntry& x) { + x.set_identifier(j.at("identifier").get()); + x.set_instances(j.at("instances").get>()); + } + + inline void to_json(json & j, const LdtkTableOfContentEntry & x) { + j = json::object(); + j["identifier"] = x.get_identifier(); + j["instances"] = x.get_instances(); + } + + inline void from_json(const json & j, World& x) { + x.set_default_level_height(j.at("defaultLevelHeight").get()); + x.set_default_level_width(j.at("defaultLevelWidth").get()); + x.set_identifier(j.at("identifier").get()); + x.set_iid(j.at("iid").get()); + x.set_levels(j.at("levels").get>()); + x.set_world_grid_height(j.at("worldGridHeight").get()); + x.set_world_grid_width(j.at("worldGridWidth").get()); + x.set_world_layout(get_stack_optional(j, "worldLayout")); + } + + inline void to_json(json & j, const World & x) { + j = json::object(); + j["defaultLevelHeight"] = x.get_default_level_height(); + j["defaultLevelWidth"] = x.get_default_level_width(); + j["identifier"] = x.get_identifier(); + j["iid"] = x.get_iid(); + j["levels"] = x.get_levels(); + j["worldGridHeight"] = x.get_world_grid_height(); + j["worldGridWidth"] = x.get_world_grid_width(); + j["worldLayout"] = x.get_world_layout(); + } + + inline void from_json(const json & j, ForcedRefs& x) { + x.set_auto_layer_rule_group(get_stack_optional(j, "AutoLayerRuleGroup")); + x.set_auto_rule_def(get_stack_optional(j, "AutoRuleDef")); + x.set_custom_command(get_stack_optional(j, "CustomCommand")); + x.set_definitions(get_stack_optional(j, "Definitions")); + x.set_entity_def(get_stack_optional(j, "EntityDef")); + x.set_entity_instance(get_stack_optional(j, "EntityInstance")); + x.set_entity_reference_infos(get_stack_optional(j, "EntityReferenceInfos")); + x.set_enum_def(get_stack_optional(j, "EnumDef")); + x.set_enum_def_values(get_stack_optional(j, "EnumDefValues")); + x.set_enum_tag_value(get_stack_optional(j, "EnumTagValue")); + x.set_field_def(get_stack_optional(j, "FieldDef")); + x.set_field_instance(get_stack_optional(j, "FieldInstance")); + x.set_grid_point(get_stack_optional(j, "GridPoint")); + x.set_int_grid_value_def(get_stack_optional(j, "IntGridValueDef")); + x.set_int_grid_value_instance(get_stack_optional(j, "IntGridValueInstance")); + x.set_layer_def(get_stack_optional(j, "LayerDef")); + x.set_layer_instance(get_stack_optional(j, "LayerInstance")); + x.set_level(get_stack_optional(j, "Level")); + x.set_level_bg_pos_infos(get_stack_optional(j, "LevelBgPosInfos")); + x.set_neighbour_level(get_stack_optional(j, "NeighbourLevel")); + x.set_table_of_content_entry(get_stack_optional(j, "TableOfContentEntry")); + x.set_tile(get_stack_optional(j, "Tile")); + x.set_tile_custom_metadata(get_stack_optional(j, "TileCustomMetadata")); + x.set_tileset_def(get_stack_optional(j, "TilesetDef")); + x.set_tileset_rect(get_stack_optional(j, "TilesetRect")); + x.set_world(get_stack_optional(j, "World")); + } + + inline void to_json(json & j, const ForcedRefs & x) { + j = json::object(); + j["AutoLayerRuleGroup"] = x.get_auto_layer_rule_group(); + j["AutoRuleDef"] = x.get_auto_rule_def(); + j["CustomCommand"] = x.get_custom_command(); + j["Definitions"] = x.get_definitions(); + j["EntityDef"] = x.get_entity_def(); + j["EntityInstance"] = x.get_entity_instance(); + j["EntityReferenceInfos"] = x.get_entity_reference_infos(); + j["EnumDef"] = x.get_enum_def(); + j["EnumDefValues"] = x.get_enum_def_values(); + j["EnumTagValue"] = x.get_enum_tag_value(); + j["FieldDef"] = x.get_field_def(); + j["FieldInstance"] = x.get_field_instance(); + j["GridPoint"] = x.get_grid_point(); + j["IntGridValueDef"] = x.get_int_grid_value_def(); + j["IntGridValueInstance"] = x.get_int_grid_value_instance(); + j["LayerDef"] = x.get_layer_def(); + j["LayerInstance"] = x.get_layer_instance(); + j["Level"] = x.get_level(); + j["LevelBgPosInfos"] = x.get_level_bg_pos_infos(); + j["NeighbourLevel"] = x.get_neighbour_level(); + j["TableOfContentEntry"] = x.get_table_of_content_entry(); + j["Tile"] = x.get_tile(); + j["TileCustomMetadata"] = x.get_tile_custom_metadata(); + j["TilesetDef"] = x.get_tileset_def(); + j["TilesetRect"] = x.get_tileset_rect(); + j["World"] = x.get_world(); + } + + inline void from_json(const json & j, LdtkJson& x) { + x.set_forced_refs(get_stack_optional(j, "__FORCED_REFS")); + x.set_app_build_id(j.at("appBuildId").get()); + x.set_backup_limit(j.at("backupLimit").get()); + x.set_backup_on_save(j.at("backupOnSave").get()); + x.set_backup_rel_path(get_stack_optional(j, "backupRelPath")); + x.set_bg_color(j.at("bgColor").get()); + x.set_custom_commands(j.at("customCommands").get>()); + x.set_default_entity_height(j.at("defaultEntityHeight").get()); + x.set_default_entity_width(j.at("defaultEntityWidth").get()); + x.set_default_grid_size(j.at("defaultGridSize").get()); + x.set_default_level_bg_color(j.at("defaultLevelBgColor").get()); + x.set_default_level_height(get_stack_optional(j, "defaultLevelHeight")); + x.set_default_level_width(get_stack_optional(j, "defaultLevelWidth")); + x.set_default_pivot_x(j.at("defaultPivotX").get()); + x.set_default_pivot_y(j.at("defaultPivotY").get()); + x.set_defs(j.at("defs").get()); + x.set_dummy_world_iid(j.at("dummyWorldIid").get()); + x.set_export_level_bg(j.at("exportLevelBg").get()); + x.set_export_png(get_stack_optional(j, "exportPng")); + x.set_export_tiled(j.at("exportTiled").get()); + x.set_external_levels(j.at("externalLevels").get()); + x.set_flags(j.at("flags").get>()); + x.set_identifier_style(j.at("identifierStyle").get()); + x.set_iid(j.at("iid").get()); + x.set_image_export_mode(j.at("imageExportMode").get()); + x.set_json_version(j.at("jsonVersion").get()); + x.set_level_name_pattern(j.at("levelNamePattern").get()); + x.set_levels(j.at("levels").get>()); + x.set_minify_json(j.at("minifyJson").get()); + x.set_next_uid(j.at("nextUid").get()); + x.set_png_file_pattern(get_stack_optional(j, "pngFilePattern")); + x.set_simplified_export(j.at("simplifiedExport").get()); + x.set_toc(j.at("toc").get>()); + x.set_tutorial_desc(get_stack_optional(j, "tutorialDesc")); + x.set_world_grid_height(get_stack_optional(j, "worldGridHeight")); + x.set_world_grid_width(get_stack_optional(j, "worldGridWidth")); + x.set_world_layout(get_stack_optional(j, "worldLayout")); + x.set_worlds(j.at("worlds").get>()); + } + + inline void to_json(json & j, const LdtkJson & x) { + j = json::object(); + j["__FORCED_REFS"] = x.get_forced_refs(); + j["appBuildId"] = x.get_app_build_id(); + j["backupLimit"] = x.get_backup_limit(); + j["backupOnSave"] = x.get_backup_on_save(); + j["backupRelPath"] = x.get_backup_rel_path(); + j["bgColor"] = x.get_bg_color(); + j["customCommands"] = x.get_custom_commands(); + j["defaultEntityHeight"] = x.get_default_entity_height(); + j["defaultEntityWidth"] = x.get_default_entity_width(); + j["defaultGridSize"] = x.get_default_grid_size(); + j["defaultLevelBgColor"] = x.get_default_level_bg_color(); + j["defaultLevelHeight"] = x.get_default_level_height(); + j["defaultLevelWidth"] = x.get_default_level_width(); + j["defaultPivotX"] = x.get_default_pivot_x(); + j["defaultPivotY"] = x.get_default_pivot_y(); + j["defs"] = x.get_defs(); + j["dummyWorldIid"] = x.get_dummy_world_iid(); + j["exportLevelBg"] = x.get_export_level_bg(); + j["exportPng"] = x.get_export_png(); + j["exportTiled"] = x.get_export_tiled(); + j["externalLevels"] = x.get_external_levels(); + j["flags"] = x.get_flags(); + j["identifierStyle"] = x.get_identifier_style(); + j["iid"] = x.get_iid(); + j["imageExportMode"] = x.get_image_export_mode(); + j["jsonVersion"] = x.get_json_version(); + j["levelNamePattern"] = x.get_level_name_pattern(); + j["levels"] = x.get_levels(); + j["minifyJson"] = x.get_minify_json(); + j["nextUid"] = x.get_next_uid(); + j["pngFilePattern"] = x.get_png_file_pattern(); + j["simplifiedExport"] = x.get_simplified_export(); + j["toc"] = x.get_toc(); + j["tutorialDesc"] = x.get_tutorial_desc(); + j["worldGridHeight"] = x.get_world_grid_height(); + j["worldGridWidth"] = x.get_world_grid_width(); + j["worldLayout"] = x.get_world_layout(); + j["worlds"] = x.get_worlds(); + } + + inline void from_json(const json & j, When & x) { + if (j == "AfterLoad") x = When::AFTER_LOAD; + else if (j == "AfterSave") x = When::AFTER_SAVE; + else if (j == "BeforeSave") x = When::BEFORE_SAVE; + else if (j == "Manual") x = When::MANUAL; + else { throw std::runtime_error("Input JSON does not conform to schema!"); } + } + + inline void to_json(json & j, const When & x) { + switch (x) { + case When::AFTER_LOAD: j = "AfterLoad"; break; + case When::AFTER_SAVE: j = "AfterSave"; break; + case When::BEFORE_SAVE: j = "BeforeSave"; break; + case When::MANUAL: j = "Manual"; break; + default: throw std::runtime_error("This should not happen"); + } + } + + inline void from_json(const json & j, AllowedRefs & x) { + if (j == "Any") x = AllowedRefs::ANY; + else if (j == "OnlySame") x = AllowedRefs::ONLY_SAME; + else if (j == "OnlySpecificEntity") x = AllowedRefs::ONLY_SPECIFIC_ENTITY; + else if (j == "OnlyTags") x = AllowedRefs::ONLY_TAGS; + else { throw std::runtime_error("Input JSON does not conform to schema!"); } + } + + inline void to_json(json & j, const AllowedRefs & x) { + switch (x) { + case AllowedRefs::ANY: j = "Any"; break; + case AllowedRefs::ONLY_SAME: j = "OnlySame"; break; + case AllowedRefs::ONLY_SPECIFIC_ENTITY: j = "OnlySpecificEntity"; break; + case AllowedRefs::ONLY_TAGS: j = "OnlyTags"; break; + default: throw std::runtime_error("This should not happen"); + } + } + + inline void from_json(const json & j, EditorDisplayMode & x) { + if (j == "ArrayCountNoLabel") x = EditorDisplayMode::ARRAY_COUNT_NO_LABEL; + else if (j == "ArrayCountWithLabel") x = EditorDisplayMode::ARRAY_COUNT_WITH_LABEL; + else if (j == "EntityTile") x = EditorDisplayMode::ENTITY_TILE; + else if (j == "Hidden") x = EditorDisplayMode::HIDDEN; + else if (j == "LevelTile") x = EditorDisplayMode::LEVEL_TILE; + else if (j == "NameAndValue") x = EditorDisplayMode::NAME_AND_VALUE; + else if (j == "Points") x = EditorDisplayMode::POINTS; + else if (j == "PointPath") x = EditorDisplayMode::POINT_PATH; + else if (j == "PointPathLoop") x = EditorDisplayMode::POINT_PATH_LOOP; + else if (j == "PointStar") x = EditorDisplayMode::POINT_STAR; + else if (j == "RadiusGrid") x = EditorDisplayMode::RADIUS_GRID; + else if (j == "RadiusPx") x = EditorDisplayMode::RADIUS_PX; + else if (j == "RefLinkBetweenCenters") x = EditorDisplayMode::REF_LINK_BETWEEN_CENTERS; + else if (j == "RefLinkBetweenPivots") x = EditorDisplayMode::REF_LINK_BETWEEN_PIVOTS; + else if (j == "ValueOnly") x = EditorDisplayMode::VALUE_ONLY; + else { throw std::runtime_error("Input JSON does not conform to schema!"); } + } + + inline void to_json(json & j, const EditorDisplayMode & x) { + switch (x) { + case EditorDisplayMode::ARRAY_COUNT_NO_LABEL: j = "ArrayCountNoLabel"; break; + case EditorDisplayMode::ARRAY_COUNT_WITH_LABEL: j = "ArrayCountWithLabel"; break; + case EditorDisplayMode::ENTITY_TILE: j = "EntityTile"; break; + case EditorDisplayMode::HIDDEN: j = "Hidden"; break; + case EditorDisplayMode::LEVEL_TILE: j = "LevelTile"; break; + case EditorDisplayMode::NAME_AND_VALUE: j = "NameAndValue"; break; + case EditorDisplayMode::POINTS: j = "Points"; break; + case EditorDisplayMode::POINT_PATH: j = "PointPath"; break; + case EditorDisplayMode::POINT_PATH_LOOP: j = "PointPathLoop"; break; + case EditorDisplayMode::POINT_STAR: j = "PointStar"; break; + case EditorDisplayMode::RADIUS_GRID: j = "RadiusGrid"; break; + case EditorDisplayMode::RADIUS_PX: j = "RadiusPx"; break; + case EditorDisplayMode::REF_LINK_BETWEEN_CENTERS: j = "RefLinkBetweenCenters"; break; + case EditorDisplayMode::REF_LINK_BETWEEN_PIVOTS: j = "RefLinkBetweenPivots"; break; + case EditorDisplayMode::VALUE_ONLY: j = "ValueOnly"; break; + default: throw std::runtime_error("This should not happen"); + } + } + + inline void from_json(const json & j, EditorDisplayPos & x) { + if (j == "Above") x = EditorDisplayPos::ABOVE; + else if (j == "Beneath") x = EditorDisplayPos::BENEATH; + else if (j == "Center") x = EditorDisplayPos::CENTER; + else { throw std::runtime_error("Input JSON does not conform to schema!"); } + } + + inline void to_json(json & j, const EditorDisplayPos & x) { + switch (x) { + case EditorDisplayPos::ABOVE: j = "Above"; break; + case EditorDisplayPos::BENEATH: j = "Beneath"; break; + case EditorDisplayPos::CENTER: j = "Center"; break; + default: throw std::runtime_error("This should not happen"); + } + } + + inline void from_json(const json & j, EditorLinkStyle & x) { + if (j == "ArrowsLine") x = EditorLinkStyle::ARROWS_LINE; + else if (j == "CurvedArrow") x = EditorLinkStyle::CURVED_ARROW; + else if (j == "DashedLine") x = EditorLinkStyle::DASHED_LINE; + else if (j == "StraightArrow") x = EditorLinkStyle::STRAIGHT_ARROW; + else if (j == "ZigZag") x = EditorLinkStyle::ZIG_ZAG; + else { throw std::runtime_error("Input JSON does not conform to schema!"); } + } + + inline void to_json(json & j, const EditorLinkStyle & x) { + switch (x) { + case EditorLinkStyle::ARROWS_LINE: j = "ArrowsLine"; break; + case EditorLinkStyle::CURVED_ARROW: j = "CurvedArrow"; break; + case EditorLinkStyle::DASHED_LINE: j = "DashedLine"; break; + case EditorLinkStyle::STRAIGHT_ARROW: j = "StraightArrow"; break; + case EditorLinkStyle::ZIG_ZAG: j = "ZigZag"; break; + default: throw std::runtime_error("This should not happen"); + } + } + + inline void from_json(const json & j, TextLanguageMode & x) { + if (j == "LangC") x = TextLanguageMode::LANG_C; + else if (j == "LangHaxe") x = TextLanguageMode::LANG_HAXE; + else if (j == "LangJS") x = TextLanguageMode::LANG_JS; + else if (j == "LangJson") x = TextLanguageMode::LANG_JSON; + else if (j == "LangLog") x = TextLanguageMode::LANG_LOG; + else if (j == "LangLua") x = TextLanguageMode::LANG_LUA; + else if (j == "LangMarkdown") x = TextLanguageMode::LANG_MARKDOWN; + else if (j == "LangPython") x = TextLanguageMode::LANG_PYTHON; + else if (j == "LangRuby") x = TextLanguageMode::LANG_RUBY; + else if (j == "LangXml") x = TextLanguageMode::LANG_XML; + else { throw std::runtime_error("Input JSON does not conform to schema!"); } + } + + inline void to_json(json & j, const TextLanguageMode & x) { + switch (x) { + case TextLanguageMode::LANG_C: j = "LangC"; break; + case TextLanguageMode::LANG_HAXE: j = "LangHaxe"; break; + case TextLanguageMode::LANG_JS: j = "LangJS"; break; + case TextLanguageMode::LANG_JSON: j = "LangJson"; break; + case TextLanguageMode::LANG_LOG: j = "LangLog"; break; + case TextLanguageMode::LANG_LUA: j = "LangLua"; break; + case TextLanguageMode::LANG_MARKDOWN: j = "LangMarkdown"; break; + case TextLanguageMode::LANG_PYTHON: j = "LangPython"; break; + case TextLanguageMode::LANG_RUBY: j = "LangRuby"; break; + case TextLanguageMode::LANG_XML: j = "LangXml"; break; + default: throw std::runtime_error("This should not happen"); + } + } + + inline void from_json(const json & j, LimitBehavior & x) { + if (j == "DiscardOldOnes") x = LimitBehavior::DISCARD_OLD_ONES; + else if (j == "MoveLastOne") x = LimitBehavior::MOVE_LAST_ONE; + else if (j == "PreventAdding") x = LimitBehavior::PREVENT_ADDING; + else { throw std::runtime_error("Input JSON does not conform to schema!"); } + } + + inline void to_json(json & j, const LimitBehavior & x) { + switch (x) { + case LimitBehavior::DISCARD_OLD_ONES: j = "DiscardOldOnes"; break; + case LimitBehavior::MOVE_LAST_ONE: j = "MoveLastOne"; break; + case LimitBehavior::PREVENT_ADDING: j = "PreventAdding"; break; + default: throw std::runtime_error("This should not happen"); + } + } + + inline void from_json(const json & j, LimitScope & x) { + if (j == "PerLayer") x = LimitScope::PER_LAYER; + else if (j == "PerLevel") x = LimitScope::PER_LEVEL; + else if (j == "PerWorld") x = LimitScope::PER_WORLD; + else { throw std::runtime_error("Input JSON does not conform to schema!"); } + } + + inline void to_json(json & j, const LimitScope & x) { + switch (x) { + case LimitScope::PER_LAYER: j = "PerLayer"; break; + case LimitScope::PER_LEVEL: j = "PerLevel"; break; + case LimitScope::PER_WORLD: j = "PerWorld"; break; + default: throw std::runtime_error("This should not happen"); + } + } + + inline void from_json(const json & j, RenderMode & x) { + if (j == "Cross") x = RenderMode::CROSS; + else if (j == "Ellipse") x = RenderMode::ELLIPSE; + else if (j == "Rectangle") x = RenderMode::RECTANGLE; + else if (j == "Tile") x = RenderMode::TILE; + else { throw std::runtime_error("Input JSON does not conform to schema!"); } + } + + inline void to_json(json & j, const RenderMode & x) { + switch (x) { + case RenderMode::CROSS: j = "Cross"; break; + case RenderMode::ELLIPSE: j = "Ellipse"; break; + case RenderMode::RECTANGLE: j = "Rectangle"; break; + case RenderMode::TILE: j = "Tile"; break; + default: throw std::runtime_error("This should not happen"); + } + } + + inline void from_json(const json & j, TileRenderMode & x) { + if (j == "Cover") x = TileRenderMode::COVER; + else if (j == "FitInside") x = TileRenderMode::FIT_INSIDE; + else if (j == "FullSizeCropped") x = TileRenderMode::FULL_SIZE_CROPPED; + else if (j == "FullSizeUncropped") x = TileRenderMode::FULL_SIZE_UNCROPPED; + else if (j == "NineSlice") x = TileRenderMode::NINE_SLICE; + else if (j == "Repeat") x = TileRenderMode::REPEAT; + else if (j == "Stretch") x = TileRenderMode::STRETCH; + else { throw std::runtime_error("Input JSON does not conform to schema!"); } + } + + inline void to_json(json & j, const TileRenderMode & x) { + switch (x) { + case TileRenderMode::COVER: j = "Cover"; break; + case TileRenderMode::FIT_INSIDE: j = "FitInside"; break; + case TileRenderMode::FULL_SIZE_CROPPED: j = "FullSizeCropped"; break; + case TileRenderMode::FULL_SIZE_UNCROPPED: j = "FullSizeUncropped"; break; + case TileRenderMode::NINE_SLICE: j = "NineSlice"; break; + case TileRenderMode::REPEAT: j = "Repeat"; break; + case TileRenderMode::STRETCH: j = "Stretch"; break; + default: throw std::runtime_error("This should not happen"); + } + } + + inline void from_json(const json & j, Checker & x) { + if (j == "Horizontal") x = Checker::HORIZONTAL; + else if (j == "None") x = Checker::NONE; + else if (j == "Vertical") x = Checker::VERTICAL; + else { throw std::runtime_error("Input JSON does not conform to schema!"); } + } + + inline void to_json(json & j, const Checker & x) { + switch (x) { + case Checker::HORIZONTAL: j = "Horizontal"; break; + case Checker::NONE: j = "None"; break; + case Checker::VERTICAL: j = "Vertical"; break; + default: throw std::runtime_error("This should not happen"); + } + } + + inline void from_json(const json & j, TileMode & x) { + if (j == "Single") x = TileMode::SINGLE; + else if (j == "Stamp") x = TileMode::STAMP; + else { throw std::runtime_error("Input JSON does not conform to schema!"); } + } + + inline void to_json(json & j, const TileMode & x) { + switch (x) { + case TileMode::SINGLE: j = "Single"; break; + case TileMode::STAMP: j = "Stamp"; break; + default: throw std::runtime_error("This should not happen"); + } + } + + inline void from_json(const json & j, Type & x) { + if (j == "AutoLayer") x = Type::AUTO_LAYER; + else if (j == "Entities") x = Type::ENTITIES; + else if (j == "IntGrid") x = Type::INT_GRID; + else if (j == "Tiles") x = Type::TILES; + else { throw std::runtime_error("Input JSON does not conform to schema!"); } + } + + inline void to_json(json & j, const Type & x) { + switch (x) { + case Type::AUTO_LAYER: j = "AutoLayer"; break; + case Type::ENTITIES: j = "Entities"; break; + case Type::INT_GRID: j = "IntGrid"; break; + case Type::TILES: j = "Tiles"; break; + default: throw std::runtime_error("This should not happen"); + } + } + + inline void from_json(const json & j, EmbedAtlas & x) { + if (j == "LdtkIcons") x = EmbedAtlas::LDTK_ICONS; + else { throw std::runtime_error("Input JSON does not conform to schema!"); } + } + + inline void to_json(json & j, const EmbedAtlas & x) { + switch (x) { + case EmbedAtlas::LDTK_ICONS: j = "LdtkIcons"; break; + default: throw std::runtime_error("This should not happen"); + } + } + + inline void from_json(const json & j, Flag & x) { + if (j == "DiscardPreCsvIntGrid") x = Flag::DISCARD_PRE_CSV_INT_GRID; + else if (j == "ExportPreCsvIntGridFormat") x = Flag::EXPORT_PRE_CSV_INT_GRID_FORMAT; + else if (j == "IgnoreBackupSuggest") x = Flag::IGNORE_BACKUP_SUGGEST; + else if (j == "MultiWorlds") x = Flag::MULTI_WORLDS; + else if (j == "PrependIndexToLevelFileNames") x = Flag::PREPEND_INDEX_TO_LEVEL_FILE_NAMES; + else if (j == "UseMultilinesType") x = Flag::USE_MULTILINES_TYPE; + else { throw std::runtime_error("Input JSON does not conform to schema!"); } + } + + inline void to_json(json & j, const Flag & x) { + switch (x) { + case Flag::DISCARD_PRE_CSV_INT_GRID: j = "DiscardPreCsvIntGrid"; break; + case Flag::EXPORT_PRE_CSV_INT_GRID_FORMAT: j = "ExportPreCsvIntGridFormat"; break; + case Flag::IGNORE_BACKUP_SUGGEST: j = "IgnoreBackupSuggest"; break; + case Flag::MULTI_WORLDS: j = "MultiWorlds"; break; + case Flag::PREPEND_INDEX_TO_LEVEL_FILE_NAMES: j = "PrependIndexToLevelFileNames"; break; + case Flag::USE_MULTILINES_TYPE: j = "UseMultilinesType"; break; + default: throw std::runtime_error("This should not happen"); + } + } + + inline void from_json(const json & j, BgPos & x) { + if (j == "Contain") x = BgPos::CONTAIN; + else if (j == "Cover") x = BgPos::COVER; + else if (j == "CoverDirty") x = BgPos::COVER_DIRTY; + else if (j == "Repeat") x = BgPos::REPEAT; + else if (j == "Unscaled") x = BgPos::UNSCALED; + else { throw std::runtime_error("Input JSON does not conform to schema!"); } + } + + inline void to_json(json & j, const BgPos & x) { + switch (x) { + case BgPos::CONTAIN: j = "Contain"; break; + case BgPos::COVER: j = "Cover"; break; + case BgPos::COVER_DIRTY: j = "CoverDirty"; break; + case BgPos::REPEAT: j = "Repeat"; break; + case BgPos::UNSCALED: j = "Unscaled"; break; + default: throw std::runtime_error("This should not happen"); + } + } + + inline void from_json(const json & j, WorldLayout & x) { + if (j == "Free") x = WorldLayout::FREE; + else if (j == "GridVania") x = WorldLayout::GRID_VANIA; + else if (j == "LinearHorizontal") x = WorldLayout::LINEAR_HORIZONTAL; + else if (j == "LinearVertical") x = WorldLayout::LINEAR_VERTICAL; + else { throw std::runtime_error("Input JSON does not conform to schema!"); } + } + + inline void to_json(json & j, const WorldLayout & x) { + switch (x) { + case WorldLayout::FREE: j = "Free"; break; + case WorldLayout::GRID_VANIA: j = "GridVania"; break; + case WorldLayout::LINEAR_HORIZONTAL: j = "LinearHorizontal"; break; + case WorldLayout::LINEAR_VERTICAL: j = "LinearVertical"; break; + default: throw std::runtime_error("This should not happen"); + } + } + + inline void from_json(const json & j, IdentifierStyle & x) { + if (j == "Capitalize") x = IdentifierStyle::CAPITALIZE; + else if (j == "Free") x = IdentifierStyle::FREE; + else if (j == "Lowercase") x = IdentifierStyle::LOWERCASE; + else if (j == "Uppercase") x = IdentifierStyle::UPPERCASE; + else { throw std::runtime_error("Input JSON does not conform to schema!"); } + } + + inline void to_json(json & j, const IdentifierStyle & x) { + switch (x) { + case IdentifierStyle::CAPITALIZE: j = "Capitalize"; break; + case IdentifierStyle::FREE: j = "Free"; break; + case IdentifierStyle::LOWERCASE: j = "Lowercase"; break; + case IdentifierStyle::UPPERCASE: j = "Uppercase"; break; + default: throw std::runtime_error("This should not happen"); + } + } + + inline void from_json(const json & j, ImageExportMode & x) { + if (j == "LayersAndLevels") x = ImageExportMode::LAYERS_AND_LEVELS; + else if (j == "None") x = ImageExportMode::NONE; + else if (j == "OneImagePerLayer") x = ImageExportMode::ONE_IMAGE_PER_LAYER; + else if (j == "OneImagePerLevel") x = ImageExportMode::ONE_IMAGE_PER_LEVEL; + else { throw std::runtime_error("Input JSON does not conform to schema!"); } + } + + inline void to_json(json & j, const ImageExportMode & x) { + switch (x) { + case ImageExportMode::LAYERS_AND_LEVELS: j = "LayersAndLevels"; break; + case ImageExportMode::NONE: j = "None"; break; + case ImageExportMode::ONE_IMAGE_PER_LAYER: j = "OneImagePerLayer"; break; + case ImageExportMode::ONE_IMAGE_PER_LEVEL: j = "OneImagePerLevel"; break; + default: throw std::runtime_error("This should not happen"); + } + } +} diff --git a/docs/archives/1.3.4/quicktype/LdtkJson.cs b/docs/archives/1.3.4/quicktype/LdtkJson.cs new file mode 100644 index 000000000..0ee9ee583 --- /dev/null +++ b/docs/archives/1.3.4/quicktype/LdtkJson.cs @@ -0,0 +1,3331 @@ +// +// +// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do: +// +// using ldtk; +// +// var ldtkJson = LdtkJson.FromJson(jsonString); + +namespace ldtk +{ + using System; + using System.Collections.Generic; + + using System.Globalization; + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + + /// + /// This file is a JSON schema of files created by LDtk level editor (https://ldtk.io). + /// + /// This is the root of any Project JSON file. It contains: - the project settings, - an + /// array of levels, - a group of definitions (that can probably be safely ignored for most + /// users). + /// + public partial class LdtkJson + { + /// + /// This object is not actually used by LDtk. It ONLY exists to force explicit references to + /// all types, to make sure QuickType finds them and integrate all of them. Otherwise, + /// Quicktype will drop types that are not explicitely used. + /// + [JsonProperty("__FORCED_REFS", NullValueHandling = NullValueHandling.Ignore)] + public ForcedRefs ForcedRefs { get; set; } + + /// + /// LDtk application build identifier.
This is only used to identify the LDtk version + /// that generated this particular project file, which can be useful for specific bug fixing. + /// Note that the build identifier is just the date of the release, so it's not unique to + /// each user (one single global ID per LDtk public release), and as a result, completely + /// anonymous. + ///
+ [JsonProperty("appBuildId")] + public double AppBuildId { get; set; } + + /// + /// Number of backup files to keep, if the `backupOnSave` is TRUE + /// + [JsonProperty("backupLimit")] + public long BackupLimit { get; set; } + + /// + /// If TRUE, an extra copy of the project will be created in a sub folder, when saving. + /// + [JsonProperty("backupOnSave")] + public bool BackupOnSave { get; set; } + + /// + /// Target relative path to store backup files + /// + [JsonProperty("backupRelPath")] + public string BackupRelPath { get; set; } + + /// + /// Project background color + /// + [JsonProperty("bgColor")] + public string BgColor { get; set; } + + /// + /// An array of command lines that can be ran manually by the user + /// + [JsonProperty("customCommands")] + public LdtkCustomCommand[] CustomCommands { get; set; } + + /// + /// Default height for new entities + /// + [JsonProperty("defaultEntityHeight")] + public long DefaultEntityHeight { get; set; } + + /// + /// Default width for new entities + /// + [JsonProperty("defaultEntityWidth")] + public long DefaultEntityWidth { get; set; } + + /// + /// Default grid size for new layers + /// + [JsonProperty("defaultGridSize")] + public long DefaultGridSize { get; set; } + + /// + /// Default background color of levels + /// + [JsonProperty("defaultLevelBgColor")] + public string DefaultLevelBgColor { get; set; } + + /// + /// **WARNING**: this field will move to the `worlds` array after the "multi-worlds" update. + /// It will then be `null`. You can enable the Multi-worlds advanced project option to enable + /// the change immediately.

Default new level height + ///
+ [JsonProperty("defaultLevelHeight")] + public long? DefaultLevelHeight { get; set; } + + /// + /// **WARNING**: this field will move to the `worlds` array after the "multi-worlds" update. + /// It will then be `null`. You can enable the Multi-worlds advanced project option to enable + /// the change immediately.

Default new level width + ///
+ [JsonProperty("defaultLevelWidth")] + public long? DefaultLevelWidth { get; set; } + + /// + /// Default X pivot (0 to 1) for new entities + /// + [JsonProperty("defaultPivotX")] + public double DefaultPivotX { get; set; } + + /// + /// Default Y pivot (0 to 1) for new entities + /// + [JsonProperty("defaultPivotY")] + public double DefaultPivotY { get; set; } + + /// + /// A structure containing all the definitions of this project + /// + [JsonProperty("defs")] + public Definitions Defs { get; set; } + + /// + /// If the project isn't in MultiWorlds mode, this is the IID of the internal "dummy" World. + /// + [JsonProperty("dummyWorldIid")] + public string DummyWorldIid { get; set; } + + /// + /// If TRUE, the exported PNGs will include the level background (color or image). + /// + [JsonProperty("exportLevelBg")] + public bool ExportLevelBg { get; set; } + + /// + /// **WARNING**: this deprecated value is no longer exported since version 0.9.3 Replaced + /// by: `imageExportMode` + /// + [JsonProperty("exportPng")] + public bool? ExportPng { get; set; } + + /// + /// If TRUE, a Tiled compatible file will also be generated along with the LDtk JSON file + /// (default is FALSE) + /// + [JsonProperty("exportTiled")] + public bool ExportTiled { get; set; } + + /// + /// If TRUE, one file will be saved for the project (incl. all its definitions) and one file + /// in a sub-folder for each level. + /// + [JsonProperty("externalLevels")] + public bool ExternalLevels { get; set; } + + /// + /// An array containing various advanced flags (ie. options or other states). Possible + /// values: `DiscardPreCsvIntGrid`, `ExportPreCsvIntGridFormat`, `IgnoreBackupSuggest`, + /// `PrependIndexToLevelFileNames`, `MultiWorlds`, `UseMultilinesType` + /// + [JsonProperty("flags")] + public Flag[] Flags { get; set; } + + /// + /// Naming convention for Identifiers (first-letter uppercase, full uppercase etc.) Possible + /// values: `Capitalize`, `Uppercase`, `Lowercase`, `Free` + /// + [JsonProperty("identifierStyle")] + public IdentifierStyle IdentifierStyle { get; set; } + + /// + /// Unique project identifier + /// + [JsonProperty("iid")] + public string Iid { get; set; } + + /// + /// "Image export" option when saving project. Possible values: `None`, `OneImagePerLayer`, + /// `OneImagePerLevel`, `LayersAndLevels` + /// + [JsonProperty("imageExportMode")] + public ImageExportMode ImageExportMode { get; set; } + + /// + /// File format version + /// + [JsonProperty("jsonVersion")] + public string JsonVersion { get; set; } + + /// + /// The default naming convention for level identifiers. + /// + [JsonProperty("levelNamePattern")] + public string LevelNamePattern { get; set; } + + /// + /// All levels. The order of this array is only relevant in `LinearHorizontal` and + /// `linearVertical` world layouts (see `worldLayout` value).
Otherwise, you should + /// refer to the `worldX`,`worldY` coordinates of each Level. + ///
+ [JsonProperty("levels")] + public Level[] Levels { get; set; } + + /// + /// If TRUE, the Json is partially minified (no indentation, nor line breaks, default is + /// FALSE) + /// + [JsonProperty("minifyJson")] + public bool MinifyJson { get; set; } + + /// + /// Next Unique integer ID available + /// + [JsonProperty("nextUid")] + public long NextUid { get; set; } + + /// + /// File naming pattern for exported PNGs + /// + [JsonProperty("pngFilePattern")] + public string PngFilePattern { get; set; } + + /// + /// If TRUE, a very simplified will be generated on saving, for quicker & easier engine + /// integration. + /// + [JsonProperty("simplifiedExport")] + public bool SimplifiedExport { get; set; } + + /// + /// All instances of entities that have their `exportToToc` flag enabled are listed in this + /// array. + /// + [JsonProperty("toc")] + public LdtkTableOfContentEntry[] Toc { get; set; } + + /// + /// This optional description is used by LDtk Samples to show up some informations and + /// instructions. + /// + [JsonProperty("tutorialDesc")] + public string TutorialDesc { get; set; } + + /// + /// **WARNING**: this field will move to the `worlds` array after the "multi-worlds" update. + /// It will then be `null`. You can enable the Multi-worlds advanced project option to enable + /// the change immediately.

Height of the world grid in pixels. + ///
+ [JsonProperty("worldGridHeight")] + public long? WorldGridHeight { get; set; } + + /// + /// **WARNING**: this field will move to the `worlds` array after the "multi-worlds" update. + /// It will then be `null`. You can enable the Multi-worlds advanced project option to enable + /// the change immediately.

Width of the world grid in pixels. + ///
+ [JsonProperty("worldGridWidth")] + public long? WorldGridWidth { get; set; } + + /// + /// **WARNING**: this field will move to the `worlds` array after the "multi-worlds" update. + /// It will then be `null`. You can enable the Multi-worlds advanced project option to enable + /// the change immediately.

An enum that describes how levels are organized in + /// this project (ie. linearly or in a 2D space). Possible values: <`null`>, `Free`, + /// `GridVania`, `LinearHorizontal`, `LinearVertical` + ///
+ [JsonProperty("worldLayout")] + public WorldLayout? WorldLayout { get; set; } + + /// + /// This array will be empty, unless you enable the Multi-Worlds in the project advanced + /// settings.

- in current version, a LDtk project file can only contain a single + /// world with multiple levels in it. In this case, levels and world layout related settings + /// are stored in the root of the JSON.
- with "Multi-worlds" enabled, there will be a + /// `worlds` array in root, each world containing levels and layout settings. Basically, it's + /// pretty much only about moving the `levels` array to the `worlds` array, along with world + /// layout related values (eg. `worldGridWidth` etc).

If you want to start + /// supporting this future update easily, please refer to this documentation: + /// https://github.com/deepnight/ldtk/issues/231 + ///
+ [JsonProperty("worlds")] + public World[] Worlds { get; set; } + } + + public partial class LdtkCustomCommand + { + [JsonProperty("command")] + public string Command { get; set; } + + /// + /// Possible values: `Manual`, `AfterLoad`, `BeforeSave`, `AfterSave` + /// + [JsonProperty("when")] + public When When { get; set; } + } + + /// + /// If you're writing your own LDtk importer, you should probably just ignore *most* stuff in + /// the `defs` section, as it contains data that are mostly important to the editor. To keep + /// you away from the `defs` section and avoid some unnecessary JSON parsing, important data + /// from definitions is often duplicated in fields prefixed with a double underscore (eg. + /// `__identifier` or `__type`). The 2 only definition types you might need here are + /// **Tilesets** and **Enums**. + /// + /// A structure containing all the definitions of this project + /// + public partial class Definitions + { + /// + /// All entities definitions, including their custom fields + /// + [JsonProperty("entities")] + public EntityDefinition[] Entities { get; set; } + + /// + /// All internal enums + /// + [JsonProperty("enums")] + public EnumDefinition[] Enums { get; set; } + + /// + /// Note: external enums are exactly the same as `enums`, except they have a `relPath` to + /// point to an external source file. + /// + [JsonProperty("externalEnums")] + public EnumDefinition[] ExternalEnums { get; set; } + + /// + /// All layer definitions + /// + [JsonProperty("layers")] + public LayerDefinition[] Layers { get; set; } + + /// + /// All custom fields available to all levels. + /// + [JsonProperty("levelFields")] + public FieldDefinition[] LevelFields { get; set; } + + /// + /// All tilesets + /// + [JsonProperty("tilesets")] + public TilesetDefinition[] Tilesets { get; set; } + } + + public partial class EntityDefinition + { + /// + /// Base entity color + /// + [JsonProperty("color")] + public string Color { get; set; } + + /// + /// User defined documentation for this element to provide help/tips to level designers. + /// + [JsonProperty("doc")] + public string Doc { get; set; } + + /// + /// If enabled, all instances of this entity will be listed in the project "Table of content" + /// object. + /// + [JsonProperty("exportToToc")] + public bool ExportToToc { get; set; } + + /// + /// Array of field definitions + /// + [JsonProperty("fieldDefs")] + public FieldDefinition[] FieldDefs { get; set; } + + [JsonProperty("fillOpacity")] + public double FillOpacity { get; set; } + + /// + /// Pixel height + /// + [JsonProperty("height")] + public long Height { get; set; } + + [JsonProperty("hollow")] + public bool Hollow { get; set; } + + /// + /// User defined unique identifier + /// + [JsonProperty("identifier")] + public string Identifier { get; set; } + + /// + /// Only applies to entities resizable on both X/Y. If TRUE, the entity instance width/height + /// will keep the same aspect ratio as the definition. + /// + [JsonProperty("keepAspectRatio")] + public bool KeepAspectRatio { get; set; } + + /// + /// Possible values: `DiscardOldOnes`, `PreventAdding`, `MoveLastOne` + /// + [JsonProperty("limitBehavior")] + public LimitBehavior LimitBehavior { get; set; } + + /// + /// If TRUE, the maxCount is a "per world" limit, if FALSE, it's a "per level". Possible + /// values: `PerLayer`, `PerLevel`, `PerWorld` + /// + [JsonProperty("limitScope")] + public LimitScope LimitScope { get; set; } + + [JsonProperty("lineOpacity")] + public double LineOpacity { get; set; } + + /// + /// Max instances count + /// + [JsonProperty("maxCount")] + public long MaxCount { get; set; } + + /// + /// Max pixel height (only applies if the entity is resizable on Y) + /// + [JsonProperty("maxHeight")] + public long? MaxHeight { get; set; } + + /// + /// Max pixel width (only applies if the entity is resizable on X) + /// + [JsonProperty("maxWidth")] + public long? MaxWidth { get; set; } + + /// + /// Min pixel height (only applies if the entity is resizable on Y) + /// + [JsonProperty("minHeight")] + public long? MinHeight { get; set; } + + /// + /// Min pixel width (only applies if the entity is resizable on X) + /// + [JsonProperty("minWidth")] + public long? MinWidth { get; set; } + + /// + /// An array of 4 dimensions for the up/right/down/left borders (in this order) when using + /// 9-slice mode for `tileRenderMode`.
If the tileRenderMode is not NineSlice, then + /// this array is empty.
See: https://en.wikipedia.org/wiki/9-slice_scaling + ///
+ [JsonProperty("nineSliceBorders")] + public long[] NineSliceBorders { get; set; } + + /// + /// Pivot X coordinate (from 0 to 1.0) + /// + [JsonProperty("pivotX")] + public double PivotX { get; set; } + + /// + /// Pivot Y coordinate (from 0 to 1.0) + /// + [JsonProperty("pivotY")] + public double PivotY { get; set; } + + /// + /// Possible values: `Rectangle`, `Ellipse`, `Tile`, `Cross` + /// + [JsonProperty("renderMode")] + public RenderMode RenderMode { get; set; } + + /// + /// If TRUE, the entity instances will be resizable horizontally + /// + [JsonProperty("resizableX")] + public bool ResizableX { get; set; } + + /// + /// If TRUE, the entity instances will be resizable vertically + /// + [JsonProperty("resizableY")] + public bool ResizableY { get; set; } + + /// + /// Display entity name in editor + /// + [JsonProperty("showName")] + public bool ShowName { get; set; } + + /// + /// An array of strings that classifies this entity + /// + [JsonProperty("tags")] + public string[] Tags { get; set; } + + /// + /// **WARNING**: this deprecated value is no longer exported since version 1.2.0 Replaced + /// by: `tileRect` + /// + [JsonProperty("tileId")] + public long? TileId { get; set; } + + [JsonProperty("tileOpacity")] + public double TileOpacity { get; set; } + + /// + /// An object representing a rectangle from an existing Tileset + /// + [JsonProperty("tileRect")] + public TilesetRectangle TileRect { get; set; } + + /// + /// An enum describing how the the Entity tile is rendered inside the Entity bounds. Possible + /// values: `Cover`, `FitInside`, `Repeat`, `Stretch`, `FullSizeCropped`, + /// `FullSizeUncropped`, `NineSlice` + /// + [JsonProperty("tileRenderMode")] + public TileRenderMode TileRenderMode { get; set; } + + /// + /// Tileset ID used for optional tile display + /// + [JsonProperty("tilesetId")] + public long? TilesetId { get; set; } + + /// + /// Unique Int identifier + /// + [JsonProperty("uid")] + public long Uid { get; set; } + + /// + /// Pixel width + /// + [JsonProperty("width")] + public long Width { get; set; } + } + + /// + /// This section is mostly only intended for the LDtk editor app itself. You can safely + /// ignore it. + /// + public partial class FieldDefinition + { + /// + /// Human readable value type. Possible values: `Int, Float, String, Bool, Color, + /// ExternEnum.XXX, LocalEnum.XXX, Point, FilePath`.
If the field is an array, this + /// field will look like `Array<...>` (eg. `Array`, `Array` etc.)
NOTE: if + /// you enable the advanced option **Use Multilines type**, you will have "*Multilines*" + /// instead of "*String*" when relevant. + ///
+ [JsonProperty("__type")] + public string Type { get; set; } + + /// + /// Optional list of accepted file extensions for FilePath value type. Includes the dot: + /// `.ext` + /// + [JsonProperty("acceptFileTypes")] + public string[] AcceptFileTypes { get; set; } + + /// + /// Possible values: `Any`, `OnlySame`, `OnlyTags`, `OnlySpecificEntity` + /// + [JsonProperty("allowedRefs")] + public AllowedRefs AllowedRefs { get; set; } + + [JsonProperty("allowedRefsEntityUid")] + public long? AllowedRefsEntityUid { get; set; } + + [JsonProperty("allowedRefTags")] + public string[] AllowedRefTags { get; set; } + + [JsonProperty("allowOutOfLevelRef")] + public bool AllowOutOfLevelRef { get; set; } + + /// + /// Array max length + /// + [JsonProperty("arrayMaxLength")] + public long? ArrayMaxLength { get; set; } + + /// + /// Array min length + /// + [JsonProperty("arrayMinLength")] + public long? ArrayMinLength { get; set; } + + [JsonProperty("autoChainRef")] + public bool AutoChainRef { get; set; } + + /// + /// TRUE if the value can be null. For arrays, TRUE means it can contain null values + /// (exception: array of Points can't have null values). + /// + [JsonProperty("canBeNull")] + public bool CanBeNull { get; set; } + + /// + /// Default value if selected value is null or invalid. + /// + [JsonProperty("defaultOverride")] + public dynamic DefaultOverride { get; set; } + + /// + /// User defined documentation for this field to provide help/tips to level designers about + /// accepted values. + /// + [JsonProperty("doc")] + public string Doc { get; set; } + + [JsonProperty("editorAlwaysShow")] + public bool EditorAlwaysShow { get; set; } + + [JsonProperty("editorCutLongValues")] + public bool EditorCutLongValues { get; set; } + + [JsonProperty("editorDisplayColor")] + public string EditorDisplayColor { get; set; } + + /// + /// Possible values: `Hidden`, `ValueOnly`, `NameAndValue`, `EntityTile`, `LevelTile`, + /// `Points`, `PointStar`, `PointPath`, `PointPathLoop`, `RadiusPx`, `RadiusGrid`, + /// `ArrayCountWithLabel`, `ArrayCountNoLabel`, `RefLinkBetweenPivots`, + /// `RefLinkBetweenCenters` + /// + [JsonProperty("editorDisplayMode")] + public EditorDisplayMode EditorDisplayMode { get; set; } + + /// + /// Possible values: `Above`, `Center`, `Beneath` + /// + [JsonProperty("editorDisplayPos")] + public EditorDisplayPos EditorDisplayPos { get; set; } + + [JsonProperty("editorDisplayScale")] + public double EditorDisplayScale { get; set; } + + /// + /// Possible values: `ZigZag`, `StraightArrow`, `CurvedArrow`, `ArrowsLine`, `DashedLine` + /// + [JsonProperty("editorLinkStyle")] + public EditorLinkStyle EditorLinkStyle { get; set; } + + [JsonProperty("editorShowInWorld")] + public bool EditorShowInWorld { get; set; } + + [JsonProperty("editorTextPrefix")] + public string EditorTextPrefix { get; set; } + + [JsonProperty("editorTextSuffix")] + public string EditorTextSuffix { get; set; } + + /// + /// User defined unique identifier + /// + [JsonProperty("identifier")] + public string Identifier { get; set; } + + /// + /// TRUE if the value is an array of multiple values + /// + [JsonProperty("isArray")] + public bool IsArray { get; set; } + + /// + /// Max limit for value, if applicable + /// + [JsonProperty("max")] + public double? Max { get; set; } + + /// + /// Min limit for value, if applicable + /// + [JsonProperty("min")] + public double? Min { get; set; } + + /// + /// Optional regular expression that needs to be matched to accept values. Expected format: + /// `/some_reg_ex/g`, with optional "i" flag. + /// + [JsonProperty("regex")] + public string Regex { get; set; } + + [JsonProperty("symmetricalRef")] + public bool SymmetricalRef { get; set; } + + /// + /// Possible values: <`null`>, `LangPython`, `LangRuby`, `LangJS`, `LangLua`, `LangC`, + /// `LangHaxe`, `LangMarkdown`, `LangJson`, `LangXml`, `LangLog` + /// + [JsonProperty("textLanguageMode")] + public TextLanguageMode? TextLanguageMode { get; set; } + + /// + /// UID of the tileset used for a Tile + /// + [JsonProperty("tilesetUid")] + public long? TilesetUid { get; set; } + + /// + /// Internal enum representing the possible field types. Possible values: F_Int, F_Float, + /// F_String, F_Text, F_Bool, F_Color, F_Enum(...), F_Point, F_Path, F_EntityRef, F_Tile + /// + [JsonProperty("type")] + public string FieldDefinitionType { get; set; } + + /// + /// Unique Int identifier + /// + [JsonProperty("uid")] + public long Uid { get; set; } + + /// + /// If TRUE, the color associated with this field will override the Entity or Level default + /// color in the editor UI. For Enum fields, this would be the color associated to their + /// values. + /// + [JsonProperty("useForSmartColor")] + public bool UseForSmartColor { get; set; } + } + + /// + /// This object represents a custom sub rectangle in a Tileset image. + /// + public partial class TilesetRectangle + { + /// + /// Height in pixels + /// + [JsonProperty("h")] + public long H { get; set; } + + /// + /// UID of the tileset + /// + [JsonProperty("tilesetUid")] + public long TilesetUid { get; set; } + + /// + /// Width in pixels + /// + [JsonProperty("w")] + public long W { get; set; } + + /// + /// X pixels coordinate of the top-left corner in the Tileset image + /// + [JsonProperty("x")] + public long X { get; set; } + + /// + /// Y pixels coordinate of the top-left corner in the Tileset image + /// + [JsonProperty("y")] + public long Y { get; set; } + } + + public partial class EnumDefinition + { + [JsonProperty("externalFileChecksum")] + public string ExternalFileChecksum { get; set; } + + /// + /// Relative path to the external file providing this Enum + /// + [JsonProperty("externalRelPath")] + public string ExternalRelPath { get; set; } + + /// + /// Tileset UID if provided + /// + [JsonProperty("iconTilesetUid")] + public long? IconTilesetUid { get; set; } + + /// + /// User defined unique identifier + /// + [JsonProperty("identifier")] + public string Identifier { get; set; } + + /// + /// An array of user-defined tags to organize the Enums + /// + [JsonProperty("tags")] + public string[] Tags { get; set; } + + /// + /// Unique Int identifier + /// + [JsonProperty("uid")] + public long Uid { get; set; } + + /// + /// All possible enum values, with their optional Tile infos. + /// + [JsonProperty("values")] + public EnumValueDefinition[] Values { get; set; } + } + + public partial class EnumValueDefinition + { + /// + /// **WARNING**: this deprecated value will be *removed* completely on version 1.4.0+ + /// Replaced by: `tileRect` + /// + [JsonProperty("__tileSrcRect")] + public long[] TileSrcRect { get; set; } + + /// + /// Optional color + /// + [JsonProperty("color")] + public long Color { get; set; } + + /// + /// Enum value + /// + [JsonProperty("id")] + public string Id { get; set; } + + /// + /// **WARNING**: this deprecated value will be *removed* completely on version 1.4.0+ + /// Replaced by: `tileRect` + /// + [JsonProperty("tileId")] + public long? TileId { get; set; } + + /// + /// Optional tileset rectangle to represents this value + /// + [JsonProperty("tileRect")] + public TilesetRectangle TileRect { get; set; } + } + + public partial class LayerDefinition + { + /// + /// Type of the layer (*IntGrid, Entities, Tiles or AutoLayer*) + /// + [JsonProperty("__type")] + public string Type { get; set; } + + /// + /// Contains all the auto-layer rule definitions. + /// + [JsonProperty("autoRuleGroups")] + public AutoLayerRuleGroup[] AutoRuleGroups { get; set; } + + [JsonProperty("autoSourceLayerDefUid")] + public long? AutoSourceLayerDefUid { get; set; } + + /// + /// **WARNING**: this deprecated value is no longer exported since version 1.2.0 Replaced + /// by: `tilesetDefUid` + /// + [JsonProperty("autoTilesetDefUid")] + public long? AutoTilesetDefUid { get; set; } + + /// + /// Allow editor selections when the layer is not currently active. + /// + [JsonProperty("canSelectWhenInactive")] + public bool CanSelectWhenInactive { get; set; } + + /// + /// Opacity of the layer (0 to 1.0) + /// + [JsonProperty("displayOpacity")] + public double DisplayOpacity { get; set; } + + /// + /// User defined documentation for this element to provide help/tips to level designers. + /// + [JsonProperty("doc")] + public string Doc { get; set; } + + /// + /// An array of tags to forbid some Entities in this layer + /// + [JsonProperty("excludedTags")] + public string[] ExcludedTags { get; set; } + + /// + /// Width and height of the grid in pixels + /// + [JsonProperty("gridSize")] + public long GridSize { get; set; } + + /// + /// Height of the optional "guide" grid in pixels + /// + [JsonProperty("guideGridHei")] + public long GuideGridHei { get; set; } + + /// + /// Width of the optional "guide" grid in pixels + /// + [JsonProperty("guideGridWid")] + public long GuideGridWid { get; set; } + + [JsonProperty("hideFieldsWhenInactive")] + public bool HideFieldsWhenInactive { get; set; } + + /// + /// Hide the layer from the list on the side of the editor view. + /// + [JsonProperty("hideInList")] + public bool HideInList { get; set; } + + /// + /// User defined unique identifier + /// + [JsonProperty("identifier")] + public string Identifier { get; set; } + + /// + /// Alpha of this layer when it is not the active one. + /// + [JsonProperty("inactiveOpacity")] + public double InactiveOpacity { get; set; } + + /// + /// An array that defines extra optional info for each IntGrid value.
WARNING: the + /// array order is not related to actual IntGrid values! As user can re-order IntGrid values + /// freely, you may value "2" before value "1" in this array. + ///
+ [JsonProperty("intGridValues")] + public IntGridValueDefinition[] IntGridValues { get; set; } + + /// + /// Parallax horizontal factor (from -1 to 1, defaults to 0) which affects the scrolling + /// speed of this layer, creating a fake 3D (parallax) effect. + /// + [JsonProperty("parallaxFactorX")] + public double ParallaxFactorX { get; set; } + + /// + /// Parallax vertical factor (from -1 to 1, defaults to 0) which affects the scrolling speed + /// of this layer, creating a fake 3D (parallax) effect. + /// + [JsonProperty("parallaxFactorY")] + public double ParallaxFactorY { get; set; } + + /// + /// If true (default), a layer with a parallax factor will also be scaled up/down accordingly. + /// + [JsonProperty("parallaxScaling")] + public bool ParallaxScaling { get; set; } + + /// + /// X offset of the layer, in pixels (IMPORTANT: this should be added to the `LayerInstance` + /// optional offset) + /// + [JsonProperty("pxOffsetX")] + public long PxOffsetX { get; set; } + + /// + /// Y offset of the layer, in pixels (IMPORTANT: this should be added to the `LayerInstance` + /// optional offset) + /// + [JsonProperty("pxOffsetY")] + public long PxOffsetY { get; set; } + + /// + /// If TRUE, the content of this layer will be used when rendering levels in a simplified way + /// for the world view + /// + [JsonProperty("renderInWorldView")] + public bool RenderInWorldView { get; set; } + + /// + /// An array of tags to filter Entities that can be added to this layer + /// + [JsonProperty("requiredTags")] + public string[] RequiredTags { get; set; } + + /// + /// If the tiles are smaller or larger than the layer grid, the pivot value will be used to + /// position the tile relatively its grid cell. + /// + [JsonProperty("tilePivotX")] + public double TilePivotX { get; set; } + + /// + /// If the tiles are smaller or larger than the layer grid, the pivot value will be used to + /// position the tile relatively its grid cell. + /// + [JsonProperty("tilePivotY")] + public double TilePivotY { get; set; } + + /// + /// Reference to the default Tileset UID being used by this layer definition.
+ /// **WARNING**: some layer *instances* might use a different tileset. So most of the time, + /// you should probably use the `__tilesetDefUid` value found in layer instances.
Note: + /// since version 1.0.0, the old `autoTilesetDefUid` was removed and merged into this value. + ///
+ [JsonProperty("tilesetDefUid")] + public long? TilesetDefUid { get; set; } + + /// + /// Type of the layer as Haxe Enum Possible values: `IntGrid`, `Entities`, `Tiles`, + /// `AutoLayer` + /// + [JsonProperty("type")] + public TypeEnum LayerDefinitionType { get; set; } + + /// + /// User defined color for the UI + /// + [JsonProperty("uiColor")] + public string UiColor { get; set; } + + /// + /// Unique Int identifier + /// + [JsonProperty("uid")] + public long Uid { get; set; } + } + + public partial class AutoLayerRuleGroup + { + [JsonProperty("active")] + public bool Active { get; set; } + + /// + /// *This field was removed in 1.0.0 and should no longer be used.* + /// + [JsonProperty("collapsed")] + public bool? Collapsed { get; set; } + + [JsonProperty("isOptional")] + public bool IsOptional { get; set; } + + [JsonProperty("name")] + public string Name { get; set; } + + [JsonProperty("rules")] + public AutoLayerRuleDefinition[] Rules { get; set; } + + [JsonProperty("uid")] + public long Uid { get; set; } + + [JsonProperty("usesWizard")] + public bool UsesWizard { get; set; } + } + + /// + /// This complex section isn't meant to be used by game devs at all, as these rules are + /// completely resolved internally by the editor before any saving. You should just ignore + /// this part. + /// + public partial class AutoLayerRuleDefinition + { + /// + /// If FALSE, the rule effect isn't applied, and no tiles are generated. + /// + [JsonProperty("active")] + public bool Active { get; set; } + + [JsonProperty("alpha")] + public double Alpha { get; set; } + + /// + /// When TRUE, the rule will prevent other rules to be applied in the same cell if it matches + /// (TRUE by default). + /// + [JsonProperty("breakOnMatch")] + public bool BreakOnMatch { get; set; } + + /// + /// Chances for this rule to be applied (0 to 1) + /// + [JsonProperty("chance")] + public double Chance { get; set; } + + /// + /// Checker mode Possible values: `None`, `Horizontal`, `Vertical` + /// + [JsonProperty("checker")] + public Checker Checker { get; set; } + + /// + /// If TRUE, allow rule to be matched by flipping its pattern horizontally + /// + [JsonProperty("flipX")] + public bool FlipX { get; set; } + + /// + /// If TRUE, allow rule to be matched by flipping its pattern vertically + /// + [JsonProperty("flipY")] + public bool FlipY { get; set; } + + /// + /// Default IntGrid value when checking cells outside of level bounds + /// + [JsonProperty("outOfBoundsValue")] + public long? OutOfBoundsValue { get; set; } + + /// + /// Rule pattern (size x size) + /// + [JsonProperty("pattern")] + public long[] Pattern { get; set; } + + /// + /// If TRUE, enable Perlin filtering to only apply rule on specific random area + /// + [JsonProperty("perlinActive")] + public bool PerlinActive { get; set; } + + [JsonProperty("perlinOctaves")] + public double PerlinOctaves { get; set; } + + [JsonProperty("perlinScale")] + public double PerlinScale { get; set; } + + [JsonProperty("perlinSeed")] + public double PerlinSeed { get; set; } + + /// + /// X pivot of a tile stamp (0-1) + /// + [JsonProperty("pivotX")] + public double PivotX { get; set; } + + /// + /// Y pivot of a tile stamp (0-1) + /// + [JsonProperty("pivotY")] + public double PivotY { get; set; } + + /// + /// Pattern width & height. Should only be 1,3,5 or 7. + /// + [JsonProperty("size")] + public long Size { get; set; } + + /// + /// Array of all the tile IDs. They are used randomly or as stamps, based on `tileMode` value. + /// + [JsonProperty("tileIds")] + public long[] TileIds { get; set; } + + /// + /// Defines how tileIds array is used Possible values: `Single`, `Stamp` + /// + [JsonProperty("tileMode")] + public TileMode TileMode { get; set; } + + /// + /// Max random offset for X tile pos + /// + [JsonProperty("tileRandomXMax")] + public long TileRandomXMax { get; set; } + + /// + /// Min random offset for X tile pos + /// + [JsonProperty("tileRandomXMin")] + public long TileRandomXMin { get; set; } + + /// + /// Max random offset for Y tile pos + /// + [JsonProperty("tileRandomYMax")] + public long TileRandomYMax { get; set; } + + /// + /// Min random offset for Y tile pos + /// + [JsonProperty("tileRandomYMin")] + public long TileRandomYMin { get; set; } + + /// + /// Tile X offset + /// + [JsonProperty("tileXOffset")] + public long TileXOffset { get; set; } + + /// + /// Tile Y offset + /// + [JsonProperty("tileYOffset")] + public long TileYOffset { get; set; } + + /// + /// Unique Int identifier + /// + [JsonProperty("uid")] + public long Uid { get; set; } + + /// + /// X cell coord modulo + /// + [JsonProperty("xModulo")] + public long XModulo { get; set; } + + /// + /// X cell start offset + /// + [JsonProperty("xOffset")] + public long XOffset { get; set; } + + /// + /// Y cell coord modulo + /// + [JsonProperty("yModulo")] + public long YModulo { get; set; } + + /// + /// Y cell start offset + /// + [JsonProperty("yOffset")] + public long YOffset { get; set; } + } + + /// + /// IntGrid value definition + /// + public partial class IntGridValueDefinition + { + [JsonProperty("color")] + public string Color { get; set; } + + /// + /// User defined unique identifier + /// + [JsonProperty("identifier")] + public string Identifier { get; set; } + + [JsonProperty("tile")] + public TilesetRectangle Tile { get; set; } + + /// + /// The IntGrid value itself + /// + [JsonProperty("value")] + public long Value { get; set; } + } + + /// + /// The `Tileset` definition is the most important part among project definitions. It + /// contains some extra informations about each integrated tileset. If you only had to parse + /// one definition section, that would be the one. + /// + public partial class TilesetDefinition + { + /// + /// Grid-based height + /// + [JsonProperty("__cHei")] + public long CHei { get; set; } + + /// + /// Grid-based width + /// + [JsonProperty("__cWid")] + public long CWid { get; set; } + + /// + /// The following data is used internally for various optimizations. It's always synced with + /// source image changes. + /// + [JsonProperty("cachedPixelData")] + public Dictionary CachedPixelData { get; set; } + + /// + /// An array of custom tile metadata + /// + [JsonProperty("customData")] + public TileCustomMetadata[] CustomData { get; set; } + + /// + /// If this value is set, then it means that this atlas uses an internal LDtk atlas image + /// instead of a loaded one. Possible values: <`null`>, `LdtkIcons` + /// + [JsonProperty("embedAtlas")] + public EmbedAtlas? EmbedAtlas { get; set; } + + /// + /// Tileset tags using Enum values specified by `tagsSourceEnumId`. This array contains 1 + /// element per Enum value, which contains an array of all Tile IDs that are tagged with it. + /// + [JsonProperty("enumTags")] + public EnumTagValue[] EnumTags { get; set; } + + /// + /// User defined unique identifier + /// + [JsonProperty("identifier")] + public string Identifier { get; set; } + + /// + /// Distance in pixels from image borders + /// + [JsonProperty("padding")] + public long Padding { get; set; } + + /// + /// Image height in pixels + /// + [JsonProperty("pxHei")] + public long PxHei { get; set; } + + /// + /// Image width in pixels + /// + [JsonProperty("pxWid")] + public long PxWid { get; set; } + + /// + /// Path to the source file, relative to the current project JSON file
It can be null + /// if no image was provided, or when using an embed atlas. + ///
+ [JsonProperty("relPath")] + public string RelPath { get; set; } + + /// + /// Array of group of tiles selections, only meant to be used in the editor + /// + [JsonProperty("savedSelections")] + public Dictionary[] SavedSelections { get; set; } + + /// + /// Space in pixels between all tiles + /// + [JsonProperty("spacing")] + public long Spacing { get; set; } + + /// + /// An array of user-defined tags to organize the Tilesets + /// + [JsonProperty("tags")] + public string[] Tags { get; set; } + + /// + /// Optional Enum definition UID used for this tileset meta-data + /// + [JsonProperty("tagsSourceEnumUid")] + public long? TagsSourceEnumUid { get; set; } + + [JsonProperty("tileGridSize")] + public long TileGridSize { get; set; } + + /// + /// Unique Intidentifier + /// + [JsonProperty("uid")] + public long Uid { get; set; } + } + + /// + /// In a tileset definition, user defined meta-data of a tile. + /// + public partial class TileCustomMetadata + { + [JsonProperty("data")] + public string Data { get; set; } + + [JsonProperty("tileId")] + public long TileId { get; set; } + } + + /// + /// In a tileset definition, enum based tag infos + /// + public partial class EnumTagValue + { + [JsonProperty("enumValueId")] + public string EnumValueId { get; set; } + + [JsonProperty("tileIds")] + public long[] TileIds { get; set; } + } + + /// + /// This object is not actually used by LDtk. It ONLY exists to force explicit references to + /// all types, to make sure QuickType finds them and integrate all of them. Otherwise, + /// Quicktype will drop types that are not explicitely used. + /// + public partial class ForcedRefs + { + [JsonProperty("AutoLayerRuleGroup", NullValueHandling = NullValueHandling.Ignore)] + public AutoLayerRuleGroup AutoLayerRuleGroup { get; set; } + + [JsonProperty("AutoRuleDef", NullValueHandling = NullValueHandling.Ignore)] + public AutoLayerRuleDefinition AutoRuleDef { get; set; } + + [JsonProperty("CustomCommand", NullValueHandling = NullValueHandling.Ignore)] + public LdtkCustomCommand CustomCommand { get; set; } + + [JsonProperty("Definitions", NullValueHandling = NullValueHandling.Ignore)] + public Definitions Definitions { get; set; } + + [JsonProperty("EntityDef", NullValueHandling = NullValueHandling.Ignore)] + public EntityDefinition EntityDef { get; set; } + + [JsonProperty("EntityInstance", NullValueHandling = NullValueHandling.Ignore)] + public EntityInstance EntityInstance { get; set; } + + [JsonProperty("EntityReferenceInfos", NullValueHandling = NullValueHandling.Ignore)] + public ReferenceToAnEntityInstance EntityReferenceInfos { get; set; } + + [JsonProperty("EnumDef", NullValueHandling = NullValueHandling.Ignore)] + public EnumDefinition EnumDef { get; set; } + + [JsonProperty("EnumDefValues", NullValueHandling = NullValueHandling.Ignore)] + public EnumValueDefinition EnumDefValues { get; set; } + + [JsonProperty("EnumTagValue", NullValueHandling = NullValueHandling.Ignore)] + public EnumTagValue EnumTagValue { get; set; } + + [JsonProperty("FieldDef", NullValueHandling = NullValueHandling.Ignore)] + public FieldDefinition FieldDef { get; set; } + + [JsonProperty("FieldInstance", NullValueHandling = NullValueHandling.Ignore)] + public FieldInstance FieldInstance { get; set; } + + [JsonProperty("GridPoint", NullValueHandling = NullValueHandling.Ignore)] + public GridPoint GridPoint { get; set; } + + [JsonProperty("IntGridValueDef", NullValueHandling = NullValueHandling.Ignore)] + public IntGridValueDefinition IntGridValueDef { get; set; } + + [JsonProperty("IntGridValueInstance", NullValueHandling = NullValueHandling.Ignore)] + public IntGridValueInstance IntGridValueInstance { get; set; } + + [JsonProperty("LayerDef", NullValueHandling = NullValueHandling.Ignore)] + public LayerDefinition LayerDef { get; set; } + + [JsonProperty("LayerInstance", NullValueHandling = NullValueHandling.Ignore)] + public LayerInstance LayerInstance { get; set; } + + [JsonProperty("Level", NullValueHandling = NullValueHandling.Ignore)] + public Level Level { get; set; } + + [JsonProperty("LevelBgPosInfos", NullValueHandling = NullValueHandling.Ignore)] + public LevelBackgroundPosition LevelBgPosInfos { get; set; } + + [JsonProperty("NeighbourLevel", NullValueHandling = NullValueHandling.Ignore)] + public NeighbourLevel NeighbourLevel { get; set; } + + [JsonProperty("TableOfContentEntry", NullValueHandling = NullValueHandling.Ignore)] + public LdtkTableOfContentEntry TableOfContentEntry { get; set; } + + [JsonProperty("Tile", NullValueHandling = NullValueHandling.Ignore)] + public TileInstance Tile { get; set; } + + [JsonProperty("TileCustomMetadata", NullValueHandling = NullValueHandling.Ignore)] + public TileCustomMetadata TileCustomMetadata { get; set; } + + [JsonProperty("TilesetDef", NullValueHandling = NullValueHandling.Ignore)] + public TilesetDefinition TilesetDef { get; set; } + + [JsonProperty("TilesetRect", NullValueHandling = NullValueHandling.Ignore)] + public TilesetRectangle TilesetRect { get; set; } + + [JsonProperty("World", NullValueHandling = NullValueHandling.Ignore)] + public World World { get; set; } + } + + public partial class EntityInstance + { + /// + /// Grid-based coordinates (`[x,y]` format) + /// + [JsonProperty("__grid")] + public long[] Grid { get; set; } + + /// + /// Entity definition identifier + /// + [JsonProperty("__identifier")] + public string Identifier { get; set; } + + /// + /// Pivot coordinates (`[x,y]` format, values are from 0 to 1) of the Entity + /// + [JsonProperty("__pivot")] + public double[] Pivot { get; set; } + + /// + /// The entity "smart" color, guessed from either Entity definition, or one its field + /// instances. + /// + [JsonProperty("__smartColor")] + public string SmartColor { get; set; } + + /// + /// Array of tags defined in this Entity definition + /// + [JsonProperty("__tags")] + public string[] Tags { get; set; } + + /// + /// Optional TilesetRect used to display this entity (it could either be the default Entity + /// tile, or some tile provided by a field value, like an Enum). + /// + [JsonProperty("__tile")] + public TilesetRectangle Tile { get; set; } + + /// + /// X world coordinate in pixels + /// + [JsonProperty("__worldX")] + public long WorldX { get; set; } + + /// + /// Y world coordinate in pixels + /// + [JsonProperty("__worldY")] + public long WorldY { get; set; } + + /// + /// Reference of the **Entity definition** UID + /// + [JsonProperty("defUid")] + public long DefUid { get; set; } + + /// + /// An array of all custom fields and their values. + /// + [JsonProperty("fieldInstances")] + public FieldInstance[] FieldInstances { get; set; } + + /// + /// Entity height in pixels. For non-resizable entities, it will be the same as Entity + /// definition. + /// + [JsonProperty("height")] + public long Height { get; set; } + + /// + /// Unique instance identifier + /// + [JsonProperty("iid")] + public string Iid { get; set; } + + /// + /// Pixel coordinates (`[x,y]` format) in current level coordinate space. Don't forget + /// optional layer offsets, if they exist! + /// + [JsonProperty("px")] + public long[] Px { get; set; } + + /// + /// Entity width in pixels. For non-resizable entities, it will be the same as Entity + /// definition. + /// + [JsonProperty("width")] + public long Width { get; set; } + } + + public partial class FieldInstance + { + /// + /// Field definition identifier + /// + [JsonProperty("__identifier")] + public string Identifier { get; set; } + + /// + /// Optional TilesetRect used to display this field (this can be the field own Tile, or some + /// other Tile guessed from the value, like an Enum). + /// + [JsonProperty("__tile")] + public TilesetRectangle Tile { get; set; } + + /// + /// Type of the field, such as `Int`, `Float`, `String`, `Enum(my_enum_name)`, `Bool`, + /// etc.
NOTE: if you enable the advanced option **Use Multilines type**, you will have + /// "*Multilines*" instead of "*String*" when relevant. + ///
+ [JsonProperty("__type")] + public string Type { get; set; } + + /// + /// Actual value of the field instance. The value type varies, depending on `__type`:
+ /// - For **classic types** (ie. Integer, Float, Boolean, String, Text and FilePath), you + /// just get the actual value with the expected type.
- For **Color**, the value is an + /// hexadecimal string using "#rrggbb" format.
- For **Enum**, the value is a String + /// representing the selected enum value.
- For **Point**, the value is a + /// [GridPoint](#ldtk-GridPoint) object.
- For **Tile**, the value is a + /// [TilesetRect](#ldtk-TilesetRect) object.
- For **EntityRef**, the value is an + /// [EntityReferenceInfos](#ldtk-EntityReferenceInfos) object.

If the field is an + /// array, then this `__value` will also be a JSON array. + ///
+ [JsonProperty("__value")] + public dynamic Value { get; set; } + + /// + /// Reference of the **Field definition** UID + /// + [JsonProperty("defUid")] + public long DefUid { get; set; } + + /// + /// Editor internal raw values + /// + [JsonProperty("realEditorValues")] + public dynamic[] RealEditorValues { get; set; } + } + + /// + /// This object describes the "location" of an Entity instance in the project worlds. + /// + public partial class ReferenceToAnEntityInstance + { + /// + /// IID of the refered EntityInstance + /// + [JsonProperty("entityIid")] + public string EntityIid { get; set; } + + /// + /// IID of the LayerInstance containing the refered EntityInstance + /// + [JsonProperty("layerIid")] + public string LayerIid { get; set; } + + /// + /// IID of the Level containing the refered EntityInstance + /// + [JsonProperty("levelIid")] + public string LevelIid { get; set; } + + /// + /// IID of the World containing the refered EntityInstance + /// + [JsonProperty("worldIid")] + public string WorldIid { get; set; } + } + + /// + /// This object is just a grid-based coordinate used in Field values. + /// + public partial class GridPoint + { + /// + /// X grid-based coordinate + /// + [JsonProperty("cx")] + public long Cx { get; set; } + + /// + /// Y grid-based coordinate + /// + [JsonProperty("cy")] + public long Cy { get; set; } + } + + /// + /// IntGrid value instance + /// + public partial class IntGridValueInstance + { + /// + /// Coordinate ID in the layer grid + /// + [JsonProperty("coordId")] + public long CoordId { get; set; } + + /// + /// IntGrid value + /// + [JsonProperty("v")] + public long V { get; set; } + } + + public partial class LayerInstance + { + /// + /// Grid-based height + /// + [JsonProperty("__cHei")] + public long CHei { get; set; } + + /// + /// Grid-based width + /// + [JsonProperty("__cWid")] + public long CWid { get; set; } + + /// + /// Grid size + /// + [JsonProperty("__gridSize")] + public long GridSize { get; set; } + + /// + /// Layer definition identifier + /// + [JsonProperty("__identifier")] + public string Identifier { get; set; } + + /// + /// Layer opacity as Float [0-1] + /// + [JsonProperty("__opacity")] + public double Opacity { get; set; } + + /// + /// Total layer X pixel offset, including both instance and definition offsets. + /// + [JsonProperty("__pxTotalOffsetX")] + public long PxTotalOffsetX { get; set; } + + /// + /// Total layer Y pixel offset, including both instance and definition offsets. + /// + [JsonProperty("__pxTotalOffsetY")] + public long PxTotalOffsetY { get; set; } + + /// + /// The definition UID of corresponding Tileset, if any. + /// + [JsonProperty("__tilesetDefUid")] + public long? TilesetDefUid { get; set; } + + /// + /// The relative path to corresponding Tileset, if any. + /// + [JsonProperty("__tilesetRelPath")] + public string TilesetRelPath { get; set; } + + /// + /// Layer type (possible values: IntGrid, Entities, Tiles or AutoLayer) + /// + [JsonProperty("__type")] + public string Type { get; set; } + + /// + /// An array containing all tiles generated by Auto-layer rules. The array is already sorted + /// in display order (ie. 1st tile is beneath 2nd, which is beneath 3rd etc.).

+ /// Note: if multiple tiles are stacked in the same cell as the result of different rules, + /// all tiles behind opaque ones will be discarded. + ///
+ [JsonProperty("autoLayerTiles")] + public TileInstance[] AutoLayerTiles { get; set; } + + [JsonProperty("entityInstances")] + public EntityInstance[] EntityInstances { get; set; } + + [JsonProperty("gridTiles")] + public TileInstance[] GridTiles { get; set; } + + /// + /// Unique layer instance identifier + /// + [JsonProperty("iid")] + public string Iid { get; set; } + + /// + /// **WARNING**: this deprecated value is no longer exported since version 1.0.0 Replaced + /// by: `intGridCsv` + /// + [JsonProperty("intGrid")] + public IntGridValueInstance[] IntGrid { get; set; } + + /// + /// A list of all values in the IntGrid layer, stored in CSV format (Comma Separated + /// Values).
Order is from left to right, and top to bottom (ie. first row from left to + /// right, followed by second row, etc).
`0` means "empty cell" and IntGrid values + /// start at 1.
The array size is `__cWid` x `__cHei` cells. + ///
+ [JsonProperty("intGridCsv")] + public long[] IntGridCsv { get; set; } + + /// + /// Reference the Layer definition UID + /// + [JsonProperty("layerDefUid")] + public long LayerDefUid { get; set; } + + /// + /// Reference to the UID of the level containing this layer instance + /// + [JsonProperty("levelId")] + public long LevelId { get; set; } + + /// + /// An Array containing the UIDs of optional rules that were enabled in this specific layer + /// instance. + /// + [JsonProperty("optionalRules")] + public long[] OptionalRules { get; set; } + + /// + /// This layer can use another tileset by overriding the tileset UID here. + /// + [JsonProperty("overrideTilesetUid")] + public long? OverrideTilesetUid { get; set; } + + /// + /// X offset in pixels to render this layer, usually 0 (IMPORTANT: this should be added to + /// the `LayerDef` optional offset, so you should probably prefer using `__pxTotalOffsetX` + /// which contains the total offset value) + /// + [JsonProperty("pxOffsetX")] + public long PxOffsetX { get; set; } + + /// + /// Y offset in pixels to render this layer, usually 0 (IMPORTANT: this should be added to + /// the `LayerDef` optional offset, so you should probably prefer using `__pxTotalOffsetX` + /// which contains the total offset value) + /// + [JsonProperty("pxOffsetY")] + public long PxOffsetY { get; set; } + + /// + /// Random seed used for Auto-Layers rendering + /// + [JsonProperty("seed")] + public long Seed { get; set; } + + /// + /// Layer instance visibility + /// + [JsonProperty("visible")] + public bool Visible { get; set; } + } + + /// + /// This structure represents a single tile from a given Tileset. + /// + public partial class TileInstance + { + /// + /// Alpha/opacity of the tile (0-1, defaults to 1) + /// + [JsonProperty("a")] + public double A { get; set; } + + /// + /// Internal data used by the editor.
For auto-layer tiles: `[ruleId, coordId]`.
+ /// For tile-layer tiles: `[coordId]`. + ///
+ [JsonProperty("d")] + public long[] D { get; set; } + + /// + /// "Flip bits", a 2-bits integer to represent the mirror transformations of the tile.
+ /// - Bit 0 = X flip
- Bit 1 = Y flip
Examples: f=0 (no flip), f=1 (X flip + /// only), f=2 (Y flip only), f=3 (both flips) + ///
+ [JsonProperty("f")] + public long F { get; set; } + + /// + /// Pixel coordinates of the tile in the **layer** (`[x,y]` format). Don't forget optional + /// layer offsets, if they exist! + /// + [JsonProperty("px")] + public long[] Px { get; set; } + + /// + /// Pixel coordinates of the tile in the **tileset** (`[x,y]` format) + /// + [JsonProperty("src")] + public long[] Src { get; set; } + + /// + /// The *Tile ID* in the corresponding tileset. + /// + [JsonProperty("t")] + public long T { get; set; } + } + + /// + /// This section contains all the level data. It can be found in 2 distinct forms, depending + /// on Project current settings: - If "*Separate level files*" is **disabled** (default): + /// full level data is *embedded* inside the main Project JSON file, - If "*Separate level + /// files*" is **enabled**: level data is stored in *separate* standalone `.ldtkl` files (one + /// per level). In this case, the main Project JSON file will still contain most level data, + /// except heavy sections, like the `layerInstances` array (which will be null). The + /// `externalRelPath` string points to the `ldtkl` file. A `ldtkl` file is just a JSON file + /// containing exactly what is described below. + /// + public partial class Level + { + /// + /// Background color of the level (same as `bgColor`, except the default value is + /// automatically used here if its value is `null`) + /// + [JsonProperty("__bgColor")] + public string BgColor { get; set; } + + /// + /// Position informations of the background image, if there is one. + /// + [JsonProperty("__bgPos")] + public LevelBackgroundPosition BgPos { get; set; } + + /// + /// An array listing all other levels touching this one on the world map.
Only relevant + /// for world layouts where level spatial positioning is manual (ie. GridVania, Free). For + /// Horizontal and Vertical layouts, this array is always empty. + ///
+ [JsonProperty("__neighbours")] + public NeighbourLevel[] Neighbours { get; set; } + + /// + /// The "guessed" color for this level in the editor, decided using either the background + /// color or an existing custom field. + /// + [JsonProperty("__smartColor")] + public string SmartColor { get; set; } + + /// + /// Background color of the level. If `null`, the project `defaultLevelBgColor` should be + /// used. + /// + [JsonProperty("bgColor")] + public string LevelBgColor { get; set; } + + /// + /// Background image X pivot (0-1) + /// + [JsonProperty("bgPivotX")] + public double BgPivotX { get; set; } + + /// + /// Background image Y pivot (0-1) + /// + [JsonProperty("bgPivotY")] + public double BgPivotY { get; set; } + + /// + /// An enum defining the way the background image (if any) is positioned on the level. See + /// `__bgPos` for resulting position info. Possible values: <`null`>, `Unscaled`, + /// `Contain`, `Cover`, `CoverDirty`, `Repeat` + /// + [JsonProperty("bgPos")] + public BgPos? LevelBgPos { get; set; } + + /// + /// The *optional* relative path to the level background image. + /// + [JsonProperty("bgRelPath")] + public string BgRelPath { get; set; } + + /// + /// This value is not null if the project option "*Save levels separately*" is enabled. In + /// this case, this **relative** path points to the level Json file. + /// + [JsonProperty("externalRelPath")] + public string ExternalRelPath { get; set; } + + /// + /// An array containing this level custom field values. + /// + [JsonProperty("fieldInstances")] + public FieldInstance[] FieldInstances { get; set; } + + /// + /// User defined unique identifier + /// + [JsonProperty("identifier")] + public string Identifier { get; set; } + + /// + /// Unique instance identifier + /// + [JsonProperty("iid")] + public string Iid { get; set; } + + /// + /// An array containing all Layer instances. **IMPORTANT**: if the project option "*Save + /// levels separately*" is enabled, this field will be `null`.
This array is **sorted + /// in display order**: the 1st layer is the top-most and the last is behind. + ///
+ [JsonProperty("layerInstances")] + public LayerInstance[] LayerInstances { get; set; } + + /// + /// Height of the level in pixels + /// + [JsonProperty("pxHei")] + public long PxHei { get; set; } + + /// + /// Width of the level in pixels + /// + [JsonProperty("pxWid")] + public long PxWid { get; set; } + + /// + /// Unique Int identifier + /// + [JsonProperty("uid")] + public long Uid { get; set; } + + /// + /// If TRUE, the level identifier will always automatically use the naming pattern as defined + /// in `Project.levelNamePattern`. Becomes FALSE if the identifier is manually modified by + /// user. + /// + [JsonProperty("useAutoIdentifier")] + public bool UseAutoIdentifier { get; set; } + + /// + /// Index that represents the "depth" of the level in the world. Default is 0, greater means + /// "above", lower means "below".
This value is mostly used for display only and is + /// intended to make stacking of levels easier to manage. + ///
+ [JsonProperty("worldDepth")] + public long WorldDepth { get; set; } + + /// + /// World X coordinate in pixels.
Only relevant for world layouts where level spatial + /// positioning is manual (ie. GridVania, Free). For Horizontal and Vertical layouts, the + /// value is always -1 here. + ///
+ [JsonProperty("worldX")] + public long WorldX { get; set; } + + /// + /// World Y coordinate in pixels.
Only relevant for world layouts where level spatial + /// positioning is manual (ie. GridVania, Free). For Horizontal and Vertical layouts, the + /// value is always -1 here. + ///
+ [JsonProperty("worldY")] + public long WorldY { get; set; } + } + + /// + /// Level background image position info + /// + public partial class LevelBackgroundPosition + { + /// + /// An array of 4 float values describing the cropped sub-rectangle of the displayed + /// background image. This cropping happens when original is larger than the level bounds. + /// Array format: `[ cropX, cropY, cropWidth, cropHeight ]` + /// + [JsonProperty("cropRect")] + public double[] CropRect { get; set; } + + /// + /// An array containing the `[scaleX,scaleY]` values of the **cropped** background image, + /// depending on `bgPos` option. + /// + [JsonProperty("scale")] + public double[] Scale { get; set; } + + /// + /// An array containing the `[x,y]` pixel coordinates of the top-left corner of the + /// **cropped** background image, depending on `bgPos` option. + /// + [JsonProperty("topLeftPx")] + public long[] TopLeftPx { get; set; } + } + + /// + /// Nearby level info + /// + public partial class NeighbourLevel + { + /// + /// A single lowercase character tipping on the level location (`n`orth, `s`outh, `w`est, + /// `e`ast). + /// + [JsonProperty("dir")] + public string Dir { get; set; } + + /// + /// Neighbour Instance Identifier + /// + [JsonProperty("levelIid")] + public string LevelIid { get; set; } + + /// + /// **WARNING**: this deprecated value is no longer exported since version 1.2.0 Replaced + /// by: `levelIid` + /// + [JsonProperty("levelUid")] + public long? LevelUid { get; set; } + } + + public partial class LdtkTableOfContentEntry + { + [JsonProperty("identifier")] + public string Identifier { get; set; } + + [JsonProperty("instances")] + public ReferenceToAnEntityInstance[] Instances { get; set; } + } + + /// + /// **IMPORTANT**: this type is available as a preview. You can rely on it to update your + /// importers, for when it will be officially available. A World contains multiple levels, + /// and it has its own layout settings. + /// + public partial class World + { + /// + /// Default new level height + /// + [JsonProperty("defaultLevelHeight")] + public long DefaultLevelHeight { get; set; } + + /// + /// Default new level width + /// + [JsonProperty("defaultLevelWidth")] + public long DefaultLevelWidth { get; set; } + + /// + /// User defined unique identifier + /// + [JsonProperty("identifier")] + public string Identifier { get; set; } + + /// + /// Unique instance identifer + /// + [JsonProperty("iid")] + public string Iid { get; set; } + + /// + /// All levels from this world. The order of this array is only relevant in + /// `LinearHorizontal` and `linearVertical` world layouts (see `worldLayout` value). + /// Otherwise, you should refer to the `worldX`,`worldY` coordinates of each Level. + /// + [JsonProperty("levels")] + public Level[] Levels { get; set; } + + /// + /// Height of the world grid in pixels. + /// + [JsonProperty("worldGridHeight")] + public long WorldGridHeight { get; set; } + + /// + /// Width of the world grid in pixels. + /// + [JsonProperty("worldGridWidth")] + public long WorldGridWidth { get; set; } + + /// + /// An enum that describes how levels are organized in this project (ie. linearly or in a 2D + /// space). Possible values: `Free`, `GridVania`, `LinearHorizontal`, `LinearVertical`, `null` + /// + [JsonProperty("worldLayout")] + public WorldLayout? WorldLayout { get; set; } + } + + /// + /// Possible values: `Manual`, `AfterLoad`, `BeforeSave`, `AfterSave` + /// + public enum When { AfterLoad, AfterSave, BeforeSave, Manual }; + + /// + /// Possible values: `Any`, `OnlySame`, `OnlyTags`, `OnlySpecificEntity` + /// + public enum AllowedRefs { Any, OnlySame, OnlySpecificEntity, OnlyTags }; + + /// + /// Possible values: `Hidden`, `ValueOnly`, `NameAndValue`, `EntityTile`, `LevelTile`, + /// `Points`, `PointStar`, `PointPath`, `PointPathLoop`, `RadiusPx`, `RadiusGrid`, + /// `ArrayCountWithLabel`, `ArrayCountNoLabel`, `RefLinkBetweenPivots`, + /// `RefLinkBetweenCenters` + /// + public enum EditorDisplayMode { ArrayCountNoLabel, ArrayCountWithLabel, EntityTile, Hidden, LevelTile, NameAndValue, PointPath, PointPathLoop, PointStar, Points, RadiusGrid, RadiusPx, RefLinkBetweenCenters, RefLinkBetweenPivots, ValueOnly }; + + /// + /// Possible values: `Above`, `Center`, `Beneath` + /// + public enum EditorDisplayPos { Above, Beneath, Center }; + + /// + /// Possible values: `ZigZag`, `StraightArrow`, `CurvedArrow`, `ArrowsLine`, `DashedLine` + /// + public enum EditorLinkStyle { ArrowsLine, CurvedArrow, DashedLine, StraightArrow, ZigZag }; + + public enum TextLanguageMode { LangC, LangHaxe, LangJs, LangJson, LangLog, LangLua, LangMarkdown, LangPython, LangRuby, LangXml }; + + /// + /// Possible values: `DiscardOldOnes`, `PreventAdding`, `MoveLastOne` + /// + public enum LimitBehavior { DiscardOldOnes, MoveLastOne, PreventAdding }; + + /// + /// If TRUE, the maxCount is a "per world" limit, if FALSE, it's a "per level". Possible + /// values: `PerLayer`, `PerLevel`, `PerWorld` + /// + public enum LimitScope { PerLayer, PerLevel, PerWorld }; + + /// + /// Possible values: `Rectangle`, `Ellipse`, `Tile`, `Cross` + /// + public enum RenderMode { Cross, Ellipse, Rectangle, Tile }; + + /// + /// An enum describing how the the Entity tile is rendered inside the Entity bounds. Possible + /// values: `Cover`, `FitInside`, `Repeat`, `Stretch`, `FullSizeCropped`, + /// `FullSizeUncropped`, `NineSlice` + /// + public enum TileRenderMode { Cover, FitInside, FullSizeCropped, FullSizeUncropped, NineSlice, Repeat, Stretch }; + + /// + /// Checker mode Possible values: `None`, `Horizontal`, `Vertical` + /// + public enum Checker { Horizontal, None, Vertical }; + + /// + /// Defines how tileIds array is used Possible values: `Single`, `Stamp` + /// + public enum TileMode { Single, Stamp }; + + /// + /// Type of the layer as Haxe Enum Possible values: `IntGrid`, `Entities`, `Tiles`, + /// `AutoLayer` + /// + public enum TypeEnum { AutoLayer, Entities, IntGrid, Tiles }; + + public enum EmbedAtlas { LdtkIcons }; + + public enum Flag { DiscardPreCsvIntGrid, ExportPreCsvIntGridFormat, IgnoreBackupSuggest, MultiWorlds, PrependIndexToLevelFileNames, UseMultilinesType }; + + public enum BgPos { Contain, Cover, CoverDirty, Repeat, Unscaled }; + + public enum WorldLayout { Free, GridVania, LinearHorizontal, LinearVertical }; + + /// + /// Naming convention for Identifiers (first-letter uppercase, full uppercase etc.) Possible + /// values: `Capitalize`, `Uppercase`, `Lowercase`, `Free` + /// + public enum IdentifierStyle { Capitalize, Free, Lowercase, Uppercase }; + + /// + /// "Image export" option when saving project. Possible values: `None`, `OneImagePerLayer`, + /// `OneImagePerLevel`, `LayersAndLevels` + /// + public enum ImageExportMode { LayersAndLevels, None, OneImagePerLayer, OneImagePerLevel }; + + public partial class LdtkJson + { + public static LdtkJson FromJson(string json) => JsonConvert.DeserializeObject(json, ldtk.Converter.Settings); + } + + public static class Serialize + { + public static string ToJson(this LdtkJson self) => JsonConvert.SerializeObject(self, ldtk.Converter.Settings); + } + + internal static class Converter + { + public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings + { + MetadataPropertyHandling = MetadataPropertyHandling.Ignore, + DateParseHandling = DateParseHandling.None, + Converters = + { + CheckerConverter.Singleton, + TileModeConverter.Singleton, + WhenConverter.Singleton, + AllowedRefsConverter.Singleton, + EditorDisplayModeConverter.Singleton, + EditorDisplayPosConverter.Singleton, + EditorLinkStyleConverter.Singleton, + TextLanguageModeConverter.Singleton, + LimitBehaviorConverter.Singleton, + LimitScopeConverter.Singleton, + RenderModeConverter.Singleton, + TileRenderModeConverter.Singleton, + TypeEnumConverter.Singleton, + EmbedAtlasConverter.Singleton, + BgPosConverter.Singleton, + WorldLayoutConverter.Singleton, + FlagConverter.Singleton, + IdentifierStyleConverter.Singleton, + ImageExportModeConverter.Singleton, + new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeUniversal } + }, + }; + } + + internal class CheckerConverter : JsonConverter + { + public override bool CanConvert(Type t) => t == typeof(Checker) || t == typeof(Checker?); + + public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType == JsonToken.Null) return null; + var value = serializer.Deserialize(reader); + switch (value) + { + case "Horizontal": + return Checker.Horizontal; + case "None": + return Checker.None; + case "Vertical": + return Checker.Vertical; + } + throw new Exception("Cannot unmarshal type Checker"); + } + + public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer) + { + if (untypedValue == null) + { + serializer.Serialize(writer, null); + return; + } + var value = (Checker)untypedValue; + switch (value) + { + case Checker.Horizontal: + serializer.Serialize(writer, "Horizontal"); + return; + case Checker.None: + serializer.Serialize(writer, "None"); + return; + case Checker.Vertical: + serializer.Serialize(writer, "Vertical"); + return; + } + throw new Exception("Cannot marshal type Checker"); + } + + public static readonly CheckerConverter Singleton = new CheckerConverter(); + } + + internal class TileModeConverter : JsonConverter + { + public override bool CanConvert(Type t) => t == typeof(TileMode) || t == typeof(TileMode?); + + public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType == JsonToken.Null) return null; + var value = serializer.Deserialize(reader); + switch (value) + { + case "Single": + return TileMode.Single; + case "Stamp": + return TileMode.Stamp; + } + throw new Exception("Cannot unmarshal type TileMode"); + } + + public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer) + { + if (untypedValue == null) + { + serializer.Serialize(writer, null); + return; + } + var value = (TileMode)untypedValue; + switch (value) + { + case TileMode.Single: + serializer.Serialize(writer, "Single"); + return; + case TileMode.Stamp: + serializer.Serialize(writer, "Stamp"); + return; + } + throw new Exception("Cannot marshal type TileMode"); + } + + public static readonly TileModeConverter Singleton = new TileModeConverter(); + } + + internal class WhenConverter : JsonConverter + { + public override bool CanConvert(Type t) => t == typeof(When) || t == typeof(When?); + + public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType == JsonToken.Null) return null; + var value = serializer.Deserialize(reader); + switch (value) + { + case "AfterLoad": + return When.AfterLoad; + case "AfterSave": + return When.AfterSave; + case "BeforeSave": + return When.BeforeSave; + case "Manual": + return When.Manual; + } + throw new Exception("Cannot unmarshal type When"); + } + + public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer) + { + if (untypedValue == null) + { + serializer.Serialize(writer, null); + return; + } + var value = (When)untypedValue; + switch (value) + { + case When.AfterLoad: + serializer.Serialize(writer, "AfterLoad"); + return; + case When.AfterSave: + serializer.Serialize(writer, "AfterSave"); + return; + case When.BeforeSave: + serializer.Serialize(writer, "BeforeSave"); + return; + case When.Manual: + serializer.Serialize(writer, "Manual"); + return; + } + throw new Exception("Cannot marshal type When"); + } + + public static readonly WhenConverter Singleton = new WhenConverter(); + } + + internal class AllowedRefsConverter : JsonConverter + { + public override bool CanConvert(Type t) => t == typeof(AllowedRefs) || t == typeof(AllowedRefs?); + + public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType == JsonToken.Null) return null; + var value = serializer.Deserialize(reader); + switch (value) + { + case "Any": + return AllowedRefs.Any; + case "OnlySame": + return AllowedRefs.OnlySame; + case "OnlySpecificEntity": + return AllowedRefs.OnlySpecificEntity; + case "OnlyTags": + return AllowedRefs.OnlyTags; + } + throw new Exception("Cannot unmarshal type AllowedRefs"); + } + + public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer) + { + if (untypedValue == null) + { + serializer.Serialize(writer, null); + return; + } + var value = (AllowedRefs)untypedValue; + switch (value) + { + case AllowedRefs.Any: + serializer.Serialize(writer, "Any"); + return; + case AllowedRefs.OnlySame: + serializer.Serialize(writer, "OnlySame"); + return; + case AllowedRefs.OnlySpecificEntity: + serializer.Serialize(writer, "OnlySpecificEntity"); + return; + case AllowedRefs.OnlyTags: + serializer.Serialize(writer, "OnlyTags"); + return; + } + throw new Exception("Cannot marshal type AllowedRefs"); + } + + public static readonly AllowedRefsConverter Singleton = new AllowedRefsConverter(); + } + + internal class EditorDisplayModeConverter : JsonConverter + { + public override bool CanConvert(Type t) => t == typeof(EditorDisplayMode) || t == typeof(EditorDisplayMode?); + + public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType == JsonToken.Null) return null; + var value = serializer.Deserialize(reader); + switch (value) + { + case "ArrayCountNoLabel": + return EditorDisplayMode.ArrayCountNoLabel; + case "ArrayCountWithLabel": + return EditorDisplayMode.ArrayCountWithLabel; + case "EntityTile": + return EditorDisplayMode.EntityTile; + case "Hidden": + return EditorDisplayMode.Hidden; + case "LevelTile": + return EditorDisplayMode.LevelTile; + case "NameAndValue": + return EditorDisplayMode.NameAndValue; + case "PointPath": + return EditorDisplayMode.PointPath; + case "PointPathLoop": + return EditorDisplayMode.PointPathLoop; + case "PointStar": + return EditorDisplayMode.PointStar; + case "Points": + return EditorDisplayMode.Points; + case "RadiusGrid": + return EditorDisplayMode.RadiusGrid; + case "RadiusPx": + return EditorDisplayMode.RadiusPx; + case "RefLinkBetweenCenters": + return EditorDisplayMode.RefLinkBetweenCenters; + case "RefLinkBetweenPivots": + return EditorDisplayMode.RefLinkBetweenPivots; + case "ValueOnly": + return EditorDisplayMode.ValueOnly; + } + throw new Exception("Cannot unmarshal type EditorDisplayMode"); + } + + public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer) + { + if (untypedValue == null) + { + serializer.Serialize(writer, null); + return; + } + var value = (EditorDisplayMode)untypedValue; + switch (value) + { + case EditorDisplayMode.ArrayCountNoLabel: + serializer.Serialize(writer, "ArrayCountNoLabel"); + return; + case EditorDisplayMode.ArrayCountWithLabel: + serializer.Serialize(writer, "ArrayCountWithLabel"); + return; + case EditorDisplayMode.EntityTile: + serializer.Serialize(writer, "EntityTile"); + return; + case EditorDisplayMode.Hidden: + serializer.Serialize(writer, "Hidden"); + return; + case EditorDisplayMode.LevelTile: + serializer.Serialize(writer, "LevelTile"); + return; + case EditorDisplayMode.NameAndValue: + serializer.Serialize(writer, "NameAndValue"); + return; + case EditorDisplayMode.PointPath: + serializer.Serialize(writer, "PointPath"); + return; + case EditorDisplayMode.PointPathLoop: + serializer.Serialize(writer, "PointPathLoop"); + return; + case EditorDisplayMode.PointStar: + serializer.Serialize(writer, "PointStar"); + return; + case EditorDisplayMode.Points: + serializer.Serialize(writer, "Points"); + return; + case EditorDisplayMode.RadiusGrid: + serializer.Serialize(writer, "RadiusGrid"); + return; + case EditorDisplayMode.RadiusPx: + serializer.Serialize(writer, "RadiusPx"); + return; + case EditorDisplayMode.RefLinkBetweenCenters: + serializer.Serialize(writer, "RefLinkBetweenCenters"); + return; + case EditorDisplayMode.RefLinkBetweenPivots: + serializer.Serialize(writer, "RefLinkBetweenPivots"); + return; + case EditorDisplayMode.ValueOnly: + serializer.Serialize(writer, "ValueOnly"); + return; + } + throw new Exception("Cannot marshal type EditorDisplayMode"); + } + + public static readonly EditorDisplayModeConverter Singleton = new EditorDisplayModeConverter(); + } + + internal class EditorDisplayPosConverter : JsonConverter + { + public override bool CanConvert(Type t) => t == typeof(EditorDisplayPos) || t == typeof(EditorDisplayPos?); + + public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType == JsonToken.Null) return null; + var value = serializer.Deserialize(reader); + switch (value) + { + case "Above": + return EditorDisplayPos.Above; + case "Beneath": + return EditorDisplayPos.Beneath; + case "Center": + return EditorDisplayPos.Center; + } + throw new Exception("Cannot unmarshal type EditorDisplayPos"); + } + + public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer) + { + if (untypedValue == null) + { + serializer.Serialize(writer, null); + return; + } + var value = (EditorDisplayPos)untypedValue; + switch (value) + { + case EditorDisplayPos.Above: + serializer.Serialize(writer, "Above"); + return; + case EditorDisplayPos.Beneath: + serializer.Serialize(writer, "Beneath"); + return; + case EditorDisplayPos.Center: + serializer.Serialize(writer, "Center"); + return; + } + throw new Exception("Cannot marshal type EditorDisplayPos"); + } + + public static readonly EditorDisplayPosConverter Singleton = new EditorDisplayPosConverter(); + } + + internal class EditorLinkStyleConverter : JsonConverter + { + public override bool CanConvert(Type t) => t == typeof(EditorLinkStyle) || t == typeof(EditorLinkStyle?); + + public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType == JsonToken.Null) return null; + var value = serializer.Deserialize(reader); + switch (value) + { + case "ArrowsLine": + return EditorLinkStyle.ArrowsLine; + case "CurvedArrow": + return EditorLinkStyle.CurvedArrow; + case "DashedLine": + return EditorLinkStyle.DashedLine; + case "StraightArrow": + return EditorLinkStyle.StraightArrow; + case "ZigZag": + return EditorLinkStyle.ZigZag; + } + throw new Exception("Cannot unmarshal type EditorLinkStyle"); + } + + public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer) + { + if (untypedValue == null) + { + serializer.Serialize(writer, null); + return; + } + var value = (EditorLinkStyle)untypedValue; + switch (value) + { + case EditorLinkStyle.ArrowsLine: + serializer.Serialize(writer, "ArrowsLine"); + return; + case EditorLinkStyle.CurvedArrow: + serializer.Serialize(writer, "CurvedArrow"); + return; + case EditorLinkStyle.DashedLine: + serializer.Serialize(writer, "DashedLine"); + return; + case EditorLinkStyle.StraightArrow: + serializer.Serialize(writer, "StraightArrow"); + return; + case EditorLinkStyle.ZigZag: + serializer.Serialize(writer, "ZigZag"); + return; + } + throw new Exception("Cannot marshal type EditorLinkStyle"); + } + + public static readonly EditorLinkStyleConverter Singleton = new EditorLinkStyleConverter(); + } + + internal class TextLanguageModeConverter : JsonConverter + { + public override bool CanConvert(Type t) => t == typeof(TextLanguageMode) || t == typeof(TextLanguageMode?); + + public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType == JsonToken.Null) return null; + var value = serializer.Deserialize(reader); + switch (value) + { + case "LangC": + return TextLanguageMode.LangC; + case "LangHaxe": + return TextLanguageMode.LangHaxe; + case "LangJS": + return TextLanguageMode.LangJs; + case "LangJson": + return TextLanguageMode.LangJson; + case "LangLog": + return TextLanguageMode.LangLog; + case "LangLua": + return TextLanguageMode.LangLua; + case "LangMarkdown": + return TextLanguageMode.LangMarkdown; + case "LangPython": + return TextLanguageMode.LangPython; + case "LangRuby": + return TextLanguageMode.LangRuby; + case "LangXml": + return TextLanguageMode.LangXml; + } + throw new Exception("Cannot unmarshal type TextLanguageMode"); + } + + public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer) + { + if (untypedValue == null) + { + serializer.Serialize(writer, null); + return; + } + var value = (TextLanguageMode)untypedValue; + switch (value) + { + case TextLanguageMode.LangC: + serializer.Serialize(writer, "LangC"); + return; + case TextLanguageMode.LangHaxe: + serializer.Serialize(writer, "LangHaxe"); + return; + case TextLanguageMode.LangJs: + serializer.Serialize(writer, "LangJS"); + return; + case TextLanguageMode.LangJson: + serializer.Serialize(writer, "LangJson"); + return; + case TextLanguageMode.LangLog: + serializer.Serialize(writer, "LangLog"); + return; + case TextLanguageMode.LangLua: + serializer.Serialize(writer, "LangLua"); + return; + case TextLanguageMode.LangMarkdown: + serializer.Serialize(writer, "LangMarkdown"); + return; + case TextLanguageMode.LangPython: + serializer.Serialize(writer, "LangPython"); + return; + case TextLanguageMode.LangRuby: + serializer.Serialize(writer, "LangRuby"); + return; + case TextLanguageMode.LangXml: + serializer.Serialize(writer, "LangXml"); + return; + } + throw new Exception("Cannot marshal type TextLanguageMode"); + } + + public static readonly TextLanguageModeConverter Singleton = new TextLanguageModeConverter(); + } + + internal class LimitBehaviorConverter : JsonConverter + { + public override bool CanConvert(Type t) => t == typeof(LimitBehavior) || t == typeof(LimitBehavior?); + + public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType == JsonToken.Null) return null; + var value = serializer.Deserialize(reader); + switch (value) + { + case "DiscardOldOnes": + return LimitBehavior.DiscardOldOnes; + case "MoveLastOne": + return LimitBehavior.MoveLastOne; + case "PreventAdding": + return LimitBehavior.PreventAdding; + } + throw new Exception("Cannot unmarshal type LimitBehavior"); + } + + public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer) + { + if (untypedValue == null) + { + serializer.Serialize(writer, null); + return; + } + var value = (LimitBehavior)untypedValue; + switch (value) + { + case LimitBehavior.DiscardOldOnes: + serializer.Serialize(writer, "DiscardOldOnes"); + return; + case LimitBehavior.MoveLastOne: + serializer.Serialize(writer, "MoveLastOne"); + return; + case LimitBehavior.PreventAdding: + serializer.Serialize(writer, "PreventAdding"); + return; + } + throw new Exception("Cannot marshal type LimitBehavior"); + } + + public static readonly LimitBehaviorConverter Singleton = new LimitBehaviorConverter(); + } + + internal class LimitScopeConverter : JsonConverter + { + public override bool CanConvert(Type t) => t == typeof(LimitScope) || t == typeof(LimitScope?); + + public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType == JsonToken.Null) return null; + var value = serializer.Deserialize(reader); + switch (value) + { + case "PerLayer": + return LimitScope.PerLayer; + case "PerLevel": + return LimitScope.PerLevel; + case "PerWorld": + return LimitScope.PerWorld; + } + throw new Exception("Cannot unmarshal type LimitScope"); + } + + public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer) + { + if (untypedValue == null) + { + serializer.Serialize(writer, null); + return; + } + var value = (LimitScope)untypedValue; + switch (value) + { + case LimitScope.PerLayer: + serializer.Serialize(writer, "PerLayer"); + return; + case LimitScope.PerLevel: + serializer.Serialize(writer, "PerLevel"); + return; + case LimitScope.PerWorld: + serializer.Serialize(writer, "PerWorld"); + return; + } + throw new Exception("Cannot marshal type LimitScope"); + } + + public static readonly LimitScopeConverter Singleton = new LimitScopeConverter(); + } + + internal class RenderModeConverter : JsonConverter + { + public override bool CanConvert(Type t) => t == typeof(RenderMode) || t == typeof(RenderMode?); + + public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType == JsonToken.Null) return null; + var value = serializer.Deserialize(reader); + switch (value) + { + case "Cross": + return RenderMode.Cross; + case "Ellipse": + return RenderMode.Ellipse; + case "Rectangle": + return RenderMode.Rectangle; + case "Tile": + return RenderMode.Tile; + } + throw new Exception("Cannot unmarshal type RenderMode"); + } + + public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer) + { + if (untypedValue == null) + { + serializer.Serialize(writer, null); + return; + } + var value = (RenderMode)untypedValue; + switch (value) + { + case RenderMode.Cross: + serializer.Serialize(writer, "Cross"); + return; + case RenderMode.Ellipse: + serializer.Serialize(writer, "Ellipse"); + return; + case RenderMode.Rectangle: + serializer.Serialize(writer, "Rectangle"); + return; + case RenderMode.Tile: + serializer.Serialize(writer, "Tile"); + return; + } + throw new Exception("Cannot marshal type RenderMode"); + } + + public static readonly RenderModeConverter Singleton = new RenderModeConverter(); + } + + internal class TileRenderModeConverter : JsonConverter + { + public override bool CanConvert(Type t) => t == typeof(TileRenderMode) || t == typeof(TileRenderMode?); + + public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType == JsonToken.Null) return null; + var value = serializer.Deserialize(reader); + switch (value) + { + case "Cover": + return TileRenderMode.Cover; + case "FitInside": + return TileRenderMode.FitInside; + case "FullSizeCropped": + return TileRenderMode.FullSizeCropped; + case "FullSizeUncropped": + return TileRenderMode.FullSizeUncropped; + case "NineSlice": + return TileRenderMode.NineSlice; + case "Repeat": + return TileRenderMode.Repeat; + case "Stretch": + return TileRenderMode.Stretch; + } + throw new Exception("Cannot unmarshal type TileRenderMode"); + } + + public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer) + { + if (untypedValue == null) + { + serializer.Serialize(writer, null); + return; + } + var value = (TileRenderMode)untypedValue; + switch (value) + { + case TileRenderMode.Cover: + serializer.Serialize(writer, "Cover"); + return; + case TileRenderMode.FitInside: + serializer.Serialize(writer, "FitInside"); + return; + case TileRenderMode.FullSizeCropped: + serializer.Serialize(writer, "FullSizeCropped"); + return; + case TileRenderMode.FullSizeUncropped: + serializer.Serialize(writer, "FullSizeUncropped"); + return; + case TileRenderMode.NineSlice: + serializer.Serialize(writer, "NineSlice"); + return; + case TileRenderMode.Repeat: + serializer.Serialize(writer, "Repeat"); + return; + case TileRenderMode.Stretch: + serializer.Serialize(writer, "Stretch"); + return; + } + throw new Exception("Cannot marshal type TileRenderMode"); + } + + public static readonly TileRenderModeConverter Singleton = new TileRenderModeConverter(); + } + + internal class TypeEnumConverter : JsonConverter + { + public override bool CanConvert(Type t) => t == typeof(TypeEnum) || t == typeof(TypeEnum?); + + public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType == JsonToken.Null) return null; + var value = serializer.Deserialize(reader); + switch (value) + { + case "AutoLayer": + return TypeEnum.AutoLayer; + case "Entities": + return TypeEnum.Entities; + case "IntGrid": + return TypeEnum.IntGrid; + case "Tiles": + return TypeEnum.Tiles; + } + throw new Exception("Cannot unmarshal type TypeEnum"); + } + + public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer) + { + if (untypedValue == null) + { + serializer.Serialize(writer, null); + return; + } + var value = (TypeEnum)untypedValue; + switch (value) + { + case TypeEnum.AutoLayer: + serializer.Serialize(writer, "AutoLayer"); + return; + case TypeEnum.Entities: + serializer.Serialize(writer, "Entities"); + return; + case TypeEnum.IntGrid: + serializer.Serialize(writer, "IntGrid"); + return; + case TypeEnum.Tiles: + serializer.Serialize(writer, "Tiles"); + return; + } + throw new Exception("Cannot marshal type TypeEnum"); + } + + public static readonly TypeEnumConverter Singleton = new TypeEnumConverter(); + } + + internal class EmbedAtlasConverter : JsonConverter + { + public override bool CanConvert(Type t) => t == typeof(EmbedAtlas) || t == typeof(EmbedAtlas?); + + public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType == JsonToken.Null) return null; + var value = serializer.Deserialize(reader); + if (value == "LdtkIcons") + { + return EmbedAtlas.LdtkIcons; + } + throw new Exception("Cannot unmarshal type EmbedAtlas"); + } + + public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer) + { + if (untypedValue == null) + { + serializer.Serialize(writer, null); + return; + } + var value = (EmbedAtlas)untypedValue; + if (value == EmbedAtlas.LdtkIcons) + { + serializer.Serialize(writer, "LdtkIcons"); + return; + } + throw new Exception("Cannot marshal type EmbedAtlas"); + } + + public static readonly EmbedAtlasConverter Singleton = new EmbedAtlasConverter(); + } + + internal class BgPosConverter : JsonConverter + { + public override bool CanConvert(Type t) => t == typeof(BgPos) || t == typeof(BgPos?); + + public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType == JsonToken.Null) return null; + var value = serializer.Deserialize(reader); + switch (value) + { + case "Contain": + return BgPos.Contain; + case "Cover": + return BgPos.Cover; + case "CoverDirty": + return BgPos.CoverDirty; + case "Repeat": + return BgPos.Repeat; + case "Unscaled": + return BgPos.Unscaled; + } + throw new Exception("Cannot unmarshal type BgPos"); + } + + public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer) + { + if (untypedValue == null) + { + serializer.Serialize(writer, null); + return; + } + var value = (BgPos)untypedValue; + switch (value) + { + case BgPos.Contain: + serializer.Serialize(writer, "Contain"); + return; + case BgPos.Cover: + serializer.Serialize(writer, "Cover"); + return; + case BgPos.CoverDirty: + serializer.Serialize(writer, "CoverDirty"); + return; + case BgPos.Repeat: + serializer.Serialize(writer, "Repeat"); + return; + case BgPos.Unscaled: + serializer.Serialize(writer, "Unscaled"); + return; + } + throw new Exception("Cannot marshal type BgPos"); + } + + public static readonly BgPosConverter Singleton = new BgPosConverter(); + } + + internal class WorldLayoutConverter : JsonConverter + { + public override bool CanConvert(Type t) => t == typeof(WorldLayout) || t == typeof(WorldLayout?); + + public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType == JsonToken.Null) return null; + var value = serializer.Deserialize(reader); + switch (value) + { + case "Free": + return WorldLayout.Free; + case "GridVania": + return WorldLayout.GridVania; + case "LinearHorizontal": + return WorldLayout.LinearHorizontal; + case "LinearVertical": + return WorldLayout.LinearVertical; + } + throw new Exception("Cannot unmarshal type WorldLayout"); + } + + public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer) + { + if (untypedValue == null) + { + serializer.Serialize(writer, null); + return; + } + var value = (WorldLayout)untypedValue; + switch (value) + { + case WorldLayout.Free: + serializer.Serialize(writer, "Free"); + return; + case WorldLayout.GridVania: + serializer.Serialize(writer, "GridVania"); + return; + case WorldLayout.LinearHorizontal: + serializer.Serialize(writer, "LinearHorizontal"); + return; + case WorldLayout.LinearVertical: + serializer.Serialize(writer, "LinearVertical"); + return; + } + throw new Exception("Cannot marshal type WorldLayout"); + } + + public static readonly WorldLayoutConverter Singleton = new WorldLayoutConverter(); + } + + internal class FlagConverter : JsonConverter + { + public override bool CanConvert(Type t) => t == typeof(Flag) || t == typeof(Flag?); + + public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType == JsonToken.Null) return null; + var value = serializer.Deserialize(reader); + switch (value) + { + case "DiscardPreCsvIntGrid": + return Flag.DiscardPreCsvIntGrid; + case "ExportPreCsvIntGridFormat": + return Flag.ExportPreCsvIntGridFormat; + case "IgnoreBackupSuggest": + return Flag.IgnoreBackupSuggest; + case "MultiWorlds": + return Flag.MultiWorlds; + case "PrependIndexToLevelFileNames": + return Flag.PrependIndexToLevelFileNames; + case "UseMultilinesType": + return Flag.UseMultilinesType; + } + throw new Exception("Cannot unmarshal type Flag"); + } + + public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer) + { + if (untypedValue == null) + { + serializer.Serialize(writer, null); + return; + } + var value = (Flag)untypedValue; + switch (value) + { + case Flag.DiscardPreCsvIntGrid: + serializer.Serialize(writer, "DiscardPreCsvIntGrid"); + return; + case Flag.ExportPreCsvIntGridFormat: + serializer.Serialize(writer, "ExportPreCsvIntGridFormat"); + return; + case Flag.IgnoreBackupSuggest: + serializer.Serialize(writer, "IgnoreBackupSuggest"); + return; + case Flag.MultiWorlds: + serializer.Serialize(writer, "MultiWorlds"); + return; + case Flag.PrependIndexToLevelFileNames: + serializer.Serialize(writer, "PrependIndexToLevelFileNames"); + return; + case Flag.UseMultilinesType: + serializer.Serialize(writer, "UseMultilinesType"); + return; + } + throw new Exception("Cannot marshal type Flag"); + } + + public static readonly FlagConverter Singleton = new FlagConverter(); + } + + internal class IdentifierStyleConverter : JsonConverter + { + public override bool CanConvert(Type t) => t == typeof(IdentifierStyle) || t == typeof(IdentifierStyle?); + + public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType == JsonToken.Null) return null; + var value = serializer.Deserialize(reader); + switch (value) + { + case "Capitalize": + return IdentifierStyle.Capitalize; + case "Free": + return IdentifierStyle.Free; + case "Lowercase": + return IdentifierStyle.Lowercase; + case "Uppercase": + return IdentifierStyle.Uppercase; + } + throw new Exception("Cannot unmarshal type IdentifierStyle"); + } + + public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer) + { + if (untypedValue == null) + { + serializer.Serialize(writer, null); + return; + } + var value = (IdentifierStyle)untypedValue; + switch (value) + { + case IdentifierStyle.Capitalize: + serializer.Serialize(writer, "Capitalize"); + return; + case IdentifierStyle.Free: + serializer.Serialize(writer, "Free"); + return; + case IdentifierStyle.Lowercase: + serializer.Serialize(writer, "Lowercase"); + return; + case IdentifierStyle.Uppercase: + serializer.Serialize(writer, "Uppercase"); + return; + } + throw new Exception("Cannot marshal type IdentifierStyle"); + } + + public static readonly IdentifierStyleConverter Singleton = new IdentifierStyleConverter(); + } + + internal class ImageExportModeConverter : JsonConverter + { + public override bool CanConvert(Type t) => t == typeof(ImageExportMode) || t == typeof(ImageExportMode?); + + public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType == JsonToken.Null) return null; + var value = serializer.Deserialize(reader); + switch (value) + { + case "LayersAndLevels": + return ImageExportMode.LayersAndLevels; + case "None": + return ImageExportMode.None; + case "OneImagePerLayer": + return ImageExportMode.OneImagePerLayer; + case "OneImagePerLevel": + return ImageExportMode.OneImagePerLevel; + } + throw new Exception("Cannot unmarshal type ImageExportMode"); + } + + public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer) + { + if (untypedValue == null) + { + serializer.Serialize(writer, null); + return; + } + var value = (ImageExportMode)untypedValue; + switch (value) + { + case ImageExportMode.LayersAndLevels: + serializer.Serialize(writer, "LayersAndLevels"); + return; + case ImageExportMode.None: + serializer.Serialize(writer, "None"); + return; + case ImageExportMode.OneImagePerLayer: + serializer.Serialize(writer, "OneImagePerLayer"); + return; + case ImageExportMode.OneImagePerLevel: + serializer.Serialize(writer, "OneImagePerLevel"); + return; + } + throw new Exception("Cannot marshal type ImageExportMode"); + } + + public static readonly ImageExportModeConverter Singleton = new ImageExportModeConverter(); + } +} diff --git a/docs/archives/1.3.4/quicktype/LdtkJson.go b/docs/archives/1.3.4/quicktype/LdtkJson.go new file mode 100644 index 000000000..9fa5bc3b1 --- /dev/null +++ b/docs/archives/1.3.4/quicktype/LdtkJson.go @@ -0,0 +1,1111 @@ +// This file was generated from JSON Schema using quicktype, do not modify it directly. +// To parse and unparse this JSON data, add this code to your project and do: +// +// ldtkJSON, err := UnmarshalLdtkJSON(bytes) +// bytes, err = ldtkJSON.Marshal() + +package main + +import "encoding/json" + +func UnmarshalLdtkJSON(data []byte) (LdtkJSON, error) { + var r LdtkJSON + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *LdtkJSON) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +// This file is a JSON schema of files created by LDtk level editor (https://ldtk.io). +// +// This is the root of any Project JSON file. It contains: - the project settings, - an +// array of levels, - a group of definitions (that can probably be safely ignored for most +// users). +type LdtkJSON struct { + // This object is not actually used by LDtk. It ONLY exists to force explicit references to + // all types, to make sure QuickType finds them and integrate all of them. Otherwise, + // Quicktype will drop types that are not explicitely used. + ForcedRefs *ForcedRefs `json:"__FORCED_REFS,omitempty"` + // LDtk application build identifier.
This is only used to identify the LDtk version + // that generated this particular project file, which can be useful for specific bug fixing. + // Note that the build identifier is just the date of the release, so it's not unique to + // each user (one single global ID per LDtk public release), and as a result, completely + // anonymous. + AppBuildID float64 `json:"appBuildId"` + // Number of backup files to keep, if the `backupOnSave` is TRUE + BackupLimit int64 `json:"backupLimit"` + // If TRUE, an extra copy of the project will be created in a sub folder, when saving. + BackupOnSave bool `json:"backupOnSave"` + // Target relative path to store backup files + BackupRelPath *string `json:"backupRelPath"` + // Project background color + BgColor string `json:"bgColor"` + // An array of command lines that can be ran manually by the user + CustomCommands []LdtkCustomCommand `json:"customCommands"` + // Default height for new entities + DefaultEntityHeight int64 `json:"defaultEntityHeight"` + // Default width for new entities + DefaultEntityWidth int64 `json:"defaultEntityWidth"` + // Default grid size for new layers + DefaultGridSize int64 `json:"defaultGridSize"` + // Default background color of levels + DefaultLevelBgColor string `json:"defaultLevelBgColor"` + // **WARNING**: this field will move to the `worlds` array after the "multi-worlds" update. + // It will then be `null`. You can enable the Multi-worlds advanced project option to enable + // the change immediately.

Default new level height + DefaultLevelHeight *int64 `json:"defaultLevelHeight"` + // **WARNING**: this field will move to the `worlds` array after the "multi-worlds" update. + // It will then be `null`. You can enable the Multi-worlds advanced project option to enable + // the change immediately.

Default new level width + DefaultLevelWidth *int64 `json:"defaultLevelWidth"` + // Default X pivot (0 to 1) for new entities + DefaultPivotX float64 `json:"defaultPivotX"` + // Default Y pivot (0 to 1) for new entities + DefaultPivotY float64 `json:"defaultPivotY"` + // A structure containing all the definitions of this project + Defs Definitions `json:"defs"` + // If the project isn't in MultiWorlds mode, this is the IID of the internal "dummy" World. + DummyWorldIid string `json:"dummyWorldIid"` + // If TRUE, the exported PNGs will include the level background (color or image). + ExportLevelBg bool `json:"exportLevelBg"` + // **WARNING**: this deprecated value is no longer exported since version 0.9.3 Replaced + // by: `imageExportMode` + ExportPNG *bool `json:"exportPng"` + // If TRUE, a Tiled compatible file will also be generated along with the LDtk JSON file + // (default is FALSE) + ExportTiled bool `json:"exportTiled"` + // If TRUE, one file will be saved for the project (incl. all its definitions) and one file + // in a sub-folder for each level. + ExternalLevels bool `json:"externalLevels"` + // An array containing various advanced flags (ie. options or other states). Possible + // values: `DiscardPreCsvIntGrid`, `ExportPreCsvIntGridFormat`, `IgnoreBackupSuggest`, + // `PrependIndexToLevelFileNames`, `MultiWorlds`, `UseMultilinesType` + Flags []Flag `json:"flags"` + // Naming convention for Identifiers (first-letter uppercase, full uppercase etc.) Possible + // values: `Capitalize`, `Uppercase`, `Lowercase`, `Free` + IdentifierStyle IdentifierStyle `json:"identifierStyle"` + // Unique project identifier + Iid string `json:"iid"` + // "Image export" option when saving project. Possible values: `None`, `OneImagePerLayer`, + // `OneImagePerLevel`, `LayersAndLevels` + ImageExportMode ImageExportMode `json:"imageExportMode"` + // File format version + JSONVersion string `json:"jsonVersion"` + // The default naming convention for level identifiers. + LevelNamePattern string `json:"levelNamePattern"` + // All levels. The order of this array is only relevant in `LinearHorizontal` and + // `linearVertical` world layouts (see `worldLayout` value).
Otherwise, you should + // refer to the `worldX`,`worldY` coordinates of each Level. + Levels []Level `json:"levels"` + // If TRUE, the Json is partially minified (no indentation, nor line breaks, default is + // FALSE) + MinifyJSON bool `json:"minifyJson"` + // Next Unique integer ID available + NextUid int64 `json:"nextUid"` + // File naming pattern for exported PNGs + PNGFilePattern *string `json:"pngFilePattern"` + // If TRUE, a very simplified will be generated on saving, for quicker & easier engine + // integration. + SimplifiedExport bool `json:"simplifiedExport"` + // All instances of entities that have their `exportToToc` flag enabled are listed in this + // array. + Toc []LdtkTableOfContentEntry `json:"toc"` + // This optional description is used by LDtk Samples to show up some informations and + // instructions. + TutorialDesc *string `json:"tutorialDesc"` + // **WARNING**: this field will move to the `worlds` array after the "multi-worlds" update. + // It will then be `null`. You can enable the Multi-worlds advanced project option to enable + // the change immediately.

Height of the world grid in pixels. + WorldGridHeight *int64 `json:"worldGridHeight"` + // **WARNING**: this field will move to the `worlds` array after the "multi-worlds" update. + // It will then be `null`. You can enable the Multi-worlds advanced project option to enable + // the change immediately.

Width of the world grid in pixels. + WorldGridWidth *int64 `json:"worldGridWidth"` + // **WARNING**: this field will move to the `worlds` array after the "multi-worlds" update. + // It will then be `null`. You can enable the Multi-worlds advanced project option to enable + // the change immediately.

An enum that describes how levels are organized in + // this project (ie. linearly or in a 2D space). Possible values: <`null`>, `Free`, + // `GridVania`, `LinearHorizontal`, `LinearVertical` + WorldLayout *WorldLayout `json:"worldLayout"` + // This array will be empty, unless you enable the Multi-Worlds in the project advanced + // settings.

- in current version, a LDtk project file can only contain a single + // world with multiple levels in it. In this case, levels and world layout related settings + // are stored in the root of the JSON.
- with "Multi-worlds" enabled, there will be a + // `worlds` array in root, each world containing levels and layout settings. Basically, it's + // pretty much only about moving the `levels` array to the `worlds` array, along with world + // layout related values (eg. `worldGridWidth` etc).

If you want to start + // supporting this future update easily, please refer to this documentation: + // https://github.com/deepnight/ldtk/issues/231 + Worlds []World `json:"worlds"` +} + +type LdtkCustomCommand struct { + Command string `json:"command"` + // Possible values: `Manual`, `AfterLoad`, `BeforeSave`, `AfterSave` + When When `json:"when"` +} + +// If you're writing your own LDtk importer, you should probably just ignore *most* stuff in +// the `defs` section, as it contains data that are mostly important to the editor. To keep +// you away from the `defs` section and avoid some unnecessary JSON parsing, important data +// from definitions is often duplicated in fields prefixed with a double underscore (eg. +// `__identifier` or `__type`). The 2 only definition types you might need here are +// **Tilesets** and **Enums**. +// +// A structure containing all the definitions of this project +type Definitions struct { + // All entities definitions, including their custom fields + Entities []EntityDefinition `json:"entities"` + // All internal enums + Enums []EnumDefinition `json:"enums"` + // Note: external enums are exactly the same as `enums`, except they have a `relPath` to + // point to an external source file. + ExternalEnums []EnumDefinition `json:"externalEnums"` + // All layer definitions + Layers []LayerDefinition `json:"layers"` + // All custom fields available to all levels. + LevelFields []FieldDefinition `json:"levelFields"` + // All tilesets + Tilesets []TilesetDefinition `json:"tilesets"` +} + +type EntityDefinition struct { + // Base entity color + Color string `json:"color"` + // User defined documentation for this element to provide help/tips to level designers. + Doc *string `json:"doc"` + // If enabled, all instances of this entity will be listed in the project "Table of content" + // object. + ExportToToc bool `json:"exportToToc"` + // Array of field definitions + FieldDefs []FieldDefinition `json:"fieldDefs"` + FillOpacity float64 `json:"fillOpacity"` + // Pixel height + Height int64 `json:"height"` + Hollow bool `json:"hollow"` + // User defined unique identifier + Identifier string `json:"identifier"` + // Only applies to entities resizable on both X/Y. If TRUE, the entity instance width/height + // will keep the same aspect ratio as the definition. + KeepAspectRatio bool `json:"keepAspectRatio"` + // Possible values: `DiscardOldOnes`, `PreventAdding`, `MoveLastOne` + LimitBehavior LimitBehavior `json:"limitBehavior"` + // If TRUE, the maxCount is a "per world" limit, if FALSE, it's a "per level". Possible + // values: `PerLayer`, `PerLevel`, `PerWorld` + LimitScope LimitScope `json:"limitScope"` + LineOpacity float64 `json:"lineOpacity"` + // Max instances count + MaxCount int64 `json:"maxCount"` + // Max pixel height (only applies if the entity is resizable on Y) + MaxHeight *int64 `json:"maxHeight"` + // Max pixel width (only applies if the entity is resizable on X) + MaxWidth *int64 `json:"maxWidth"` + // Min pixel height (only applies if the entity is resizable on Y) + MinHeight *int64 `json:"minHeight"` + // Min pixel width (only applies if the entity is resizable on X) + MinWidth *int64 `json:"minWidth"` + // An array of 4 dimensions for the up/right/down/left borders (in this order) when using + // 9-slice mode for `tileRenderMode`.
If the tileRenderMode is not NineSlice, then + // this array is empty.
See: https://en.wikipedia.org/wiki/9-slice_scaling + NineSliceBorders []int64 `json:"nineSliceBorders"` + // Pivot X coordinate (from 0 to 1.0) + PivotX float64 `json:"pivotX"` + // Pivot Y coordinate (from 0 to 1.0) + PivotY float64 `json:"pivotY"` + // Possible values: `Rectangle`, `Ellipse`, `Tile`, `Cross` + RenderMode RenderMode `json:"renderMode"` + // If TRUE, the entity instances will be resizable horizontally + ResizableX bool `json:"resizableX"` + // If TRUE, the entity instances will be resizable vertically + ResizableY bool `json:"resizableY"` + // Display entity name in editor + ShowName bool `json:"showName"` + // An array of strings that classifies this entity + Tags []string `json:"tags"` + // **WARNING**: this deprecated value is no longer exported since version 1.2.0 Replaced + // by: `tileRect` + TileID *int64 `json:"tileId"` + TileOpacity float64 `json:"tileOpacity"` + // An object representing a rectangle from an existing Tileset + TileRect *TilesetRectangle `json:"tileRect"` + // An enum describing how the the Entity tile is rendered inside the Entity bounds. Possible + // values: `Cover`, `FitInside`, `Repeat`, `Stretch`, `FullSizeCropped`, + // `FullSizeUncropped`, `NineSlice` + TileRenderMode TileRenderMode `json:"tileRenderMode"` + // Tileset ID used for optional tile display + TilesetID *int64 `json:"tilesetId"` + // Unique Int identifier + Uid int64 `json:"uid"` + // Pixel width + Width int64 `json:"width"` +} + +// This section is mostly only intended for the LDtk editor app itself. You can safely +// ignore it. +type FieldDefinition struct { + // Human readable value type. Possible values: `Int, Float, String, Bool, Color, + // ExternEnum.XXX, LocalEnum.XXX, Point, FilePath`.
If the field is an array, this + // field will look like `Array<...>` (eg. `Array`, `Array` etc.)
NOTE: if + // you enable the advanced option **Use Multilines type**, you will have "*Multilines*" + // instead of "*String*" when relevant. + Type string `json:"__type"` + // Optional list of accepted file extensions for FilePath value type. Includes the dot: + // `.ext` + AcceptFileTypes []string `json:"acceptFileTypes"` + // Possible values: `Any`, `OnlySame`, `OnlyTags`, `OnlySpecificEntity` + AllowedRefs AllowedRefs `json:"allowedRefs"` + AllowedRefsEntityUid *int64 `json:"allowedRefsEntityUid"` + AllowedRefTags []string `json:"allowedRefTags"` + AllowOutOfLevelRef bool `json:"allowOutOfLevelRef"` + // Array max length + ArrayMaxLength *int64 `json:"arrayMaxLength"` + // Array min length + ArrayMinLength *int64 `json:"arrayMinLength"` + AutoChainRef bool `json:"autoChainRef"` + // TRUE if the value can be null. For arrays, TRUE means it can contain null values + // (exception: array of Points can't have null values). + CanBeNull bool `json:"canBeNull"` + // Default value if selected value is null or invalid. + DefaultOverride interface{} `json:"defaultOverride"` + // User defined documentation for this field to provide help/tips to level designers about + // accepted values. + Doc *string `json:"doc"` + EditorAlwaysShow bool `json:"editorAlwaysShow"` + EditorCutLongValues bool `json:"editorCutLongValues"` + EditorDisplayColor *string `json:"editorDisplayColor"` + // Possible values: `Hidden`, `ValueOnly`, `NameAndValue`, `EntityTile`, `LevelTile`, + // `Points`, `PointStar`, `PointPath`, `PointPathLoop`, `RadiusPx`, `RadiusGrid`, + // `ArrayCountWithLabel`, `ArrayCountNoLabel`, `RefLinkBetweenPivots`, + // `RefLinkBetweenCenters` + EditorDisplayMode EditorDisplayMode `json:"editorDisplayMode"` + // Possible values: `Above`, `Center`, `Beneath` + EditorDisplayPos EditorDisplayPos `json:"editorDisplayPos"` + EditorDisplayScale float64 `json:"editorDisplayScale"` + // Possible values: `ZigZag`, `StraightArrow`, `CurvedArrow`, `ArrowsLine`, `DashedLine` + EditorLinkStyle EditorLinkStyle `json:"editorLinkStyle"` + EditorShowInWorld bool `json:"editorShowInWorld"` + EditorTextPrefix *string `json:"editorTextPrefix"` + EditorTextSuffix *string `json:"editorTextSuffix"` + // User defined unique identifier + Identifier string `json:"identifier"` + // TRUE if the value is an array of multiple values + IsArray bool `json:"isArray"` + // Max limit for value, if applicable + Max *float64 `json:"max"` + // Min limit for value, if applicable + Min *float64 `json:"min"` + // Optional regular expression that needs to be matched to accept values. Expected format: + // `/some_reg_ex/g`, with optional "i" flag. + Regex *string `json:"regex"` + SymmetricalRef bool `json:"symmetricalRef"` + // Possible values: <`null`>, `LangPython`, `LangRuby`, `LangJS`, `LangLua`, `LangC`, + // `LangHaxe`, `LangMarkdown`, `LangJson`, `LangXml`, `LangLog` + TextLanguageMode *TextLanguageMode `json:"textLanguageMode"` + // UID of the tileset used for a Tile + TilesetUid *int64 `json:"tilesetUid"` + // Internal enum representing the possible field types. Possible values: F_Int, F_Float, + // F_String, F_Text, F_Bool, F_Color, F_Enum(...), F_Point, F_Path, F_EntityRef, F_Tile + FieldDefinitionType string `json:"type"` + // Unique Int identifier + Uid int64 `json:"uid"` + // If TRUE, the color associated with this field will override the Entity or Level default + // color in the editor UI. For Enum fields, this would be the color associated to their + // values. + UseForSmartColor bool `json:"useForSmartColor"` +} + +// This object represents a custom sub rectangle in a Tileset image. +type TilesetRectangle struct { + // Height in pixels + H int64 `json:"h"` + // UID of the tileset + TilesetUid int64 `json:"tilesetUid"` + // Width in pixels + W int64 `json:"w"` + // X pixels coordinate of the top-left corner in the Tileset image + X int64 `json:"x"` + // Y pixels coordinate of the top-left corner in the Tileset image + Y int64 `json:"y"` +} + +type EnumDefinition struct { + ExternalFileChecksum *string `json:"externalFileChecksum"` + // Relative path to the external file providing this Enum + ExternalRelPath *string `json:"externalRelPath"` + // Tileset UID if provided + IconTilesetUid *int64 `json:"iconTilesetUid"` + // User defined unique identifier + Identifier string `json:"identifier"` + // An array of user-defined tags to organize the Enums + Tags []string `json:"tags"` + // Unique Int identifier + Uid int64 `json:"uid"` + // All possible enum values, with their optional Tile infos. + Values []EnumValueDefinition `json:"values"` +} + +type EnumValueDefinition struct { + // **WARNING**: this deprecated value will be *removed* completely on version 1.4.0+ + // Replaced by: `tileRect` + TileSrcRect []int64 `json:"__tileSrcRect"` + // Optional color + Color int64 `json:"color"` + // Enum value + ID string `json:"id"` + // **WARNING**: this deprecated value will be *removed* completely on version 1.4.0+ + // Replaced by: `tileRect` + TileID *int64 `json:"tileId"` + // Optional tileset rectangle to represents this value + TileRect *TilesetRectangle `json:"tileRect"` +} + +type LayerDefinition struct { + // Type of the layer (*IntGrid, Entities, Tiles or AutoLayer*) + Type string `json:"__type"` + // Contains all the auto-layer rule definitions. + AutoRuleGroups []AutoLayerRuleGroup `json:"autoRuleGroups"` + AutoSourceLayerDefUid *int64 `json:"autoSourceLayerDefUid"` + // **WARNING**: this deprecated value is no longer exported since version 1.2.0 Replaced + // by: `tilesetDefUid` + AutoTilesetDefUid *int64 `json:"autoTilesetDefUid"` + // Allow editor selections when the layer is not currently active. + CanSelectWhenInactive bool `json:"canSelectWhenInactive"` + // Opacity of the layer (0 to 1.0) + DisplayOpacity float64 `json:"displayOpacity"` + // User defined documentation for this element to provide help/tips to level designers. + Doc *string `json:"doc"` + // An array of tags to forbid some Entities in this layer + ExcludedTags []string `json:"excludedTags"` + // Width and height of the grid in pixels + GridSize int64 `json:"gridSize"` + // Height of the optional "guide" grid in pixels + GuideGridHei int64 `json:"guideGridHei"` + // Width of the optional "guide" grid in pixels + GuideGridWid int64 `json:"guideGridWid"` + HideFieldsWhenInactive bool `json:"hideFieldsWhenInactive"` + // Hide the layer from the list on the side of the editor view. + HideInList bool `json:"hideInList"` + // User defined unique identifier + Identifier string `json:"identifier"` + // Alpha of this layer when it is not the active one. + InactiveOpacity float64 `json:"inactiveOpacity"` + // An array that defines extra optional info for each IntGrid value.
WARNING: the + // array order is not related to actual IntGrid values! As user can re-order IntGrid values + // freely, you may value "2" before value "1" in this array. + IntGridValues []IntGridValueDefinition `json:"intGridValues"` + // Parallax horizontal factor (from -1 to 1, defaults to 0) which affects the scrolling + // speed of this layer, creating a fake 3D (parallax) effect. + ParallaxFactorX float64 `json:"parallaxFactorX"` + // Parallax vertical factor (from -1 to 1, defaults to 0) which affects the scrolling speed + // of this layer, creating a fake 3D (parallax) effect. + ParallaxFactorY float64 `json:"parallaxFactorY"` + // If true (default), a layer with a parallax factor will also be scaled up/down accordingly. + ParallaxScaling bool `json:"parallaxScaling"` + // X offset of the layer, in pixels (IMPORTANT: this should be added to the `LayerInstance` + // optional offset) + PxOffsetX int64 `json:"pxOffsetX"` + // Y offset of the layer, in pixels (IMPORTANT: this should be added to the `LayerInstance` + // optional offset) + PxOffsetY int64 `json:"pxOffsetY"` + // If TRUE, the content of this layer will be used when rendering levels in a simplified way + // for the world view + RenderInWorldView bool `json:"renderInWorldView"` + // An array of tags to filter Entities that can be added to this layer + RequiredTags []string `json:"requiredTags"` + // If the tiles are smaller or larger than the layer grid, the pivot value will be used to + // position the tile relatively its grid cell. + TilePivotX float64 `json:"tilePivotX"` + // If the tiles are smaller or larger than the layer grid, the pivot value will be used to + // position the tile relatively its grid cell. + TilePivotY float64 `json:"tilePivotY"` + // Reference to the default Tileset UID being used by this layer definition.
+ // **WARNING**: some layer *instances* might use a different tileset. So most of the time, + // you should probably use the `__tilesetDefUid` value found in layer instances.
Note: + // since version 1.0.0, the old `autoTilesetDefUid` was removed and merged into this value. + TilesetDefUid *int64 `json:"tilesetDefUid"` + // Type of the layer as Haxe Enum Possible values: `IntGrid`, `Entities`, `Tiles`, + // `AutoLayer` + LayerDefinitionType Type `json:"type"` + // User defined color for the UI + UIColor *string `json:"uiColor"` + // Unique Int identifier + Uid int64 `json:"uid"` +} + +type AutoLayerRuleGroup struct { + Active bool `json:"active"` + // *This field was removed in 1.0.0 and should no longer be used.* + Collapsed *bool `json:"collapsed"` + IsOptional bool `json:"isOptional"` + Name string `json:"name"` + Rules []AutoLayerRuleDefinition `json:"rules"` + Uid int64 `json:"uid"` + UsesWizard bool `json:"usesWizard"` +} + +// This complex section isn't meant to be used by game devs at all, as these rules are +// completely resolved internally by the editor before any saving. You should just ignore +// this part. +type AutoLayerRuleDefinition struct { + // If FALSE, the rule effect isn't applied, and no tiles are generated. + Active bool `json:"active"` + Alpha float64 `json:"alpha"` + // When TRUE, the rule will prevent other rules to be applied in the same cell if it matches + // (TRUE by default). + BreakOnMatch bool `json:"breakOnMatch"` + // Chances for this rule to be applied (0 to 1) + Chance float64 `json:"chance"` + // Checker mode Possible values: `None`, `Horizontal`, `Vertical` + Checker Checker `json:"checker"` + // If TRUE, allow rule to be matched by flipping its pattern horizontally + FlipX bool `json:"flipX"` + // If TRUE, allow rule to be matched by flipping its pattern vertically + FlipY bool `json:"flipY"` + // Default IntGrid value when checking cells outside of level bounds + OutOfBoundsValue *int64 `json:"outOfBoundsValue"` + // Rule pattern (size x size) + Pattern []int64 `json:"pattern"` + // If TRUE, enable Perlin filtering to only apply rule on specific random area + PerlinActive bool `json:"perlinActive"` + PerlinOctaves float64 `json:"perlinOctaves"` + PerlinScale float64 `json:"perlinScale"` + PerlinSeed float64 `json:"perlinSeed"` + // X pivot of a tile stamp (0-1) + PivotX float64 `json:"pivotX"` + // Y pivot of a tile stamp (0-1) + PivotY float64 `json:"pivotY"` + // Pattern width & height. Should only be 1,3,5 or 7. + Size int64 `json:"size"` + // Array of all the tile IDs. They are used randomly or as stamps, based on `tileMode` value. + TileIDS []int64 `json:"tileIds"` + // Defines how tileIds array is used Possible values: `Single`, `Stamp` + TileMode TileMode `json:"tileMode"` + // Max random offset for X tile pos + TileRandomXMax int64 `json:"tileRandomXMax"` + // Min random offset for X tile pos + TileRandomXMin int64 `json:"tileRandomXMin"` + // Max random offset for Y tile pos + TileRandomYMax int64 `json:"tileRandomYMax"` + // Min random offset for Y tile pos + TileRandomYMin int64 `json:"tileRandomYMin"` + // Tile X offset + TileXOffset int64 `json:"tileXOffset"` + // Tile Y offset + TileYOffset int64 `json:"tileYOffset"` + // Unique Int identifier + Uid int64 `json:"uid"` + // X cell coord modulo + XModulo int64 `json:"xModulo"` + // X cell start offset + XOffset int64 `json:"xOffset"` + // Y cell coord modulo + YModulo int64 `json:"yModulo"` + // Y cell start offset + YOffset int64 `json:"yOffset"` +} + +// IntGrid value definition +type IntGridValueDefinition struct { + Color string `json:"color"` + // User defined unique identifier + Identifier *string `json:"identifier"` + Tile *TilesetRectangle `json:"tile"` + // The IntGrid value itself + Value int64 `json:"value"` +} + +// The `Tileset` definition is the most important part among project definitions. It +// contains some extra informations about each integrated tileset. If you only had to parse +// one definition section, that would be the one. +type TilesetDefinition struct { + // Grid-based height + CHei int64 `json:"__cHei"` + // Grid-based width + CWid int64 `json:"__cWid"` + // The following data is used internally for various optimizations. It's always synced with + // source image changes. + CachedPixelData map[string]interface{} `json:"cachedPixelData"` + // An array of custom tile metadata + CustomData []TileCustomMetadata `json:"customData"` + // If this value is set, then it means that this atlas uses an internal LDtk atlas image + // instead of a loaded one. Possible values: <`null`>, `LdtkIcons` + EmbedAtlas *EmbedAtlas `json:"embedAtlas"` + // Tileset tags using Enum values specified by `tagsSourceEnumId`. This array contains 1 + // element per Enum value, which contains an array of all Tile IDs that are tagged with it. + EnumTags []EnumTagValue `json:"enumTags"` + // User defined unique identifier + Identifier string `json:"identifier"` + // Distance in pixels from image borders + Padding int64 `json:"padding"` + // Image height in pixels + PxHei int64 `json:"pxHei"` + // Image width in pixels + PxWid int64 `json:"pxWid"` + // Path to the source file, relative to the current project JSON file
It can be null + // if no image was provided, or when using an embed atlas. + RelPath *string `json:"relPath"` + // Array of group of tiles selections, only meant to be used in the editor + SavedSelections []map[string]interface{} `json:"savedSelections"` + // Space in pixels between all tiles + Spacing int64 `json:"spacing"` + // An array of user-defined tags to organize the Tilesets + Tags []string `json:"tags"` + // Optional Enum definition UID used for this tileset meta-data + TagsSourceEnumUid *int64 `json:"tagsSourceEnumUid"` + TileGridSize int64 `json:"tileGridSize"` + // Unique Intidentifier + Uid int64 `json:"uid"` +} + +// In a tileset definition, user defined meta-data of a tile. +type TileCustomMetadata struct { + Data string `json:"data"` + TileID int64 `json:"tileId"` +} + +// In a tileset definition, enum based tag infos +type EnumTagValue struct { + EnumValueID string `json:"enumValueId"` + TileIDS []int64 `json:"tileIds"` +} + +// This object is not actually used by LDtk. It ONLY exists to force explicit references to +// all types, to make sure QuickType finds them and integrate all of them. Otherwise, +// Quicktype will drop types that are not explicitely used. +type ForcedRefs struct { + AutoLayerRuleGroup *AutoLayerRuleGroup `json:"AutoLayerRuleGroup,omitempty"` + AutoRuleDef *AutoLayerRuleDefinition `json:"AutoRuleDef,omitempty"` + CustomCommand *LdtkCustomCommand `json:"CustomCommand,omitempty"` + Definitions *Definitions `json:"Definitions,omitempty"` + EntityDef *EntityDefinition `json:"EntityDef,omitempty"` + EntityInstance *EntityInstance `json:"EntityInstance,omitempty"` + EntityReferenceInfos *ReferenceToAnEntityInstance `json:"EntityReferenceInfos,omitempty"` + EnumDef *EnumDefinition `json:"EnumDef,omitempty"` + EnumDefValues *EnumValueDefinition `json:"EnumDefValues,omitempty"` + EnumTagValue *EnumTagValue `json:"EnumTagValue,omitempty"` + FieldDef *FieldDefinition `json:"FieldDef,omitempty"` + FieldInstance *FieldInstance `json:"FieldInstance,omitempty"` + GridPoint *GridPoint `json:"GridPoint,omitempty"` + IntGridValueDef *IntGridValueDefinition `json:"IntGridValueDef,omitempty"` + IntGridValueInstance *IntGridValueInstance `json:"IntGridValueInstance,omitempty"` + LayerDef *LayerDefinition `json:"LayerDef,omitempty"` + LayerInstance *LayerInstance `json:"LayerInstance,omitempty"` + Level *Level `json:"Level,omitempty"` + LevelBgPosInfos *LevelBackgroundPosition `json:"LevelBgPosInfos,omitempty"` + NeighbourLevel *NeighbourLevel `json:"NeighbourLevel,omitempty"` + TableOfContentEntry *LdtkTableOfContentEntry `json:"TableOfContentEntry,omitempty"` + Tile *TileInstance `json:"Tile,omitempty"` + TileCustomMetadata *TileCustomMetadata `json:"TileCustomMetadata,omitempty"` + TilesetDef *TilesetDefinition `json:"TilesetDef,omitempty"` + TilesetRect *TilesetRectangle `json:"TilesetRect,omitempty"` + World *World `json:"World,omitempty"` +} + +type EntityInstance struct { + // Grid-based coordinates (`[x,y]` format) + Grid []int64 `json:"__grid"` + // Entity definition identifier + Identifier string `json:"__identifier"` + // Pivot coordinates (`[x,y]` format, values are from 0 to 1) of the Entity + Pivot []float64 `json:"__pivot"` + // The entity "smart" color, guessed from either Entity definition, or one its field + // instances. + SmartColor string `json:"__smartColor"` + // Array of tags defined in this Entity definition + Tags []string `json:"__tags"` + // Optional TilesetRect used to display this entity (it could either be the default Entity + // tile, or some tile provided by a field value, like an Enum). + Tile *TilesetRectangle `json:"__tile"` + // X world coordinate in pixels + WorldX int64 `json:"__worldX"` + // Y world coordinate in pixels + WorldY int64 `json:"__worldY"` + // Reference of the **Entity definition** UID + DefUid int64 `json:"defUid"` + // An array of all custom fields and their values. + FieldInstances []FieldInstance `json:"fieldInstances"` + // Entity height in pixels. For non-resizable entities, it will be the same as Entity + // definition. + Height int64 `json:"height"` + // Unique instance identifier + Iid string `json:"iid"` + // Pixel coordinates (`[x,y]` format) in current level coordinate space. Don't forget + // optional layer offsets, if they exist! + Px []int64 `json:"px"` + // Entity width in pixels. For non-resizable entities, it will be the same as Entity + // definition. + Width int64 `json:"width"` +} + +type FieldInstance struct { + // Field definition identifier + Identifier string `json:"__identifier"` + // Optional TilesetRect used to display this field (this can be the field own Tile, or some + // other Tile guessed from the value, like an Enum). + Tile *TilesetRectangle `json:"__tile"` + // Type of the field, such as `Int`, `Float`, `String`, `Enum(my_enum_name)`, `Bool`, + // etc.
NOTE: if you enable the advanced option **Use Multilines type**, you will have + // "*Multilines*" instead of "*String*" when relevant. + Type string `json:"__type"` + // Actual value of the field instance. The value type varies, depending on `__type`:
+ // - For **classic types** (ie. Integer, Float, Boolean, String, Text and FilePath), you + // just get the actual value with the expected type.
- For **Color**, the value is an + // hexadecimal string using "#rrggbb" format.
- For **Enum**, the value is a String + // representing the selected enum value.
- For **Point**, the value is a + // [GridPoint](#ldtk-GridPoint) object.
- For **Tile**, the value is a + // [TilesetRect](#ldtk-TilesetRect) object.
- For **EntityRef**, the value is an + // [EntityReferenceInfos](#ldtk-EntityReferenceInfos) object.

If the field is an + // array, then this `__value` will also be a JSON array. + Value interface{} `json:"__value"` + // Reference of the **Field definition** UID + DefUid int64 `json:"defUid"` + // Editor internal raw values + RealEditorValues []interface{} `json:"realEditorValues"` +} + +// This object describes the "location" of an Entity instance in the project worlds. +type ReferenceToAnEntityInstance struct { + // IID of the refered EntityInstance + EntityIid string `json:"entityIid"` + // IID of the LayerInstance containing the refered EntityInstance + LayerIid string `json:"layerIid"` + // IID of the Level containing the refered EntityInstance + LevelIid string `json:"levelIid"` + // IID of the World containing the refered EntityInstance + WorldIid string `json:"worldIid"` +} + +// This object is just a grid-based coordinate used in Field values. +type GridPoint struct { + // X grid-based coordinate + Cx int64 `json:"cx"` + // Y grid-based coordinate + Cy int64 `json:"cy"` +} + +// IntGrid value instance +type IntGridValueInstance struct { + // Coordinate ID in the layer grid + CoordID int64 `json:"coordId"` + // IntGrid value + V int64 `json:"v"` +} + +type LayerInstance struct { + // Grid-based height + CHei int64 `json:"__cHei"` + // Grid-based width + CWid int64 `json:"__cWid"` + // Grid size + GridSize int64 `json:"__gridSize"` + // Layer definition identifier + Identifier string `json:"__identifier"` + // Layer opacity as Float [0-1] + Opacity float64 `json:"__opacity"` + // Total layer X pixel offset, including both instance and definition offsets. + PxTotalOffsetX int64 `json:"__pxTotalOffsetX"` + // Total layer Y pixel offset, including both instance and definition offsets. + PxTotalOffsetY int64 `json:"__pxTotalOffsetY"` + // The definition UID of corresponding Tileset, if any. + TilesetDefUid *int64 `json:"__tilesetDefUid"` + // The relative path to corresponding Tileset, if any. + TilesetRelPath *string `json:"__tilesetRelPath"` + // Layer type (possible values: IntGrid, Entities, Tiles or AutoLayer) + Type string `json:"__type"` + // An array containing all tiles generated by Auto-layer rules. The array is already sorted + // in display order (ie. 1st tile is beneath 2nd, which is beneath 3rd etc.).

+ // Note: if multiple tiles are stacked in the same cell as the result of different rules, + // all tiles behind opaque ones will be discarded. + AutoLayerTiles []TileInstance `json:"autoLayerTiles"` + EntityInstances []EntityInstance `json:"entityInstances"` + GridTiles []TileInstance `json:"gridTiles"` + // Unique layer instance identifier + Iid string `json:"iid"` + // **WARNING**: this deprecated value is no longer exported since version 1.0.0 Replaced + // by: `intGridCsv` + IntGrid []IntGridValueInstance `json:"intGrid"` + // A list of all values in the IntGrid layer, stored in CSV format (Comma Separated + // Values).
Order is from left to right, and top to bottom (ie. first row from left to + // right, followed by second row, etc).
`0` means "empty cell" and IntGrid values + // start at 1.
The array size is `__cWid` x `__cHei` cells. + IntGridCSV []int64 `json:"intGridCsv"` + // Reference the Layer definition UID + LayerDefUid int64 `json:"layerDefUid"` + // Reference to the UID of the level containing this layer instance + LevelID int64 `json:"levelId"` + // An Array containing the UIDs of optional rules that were enabled in this specific layer + // instance. + OptionalRules []int64 `json:"optionalRules"` + // This layer can use another tileset by overriding the tileset UID here. + OverrideTilesetUid *int64 `json:"overrideTilesetUid"` + // X offset in pixels to render this layer, usually 0 (IMPORTANT: this should be added to + // the `LayerDef` optional offset, so you should probably prefer using `__pxTotalOffsetX` + // which contains the total offset value) + PxOffsetX int64 `json:"pxOffsetX"` + // Y offset in pixels to render this layer, usually 0 (IMPORTANT: this should be added to + // the `LayerDef` optional offset, so you should probably prefer using `__pxTotalOffsetX` + // which contains the total offset value) + PxOffsetY int64 `json:"pxOffsetY"` + // Random seed used for Auto-Layers rendering + Seed int64 `json:"seed"` + // Layer instance visibility + Visible bool `json:"visible"` +} + +// This structure represents a single tile from a given Tileset. +type TileInstance struct { + // Alpha/opacity of the tile (0-1, defaults to 1) + A float64 `json:"a"` + // Internal data used by the editor.
For auto-layer tiles: `[ruleId, coordId]`.
+ // For tile-layer tiles: `[coordId]`. + D []int64 `json:"d"` + // "Flip bits", a 2-bits integer to represent the mirror transformations of the tile.
+ // - Bit 0 = X flip
- Bit 1 = Y flip
Examples: f=0 (no flip), f=1 (X flip + // only), f=2 (Y flip only), f=3 (both flips) + F int64 `json:"f"` + // Pixel coordinates of the tile in the **layer** (`[x,y]` format). Don't forget optional + // layer offsets, if they exist! + Px []int64 `json:"px"` + // Pixel coordinates of the tile in the **tileset** (`[x,y]` format) + Src []int64 `json:"src"` + // The *Tile ID* in the corresponding tileset. + T int64 `json:"t"` +} + +// This section contains all the level data. It can be found in 2 distinct forms, depending +// on Project current settings: - If "*Separate level files*" is **disabled** (default): +// full level data is *embedded* inside the main Project JSON file, - If "*Separate level +// files*" is **enabled**: level data is stored in *separate* standalone `.ldtkl` files (one +// per level). In this case, the main Project JSON file will still contain most level data, +// except heavy sections, like the `layerInstances` array (which will be null). The +// `externalRelPath` string points to the `ldtkl` file. A `ldtkl` file is just a JSON file +// containing exactly what is described below. +type Level struct { + // Background color of the level (same as `bgColor`, except the default value is + // automatically used here if its value is `null`) + BgColor string `json:"__bgColor"` + // Position informations of the background image, if there is one. + BgPos *LevelBackgroundPosition `json:"__bgPos"` + // An array listing all other levels touching this one on the world map.
Only relevant + // for world layouts where level spatial positioning is manual (ie. GridVania, Free). For + // Horizontal and Vertical layouts, this array is always empty. + Neighbours []NeighbourLevel `json:"__neighbours"` + // The "guessed" color for this level in the editor, decided using either the background + // color or an existing custom field. + SmartColor string `json:"__smartColor"` + // Background color of the level. If `null`, the project `defaultLevelBgColor` should be + // used. + LevelBgColor *string `json:"bgColor"` + // Background image X pivot (0-1) + BgPivotX float64 `json:"bgPivotX"` + // Background image Y pivot (0-1) + BgPivotY float64 `json:"bgPivotY"` + // An enum defining the way the background image (if any) is positioned on the level. See + // `__bgPos` for resulting position info. Possible values: <`null`>, `Unscaled`, + // `Contain`, `Cover`, `CoverDirty`, `Repeat` + LevelBgPos *BgPos `json:"bgPos"` + // The *optional* relative path to the level background image. + BgRelPath *string `json:"bgRelPath"` + // This value is not null if the project option "*Save levels separately*" is enabled. In + // this case, this **relative** path points to the level Json file. + ExternalRelPath *string `json:"externalRelPath"` + // An array containing this level custom field values. + FieldInstances []FieldInstance `json:"fieldInstances"` + // User defined unique identifier + Identifier string `json:"identifier"` + // Unique instance identifier + Iid string `json:"iid"` + // An array containing all Layer instances. **IMPORTANT**: if the project option "*Save + // levels separately*" is enabled, this field will be `null`.
This array is **sorted + // in display order**: the 1st layer is the top-most and the last is behind. + LayerInstances []LayerInstance `json:"layerInstances"` + // Height of the level in pixels + PxHei int64 `json:"pxHei"` + // Width of the level in pixels + PxWid int64 `json:"pxWid"` + // Unique Int identifier + Uid int64 `json:"uid"` + // If TRUE, the level identifier will always automatically use the naming pattern as defined + // in `Project.levelNamePattern`. Becomes FALSE if the identifier is manually modified by + // user. + UseAutoIdentifier bool `json:"useAutoIdentifier"` + // Index that represents the "depth" of the level in the world. Default is 0, greater means + // "above", lower means "below".
This value is mostly used for display only and is + // intended to make stacking of levels easier to manage. + WorldDepth int64 `json:"worldDepth"` + // World X coordinate in pixels.
Only relevant for world layouts where level spatial + // positioning is manual (ie. GridVania, Free). For Horizontal and Vertical layouts, the + // value is always -1 here. + WorldX int64 `json:"worldX"` + // World Y coordinate in pixels.
Only relevant for world layouts where level spatial + // positioning is manual (ie. GridVania, Free). For Horizontal and Vertical layouts, the + // value is always -1 here. + WorldY int64 `json:"worldY"` +} + +// Level background image position info +type LevelBackgroundPosition struct { + // An array of 4 float values describing the cropped sub-rectangle of the displayed + // background image. This cropping happens when original is larger than the level bounds. + // Array format: `[ cropX, cropY, cropWidth, cropHeight ]` + CropRect []float64 `json:"cropRect"` + // An array containing the `[scaleX,scaleY]` values of the **cropped** background image, + // depending on `bgPos` option. + Scale []float64 `json:"scale"` + // An array containing the `[x,y]` pixel coordinates of the top-left corner of the + // **cropped** background image, depending on `bgPos` option. + TopLeftPx []int64 `json:"topLeftPx"` +} + +// Nearby level info +type NeighbourLevel struct { + // A single lowercase character tipping on the level location (`n`orth, `s`outh, `w`est, + // `e`ast). + Dir string `json:"dir"` + // Neighbour Instance Identifier + LevelIid string `json:"levelIid"` + // **WARNING**: this deprecated value is no longer exported since version 1.2.0 Replaced + // by: `levelIid` + LevelUid *int64 `json:"levelUid"` +} + +type LdtkTableOfContentEntry struct { + Identifier string `json:"identifier"` + Instances []ReferenceToAnEntityInstance `json:"instances"` +} + +// **IMPORTANT**: this type is available as a preview. You can rely on it to update your +// importers, for when it will be officially available. A World contains multiple levels, +// and it has its own layout settings. +type World struct { + // Default new level height + DefaultLevelHeight int64 `json:"defaultLevelHeight"` + // Default new level width + DefaultLevelWidth int64 `json:"defaultLevelWidth"` + // User defined unique identifier + Identifier string `json:"identifier"` + // Unique instance identifer + Iid string `json:"iid"` + // All levels from this world. The order of this array is only relevant in + // `LinearHorizontal` and `linearVertical` world layouts (see `worldLayout` value). + // Otherwise, you should refer to the `worldX`,`worldY` coordinates of each Level. + Levels []Level `json:"levels"` + // Height of the world grid in pixels. + WorldGridHeight int64 `json:"worldGridHeight"` + // Width of the world grid in pixels. + WorldGridWidth int64 `json:"worldGridWidth"` + // An enum that describes how levels are organized in this project (ie. linearly or in a 2D + // space). Possible values: `Free`, `GridVania`, `LinearHorizontal`, `LinearVertical`, `null` + WorldLayout *WorldLayout `json:"worldLayout"` +} + +// Possible values: `Manual`, `AfterLoad`, `BeforeSave`, `AfterSave` +type When string + +const ( + AfterLoad When = "AfterLoad" + AfterSave When = "AfterSave" + BeforeSave When = "BeforeSave" + Manual When = "Manual" +) + +// Possible values: `Any`, `OnlySame`, `OnlyTags`, `OnlySpecificEntity` +type AllowedRefs string + +const ( + Any AllowedRefs = "Any" + OnlySame AllowedRefs = "OnlySame" + OnlySpecificEntity AllowedRefs = "OnlySpecificEntity" + OnlyTags AllowedRefs = "OnlyTags" +) + +// Possible values: `Hidden`, `ValueOnly`, `NameAndValue`, `EntityTile`, `LevelTile`, +// `Points`, `PointStar`, `PointPath`, `PointPathLoop`, `RadiusPx`, `RadiusGrid`, +// `ArrayCountWithLabel`, `ArrayCountNoLabel`, `RefLinkBetweenPivots`, +// `RefLinkBetweenCenters` +type EditorDisplayMode string + +const ( + ArrayCountNoLabel EditorDisplayMode = "ArrayCountNoLabel" + ArrayCountWithLabel EditorDisplayMode = "ArrayCountWithLabel" + EntityTile EditorDisplayMode = "EntityTile" + Hidden EditorDisplayMode = "Hidden" + LevelTile EditorDisplayMode = "LevelTile" + NameAndValue EditorDisplayMode = "NameAndValue" + PointPath EditorDisplayMode = "PointPath" + PointPathLoop EditorDisplayMode = "PointPathLoop" + PointStar EditorDisplayMode = "PointStar" + Points EditorDisplayMode = "Points" + RadiusGrid EditorDisplayMode = "RadiusGrid" + RadiusPx EditorDisplayMode = "RadiusPx" + RefLinkBetweenCenters EditorDisplayMode = "RefLinkBetweenCenters" + RefLinkBetweenPivots EditorDisplayMode = "RefLinkBetweenPivots" + ValueOnly EditorDisplayMode = "ValueOnly" +) + +// Possible values: `Above`, `Center`, `Beneath` +type EditorDisplayPos string + +const ( + Above EditorDisplayPos = "Above" + Beneath EditorDisplayPos = "Beneath" + Center EditorDisplayPos = "Center" +) + +// Possible values: `ZigZag`, `StraightArrow`, `CurvedArrow`, `ArrowsLine`, `DashedLine` +type EditorLinkStyle string + +const ( + ArrowsLine EditorLinkStyle = "ArrowsLine" + CurvedArrow EditorLinkStyle = "CurvedArrow" + DashedLine EditorLinkStyle = "DashedLine" + StraightArrow EditorLinkStyle = "StraightArrow" + ZigZag EditorLinkStyle = "ZigZag" +) + +type TextLanguageMode string + +const ( + LangC TextLanguageMode = "LangC" + LangHaxe TextLanguageMode = "LangHaxe" + LangJS TextLanguageMode = "LangJS" + LangJSON TextLanguageMode = "LangJson" + LangLog TextLanguageMode = "LangLog" + LangLua TextLanguageMode = "LangLua" + LangMarkdown TextLanguageMode = "LangMarkdown" + LangPython TextLanguageMode = "LangPython" + LangRuby TextLanguageMode = "LangRuby" + LangXML TextLanguageMode = "LangXml" +) + +// Possible values: `DiscardOldOnes`, `PreventAdding`, `MoveLastOne` +type LimitBehavior string + +const ( + DiscardOldOnes LimitBehavior = "DiscardOldOnes" + MoveLastOne LimitBehavior = "MoveLastOne" + PreventAdding LimitBehavior = "PreventAdding" +) + +// If TRUE, the maxCount is a "per world" limit, if FALSE, it's a "per level". Possible +// values: `PerLayer`, `PerLevel`, `PerWorld` +type LimitScope string + +const ( + PerLayer LimitScope = "PerLayer" + PerLevel LimitScope = "PerLevel" + PerWorld LimitScope = "PerWorld" +) + +// Possible values: `Rectangle`, `Ellipse`, `Tile`, `Cross` +type RenderMode string + +const ( + Cross RenderMode = "Cross" + Ellipse RenderMode = "Ellipse" + Rectangle RenderMode = "Rectangle" + Tile RenderMode = "Tile" +) + +// An enum describing how the the Entity tile is rendered inside the Entity bounds. Possible +// values: `Cover`, `FitInside`, `Repeat`, `Stretch`, `FullSizeCropped`, +// `FullSizeUncropped`, `NineSlice` +type TileRenderMode string + +const ( + FitInside TileRenderMode = "FitInside" + FullSizeCropped TileRenderMode = "FullSizeCropped" + FullSizeUncropped TileRenderMode = "FullSizeUncropped" + NineSlice TileRenderMode = "NineSlice" + Stretch TileRenderMode = "Stretch" + TileRenderModeCover TileRenderMode = "Cover" + TileRenderModeRepeat TileRenderMode = "Repeat" +) + +// Checker mode Possible values: `None`, `Horizontal`, `Vertical` +type Checker string + +const ( + CheckerNone Checker = "None" + Horizontal Checker = "Horizontal" + Vertical Checker = "Vertical" +) + +// Defines how tileIds array is used Possible values: `Single`, `Stamp` +type TileMode string + +const ( + Single TileMode = "Single" + Stamp TileMode = "Stamp" +) + +// Type of the layer as Haxe Enum Possible values: `IntGrid`, `Entities`, `Tiles`, +// `AutoLayer` +type Type string + +const ( + AutoLayer Type = "AutoLayer" + Entities Type = "Entities" + IntGrid Type = "IntGrid" + Tiles Type = "Tiles" +) + +type EmbedAtlas string + +const ( + LdtkIcons EmbedAtlas = "LdtkIcons" +) + +type Flag string + +const ( + DiscardPreCSVIntGrid Flag = "DiscardPreCsvIntGrid" + ExportPreCSVIntGridFormat Flag = "ExportPreCsvIntGridFormat" + IgnoreBackupSuggest Flag = "IgnoreBackupSuggest" + MultiWorlds Flag = "MultiWorlds" + PrependIndexToLevelFileNames Flag = "PrependIndexToLevelFileNames" + UseMultilinesType Flag = "UseMultilinesType" +) + +type BgPos string + +const ( + BgPosCover BgPos = "Cover" + BgPosRepeat BgPos = "Repeat" + Contain BgPos = "Contain" + CoverDirty BgPos = "CoverDirty" + Unscaled BgPos = "Unscaled" +) + +type WorldLayout string + +const ( + GridVania WorldLayout = "GridVania" + LinearHorizontal WorldLayout = "LinearHorizontal" + LinearVertical WorldLayout = "LinearVertical" + WorldLayoutFree WorldLayout = "Free" +) + +// Naming convention for Identifiers (first-letter uppercase, full uppercase etc.) Possible +// values: `Capitalize`, `Uppercase`, `Lowercase`, `Free` +type IdentifierStyle string + +const ( + Capitalize IdentifierStyle = "Capitalize" + IdentifierStyleFree IdentifierStyle = "Free" + Lowercase IdentifierStyle = "Lowercase" + Uppercase IdentifierStyle = "Uppercase" +) + +// "Image export" option when saving project. Possible values: `None`, `OneImagePerLayer`, +// `OneImagePerLevel`, `LayersAndLevels` +type ImageExportMode string + +const ( + ImageExportModeNone ImageExportMode = "None" + LayersAndLevels ImageExportMode = "LayersAndLevels" + OneImagePerLayer ImageExportMode = "OneImagePerLayer" + OneImagePerLevel ImageExportMode = "OneImagePerLevel" +) diff --git a/docs/archives/1.3.4/quicktype/LdtkJson.js b/docs/archives/1.3.4/quicktype/LdtkJson.js new file mode 100644 index 000000000..504a1d51a --- /dev/null +++ b/docs/archives/1.3.4/quicktype/LdtkJson.js @@ -0,0 +1,702 @@ +// To parse this data: +// +// const Convert = require("./file"); +// +// const ldtkJSON = Convert.toLdtkJSON(json); +// +// These functions will throw an error if the JSON doesn't +// match the expected interface, even if the JSON is valid. + +// Converts JSON strings to/from your types +// and asserts the results of JSON.parse at runtime +function toLdtkJSON(json) { + return cast(JSON.parse(json), r("LdtkJSON")); +} + +function ldtkJSONToJson(value) { + return JSON.stringify(uncast(value, r("LdtkJSON")), null, 2); +} + +function invalidValue(typ, val, key, parent = '') { + const prettyTyp = prettyTypeName(typ); + const parentText = parent ? ` on ${parent}` : ''; + const keyText = key ? ` for key "${key}"` : ''; + throw Error(`Invalid value${keyText}${parentText}. Expected ${prettyTyp} but got ${JSON.stringify(val)}`); +} + +function prettyTypeName(typ) { + if (Array.isArray(typ)) { + if (typ.length === 2 && typ[0] === undefined) { + return `an optional ${prettyTypeName(typ[1])}`; + } else { + return `one of [${typ.map(a => { return prettyTypeName(a); }).join(", ")}]`; + } + } else if (typeof typ === "object" && typ.literal !== undefined) { + return typ.literal; + } else { + return typeof typ; + } +} + +function jsonToJSProps(typ) { + if (typ.jsonToJS === undefined) { + const map = {}; + typ.props.forEach((p) => map[p.json] = { key: p.js, typ: p.typ }); + typ.jsonToJS = map; + } + return typ.jsonToJS; +} + +function jsToJSONProps(typ) { + if (typ.jsToJSON === undefined) { + const map = {}; + typ.props.forEach((p) => map[p.js] = { key: p.json, typ: p.typ }); + typ.jsToJSON = map; + } + return typ.jsToJSON; +} + +function transform(val, typ, getProps, key = '', parent = '') { + function transformPrimitive(typ, val) { + if (typeof typ === typeof val) return val; + return invalidValue(typ, val, key, parent); + } + + function transformUnion(typs, val) { + // val must validate against one typ in typs + const l = typs.length; + for (let i = 0; i < l; i++) { + const typ = typs[i]; + try { + return transform(val, typ, getProps); + } catch (_) {} + } + return invalidValue(typs, val, key, parent); + } + + function transformEnum(cases, val) { + if (cases.indexOf(val) !== -1) return val; + return invalidValue(cases.map(a => { return l(a); }), val, key, parent); + } + + function transformArray(typ, val) { + // val must be an array with no invalid elements + if (!Array.isArray(val)) return invalidValue(l("array"), val, key, parent); + return val.map(el => transform(el, typ, getProps)); + } + + function transformDate(val) { + if (val === null) { + return null; + } + const d = new Date(val); + if (isNaN(d.valueOf())) { + return invalidValue(l("Date"), val, key, parent); + } + return d; + } + + function transformObject(props, additional, val) { + if (val === null || typeof val !== "object" || Array.isArray(val)) { + return invalidValue(l(ref || "object"), val, key, parent); + } + const result = {}; + Object.getOwnPropertyNames(props).forEach(key => { + const prop = props[key]; + const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; + result[prop.key] = transform(v, prop.typ, getProps, key, ref); + }); + Object.getOwnPropertyNames(val).forEach(key => { + if (!Object.prototype.hasOwnProperty.call(props, key)) { + result[key] = transform(val[key], additional, getProps, key, ref); + } + }); + return result; + } + + if (typ === "any") return val; + if (typ === null) { + if (val === null) return val; + return invalidValue(typ, val, key, parent); + } + if (typ === false) return invalidValue(typ, val, key, parent); + let ref = undefined; + while (typeof typ === "object" && typ.ref !== undefined) { + ref = typ.ref; + typ = typeMap[typ.ref]; + } + if (Array.isArray(typ)) return transformEnum(typ, val); + if (typeof typ === "object") { + return typ.hasOwnProperty("unionMembers") ? transformUnion(typ.unionMembers, val) + : typ.hasOwnProperty("arrayItems") ? transformArray(typ.arrayItems, val) + : typ.hasOwnProperty("props") ? transformObject(getProps(typ), typ.additional, val) + : invalidValue(typ, val, key, parent); + } + // Numbers can be parsed by Date but shouldn't be. + if (typ === Date && typeof val !== "number") return transformDate(val); + return transformPrimitive(typ, val); +} + +function cast(val, typ) { + return transform(val, typ, jsonToJSProps); +} + +function uncast(val, typ) { + return transform(val, typ, jsToJSONProps); +} + +function l(typ) { + return { literal: typ }; +} + +function a(typ) { + return { arrayItems: typ }; +} + +function u(...typs) { + return { unionMembers: typs }; +} + +function o(props, additional) { + return { props, additional }; +} + +function m(additional) { + return { props: [], additional }; +} + +function r(name) { + return { ref: name }; +} + +const typeMap = { + "LdtkJSON": o([ + { json: "__FORCED_REFS", js: "__FORCED_REFS", typ: u(undefined, r("ForcedRefs")) }, + { json: "appBuildId", js: "appBuildId", typ: 3.14 }, + { json: "backupLimit", js: "backupLimit", typ: 0 }, + { json: "backupOnSave", js: "backupOnSave", typ: true }, + { json: "backupRelPath", js: "backupRelPath", typ: u(undefined, u(null, "")) }, + { json: "bgColor", js: "bgColor", typ: "" }, + { json: "customCommands", js: "customCommands", typ: a(r("LdtkCustomCommand")) }, + { json: "defaultEntityHeight", js: "defaultEntityHeight", typ: 0 }, + { json: "defaultEntityWidth", js: "defaultEntityWidth", typ: 0 }, + { json: "defaultGridSize", js: "defaultGridSize", typ: 0 }, + { json: "defaultLevelBgColor", js: "defaultLevelBgColor", typ: "" }, + { json: "defaultLevelHeight", js: "defaultLevelHeight", typ: u(undefined, u(0, null)) }, + { json: "defaultLevelWidth", js: "defaultLevelWidth", typ: u(undefined, u(0, null)) }, + { json: "defaultPivotX", js: "defaultPivotX", typ: 3.14 }, + { json: "defaultPivotY", js: "defaultPivotY", typ: 3.14 }, + { json: "defs", js: "defs", typ: r("Definitions") }, + { json: "dummyWorldIid", js: "dummyWorldIid", typ: "" }, + { json: "exportLevelBg", js: "exportLevelBg", typ: true }, + { json: "exportPng", js: "exportPng", typ: u(undefined, u(true, null)) }, + { json: "exportTiled", js: "exportTiled", typ: true }, + { json: "externalLevels", js: "externalLevels", typ: true }, + { json: "flags", js: "flags", typ: a(r("Flag")) }, + { json: "identifierStyle", js: "identifierStyle", typ: r("IdentifierStyle") }, + { json: "iid", js: "iid", typ: "" }, + { json: "imageExportMode", js: "imageExportMode", typ: r("ImageExportMode") }, + { json: "jsonVersion", js: "jsonVersion", typ: "" }, + { json: "levelNamePattern", js: "levelNamePattern", typ: "" }, + { json: "levels", js: "levels", typ: a(r("Level")) }, + { json: "minifyJson", js: "minifyJson", typ: true }, + { json: "nextUid", js: "nextUid", typ: 0 }, + { json: "pngFilePattern", js: "pngFilePattern", typ: u(undefined, u(null, "")) }, + { json: "simplifiedExport", js: "simplifiedExport", typ: true }, + { json: "toc", js: "toc", typ: a(r("LdtkTableOfContentEntry")) }, + { json: "tutorialDesc", js: "tutorialDesc", typ: u(undefined, u(null, "")) }, + { json: "worldGridHeight", js: "worldGridHeight", typ: u(undefined, u(0, null)) }, + { json: "worldGridWidth", js: "worldGridWidth", typ: u(undefined, u(0, null)) }, + { json: "worldLayout", js: "worldLayout", typ: u(undefined, u(r("WorldLayout"), null)) }, + { json: "worlds", js: "worlds", typ: a(r("World")) }, + ], "any"), + "ForcedRefs": o([ + { json: "AutoLayerRuleGroup", js: "AutoLayerRuleGroup", typ: u(undefined, r("AutoLayerRuleGroup")) }, + { json: "AutoRuleDef", js: "AutoRuleDef", typ: u(undefined, r("AutoLayerRuleDefinition")) }, + { json: "CustomCommand", js: "CustomCommand", typ: u(undefined, r("LdtkCustomCommand")) }, + { json: "Definitions", js: "Definitions", typ: u(undefined, r("Definitions")) }, + { json: "EntityDef", js: "EntityDef", typ: u(undefined, r("EntityDefinition")) }, + { json: "EntityInstance", js: "EntityInstance", typ: u(undefined, r("EntityInstance")) }, + { json: "EntityReferenceInfos", js: "EntityReferenceInfos", typ: u(undefined, r("ReferenceToAnEntityInstance")) }, + { json: "EnumDef", js: "EnumDef", typ: u(undefined, r("EnumDefinition")) }, + { json: "EnumDefValues", js: "EnumDefValues", typ: u(undefined, r("EnumValueDefinition")) }, + { json: "EnumTagValue", js: "EnumTagValue", typ: u(undefined, r("EnumTagValue")) }, + { json: "FieldDef", js: "FieldDef", typ: u(undefined, r("FieldDefinition")) }, + { json: "FieldInstance", js: "FieldInstance", typ: u(undefined, r("FieldInstance")) }, + { json: "GridPoint", js: "GridPoint", typ: u(undefined, r("GridPoint")) }, + { json: "IntGridValueDef", js: "IntGridValueDef", typ: u(undefined, r("IntGridValueDefinition")) }, + { json: "IntGridValueInstance", js: "IntGridValueInstance", typ: u(undefined, r("IntGridValueInstance")) }, + { json: "LayerDef", js: "LayerDef", typ: u(undefined, r("LayerDefinition")) }, + { json: "LayerInstance", js: "LayerInstance", typ: u(undefined, r("LayerInstance")) }, + { json: "Level", js: "Level", typ: u(undefined, r("Level")) }, + { json: "LevelBgPosInfos", js: "LevelBgPosInfos", typ: u(undefined, r("LevelBackgroundPosition")) }, + { json: "NeighbourLevel", js: "NeighbourLevel", typ: u(undefined, r("NeighbourLevel")) }, + { json: "TableOfContentEntry", js: "TableOfContentEntry", typ: u(undefined, r("LdtkTableOfContentEntry")) }, + { json: "Tile", js: "Tile", typ: u(undefined, r("TileInstance")) }, + { json: "TileCustomMetadata", js: "TileCustomMetadata", typ: u(undefined, r("TileCustomMetadata")) }, + { json: "TilesetDef", js: "TilesetDef", typ: u(undefined, r("TilesetDefinition")) }, + { json: "TilesetRect", js: "TilesetRect", typ: u(undefined, r("TilesetRectangle")) }, + { json: "World", js: "World", typ: u(undefined, r("World")) }, + ], "any"), + "AutoLayerRuleGroup": o([ + { json: "active", js: "active", typ: true }, + { json: "collapsed", js: "collapsed", typ: u(undefined, u(true, null)) }, + { json: "isOptional", js: "isOptional", typ: true }, + { json: "name", js: "name", typ: "" }, + { json: "rules", js: "rules", typ: a(r("AutoLayerRuleDefinition")) }, + { json: "uid", js: "uid", typ: 0 }, + { json: "usesWizard", js: "usesWizard", typ: true }, + ], false), + "AutoLayerRuleDefinition": o([ + { json: "active", js: "active", typ: true }, + { json: "alpha", js: "alpha", typ: 3.14 }, + { json: "breakOnMatch", js: "breakOnMatch", typ: true }, + { json: "chance", js: "chance", typ: 3.14 }, + { json: "checker", js: "checker", typ: r("Checker") }, + { json: "flipX", js: "flipX", typ: true }, + { json: "flipY", js: "flipY", typ: true }, + { json: "outOfBoundsValue", js: "outOfBoundsValue", typ: u(undefined, u(0, null)) }, + { json: "pattern", js: "pattern", typ: a(0) }, + { json: "perlinActive", js: "perlinActive", typ: true }, + { json: "perlinOctaves", js: "perlinOctaves", typ: 3.14 }, + { json: "perlinScale", js: "perlinScale", typ: 3.14 }, + { json: "perlinSeed", js: "perlinSeed", typ: 3.14 }, + { json: "pivotX", js: "pivotX", typ: 3.14 }, + { json: "pivotY", js: "pivotY", typ: 3.14 }, + { json: "size", js: "size", typ: 0 }, + { json: "tileIds", js: "tileIds", typ: a(0) }, + { json: "tileMode", js: "tileMode", typ: r("TileMode") }, + { json: "tileRandomXMax", js: "tileRandomXMax", typ: 0 }, + { json: "tileRandomXMin", js: "tileRandomXMin", typ: 0 }, + { json: "tileRandomYMax", js: "tileRandomYMax", typ: 0 }, + { json: "tileRandomYMin", js: "tileRandomYMin", typ: 0 }, + { json: "tileXOffset", js: "tileXOffset", typ: 0 }, + { json: "tileYOffset", js: "tileYOffset", typ: 0 }, + { json: "uid", js: "uid", typ: 0 }, + { json: "xModulo", js: "xModulo", typ: 0 }, + { json: "xOffset", js: "xOffset", typ: 0 }, + { json: "yModulo", js: "yModulo", typ: 0 }, + { json: "yOffset", js: "yOffset", typ: 0 }, + ], false), + "LdtkCustomCommand": o([ + { json: "command", js: "command", typ: "" }, + { json: "when", js: "when", typ: r("When") }, + ], false), + "Definitions": o([ + { json: "entities", js: "entities", typ: a(r("EntityDefinition")) }, + { json: "enums", js: "enums", typ: a(r("EnumDefinition")) }, + { json: "externalEnums", js: "externalEnums", typ: a(r("EnumDefinition")) }, + { json: "layers", js: "layers", typ: a(r("LayerDefinition")) }, + { json: "levelFields", js: "levelFields", typ: a(r("FieldDefinition")) }, + { json: "tilesets", js: "tilesets", typ: a(r("TilesetDefinition")) }, + ], false), + "EntityDefinition": o([ + { json: "color", js: "color", typ: "" }, + { json: "doc", js: "doc", typ: u(undefined, u(null, "")) }, + { json: "exportToToc", js: "exportToToc", typ: true }, + { json: "fieldDefs", js: "fieldDefs", typ: a(r("FieldDefinition")) }, + { json: "fillOpacity", js: "fillOpacity", typ: 3.14 }, + { json: "height", js: "height", typ: 0 }, + { json: "hollow", js: "hollow", typ: true }, + { json: "identifier", js: "identifier", typ: "" }, + { json: "keepAspectRatio", js: "keepAspectRatio", typ: true }, + { json: "limitBehavior", js: "limitBehavior", typ: r("LimitBehavior") }, + { json: "limitScope", js: "limitScope", typ: r("LimitScope") }, + { json: "lineOpacity", js: "lineOpacity", typ: 3.14 }, + { json: "maxCount", js: "maxCount", typ: 0 }, + { json: "maxHeight", js: "maxHeight", typ: u(undefined, u(0, null)) }, + { json: "maxWidth", js: "maxWidth", typ: u(undefined, u(0, null)) }, + { json: "minHeight", js: "minHeight", typ: u(undefined, u(0, null)) }, + { json: "minWidth", js: "minWidth", typ: u(undefined, u(0, null)) }, + { json: "nineSliceBorders", js: "nineSliceBorders", typ: a(0) }, + { json: "pivotX", js: "pivotX", typ: 3.14 }, + { json: "pivotY", js: "pivotY", typ: 3.14 }, + { json: "renderMode", js: "renderMode", typ: r("RenderMode") }, + { json: "resizableX", js: "resizableX", typ: true }, + { json: "resizableY", js: "resizableY", typ: true }, + { json: "showName", js: "showName", typ: true }, + { json: "tags", js: "tags", typ: a("") }, + { json: "tileId", js: "tileId", typ: u(undefined, u(0, null)) }, + { json: "tileOpacity", js: "tileOpacity", typ: 3.14 }, + { json: "tileRect", js: "tileRect", typ: u(undefined, u(r("TilesetRectangle"), null)) }, + { json: "tileRenderMode", js: "tileRenderMode", typ: r("TileRenderMode") }, + { json: "tilesetId", js: "tilesetId", typ: u(undefined, u(0, null)) }, + { json: "uid", js: "uid", typ: 0 }, + { json: "width", js: "width", typ: 0 }, + ], false), + "FieldDefinition": o([ + { json: "__type", js: "__type", typ: "" }, + { json: "acceptFileTypes", js: "acceptFileTypes", typ: u(undefined, u(a(""), null)) }, + { json: "allowedRefs", js: "allowedRefs", typ: r("AllowedRefs") }, + { json: "allowedRefsEntityUid", js: "allowedRefsEntityUid", typ: u(undefined, u(0, null)) }, + { json: "allowedRefTags", js: "allowedRefTags", typ: a("") }, + { json: "allowOutOfLevelRef", js: "allowOutOfLevelRef", typ: true }, + { json: "arrayMaxLength", js: "arrayMaxLength", typ: u(undefined, u(0, null)) }, + { json: "arrayMinLength", js: "arrayMinLength", typ: u(undefined, u(0, null)) }, + { json: "autoChainRef", js: "autoChainRef", typ: true }, + { json: "canBeNull", js: "canBeNull", typ: true }, + { json: "defaultOverride", js: "defaultOverride", typ: u(undefined, "any") }, + { json: "doc", js: "doc", typ: u(undefined, u(null, "")) }, + { json: "editorAlwaysShow", js: "editorAlwaysShow", typ: true }, + { json: "editorCutLongValues", js: "editorCutLongValues", typ: true }, + { json: "editorDisplayColor", js: "editorDisplayColor", typ: u(undefined, u(null, "")) }, + { json: "editorDisplayMode", js: "editorDisplayMode", typ: r("EditorDisplayMode") }, + { json: "editorDisplayPos", js: "editorDisplayPos", typ: r("EditorDisplayPos") }, + { json: "editorDisplayScale", js: "editorDisplayScale", typ: 3.14 }, + { json: "editorLinkStyle", js: "editorLinkStyle", typ: r("EditorLinkStyle") }, + { json: "editorShowInWorld", js: "editorShowInWorld", typ: true }, + { json: "editorTextPrefix", js: "editorTextPrefix", typ: u(undefined, u(null, "")) }, + { json: "editorTextSuffix", js: "editorTextSuffix", typ: u(undefined, u(null, "")) }, + { json: "identifier", js: "identifier", typ: "" }, + { json: "isArray", js: "isArray", typ: true }, + { json: "max", js: "max", typ: u(undefined, u(3.14, null)) }, + { json: "min", js: "min", typ: u(undefined, u(3.14, null)) }, + { json: "regex", js: "regex", typ: u(undefined, u(null, "")) }, + { json: "symmetricalRef", js: "symmetricalRef", typ: true }, + { json: "textLanguageMode", js: "textLanguageMode", typ: u(undefined, u(r("TextLanguageMode"), null)) }, + { json: "tilesetUid", js: "tilesetUid", typ: u(undefined, u(0, null)) }, + { json: "type", js: "type", typ: "" }, + { json: "uid", js: "uid", typ: 0 }, + { json: "useForSmartColor", js: "useForSmartColor", typ: true }, + ], false), + "TilesetRectangle": o([ + { json: "h", js: "h", typ: 0 }, + { json: "tilesetUid", js: "tilesetUid", typ: 0 }, + { json: "w", js: "w", typ: 0 }, + { json: "x", js: "x", typ: 0 }, + { json: "y", js: "y", typ: 0 }, + ], false), + "EnumDefinition": o([ + { json: "externalFileChecksum", js: "externalFileChecksum", typ: u(undefined, u(null, "")) }, + { json: "externalRelPath", js: "externalRelPath", typ: u(undefined, u(null, "")) }, + { json: "iconTilesetUid", js: "iconTilesetUid", typ: u(undefined, u(0, null)) }, + { json: "identifier", js: "identifier", typ: "" }, + { json: "tags", js: "tags", typ: a("") }, + { json: "uid", js: "uid", typ: 0 }, + { json: "values", js: "values", typ: a(r("EnumValueDefinition")) }, + ], false), + "EnumValueDefinition": o([ + { json: "__tileSrcRect", js: "__tileSrcRect", typ: u(undefined, u(a(0), null)) }, + { json: "color", js: "color", typ: 0 }, + { json: "id", js: "id", typ: "" }, + { json: "tileId", js: "tileId", typ: u(undefined, u(0, null)) }, + { json: "tileRect", js: "tileRect", typ: u(undefined, u(r("TilesetRectangle"), null)) }, + ], false), + "LayerDefinition": o([ + { json: "__type", js: "__type", typ: "" }, + { json: "autoRuleGroups", js: "autoRuleGroups", typ: a(r("AutoLayerRuleGroup")) }, + { json: "autoSourceLayerDefUid", js: "autoSourceLayerDefUid", typ: u(undefined, u(0, null)) }, + { json: "autoTilesetDefUid", js: "autoTilesetDefUid", typ: u(undefined, u(0, null)) }, + { json: "canSelectWhenInactive", js: "canSelectWhenInactive", typ: true }, + { json: "displayOpacity", js: "displayOpacity", typ: 3.14 }, + { json: "doc", js: "doc", typ: u(undefined, u(null, "")) }, + { json: "excludedTags", js: "excludedTags", typ: a("") }, + { json: "gridSize", js: "gridSize", typ: 0 }, + { json: "guideGridHei", js: "guideGridHei", typ: 0 }, + { json: "guideGridWid", js: "guideGridWid", typ: 0 }, + { json: "hideFieldsWhenInactive", js: "hideFieldsWhenInactive", typ: true }, + { json: "hideInList", js: "hideInList", typ: true }, + { json: "identifier", js: "identifier", typ: "" }, + { json: "inactiveOpacity", js: "inactiveOpacity", typ: 3.14 }, + { json: "intGridValues", js: "intGridValues", typ: a(r("IntGridValueDefinition")) }, + { json: "parallaxFactorX", js: "parallaxFactorX", typ: 3.14 }, + { json: "parallaxFactorY", js: "parallaxFactorY", typ: 3.14 }, + { json: "parallaxScaling", js: "parallaxScaling", typ: true }, + { json: "pxOffsetX", js: "pxOffsetX", typ: 0 }, + { json: "pxOffsetY", js: "pxOffsetY", typ: 0 }, + { json: "renderInWorldView", js: "renderInWorldView", typ: true }, + { json: "requiredTags", js: "requiredTags", typ: a("") }, + { json: "tilePivotX", js: "tilePivotX", typ: 3.14 }, + { json: "tilePivotY", js: "tilePivotY", typ: 3.14 }, + { json: "tilesetDefUid", js: "tilesetDefUid", typ: u(undefined, u(0, null)) }, + { json: "type", js: "type", typ: r("Type") }, + { json: "uiColor", js: "uiColor", typ: u(undefined, u(null, "")) }, + { json: "uid", js: "uid", typ: 0 }, + ], false), + "IntGridValueDefinition": o([ + { json: "color", js: "color", typ: "" }, + { json: "identifier", js: "identifier", typ: u(undefined, u(null, "")) }, + { json: "tile", js: "tile", typ: u(undefined, u(r("TilesetRectangle"), null)) }, + { json: "value", js: "value", typ: 0 }, + ], false), + "TilesetDefinition": o([ + { json: "__cHei", js: "__cHei", typ: 0 }, + { json: "__cWid", js: "__cWid", typ: 0 }, + { json: "cachedPixelData", js: "cachedPixelData", typ: u(undefined, u(m("any"), null)) }, + { json: "customData", js: "customData", typ: a(r("TileCustomMetadata")) }, + { json: "embedAtlas", js: "embedAtlas", typ: u(undefined, u(r("EmbedAtlas"), null)) }, + { json: "enumTags", js: "enumTags", typ: a(r("EnumTagValue")) }, + { json: "identifier", js: "identifier", typ: "" }, + { json: "padding", js: "padding", typ: 0 }, + { json: "pxHei", js: "pxHei", typ: 0 }, + { json: "pxWid", js: "pxWid", typ: 0 }, + { json: "relPath", js: "relPath", typ: u(undefined, u(null, "")) }, + { json: "savedSelections", js: "savedSelections", typ: a(m("any")) }, + { json: "spacing", js: "spacing", typ: 0 }, + { json: "tags", js: "tags", typ: a("") }, + { json: "tagsSourceEnumUid", js: "tagsSourceEnumUid", typ: u(undefined, u(0, null)) }, + { json: "tileGridSize", js: "tileGridSize", typ: 0 }, + { json: "uid", js: "uid", typ: 0 }, + ], false), + "TileCustomMetadata": o([ + { json: "data", js: "data", typ: "" }, + { json: "tileId", js: "tileId", typ: 0 }, + ], false), + "EnumTagValue": o([ + { json: "enumValueId", js: "enumValueId", typ: "" }, + { json: "tileIds", js: "tileIds", typ: a(0) }, + ], false), + "EntityInstance": o([ + { json: "__grid", js: "__grid", typ: a(0) }, + { json: "__identifier", js: "__identifier", typ: "" }, + { json: "__pivot", js: "__pivot", typ: a(3.14) }, + { json: "__smartColor", js: "__smartColor", typ: "" }, + { json: "__tags", js: "__tags", typ: a("") }, + { json: "__tile", js: "__tile", typ: u(undefined, u(r("TilesetRectangle"), null)) }, + { json: "__worldX", js: "__worldX", typ: 0 }, + { json: "__worldY", js: "__worldY", typ: 0 }, + { json: "defUid", js: "defUid", typ: 0 }, + { json: "fieldInstances", js: "fieldInstances", typ: a(r("FieldInstance")) }, + { json: "height", js: "height", typ: 0 }, + { json: "iid", js: "iid", typ: "" }, + { json: "px", js: "px", typ: a(0) }, + { json: "width", js: "width", typ: 0 }, + ], false), + "FieldInstance": o([ + { json: "__identifier", js: "__identifier", typ: "" }, + { json: "__tile", js: "__tile", typ: u(undefined, u(r("TilesetRectangle"), null)) }, + { json: "__type", js: "__type", typ: "" }, + { json: "__value", js: "__value", typ: "any" }, + { json: "defUid", js: "defUid", typ: 0 }, + { json: "realEditorValues", js: "realEditorValues", typ: a("any") }, + ], false), + "ReferenceToAnEntityInstance": o([ + { json: "entityIid", js: "entityIid", typ: "" }, + { json: "layerIid", js: "layerIid", typ: "" }, + { json: "levelIid", js: "levelIid", typ: "" }, + { json: "worldIid", js: "worldIid", typ: "" }, + ], false), + "GridPoint": o([ + { json: "cx", js: "cx", typ: 0 }, + { json: "cy", js: "cy", typ: 0 }, + ], false), + "IntGridValueInstance": o([ + { json: "coordId", js: "coordId", typ: 0 }, + { json: "v", js: "v", typ: 0 }, + ], false), + "LayerInstance": o([ + { json: "__cHei", js: "__cHei", typ: 0 }, + { json: "__cWid", js: "__cWid", typ: 0 }, + { json: "__gridSize", js: "__gridSize", typ: 0 }, + { json: "__identifier", js: "__identifier", typ: "" }, + { json: "__opacity", js: "__opacity", typ: 3.14 }, + { json: "__pxTotalOffsetX", js: "__pxTotalOffsetX", typ: 0 }, + { json: "__pxTotalOffsetY", js: "__pxTotalOffsetY", typ: 0 }, + { json: "__tilesetDefUid", js: "__tilesetDefUid", typ: u(undefined, u(0, null)) }, + { json: "__tilesetRelPath", js: "__tilesetRelPath", typ: u(undefined, u(null, "")) }, + { json: "__type", js: "__type", typ: "" }, + { json: "autoLayerTiles", js: "autoLayerTiles", typ: a(r("TileInstance")) }, + { json: "entityInstances", js: "entityInstances", typ: a(r("EntityInstance")) }, + { json: "gridTiles", js: "gridTiles", typ: a(r("TileInstance")) }, + { json: "iid", js: "iid", typ: "" }, + { json: "intGrid", js: "intGrid", typ: u(undefined, u(a(r("IntGridValueInstance")), null)) }, + { json: "intGridCsv", js: "intGridCsv", typ: a(0) }, + { json: "layerDefUid", js: "layerDefUid", typ: 0 }, + { json: "levelId", js: "levelId", typ: 0 }, + { json: "optionalRules", js: "optionalRules", typ: a(0) }, + { json: "overrideTilesetUid", js: "overrideTilesetUid", typ: u(undefined, u(0, null)) }, + { json: "pxOffsetX", js: "pxOffsetX", typ: 0 }, + { json: "pxOffsetY", js: "pxOffsetY", typ: 0 }, + { json: "seed", js: "seed", typ: 0 }, + { json: "visible", js: "visible", typ: true }, + ], false), + "TileInstance": o([ + { json: "a", js: "a", typ: 3.14 }, + { json: "d", js: "d", typ: a(0) }, + { json: "f", js: "f", typ: 0 }, + { json: "px", js: "px", typ: a(0) }, + { json: "src", js: "src", typ: a(0) }, + { json: "t", js: "t", typ: 0 }, + ], false), + "Level": o([ + { json: "__bgColor", js: "__bgColor", typ: "" }, + { json: "__bgPos", js: "__bgPos", typ: u(undefined, u(r("LevelBackgroundPosition"), null)) }, + { json: "__neighbours", js: "__neighbours", typ: a(r("NeighbourLevel")) }, + { json: "__smartColor", js: "__smartColor", typ: "" }, + { json: "bgColor", js: "bgColor", typ: u(undefined, u(null, "")) }, + { json: "bgPivotX", js: "bgPivotX", typ: 3.14 }, + { json: "bgPivotY", js: "bgPivotY", typ: 3.14 }, + { json: "bgPos", js: "bgPos", typ: u(undefined, u(r("BgPos"), null)) }, + { json: "bgRelPath", js: "bgRelPath", typ: u(undefined, u(null, "")) }, + { json: "externalRelPath", js: "externalRelPath", typ: u(undefined, u(null, "")) }, + { json: "fieldInstances", js: "fieldInstances", typ: a(r("FieldInstance")) }, + { json: "identifier", js: "identifier", typ: "" }, + { json: "iid", js: "iid", typ: "" }, + { json: "layerInstances", js: "layerInstances", typ: u(undefined, u(a(r("LayerInstance")), null)) }, + { json: "pxHei", js: "pxHei", typ: 0 }, + { json: "pxWid", js: "pxWid", typ: 0 }, + { json: "uid", js: "uid", typ: 0 }, + { json: "useAutoIdentifier", js: "useAutoIdentifier", typ: true }, + { json: "worldDepth", js: "worldDepth", typ: 0 }, + { json: "worldX", js: "worldX", typ: 0 }, + { json: "worldY", js: "worldY", typ: 0 }, + ], false), + "LevelBackgroundPosition": o([ + { json: "cropRect", js: "cropRect", typ: a(3.14) }, + { json: "scale", js: "scale", typ: a(3.14) }, + { json: "topLeftPx", js: "topLeftPx", typ: a(0) }, + ], false), + "NeighbourLevel": o([ + { json: "dir", js: "dir", typ: "" }, + { json: "levelIid", js: "levelIid", typ: "" }, + { json: "levelUid", js: "levelUid", typ: u(undefined, u(0, null)) }, + ], false), + "LdtkTableOfContentEntry": o([ + { json: "identifier", js: "identifier", typ: "" }, + { json: "instances", js: "instances", typ: a(r("ReferenceToAnEntityInstance")) }, + ], false), + "World": o([ + { json: "defaultLevelHeight", js: "defaultLevelHeight", typ: 0 }, + { json: "defaultLevelWidth", js: "defaultLevelWidth", typ: 0 }, + { json: "identifier", js: "identifier", typ: "" }, + { json: "iid", js: "iid", typ: "" }, + { json: "levels", js: "levels", typ: a(r("Level")) }, + { json: "worldGridHeight", js: "worldGridHeight", typ: 0 }, + { json: "worldGridWidth", js: "worldGridWidth", typ: 0 }, + { json: "worldLayout", js: "worldLayout", typ: u(r("WorldLayout"), null) }, + ], false), + "Checker": [ + "Horizontal", + "None", + "Vertical", + ], + "TileMode": [ + "Single", + "Stamp", + ], + "When": [ + "AfterLoad", + "AfterSave", + "BeforeSave", + "Manual", + ], + "AllowedRefs": [ + "Any", + "OnlySame", + "OnlySpecificEntity", + "OnlyTags", + ], + "EditorDisplayMode": [ + "ArrayCountNoLabel", + "ArrayCountWithLabel", + "EntityTile", + "Hidden", + "LevelTile", + "NameAndValue", + "PointPath", + "PointPathLoop", + "PointStar", + "Points", + "RadiusGrid", + "RadiusPx", + "RefLinkBetweenCenters", + "RefLinkBetweenPivots", + "ValueOnly", + ], + "EditorDisplayPos": [ + "Above", + "Beneath", + "Center", + ], + "EditorLinkStyle": [ + "ArrowsLine", + "CurvedArrow", + "DashedLine", + "StraightArrow", + "ZigZag", + ], + "TextLanguageMode": [ + "LangC", + "LangHaxe", + "LangJS", + "LangJson", + "LangLog", + "LangLua", + "LangMarkdown", + "LangPython", + "LangRuby", + "LangXml", + ], + "LimitBehavior": [ + "DiscardOldOnes", + "MoveLastOne", + "PreventAdding", + ], + "LimitScope": [ + "PerLayer", + "PerLevel", + "PerWorld", + ], + "RenderMode": [ + "Cross", + "Ellipse", + "Rectangle", + "Tile", + ], + "TileRenderMode": [ + "Cover", + "FitInside", + "FullSizeCropped", + "FullSizeUncropped", + "NineSlice", + "Repeat", + "Stretch", + ], + "Type": [ + "AutoLayer", + "Entities", + "IntGrid", + "Tiles", + ], + "EmbedAtlas": [ + "LdtkIcons", + ], + "BgPos": [ + "Contain", + "Cover", + "CoverDirty", + "Repeat", + "Unscaled", + ], + "WorldLayout": [ + "Free", + "GridVania", + "LinearHorizontal", + "LinearVertical", + ], + "Flag": [ + "DiscardPreCsvIntGrid", + "ExportPreCsvIntGridFormat", + "IgnoreBackupSuggest", + "MultiWorlds", + "PrependIndexToLevelFileNames", + "UseMultilinesType", + ], + "IdentifierStyle": [ + "Capitalize", + "Free", + "Lowercase", + "Uppercase", + ], + "ImageExportMode": [ + "LayersAndLevels", + "None", + "OneImagePerLayer", + "OneImagePerLevel", + ], +}; + +module.exports = { + "ldtkJSONToJson": ldtkJSONToJson, + "toLdtkJSON": toLdtkJSON, +}; diff --git a/docs/archives/1.3.4/quicktype/LdtkJson.py b/docs/archives/1.3.4/quicktype/LdtkJson.py new file mode 100644 index 000000000..18a400ea3 --- /dev/null +++ b/docs/archives/1.3.4/quicktype/LdtkJson.py @@ -0,0 +1,2644 @@ +from enum import Enum +from typing import Any, List, Optional, Dict, TypeVar, Type, Callable, cast + + +T = TypeVar("T") +EnumT = TypeVar("EnumT", bound=Enum) + + +def from_str(x: Any) -> str: + assert isinstance(x, str) + return x + + +def to_enum(c: Type[EnumT], x: Any) -> EnumT: + assert isinstance(x, c) + return x.value + + +def from_none(x: Any) -> Any: + assert x is None + return x + + +def from_list(f: Callable[[Any], T], x: Any) -> List[T]: + assert isinstance(x, list) + return [f(y) for y in x] + + +def from_union(fs, x): + for f in fs: + try: + return f(x) + except: + pass + assert False + + +def from_int(x: Any) -> int: + assert isinstance(x, int) and not isinstance(x, bool) + return x + + +def from_bool(x: Any) -> bool: + assert isinstance(x, bool) + return x + + +def from_float(x: Any) -> float: + assert isinstance(x, (float, int)) and not isinstance(x, bool) + return float(x) + + +def to_float(x: Any) -> float: + assert isinstance(x, float) + return x + + +def to_class(c: Type[T], x: Any) -> dict: + assert isinstance(x, c) + return cast(Any, x).to_dict() + + +def from_dict(f: Callable[[Any], T], x: Any) -> Dict[str, T]: + assert isinstance(x, dict) + return { k: f(v) for (k, v) in x.items() } + + +class When(Enum): + """Possible values: `Manual`, `AfterLoad`, `BeforeSave`, `AfterSave`""" + AFTER_LOAD = "AfterLoad" + AFTER_SAVE = "AfterSave" + BEFORE_SAVE = "BeforeSave" + MANUAL = "Manual" + + +class LdtkCustomCommand: + command: str + """Possible values: `Manual`, `AfterLoad`, `BeforeSave`, `AfterSave`""" + when: When + + def __init__(self, command: str, when: When) -> None: + self.command = command + self.when = when + + @staticmethod + def from_dict(obj: Any) -> 'LdtkCustomCommand': + assert isinstance(obj, dict) + command = from_str(obj.get("command")) + when = When(obj.get("when")) + return LdtkCustomCommand(command, when) + + def to_dict(self) -> dict: + result: dict = {} + result["command"] = from_str(self.command) + result["when"] = to_enum(When, self.when) + return result + + +class AllowedRefs(Enum): + """Possible values: `Any`, `OnlySame`, `OnlyTags`, `OnlySpecificEntity`""" + ANY = "Any" + ONLY_SAME = "OnlySame" + ONLY_SPECIFIC_ENTITY = "OnlySpecificEntity" + ONLY_TAGS = "OnlyTags" + + +class EditorDisplayMode(Enum): + """Possible values: `Hidden`, `ValueOnly`, `NameAndValue`, `EntityTile`, `LevelTile`, + `Points`, `PointStar`, `PointPath`, `PointPathLoop`, `RadiusPx`, `RadiusGrid`, + `ArrayCountWithLabel`, `ArrayCountNoLabel`, `RefLinkBetweenPivots`, + `RefLinkBetweenCenters` + """ + ARRAY_COUNT_NO_LABEL = "ArrayCountNoLabel" + ARRAY_COUNT_WITH_LABEL = "ArrayCountWithLabel" + ENTITY_TILE = "EntityTile" + HIDDEN = "Hidden" + LEVEL_TILE = "LevelTile" + NAME_AND_VALUE = "NameAndValue" + POINTS = "Points" + POINT_PATH = "PointPath" + POINT_PATH_LOOP = "PointPathLoop" + POINT_STAR = "PointStar" + RADIUS_GRID = "RadiusGrid" + RADIUS_PX = "RadiusPx" + REF_LINK_BETWEEN_CENTERS = "RefLinkBetweenCenters" + REF_LINK_BETWEEN_PIVOTS = "RefLinkBetweenPivots" + VALUE_ONLY = "ValueOnly" + + +class EditorDisplayPos(Enum): + """Possible values: `Above`, `Center`, `Beneath`""" + ABOVE = "Above" + BENEATH = "Beneath" + CENTER = "Center" + + +class EditorLinkStyle(Enum): + """Possible values: `ZigZag`, `StraightArrow`, `CurvedArrow`, `ArrowsLine`, `DashedLine`""" + ARROWS_LINE = "ArrowsLine" + CURVED_ARROW = "CurvedArrow" + DASHED_LINE = "DashedLine" + STRAIGHT_ARROW = "StraightArrow" + ZIG_ZAG = "ZigZag" + + +class TextLanguageMode(Enum): + LANG_C = "LangC" + LANG_HAXE = "LangHaxe" + LANG_JS = "LangJS" + LANG_JSON = "LangJson" + LANG_LOG = "LangLog" + LANG_LUA = "LangLua" + LANG_MARKDOWN = "LangMarkdown" + LANG_PYTHON = "LangPython" + LANG_RUBY = "LangRuby" + LANG_XML = "LangXml" + + +class FieldDefinition: + """This section is mostly only intended for the LDtk editor app itself. You can safely + ignore it. + """ + """Human readable value type. Possible values: `Int, Float, String, Bool, Color, + ExternEnum.XXX, LocalEnum.XXX, Point, FilePath`.
If the field is an array, this + field will look like `Array<...>` (eg. `Array`, `Array` etc.)
NOTE: if + you enable the advanced option **Use Multilines type**, you will have "*Multilines*" + instead of "*String*" when relevant. + """ + type: str + """Optional list of accepted file extensions for FilePath value type. Includes the dot: + `.ext` + """ + accept_file_types: Optional[List[str]] + """Possible values: `Any`, `OnlySame`, `OnlyTags`, `OnlySpecificEntity`""" + allowed_refs: AllowedRefs + allowed_refs_entity_uid: Optional[int] + allowed_ref_tags: List[str] + allow_out_of_level_ref: bool + """Array max length""" + array_max_length: Optional[int] + """Array min length""" + array_min_length: Optional[int] + auto_chain_ref: bool + """TRUE if the value can be null. For arrays, TRUE means it can contain null values + (exception: array of Points can't have null values). + """ + can_be_null: bool + """Default value if selected value is null or invalid.""" + default_override: Any + """User defined documentation for this field to provide help/tips to level designers about + accepted values. + """ + doc: Optional[str] + editor_always_show: bool + editor_cut_long_values: bool + editor_display_color: Optional[str] + """Possible values: `Hidden`, `ValueOnly`, `NameAndValue`, `EntityTile`, `LevelTile`, + `Points`, `PointStar`, `PointPath`, `PointPathLoop`, `RadiusPx`, `RadiusGrid`, + `ArrayCountWithLabel`, `ArrayCountNoLabel`, `RefLinkBetweenPivots`, + `RefLinkBetweenCenters` + """ + editor_display_mode: EditorDisplayMode + """Possible values: `Above`, `Center`, `Beneath`""" + editor_display_pos: EditorDisplayPos + editor_display_scale: float + """Possible values: `ZigZag`, `StraightArrow`, `CurvedArrow`, `ArrowsLine`, `DashedLine`""" + editor_link_style: EditorLinkStyle + editor_show_in_world: bool + editor_text_prefix: Optional[str] + editor_text_suffix: Optional[str] + """User defined unique identifier""" + identifier: str + """TRUE if the value is an array of multiple values""" + is_array: bool + """Max limit for value, if applicable""" + max: Optional[float] + """Min limit for value, if applicable""" + min: Optional[float] + """Optional regular expression that needs to be matched to accept values. Expected format: + `/some_reg_ex/g`, with optional "i" flag. + """ + regex: Optional[str] + symmetrical_ref: bool + """Possible values: <`null`>, `LangPython`, `LangRuby`, `LangJS`, `LangLua`, `LangC`, + `LangHaxe`, `LangMarkdown`, `LangJson`, `LangXml`, `LangLog` + """ + text_language_mode: Optional[TextLanguageMode] + """UID of the tileset used for a Tile""" + tileset_uid: Optional[int] + """Internal enum representing the possible field types. Possible values: F_Int, F_Float, + F_String, F_Text, F_Bool, F_Color, F_Enum(...), F_Point, F_Path, F_EntityRef, F_Tile + """ + field_definition_type: str + """Unique Int identifier""" + uid: int + """If TRUE, the color associated with this field will override the Entity or Level default + color in the editor UI. For Enum fields, this would be the color associated to their + values. + """ + use_for_smart_color: bool + + def __init__(self, type: str, accept_file_types: Optional[List[str]], allowed_refs: AllowedRefs, allowed_refs_entity_uid: Optional[int], allowed_ref_tags: List[str], allow_out_of_level_ref: bool, array_max_length: Optional[int], array_min_length: Optional[int], auto_chain_ref: bool, can_be_null: bool, default_override: Any, doc: Optional[str], editor_always_show: bool, editor_cut_long_values: bool, editor_display_color: Optional[str], editor_display_mode: EditorDisplayMode, editor_display_pos: EditorDisplayPos, editor_display_scale: float, editor_link_style: EditorLinkStyle, editor_show_in_world: bool, editor_text_prefix: Optional[str], editor_text_suffix: Optional[str], identifier: str, is_array: bool, max: Optional[float], min: Optional[float], regex: Optional[str], symmetrical_ref: bool, text_language_mode: Optional[TextLanguageMode], tileset_uid: Optional[int], field_definition_type: str, uid: int, use_for_smart_color: bool) -> None: + self.type = type + self.accept_file_types = accept_file_types + self.allowed_refs = allowed_refs + self.allowed_refs_entity_uid = allowed_refs_entity_uid + self.allowed_ref_tags = allowed_ref_tags + self.allow_out_of_level_ref = allow_out_of_level_ref + self.array_max_length = array_max_length + self.array_min_length = array_min_length + self.auto_chain_ref = auto_chain_ref + self.can_be_null = can_be_null + self.default_override = default_override + self.doc = doc + self.editor_always_show = editor_always_show + self.editor_cut_long_values = editor_cut_long_values + self.editor_display_color = editor_display_color + self.editor_display_mode = editor_display_mode + self.editor_display_pos = editor_display_pos + self.editor_display_scale = editor_display_scale + self.editor_link_style = editor_link_style + self.editor_show_in_world = editor_show_in_world + self.editor_text_prefix = editor_text_prefix + self.editor_text_suffix = editor_text_suffix + self.identifier = identifier + self.is_array = is_array + self.max = max + self.min = min + self.regex = regex + self.symmetrical_ref = symmetrical_ref + self.text_language_mode = text_language_mode + self.tileset_uid = tileset_uid + self.field_definition_type = field_definition_type + self.uid = uid + self.use_for_smart_color = use_for_smart_color + + @staticmethod + def from_dict(obj: Any) -> 'FieldDefinition': + assert isinstance(obj, dict) + type = from_str(obj.get("__type")) + accept_file_types = from_union([from_none, lambda x: from_list(from_str, x)], obj.get("acceptFileTypes")) + allowed_refs = AllowedRefs(obj.get("allowedRefs")) + allowed_refs_entity_uid = from_union([from_none, from_int], obj.get("allowedRefsEntityUid")) + allowed_ref_tags = from_list(from_str, obj.get("allowedRefTags")) + allow_out_of_level_ref = from_bool(obj.get("allowOutOfLevelRef")) + array_max_length = from_union([from_none, from_int], obj.get("arrayMaxLength")) + array_min_length = from_union([from_none, from_int], obj.get("arrayMinLength")) + auto_chain_ref = from_bool(obj.get("autoChainRef")) + can_be_null = from_bool(obj.get("canBeNull")) + default_override = obj.get("defaultOverride") + doc = from_union([from_none, from_str], obj.get("doc")) + editor_always_show = from_bool(obj.get("editorAlwaysShow")) + editor_cut_long_values = from_bool(obj.get("editorCutLongValues")) + editor_display_color = from_union([from_none, from_str], obj.get("editorDisplayColor")) + editor_display_mode = EditorDisplayMode(obj.get("editorDisplayMode")) + editor_display_pos = EditorDisplayPos(obj.get("editorDisplayPos")) + editor_display_scale = from_float(obj.get("editorDisplayScale")) + editor_link_style = EditorLinkStyle(obj.get("editorLinkStyle")) + editor_show_in_world = from_bool(obj.get("editorShowInWorld")) + editor_text_prefix = from_union([from_none, from_str], obj.get("editorTextPrefix")) + editor_text_suffix = from_union([from_none, from_str], obj.get("editorTextSuffix")) + identifier = from_str(obj.get("identifier")) + is_array = from_bool(obj.get("isArray")) + max = from_union([from_none, from_float], obj.get("max")) + min = from_union([from_none, from_float], obj.get("min")) + regex = from_union([from_none, from_str], obj.get("regex")) + symmetrical_ref = from_bool(obj.get("symmetricalRef")) + text_language_mode = from_union([from_none, TextLanguageMode], obj.get("textLanguageMode")) + tileset_uid = from_union([from_none, from_int], obj.get("tilesetUid")) + field_definition_type = from_str(obj.get("type")) + uid = from_int(obj.get("uid")) + use_for_smart_color = from_bool(obj.get("useForSmartColor")) + return FieldDefinition(type, accept_file_types, allowed_refs, allowed_refs_entity_uid, allowed_ref_tags, allow_out_of_level_ref, array_max_length, array_min_length, auto_chain_ref, can_be_null, default_override, doc, editor_always_show, editor_cut_long_values, editor_display_color, editor_display_mode, editor_display_pos, editor_display_scale, editor_link_style, editor_show_in_world, editor_text_prefix, editor_text_suffix, identifier, is_array, max, min, regex, symmetrical_ref, text_language_mode, tileset_uid, field_definition_type, uid, use_for_smart_color) + + def to_dict(self) -> dict: + result: dict = {} + result["__type"] = from_str(self.type) + if self.accept_file_types is not None: + result["acceptFileTypes"] = from_union([from_none, lambda x: from_list(from_str, x)], self.accept_file_types) + result["allowedRefs"] = to_enum(AllowedRefs, self.allowed_refs) + if self.allowed_refs_entity_uid is not None: + result["allowedRefsEntityUid"] = from_union([from_none, from_int], self.allowed_refs_entity_uid) + result["allowedRefTags"] = from_list(from_str, self.allowed_ref_tags) + result["allowOutOfLevelRef"] = from_bool(self.allow_out_of_level_ref) + if self.array_max_length is not None: + result["arrayMaxLength"] = from_union([from_none, from_int], self.array_max_length) + if self.array_min_length is not None: + result["arrayMinLength"] = from_union([from_none, from_int], self.array_min_length) + result["autoChainRef"] = from_bool(self.auto_chain_ref) + result["canBeNull"] = from_bool(self.can_be_null) + if self.default_override is not None: + result["defaultOverride"] = self.default_override + if self.doc is not None: + result["doc"] = from_union([from_none, from_str], self.doc) + result["editorAlwaysShow"] = from_bool(self.editor_always_show) + result["editorCutLongValues"] = from_bool(self.editor_cut_long_values) + if self.editor_display_color is not None: + result["editorDisplayColor"] = from_union([from_none, from_str], self.editor_display_color) + result["editorDisplayMode"] = to_enum(EditorDisplayMode, self.editor_display_mode) + result["editorDisplayPos"] = to_enum(EditorDisplayPos, self.editor_display_pos) + result["editorDisplayScale"] = to_float(self.editor_display_scale) + result["editorLinkStyle"] = to_enum(EditorLinkStyle, self.editor_link_style) + result["editorShowInWorld"] = from_bool(self.editor_show_in_world) + if self.editor_text_prefix is not None: + result["editorTextPrefix"] = from_union([from_none, from_str], self.editor_text_prefix) + if self.editor_text_suffix is not None: + result["editorTextSuffix"] = from_union([from_none, from_str], self.editor_text_suffix) + result["identifier"] = from_str(self.identifier) + result["isArray"] = from_bool(self.is_array) + if self.max is not None: + result["max"] = from_union([from_none, to_float], self.max) + if self.min is not None: + result["min"] = from_union([from_none, to_float], self.min) + if self.regex is not None: + result["regex"] = from_union([from_none, from_str], self.regex) + result["symmetricalRef"] = from_bool(self.symmetrical_ref) + if self.text_language_mode is not None: + result["textLanguageMode"] = from_union([from_none, lambda x: to_enum(TextLanguageMode, x)], self.text_language_mode) + if self.tileset_uid is not None: + result["tilesetUid"] = from_union([from_none, from_int], self.tileset_uid) + result["type"] = from_str(self.field_definition_type) + result["uid"] = from_int(self.uid) + result["useForSmartColor"] = from_bool(self.use_for_smart_color) + return result + + +class LimitBehavior(Enum): + """Possible values: `DiscardOldOnes`, `PreventAdding`, `MoveLastOne`""" + DISCARD_OLD_ONES = "DiscardOldOnes" + MOVE_LAST_ONE = "MoveLastOne" + PREVENT_ADDING = "PreventAdding" + + +class LimitScope(Enum): + """If TRUE, the maxCount is a "per world" limit, if FALSE, it's a "per level". Possible + values: `PerLayer`, `PerLevel`, `PerWorld` + """ + PER_LAYER = "PerLayer" + PER_LEVEL = "PerLevel" + PER_WORLD = "PerWorld" + + +class RenderMode(Enum): + """Possible values: `Rectangle`, `Ellipse`, `Tile`, `Cross`""" + CROSS = "Cross" + ELLIPSE = "Ellipse" + RECTANGLE = "Rectangle" + TILE = "Tile" + + +class TilesetRectangle: + """This object represents a custom sub rectangle in a Tileset image.""" + """Height in pixels""" + h: int + """UID of the tileset""" + tileset_uid: int + """Width in pixels""" + w: int + """X pixels coordinate of the top-left corner in the Tileset image""" + x: int + """Y pixels coordinate of the top-left corner in the Tileset image""" + y: int + + def __init__(self, h: int, tileset_uid: int, w: int, x: int, y: int) -> None: + self.h = h + self.tileset_uid = tileset_uid + self.w = w + self.x = x + self.y = y + + @staticmethod + def from_dict(obj: Any) -> 'TilesetRectangle': + assert isinstance(obj, dict) + h = from_int(obj.get("h")) + tileset_uid = from_int(obj.get("tilesetUid")) + w = from_int(obj.get("w")) + x = from_int(obj.get("x")) + y = from_int(obj.get("y")) + return TilesetRectangle(h, tileset_uid, w, x, y) + + def to_dict(self) -> dict: + result: dict = {} + result["h"] = from_int(self.h) + result["tilesetUid"] = from_int(self.tileset_uid) + result["w"] = from_int(self.w) + result["x"] = from_int(self.x) + result["y"] = from_int(self.y) + return result + + +class TileRenderMode(Enum): + """An enum describing how the the Entity tile is rendered inside the Entity bounds. Possible + values: `Cover`, `FitInside`, `Repeat`, `Stretch`, `FullSizeCropped`, + `FullSizeUncropped`, `NineSlice` + """ + COVER = "Cover" + FIT_INSIDE = "FitInside" + FULL_SIZE_CROPPED = "FullSizeCropped" + FULL_SIZE_UNCROPPED = "FullSizeUncropped" + NINE_SLICE = "NineSlice" + REPEAT = "Repeat" + STRETCH = "Stretch" + + +class EntityDefinition: + """Base entity color""" + color: str + """User defined documentation for this element to provide help/tips to level designers.""" + doc: Optional[str] + """If enabled, all instances of this entity will be listed in the project "Table of content" + object. + """ + export_to_toc: bool + """Array of field definitions""" + field_defs: List[FieldDefinition] + fill_opacity: float + """Pixel height""" + height: int + hollow: bool + """User defined unique identifier""" + identifier: str + """Only applies to entities resizable on both X/Y. If TRUE, the entity instance width/height + will keep the same aspect ratio as the definition. + """ + keep_aspect_ratio: bool + """Possible values: `DiscardOldOnes`, `PreventAdding`, `MoveLastOne`""" + limit_behavior: LimitBehavior + """If TRUE, the maxCount is a "per world" limit, if FALSE, it's a "per level". Possible + values: `PerLayer`, `PerLevel`, `PerWorld` + """ + limit_scope: LimitScope + line_opacity: float + """Max instances count""" + max_count: int + """Max pixel height (only applies if the entity is resizable on Y)""" + max_height: Optional[int] + """Max pixel width (only applies if the entity is resizable on X)""" + max_width: Optional[int] + """Min pixel height (only applies if the entity is resizable on Y)""" + min_height: Optional[int] + """Min pixel width (only applies if the entity is resizable on X)""" + min_width: Optional[int] + """An array of 4 dimensions for the up/right/down/left borders (in this order) when using + 9-slice mode for `tileRenderMode`.
If the tileRenderMode is not NineSlice, then + this array is empty.
See: https://en.wikipedia.org/wiki/9-slice_scaling + """ + nine_slice_borders: List[int] + """Pivot X coordinate (from 0 to 1.0)""" + pivot_x: float + """Pivot Y coordinate (from 0 to 1.0)""" + pivot_y: float + """Possible values: `Rectangle`, `Ellipse`, `Tile`, `Cross`""" + render_mode: RenderMode + """If TRUE, the entity instances will be resizable horizontally""" + resizable_x: bool + """If TRUE, the entity instances will be resizable vertically""" + resizable_y: bool + """Display entity name in editor""" + show_name: bool + """An array of strings that classifies this entity""" + tags: List[str] + """**WARNING**: this deprecated value is no longer exported since version 1.2.0 Replaced + by: `tileRect` + """ + tile_id: Optional[int] + tile_opacity: float + """An object representing a rectangle from an existing Tileset""" + tile_rect: Optional[TilesetRectangle] + """An enum describing how the the Entity tile is rendered inside the Entity bounds. Possible + values: `Cover`, `FitInside`, `Repeat`, `Stretch`, `FullSizeCropped`, + `FullSizeUncropped`, `NineSlice` + """ + tile_render_mode: TileRenderMode + """Tileset ID used for optional tile display""" + tileset_id: Optional[int] + """Unique Int identifier""" + uid: int + """Pixel width""" + width: int + + def __init__(self, color: str, doc: Optional[str], export_to_toc: bool, field_defs: List[FieldDefinition], fill_opacity: float, height: int, hollow: bool, identifier: str, keep_aspect_ratio: bool, limit_behavior: LimitBehavior, limit_scope: LimitScope, line_opacity: float, max_count: int, max_height: Optional[int], max_width: Optional[int], min_height: Optional[int], min_width: Optional[int], nine_slice_borders: List[int], pivot_x: float, pivot_y: float, render_mode: RenderMode, resizable_x: bool, resizable_y: bool, show_name: bool, tags: List[str], tile_id: Optional[int], tile_opacity: float, tile_rect: Optional[TilesetRectangle], tile_render_mode: TileRenderMode, tileset_id: Optional[int], uid: int, width: int) -> None: + self.color = color + self.doc = doc + self.export_to_toc = export_to_toc + self.field_defs = field_defs + self.fill_opacity = fill_opacity + self.height = height + self.hollow = hollow + self.identifier = identifier + self.keep_aspect_ratio = keep_aspect_ratio + self.limit_behavior = limit_behavior + self.limit_scope = limit_scope + self.line_opacity = line_opacity + self.max_count = max_count + self.max_height = max_height + self.max_width = max_width + self.min_height = min_height + self.min_width = min_width + self.nine_slice_borders = nine_slice_borders + self.pivot_x = pivot_x + self.pivot_y = pivot_y + self.render_mode = render_mode + self.resizable_x = resizable_x + self.resizable_y = resizable_y + self.show_name = show_name + self.tags = tags + self.tile_id = tile_id + self.tile_opacity = tile_opacity + self.tile_rect = tile_rect + self.tile_render_mode = tile_render_mode + self.tileset_id = tileset_id + self.uid = uid + self.width = width + + @staticmethod + def from_dict(obj: Any) -> 'EntityDefinition': + assert isinstance(obj, dict) + color = from_str(obj.get("color")) + doc = from_union([from_none, from_str], obj.get("doc")) + export_to_toc = from_bool(obj.get("exportToToc")) + field_defs = from_list(FieldDefinition.from_dict, obj.get("fieldDefs")) + fill_opacity = from_float(obj.get("fillOpacity")) + height = from_int(obj.get("height")) + hollow = from_bool(obj.get("hollow")) + identifier = from_str(obj.get("identifier")) + keep_aspect_ratio = from_bool(obj.get("keepAspectRatio")) + limit_behavior = LimitBehavior(obj.get("limitBehavior")) + limit_scope = LimitScope(obj.get("limitScope")) + line_opacity = from_float(obj.get("lineOpacity")) + max_count = from_int(obj.get("maxCount")) + max_height = from_union([from_none, from_int], obj.get("maxHeight")) + max_width = from_union([from_none, from_int], obj.get("maxWidth")) + min_height = from_union([from_none, from_int], obj.get("minHeight")) + min_width = from_union([from_none, from_int], obj.get("minWidth")) + nine_slice_borders = from_list(from_int, obj.get("nineSliceBorders")) + pivot_x = from_float(obj.get("pivotX")) + pivot_y = from_float(obj.get("pivotY")) + render_mode = RenderMode(obj.get("renderMode")) + resizable_x = from_bool(obj.get("resizableX")) + resizable_y = from_bool(obj.get("resizableY")) + show_name = from_bool(obj.get("showName")) + tags = from_list(from_str, obj.get("tags")) + tile_id = from_union([from_none, from_int], obj.get("tileId")) + tile_opacity = from_float(obj.get("tileOpacity")) + tile_rect = from_union([from_none, TilesetRectangle.from_dict], obj.get("tileRect")) + tile_render_mode = TileRenderMode(obj.get("tileRenderMode")) + tileset_id = from_union([from_none, from_int], obj.get("tilesetId")) + uid = from_int(obj.get("uid")) + width = from_int(obj.get("width")) + return EntityDefinition(color, doc, export_to_toc, field_defs, fill_opacity, height, hollow, identifier, keep_aspect_ratio, limit_behavior, limit_scope, line_opacity, max_count, max_height, max_width, min_height, min_width, nine_slice_borders, pivot_x, pivot_y, render_mode, resizable_x, resizable_y, show_name, tags, tile_id, tile_opacity, tile_rect, tile_render_mode, tileset_id, uid, width) + + def to_dict(self) -> dict: + result: dict = {} + result["color"] = from_str(self.color) + if self.doc is not None: + result["doc"] = from_union([from_none, from_str], self.doc) + result["exportToToc"] = from_bool(self.export_to_toc) + result["fieldDefs"] = from_list(lambda x: to_class(FieldDefinition, x), self.field_defs) + result["fillOpacity"] = to_float(self.fill_opacity) + result["height"] = from_int(self.height) + result["hollow"] = from_bool(self.hollow) + result["identifier"] = from_str(self.identifier) + result["keepAspectRatio"] = from_bool(self.keep_aspect_ratio) + result["limitBehavior"] = to_enum(LimitBehavior, self.limit_behavior) + result["limitScope"] = to_enum(LimitScope, self.limit_scope) + result["lineOpacity"] = to_float(self.line_opacity) + result["maxCount"] = from_int(self.max_count) + if self.max_height is not None: + result["maxHeight"] = from_union([from_none, from_int], self.max_height) + if self.max_width is not None: + result["maxWidth"] = from_union([from_none, from_int], self.max_width) + if self.min_height is not None: + result["minHeight"] = from_union([from_none, from_int], self.min_height) + if self.min_width is not None: + result["minWidth"] = from_union([from_none, from_int], self.min_width) + result["nineSliceBorders"] = from_list(from_int, self.nine_slice_borders) + result["pivotX"] = to_float(self.pivot_x) + result["pivotY"] = to_float(self.pivot_y) + result["renderMode"] = to_enum(RenderMode, self.render_mode) + result["resizableX"] = from_bool(self.resizable_x) + result["resizableY"] = from_bool(self.resizable_y) + result["showName"] = from_bool(self.show_name) + result["tags"] = from_list(from_str, self.tags) + if self.tile_id is not None: + result["tileId"] = from_union([from_none, from_int], self.tile_id) + result["tileOpacity"] = to_float(self.tile_opacity) + if self.tile_rect is not None: + result["tileRect"] = from_union([from_none, lambda x: to_class(TilesetRectangle, x)], self.tile_rect) + result["tileRenderMode"] = to_enum(TileRenderMode, self.tile_render_mode) + if self.tileset_id is not None: + result["tilesetId"] = from_union([from_none, from_int], self.tileset_id) + result["uid"] = from_int(self.uid) + result["width"] = from_int(self.width) + return result + + +class EnumValueDefinition: + """**WARNING**: this deprecated value will be *removed* completely on version 1.4.0+ + Replaced by: `tileRect` + """ + tile_src_rect: Optional[List[int]] + """Optional color""" + color: int + """Enum value""" + id: str + """**WARNING**: this deprecated value will be *removed* completely on version 1.4.0+ + Replaced by: `tileRect` + """ + tile_id: Optional[int] + """Optional tileset rectangle to represents this value""" + tile_rect: Optional[TilesetRectangle] + + def __init__(self, tile_src_rect: Optional[List[int]], color: int, id: str, tile_id: Optional[int], tile_rect: Optional[TilesetRectangle]) -> None: + self.tile_src_rect = tile_src_rect + self.color = color + self.id = id + self.tile_id = tile_id + self.tile_rect = tile_rect + + @staticmethod + def from_dict(obj: Any) -> 'EnumValueDefinition': + assert isinstance(obj, dict) + tile_src_rect = from_union([from_none, lambda x: from_list(from_int, x)], obj.get("__tileSrcRect")) + color = from_int(obj.get("color")) + id = from_str(obj.get("id")) + tile_id = from_union([from_none, from_int], obj.get("tileId")) + tile_rect = from_union([from_none, TilesetRectangle.from_dict], obj.get("tileRect")) + return EnumValueDefinition(tile_src_rect, color, id, tile_id, tile_rect) + + def to_dict(self) -> dict: + result: dict = {} + if self.tile_src_rect is not None: + result["__tileSrcRect"] = from_union([from_none, lambda x: from_list(from_int, x)], self.tile_src_rect) + result["color"] = from_int(self.color) + result["id"] = from_str(self.id) + if self.tile_id is not None: + result["tileId"] = from_union([from_none, from_int], self.tile_id) + if self.tile_rect is not None: + result["tileRect"] = from_union([from_none, lambda x: to_class(TilesetRectangle, x)], self.tile_rect) + return result + + +class EnumDefinition: + external_file_checksum: Optional[str] + """Relative path to the external file providing this Enum""" + external_rel_path: Optional[str] + """Tileset UID if provided""" + icon_tileset_uid: Optional[int] + """User defined unique identifier""" + identifier: str + """An array of user-defined tags to organize the Enums""" + tags: List[str] + """Unique Int identifier""" + uid: int + """All possible enum values, with their optional Tile infos.""" + values: List[EnumValueDefinition] + + def __init__(self, external_file_checksum: Optional[str], external_rel_path: Optional[str], icon_tileset_uid: Optional[int], identifier: str, tags: List[str], uid: int, values: List[EnumValueDefinition]) -> None: + self.external_file_checksum = external_file_checksum + self.external_rel_path = external_rel_path + self.icon_tileset_uid = icon_tileset_uid + self.identifier = identifier + self.tags = tags + self.uid = uid + self.values = values + + @staticmethod + def from_dict(obj: Any) -> 'EnumDefinition': + assert isinstance(obj, dict) + external_file_checksum = from_union([from_none, from_str], obj.get("externalFileChecksum")) + external_rel_path = from_union([from_none, from_str], obj.get("externalRelPath")) + icon_tileset_uid = from_union([from_none, from_int], obj.get("iconTilesetUid")) + identifier = from_str(obj.get("identifier")) + tags = from_list(from_str, obj.get("tags")) + uid = from_int(obj.get("uid")) + values = from_list(EnumValueDefinition.from_dict, obj.get("values")) + return EnumDefinition(external_file_checksum, external_rel_path, icon_tileset_uid, identifier, tags, uid, values) + + def to_dict(self) -> dict: + result: dict = {} + if self.external_file_checksum is not None: + result["externalFileChecksum"] = from_union([from_none, from_str], self.external_file_checksum) + if self.external_rel_path is not None: + result["externalRelPath"] = from_union([from_none, from_str], self.external_rel_path) + if self.icon_tileset_uid is not None: + result["iconTilesetUid"] = from_union([from_none, from_int], self.icon_tileset_uid) + result["identifier"] = from_str(self.identifier) + result["tags"] = from_list(from_str, self.tags) + result["uid"] = from_int(self.uid) + result["values"] = from_list(lambda x: to_class(EnumValueDefinition, x), self.values) + return result + + +class Checker(Enum): + """Checker mode Possible values: `None`, `Horizontal`, `Vertical`""" + HORIZONTAL = "Horizontal" + NONE = "None" + VERTICAL = "Vertical" + + +class TileMode(Enum): + """Defines how tileIds array is used Possible values: `Single`, `Stamp`""" + SINGLE = "Single" + STAMP = "Stamp" + + +class AutoLayerRuleDefinition: + """This complex section isn't meant to be used by game devs at all, as these rules are + completely resolved internally by the editor before any saving. You should just ignore + this part. + """ + """If FALSE, the rule effect isn't applied, and no tiles are generated.""" + active: bool + alpha: float + """When TRUE, the rule will prevent other rules to be applied in the same cell if it matches + (TRUE by default). + """ + break_on_match: bool + """Chances for this rule to be applied (0 to 1)""" + chance: float + """Checker mode Possible values: `None`, `Horizontal`, `Vertical`""" + checker: Checker + """If TRUE, allow rule to be matched by flipping its pattern horizontally""" + flip_x: bool + """If TRUE, allow rule to be matched by flipping its pattern vertically""" + flip_y: bool + """Default IntGrid value when checking cells outside of level bounds""" + out_of_bounds_value: Optional[int] + """Rule pattern (size x size)""" + pattern: List[int] + """If TRUE, enable Perlin filtering to only apply rule on specific random area""" + perlin_active: bool + perlin_octaves: float + perlin_scale: float + perlin_seed: float + """X pivot of a tile stamp (0-1)""" + pivot_x: float + """Y pivot of a tile stamp (0-1)""" + pivot_y: float + """Pattern width & height. Should only be 1,3,5 or 7.""" + size: int + """Array of all the tile IDs. They are used randomly or as stamps, based on `tileMode` value.""" + tile_ids: List[int] + """Defines how tileIds array is used Possible values: `Single`, `Stamp`""" + tile_mode: TileMode + """Max random offset for X tile pos""" + tile_random_x_max: int + """Min random offset for X tile pos""" + tile_random_x_min: int + """Max random offset for Y tile pos""" + tile_random_y_max: int + """Min random offset for Y tile pos""" + tile_random_y_min: int + """Tile X offset""" + tile_x_offset: int + """Tile Y offset""" + tile_y_offset: int + """Unique Int identifier""" + uid: int + """X cell coord modulo""" + x_modulo: int + """X cell start offset""" + x_offset: int + """Y cell coord modulo""" + y_modulo: int + """Y cell start offset""" + y_offset: int + + def __init__(self, active: bool, alpha: float, break_on_match: bool, chance: float, checker: Checker, flip_x: bool, flip_y: bool, out_of_bounds_value: Optional[int], pattern: List[int], perlin_active: bool, perlin_octaves: float, perlin_scale: float, perlin_seed: float, pivot_x: float, pivot_y: float, size: int, tile_ids: List[int], tile_mode: TileMode, tile_random_x_max: int, tile_random_x_min: int, tile_random_y_max: int, tile_random_y_min: int, tile_x_offset: int, tile_y_offset: int, uid: int, x_modulo: int, x_offset: int, y_modulo: int, y_offset: int) -> None: + self.active = active + self.alpha = alpha + self.break_on_match = break_on_match + self.chance = chance + self.checker = checker + self.flip_x = flip_x + self.flip_y = flip_y + self.out_of_bounds_value = out_of_bounds_value + self.pattern = pattern + self.perlin_active = perlin_active + self.perlin_octaves = perlin_octaves + self.perlin_scale = perlin_scale + self.perlin_seed = perlin_seed + self.pivot_x = pivot_x + self.pivot_y = pivot_y + self.size = size + self.tile_ids = tile_ids + self.tile_mode = tile_mode + self.tile_random_x_max = tile_random_x_max + self.tile_random_x_min = tile_random_x_min + self.tile_random_y_max = tile_random_y_max + self.tile_random_y_min = tile_random_y_min + self.tile_x_offset = tile_x_offset + self.tile_y_offset = tile_y_offset + self.uid = uid + self.x_modulo = x_modulo + self.x_offset = x_offset + self.y_modulo = y_modulo + self.y_offset = y_offset + + @staticmethod + def from_dict(obj: Any) -> 'AutoLayerRuleDefinition': + assert isinstance(obj, dict) + active = from_bool(obj.get("active")) + alpha = from_float(obj.get("alpha")) + break_on_match = from_bool(obj.get("breakOnMatch")) + chance = from_float(obj.get("chance")) + checker = Checker(obj.get("checker")) + flip_x = from_bool(obj.get("flipX")) + flip_y = from_bool(obj.get("flipY")) + out_of_bounds_value = from_union([from_none, from_int], obj.get("outOfBoundsValue")) + pattern = from_list(from_int, obj.get("pattern")) + perlin_active = from_bool(obj.get("perlinActive")) + perlin_octaves = from_float(obj.get("perlinOctaves")) + perlin_scale = from_float(obj.get("perlinScale")) + perlin_seed = from_float(obj.get("perlinSeed")) + pivot_x = from_float(obj.get("pivotX")) + pivot_y = from_float(obj.get("pivotY")) + size = from_int(obj.get("size")) + tile_ids = from_list(from_int, obj.get("tileIds")) + tile_mode = TileMode(obj.get("tileMode")) + tile_random_x_max = from_int(obj.get("tileRandomXMax")) + tile_random_x_min = from_int(obj.get("tileRandomXMin")) + tile_random_y_max = from_int(obj.get("tileRandomYMax")) + tile_random_y_min = from_int(obj.get("tileRandomYMin")) + tile_x_offset = from_int(obj.get("tileXOffset")) + tile_y_offset = from_int(obj.get("tileYOffset")) + uid = from_int(obj.get("uid")) + x_modulo = from_int(obj.get("xModulo")) + x_offset = from_int(obj.get("xOffset")) + y_modulo = from_int(obj.get("yModulo")) + y_offset = from_int(obj.get("yOffset")) + return AutoLayerRuleDefinition(active, alpha, break_on_match, chance, checker, flip_x, flip_y, out_of_bounds_value, pattern, perlin_active, perlin_octaves, perlin_scale, perlin_seed, pivot_x, pivot_y, size, tile_ids, tile_mode, tile_random_x_max, tile_random_x_min, tile_random_y_max, tile_random_y_min, tile_x_offset, tile_y_offset, uid, x_modulo, x_offset, y_modulo, y_offset) + + def to_dict(self) -> dict: + result: dict = {} + result["active"] = from_bool(self.active) + result["alpha"] = to_float(self.alpha) + result["breakOnMatch"] = from_bool(self.break_on_match) + result["chance"] = to_float(self.chance) + result["checker"] = to_enum(Checker, self.checker) + result["flipX"] = from_bool(self.flip_x) + result["flipY"] = from_bool(self.flip_y) + if self.out_of_bounds_value is not None: + result["outOfBoundsValue"] = from_union([from_none, from_int], self.out_of_bounds_value) + result["pattern"] = from_list(from_int, self.pattern) + result["perlinActive"] = from_bool(self.perlin_active) + result["perlinOctaves"] = to_float(self.perlin_octaves) + result["perlinScale"] = to_float(self.perlin_scale) + result["perlinSeed"] = to_float(self.perlin_seed) + result["pivotX"] = to_float(self.pivot_x) + result["pivotY"] = to_float(self.pivot_y) + result["size"] = from_int(self.size) + result["tileIds"] = from_list(from_int, self.tile_ids) + result["tileMode"] = to_enum(TileMode, self.tile_mode) + result["tileRandomXMax"] = from_int(self.tile_random_x_max) + result["tileRandomXMin"] = from_int(self.tile_random_x_min) + result["tileRandomYMax"] = from_int(self.tile_random_y_max) + result["tileRandomYMin"] = from_int(self.tile_random_y_min) + result["tileXOffset"] = from_int(self.tile_x_offset) + result["tileYOffset"] = from_int(self.tile_y_offset) + result["uid"] = from_int(self.uid) + result["xModulo"] = from_int(self.x_modulo) + result["xOffset"] = from_int(self.x_offset) + result["yModulo"] = from_int(self.y_modulo) + result["yOffset"] = from_int(self.y_offset) + return result + + +class AutoLayerRuleGroup: + active: bool + """*This field was removed in 1.0.0 and should no longer be used.*""" + collapsed: Optional[bool] + is_optional: bool + name: str + rules: List[AutoLayerRuleDefinition] + uid: int + uses_wizard: bool + + def __init__(self, active: bool, collapsed: Optional[bool], is_optional: bool, name: str, rules: List[AutoLayerRuleDefinition], uid: int, uses_wizard: bool) -> None: + self.active = active + self.collapsed = collapsed + self.is_optional = is_optional + self.name = name + self.rules = rules + self.uid = uid + self.uses_wizard = uses_wizard + + @staticmethod + def from_dict(obj: Any) -> 'AutoLayerRuleGroup': + assert isinstance(obj, dict) + active = from_bool(obj.get("active")) + collapsed = from_union([from_none, from_bool], obj.get("collapsed")) + is_optional = from_bool(obj.get("isOptional")) + name = from_str(obj.get("name")) + rules = from_list(AutoLayerRuleDefinition.from_dict, obj.get("rules")) + uid = from_int(obj.get("uid")) + uses_wizard = from_bool(obj.get("usesWizard")) + return AutoLayerRuleGroup(active, collapsed, is_optional, name, rules, uid, uses_wizard) + + def to_dict(self) -> dict: + result: dict = {} + result["active"] = from_bool(self.active) + if self.collapsed is not None: + result["collapsed"] = from_union([from_none, from_bool], self.collapsed) + result["isOptional"] = from_bool(self.is_optional) + result["name"] = from_str(self.name) + result["rules"] = from_list(lambda x: to_class(AutoLayerRuleDefinition, x), self.rules) + result["uid"] = from_int(self.uid) + result["usesWizard"] = from_bool(self.uses_wizard) + return result + + +class IntGridValueDefinition: + """IntGrid value definition""" + color: str + """User defined unique identifier""" + identifier: Optional[str] + tile: Optional[TilesetRectangle] + """The IntGrid value itself""" + value: int + + def __init__(self, color: str, identifier: Optional[str], tile: Optional[TilesetRectangle], value: int) -> None: + self.color = color + self.identifier = identifier + self.tile = tile + self.value = value + + @staticmethod + def from_dict(obj: Any) -> 'IntGridValueDefinition': + assert isinstance(obj, dict) + color = from_str(obj.get("color")) + identifier = from_union([from_none, from_str], obj.get("identifier")) + tile = from_union([from_none, TilesetRectangle.from_dict], obj.get("tile")) + value = from_int(obj.get("value")) + return IntGridValueDefinition(color, identifier, tile, value) + + def to_dict(self) -> dict: + result: dict = {} + result["color"] = from_str(self.color) + if self.identifier is not None: + result["identifier"] = from_union([from_none, from_str], self.identifier) + if self.tile is not None: + result["tile"] = from_union([from_none, lambda x: to_class(TilesetRectangle, x)], self.tile) + result["value"] = from_int(self.value) + return result + + +class TypeEnum(Enum): + """Type of the layer as Haxe Enum Possible values: `IntGrid`, `Entities`, `Tiles`, + `AutoLayer` + """ + AUTO_LAYER = "AutoLayer" + ENTITIES = "Entities" + INT_GRID = "IntGrid" + TILES = "Tiles" + + +class LayerDefinition: + """Type of the layer (*IntGrid, Entities, Tiles or AutoLayer*)""" + type: str + """Contains all the auto-layer rule definitions.""" + auto_rule_groups: List[AutoLayerRuleGroup] + auto_source_layer_def_uid: Optional[int] + """**WARNING**: this deprecated value is no longer exported since version 1.2.0 Replaced + by: `tilesetDefUid` + """ + auto_tileset_def_uid: Optional[int] + """Allow editor selections when the layer is not currently active.""" + can_select_when_inactive: bool + """Opacity of the layer (0 to 1.0)""" + display_opacity: float + """User defined documentation for this element to provide help/tips to level designers.""" + doc: Optional[str] + """An array of tags to forbid some Entities in this layer""" + excluded_tags: List[str] + """Width and height of the grid in pixels""" + grid_size: int + """Height of the optional "guide" grid in pixels""" + guide_grid_hei: int + """Width of the optional "guide" grid in pixels""" + guide_grid_wid: int + hide_fields_when_inactive: bool + """Hide the layer from the list on the side of the editor view.""" + hide_in_list: bool + """User defined unique identifier""" + identifier: str + """Alpha of this layer when it is not the active one.""" + inactive_opacity: float + """An array that defines extra optional info for each IntGrid value.
WARNING: the + array order is not related to actual IntGrid values! As user can re-order IntGrid values + freely, you may value "2" before value "1" in this array. + """ + int_grid_values: List[IntGridValueDefinition] + """Parallax horizontal factor (from -1 to 1, defaults to 0) which affects the scrolling + speed of this layer, creating a fake 3D (parallax) effect. + """ + parallax_factor_x: float + """Parallax vertical factor (from -1 to 1, defaults to 0) which affects the scrolling speed + of this layer, creating a fake 3D (parallax) effect. + """ + parallax_factor_y: float + """If true (default), a layer with a parallax factor will also be scaled up/down accordingly.""" + parallax_scaling: bool + """X offset of the layer, in pixels (IMPORTANT: this should be added to the `LayerInstance` + optional offset) + """ + px_offset_x: int + """Y offset of the layer, in pixels (IMPORTANT: this should be added to the `LayerInstance` + optional offset) + """ + px_offset_y: int + """If TRUE, the content of this layer will be used when rendering levels in a simplified way + for the world view + """ + render_in_world_view: bool + """An array of tags to filter Entities that can be added to this layer""" + required_tags: List[str] + """If the tiles are smaller or larger than the layer grid, the pivot value will be used to + position the tile relatively its grid cell. + """ + tile_pivot_x: float + """If the tiles are smaller or larger than the layer grid, the pivot value will be used to + position the tile relatively its grid cell. + """ + tile_pivot_y: float + """Reference to the default Tileset UID being used by this layer definition.
+ **WARNING**: some layer *instances* might use a different tileset. So most of the time, + you should probably use the `__tilesetDefUid` value found in layer instances.
Note: + since version 1.0.0, the old `autoTilesetDefUid` was removed and merged into this value. + """ + tileset_def_uid: Optional[int] + """Type of the layer as Haxe Enum Possible values: `IntGrid`, `Entities`, `Tiles`, + `AutoLayer` + """ + layer_definition_type: TypeEnum + """User defined color for the UI""" + ui_color: Optional[str] + """Unique Int identifier""" + uid: int + + def __init__(self, type: str, auto_rule_groups: List[AutoLayerRuleGroup], auto_source_layer_def_uid: Optional[int], auto_tileset_def_uid: Optional[int], can_select_when_inactive: bool, display_opacity: float, doc: Optional[str], excluded_tags: List[str], grid_size: int, guide_grid_hei: int, guide_grid_wid: int, hide_fields_when_inactive: bool, hide_in_list: bool, identifier: str, inactive_opacity: float, int_grid_values: List[IntGridValueDefinition], parallax_factor_x: float, parallax_factor_y: float, parallax_scaling: bool, px_offset_x: int, px_offset_y: int, render_in_world_view: bool, required_tags: List[str], tile_pivot_x: float, tile_pivot_y: float, tileset_def_uid: Optional[int], layer_definition_type: TypeEnum, ui_color: Optional[str], uid: int) -> None: + self.type = type + self.auto_rule_groups = auto_rule_groups + self.auto_source_layer_def_uid = auto_source_layer_def_uid + self.auto_tileset_def_uid = auto_tileset_def_uid + self.can_select_when_inactive = can_select_when_inactive + self.display_opacity = display_opacity + self.doc = doc + self.excluded_tags = excluded_tags + self.grid_size = grid_size + self.guide_grid_hei = guide_grid_hei + self.guide_grid_wid = guide_grid_wid + self.hide_fields_when_inactive = hide_fields_when_inactive + self.hide_in_list = hide_in_list + self.identifier = identifier + self.inactive_opacity = inactive_opacity + self.int_grid_values = int_grid_values + self.parallax_factor_x = parallax_factor_x + self.parallax_factor_y = parallax_factor_y + self.parallax_scaling = parallax_scaling + self.px_offset_x = px_offset_x + self.px_offset_y = px_offset_y + self.render_in_world_view = render_in_world_view + self.required_tags = required_tags + self.tile_pivot_x = tile_pivot_x + self.tile_pivot_y = tile_pivot_y + self.tileset_def_uid = tileset_def_uid + self.layer_definition_type = layer_definition_type + self.ui_color = ui_color + self.uid = uid + + @staticmethod + def from_dict(obj: Any) -> 'LayerDefinition': + assert isinstance(obj, dict) + type = from_str(obj.get("__type")) + auto_rule_groups = from_list(AutoLayerRuleGroup.from_dict, obj.get("autoRuleGroups")) + auto_source_layer_def_uid = from_union([from_none, from_int], obj.get("autoSourceLayerDefUid")) + auto_tileset_def_uid = from_union([from_none, from_int], obj.get("autoTilesetDefUid")) + can_select_when_inactive = from_bool(obj.get("canSelectWhenInactive")) + display_opacity = from_float(obj.get("displayOpacity")) + doc = from_union([from_none, from_str], obj.get("doc")) + excluded_tags = from_list(from_str, obj.get("excludedTags")) + grid_size = from_int(obj.get("gridSize")) + guide_grid_hei = from_int(obj.get("guideGridHei")) + guide_grid_wid = from_int(obj.get("guideGridWid")) + hide_fields_when_inactive = from_bool(obj.get("hideFieldsWhenInactive")) + hide_in_list = from_bool(obj.get("hideInList")) + identifier = from_str(obj.get("identifier")) + inactive_opacity = from_float(obj.get("inactiveOpacity")) + int_grid_values = from_list(IntGridValueDefinition.from_dict, obj.get("intGridValues")) + parallax_factor_x = from_float(obj.get("parallaxFactorX")) + parallax_factor_y = from_float(obj.get("parallaxFactorY")) + parallax_scaling = from_bool(obj.get("parallaxScaling")) + px_offset_x = from_int(obj.get("pxOffsetX")) + px_offset_y = from_int(obj.get("pxOffsetY")) + render_in_world_view = from_bool(obj.get("renderInWorldView")) + required_tags = from_list(from_str, obj.get("requiredTags")) + tile_pivot_x = from_float(obj.get("tilePivotX")) + tile_pivot_y = from_float(obj.get("tilePivotY")) + tileset_def_uid = from_union([from_none, from_int], obj.get("tilesetDefUid")) + layer_definition_type = TypeEnum(obj.get("type")) + ui_color = from_union([from_none, from_str], obj.get("uiColor")) + uid = from_int(obj.get("uid")) + return LayerDefinition(type, auto_rule_groups, auto_source_layer_def_uid, auto_tileset_def_uid, can_select_when_inactive, display_opacity, doc, excluded_tags, grid_size, guide_grid_hei, guide_grid_wid, hide_fields_when_inactive, hide_in_list, identifier, inactive_opacity, int_grid_values, parallax_factor_x, parallax_factor_y, parallax_scaling, px_offset_x, px_offset_y, render_in_world_view, required_tags, tile_pivot_x, tile_pivot_y, tileset_def_uid, layer_definition_type, ui_color, uid) + + def to_dict(self) -> dict: + result: dict = {} + result["__type"] = from_str(self.type) + result["autoRuleGroups"] = from_list(lambda x: to_class(AutoLayerRuleGroup, x), self.auto_rule_groups) + if self.auto_source_layer_def_uid is not None: + result["autoSourceLayerDefUid"] = from_union([from_none, from_int], self.auto_source_layer_def_uid) + if self.auto_tileset_def_uid is not None: + result["autoTilesetDefUid"] = from_union([from_none, from_int], self.auto_tileset_def_uid) + result["canSelectWhenInactive"] = from_bool(self.can_select_when_inactive) + result["displayOpacity"] = to_float(self.display_opacity) + if self.doc is not None: + result["doc"] = from_union([from_none, from_str], self.doc) + result["excludedTags"] = from_list(from_str, self.excluded_tags) + result["gridSize"] = from_int(self.grid_size) + result["guideGridHei"] = from_int(self.guide_grid_hei) + result["guideGridWid"] = from_int(self.guide_grid_wid) + result["hideFieldsWhenInactive"] = from_bool(self.hide_fields_when_inactive) + result["hideInList"] = from_bool(self.hide_in_list) + result["identifier"] = from_str(self.identifier) + result["inactiveOpacity"] = to_float(self.inactive_opacity) + result["intGridValues"] = from_list(lambda x: to_class(IntGridValueDefinition, x), self.int_grid_values) + result["parallaxFactorX"] = to_float(self.parallax_factor_x) + result["parallaxFactorY"] = to_float(self.parallax_factor_y) + result["parallaxScaling"] = from_bool(self.parallax_scaling) + result["pxOffsetX"] = from_int(self.px_offset_x) + result["pxOffsetY"] = from_int(self.px_offset_y) + result["renderInWorldView"] = from_bool(self.render_in_world_view) + result["requiredTags"] = from_list(from_str, self.required_tags) + result["tilePivotX"] = to_float(self.tile_pivot_x) + result["tilePivotY"] = to_float(self.tile_pivot_y) + if self.tileset_def_uid is not None: + result["tilesetDefUid"] = from_union([from_none, from_int], self.tileset_def_uid) + result["type"] = to_enum(TypeEnum, self.layer_definition_type) + if self.ui_color is not None: + result["uiColor"] = from_union([from_none, from_str], self.ui_color) + result["uid"] = from_int(self.uid) + return result + + +class TileCustomMetadata: + """In a tileset definition, user defined meta-data of a tile.""" + data: str + tile_id: int + + def __init__(self, data: str, tile_id: int) -> None: + self.data = data + self.tile_id = tile_id + + @staticmethod + def from_dict(obj: Any) -> 'TileCustomMetadata': + assert isinstance(obj, dict) + data = from_str(obj.get("data")) + tile_id = from_int(obj.get("tileId")) + return TileCustomMetadata(data, tile_id) + + def to_dict(self) -> dict: + result: dict = {} + result["data"] = from_str(self.data) + result["tileId"] = from_int(self.tile_id) + return result + + +class EmbedAtlas(Enum): + LDTK_ICONS = "LdtkIcons" + + +class EnumTagValue: + """In a tileset definition, enum based tag infos""" + enum_value_id: str + tile_ids: List[int] + + def __init__(self, enum_value_id: str, tile_ids: List[int]) -> None: + self.enum_value_id = enum_value_id + self.tile_ids = tile_ids + + @staticmethod + def from_dict(obj: Any) -> 'EnumTagValue': + assert isinstance(obj, dict) + enum_value_id = from_str(obj.get("enumValueId")) + tile_ids = from_list(from_int, obj.get("tileIds")) + return EnumTagValue(enum_value_id, tile_ids) + + def to_dict(self) -> dict: + result: dict = {} + result["enumValueId"] = from_str(self.enum_value_id) + result["tileIds"] = from_list(from_int, self.tile_ids) + return result + + +class TilesetDefinition: + """The `Tileset` definition is the most important part among project definitions. It + contains some extra informations about each integrated tileset. If you only had to parse + one definition section, that would be the one. + """ + """Grid-based height""" + c_hei: int + """Grid-based width""" + c_wid: int + """The following data is used internally for various optimizations. It's always synced with + source image changes. + """ + cached_pixel_data: Optional[Dict[str, Any]] + """An array of custom tile metadata""" + custom_data: List[TileCustomMetadata] + """If this value is set, then it means that this atlas uses an internal LDtk atlas image + instead of a loaded one. Possible values: <`null`>, `LdtkIcons` + """ + embed_atlas: Optional[EmbedAtlas] + """Tileset tags using Enum values specified by `tagsSourceEnumId`. This array contains 1 + element per Enum value, which contains an array of all Tile IDs that are tagged with it. + """ + enum_tags: List[EnumTagValue] + """User defined unique identifier""" + identifier: str + """Distance in pixels from image borders""" + padding: int + """Image height in pixels""" + px_hei: int + """Image width in pixels""" + px_wid: int + """Path to the source file, relative to the current project JSON file
It can be null + if no image was provided, or when using an embed atlas. + """ + rel_path: Optional[str] + """Array of group of tiles selections, only meant to be used in the editor""" + saved_selections: List[Dict[str, Any]] + """Space in pixels between all tiles""" + spacing: int + """An array of user-defined tags to organize the Tilesets""" + tags: List[str] + """Optional Enum definition UID used for this tileset meta-data""" + tags_source_enum_uid: Optional[int] + tile_grid_size: int + """Unique Intidentifier""" + uid: int + + def __init__(self, c_hei: int, c_wid: int, cached_pixel_data: Optional[Dict[str, Any]], custom_data: List[TileCustomMetadata], embed_atlas: Optional[EmbedAtlas], enum_tags: List[EnumTagValue], identifier: str, padding: int, px_hei: int, px_wid: int, rel_path: Optional[str], saved_selections: List[Dict[str, Any]], spacing: int, tags: List[str], tags_source_enum_uid: Optional[int], tile_grid_size: int, uid: int) -> None: + self.c_hei = c_hei + self.c_wid = c_wid + self.cached_pixel_data = cached_pixel_data + self.custom_data = custom_data + self.embed_atlas = embed_atlas + self.enum_tags = enum_tags + self.identifier = identifier + self.padding = padding + self.px_hei = px_hei + self.px_wid = px_wid + self.rel_path = rel_path + self.saved_selections = saved_selections + self.spacing = spacing + self.tags = tags + self.tags_source_enum_uid = tags_source_enum_uid + self.tile_grid_size = tile_grid_size + self.uid = uid + + @staticmethod + def from_dict(obj: Any) -> 'TilesetDefinition': + assert isinstance(obj, dict) + c_hei = from_int(obj.get("__cHei")) + c_wid = from_int(obj.get("__cWid")) + cached_pixel_data = from_union([from_none, lambda x: from_dict(lambda x: x, x)], obj.get("cachedPixelData")) + custom_data = from_list(TileCustomMetadata.from_dict, obj.get("customData")) + embed_atlas = from_union([from_none, EmbedAtlas], obj.get("embedAtlas")) + enum_tags = from_list(EnumTagValue.from_dict, obj.get("enumTags")) + identifier = from_str(obj.get("identifier")) + padding = from_int(obj.get("padding")) + px_hei = from_int(obj.get("pxHei")) + px_wid = from_int(obj.get("pxWid")) + rel_path = from_union([from_none, from_str], obj.get("relPath")) + saved_selections = from_list(lambda x: from_dict(lambda x: x, x), obj.get("savedSelections")) + spacing = from_int(obj.get("spacing")) + tags = from_list(from_str, obj.get("tags")) + tags_source_enum_uid = from_union([from_none, from_int], obj.get("tagsSourceEnumUid")) + tile_grid_size = from_int(obj.get("tileGridSize")) + uid = from_int(obj.get("uid")) + return TilesetDefinition(c_hei, c_wid, cached_pixel_data, custom_data, embed_atlas, enum_tags, identifier, padding, px_hei, px_wid, rel_path, saved_selections, spacing, tags, tags_source_enum_uid, tile_grid_size, uid) + + def to_dict(self) -> dict: + result: dict = {} + result["__cHei"] = from_int(self.c_hei) + result["__cWid"] = from_int(self.c_wid) + if self.cached_pixel_data is not None: + result["cachedPixelData"] = from_union([from_none, lambda x: from_dict(lambda x: x, x)], self.cached_pixel_data) + result["customData"] = from_list(lambda x: to_class(TileCustomMetadata, x), self.custom_data) + if self.embed_atlas is not None: + result["embedAtlas"] = from_union([from_none, lambda x: to_enum(EmbedAtlas, x)], self.embed_atlas) + result["enumTags"] = from_list(lambda x: to_class(EnumTagValue, x), self.enum_tags) + result["identifier"] = from_str(self.identifier) + result["padding"] = from_int(self.padding) + result["pxHei"] = from_int(self.px_hei) + result["pxWid"] = from_int(self.px_wid) + if self.rel_path is not None: + result["relPath"] = from_union([from_none, from_str], self.rel_path) + result["savedSelections"] = from_list(lambda x: from_dict(lambda x: x, x), self.saved_selections) + result["spacing"] = from_int(self.spacing) + result["tags"] = from_list(from_str, self.tags) + if self.tags_source_enum_uid is not None: + result["tagsSourceEnumUid"] = from_union([from_none, from_int], self.tags_source_enum_uid) + result["tileGridSize"] = from_int(self.tile_grid_size) + result["uid"] = from_int(self.uid) + return result + + +class Definitions: + """If you're writing your own LDtk importer, you should probably just ignore *most* stuff in + the `defs` section, as it contains data that are mostly important to the editor. To keep + you away from the `defs` section and avoid some unnecessary JSON parsing, important data + from definitions is often duplicated in fields prefixed with a double underscore (eg. + `__identifier` or `__type`). The 2 only definition types you might need here are + **Tilesets** and **Enums**. + + A structure containing all the definitions of this project + """ + """All entities definitions, including their custom fields""" + entities: List[EntityDefinition] + """All internal enums""" + enums: List[EnumDefinition] + """Note: external enums are exactly the same as `enums`, except they have a `relPath` to + point to an external source file. + """ + external_enums: List[EnumDefinition] + """All layer definitions""" + layers: List[LayerDefinition] + """All custom fields available to all levels.""" + level_fields: List[FieldDefinition] + """All tilesets""" + tilesets: List[TilesetDefinition] + + def __init__(self, entities: List[EntityDefinition], enums: List[EnumDefinition], external_enums: List[EnumDefinition], layers: List[LayerDefinition], level_fields: List[FieldDefinition], tilesets: List[TilesetDefinition]) -> None: + self.entities = entities + self.enums = enums + self.external_enums = external_enums + self.layers = layers + self.level_fields = level_fields + self.tilesets = tilesets + + @staticmethod + def from_dict(obj: Any) -> 'Definitions': + assert isinstance(obj, dict) + entities = from_list(EntityDefinition.from_dict, obj.get("entities")) + enums = from_list(EnumDefinition.from_dict, obj.get("enums")) + external_enums = from_list(EnumDefinition.from_dict, obj.get("externalEnums")) + layers = from_list(LayerDefinition.from_dict, obj.get("layers")) + level_fields = from_list(FieldDefinition.from_dict, obj.get("levelFields")) + tilesets = from_list(TilesetDefinition.from_dict, obj.get("tilesets")) + return Definitions(entities, enums, external_enums, layers, level_fields, tilesets) + + def to_dict(self) -> dict: + result: dict = {} + result["entities"] = from_list(lambda x: to_class(EntityDefinition, x), self.entities) + result["enums"] = from_list(lambda x: to_class(EnumDefinition, x), self.enums) + result["externalEnums"] = from_list(lambda x: to_class(EnumDefinition, x), self.external_enums) + result["layers"] = from_list(lambda x: to_class(LayerDefinition, x), self.layers) + result["levelFields"] = from_list(lambda x: to_class(FieldDefinition, x), self.level_fields) + result["tilesets"] = from_list(lambda x: to_class(TilesetDefinition, x), self.tilesets) + return result + + +class Flag(Enum): + DISCARD_PRE_CSV_INT_GRID = "DiscardPreCsvIntGrid" + EXPORT_PRE_CSV_INT_GRID_FORMAT = "ExportPreCsvIntGridFormat" + IGNORE_BACKUP_SUGGEST = "IgnoreBackupSuggest" + MULTI_WORLDS = "MultiWorlds" + PREPEND_INDEX_TO_LEVEL_FILE_NAMES = "PrependIndexToLevelFileNames" + USE_MULTILINES_TYPE = "UseMultilinesType" + + +class FieldInstance: + """Field definition identifier""" + identifier: str + """Optional TilesetRect used to display this field (this can be the field own Tile, or some + other Tile guessed from the value, like an Enum). + """ + tile: Optional[TilesetRectangle] + """Type of the field, such as `Int`, `Float`, `String`, `Enum(my_enum_name)`, `Bool`, + etc.
NOTE: if you enable the advanced option **Use Multilines type**, you will have + "*Multilines*" instead of "*String*" when relevant. + """ + type: str + """Actual value of the field instance. The value type varies, depending on `__type`:
+ - For **classic types** (ie. Integer, Float, Boolean, String, Text and FilePath), you + just get the actual value with the expected type.
- For **Color**, the value is an + hexadecimal string using "#rrggbb" format.
- For **Enum**, the value is a String + representing the selected enum value.
- For **Point**, the value is a + [GridPoint](#ldtk-GridPoint) object.
- For **Tile**, the value is a + [TilesetRect](#ldtk-TilesetRect) object.
- For **EntityRef**, the value is an + [EntityReferenceInfos](#ldtk-EntityReferenceInfos) object.

If the field is an + array, then this `__value` will also be a JSON array. + """ + value: Any + """Reference of the **Field definition** UID""" + def_uid: int + """Editor internal raw values""" + real_editor_values: List[Any] + + def __init__(self, identifier: str, tile: Optional[TilesetRectangle], type: str, value: Any, def_uid: int, real_editor_values: List[Any]) -> None: + self.identifier = identifier + self.tile = tile + self.type = type + self.value = value + self.def_uid = def_uid + self.real_editor_values = real_editor_values + + @staticmethod + def from_dict(obj: Any) -> 'FieldInstance': + assert isinstance(obj, dict) + identifier = from_str(obj.get("__identifier")) + tile = from_union([from_none, TilesetRectangle.from_dict], obj.get("__tile")) + type = from_str(obj.get("__type")) + value = obj.get("__value") + def_uid = from_int(obj.get("defUid")) + real_editor_values = from_list(lambda x: x, obj.get("realEditorValues")) + return FieldInstance(identifier, tile, type, value, def_uid, real_editor_values) + + def to_dict(self) -> dict: + result: dict = {} + result["__identifier"] = from_str(self.identifier) + if self.tile is not None: + result["__tile"] = from_union([from_none, lambda x: to_class(TilesetRectangle, x)], self.tile) + result["__type"] = from_str(self.type) + result["__value"] = self.value + result["defUid"] = from_int(self.def_uid) + result["realEditorValues"] = from_list(lambda x: x, self.real_editor_values) + return result + + +class EntityInstance: + """Grid-based coordinates (`[x,y]` format)""" + grid: List[int] + """Entity definition identifier""" + identifier: str + """Pivot coordinates (`[x,y]` format, values are from 0 to 1) of the Entity""" + pivot: List[float] + """The entity "smart" color, guessed from either Entity definition, or one its field + instances. + """ + smart_color: str + """Array of tags defined in this Entity definition""" + tags: List[str] + """Optional TilesetRect used to display this entity (it could either be the default Entity + tile, or some tile provided by a field value, like an Enum). + """ + tile: Optional[TilesetRectangle] + """X world coordinate in pixels""" + world_x: int + """Y world coordinate in pixels""" + world_y: int + """Reference of the **Entity definition** UID""" + def_uid: int + """An array of all custom fields and their values.""" + field_instances: List[FieldInstance] + """Entity height in pixels. For non-resizable entities, it will be the same as Entity + definition. + """ + height: int + """Unique instance identifier""" + iid: str + """Pixel coordinates (`[x,y]` format) in current level coordinate space. Don't forget + optional layer offsets, if they exist! + """ + px: List[int] + """Entity width in pixels. For non-resizable entities, it will be the same as Entity + definition. + """ + width: int + + def __init__(self, grid: List[int], identifier: str, pivot: List[float], smart_color: str, tags: List[str], tile: Optional[TilesetRectangle], world_x: int, world_y: int, def_uid: int, field_instances: List[FieldInstance], height: int, iid: str, px: List[int], width: int) -> None: + self.grid = grid + self.identifier = identifier + self.pivot = pivot + self.smart_color = smart_color + self.tags = tags + self.tile = tile + self.world_x = world_x + self.world_y = world_y + self.def_uid = def_uid + self.field_instances = field_instances + self.height = height + self.iid = iid + self.px = px + self.width = width + + @staticmethod + def from_dict(obj: Any) -> 'EntityInstance': + assert isinstance(obj, dict) + grid = from_list(from_int, obj.get("__grid")) + identifier = from_str(obj.get("__identifier")) + pivot = from_list(from_float, obj.get("__pivot")) + smart_color = from_str(obj.get("__smartColor")) + tags = from_list(from_str, obj.get("__tags")) + tile = from_union([from_none, TilesetRectangle.from_dict], obj.get("__tile")) + world_x = from_int(obj.get("__worldX")) + world_y = from_int(obj.get("__worldY")) + def_uid = from_int(obj.get("defUid")) + field_instances = from_list(FieldInstance.from_dict, obj.get("fieldInstances")) + height = from_int(obj.get("height")) + iid = from_str(obj.get("iid")) + px = from_list(from_int, obj.get("px")) + width = from_int(obj.get("width")) + return EntityInstance(grid, identifier, pivot, smart_color, tags, tile, world_x, world_y, def_uid, field_instances, height, iid, px, width) + + def to_dict(self) -> dict: + result: dict = {} + result["__grid"] = from_list(from_int, self.grid) + result["__identifier"] = from_str(self.identifier) + result["__pivot"] = from_list(to_float, self.pivot) + result["__smartColor"] = from_str(self.smart_color) + result["__tags"] = from_list(from_str, self.tags) + if self.tile is not None: + result["__tile"] = from_union([from_none, lambda x: to_class(TilesetRectangle, x)], self.tile) + result["__worldX"] = from_int(self.world_x) + result["__worldY"] = from_int(self.world_y) + result["defUid"] = from_int(self.def_uid) + result["fieldInstances"] = from_list(lambda x: to_class(FieldInstance, x), self.field_instances) + result["height"] = from_int(self.height) + result["iid"] = from_str(self.iid) + result["px"] = from_list(from_int, self.px) + result["width"] = from_int(self.width) + return result + + +class ReferenceToAnEntityInstance: + """This object describes the "location" of an Entity instance in the project worlds.""" + """IID of the refered EntityInstance""" + entity_iid: str + """IID of the LayerInstance containing the refered EntityInstance""" + layer_iid: str + """IID of the Level containing the refered EntityInstance""" + level_iid: str + """IID of the World containing the refered EntityInstance""" + world_iid: str + + def __init__(self, entity_iid: str, layer_iid: str, level_iid: str, world_iid: str) -> None: + self.entity_iid = entity_iid + self.layer_iid = layer_iid + self.level_iid = level_iid + self.world_iid = world_iid + + @staticmethod + def from_dict(obj: Any) -> 'ReferenceToAnEntityInstance': + assert isinstance(obj, dict) + entity_iid = from_str(obj.get("entityIid")) + layer_iid = from_str(obj.get("layerIid")) + level_iid = from_str(obj.get("levelIid")) + world_iid = from_str(obj.get("worldIid")) + return ReferenceToAnEntityInstance(entity_iid, layer_iid, level_iid, world_iid) + + def to_dict(self) -> dict: + result: dict = {} + result["entityIid"] = from_str(self.entity_iid) + result["layerIid"] = from_str(self.layer_iid) + result["levelIid"] = from_str(self.level_iid) + result["worldIid"] = from_str(self.world_iid) + return result + + +class GridPoint: + """This object is just a grid-based coordinate used in Field values.""" + """X grid-based coordinate""" + cx: int + """Y grid-based coordinate""" + cy: int + + def __init__(self, cx: int, cy: int) -> None: + self.cx = cx + self.cy = cy + + @staticmethod + def from_dict(obj: Any) -> 'GridPoint': + assert isinstance(obj, dict) + cx = from_int(obj.get("cx")) + cy = from_int(obj.get("cy")) + return GridPoint(cx, cy) + + def to_dict(self) -> dict: + result: dict = {} + result["cx"] = from_int(self.cx) + result["cy"] = from_int(self.cy) + return result + + +class IntGridValueInstance: + """IntGrid value instance""" + """Coordinate ID in the layer grid""" + coord_id: int + """IntGrid value""" + v: int + + def __init__(self, coord_id: int, v: int) -> None: + self.coord_id = coord_id + self.v = v + + @staticmethod + def from_dict(obj: Any) -> 'IntGridValueInstance': + assert isinstance(obj, dict) + coord_id = from_int(obj.get("coordId")) + v = from_int(obj.get("v")) + return IntGridValueInstance(coord_id, v) + + def to_dict(self) -> dict: + result: dict = {} + result["coordId"] = from_int(self.coord_id) + result["v"] = from_int(self.v) + return result + + +class TileInstance: + """This structure represents a single tile from a given Tileset.""" + """Alpha/opacity of the tile (0-1, defaults to 1)""" + a: float + """Internal data used by the editor.
For auto-layer tiles: `[ruleId, coordId]`.
+ For tile-layer tiles: `[coordId]`. + """ + d: List[int] + """"Flip bits", a 2-bits integer to represent the mirror transformations of the tile.
+ - Bit 0 = X flip
- Bit 1 = Y flip
Examples: f=0 (no flip), f=1 (X flip + only), f=2 (Y flip only), f=3 (both flips) + """ + f: int + """Pixel coordinates of the tile in the **layer** (`[x,y]` format). Don't forget optional + layer offsets, if they exist! + """ + px: List[int] + """Pixel coordinates of the tile in the **tileset** (`[x,y]` format)""" + src: List[int] + """The *Tile ID* in the corresponding tileset.""" + t: int + + def __init__(self, a: float, d: List[int], f: int, px: List[int], src: List[int], t: int) -> None: + self.a = a + self.d = d + self.f = f + self.px = px + self.src = src + self.t = t + + @staticmethod + def from_dict(obj: Any) -> 'TileInstance': + assert isinstance(obj, dict) + a = from_float(obj.get("a")) + d = from_list(from_int, obj.get("d")) + f = from_int(obj.get("f")) + px = from_list(from_int, obj.get("px")) + src = from_list(from_int, obj.get("src")) + t = from_int(obj.get("t")) + return TileInstance(a, d, f, px, src, t) + + def to_dict(self) -> dict: + result: dict = {} + result["a"] = to_float(self.a) + result["d"] = from_list(from_int, self.d) + result["f"] = from_int(self.f) + result["px"] = from_list(from_int, self.px) + result["src"] = from_list(from_int, self.src) + result["t"] = from_int(self.t) + return result + + +class LayerInstance: + """Grid-based height""" + c_hei: int + """Grid-based width""" + c_wid: int + """Grid size""" + grid_size: int + """Layer definition identifier""" + identifier: str + """Layer opacity as Float [0-1]""" + opacity: float + """Total layer X pixel offset, including both instance and definition offsets.""" + px_total_offset_x: int + """Total layer Y pixel offset, including both instance and definition offsets.""" + px_total_offset_y: int + """The definition UID of corresponding Tileset, if any.""" + tileset_def_uid: Optional[int] + """The relative path to corresponding Tileset, if any.""" + tileset_rel_path: Optional[str] + """Layer type (possible values: IntGrid, Entities, Tiles or AutoLayer)""" + type: str + """An array containing all tiles generated by Auto-layer rules. The array is already sorted + in display order (ie. 1st tile is beneath 2nd, which is beneath 3rd etc.).

+ Note: if multiple tiles are stacked in the same cell as the result of different rules, + all tiles behind opaque ones will be discarded. + """ + auto_layer_tiles: List[TileInstance] + entity_instances: List[EntityInstance] + grid_tiles: List[TileInstance] + """Unique layer instance identifier""" + iid: str + """**WARNING**: this deprecated value is no longer exported since version 1.0.0 Replaced + by: `intGridCsv` + """ + int_grid: Optional[List[IntGridValueInstance]] + """A list of all values in the IntGrid layer, stored in CSV format (Comma Separated + Values).
Order is from left to right, and top to bottom (ie. first row from left to + right, followed by second row, etc).
`0` means "empty cell" and IntGrid values + start at 1.
The array size is `__cWid` x `__cHei` cells. + """ + int_grid_csv: List[int] + """Reference the Layer definition UID""" + layer_def_uid: int + """Reference to the UID of the level containing this layer instance""" + level_id: int + """An Array containing the UIDs of optional rules that were enabled in this specific layer + instance. + """ + optional_rules: List[int] + """This layer can use another tileset by overriding the tileset UID here.""" + override_tileset_uid: Optional[int] + """X offset in pixels to render this layer, usually 0 (IMPORTANT: this should be added to + the `LayerDef` optional offset, so you should probably prefer using `__pxTotalOffsetX` + which contains the total offset value) + """ + px_offset_x: int + """Y offset in pixels to render this layer, usually 0 (IMPORTANT: this should be added to + the `LayerDef` optional offset, so you should probably prefer using `__pxTotalOffsetX` + which contains the total offset value) + """ + px_offset_y: int + """Random seed used for Auto-Layers rendering""" + seed: int + """Layer instance visibility""" + visible: bool + + def __init__(self, c_hei: int, c_wid: int, grid_size: int, identifier: str, opacity: float, px_total_offset_x: int, px_total_offset_y: int, tileset_def_uid: Optional[int], tileset_rel_path: Optional[str], type: str, auto_layer_tiles: List[TileInstance], entity_instances: List[EntityInstance], grid_tiles: List[TileInstance], iid: str, int_grid: Optional[List[IntGridValueInstance]], int_grid_csv: List[int], layer_def_uid: int, level_id: int, optional_rules: List[int], override_tileset_uid: Optional[int], px_offset_x: int, px_offset_y: int, seed: int, visible: bool) -> None: + self.c_hei = c_hei + self.c_wid = c_wid + self.grid_size = grid_size + self.identifier = identifier + self.opacity = opacity + self.px_total_offset_x = px_total_offset_x + self.px_total_offset_y = px_total_offset_y + self.tileset_def_uid = tileset_def_uid + self.tileset_rel_path = tileset_rel_path + self.type = type + self.auto_layer_tiles = auto_layer_tiles + self.entity_instances = entity_instances + self.grid_tiles = grid_tiles + self.iid = iid + self.int_grid = int_grid + self.int_grid_csv = int_grid_csv + self.layer_def_uid = layer_def_uid + self.level_id = level_id + self.optional_rules = optional_rules + self.override_tileset_uid = override_tileset_uid + self.px_offset_x = px_offset_x + self.px_offset_y = px_offset_y + self.seed = seed + self.visible = visible + + @staticmethod + def from_dict(obj: Any) -> 'LayerInstance': + assert isinstance(obj, dict) + c_hei = from_int(obj.get("__cHei")) + c_wid = from_int(obj.get("__cWid")) + grid_size = from_int(obj.get("__gridSize")) + identifier = from_str(obj.get("__identifier")) + opacity = from_float(obj.get("__opacity")) + px_total_offset_x = from_int(obj.get("__pxTotalOffsetX")) + px_total_offset_y = from_int(obj.get("__pxTotalOffsetY")) + tileset_def_uid = from_union([from_none, from_int], obj.get("__tilesetDefUid")) + tileset_rel_path = from_union([from_none, from_str], obj.get("__tilesetRelPath")) + type = from_str(obj.get("__type")) + auto_layer_tiles = from_list(TileInstance.from_dict, obj.get("autoLayerTiles")) + entity_instances = from_list(EntityInstance.from_dict, obj.get("entityInstances")) + grid_tiles = from_list(TileInstance.from_dict, obj.get("gridTiles")) + iid = from_str(obj.get("iid")) + int_grid = from_union([from_none, lambda x: from_list(IntGridValueInstance.from_dict, x)], obj.get("intGrid")) + int_grid_csv = from_list(from_int, obj.get("intGridCsv")) + layer_def_uid = from_int(obj.get("layerDefUid")) + level_id = from_int(obj.get("levelId")) + optional_rules = from_list(from_int, obj.get("optionalRules")) + override_tileset_uid = from_union([from_none, from_int], obj.get("overrideTilesetUid")) + px_offset_x = from_int(obj.get("pxOffsetX")) + px_offset_y = from_int(obj.get("pxOffsetY")) + seed = from_int(obj.get("seed")) + visible = from_bool(obj.get("visible")) + return LayerInstance(c_hei, c_wid, grid_size, identifier, opacity, px_total_offset_x, px_total_offset_y, tileset_def_uid, tileset_rel_path, type, auto_layer_tiles, entity_instances, grid_tiles, iid, int_grid, int_grid_csv, layer_def_uid, level_id, optional_rules, override_tileset_uid, px_offset_x, px_offset_y, seed, visible) + + def to_dict(self) -> dict: + result: dict = {} + result["__cHei"] = from_int(self.c_hei) + result["__cWid"] = from_int(self.c_wid) + result["__gridSize"] = from_int(self.grid_size) + result["__identifier"] = from_str(self.identifier) + result["__opacity"] = to_float(self.opacity) + result["__pxTotalOffsetX"] = from_int(self.px_total_offset_x) + result["__pxTotalOffsetY"] = from_int(self.px_total_offset_y) + if self.tileset_def_uid is not None: + result["__tilesetDefUid"] = from_union([from_none, from_int], self.tileset_def_uid) + if self.tileset_rel_path is not None: + result["__tilesetRelPath"] = from_union([from_none, from_str], self.tileset_rel_path) + result["__type"] = from_str(self.type) + result["autoLayerTiles"] = from_list(lambda x: to_class(TileInstance, x), self.auto_layer_tiles) + result["entityInstances"] = from_list(lambda x: to_class(EntityInstance, x), self.entity_instances) + result["gridTiles"] = from_list(lambda x: to_class(TileInstance, x), self.grid_tiles) + result["iid"] = from_str(self.iid) + if self.int_grid is not None: + result["intGrid"] = from_union([from_none, lambda x: from_list(lambda x: to_class(IntGridValueInstance, x), x)], self.int_grid) + result["intGridCsv"] = from_list(from_int, self.int_grid_csv) + result["layerDefUid"] = from_int(self.layer_def_uid) + result["levelId"] = from_int(self.level_id) + result["optionalRules"] = from_list(from_int, self.optional_rules) + if self.override_tileset_uid is not None: + result["overrideTilesetUid"] = from_union([from_none, from_int], self.override_tileset_uid) + result["pxOffsetX"] = from_int(self.px_offset_x) + result["pxOffsetY"] = from_int(self.px_offset_y) + result["seed"] = from_int(self.seed) + result["visible"] = from_bool(self.visible) + return result + + +class LevelBackgroundPosition: + """Level background image position info""" + """An array of 4 float values describing the cropped sub-rectangle of the displayed + background image. This cropping happens when original is larger than the level bounds. + Array format: `[ cropX, cropY, cropWidth, cropHeight ]` + """ + crop_rect: List[float] + """An array containing the `[scaleX,scaleY]` values of the **cropped** background image, + depending on `bgPos` option. + """ + scale: List[float] + """An array containing the `[x,y]` pixel coordinates of the top-left corner of the + **cropped** background image, depending on `bgPos` option. + """ + top_left_px: List[int] + + def __init__(self, crop_rect: List[float], scale: List[float], top_left_px: List[int]) -> None: + self.crop_rect = crop_rect + self.scale = scale + self.top_left_px = top_left_px + + @staticmethod + def from_dict(obj: Any) -> 'LevelBackgroundPosition': + assert isinstance(obj, dict) + crop_rect = from_list(from_float, obj.get("cropRect")) + scale = from_list(from_float, obj.get("scale")) + top_left_px = from_list(from_int, obj.get("topLeftPx")) + return LevelBackgroundPosition(crop_rect, scale, top_left_px) + + def to_dict(self) -> dict: + result: dict = {} + result["cropRect"] = from_list(to_float, self.crop_rect) + result["scale"] = from_list(to_float, self.scale) + result["topLeftPx"] = from_list(from_int, self.top_left_px) + return result + + +class BgPos(Enum): + CONTAIN = "Contain" + COVER = "Cover" + COVER_DIRTY = "CoverDirty" + REPEAT = "Repeat" + UNSCALED = "Unscaled" + + +class NeighbourLevel: + """Nearby level info""" + """A single lowercase character tipping on the level location (`n`orth, `s`outh, `w`est, + `e`ast). + """ + dir: str + """Neighbour Instance Identifier""" + level_iid: str + """**WARNING**: this deprecated value is no longer exported since version 1.2.0 Replaced + by: `levelIid` + """ + level_uid: Optional[int] + + def __init__(self, dir: str, level_iid: str, level_uid: Optional[int]) -> None: + self.dir = dir + self.level_iid = level_iid + self.level_uid = level_uid + + @staticmethod + def from_dict(obj: Any) -> 'NeighbourLevel': + assert isinstance(obj, dict) + dir = from_str(obj.get("dir")) + level_iid = from_str(obj.get("levelIid")) + level_uid = from_union([from_none, from_int], obj.get("levelUid")) + return NeighbourLevel(dir, level_iid, level_uid) + + def to_dict(self) -> dict: + result: dict = {} + result["dir"] = from_str(self.dir) + result["levelIid"] = from_str(self.level_iid) + if self.level_uid is not None: + result["levelUid"] = from_union([from_none, from_int], self.level_uid) + return result + + +class Level: + """This section contains all the level data. It can be found in 2 distinct forms, depending + on Project current settings: - If "*Separate level files*" is **disabled** (default): + full level data is *embedded* inside the main Project JSON file, - If "*Separate level + files*" is **enabled**: level data is stored in *separate* standalone `.ldtkl` files (one + per level). In this case, the main Project JSON file will still contain most level data, + except heavy sections, like the `layerInstances` array (which will be null). The + `externalRelPath` string points to the `ldtkl` file. A `ldtkl` file is just a JSON file + containing exactly what is described below. + """ + """Background color of the level (same as `bgColor`, except the default value is + automatically used here if its value is `null`) + """ + bg_color: str + """Position informations of the background image, if there is one.""" + bg_pos: Optional[LevelBackgroundPosition] + """An array listing all other levels touching this one on the world map.
Only relevant + for world layouts where level spatial positioning is manual (ie. GridVania, Free). For + Horizontal and Vertical layouts, this array is always empty. + """ + neighbours: List[NeighbourLevel] + """The "guessed" color for this level in the editor, decided using either the background + color or an existing custom field. + """ + smart_color: str + """Background color of the level. If `null`, the project `defaultLevelBgColor` should be + used. + """ + level_bg_color: Optional[str] + """Background image X pivot (0-1)""" + bg_pivot_x: float + """Background image Y pivot (0-1)""" + bg_pivot_y: float + """An enum defining the way the background image (if any) is positioned on the level. See + `__bgPos` for resulting position info. Possible values: <`null`>, `Unscaled`, + `Contain`, `Cover`, `CoverDirty`, `Repeat` + """ + level_bg_pos: Optional[BgPos] + """The *optional* relative path to the level background image.""" + bg_rel_path: Optional[str] + """This value is not null if the project option "*Save levels separately*" is enabled. In + this case, this **relative** path points to the level Json file. + """ + external_rel_path: Optional[str] + """An array containing this level custom field values.""" + field_instances: List[FieldInstance] + """User defined unique identifier""" + identifier: str + """Unique instance identifier""" + iid: str + """An array containing all Layer instances. **IMPORTANT**: if the project option "*Save + levels separately*" is enabled, this field will be `null`.
This array is **sorted + in display order**: the 1st layer is the top-most and the last is behind. + """ + layer_instances: Optional[List[LayerInstance]] + """Height of the level in pixels""" + px_hei: int + """Width of the level in pixels""" + px_wid: int + """Unique Int identifier""" + uid: int + """If TRUE, the level identifier will always automatically use the naming pattern as defined + in `Project.levelNamePattern`. Becomes FALSE if the identifier is manually modified by + user. + """ + use_auto_identifier: bool + """Index that represents the "depth" of the level in the world. Default is 0, greater means + "above", lower means "below".
This value is mostly used for display only and is + intended to make stacking of levels easier to manage. + """ + world_depth: int + """World X coordinate in pixels.
Only relevant for world layouts where level spatial + positioning is manual (ie. GridVania, Free). For Horizontal and Vertical layouts, the + value is always -1 here. + """ + world_x: int + """World Y coordinate in pixels.
Only relevant for world layouts where level spatial + positioning is manual (ie. GridVania, Free). For Horizontal and Vertical layouts, the + value is always -1 here. + """ + world_y: int + + def __init__(self, bg_color: str, bg_pos: Optional[LevelBackgroundPosition], neighbours: List[NeighbourLevel], smart_color: str, level_bg_color: Optional[str], bg_pivot_x: float, bg_pivot_y: float, level_bg_pos: Optional[BgPos], bg_rel_path: Optional[str], external_rel_path: Optional[str], field_instances: List[FieldInstance], identifier: str, iid: str, layer_instances: Optional[List[LayerInstance]], px_hei: int, px_wid: int, uid: int, use_auto_identifier: bool, world_depth: int, world_x: int, world_y: int) -> None: + self.bg_color = bg_color + self.bg_pos = bg_pos + self.neighbours = neighbours + self.smart_color = smart_color + self.level_bg_color = level_bg_color + self.bg_pivot_x = bg_pivot_x + self.bg_pivot_y = bg_pivot_y + self.level_bg_pos = level_bg_pos + self.bg_rel_path = bg_rel_path + self.external_rel_path = external_rel_path + self.field_instances = field_instances + self.identifier = identifier + self.iid = iid + self.layer_instances = layer_instances + self.px_hei = px_hei + self.px_wid = px_wid + self.uid = uid + self.use_auto_identifier = use_auto_identifier + self.world_depth = world_depth + self.world_x = world_x + self.world_y = world_y + + @staticmethod + def from_dict(obj: Any) -> 'Level': + assert isinstance(obj, dict) + bg_color = from_str(obj.get("__bgColor")) + bg_pos = from_union([from_none, LevelBackgroundPosition.from_dict], obj.get("__bgPos")) + neighbours = from_list(NeighbourLevel.from_dict, obj.get("__neighbours")) + smart_color = from_str(obj.get("__smartColor")) + level_bg_color = from_union([from_none, from_str], obj.get("bgColor")) + bg_pivot_x = from_float(obj.get("bgPivotX")) + bg_pivot_y = from_float(obj.get("bgPivotY")) + level_bg_pos = from_union([from_none, BgPos], obj.get("bgPos")) + bg_rel_path = from_union([from_none, from_str], obj.get("bgRelPath")) + external_rel_path = from_union([from_none, from_str], obj.get("externalRelPath")) + field_instances = from_list(FieldInstance.from_dict, obj.get("fieldInstances")) + identifier = from_str(obj.get("identifier")) + iid = from_str(obj.get("iid")) + layer_instances = from_union([from_none, lambda x: from_list(LayerInstance.from_dict, x)], obj.get("layerInstances")) + px_hei = from_int(obj.get("pxHei")) + px_wid = from_int(obj.get("pxWid")) + uid = from_int(obj.get("uid")) + use_auto_identifier = from_bool(obj.get("useAutoIdentifier")) + world_depth = from_int(obj.get("worldDepth")) + world_x = from_int(obj.get("worldX")) + world_y = from_int(obj.get("worldY")) + return Level(bg_color, bg_pos, neighbours, smart_color, level_bg_color, bg_pivot_x, bg_pivot_y, level_bg_pos, bg_rel_path, external_rel_path, field_instances, identifier, iid, layer_instances, px_hei, px_wid, uid, use_auto_identifier, world_depth, world_x, world_y) + + def to_dict(self) -> dict: + result: dict = {} + result["__bgColor"] = from_str(self.bg_color) + if self.bg_pos is not None: + result["__bgPos"] = from_union([from_none, lambda x: to_class(LevelBackgroundPosition, x)], self.bg_pos) + result["__neighbours"] = from_list(lambda x: to_class(NeighbourLevel, x), self.neighbours) + result["__smartColor"] = from_str(self.smart_color) + if self.level_bg_color is not None: + result["bgColor"] = from_union([from_none, from_str], self.level_bg_color) + result["bgPivotX"] = to_float(self.bg_pivot_x) + result["bgPivotY"] = to_float(self.bg_pivot_y) + if self.level_bg_pos is not None: + result["bgPos"] = from_union([from_none, lambda x: to_enum(BgPos, x)], self.level_bg_pos) + if self.bg_rel_path is not None: + result["bgRelPath"] = from_union([from_none, from_str], self.bg_rel_path) + if self.external_rel_path is not None: + result["externalRelPath"] = from_union([from_none, from_str], self.external_rel_path) + result["fieldInstances"] = from_list(lambda x: to_class(FieldInstance, x), self.field_instances) + result["identifier"] = from_str(self.identifier) + result["iid"] = from_str(self.iid) + if self.layer_instances is not None: + result["layerInstances"] = from_union([from_none, lambda x: from_list(lambda x: to_class(LayerInstance, x), x)], self.layer_instances) + result["pxHei"] = from_int(self.px_hei) + result["pxWid"] = from_int(self.px_wid) + result["uid"] = from_int(self.uid) + result["useAutoIdentifier"] = from_bool(self.use_auto_identifier) + result["worldDepth"] = from_int(self.world_depth) + result["worldX"] = from_int(self.world_x) + result["worldY"] = from_int(self.world_y) + return result + + +class LdtkTableOfContentEntry: + identifier: str + instances: List[ReferenceToAnEntityInstance] + + def __init__(self, identifier: str, instances: List[ReferenceToAnEntityInstance]) -> None: + self.identifier = identifier + self.instances = instances + + @staticmethod + def from_dict(obj: Any) -> 'LdtkTableOfContentEntry': + assert isinstance(obj, dict) + identifier = from_str(obj.get("identifier")) + instances = from_list(ReferenceToAnEntityInstance.from_dict, obj.get("instances")) + return LdtkTableOfContentEntry(identifier, instances) + + def to_dict(self) -> dict: + result: dict = {} + result["identifier"] = from_str(self.identifier) + result["instances"] = from_list(lambda x: to_class(ReferenceToAnEntityInstance, x), self.instances) + return result + + +class WorldLayout(Enum): + FREE = "Free" + GRID_VANIA = "GridVania" + LINEAR_HORIZONTAL = "LinearHorizontal" + LINEAR_VERTICAL = "LinearVertical" + + +class World: + """**IMPORTANT**: this type is available as a preview. You can rely on it to update your + importers, for when it will be officially available. A World contains multiple levels, + and it has its own layout settings. + """ + """Default new level height""" + default_level_height: int + """Default new level width""" + default_level_width: int + """User defined unique identifier""" + identifier: str + """Unique instance identifer""" + iid: str + """All levels from this world. The order of this array is only relevant in + `LinearHorizontal` and `linearVertical` world layouts (see `worldLayout` value). + Otherwise, you should refer to the `worldX`,`worldY` coordinates of each Level. + """ + levels: List[Level] + """Height of the world grid in pixels.""" + world_grid_height: int + """Width of the world grid in pixels.""" + world_grid_width: int + """An enum that describes how levels are organized in this project (ie. linearly or in a 2D + space). Possible values: `Free`, `GridVania`, `LinearHorizontal`, `LinearVertical`, `null` + """ + world_layout: Optional[WorldLayout] + + def __init__(self, default_level_height: int, default_level_width: int, identifier: str, iid: str, levels: List[Level], world_grid_height: int, world_grid_width: int, world_layout: Optional[WorldLayout]) -> None: + self.default_level_height = default_level_height + self.default_level_width = default_level_width + self.identifier = identifier + self.iid = iid + self.levels = levels + self.world_grid_height = world_grid_height + self.world_grid_width = world_grid_width + self.world_layout = world_layout + + @staticmethod + def from_dict(obj: Any) -> 'World': + assert isinstance(obj, dict) + default_level_height = from_int(obj.get("defaultLevelHeight")) + default_level_width = from_int(obj.get("defaultLevelWidth")) + identifier = from_str(obj.get("identifier")) + iid = from_str(obj.get("iid")) + levels = from_list(Level.from_dict, obj.get("levels")) + world_grid_height = from_int(obj.get("worldGridHeight")) + world_grid_width = from_int(obj.get("worldGridWidth")) + world_layout = from_union([from_none, WorldLayout], obj.get("worldLayout")) + return World(default_level_height, default_level_width, identifier, iid, levels, world_grid_height, world_grid_width, world_layout) + + def to_dict(self) -> dict: + result: dict = {} + result["defaultLevelHeight"] = from_int(self.default_level_height) + result["defaultLevelWidth"] = from_int(self.default_level_width) + result["identifier"] = from_str(self.identifier) + result["iid"] = from_str(self.iid) + result["levels"] = from_list(lambda x: to_class(Level, x), self.levels) + result["worldGridHeight"] = from_int(self.world_grid_height) + result["worldGridWidth"] = from_int(self.world_grid_width) + result["worldLayout"] = from_union([from_none, lambda x: to_enum(WorldLayout, x)], self.world_layout) + return result + + +class ForcedRefs: + """This object is not actually used by LDtk. It ONLY exists to force explicit references to + all types, to make sure QuickType finds them and integrate all of them. Otherwise, + Quicktype will drop types that are not explicitely used. + """ + auto_layer_rule_group: Optional[AutoLayerRuleGroup] + auto_rule_def: Optional[AutoLayerRuleDefinition] + custom_command: Optional[LdtkCustomCommand] + definitions: Optional[Definitions] + entity_def: Optional[EntityDefinition] + entity_instance: Optional[EntityInstance] + entity_reference_infos: Optional[ReferenceToAnEntityInstance] + enum_def: Optional[EnumDefinition] + enum_def_values: Optional[EnumValueDefinition] + enum_tag_value: Optional[EnumTagValue] + field_def: Optional[FieldDefinition] + field_instance: Optional[FieldInstance] + grid_point: Optional[GridPoint] + int_grid_value_def: Optional[IntGridValueDefinition] + int_grid_value_instance: Optional[IntGridValueInstance] + layer_def: Optional[LayerDefinition] + layer_instance: Optional[LayerInstance] + level: Optional[Level] + level_bg_pos_infos: Optional[LevelBackgroundPosition] + neighbour_level: Optional[NeighbourLevel] + table_of_content_entry: Optional[LdtkTableOfContentEntry] + tile: Optional[TileInstance] + tile_custom_metadata: Optional[TileCustomMetadata] + tileset_def: Optional[TilesetDefinition] + tileset_rect: Optional[TilesetRectangle] + world: Optional[World] + + def __init__(self, auto_layer_rule_group: Optional[AutoLayerRuleGroup], auto_rule_def: Optional[AutoLayerRuleDefinition], custom_command: Optional[LdtkCustomCommand], definitions: Optional[Definitions], entity_def: Optional[EntityDefinition], entity_instance: Optional[EntityInstance], entity_reference_infos: Optional[ReferenceToAnEntityInstance], enum_def: Optional[EnumDefinition], enum_def_values: Optional[EnumValueDefinition], enum_tag_value: Optional[EnumTagValue], field_def: Optional[FieldDefinition], field_instance: Optional[FieldInstance], grid_point: Optional[GridPoint], int_grid_value_def: Optional[IntGridValueDefinition], int_grid_value_instance: Optional[IntGridValueInstance], layer_def: Optional[LayerDefinition], layer_instance: Optional[LayerInstance], level: Optional[Level], level_bg_pos_infos: Optional[LevelBackgroundPosition], neighbour_level: Optional[NeighbourLevel], table_of_content_entry: Optional[LdtkTableOfContentEntry], tile: Optional[TileInstance], tile_custom_metadata: Optional[TileCustomMetadata], tileset_def: Optional[TilesetDefinition], tileset_rect: Optional[TilesetRectangle], world: Optional[World]) -> None: + self.auto_layer_rule_group = auto_layer_rule_group + self.auto_rule_def = auto_rule_def + self.custom_command = custom_command + self.definitions = definitions + self.entity_def = entity_def + self.entity_instance = entity_instance + self.entity_reference_infos = entity_reference_infos + self.enum_def = enum_def + self.enum_def_values = enum_def_values + self.enum_tag_value = enum_tag_value + self.field_def = field_def + self.field_instance = field_instance + self.grid_point = grid_point + self.int_grid_value_def = int_grid_value_def + self.int_grid_value_instance = int_grid_value_instance + self.layer_def = layer_def + self.layer_instance = layer_instance + self.level = level + self.level_bg_pos_infos = level_bg_pos_infos + self.neighbour_level = neighbour_level + self.table_of_content_entry = table_of_content_entry + self.tile = tile + self.tile_custom_metadata = tile_custom_metadata + self.tileset_def = tileset_def + self.tileset_rect = tileset_rect + self.world = world + + @staticmethod + def from_dict(obj: Any) -> 'ForcedRefs': + assert isinstance(obj, dict) + auto_layer_rule_group = from_union([AutoLayerRuleGroup.from_dict, from_none], obj.get("AutoLayerRuleGroup")) + auto_rule_def = from_union([AutoLayerRuleDefinition.from_dict, from_none], obj.get("AutoRuleDef")) + custom_command = from_union([LdtkCustomCommand.from_dict, from_none], obj.get("CustomCommand")) + definitions = from_union([Definitions.from_dict, from_none], obj.get("Definitions")) + entity_def = from_union([EntityDefinition.from_dict, from_none], obj.get("EntityDef")) + entity_instance = from_union([EntityInstance.from_dict, from_none], obj.get("EntityInstance")) + entity_reference_infos = from_union([ReferenceToAnEntityInstance.from_dict, from_none], obj.get("EntityReferenceInfos")) + enum_def = from_union([EnumDefinition.from_dict, from_none], obj.get("EnumDef")) + enum_def_values = from_union([EnumValueDefinition.from_dict, from_none], obj.get("EnumDefValues")) + enum_tag_value = from_union([EnumTagValue.from_dict, from_none], obj.get("EnumTagValue")) + field_def = from_union([FieldDefinition.from_dict, from_none], obj.get("FieldDef")) + field_instance = from_union([FieldInstance.from_dict, from_none], obj.get("FieldInstance")) + grid_point = from_union([GridPoint.from_dict, from_none], obj.get("GridPoint")) + int_grid_value_def = from_union([IntGridValueDefinition.from_dict, from_none], obj.get("IntGridValueDef")) + int_grid_value_instance = from_union([IntGridValueInstance.from_dict, from_none], obj.get("IntGridValueInstance")) + layer_def = from_union([LayerDefinition.from_dict, from_none], obj.get("LayerDef")) + layer_instance = from_union([LayerInstance.from_dict, from_none], obj.get("LayerInstance")) + level = from_union([Level.from_dict, from_none], obj.get("Level")) + level_bg_pos_infos = from_union([from_none, LevelBackgroundPosition.from_dict], obj.get("LevelBgPosInfos")) + neighbour_level = from_union([NeighbourLevel.from_dict, from_none], obj.get("NeighbourLevel")) + table_of_content_entry = from_union([LdtkTableOfContentEntry.from_dict, from_none], obj.get("TableOfContentEntry")) + tile = from_union([TileInstance.from_dict, from_none], obj.get("Tile")) + tile_custom_metadata = from_union([TileCustomMetadata.from_dict, from_none], obj.get("TileCustomMetadata")) + tileset_def = from_union([TilesetDefinition.from_dict, from_none], obj.get("TilesetDef")) + tileset_rect = from_union([from_none, TilesetRectangle.from_dict], obj.get("TilesetRect")) + world = from_union([World.from_dict, from_none], obj.get("World")) + return ForcedRefs(auto_layer_rule_group, auto_rule_def, custom_command, definitions, entity_def, entity_instance, entity_reference_infos, enum_def, enum_def_values, enum_tag_value, field_def, field_instance, grid_point, int_grid_value_def, int_grid_value_instance, layer_def, layer_instance, level, level_bg_pos_infos, neighbour_level, table_of_content_entry, tile, tile_custom_metadata, tileset_def, tileset_rect, world) + + def to_dict(self) -> dict: + result: dict = {} + if self.auto_layer_rule_group is not None: + result["AutoLayerRuleGroup"] = from_union([lambda x: to_class(AutoLayerRuleGroup, x), from_none], self.auto_layer_rule_group) + if self.auto_rule_def is not None: + result["AutoRuleDef"] = from_union([lambda x: to_class(AutoLayerRuleDefinition, x), from_none], self.auto_rule_def) + if self.custom_command is not None: + result["CustomCommand"] = from_union([lambda x: to_class(LdtkCustomCommand, x), from_none], self.custom_command) + if self.definitions is not None: + result["Definitions"] = from_union([lambda x: to_class(Definitions, x), from_none], self.definitions) + if self.entity_def is not None: + result["EntityDef"] = from_union([lambda x: to_class(EntityDefinition, x), from_none], self.entity_def) + if self.entity_instance is not None: + result["EntityInstance"] = from_union([lambda x: to_class(EntityInstance, x), from_none], self.entity_instance) + if self.entity_reference_infos is not None: + result["EntityReferenceInfos"] = from_union([lambda x: to_class(ReferenceToAnEntityInstance, x), from_none], self.entity_reference_infos) + if self.enum_def is not None: + result["EnumDef"] = from_union([lambda x: to_class(EnumDefinition, x), from_none], self.enum_def) + if self.enum_def_values is not None: + result["EnumDefValues"] = from_union([lambda x: to_class(EnumValueDefinition, x), from_none], self.enum_def_values) + if self.enum_tag_value is not None: + result["EnumTagValue"] = from_union([lambda x: to_class(EnumTagValue, x), from_none], self.enum_tag_value) + if self.field_def is not None: + result["FieldDef"] = from_union([lambda x: to_class(FieldDefinition, x), from_none], self.field_def) + if self.field_instance is not None: + result["FieldInstance"] = from_union([lambda x: to_class(FieldInstance, x), from_none], self.field_instance) + if self.grid_point is not None: + result["GridPoint"] = from_union([lambda x: to_class(GridPoint, x), from_none], self.grid_point) + if self.int_grid_value_def is not None: + result["IntGridValueDef"] = from_union([lambda x: to_class(IntGridValueDefinition, x), from_none], self.int_grid_value_def) + if self.int_grid_value_instance is not None: + result["IntGridValueInstance"] = from_union([lambda x: to_class(IntGridValueInstance, x), from_none], self.int_grid_value_instance) + if self.layer_def is not None: + result["LayerDef"] = from_union([lambda x: to_class(LayerDefinition, x), from_none], self.layer_def) + if self.layer_instance is not None: + result["LayerInstance"] = from_union([lambda x: to_class(LayerInstance, x), from_none], self.layer_instance) + if self.level is not None: + result["Level"] = from_union([lambda x: to_class(Level, x), from_none], self.level) + if self.level_bg_pos_infos is not None: + result["LevelBgPosInfos"] = from_union([from_none, lambda x: to_class(LevelBackgroundPosition, x)], self.level_bg_pos_infos) + if self.neighbour_level is not None: + result["NeighbourLevel"] = from_union([lambda x: to_class(NeighbourLevel, x), from_none], self.neighbour_level) + if self.table_of_content_entry is not None: + result["TableOfContentEntry"] = from_union([lambda x: to_class(LdtkTableOfContentEntry, x), from_none], self.table_of_content_entry) + if self.tile is not None: + result["Tile"] = from_union([lambda x: to_class(TileInstance, x), from_none], self.tile) + if self.tile_custom_metadata is not None: + result["TileCustomMetadata"] = from_union([lambda x: to_class(TileCustomMetadata, x), from_none], self.tile_custom_metadata) + if self.tileset_def is not None: + result["TilesetDef"] = from_union([lambda x: to_class(TilesetDefinition, x), from_none], self.tileset_def) + if self.tileset_rect is not None: + result["TilesetRect"] = from_union([from_none, lambda x: to_class(TilesetRectangle, x)], self.tileset_rect) + if self.world is not None: + result["World"] = from_union([lambda x: to_class(World, x), from_none], self.world) + return result + + +class IdentifierStyle(Enum): + """Naming convention for Identifiers (first-letter uppercase, full uppercase etc.) Possible + values: `Capitalize`, `Uppercase`, `Lowercase`, `Free` + """ + CAPITALIZE = "Capitalize" + FREE = "Free" + LOWERCASE = "Lowercase" + UPPERCASE = "Uppercase" + + +class ImageExportMode(Enum): + """"Image export" option when saving project. Possible values: `None`, `OneImagePerLayer`, + `OneImagePerLevel`, `LayersAndLevels` + """ + LAYERS_AND_LEVELS = "LayersAndLevels" + NONE = "None" + ONE_IMAGE_PER_LAYER = "OneImagePerLayer" + ONE_IMAGE_PER_LEVEL = "OneImagePerLevel" + + +class LdtkJSON: + """This file is a JSON schema of files created by LDtk level editor (https://ldtk.io). + + This is the root of any Project JSON file. It contains: - the project settings, - an + array of levels, - a group of definitions (that can probably be safely ignored for most + users). + """ + """This object is not actually used by LDtk. It ONLY exists to force explicit references to + all types, to make sure QuickType finds them and integrate all of them. Otherwise, + Quicktype will drop types that are not explicitely used. + """ + forced_refs: Optional[ForcedRefs] + """LDtk application build identifier.
This is only used to identify the LDtk version + that generated this particular project file, which can be useful for specific bug fixing. + Note that the build identifier is just the date of the release, so it's not unique to + each user (one single global ID per LDtk public release), and as a result, completely + anonymous. + """ + app_build_id: float + """Number of backup files to keep, if the `backupOnSave` is TRUE""" + backup_limit: int + """If TRUE, an extra copy of the project will be created in a sub folder, when saving.""" + backup_on_save: bool + """Target relative path to store backup files""" + backup_rel_path: Optional[str] + """Project background color""" + bg_color: str + """An array of command lines that can be ran manually by the user""" + custom_commands: List[LdtkCustomCommand] + """Default height for new entities""" + default_entity_height: int + """Default width for new entities""" + default_entity_width: int + """Default grid size for new layers""" + default_grid_size: int + """Default background color of levels""" + default_level_bg_color: str + """**WARNING**: this field will move to the `worlds` array after the "multi-worlds" update. + It will then be `null`. You can enable the Multi-worlds advanced project option to enable + the change immediately.

Default new level height + """ + default_level_height: Optional[int] + """**WARNING**: this field will move to the `worlds` array after the "multi-worlds" update. + It will then be `null`. You can enable the Multi-worlds advanced project option to enable + the change immediately.

Default new level width + """ + default_level_width: Optional[int] + """Default X pivot (0 to 1) for new entities""" + default_pivot_x: float + """Default Y pivot (0 to 1) for new entities""" + default_pivot_y: float + """A structure containing all the definitions of this project""" + defs: Definitions + """If the project isn't in MultiWorlds mode, this is the IID of the internal "dummy" World.""" + dummy_world_iid: str + """If TRUE, the exported PNGs will include the level background (color or image).""" + export_level_bg: bool + """**WARNING**: this deprecated value is no longer exported since version 0.9.3 Replaced + by: `imageExportMode` + """ + export_png: Optional[bool] + """If TRUE, a Tiled compatible file will also be generated along with the LDtk JSON file + (default is FALSE) + """ + export_tiled: bool + """If TRUE, one file will be saved for the project (incl. all its definitions) and one file + in a sub-folder for each level. + """ + external_levels: bool + """An array containing various advanced flags (ie. options or other states). Possible + values: `DiscardPreCsvIntGrid`, `ExportPreCsvIntGridFormat`, `IgnoreBackupSuggest`, + `PrependIndexToLevelFileNames`, `MultiWorlds`, `UseMultilinesType` + """ + flags: List[Flag] + """Naming convention for Identifiers (first-letter uppercase, full uppercase etc.) Possible + values: `Capitalize`, `Uppercase`, `Lowercase`, `Free` + """ + identifier_style: IdentifierStyle + """Unique project identifier""" + iid: str + """"Image export" option when saving project. Possible values: `None`, `OneImagePerLayer`, + `OneImagePerLevel`, `LayersAndLevels` + """ + image_export_mode: ImageExportMode + """File format version""" + json_version: str + """The default naming convention for level identifiers.""" + level_name_pattern: str + """All levels. The order of this array is only relevant in `LinearHorizontal` and + `linearVertical` world layouts (see `worldLayout` value).
Otherwise, you should + refer to the `worldX`,`worldY` coordinates of each Level. + """ + levels: List[Level] + """If TRUE, the Json is partially minified (no indentation, nor line breaks, default is + FALSE) + """ + minify_json: bool + """Next Unique integer ID available""" + next_uid: int + """File naming pattern for exported PNGs""" + png_file_pattern: Optional[str] + """If TRUE, a very simplified will be generated on saving, for quicker & easier engine + integration. + """ + simplified_export: bool + """All instances of entities that have their `exportToToc` flag enabled are listed in this + array. + """ + toc: List[LdtkTableOfContentEntry] + """This optional description is used by LDtk Samples to show up some informations and + instructions. + """ + tutorial_desc: Optional[str] + """**WARNING**: this field will move to the `worlds` array after the "multi-worlds" update. + It will then be `null`. You can enable the Multi-worlds advanced project option to enable + the change immediately.

Height of the world grid in pixels. + """ + world_grid_height: Optional[int] + """**WARNING**: this field will move to the `worlds` array after the "multi-worlds" update. + It will then be `null`. You can enable the Multi-worlds advanced project option to enable + the change immediately.

Width of the world grid in pixels. + """ + world_grid_width: Optional[int] + """**WARNING**: this field will move to the `worlds` array after the "multi-worlds" update. + It will then be `null`. You can enable the Multi-worlds advanced project option to enable + the change immediately.

An enum that describes how levels are organized in + this project (ie. linearly or in a 2D space). Possible values: <`null`>, `Free`, + `GridVania`, `LinearHorizontal`, `LinearVertical` + """ + world_layout: Optional[WorldLayout] + """This array will be empty, unless you enable the Multi-Worlds in the project advanced + settings.

- in current version, a LDtk project file can only contain a single + world with multiple levels in it. In this case, levels and world layout related settings + are stored in the root of the JSON.
- with "Multi-worlds" enabled, there will be a + `worlds` array in root, each world containing levels and layout settings. Basically, it's + pretty much only about moving the `levels` array to the `worlds` array, along with world + layout related values (eg. `worldGridWidth` etc).

If you want to start + supporting this future update easily, please refer to this documentation: + https://github.com/deepnight/ldtk/issues/231 + """ + worlds: List[World] + + def __init__(self, forced_refs: Optional[ForcedRefs], app_build_id: float, backup_limit: int, backup_on_save: bool, backup_rel_path: Optional[str], bg_color: str, custom_commands: List[LdtkCustomCommand], default_entity_height: int, default_entity_width: int, default_grid_size: int, default_level_bg_color: str, default_level_height: Optional[int], default_level_width: Optional[int], default_pivot_x: float, default_pivot_y: float, defs: Definitions, dummy_world_iid: str, export_level_bg: bool, export_png: Optional[bool], export_tiled: bool, external_levels: bool, flags: List[Flag], identifier_style: IdentifierStyle, iid: str, image_export_mode: ImageExportMode, json_version: str, level_name_pattern: str, levels: List[Level], minify_json: bool, next_uid: int, png_file_pattern: Optional[str], simplified_export: bool, toc: List[LdtkTableOfContentEntry], tutorial_desc: Optional[str], world_grid_height: Optional[int], world_grid_width: Optional[int], world_layout: Optional[WorldLayout], worlds: List[World]) -> None: + self.forced_refs = forced_refs + self.app_build_id = app_build_id + self.backup_limit = backup_limit + self.backup_on_save = backup_on_save + self.backup_rel_path = backup_rel_path + self.bg_color = bg_color + self.custom_commands = custom_commands + self.default_entity_height = default_entity_height + self.default_entity_width = default_entity_width + self.default_grid_size = default_grid_size + self.default_level_bg_color = default_level_bg_color + self.default_level_height = default_level_height + self.default_level_width = default_level_width + self.default_pivot_x = default_pivot_x + self.default_pivot_y = default_pivot_y + self.defs = defs + self.dummy_world_iid = dummy_world_iid + self.export_level_bg = export_level_bg + self.export_png = export_png + self.export_tiled = export_tiled + self.external_levels = external_levels + self.flags = flags + self.identifier_style = identifier_style + self.iid = iid + self.image_export_mode = image_export_mode + self.json_version = json_version + self.level_name_pattern = level_name_pattern + self.levels = levels + self.minify_json = minify_json + self.next_uid = next_uid + self.png_file_pattern = png_file_pattern + self.simplified_export = simplified_export + self.toc = toc + self.tutorial_desc = tutorial_desc + self.world_grid_height = world_grid_height + self.world_grid_width = world_grid_width + self.world_layout = world_layout + self.worlds = worlds + + @staticmethod + def from_dict(obj: Any) -> 'LdtkJSON': + assert isinstance(obj, dict) + forced_refs = from_union([ForcedRefs.from_dict, from_none], obj.get("__FORCED_REFS")) + app_build_id = from_float(obj.get("appBuildId")) + backup_limit = from_int(obj.get("backupLimit")) + backup_on_save = from_bool(obj.get("backupOnSave")) + backup_rel_path = from_union([from_none, from_str], obj.get("backupRelPath")) + bg_color = from_str(obj.get("bgColor")) + custom_commands = from_list(LdtkCustomCommand.from_dict, obj.get("customCommands")) + default_entity_height = from_int(obj.get("defaultEntityHeight")) + default_entity_width = from_int(obj.get("defaultEntityWidth")) + default_grid_size = from_int(obj.get("defaultGridSize")) + default_level_bg_color = from_str(obj.get("defaultLevelBgColor")) + default_level_height = from_union([from_none, from_int], obj.get("defaultLevelHeight")) + default_level_width = from_union([from_none, from_int], obj.get("defaultLevelWidth")) + default_pivot_x = from_float(obj.get("defaultPivotX")) + default_pivot_y = from_float(obj.get("defaultPivotY")) + defs = Definitions.from_dict(obj.get("defs")) + dummy_world_iid = from_str(obj.get("dummyWorldIid")) + export_level_bg = from_bool(obj.get("exportLevelBg")) + export_png = from_union([from_none, from_bool], obj.get("exportPng")) + export_tiled = from_bool(obj.get("exportTiled")) + external_levels = from_bool(obj.get("externalLevels")) + flags = from_list(Flag, obj.get("flags")) + identifier_style = IdentifierStyle(obj.get("identifierStyle")) + iid = from_str(obj.get("iid")) + image_export_mode = ImageExportMode(obj.get("imageExportMode")) + json_version = from_str(obj.get("jsonVersion")) + level_name_pattern = from_str(obj.get("levelNamePattern")) + levels = from_list(Level.from_dict, obj.get("levels")) + minify_json = from_bool(obj.get("minifyJson")) + next_uid = from_int(obj.get("nextUid")) + png_file_pattern = from_union([from_none, from_str], obj.get("pngFilePattern")) + simplified_export = from_bool(obj.get("simplifiedExport")) + toc = from_list(LdtkTableOfContentEntry.from_dict, obj.get("toc")) + tutorial_desc = from_union([from_none, from_str], obj.get("tutorialDesc")) + world_grid_height = from_union([from_none, from_int], obj.get("worldGridHeight")) + world_grid_width = from_union([from_none, from_int], obj.get("worldGridWidth")) + world_layout = from_union([from_none, WorldLayout], obj.get("worldLayout")) + worlds = from_list(World.from_dict, obj.get("worlds")) + return LdtkJSON(forced_refs, app_build_id, backup_limit, backup_on_save, backup_rel_path, bg_color, custom_commands, default_entity_height, default_entity_width, default_grid_size, default_level_bg_color, default_level_height, default_level_width, default_pivot_x, default_pivot_y, defs, dummy_world_iid, export_level_bg, export_png, export_tiled, external_levels, flags, identifier_style, iid, image_export_mode, json_version, level_name_pattern, levels, minify_json, next_uid, png_file_pattern, simplified_export, toc, tutorial_desc, world_grid_height, world_grid_width, world_layout, worlds) + + def to_dict(self) -> dict: + result: dict = {} + if self.forced_refs is not None: + result["__FORCED_REFS"] = from_union([lambda x: to_class(ForcedRefs, x), from_none], self.forced_refs) + result["appBuildId"] = to_float(self.app_build_id) + result["backupLimit"] = from_int(self.backup_limit) + result["backupOnSave"] = from_bool(self.backup_on_save) + if self.backup_rel_path is not None: + result["backupRelPath"] = from_union([from_none, from_str], self.backup_rel_path) + result["bgColor"] = from_str(self.bg_color) + result["customCommands"] = from_list(lambda x: to_class(LdtkCustomCommand, x), self.custom_commands) + result["defaultEntityHeight"] = from_int(self.default_entity_height) + result["defaultEntityWidth"] = from_int(self.default_entity_width) + result["defaultGridSize"] = from_int(self.default_grid_size) + result["defaultLevelBgColor"] = from_str(self.default_level_bg_color) + if self.default_level_height is not None: + result["defaultLevelHeight"] = from_union([from_none, from_int], self.default_level_height) + if self.default_level_width is not None: + result["defaultLevelWidth"] = from_union([from_none, from_int], self.default_level_width) + result["defaultPivotX"] = to_float(self.default_pivot_x) + result["defaultPivotY"] = to_float(self.default_pivot_y) + result["defs"] = to_class(Definitions, self.defs) + result["dummyWorldIid"] = from_str(self.dummy_world_iid) + result["exportLevelBg"] = from_bool(self.export_level_bg) + if self.export_png is not None: + result["exportPng"] = from_union([from_none, from_bool], self.export_png) + result["exportTiled"] = from_bool(self.export_tiled) + result["externalLevels"] = from_bool(self.external_levels) + result["flags"] = from_list(lambda x: to_enum(Flag, x), self.flags) + result["identifierStyle"] = to_enum(IdentifierStyle, self.identifier_style) + result["iid"] = from_str(self.iid) + result["imageExportMode"] = to_enum(ImageExportMode, self.image_export_mode) + result["jsonVersion"] = from_str(self.json_version) + result["levelNamePattern"] = from_str(self.level_name_pattern) + result["levels"] = from_list(lambda x: to_class(Level, x), self.levels) + result["minifyJson"] = from_bool(self.minify_json) + result["nextUid"] = from_int(self.next_uid) + if self.png_file_pattern is not None: + result["pngFilePattern"] = from_union([from_none, from_str], self.png_file_pattern) + result["simplifiedExport"] = from_bool(self.simplified_export) + result["toc"] = from_list(lambda x: to_class(LdtkTableOfContentEntry, x), self.toc) + if self.tutorial_desc is not None: + result["tutorialDesc"] = from_union([from_none, from_str], self.tutorial_desc) + if self.world_grid_height is not None: + result["worldGridHeight"] = from_union([from_none, from_int], self.world_grid_height) + if self.world_grid_width is not None: + result["worldGridWidth"] = from_union([from_none, from_int], self.world_grid_width) + if self.world_layout is not None: + result["worldLayout"] = from_union([from_none, lambda x: to_enum(WorldLayout, x)], self.world_layout) + result["worlds"] = from_list(lambda x: to_class(World, x), self.worlds) + return result + + +def ldtk_json_from_dict(s: Any) -> LdtkJSON: + return LdtkJSON.from_dict(s) + + +def ldtk_json_to_dict(x: LdtkJSON) -> Any: + return to_class(LdtkJSON, x) diff --git a/docs/archives/1.3.4/quicktype/LdtkJson.rs b/docs/archives/1.3.4/quicktype/LdtkJson.rs new file mode 100644 index 000000000..2b86f3325 --- /dev/null +++ b/docs/archives/1.3.4/quicktype/LdtkJson.rs @@ -0,0 +1,1618 @@ +// Example code that deserializes and serializes the model. +// extern crate serde; +// #[macro_use] +// extern crate serde_derive; +// extern crate serde_json; +// +// use generated_module::LdtkJson; +// +// fn main() { +// let json = r#"{"answer": 42}"#; +// let model: LdtkJson = serde_json::from_str(&json).unwrap(); +// } + +use serde::{Serialize, Deserialize}; +use std::collections::HashMap; + +/// This file is a JSON schema of files created by LDtk level editor (https://ldtk.io). +/// +/// This is the root of any Project JSON file. It contains: - the project settings, - an +/// array of levels, - a group of definitions (that can probably be safely ignored for most +/// users). +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct LdtkJson { + /// This object is not actually used by LDtk. It ONLY exists to force explicit references to + /// all types, to make sure QuickType finds them and integrate all of them. Otherwise, + /// Quicktype will drop types that are not explicitely used. + #[serde(rename = "__FORCED_REFS")] + pub forced_refs: Option, + + /// LDtk application build identifier.
This is only used to identify the LDtk version + /// that generated this particular project file, which can be useful for specific bug fixing. + /// Note that the build identifier is just the date of the release, so it's not unique to + /// each user (one single global ID per LDtk public release), and as a result, completely + /// anonymous. + pub app_build_id: f64, + + /// Number of backup files to keep, if the `backupOnSave` is TRUE + pub backup_limit: i64, + + /// If TRUE, an extra copy of the project will be created in a sub folder, when saving. + pub backup_on_save: bool, + + /// Target relative path to store backup files + pub backup_rel_path: Option, + + /// Project background color + pub bg_color: String, + + /// An array of command lines that can be ran manually by the user + pub custom_commands: Vec, + + /// Default height for new entities + pub default_entity_height: i64, + + /// Default width for new entities + pub default_entity_width: i64, + + /// Default grid size for new layers + pub default_grid_size: i64, + + /// Default background color of levels + pub default_level_bg_color: String, + + /// **WARNING**: this field will move to the `worlds` array after the "multi-worlds" update. + /// It will then be `null`. You can enable the Multi-worlds advanced project option to enable + /// the change immediately.

Default new level height + pub default_level_height: Option, + + /// **WARNING**: this field will move to the `worlds` array after the "multi-worlds" update. + /// It will then be `null`. You can enable the Multi-worlds advanced project option to enable + /// the change immediately.

Default new level width + pub default_level_width: Option, + + /// Default X pivot (0 to 1) for new entities + pub default_pivot_x: f64, + + /// Default Y pivot (0 to 1) for new entities + pub default_pivot_y: f64, + + /// A structure containing all the definitions of this project + pub defs: Definitions, + + /// If the project isn't in MultiWorlds mode, this is the IID of the internal "dummy" World. + pub dummy_world_iid: String, + + /// If TRUE, the exported PNGs will include the level background (color or image). + pub export_level_bg: bool, + + /// **WARNING**: this deprecated value is no longer exported since version 0.9.3 Replaced + /// by: `imageExportMode` + pub export_png: Option, + + /// If TRUE, a Tiled compatible file will also be generated along with the LDtk JSON file + /// (default is FALSE) + pub export_tiled: bool, + + /// If TRUE, one file will be saved for the project (incl. all its definitions) and one file + /// in a sub-folder for each level. + pub external_levels: bool, + + /// An array containing various advanced flags (ie. options or other states). Possible + /// values: `DiscardPreCsvIntGrid`, `ExportPreCsvIntGridFormat`, `IgnoreBackupSuggest`, + /// `PrependIndexToLevelFileNames`, `MultiWorlds`, `UseMultilinesType` + pub flags: Vec, + + /// Naming convention for Identifiers (first-letter uppercase, full uppercase etc.) Possible + /// values: `Capitalize`, `Uppercase`, `Lowercase`, `Free` + pub identifier_style: IdentifierStyle, + + /// Unique project identifier + pub iid: String, + + /// "Image export" option when saving project. Possible values: `None`, `OneImagePerLayer`, + /// `OneImagePerLevel`, `LayersAndLevels` + pub image_export_mode: ImageExportMode, + + /// File format version + pub json_version: String, + + /// The default naming convention for level identifiers. + pub level_name_pattern: String, + + /// All levels. The order of this array is only relevant in `LinearHorizontal` and + /// `linearVertical` world layouts (see `worldLayout` value).
Otherwise, you should + /// refer to the `worldX`,`worldY` coordinates of each Level. + pub levels: Vec, + + /// If TRUE, the Json is partially minified (no indentation, nor line breaks, default is + /// FALSE) + pub minify_json: bool, + + /// Next Unique integer ID available + pub next_uid: i64, + + /// File naming pattern for exported PNGs + pub png_file_pattern: Option, + + /// If TRUE, a very simplified will be generated on saving, for quicker & easier engine + /// integration. + pub simplified_export: bool, + + /// All instances of entities that have their `exportToToc` flag enabled are listed in this + /// array. + pub toc: Vec, + + /// This optional description is used by LDtk Samples to show up some informations and + /// instructions. + pub tutorial_desc: Option, + + /// **WARNING**: this field will move to the `worlds` array after the "multi-worlds" update. + /// It will then be `null`. You can enable the Multi-worlds advanced project option to enable + /// the change immediately.

Height of the world grid in pixels. + pub world_grid_height: Option, + + /// **WARNING**: this field will move to the `worlds` array after the "multi-worlds" update. + /// It will then be `null`. You can enable the Multi-worlds advanced project option to enable + /// the change immediately.

Width of the world grid in pixels. + pub world_grid_width: Option, + + /// **WARNING**: this field will move to the `worlds` array after the "multi-worlds" update. + /// It will then be `null`. You can enable the Multi-worlds advanced project option to enable + /// the change immediately.

An enum that describes how levels are organized in + /// this project (ie. linearly or in a 2D space). Possible values: <`null`>, `Free`, + /// `GridVania`, `LinearHorizontal`, `LinearVertical` + pub world_layout: Option, + + /// This array will be empty, unless you enable the Multi-Worlds in the project advanced + /// settings.

- in current version, a LDtk project file can only contain a single + /// world with multiple levels in it. In this case, levels and world layout related settings + /// are stored in the root of the JSON.
- with "Multi-worlds" enabled, there will be a + /// `worlds` array in root, each world containing levels and layout settings. Basically, it's + /// pretty much only about moving the `levels` array to the `worlds` array, along with world + /// layout related values (eg. `worldGridWidth` etc).

If you want to start + /// supporting this future update easily, please refer to this documentation: + /// https://github.com/deepnight/ldtk/issues/231 + pub worlds: Vec, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct LdtkCustomCommand { + pub command: String, + + /// Possible values: `Manual`, `AfterLoad`, `BeforeSave`, `AfterSave` + pub when: When, +} + +/// Possible values: `Manual`, `AfterLoad`, `BeforeSave`, `AfterSave` +#[derive(Debug, Clone, Serialize, Deserialize)] +pub enum When { + #[serde(rename = "AfterLoad")] + AfterLoad, + + #[serde(rename = "AfterSave")] + AfterSave, + + #[serde(rename = "BeforeSave")] + BeforeSave, + + Manual, +} + +/// If you're writing your own LDtk importer, you should probably just ignore *most* stuff in +/// the `defs` section, as it contains data that are mostly important to the editor. To keep +/// you away from the `defs` section and avoid some unnecessary JSON parsing, important data +/// from definitions is often duplicated in fields prefixed with a double underscore (eg. +/// `__identifier` or `__type`). The 2 only definition types you might need here are +/// **Tilesets** and **Enums**. +/// +/// A structure containing all the definitions of this project +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct Definitions { + /// All entities definitions, including their custom fields + pub entities: Vec, + + /// All internal enums + pub enums: Vec, + + /// Note: external enums are exactly the same as `enums`, except they have a `relPath` to + /// point to an external source file. + pub external_enums: Vec, + + /// All layer definitions + pub layers: Vec, + + /// All custom fields available to all levels. + pub level_fields: Vec, + + /// All tilesets + pub tilesets: Vec, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct EntityDefinition { + /// Base entity color + pub color: String, + + /// User defined documentation for this element to provide help/tips to level designers. + pub doc: Option, + + /// If enabled, all instances of this entity will be listed in the project "Table of content" + /// object. + pub export_to_toc: bool, + + /// Array of field definitions + pub field_defs: Vec, + + pub fill_opacity: f64, + + /// Pixel height + pub height: i64, + + pub hollow: bool, + + /// User defined unique identifier + pub identifier: String, + + /// Only applies to entities resizable on both X/Y. If TRUE, the entity instance width/height + /// will keep the same aspect ratio as the definition. + pub keep_aspect_ratio: bool, + + /// Possible values: `DiscardOldOnes`, `PreventAdding`, `MoveLastOne` + pub limit_behavior: LimitBehavior, + + /// If TRUE, the maxCount is a "per world" limit, if FALSE, it's a "per level". Possible + /// values: `PerLayer`, `PerLevel`, `PerWorld` + pub limit_scope: LimitScope, + + pub line_opacity: f64, + + /// Max instances count + pub max_count: i64, + + /// Max pixel height (only applies if the entity is resizable on Y) + pub max_height: Option, + + /// Max pixel width (only applies if the entity is resizable on X) + pub max_width: Option, + + /// Min pixel height (only applies if the entity is resizable on Y) + pub min_height: Option, + + /// Min pixel width (only applies if the entity is resizable on X) + pub min_width: Option, + + /// An array of 4 dimensions for the up/right/down/left borders (in this order) when using + /// 9-slice mode for `tileRenderMode`.
If the tileRenderMode is not NineSlice, then + /// this array is empty.
See: https://en.wikipedia.org/wiki/9-slice_scaling + pub nine_slice_borders: Vec, + + /// Pivot X coordinate (from 0 to 1.0) + pub pivot_x: f64, + + /// Pivot Y coordinate (from 0 to 1.0) + pub pivot_y: f64, + + /// Possible values: `Rectangle`, `Ellipse`, `Tile`, `Cross` + pub render_mode: RenderMode, + + /// If TRUE, the entity instances will be resizable horizontally + pub resizable_x: bool, + + /// If TRUE, the entity instances will be resizable vertically + pub resizable_y: bool, + + /// Display entity name in editor + pub show_name: bool, + + /// An array of strings that classifies this entity + pub tags: Vec, + + /// **WARNING**: this deprecated value is no longer exported since version 1.2.0 Replaced + /// by: `tileRect` + pub tile_id: Option, + + pub tile_opacity: f64, + + /// An object representing a rectangle from an existing Tileset + pub tile_rect: Option, + + /// An enum describing how the the Entity tile is rendered inside the Entity bounds. Possible + /// values: `Cover`, `FitInside`, `Repeat`, `Stretch`, `FullSizeCropped`, + /// `FullSizeUncropped`, `NineSlice` + pub tile_render_mode: TileRenderMode, + + /// Tileset ID used for optional tile display + pub tileset_id: Option, + + /// Unique Int identifier + pub uid: i64, + + /// Pixel width + pub width: i64, +} + +/// This section is mostly only intended for the LDtk editor app itself. You can safely +/// ignore it. +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct FieldDefinition { + /// Human readable value type. Possible values: `Int, Float, String, Bool, Color, + /// ExternEnum.XXX, LocalEnum.XXX, Point, FilePath`.
If the field is an array, this + /// field will look like `Array<...>` (eg. `Array`, `Array` etc.)
NOTE: if + /// you enable the advanced option **Use Multilines type**, you will have "*Multilines*" + /// instead of "*String*" when relevant. + #[serde(rename = "__type")] + pub field_definition_type: String, + + /// Optional list of accepted file extensions for FilePath value type. Includes the dot: + /// `.ext` + pub accept_file_types: Option>, + + /// Possible values: `Any`, `OnlySame`, `OnlyTags`, `OnlySpecificEntity` + pub allowed_refs: AllowedRefs, + + pub allowed_refs_entity_uid: Option, + + pub allowed_ref_tags: Vec, + + pub allow_out_of_level_ref: bool, + + /// Array max length + pub array_max_length: Option, + + /// Array min length + pub array_min_length: Option, + + pub auto_chain_ref: bool, + + /// TRUE if the value can be null. For arrays, TRUE means it can contain null values + /// (exception: array of Points can't have null values). + pub can_be_null: bool, + + /// Default value if selected value is null or invalid. + pub default_override: Option, + + /// User defined documentation for this field to provide help/tips to level designers about + /// accepted values. + pub doc: Option, + + pub editor_always_show: bool, + + pub editor_cut_long_values: bool, + + pub editor_display_color: Option, + + /// Possible values: `Hidden`, `ValueOnly`, `NameAndValue`, `EntityTile`, `LevelTile`, + /// `Points`, `PointStar`, `PointPath`, `PointPathLoop`, `RadiusPx`, `RadiusGrid`, + /// `ArrayCountWithLabel`, `ArrayCountNoLabel`, `RefLinkBetweenPivots`, + /// `RefLinkBetweenCenters` + pub editor_display_mode: EditorDisplayMode, + + /// Possible values: `Above`, `Center`, `Beneath` + pub editor_display_pos: EditorDisplayPos, + + pub editor_display_scale: f64, + + /// Possible values: `ZigZag`, `StraightArrow`, `CurvedArrow`, `ArrowsLine`, `DashedLine` + pub editor_link_style: EditorLinkStyle, + + pub editor_show_in_world: bool, + + pub editor_text_prefix: Option, + + pub editor_text_suffix: Option, + + /// User defined unique identifier + pub identifier: String, + + /// TRUE if the value is an array of multiple values + pub is_array: bool, + + /// Max limit for value, if applicable + pub max: Option, + + /// Min limit for value, if applicable + pub min: Option, + + /// Optional regular expression that needs to be matched to accept values. Expected format: + /// `/some_reg_ex/g`, with optional "i" flag. + pub regex: Option, + + pub symmetrical_ref: bool, + + /// Possible values: <`null`>, `LangPython`, `LangRuby`, `LangJS`, `LangLua`, `LangC`, + /// `LangHaxe`, `LangMarkdown`, `LangJson`, `LangXml`, `LangLog` + pub text_language_mode: Option, + + /// UID of the tileset used for a Tile + pub tileset_uid: Option, + + /// Internal enum representing the possible field types. Possible values: F_Int, F_Float, + /// F_String, F_Text, F_Bool, F_Color, F_Enum(...), F_Point, F_Path, F_EntityRef, F_Tile + #[serde(rename = "type")] + pub purple_type: String, + + /// Unique Int identifier + pub uid: i64, + + /// If TRUE, the color associated with this field will override the Entity or Level default + /// color in the editor UI. For Enum fields, this would be the color associated to their + /// values. + pub use_for_smart_color: bool, +} + +/// Possible values: `Any`, `OnlySame`, `OnlyTags`, `OnlySpecificEntity` +#[derive(Debug, Clone, Serialize, Deserialize)] +pub enum AllowedRefs { + Any, + + #[serde(rename = "OnlySame")] + OnlySame, + + #[serde(rename = "OnlySpecificEntity")] + OnlySpecificEntity, + + #[serde(rename = "OnlyTags")] + OnlyTags, +} + +/// Possible values: `Hidden`, `ValueOnly`, `NameAndValue`, `EntityTile`, `LevelTile`, +/// `Points`, `PointStar`, `PointPath`, `PointPathLoop`, `RadiusPx`, `RadiusGrid`, +/// `ArrayCountWithLabel`, `ArrayCountNoLabel`, `RefLinkBetweenPivots`, +/// `RefLinkBetweenCenters` +#[derive(Debug, Clone, Serialize, Deserialize)] +pub enum EditorDisplayMode { + #[serde(rename = "ArrayCountNoLabel")] + ArrayCountNoLabel, + + #[serde(rename = "ArrayCountWithLabel")] + ArrayCountWithLabel, + + #[serde(rename = "EntityTile")] + EntityTile, + + Hidden, + + #[serde(rename = "LevelTile")] + LevelTile, + + #[serde(rename = "NameAndValue")] + NameAndValue, + + #[serde(rename = "PointPath")] + PointPath, + + #[serde(rename = "PointPathLoop")] + PointPathLoop, + + #[serde(rename = "PointStar")] + PointStar, + + Points, + + #[serde(rename = "RadiusGrid")] + RadiusGrid, + + #[serde(rename = "RadiusPx")] + RadiusPx, + + #[serde(rename = "RefLinkBetweenCenters")] + RefLinkBetweenCenters, + + #[serde(rename = "RefLinkBetweenPivots")] + RefLinkBetweenPivots, + + #[serde(rename = "ValueOnly")] + ValueOnly, +} + +/// Possible values: `Above`, `Center`, `Beneath` +#[derive(Debug, Clone, Serialize, Deserialize)] +pub enum EditorDisplayPos { + Above, + + Beneath, + + Center, +} + +/// Possible values: `ZigZag`, `StraightArrow`, `CurvedArrow`, `ArrowsLine`, `DashedLine` +#[derive(Debug, Clone, Serialize, Deserialize)] +pub enum EditorLinkStyle { + #[serde(rename = "ArrowsLine")] + ArrowsLine, + + #[serde(rename = "CurvedArrow")] + CurvedArrow, + + #[serde(rename = "DashedLine")] + DashedLine, + + #[serde(rename = "StraightArrow")] + StraightArrow, + + #[serde(rename = "ZigZag")] + ZigZag, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub enum TextLanguageMode { + #[serde(rename = "LangC")] + LangC, + + #[serde(rename = "LangHaxe")] + LangHaxe, + + #[serde(rename = "LangJS")] + LangJs, + + #[serde(rename = "LangJson")] + LangJson, + + #[serde(rename = "LangLog")] + LangLog, + + #[serde(rename = "LangLua")] + LangLua, + + #[serde(rename = "LangMarkdown")] + LangMarkdown, + + #[serde(rename = "LangPython")] + LangPython, + + #[serde(rename = "LangRuby")] + LangRuby, + + #[serde(rename = "LangXml")] + LangXml, +} + +/// Possible values: `DiscardOldOnes`, `PreventAdding`, `MoveLastOne` +#[derive(Debug, Clone, Serialize, Deserialize)] +pub enum LimitBehavior { + #[serde(rename = "DiscardOldOnes")] + DiscardOldOnes, + + #[serde(rename = "MoveLastOne")] + MoveLastOne, + + #[serde(rename = "PreventAdding")] + PreventAdding, +} + +/// If TRUE, the maxCount is a "per world" limit, if FALSE, it's a "per level". Possible +/// values: `PerLayer`, `PerLevel`, `PerWorld` +#[derive(Debug, Clone, Serialize, Deserialize)] +pub enum LimitScope { + #[serde(rename = "PerLayer")] + PerLayer, + + #[serde(rename = "PerLevel")] + PerLevel, + + #[serde(rename = "PerWorld")] + PerWorld, +} + +/// Possible values: `Rectangle`, `Ellipse`, `Tile`, `Cross` +#[derive(Debug, Clone, Serialize, Deserialize)] +pub enum RenderMode { + Cross, + + Ellipse, + + Rectangle, + + Tile, +} + +/// This object represents a custom sub rectangle in a Tileset image. +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct TilesetRectangle { + /// Height in pixels + pub h: i64, + + /// UID of the tileset + pub tileset_uid: i64, + + /// Width in pixels + pub w: i64, + + /// X pixels coordinate of the top-left corner in the Tileset image + pub x: i64, + + /// Y pixels coordinate of the top-left corner in the Tileset image + pub y: i64, +} + +/// An enum describing how the the Entity tile is rendered inside the Entity bounds. Possible +/// values: `Cover`, `FitInside`, `Repeat`, `Stretch`, `FullSizeCropped`, +/// `FullSizeUncropped`, `NineSlice` +#[derive(Debug, Clone, Serialize, Deserialize)] +pub enum TileRenderMode { + Cover, + + #[serde(rename = "FitInside")] + FitInside, + + #[serde(rename = "FullSizeCropped")] + FullSizeCropped, + + #[serde(rename = "FullSizeUncropped")] + FullSizeUncropped, + + #[serde(rename = "NineSlice")] + NineSlice, + + Repeat, + + Stretch, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct EnumDefinition { + pub external_file_checksum: Option, + + /// Relative path to the external file providing this Enum + pub external_rel_path: Option, + + /// Tileset UID if provided + pub icon_tileset_uid: Option, + + /// User defined unique identifier + pub identifier: String, + + /// An array of user-defined tags to organize the Enums + pub tags: Vec, + + /// Unique Int identifier + pub uid: i64, + + /// All possible enum values, with their optional Tile infos. + pub values: Vec, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct EnumValueDefinition { + /// **WARNING**: this deprecated value will be *removed* completely on version 1.4.0+ + /// Replaced by: `tileRect` + #[serde(rename = "__tileSrcRect")] + pub tile_src_rect: Option>, + + /// Optional color + pub color: i64, + + /// Enum value + pub id: String, + + /// **WARNING**: this deprecated value will be *removed* completely on version 1.4.0+ + /// Replaced by: `tileRect` + pub tile_id: Option, + + /// Optional tileset rectangle to represents this value + pub tile_rect: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct LayerDefinition { + /// Type of the layer (*IntGrid, Entities, Tiles or AutoLayer*) + #[serde(rename = "__type")] + pub layer_definition_type: String, + + /// Contains all the auto-layer rule definitions. + pub auto_rule_groups: Vec, + + pub auto_source_layer_def_uid: Option, + + /// **WARNING**: this deprecated value is no longer exported since version 1.2.0 Replaced + /// by: `tilesetDefUid` + pub auto_tileset_def_uid: Option, + + /// Allow editor selections when the layer is not currently active. + pub can_select_when_inactive: bool, + + /// Opacity of the layer (0 to 1.0) + pub display_opacity: f64, + + /// User defined documentation for this element to provide help/tips to level designers. + pub doc: Option, + + /// An array of tags to forbid some Entities in this layer + pub excluded_tags: Vec, + + /// Width and height of the grid in pixels + pub grid_size: i64, + + /// Height of the optional "guide" grid in pixels + pub guide_grid_hei: i64, + + /// Width of the optional "guide" grid in pixels + pub guide_grid_wid: i64, + + pub hide_fields_when_inactive: bool, + + /// Hide the layer from the list on the side of the editor view. + pub hide_in_list: bool, + + /// User defined unique identifier + pub identifier: String, + + /// Alpha of this layer when it is not the active one. + pub inactive_opacity: f64, + + /// An array that defines extra optional info for each IntGrid value.
WARNING: the + /// array order is not related to actual IntGrid values! As user can re-order IntGrid values + /// freely, you may value "2" before value "1" in this array. + pub int_grid_values: Vec, + + /// Parallax horizontal factor (from -1 to 1, defaults to 0) which affects the scrolling + /// speed of this layer, creating a fake 3D (parallax) effect. + pub parallax_factor_x: f64, + + /// Parallax vertical factor (from -1 to 1, defaults to 0) which affects the scrolling speed + /// of this layer, creating a fake 3D (parallax) effect. + pub parallax_factor_y: f64, + + /// If true (default), a layer with a parallax factor will also be scaled up/down accordingly. + pub parallax_scaling: bool, + + /// X offset of the layer, in pixels (IMPORTANT: this should be added to the `LayerInstance` + /// optional offset) + pub px_offset_x: i64, + + /// Y offset of the layer, in pixels (IMPORTANT: this should be added to the `LayerInstance` + /// optional offset) + pub px_offset_y: i64, + + /// If TRUE, the content of this layer will be used when rendering levels in a simplified way + /// for the world view + pub render_in_world_view: bool, + + /// An array of tags to filter Entities that can be added to this layer + pub required_tags: Vec, + + /// If the tiles are smaller or larger than the layer grid, the pivot value will be used to + /// position the tile relatively its grid cell. + pub tile_pivot_x: f64, + + /// If the tiles are smaller or larger than the layer grid, the pivot value will be used to + /// position the tile relatively its grid cell. + pub tile_pivot_y: f64, + + /// Reference to the default Tileset UID being used by this layer definition.
+ /// **WARNING**: some layer *instances* might use a different tileset. So most of the time, + /// you should probably use the `__tilesetDefUid` value found in layer instances.
Note: + /// since version 1.0.0, the old `autoTilesetDefUid` was removed and merged into this value. + pub tileset_def_uid: Option, + + /// Type of the layer as Haxe Enum Possible values: `IntGrid`, `Entities`, `Tiles`, + /// `AutoLayer` + #[serde(rename = "type")] + pub purple_type: Type, + + /// User defined color for the UI + pub ui_color: Option, + + /// Unique Int identifier + pub uid: i64, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct AutoLayerRuleGroup { + pub active: bool, + + /// *This field was removed in 1.0.0 and should no longer be used.* + pub collapsed: Option, + + pub is_optional: bool, + + pub name: String, + + pub rules: Vec, + + pub uid: i64, + + pub uses_wizard: bool, +} + +/// This complex section isn't meant to be used by game devs at all, as these rules are +/// completely resolved internally by the editor before any saving. You should just ignore +/// this part. +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct AutoLayerRuleDefinition { + /// If FALSE, the rule effect isn't applied, and no tiles are generated. + pub active: bool, + + pub alpha: f64, + + /// When TRUE, the rule will prevent other rules to be applied in the same cell if it matches + /// (TRUE by default). + pub break_on_match: bool, + + /// Chances for this rule to be applied (0 to 1) + pub chance: f64, + + /// Checker mode Possible values: `None`, `Horizontal`, `Vertical` + pub checker: Checker, + + /// If TRUE, allow rule to be matched by flipping its pattern horizontally + pub flip_x: bool, + + /// If TRUE, allow rule to be matched by flipping its pattern vertically + pub flip_y: bool, + + /// Default IntGrid value when checking cells outside of level bounds + pub out_of_bounds_value: Option, + + /// Rule pattern (size x size) + pub pattern: Vec, + + /// If TRUE, enable Perlin filtering to only apply rule on specific random area + pub perlin_active: bool, + + pub perlin_octaves: f64, + + pub perlin_scale: f64, + + pub perlin_seed: f64, + + /// X pivot of a tile stamp (0-1) + pub pivot_x: f64, + + /// Y pivot of a tile stamp (0-1) + pub pivot_y: f64, + + /// Pattern width & height. Should only be 1,3,5 or 7. + pub size: i64, + + /// Array of all the tile IDs. They are used randomly or as stamps, based on `tileMode` value. + pub tile_ids: Vec, + + /// Defines how tileIds array is used Possible values: `Single`, `Stamp` + pub tile_mode: TileMode, + + /// Max random offset for X tile pos + pub tile_random_x_max: i64, + + /// Min random offset for X tile pos + pub tile_random_x_min: i64, + + /// Max random offset for Y tile pos + pub tile_random_y_max: i64, + + /// Min random offset for Y tile pos + pub tile_random_y_min: i64, + + /// Tile X offset + pub tile_x_offset: i64, + + /// Tile Y offset + pub tile_y_offset: i64, + + /// Unique Int identifier + pub uid: i64, + + /// X cell coord modulo + pub x_modulo: i64, + + /// X cell start offset + pub x_offset: i64, + + /// Y cell coord modulo + pub y_modulo: i64, + + /// Y cell start offset + pub y_offset: i64, +} + +/// Checker mode Possible values: `None`, `Horizontal`, `Vertical` +#[derive(Debug, Clone, Serialize, Deserialize)] +pub enum Checker { + Horizontal, + + None, + + Vertical, +} + +/// Defines how tileIds array is used Possible values: `Single`, `Stamp` +#[derive(Debug, Clone, Serialize, Deserialize)] +pub enum TileMode { + Single, + + Stamp, +} + +/// IntGrid value definition +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct IntGridValueDefinition { + pub color: String, + + /// User defined unique identifier + pub identifier: Option, + + pub tile: Option, + + /// The IntGrid value itself + pub value: i64, +} + +/// Type of the layer as Haxe Enum Possible values: `IntGrid`, `Entities`, `Tiles`, +/// `AutoLayer` +#[derive(Debug, Clone, Serialize, Deserialize)] +pub enum Type { + #[serde(rename = "AutoLayer")] + AutoLayer, + + Entities, + + #[serde(rename = "IntGrid")] + IntGrid, + + Tiles, +} + +/// The `Tileset` definition is the most important part among project definitions. It +/// contains some extra informations about each integrated tileset. If you only had to parse +/// one definition section, that would be the one. +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct TilesetDefinition { + /// Grid-based height + #[serde(rename = "__cHei")] + pub c_hei: i64, + + /// Grid-based width + #[serde(rename = "__cWid")] + pub c_wid: i64, + + /// The following data is used internally for various optimizations. It's always synced with + /// source image changes. + pub cached_pixel_data: Option>>, + + /// An array of custom tile metadata + pub custom_data: Vec, + + /// If this value is set, then it means that this atlas uses an internal LDtk atlas image + /// instead of a loaded one. Possible values: <`null`>, `LdtkIcons` + pub embed_atlas: Option, + + /// Tileset tags using Enum values specified by `tagsSourceEnumId`. This array contains 1 + /// element per Enum value, which contains an array of all Tile IDs that are tagged with it. + pub enum_tags: Vec, + + /// User defined unique identifier + pub identifier: String, + + /// Distance in pixels from image borders + pub padding: i64, + + /// Image height in pixels + pub px_hei: i64, + + /// Image width in pixels + pub px_wid: i64, + + /// Path to the source file, relative to the current project JSON file
It can be null + /// if no image was provided, or when using an embed atlas. + pub rel_path: Option, + + /// Array of group of tiles selections, only meant to be used in the editor + pub saved_selections: Vec>>, + + /// Space in pixels between all tiles + pub spacing: i64, + + /// An array of user-defined tags to organize the Tilesets + pub tags: Vec, + + /// Optional Enum definition UID used for this tileset meta-data + pub tags_source_enum_uid: Option, + + pub tile_grid_size: i64, + + /// Unique Intidentifier + pub uid: i64, +} + +/// In a tileset definition, user defined meta-data of a tile. +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct TileCustomMetadata { + pub data: String, + + pub tile_id: i64, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub enum EmbedAtlas { + #[serde(rename = "LdtkIcons")] + LdtkIcons, +} + +/// In a tileset definition, enum based tag infos +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct EnumTagValue { + pub enum_value_id: String, + + pub tile_ids: Vec, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub enum Flag { + #[serde(rename = "DiscardPreCsvIntGrid")] + DiscardPreCsvIntGrid, + + #[serde(rename = "ExportPreCsvIntGridFormat")] + ExportPreCsvIntGridFormat, + + #[serde(rename = "IgnoreBackupSuggest")] + IgnoreBackupSuggest, + + #[serde(rename = "MultiWorlds")] + MultiWorlds, + + #[serde(rename = "PrependIndexToLevelFileNames")] + PrependIndexToLevelFileNames, + + #[serde(rename = "UseMultilinesType")] + UseMultilinesType, +} + +/// This object is not actually used by LDtk. It ONLY exists to force explicit references to +/// all types, to make sure QuickType finds them and integrate all of them. Otherwise, +/// Quicktype will drop types that are not explicitely used. +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct ForcedRefs { + pub auto_layer_rule_group: Option, + + pub auto_rule_def: Option, + + pub custom_command: Option, + + pub definitions: Option, + + pub entity_def: Option, + + pub entity_instance: Option, + + pub entity_reference_infos: Option, + + pub enum_def: Option, + + pub enum_def_values: Option, + + pub enum_tag_value: Option, + + pub field_def: Option, + + pub field_instance: Option, + + pub grid_point: Option, + + pub int_grid_value_def: Option, + + pub int_grid_value_instance: Option, + + pub layer_def: Option, + + pub layer_instance: Option, + + pub level: Option, + + pub level_bg_pos_infos: Option, + + pub neighbour_level: Option, + + pub table_of_content_entry: Option, + + pub tile: Option, + + pub tile_custom_metadata: Option, + + pub tileset_def: Option, + + pub tileset_rect: Option, + + pub world: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct EntityInstance { + /// Grid-based coordinates (`[x,y]` format) + #[serde(rename = "__grid")] + pub grid: Vec, + + /// Entity definition identifier + #[serde(rename = "__identifier")] + pub identifier: String, + + /// Pivot coordinates (`[x,y]` format, values are from 0 to 1) of the Entity + #[serde(rename = "__pivot")] + pub pivot: Vec, + + /// The entity "smart" color, guessed from either Entity definition, or one its field + /// instances. + #[serde(rename = "__smartColor")] + pub smart_color: String, + + /// Array of tags defined in this Entity definition + #[serde(rename = "__tags")] + pub tags: Vec, + + /// Optional TilesetRect used to display this entity (it could either be the default Entity + /// tile, or some tile provided by a field value, like an Enum). + #[serde(rename = "__tile")] + pub tile: Option, + + /// X world coordinate in pixels + #[serde(rename = "__worldX")] + pub world_x: i64, + + /// Y world coordinate in pixels + #[serde(rename = "__worldY")] + pub world_y: i64, + + /// Reference of the **Entity definition** UID + pub def_uid: i64, + + /// An array of all custom fields and their values. + pub field_instances: Vec, + + /// Entity height in pixels. For non-resizable entities, it will be the same as Entity + /// definition. + pub height: i64, + + /// Unique instance identifier + pub iid: String, + + /// Pixel coordinates (`[x,y]` format) in current level coordinate space. Don't forget + /// optional layer offsets, if they exist! + pub px: Vec, + + /// Entity width in pixels. For non-resizable entities, it will be the same as Entity + /// definition. + pub width: i64, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct FieldInstance { + /// Field definition identifier + #[serde(rename = "__identifier")] + pub identifier: String, + + /// Optional TilesetRect used to display this field (this can be the field own Tile, or some + /// other Tile guessed from the value, like an Enum). + #[serde(rename = "__tile")] + pub tile: Option, + + /// Type of the field, such as `Int`, `Float`, `String`, `Enum(my_enum_name)`, `Bool`, + /// etc.
NOTE: if you enable the advanced option **Use Multilines type**, you will have + /// "*Multilines*" instead of "*String*" when relevant. + #[serde(rename = "__type")] + pub field_instance_type: String, + + /// Actual value of the field instance. The value type varies, depending on `__type`:
+ /// - For **classic types** (ie. Integer, Float, Boolean, String, Text and FilePath), you + /// just get the actual value with the expected type.
- For **Color**, the value is an + /// hexadecimal string using "#rrggbb" format.
- For **Enum**, the value is a String + /// representing the selected enum value.
- For **Point**, the value is a + /// [GridPoint](#ldtk-GridPoint) object.
- For **Tile**, the value is a + /// [TilesetRect](#ldtk-TilesetRect) object.
- For **EntityRef**, the value is an + /// [EntityReferenceInfos](#ldtk-EntityReferenceInfos) object.

If the field is an + /// array, then this `__value` will also be a JSON array. + #[serde(rename = "__value")] + pub value: Option, + + /// Reference of the **Field definition** UID + pub def_uid: i64, + + /// Editor internal raw values + pub real_editor_values: Vec>, +} + +/// This object describes the "location" of an Entity instance in the project worlds. +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct ReferenceToAnEntityInstance { + /// IID of the refered EntityInstance + pub entity_iid: String, + + /// IID of the LayerInstance containing the refered EntityInstance + pub layer_iid: String, + + /// IID of the Level containing the refered EntityInstance + pub level_iid: String, + + /// IID of the World containing the refered EntityInstance + pub world_iid: String, +} + +/// This object is just a grid-based coordinate used in Field values. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct GridPoint { + /// X grid-based coordinate + pub cx: i64, + + /// Y grid-based coordinate + pub cy: i64, +} + +/// IntGrid value instance +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct IntGridValueInstance { + /// Coordinate ID in the layer grid + pub coord_id: i64, + + /// IntGrid value + pub v: i64, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct LayerInstance { + /// Grid-based height + #[serde(rename = "__cHei")] + pub c_hei: i64, + + /// Grid-based width + #[serde(rename = "__cWid")] + pub c_wid: i64, + + /// Grid size + #[serde(rename = "__gridSize")] + pub grid_size: i64, + + /// Layer definition identifier + #[serde(rename = "__identifier")] + pub identifier: String, + + /// Layer opacity as Float [0-1] + #[serde(rename = "__opacity")] + pub opacity: f64, + + /// Total layer X pixel offset, including both instance and definition offsets. + #[serde(rename = "__pxTotalOffsetX")] + pub px_total_offset_x: i64, + + /// Total layer Y pixel offset, including both instance and definition offsets. + #[serde(rename = "__pxTotalOffsetY")] + pub px_total_offset_y: i64, + + /// The definition UID of corresponding Tileset, if any. + #[serde(rename = "__tilesetDefUid")] + pub tileset_def_uid: Option, + + /// The relative path to corresponding Tileset, if any. + #[serde(rename = "__tilesetRelPath")] + pub tileset_rel_path: Option, + + /// Layer type (possible values: IntGrid, Entities, Tiles or AutoLayer) + #[serde(rename = "__type")] + pub layer_instance_type: String, + + /// An array containing all tiles generated by Auto-layer rules. The array is already sorted + /// in display order (ie. 1st tile is beneath 2nd, which is beneath 3rd etc.).

+ /// Note: if multiple tiles are stacked in the same cell as the result of different rules, + /// all tiles behind opaque ones will be discarded. + pub auto_layer_tiles: Vec, + + pub entity_instances: Vec, + + pub grid_tiles: Vec, + + /// Unique layer instance identifier + pub iid: String, + + /// **WARNING**: this deprecated value is no longer exported since version 1.0.0 Replaced + /// by: `intGridCsv` + pub int_grid: Option>, + + /// A list of all values in the IntGrid layer, stored in CSV format (Comma Separated + /// Values).
Order is from left to right, and top to bottom (ie. first row from left to + /// right, followed by second row, etc).
`0` means "empty cell" and IntGrid values + /// start at 1.
The array size is `__cWid` x `__cHei` cells. + pub int_grid_csv: Vec, + + /// Reference the Layer definition UID + pub layer_def_uid: i64, + + /// Reference to the UID of the level containing this layer instance + pub level_id: i64, + + /// An Array containing the UIDs of optional rules that were enabled in this specific layer + /// instance. + pub optional_rules: Vec, + + /// This layer can use another tileset by overriding the tileset UID here. + pub override_tileset_uid: Option, + + /// X offset in pixels to render this layer, usually 0 (IMPORTANT: this should be added to + /// the `LayerDef` optional offset, so you should probably prefer using `__pxTotalOffsetX` + /// which contains the total offset value) + pub px_offset_x: i64, + + /// Y offset in pixels to render this layer, usually 0 (IMPORTANT: this should be added to + /// the `LayerDef` optional offset, so you should probably prefer using `__pxTotalOffsetX` + /// which contains the total offset value) + pub px_offset_y: i64, + + /// Random seed used for Auto-Layers rendering + pub seed: i64, + + /// Layer instance visibility + pub visible: bool, +} + +/// This structure represents a single tile from a given Tileset. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct TileInstance { + /// Alpha/opacity of the tile (0-1, defaults to 1) + pub a: f64, + + /// Internal data used by the editor.
For auto-layer tiles: `[ruleId, coordId]`.
+ /// For tile-layer tiles: `[coordId]`. + pub d: Vec, + + /// "Flip bits", a 2-bits integer to represent the mirror transformations of the tile.
+ /// - Bit 0 = X flip
- Bit 1 = Y flip
Examples: f=0 (no flip), f=1 (X flip + /// only), f=2 (Y flip only), f=3 (both flips) + pub f: i64, + + /// Pixel coordinates of the tile in the **layer** (`[x,y]` format). Don't forget optional + /// layer offsets, if they exist! + pub px: Vec, + + /// Pixel coordinates of the tile in the **tileset** (`[x,y]` format) + pub src: Vec, + + /// The *Tile ID* in the corresponding tileset. + pub t: i64, +} + +/// This section contains all the level data. It can be found in 2 distinct forms, depending +/// on Project current settings: - If "*Separate level files*" is **disabled** (default): +/// full level data is *embedded* inside the main Project JSON file, - If "*Separate level +/// files*" is **enabled**: level data is stored in *separate* standalone `.ldtkl` files (one +/// per level). In this case, the main Project JSON file will still contain most level data, +/// except heavy sections, like the `layerInstances` array (which will be null). The +/// `externalRelPath` string points to the `ldtkl` file. A `ldtkl` file is just a JSON file +/// containing exactly what is described below. +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct Level { + /// Background color of the level (same as `bgColor`, except the default value is + /// automatically used here if its value is `null`) + #[serde(rename = "__bgColor")] + pub bg_color: String, + + /// Position informations of the background image, if there is one. + #[serde(rename = "__bgPos")] + pub bg_pos: Option, + + /// An array listing all other levels touching this one on the world map.
Only relevant + /// for world layouts where level spatial positioning is manual (ie. GridVania, Free). For + /// Horizontal and Vertical layouts, this array is always empty. + #[serde(rename = "__neighbours")] + pub neighbours: Vec, + + /// The "guessed" color for this level in the editor, decided using either the background + /// color or an existing custom field. + #[serde(rename = "__smartColor")] + pub smart_color: String, + + /// Background color of the level. If `null`, the project `defaultLevelBgColor` should be + /// used. + #[serde(rename = "bgColor")] + pub level_bg_color: Option, + + /// Background image X pivot (0-1) + pub bg_pivot_x: f64, + + /// Background image Y pivot (0-1) + pub bg_pivot_y: f64, + + /// An enum defining the way the background image (if any) is positioned on the level. See + /// `__bgPos` for resulting position info. Possible values: <`null`>, `Unscaled`, + /// `Contain`, `Cover`, `CoverDirty`, `Repeat` + #[serde(rename = "bgPos")] + pub level_bg_pos: Option, + + /// The *optional* relative path to the level background image. + pub bg_rel_path: Option, + + /// This value is not null if the project option "*Save levels separately*" is enabled. In + /// this case, this **relative** path points to the level Json file. + pub external_rel_path: Option, + + /// An array containing this level custom field values. + pub field_instances: Vec, + + /// User defined unique identifier + pub identifier: String, + + /// Unique instance identifier + pub iid: String, + + /// An array containing all Layer instances. **IMPORTANT**: if the project option "*Save + /// levels separately*" is enabled, this field will be `null`.
This array is **sorted + /// in display order**: the 1st layer is the top-most and the last is behind. + pub layer_instances: Option>, + + /// Height of the level in pixels + pub px_hei: i64, + + /// Width of the level in pixels + pub px_wid: i64, + + /// Unique Int identifier + pub uid: i64, + + /// If TRUE, the level identifier will always automatically use the naming pattern as defined + /// in `Project.levelNamePattern`. Becomes FALSE if the identifier is manually modified by + /// user. + pub use_auto_identifier: bool, + + /// Index that represents the "depth" of the level in the world. Default is 0, greater means + /// "above", lower means "below".
This value is mostly used for display only and is + /// intended to make stacking of levels easier to manage. + pub world_depth: i64, + + /// World X coordinate in pixels.
Only relevant for world layouts where level spatial + /// positioning is manual (ie. GridVania, Free). For Horizontal and Vertical layouts, the + /// value is always -1 here. + pub world_x: i64, + + /// World Y coordinate in pixels.
Only relevant for world layouts where level spatial + /// positioning is manual (ie. GridVania, Free). For Horizontal and Vertical layouts, the + /// value is always -1 here. + pub world_y: i64, +} + +/// Level background image position info +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct LevelBackgroundPosition { + /// An array of 4 float values describing the cropped sub-rectangle of the displayed + /// background image. This cropping happens when original is larger than the level bounds. + /// Array format: `[ cropX, cropY, cropWidth, cropHeight ]` + pub crop_rect: Vec, + + /// An array containing the `[scaleX,scaleY]` values of the **cropped** background image, + /// depending on `bgPos` option. + pub scale: Vec, + + /// An array containing the `[x,y]` pixel coordinates of the top-left corner of the + /// **cropped** background image, depending on `bgPos` option. + pub top_left_px: Vec, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub enum BgPos { + Contain, + + Cover, + + #[serde(rename = "CoverDirty")] + CoverDirty, + + Repeat, + + Unscaled, +} + +/// Nearby level info +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct NeighbourLevel { + /// A single lowercase character tipping on the level location (`n`orth, `s`outh, `w`est, + /// `e`ast). + pub dir: String, + + /// Neighbour Instance Identifier + pub level_iid: String, + + /// **WARNING**: this deprecated value is no longer exported since version 1.2.0 Replaced + /// by: `levelIid` + pub level_uid: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct LdtkTableOfContentEntry { + pub identifier: String, + + pub instances: Vec, +} + +/// **IMPORTANT**: this type is available as a preview. You can rely on it to update your +/// importers, for when it will be officially available. A World contains multiple levels, +/// and it has its own layout settings. +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct World { + /// Default new level height + pub default_level_height: i64, + + /// Default new level width + pub default_level_width: i64, + + /// User defined unique identifier + pub identifier: String, + + /// Unique instance identifer + pub iid: String, + + /// All levels from this world. The order of this array is only relevant in + /// `LinearHorizontal` and `linearVertical` world layouts (see `worldLayout` value). + /// Otherwise, you should refer to the `worldX`,`worldY` coordinates of each Level. + pub levels: Vec, + + /// Height of the world grid in pixels. + pub world_grid_height: i64, + + /// Width of the world grid in pixels. + pub world_grid_width: i64, + + /// An enum that describes how levels are organized in this project (ie. linearly or in a 2D + /// space). Possible values: `Free`, `GridVania`, `LinearHorizontal`, `LinearVertical`, `null` + pub world_layout: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub enum WorldLayout { + Free, + + #[serde(rename = "GridVania")] + GridVania, + + #[serde(rename = "LinearHorizontal")] + LinearHorizontal, + + #[serde(rename = "LinearVertical")] + LinearVertical, +} + +/// Naming convention for Identifiers (first-letter uppercase, full uppercase etc.) Possible +/// values: `Capitalize`, `Uppercase`, `Lowercase`, `Free` +#[derive(Debug, Clone, Serialize, Deserialize)] +pub enum IdentifierStyle { + Capitalize, + + Free, + + Lowercase, + + Uppercase, +} + +/// "Image export" option when saving project. Possible values: `None`, `OneImagePerLayer`, +/// `OneImagePerLevel`, `LayersAndLevels` +#[derive(Debug, Clone, Serialize, Deserialize)] +pub enum ImageExportMode { + #[serde(rename = "LayersAndLevels")] + LayersAndLevels, + + None, + + #[serde(rename = "OneImagePerLayer")] + OneImagePerLayer, + + #[serde(rename = "OneImagePerLevel")] + OneImagePerLevel, +} diff --git a/docs/archives/1.3.4/version.txt b/docs/archives/1.3.4/version.txt new file mode 100644 index 000000000..8c9698aaf --- /dev/null +++ b/docs/archives/1.3.4/version.txt @@ -0,0 +1 @@ +1.3.4 \ No newline at end of file