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