WohlSoft / Moondust-Project

Moondust Project by Wohlstand

Home Page:https://wohlsoft.ru/projects/Moondust/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Editor] Custom data -> Import is unsuitable for importing custom data

Emral opened this issue · comments

commented

Which component?

  • Editor (Custom data importer)
  • Make this copyable if you want people to submit version numbers easily btw
    image

Describe the bug
Using Custom data -> Import, the user can select a folder and from that folder, custom assets relevant to SMBX will be imported.
The files it finds, however, appear to be limited to SMBX 1.3 files, making it wholly unsuited for importing custom data for, for example, SMBX2.
Since the solution is quite involved, I wonder if for now the best move would be to just not have this menu show up in SMBX2 at all, and fix it properly later.

Steps involved for a proper fix:

  • Files like npc/block-n.lua, background2-n.txt and any files they rely on (NPC AI files, MAYBE extra settings jsons?) are currently not caught by the algorithm that copies files. Simply adding *.lua etc to the seek pattern will not suffice, because a lua file might reference an arbitrary image in the seeking directory or a child or sibling of it. A proper solution thus requires some degree of parsing the lua to make sense of any calls to Graphics.loadImage/loadImageResolved, even those that are invoked with variables. Supporting background2-n.txt is easier because its img argument has no variables.
  • Even once this is fixed, another issue prevents the tool from exceeding manual copy in use: The fact that for custom assets, you might have to rename the files. The tool presently has no duplication handling. For instance, if you want to import a npc-751.ini/lua/png combo but the target folder already contains these items. The tool should find the first empty ID in the custom range (for NPCs this is 751-1000. For future object types it might differ) and automatically rename the newly incoming files. It also needs to replace the "img" and "icon" args in the INI because for some reason the img arg for INIs must always be set and it and the icon arg cannot be set relative to the file name. So be it "npc-751.png", "npc-751e.png", "npc-751-icon.png", "npc-751i.png" or anything else with the old image's ID in it, it needs to substitute it for the new ID to ensure everything runs smoothly.

To Reproduce
Steps to reproduce the behavior:

  1. Use the Import option in the custom data menu on a folder that contains any npc-n lua files
  2. Behold

Desktop specs (please complete the following information):

  • Windows 11

This feature needs to be updated in general, yeah. It was being implemented a while ago and hadn't any significant changes except a bugfix when import hadn't worked at all.

Just now, I resolved two things:

  • Added an ability to select text in the About dialogue, and the [Copy thid description] link that copies the meta-data into clipboard and turns into [Copied!]
  • Partially resolved the explained problem. The proper solution requires the remaking of the Importer with adding of more deeper parser and the options dialogue to let user to choose what they want to import among the detected stuff. That will be a part of a new task, not related to this.