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

Enum Importation from files is broken #1122

Open
weierstrass1 opened this issue Jun 24, 2024 · 1 comment
Open

Enum Importation from files is broken #1122

weierstrass1 opened this issue Jun 24, 2024 · 1 comment

Comments

@weierstrass1
Copy link

weierstrass1 commented Jun 24, 2024

I tried differents enum files but neither of them worked:

File1, a json:

{
    "TileMaskType": "Solid"
}

File2, a json with other format:

{
    "TileMaskType": [
        "Solid"
    ]
}

File 3 a txt:

Enum0: T1,T2

Any of this says "Unsupported External Enum", also they have a lot of issues when you try to import, for example some of them do 2 copies of the file, or doesn't return any enum value.

another file that i tried was this didn't work:

{
    "TileMaskType": [
        "Solid",
        "T16x16_XS_Slope_R_1",
        "T16x16_XS_Slope_R_2",
        "T16x16_XS_Slope_R_3",
        "T16x16_XS_Slope_R_4",
        "T16x16_XS_Slope_L_1",
        "T16x16_XS_Slope_L_2",
        "T16x16_XS_Slope_L_3",
        "T16x16_XS_Slope_L_4",
        "T16x16_XS_Slope_UDR_1",
        "T16x16_XS_Slope_UDR_2",
        "T16x16_XS_Slope_UDR_3",
        "T16x16_XS_Slope_UDR_4",
        "T16x16_XS_Slope_UDL_1",
        "T16x16_XS_Slope_UDL_2",
        "T16x16_XS_Slope_UDL_3",
        "T16x16_XS_Slope_UDL_4",
        "T16x16_S_Slope_R_1",
        "T16x16_S_Slope_R_2",
        "T16x16_S_Slope_R_3",
        "T16x16_S_Slope_L_1",
        "T16x16_S_Slope_L_2",
        "T16x16_S_Slope_L_3",
        "T16x16_S_Slope_UDR_1",
        "T16x16_S_Slope_UDR_2",
        "T16x16_S_Slope_UDR_3",
        "T16x16_S_Slope_UDL_1",
        "T16x16_S_Slope_UDL_2",
        "T16x16_S_Slope_UDL_3",
        "T16x16_M_Slope_R_1",
        "T16x16_M_Slope_R_2",
        "T16x16_M_Slope_L_1",
        "T16x16_M_Slope_L_2",
        "T16x16_M_Slope_UDR_1",
        "T16x16_M_Slope_UDR_2",
        "T16x16_M_Slope_UDL_1",
        "T16x16_M_Slope_UDL_2",
        "T16x16_L_Slope_R_1",
        "T16x16_L_Slope_L_1",
        "T16x16_L_Slope_UDR_1",
        "T16x16_L_Slope_UDL_1",
        "T16x16_XL_Slope_R_1",
        "T16x16_XL_Slope_R_2",
        "T16x16_XL_Slope_L_1",
        "T16x16_XL_Slope_L_2",
        "T16x16_XL_Slope_UDR_1",
        "T16x16_XL_Slope_UDR_2",
        "T16x16_XL_Slope_UDL_1",
        "T16x16_XL_Slope_UDL_2",
        "T16x16_XXL_Slope_R_1",
        "T16x16_XXL_Slope_R_2",
        "T16x16_XXL_Slope_R_3",
        "T16x16_XXL_Slope_L_1",
        "T16x16_XXL_Slope_L_2",
        "T16x16_XXL_Slope_L_3",
        "T16x16_XXL_Slope_UDR_1",
        "T16x16_XXL_Slope_UDR_2",
        "T16x16_XXL_Slope_UDR_3",
        "T16x16_XXL_Slope_UDL_1",
        "T16x16_XXL_Slope_UDL_2",
        "T16x16_XXL_Slope_UDL_3",
        "T16x16_XXXL_Slope_R_1",
        "T16x16_XXXL_Slope_R_2",
        "T16x16_XXXL_Slope_R_3",
        "T16x16_XXXL_Slope_R_4",
        "T16x16_XXXL_Slope_L_1",
        "T16x16_XXXL_Slope_L_2",
        "T16x16_XXXL_Slope_L_3",
        "T16x16_XXXL_Slope_L_4",
        "T16x16_XXXL_Slope_UDR_1",
        "T16x16_XXXL_Slope_UDR_2",
        "T16x16_XXXL_Slope_UDR_3",
        "T16x16_XXXL_Slope_UDR_4",
        "T16x16_XXXL_Slope_UDL_1",
        "T16x16_XXXL_Slope_UDL_2",
        "T16x16_XXXL_Slope_UDL_3",
        "T16x16_XXXL_Slope_UDL_4"
    ]
}
@tannerntannern
Copy link

I'm also having issues on v1.5.3 with importing enums. Jotting down some issues I encountered here in case they are helpful for troubleshooting.

Neither JSON nor text are working quite right. In both cases when I import the enum for the first time, I'm unable to see the enum until I close the enums list and reopen it. When I do, the UI says the enum needs to be synced, which results in two enums with the same name (as @weierstrass1 already noted).

When I tried to edit my enum text file then went back to the editor to reload it, the editor crashed with the splash screen saying to file a GitHub issue. In my case the enum text file was

MyEnum: Foo, Bar
MyEnum2: Foo2, Bar2
Here are the details logs copied from the crash screen

Stack:

LDtk version: 1.5.3-64bits
Cannot read properties of undefined (reading 'getValueIndex')
TypeError
TypeError: Cannot read properties of undefined (reading 'getValueIndex')
    at importer_enu_TextFileEnum.preserveEnumValuesOrder (file:///C:/Users/Tanner/AppData/Local/Programs/ldtk/resources/app.asar/assets/js/renderer.js:224177:22)
    at importer_enu_TextFileEnum.importToProject (file:///C:/Users/Tanner/AppData/Local/Programs/ldtk/resources/app.asar/assets/js/renderer.js:224076:10)
    at importer_enu_TextFileEnum.load (file:///C:/Users/Tanner/AppData/Local/Programs/ldtk/resources/app.asar/assets/js/renderer.js:223636:9)
    at importer_ExternalEnum.sync (file:///C:/Users/Tanner/AppData/Local/Programs/ldtk/resources/app.asar/assets/js/renderer.js:223406:6)
    at HTMLAnchorElement.<anonymous> (file:///C:/Users/Tanner/AppData/Local/Programs/ldtk/resources/app.asar/assets/js/renderer.js:304498:28)
    at HTMLAnchorElement.dispatch (C:\Users\Tanner\AppData\Local\Programs\ldtk\resources\app.asar\assets\js\jquery.min.js:2:43064)
    at v.handle (C:\Users\Tanner\AppData\Local\Programs\ldtk\resources\app.asar\assets\js\jquery.min.js:2:41048)

Processes:

#0 App
 |--- #3 page.Editor
       |--- #4 misc.FileWatcher
       |--- #5 display.WorldRender
       |--- #6 display.LevelRender
       |--- #7 display.Camera
       |--- #8 display.Rulers[--]
       |--- #9 tool.SelectionTool[--]
       |--- #10 tool.lt.DoNothing[--]
       |--- #11 WorldTool
       |--- #12 tool.PanView[--]
       |--- #13 tool.lt.IntGridTool[--]
       |--- #27 ui.modal.panel.EditEnumDefs
       |--- #33 ui.Tip

Log:



[BOOT]         App started
[BOOT]         Version: 1.5.3-64bits (build 473703)
[BOOT]         ExePath: C:/Users/Tanner/AppData/Local/Programs/ldtk
[BOOT]         Assets: C:/Users/Tanner/AppData/Local/Programs/ldtk/resources/app.asar/assets
[BOOT]         ExtraFiles: C:/Users/Tanner/AppData/Local/Programs/ldtk/extraFiles
[BOOT]         CWD: C:\Users\Tanner\AppData\Local\Programs\ldtk\
[BOOT]         Display: 1290x860
[BOOT]         Args: soloValues=[], args=[]
[FILE]         Loading settings from C:/Users/Tanner/AppData/Roaming/LDtk/settings...
[BOOT]         AppZoomFactor: 1
[BOOT]         Calling appReady...
[UPDATE]       Looking for update
[BOOT]         Start args: path=null levelIndex=null
[BOOT]         Loading Home...
[GENERAL]      Page started: page.Home()
[FILE]         Loading page template: home from C:/Users/Tanner/AppData/Local/Programs/ldtk/resources/app.asar/assets/tpl/pages/home.html
[DEBUG]        samplesDir=C:/Users/Tanner/AppData/Local/Programs/ldtk/extraFiles/samples
[GENERAL]      Progress created.
[GENERAL]      Progress started: : "levels.ldtk: Project...", 5 operation(s)
[LOAD]         Loading project levels.ldtk...
[LOAD]           Project appBuildId=473703 appJsonVersion=1.5.3 jsonVersion=1.5.3
[LOAD]         Loading complete.
[GENERAL]      Page started: page.Editor()
[FILE]         Loading page template: editor from C:/Users/Tanner/AppData/Local/Programs/ldtk/resources/app.asar/assets/tpl/pages/editor.html
[FILE]         Cleared all file watches
[EVENT]        LayerInstanceSelected 1
[FILE]         Reloading tileset: Placeholder_tiles path=placeholder_tiles.png
[FILE]         Loading atlas image: placeholder_tiles.png...
[CACHE]        Caching image placeholder_tiles.png...
[CACHE]         -> identified as Png
[CACHE]         -> base64 1652
[CACHE]         -> pixels 64x72
[FILE]          -> Loaded 1238 bytes.
[FILE]          -> Decoded 64x72 pixels.
[FILE]          -> Old size: 64x72 -> 64x72
[WARNING]      Tileset Placeholder_tiles remapping (image size changed)...
[FILE]          -> Reload result: Ok
[FILE]          -> pixelData: Ok
[EVENT]        TilesetImageLoaded
[EVENT]        ProjectSelected
[WARNING]      Full level render requested
[RENDER]       Rendering all world...
[RENDER]       Rendering world bg...
[RENDER]       Rendering world bounds...
[FILE]         Watching file: <REDACTED>/placeholder_tiles.png
[RENDER]       Rendering world level data.Level#e3add4c0-25d0-11ef-be3a-2bc6b791be28 "Level_0"...

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

No branches or pull requests

2 participants