Files
armorpaint/Assets/plugins/autosave.js
T

22 lines
395 B
JavaScript
Raw Normal View History

2019-10-09 23:46:08 +02:00
2019-10-10 14:27:17 +02:00
let plugin = new arm.Plugin();
2019-10-09 23:46:08 +02:00
2019-10-10 14:27:17 +02:00
let h1 = new zui.Handle();
2019-10-14 10:57:12 +02:00
let h2 = new zui.Handle({value: 5});
2019-10-10 14:27:17 +02:00
let timer = 0.0;
2019-10-09 23:46:08 +02:00
plugin.drawUI = function(ui) {
if (ui.panel(h1, "Auto Save")) {
ui.slider(h2, "min", 1, 15, false, 1);
}
}
plugin.update = function() {
if (arm.Project.filepath == "") return;
timer += 1 / 60;
if (timer >= h2.value * 60) {
timer = 0.0;
arm.Project.projectSave();
}
}