VTTAssets / vtta-tokenizer

Tiny yet capable in-game token editor, requires trusted user level for uploads
MIT License
7 stars 8 forks source link

In 0.7.3, Tokenizer causes Save Changes button in Settings to be impossible to save #22

Open apoapostolov opened 3 years ago

apoapostolov commented 3 years ago

Confirmed with Find the Culprit. The Settings menu is impossible to close and impossible to save the settings.

ScyllPoesis commented 3 years ago

Can confirm. I'll add the error I saw. Seems like the loading of the default frames in the settings got borked.

foundry.js:14753 Uncaught (in promise) TypeError: Failed to construct 'Image': Please use the 'new' operator, this DOM object constructor cannot be called as a function.
    at FormData.toObject (foundry.js:14753)
    at ExtendedSettingsConfig._getSubmitData (foundry.js:5198)
    at ExtendedSettingsConfig._onSubmit (foundry.js:5172)
toObject @ foundry.js:14753
_getSubmitData @ foundry.js:5198
_onSubmit @ foundry.js:5172
BradKriss commented 3 years ago

So I've been digging into this for the last hour or so and I think I know what the issue is.

The settings fields for both "default npc frame" and "default pc frame" have a setting data type of "Image" as indicated by the console error foundry doesn't like that. I looked into how foundry parses the settings and it looks like it has a series of different cases that it is setup to handle based on the settings data type. I see how it would handle and "Img" but there is not definition of how to handle an "Image".

As far as a fix for it, it looks FilePickerImage defined in settings-extender.js or settings-extender-patched.js handles setting the data type. I'm unclear the difference between settings-extender and it's 'patched' version and not sure if "Img" is a backwards compatible data type.

I can try to look into it a little more and see if I can figure out a fix but any further insight would be super helpful.

dreamforge2361 commented 3 years ago

This is still ocurring with both tokenizer and iconizer...

ceraetes commented 3 years ago

Based on the comment from @BradKriss I tested changing the ImagePicker.Image to ImagePicker.Img and it fixed the issue for me. Created a pull request for it: https://github.com/VTTAssets/vtta-tokenizer/pull/26

The iconizer shouldn't be impacted as it doesn't define images in its settings.

benjaminboruff commented 3 years ago

I just tested this on 0.7.5 and it works!

sgrigson commented 3 years ago

Any chance we can get this merged? The fix seems simple enough, and I'd prefer not to do a custom mod install if I don't have to.

vprenner commented 3 years ago

For what it's worth I took what ceraetes did and made edits to the module.json to make it directly installable from Github. You can use this link: https://raw.githubusercontent.com/vprenner/vtta-tokenizer/master/module.json I also bumped the version to 2.2.2, and set the compatibility flag to 0.7.5. Since the original author has a two month old kid I doubt he'll be merging this anytime soon :) When he does I will delete my fork and everything since I don't want to cause any issues. Also - use at your own risk and be aware that you are installing a zip file that some random guy from the internet uploaded...

ceraetes commented 3 years ago

@MrPrimate one of the contributor on the vtta discord also created a package already: https://github.com/MrPrimate/vtta-tokenizer/releases/download/latest/module.json

manueleiria commented 3 years ago

Version 0.7.6 introduces further issues with Tokenizer. @vprenner have you had a chance to try tokenizer in this version?