Compare commits
No commits in common. "f829eea9117b0083e42a6003fcc35027ab02f98f" and "e10d8dbe1dc9099ab4cbdbbaf50e65fffb3e8867" have entirely different histories.
f829eea911
...
e10d8dbe1d
3 changed files with 21 additions and 46 deletions
|
@ -376,11 +376,13 @@ const Layer = function(tp, layerID, fontsAndAxes, autoInit = true) {
|
|||
};
|
||||
this.init = (initialValues = false) => {
|
||||
return new Promise((resolve) => {
|
||||
console.log('this is happening','layer init');
|
||||
const promises = [];
|
||||
promises.push(this.findInjectHierarchyPanelPromise());
|
||||
const doUpdateTheatre = false;
|
||||
this.updateFonts(doUpdateTheatre)
|
||||
.then(() => {
|
||||
console.log('this is happening','layer init update fonts');
|
||||
this.theatreObject = tp.addObject(this.id(), this.props, this.onValuesChange);
|
||||
if (typeof initialValues === 'object') {
|
||||
this.theatreObject.initialValue = initialValues;
|
||||
|
@ -388,14 +390,19 @@ const Layer = function(tp, layerID, fontsAndAxes, autoInit = true) {
|
|||
window.layerOrder.add(this.id());
|
||||
setTimeout(() => {
|
||||
const values = JSON.parse(JSON.stringify(this.theatreObject.value));
|
||||
console.log('this is happening','doing the transaction');
|
||||
tp.studio.transaction(({
|
||||
set
|
||||
}) => {
|
||||
set(this.theatreObject.props, values);
|
||||
});
|
||||
console.log('this is happening','has have been doing the transaction');
|
||||
setTimeout(() => {
|
||||
console.log('this is happening');
|
||||
promises.push(this.findInjectPanelPromise());
|
||||
console.log(promises);
|
||||
Promise.allSettled(promises).then(() => {
|
||||
console.log('this is happening');
|
||||
resolve();
|
||||
if (config.autoSave && window.isInitialized) {
|
||||
tp.saveProject();
|
||||
|
@ -461,6 +468,7 @@ const Layer = function(tp, layerID, fontsAndAxes, autoInit = true) {
|
|||
}
|
||||
if (doItAgain) {
|
||||
hierarchyPanelFinderTimeout = setTimeout(() => {
|
||||
console.log('hierachrypanelfinder');
|
||||
this.findInjectHierarchyPanel(resolve);
|
||||
}, 30);
|
||||
window.hierarchyPanelFinderTimeout = hierarchyPanelFinderTimeout;
|
||||
|
@ -512,14 +520,19 @@ const Layer = function(tp, layerID, fontsAndAxes, autoInit = true) {
|
|||
let panelFinderTimeout = false;
|
||||
this.findInjectPanelPromise = () => {
|
||||
return new Promise((resolve) => {
|
||||
console.log('this is happening', 'finInjectPanelPRomisE');
|
||||
this.findInjectPanel(resolve);
|
||||
});
|
||||
};
|
||||
this.findInjectPanel = (resolve = false) => {
|
||||
if (tp.studio.selection.length === 0 || (tp.studio.selection.length > 0 && tp.studio.selection[0].address.objectKey !== this.id())) {
|
||||
console.log('this is happening', 'finInjectPanel DOES NOT RESOLVE HAHAHAHA');
|
||||
if (typeof resolve === 'function') {
|
||||
console.log('this is happening', 'resolver');
|
||||
resolve();
|
||||
}
|
||||
console.log('this is happening', 'was resolved?');
|
||||
|
||||
return;
|
||||
} else {
|
||||
const panel = tp.getPanel();
|
||||
|
|
|
@ -323,16 +323,20 @@ const resize = () => {
|
|||
};
|
||||
|
||||
const postModuleInitialized = () => {
|
||||
console.log('this is happening');
|
||||
window.setLoadingTask('setting up animation', 80);
|
||||
moduleFS.init()
|
||||
.then(() => {
|
||||
console.log('this is happening');
|
||||
artboard = new Artboard(tp, content);
|
||||
initPanels();
|
||||
// NOTE: we know that our TheatrePlay is initialized
|
||||
tp.connectModuleCallbacks();
|
||||
exporter.init();
|
||||
getFontsAndAxes();
|
||||
console.log('this is happening');
|
||||
tp.loadProject().then(() => {
|
||||
console.log('this is happening');
|
||||
interactor.init();
|
||||
resize();
|
||||
adjustPanel();
|
||||
|
@ -344,6 +348,7 @@ const postModuleInitialized = () => {
|
|||
tp.saveProject();
|
||||
}
|
||||
}, 1000);
|
||||
console.log('this is happening');
|
||||
});
|
||||
//midiController.init();
|
||||
});
|
||||
|
@ -456,7 +461,9 @@ const addExistingLayer = (layerID, values) => {
|
|||
layer.valuesCorrector(values);
|
||||
const cppProps = layer.values2cppProps(values);
|
||||
const checkID = Module.addExistingLayer(cppProps, layerID);
|
||||
console.log('this is happening');
|
||||
layer.init().then(() => {
|
||||
console.log('this is happening');
|
||||
layers.push(layer);
|
||||
layersById[layerID] = layer;
|
||||
resolve(layer);
|
||||
|
|
|
@ -4,7 +4,6 @@ import {
|
|||
toCssClass,
|
||||
flattenObject,
|
||||
deFlattenObject,
|
||||
getNestedProperty,
|
||||
} from './utils.js';
|
||||
|
||||
const LiveBuffer = function() {
|
||||
|
@ -160,15 +159,10 @@ const Record = function(tp) {
|
|||
const liveUpdater = new LiveUpdater(tp, buffy);
|
||||
let isInitialized = false;
|
||||
|
||||
let remember = {};
|
||||
|
||||
const init = () => {
|
||||
if (!isInitialized) {
|
||||
tp.core.onChange(tp.sheet.sequence.pointer.playing, (playing) => {
|
||||
if (isRecording === RECORDING && !playing) {
|
||||
// when you hit space to stop recording,
|
||||
// we want to keep it paused
|
||||
remember.isPlaying = false;
|
||||
stopRecording();
|
||||
}
|
||||
});
|
||||
|
@ -400,38 +394,6 @@ const Record = function(tp) {
|
|||
liveUpdater.immediateUpdate(layer, merged);
|
||||
};
|
||||
|
||||
/// @brief = copies letterDelay value from audio mapping to the recorded value.
|
||||
///
|
||||
/// @param layer - a layer object
|
||||
/// @param propPaths - two dimensional array of strings
|
||||
///
|
||||
/// @return
|
||||
const syncLetterDelays = (layer, propPaths) => {
|
||||
propPaths.forEach((path) => {
|
||||
const oldLetterDelay = getNestedProperty(layer.theatreObject.value.letterDelays, path, true);
|
||||
const isOriginalSequenced = tp.isSequenced(path, layer);
|
||||
const isLetterDelaySequenced = tp.isSequenced(["letterDelays", path], layer);
|
||||
// we use audio.getSavedMapping(), because mapping may be removed directly after recording
|
||||
const mapping = getNestedProperty(audio.getSavedMapping(), [layer.id()].concat(path), true);
|
||||
const newLetterDelay = (() => {
|
||||
if (typeof mapping['letterDelay'] === 'undefined') {
|
||||
return false;
|
||||
}
|
||||
return mapping['letterDelay'];
|
||||
})();
|
||||
if (newLetterDelay !== oldLetterDelay &&
|
||||
!isLetterDelaySequenced &&
|
||||
newLetterDelay !== false) {
|
||||
const prop = getNestedProperty(layer.theatreObject.props.letterDelays, path);
|
||||
tp.studio.transaction(({
|
||||
set
|
||||
}) => {
|
||||
set(prop, newLetterDelay);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const startRecording = () => {
|
||||
isRecording = STARTING_RECORDING;
|
||||
console.log('Record::startRecording');
|
||||
|
@ -445,7 +407,6 @@ const Record = function(tp) {
|
|||
init();
|
||||
}
|
||||
lastPositions = {};
|
||||
remember.isPlaying = tp.core.val(tp.sheet.sequence.pointer.playing);
|
||||
tp.sheet.sequence.pause();
|
||||
const layerKeys = Object.keys(hot);
|
||||
layerKeys.forEach((layerID) => {
|
||||
|
@ -538,10 +499,10 @@ const Record = function(tp) {
|
|||
}
|
||||
});
|
||||
//setTimeout(() => {
|
||||
const kf = clone(keyframes);
|
||||
promises.push(() => {
|
||||
return new Promise((subResolve) => {
|
||||
tp.addKeyframes(layer, keyframes).then(() => {
|
||||
syncLetterDelays(layer, keyframes.map(k => k.path));
|
||||
layer.updateValuesViaTheatre(true);
|
||||
subResolve();
|
||||
});
|
||||
|
@ -560,12 +521,6 @@ const Record = function(tp) {
|
|||
.classList.remove('visible');
|
||||
console.log('Record::stopRecording', 'stopped recording');
|
||||
isRecording = NOT_RECORDING;
|
||||
|
||||
if (remember.isPlaying) {
|
||||
tp.sheet.sequence.play();
|
||||
} else {
|
||||
tp.sheet.sequence.pause();
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue