diff --git a/CHANGELOG.md b/CHANGELOG.md index 82697b2a..79d739d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - modal: prevent touch event from affecting elements behind the popup when closing it - clone: some properies in target widget were not applied to the clone - text: vertical centering issues in narrow widgets + - dynamic properties: when using a widget's own value to determine its osc settings, these are checked and updated if needed before sending the message - editor - wrap in: insert wrapper at selected widget's index - wrap in: set label to false by default when wrapping in a strip or a panel diff --git a/resources/docs/widgets/widgets.md b/resources/docs/widgets/widgets.md index b382cb25..8795d0a5 100644 --- a/resources/docs/widgets/widgets.md +++ b/resources/docs/widgets/widgets.md @@ -137,3 +137,6 @@ preArgs: [ - type: `boolean` - default: `false` - usage: set to `true` to prevent the widget from sending any osc message + +!!! note "" + Changing OSC properties dynamically using advanced property syntax is likely to break synchronisation between multiple clients. diff --git a/src/browser/js/app/widgets/common/widget.js b/src/browser/js/app/widgets/common/widget.js index 1360ec04..58b747a7 100644 --- a/src/browser/js/app/widgets/common/widget.js +++ b/src/browser/js/app/widgets/common/widget.js @@ -10,6 +10,14 @@ var EventEmitter = require('../../events/event-emitter'), updateWidget = ()=>{} +var OSCProps = [ + 'precision', + 'address', + 'preArgs', + 'target', + 'bypass' +] + var fallbackContainer DOM.ready(()=>{ @@ -116,6 +124,9 @@ class Widget extends EventEmitter { } + var selfLinkedOSCProps = (this.linkedPropsValue['this'] || []).filter(i => OSCProps.indexOf(i) > -1) + this.selfLinkedOSCProps = selfLinkedOSCProps.length ? selfLinkedOSCProps : false + // cache precision if (this.props.precision != undefined) { this.precision = Math.min(20,Math.max(this.getProp('precision', undefined, false),0)) @@ -180,6 +191,10 @@ class Widget extends EventEmitter { sendValue(overrides, options={}) { + if (this.selfLinkedOSCProps) { + this.updateProps(this.selfLinkedOSCProps, this) + } + if (this.getProp('bypass') && !options.force) return var data = {