inbetween stuff

dependencies hashes:
openFrameworks d78075f4bca6be2a2533c6e51a75cc1f18404501
ofxMsdfgen e14da13d02c4dff04fb69d7923469f606924e6c3
ofxGPUFont d482bb7cbdf6b296fa4ab5abcf73fb5ff8c8b239
ofxVariableLab 0b5f9bdebc1e5550621957e73c040c258ec6317b
ofxProfiler a868e34fa1a79189dd4fbdede2938e308535e5e8
theatre 86d3e07f6f2c75fd6e08fca8c97e3617c9e23b18
This commit is contained in:
themancalledjakob 2024-04-07 14:30:22 +02:00
parent c832982d46
commit 09897d7178
3 changed files with 27 additions and 13 deletions

View file

@ -1630,5 +1630,6 @@ const Audio = function(tp, record) {
}; };
export { export {
Audio Audio,
AudioLayer
} }

View file

@ -52,31 +52,34 @@ import {
Config Config
} from './config.js'; } from './config.js';
window.uploadFile = uploadFile;
window.downloadFile = downloadFile;
window.isInitialized = false;
window.hashFromString = hashFromString;
const config = new Config(); const config = new Config();
window.config = config;
const tp = new TheatrePlay(); const tp = new TheatrePlay();
window.tp = tp;
const layers = []; const layers = [];
const layersById = {}; const layersById = {};
const layerOrder = new LayerOrder(); const layerOrder = new LayerOrder();
window.layerOrder = layerOrder;
const fontsAndAxes = []; const fontsAndAxes = [];
let artboard; let artboard;
const exporter = new Exporter(); const exporter = new Exporter();
const interactor = new Interactor(); const interactor = new Interactor();
const moduleFS = new ModuleFS(); const moduleFS = new ModuleFS();
window.moduleFS = moduleFS;
const record = new Record(tp); const record = new Record(tp);
window.record = record;
const audio = new Audio(tp, record); const audio = new Audio(tp, record);
window.audio = audio;
// globally reachables
// classes
window.config = config;
window.tp = tp;
window.layerOrder = layerOrder;
window.moduleFS = moduleFS;
window.record = record;
window.audio = audio;
// utilities
window.uploadFile = uploadFile;
window.downloadFile = downloadFile;
window.isInitialized = false;
window.panelFinderTimeout = false; window.panelFinderTimeout = false;
const sequenceEventBuffer = {}; const sequenceEventBuffer = {};
//const midiController = new MidiController(); //const midiController = new MidiController();
@ -247,7 +250,7 @@ window.onload = () => {
} }
tp.studio.onSelectionChange((newSelection) => { tp.studio.onSelectionChange((newSelection) => {
if (newSelection.length > 0) { if (newSelection.length > 0) {
[getArtboard(), getLayers()].flat().forEach((e) => { [getArtboard(), getLayers(), getAudioLayer()].flat().forEach((e) => {
if (e.id() === newSelection[0].address.objectKey) { if (e.id() === newSelection[0].address.objectKey) {
if (e.id().indexOf('layer-') === 0) { if (e.id().indexOf('layer-') === 0) {
e.findInjectPanel(); e.findInjectPanel();
@ -257,6 +260,8 @@ window.onload = () => {
}, 60); }, 60);
} else if (e.id() === 'artboard') { } else if (e.id() === 'artboard') {
e.findInjectPanel(); e.findInjectPanel();
} else if (e.id().indexOf('audio') === 0) {
e.findInjectPanel();
} }
} }
}); });
@ -454,7 +459,8 @@ window.getLayer = (layerID = tp.studio.selection[0].address.objectKey) => {
if (layerID === 'artboard') { if (layerID === 'artboard') {
return artboard; return artboard;
} else { } else {
return layers.find((layer) => layer.id() === layerID); //return layers.find((layer) => layer.id() === layerID);
return layersById[layerID];
} }
}; };

View file

@ -724,6 +724,13 @@ const TheatrePlay = function(autoInit = false) {
window.project_fontsHashMap = project.fontsHashMap; window.project_fontsHashMap = project.fontsHashMap;
layerPromises.push(window.addExistingLayer(layerId, objects[layerId])); layerPromises.push(window.addExistingLayer(layerId, objects[layerId]));
}); });
Object.keys(objects)
.filter((e) => e.indexOf('audio-') === 0)
.forEach((layerId) => {
window.setLoadingTask(`setting up the sounds of ${layerId} to come`, 90);
window.project_fontsHashMap = project.fontsHashMap;
layerPromises.push(window.addExistingLayer(layerId, objects[layerId]));
});
Promise.all(layerPromises).then(() => { Promise.all(layerPromises).then(() => {
window.layerOrder.set(project.layerOrder); window.layerOrder.set(project.layerOrder);
this.duration = this.core.val(this.sheet.sequence.pointer.length); this.duration = this.core.val(this.sheet.sequence.pointer.length);