So I already know how to save a PIXI.Sprite to the local file directory, I use the following function
But this causes the file explorer to open.
The only current reason I have for needing this is because I've create a custom sprite maker, that lets you change clothes/hair, etc.
In the end, I have a single sprite. and I save that to the characters folder of img, in the proejct directory.
Then, I set that as the character name for the event or player. That all works fine.
I save it so I don't have to build the sprite every time, only when you need to change stuff. It's a LOT less work and loading.
But since some sprites can be created/altered in my project during execution, and this will be done by the user, I really don't want this file dialogue box to pop up.
(Obv I understand why the dialogue pops up, and the security reasons that also go behind letting the user know when a file is about to saved on their system, even in a program's directory at the program's request. I get it.)
Any ideas?
JavaScript:
sp_Tools.download_sprite_as_png = function(sprite, fileName) {
let renderer = Graphics._renderer;
renderer.extract.canvas(sprite).toBlob(function(b){
var a = document.createElement('a');
document.body.append(a);
a.download = fileName;
a.href = URL.createObjectURL(b);
a.click();
a.remove();
}, 'image/png');
}
The only current reason I have for needing this is because I've create a custom sprite maker, that lets you change clothes/hair, etc.
In the end, I have a single sprite. and I save that to the characters folder of img, in the proejct directory.
Then, I set that as the character name for the event or player. That all works fine.
I save it so I don't have to build the sprite every time, only when you need to change stuff. It's a LOT less work and loading.
But since some sprites can be created/altered in my project during execution, and this will be done by the user, I really don't want this file dialogue box to pop up.
(Obv I understand why the dialogue pops up, and the security reasons that also go behind letting the user know when a file is about to saved on their system, even in a program's directory at the program's request. I get it.)
Any ideas?