Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[0.8.0] New IntGrid CSV format in Json #358

Closed
deepnight opened this issue Jan 28, 2021 · 2 comments
Closed

[0.8.0] New IntGrid CSV format in Json #358

deepnight opened this issue Jan 28, 2021 · 2 comments
Assignees
Labels
for API devs This tag will indicate issues that contain important info for devs who work on LDtk importers. Json
Milestone

Comments

@deepnight
Copy link
Owner

deepnight commented Jan 28, 2021

TLDR;

Starting with 0.8 update, IntGrid layer data in Json will use a much more simple CSV format, in a new field called intGridCsv.

The previous field (intGrid) will be dropped on version 0.10.0 and later.

Breaking JSON change in 0.8.0

New JSON field

The following array was added In levels > layerInstances:

"intGridCsv": [
  0,0,0,1,1,2,0,0,0, // ...
],

What are the differences?

  • intGridCsv is an array of all values in the IntGrid layer, stored from left to right, and top to bottom.
  • intGrid values are now 1-based instead of 0-based! So in this field, 0 means "empty cell" and IntGrid values are 1+.
  • The array size is always __cWid*__cHei.

Previous format:

"intGrid": [
  { coordId:4, value: -1 }, // note: previously, -1 meant "empty cell"!
  { coordId:5, value: -1 },
  { coordId:7, value: 2 },
  { coordId:9, value: 2 },
  // ...
];

Backward compatibility

The old intGrid JSON field can still be exported for back-compatibility purpose since LDtk hits version 0.10.0. This old field works entirely as before (-1 is empty, 0+ are values).

To enable this legacy export, open Project panel (F1), reveal Advanced Options at the bottom and enable this advanced option:

image

@deepnight deepnight added the Json label Jan 28, 2021
@deepnight deepnight added this to the 0.8.0 milestone Jan 28, 2021
@deepnight deepnight self-assigned this Jan 28, 2021
deepnight added a commit that referenced this issue Jan 28, 2021
@deepnight deepnight changed the title IntGrid export format now using CSV New IntGrid CSV format in Json Jan 28, 2021
@deepnight deepnight modified the milestones: 0.9.0, 0.8.0 Feb 3, 2021
@deepnight deepnight modified the milestones: 0.8.0, 0.9.0 Mar 1, 2021
@deepnight deepnight added the for API devs This tag will indicate issues that contain important info for devs who work on LDtk importers. label Jan 4, 2022
@deepnight deepnight changed the title New IntGrid CSV format in Json [0.8.0] New IntGrid CSV format in Json Jan 4, 2022
deepnight added a commit that referenced this issue Jan 7, 2022
Added ExportPreCsvIntGridFormat flag
@deepnight
Copy link
Owner Author

Old pre-CSV will be dropped by default starting from 0.10.0.
An advanced option was added to export legacy value.

deepnight added a commit that referenced this issue Jan 7, 2022
@deepnight
Copy link
Owner Author

Moved to wiki: https://github.com/deepnight/ldtk/wiki

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for API devs This tag will indicate issues that contain important info for devs who work on LDtk importers. Json
Projects
None yet
Development

No branches or pull requests

1 participant