Skip to content

Codegen fails for layers created with a default name in editor #37

@jacobalbano

Description

@jacobalbano

When you create a new layer in LDtk, the default name will be the same as its type name:
image

However, when you try to load this project with the macro, it fails with the internal compile error "Recursive class", because the generated name (using the prefix of "Level_") yields the exact same name as the internal base class Level_Entities.

I have attached a minimal LDtk project file (renamed to .json so Github would let me upload it) that illustrates the problem.
repro.json

Embed it as per the official documentation:

package ldtk;
private typedef _Tmp = haxe.macro.MacroType<[ ldtk.Project.build("repro.json") ]>;

Here is a text log of the generated type definitions, where you can see that the Entities class is being generated with the name Layer_Entities and that its parent class is also Layer_Entities.

repro_output.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions