Mscript does not need a callback. Remove from compile() method

This commit is contained in:
mmcwilliams 2019-05-28 17:42:42 -04:00
parent 35a540f5df
commit 1fd3b83ca1
1 changed files with 11 additions and 28 deletions

View File

@ -95,14 +95,7 @@ mse.mscript.toSequence = function () {
if (data !== mse.mscript.raw) {
cont = confirm(`Current script has not been compiled. Compile first?`);
if (cont) {
return mse.mscript.compile(() => {
mse.console.print(`Sending compiled script to GUI sequencer...`);
seq.clear();
mse.mscript.toGUI();
grid.refresh();
seq.stats();
return nav.change('sequencer');
})
mse.mscript.compile()
}
}
mse.console.print(`Sending compiled script to GUI sequencer...`);
@ -112,19 +105,17 @@ mse.mscript.toSequence = function () {
seq.stats();
return nav.change('sequencer');
}
mse.mscript.compile = function (cb) {
mse.mscript.compile = function () {
'use strict';
const data = mse.mscript.editor.getValue();
let mscript = new Mscript();
let output;
mse.mscript.raw = data;
mscript.interpret(data, (output) => {
const mscript = new Mscript();
let output = mscript.interpret(data);
let len = output.arr.length;
mse.mscript.raw = data;
mse.mscript.data = output;
//mse.console.print(JSON.stringify(output, null, '\t') + '\n')
mse.console.print(`Sequence contains ${len} step${(len === 1 ? '' : 's')}, CAM: ${output.cam}, PROJ: ${output.proj}`);
if (cb) cb();
});
};
mse.mscript.prepare = function () {
@ -153,21 +144,13 @@ mse.mscript.run = function () {
if (data !== mse.mscript.raw) {
cont = confirm(`Current script has not been compiled. Compile first?`);
if (cont) {
return mse.mscript.compile(() => {
mse.console.print(`Started running compiled sequence...`);
arr = mse.mscript.prepare();
gui.overlay(true);
gui.spinner(true, `Running mscript sequence...`, true, true);
return seq.exec(arr, 1);
})
mse.mscript.compile();
}
}
arr = mse.mscript.prepare();
mse.console.print(`Started running compiled sequence...`);
gui.overlay(true);
gui.spinner(true, `Running mscript sequence...`, true, true);
return seq.exec(arr, 1);
};
@ -201,7 +184,7 @@ mse.console.exec = function () {
let command;
mse.console.parse();
command = mse.console.lines[mse.console.lines.length - 1].replace('>', '').trim();
console.log(command);
log.info(command);
mse.console.newLine();
if (mscript.cmd.indexOf(command) !== -1) {
if (command === 'CF') {