recording did not work, when there were layers with mapped but not hot values

dependencies hashes:
openFrameworks d78075f4bca6be2a2533c6e51a75cc1f18404501
ofxMsdfgen e14da13d02c4dff04fb69d7923469f606924e6c3
ofxGPUFont d482bb7cbdf6b296fa4ab5abcf73fb5ff8c8b239
ofxVariableLab 8df98846248a93aa068989a3ebd0d2f0f16e5e69
ofxProfiler a868e34fa1a79189dd4fbdede2938e308535e5e8
theatre 86d3e07f6f2c75fd6e08fca8c97e3617c9e23b18
This commit is contained in:
themancalledjakob 2024-03-22 16:36:45 +01:00
parent 962344e8cd
commit 83184737ea
2 changed files with 34 additions and 11 deletions

View file

@ -1161,11 +1161,23 @@ const Audio = function(tp, record) {
//} //}
} else { } else {
const position = tp.sheet.sequence.position; const position = tp.sheet.sequence.position;
let values = {};
propsToSet.forEach((p) => { propsToSet.forEach((p) => {
const title = tp const title = tp
.getPanelPropTitle(p.title); .getPanelPropTitle(p.title);
const layer = getLayer(p.id); const layer = getLayer(p.id);
const newValues = {
[p.title]: p.value
};
if (!values.hasOwnProperty(p.id)) {
values[p.id] = {};
}
values[p.id] = {
...values[p.id],
...newValues,
};
if (title !== null) { if (title !== null) {
const inputElement = title const inputElement = title
.parentNode.parentNode .parentNode.parentNode
@ -1176,14 +1188,21 @@ const Audio = function(tp, record) {
inputElement.dispatchEvent(new Event('change')); inputElement.dispatchEvent(new Event('change'));
} }
} }
if (record.isHot(p.id, p.title)) {
record.addValue(p.id, p.title, p.value, position); record.addValue(p.id, p.title, p.value, position);
if (p.title.indexOf('color') === 0) {
if (!config.audio.colorSeparateRGBA || p.title === 'color.a') {
record.liveUpdate(layer, position);
}
} else {
record.liveUpdate(layer, position);
} }
// NOTE: liveUpdate does not work if the layer is not registered
//if (p.title.indexOf('color') === 0) {
//if (!config.audio.colorSeparateRGBA || p.title === 'color.a') {
//record.liveUpdate(layer, position);
//}
//} else {
//record.liveUpdate(layer, position);
//}
});
Object.keys(values).forEach((layerID) => {
deFlattenObject(values[layerID]);
record.liveUpdater.immediateUpdate(getLayer(layerID), values[layerID]);
}); });
} }
} }

View file

@ -177,8 +177,10 @@ const Record = function(tp) {
}; };
const isHot = (layerID, propTitle) => { const isHot = (layerID, propTitle) => {
return hot.hasOwnProperty(layerID) return typeof hot[layerID] === 'object'
&& hot[layerID].hasOwnProperty(propTitle); && typeof hot[layerID][propTitle] === 'object';
//return hot.hasOwnProperty(layerID)
//&& hot[layerID].hasOwnProperty(propTitle);
}; };
const addHot = (layerID, propTitle) => { const addHot = (layerID, propTitle) => {
if (!isHot(layerID, propTitle)) { if (!isHot(layerID, propTitle)) {
@ -303,12 +305,13 @@ const Record = function(tp) {
// only make these propTitles hot and // only make these propTitles hot and
// register their layer for recording // register their layer for recording
propPaths.forEach((p) => { propPaths.forEach((p) => {
if (typeof p === 'string') {
p = p.split('.');
}
if (Array.isArray(p)) { if (Array.isArray(p)) {
const layerID = p[0]; const layerID = p[0];
const propTitle = p.slice(1).join('.'); const propTitle = p.slice(1).join('.');
addHot(layerID, propTitle); addHot(layerID, propTitle);
} else if (typeof p === 'string') {
console.error('not implemented yet, so sorry');
} }
}); });
} }
@ -596,6 +599,7 @@ const Record = function(tp) {
this.liveUpdate = liveUpdate; this.liveUpdate = liveUpdate;
this.liveUpdater = liveUpdater; this.liveUpdater = liveUpdater;
this.addRecordButton = addRecordButton; this.addRecordButton = addRecordButton;
this.isHot = isHot;
this.addHot = addHot; this.addHot = addHot;
this.removeHot = removeHot; this.removeHot = removeHot;
this.getHot = () => { this.getHot = () => {