guansss / pixi-live2d-display

A PixiJS plugin to display Live2D models of any kind.
https://guansss.github.io/pixi-live2d-display/
MIT License
870 stars 132 forks source link

File upload error TypeError #17

Closed yeemachine closed 3 years ago

yeemachine commented 3 years ago

I've been using both beta.1 and beta.2 version atm and it seems you've removed support for DataUrls for uploading models?

File upload error TypeError: The `url` property must be specified in settings JSON

I was getting the browser crashing error when upload a mix of Cubism 2.0 and Cubism 4.0 models until I updated to the beta.2. But now, when uploading an object into Live2DModel.from() with dataurls instead of file paths, the plugin no longer accepts them. Is there a workaround for this?

guansss commented 3 years ago

Yes, previously the url will default to an empty string if it's not defined in the JSON, until I realized that not setting a URL for the JSON would typically result in errors, even if it gets a default value.

You can still workaround it by assigning an empty string when you've taken good care of all the URLs in the JSON.

json.url = '';

Live2DModel.from(json);
yeemachine commented 3 years ago

Thank for the quick response. That seems to do the trick!