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

Empty Level.Layers when opening a 1.5.3 LDtk project #8

Open
quasilyte opened this issue Feb 10, 2024 · 1 comment
Open

Empty Level.Layers when opening a 1.5.3 LDtk project #8

quasilyte opened this issue Feb 10, 2024 · 1 comment

Comments

@quasilyte
Copy link
Contributor

I might be doing something wrong, but when I open a project, a level's layer list is empty.

I'm using LDtk version 1.5.3.

This is how I use ldtkgo:

p, err := ldtkgo.Open(*projectFilename)
	if err != nil {
		panic(err)
	}

	for _, level := range p.Levels {
		for _, layer := range level.Layers {
			// Never executed because Layers is [].
		}
	}
}

I can confirm that Level fields like Identifier are loaded correctly.

The Level has layers:

	"layerInstances": [
		{
			"__identifier": "BottomTiles",
			"__type": "Tiles",
			"__cWid": 32,
			"__cHei": 20,
			"__gridSize": 16,
			"__opacity": 1,
			"__pxTotalOffsetX": 0,
...

I'm not sure why they're not unmarshalled into the ldtkgo.Level.Layers.

Here is an LDtk project (it's just 1 level and a project file):

test.zip

@quasilyte
Copy link
Contributor Author

quasilyte commented Feb 10, 2024

Hmm, I may have a clue. :D
I'm using level files stored /outside/ of the project manifest.
As far as I see, this library expects to find all level data inside the project file.

"externalLevels": true,

quasilyte added a commit to quasilyte/ldtkgo that referenced this issue Feb 10, 2024
This feature will only work with `Open()`, since that
function can easily figure out the file location
(it gets it as an argument).

I don't know how to make `Read()` work without there
breaking its API.

Fixes SolarLune#8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant