diff --git a/bin/em/variabletime/web/js/audio.js b/bin/em/variabletime/web/js/audio.js index 8c06cf6..77557e2 100644 --- a/bin/em/variabletime/web/js/audio.js +++ b/bin/em/variabletime/web/js/audio.js @@ -1161,11 +1161,23 @@ const Audio = function(tp, record) { //} } else { const position = tp.sheet.sequence.position; + let values = {}; propsToSet.forEach((p) => { const title = tp .getPanelPropTitle(p.title); 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) { const inputElement = title .parentNode.parentNode @@ -1176,14 +1188,21 @@ const Audio = function(tp, record) { inputElement.dispatchEvent(new Event('change')); } } - 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); + if (record.isHot(p.id, p.title)) { + record.addValue(p.id, p.title, p.value, 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]); }); } } diff --git a/bin/em/variabletime/web/js/record.js b/bin/em/variabletime/web/js/record.js index 8a601a5..e01b01f 100644 --- a/bin/em/variabletime/web/js/record.js +++ b/bin/em/variabletime/web/js/record.js @@ -177,8 +177,10 @@ const Record = function(tp) { }; const isHot = (layerID, propTitle) => { - return hot.hasOwnProperty(layerID) - && hot[layerID].hasOwnProperty(propTitle); + return typeof hot[layerID] === 'object' + && typeof hot[layerID][propTitle] === 'object'; + //return hot.hasOwnProperty(layerID) + //&& hot[layerID].hasOwnProperty(propTitle); }; const addHot = (layerID, propTitle) => { if (!isHot(layerID, propTitle)) { @@ -303,12 +305,13 @@ const Record = function(tp) { // only make these propTitles hot and // register their layer for recording propPaths.forEach((p) => { + if (typeof p === 'string') { + p = p.split('.'); + } if (Array.isArray(p)) { const layerID = p[0]; const propTitle = p.slice(1).join('.'); 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.liveUpdater = liveUpdater; this.addRecordButton = addRecordButton; + this.isHot = isHot; this.addHot = addHot; this.removeHot = removeHot; this.getHot = () => {