Integrate export codec selector into closing save flow

Fix issue with uninstalling plugins
Add preview.texture_frame variable
Fix textures getting stuck in non-existant frame after removing animation frames
This commit is contained in:
JannisX11 2023-03-27 22:54:07 +02:00
parent 0e4272bee3
commit eb09fcb4a5
4 changed files with 15 additions and 4 deletions

View File

@ -1197,6 +1197,14 @@ const Animator = {
let texture = Texture.all[tex_index % Texture.all.length];
if (texture) texture.select();
}
if (Interface.Panels.variable_placeholders.inside_vue.text.match(/^\s*preview\.texture_frame\s*=/mi)) {
let frame = Animator.MolangParser.variableHandler('preview.texture_frame');
Texture.all.forEach(tex => {
tex.currentFrame = (frame % tex.frameCount) || 0;
})
TextureAnimator.update(Texture.all.filter(tex => tex.frameCount > 1));
}
if (Project) Project.model_3d.scale.set(1, 1, 1);
if (Interface.Panels.variable_placeholders.inside_vue.text.match(/^\s*preview\.scale\s*=/mi)) {
let scale = Animator.MolangParser.variableHandler('preview.scale');

View File

@ -342,7 +342,11 @@ class ModelProject {
noLink: true
})
if (answer === 0) {
BarItems.save_project.trigger();
if (Project.save_path || Project.export_path) {
BarItems.save_project.trigger();
} else {
await BarItems.export_over.click();
}
return Project.saved;
}
return answer !== 2;

View File

@ -31,7 +31,7 @@ const Plugins = {
}
}
StateMemory.init('installed_plugins', 'array')
Plugins.installed = StateMemory.installed_plugins.filter(p => typeof p == 'object');
Plugins.installed = StateMemory.installed_plugins = StateMemory.installed_plugins.filter(p => p && typeof p == 'object');
class Plugin {
constructor(id, data) {
@ -436,8 +436,6 @@ async function loadInstalledPlugins() {
}
const install_promises = [];
Plugins.installed.replace(Plugins.installed.filter(p => p !== null))
if (Plugins.json instanceof Object && navigator.onLine) {
//From Store
for (var id in Plugins.json) {

View File

@ -192,6 +192,7 @@ class Texture {
let dimensions_changed = scope.width !== img.naturalWidth || scope.height !== img.naturalHeight;
scope.width = img.naturalWidth;
scope.height = img.naturalHeight;
scope.currentFrame = Math.min(scope.currentFrame, (scope.frameCount||1)-1)
if (scope.isDefault) {
console.log('Successfully loaded '+scope.name+' from default pack')