diff --git a/app/main/callbacks.js b/app/main/callbacks.js index a05edb68..3c4dfa87 100644 --- a/app/main/callbacks.js +++ b/app/main/callbacks.js @@ -188,37 +188,40 @@ module.exports = { } } + if (data.target.indexOf(null) == -1) { - var targets = [] + var targets = [] - if (settings.read('syncTargets')) Array.prototype.push.apply(targets, settings.read('syncTargets')) - if (data.target) Array.prototype.push.apply(targets, data.target) + if (settings.read('syncTargets')) Array.prototype.push.apply(targets, settings.read('syncTargets')) + if (data.target) Array.prototype.push.apply(targets, data.target) - for (var i in targets) { - - if (targets[i] == 'self') { - ipc.send('receiveOsc',data,clientId) - continue - } - - var host = targets[i].split(':')[0], - port = targets[i].split(':')[1] - - if (port) { - - if (data.split) { - - for (var j in data.split) { - osc.send(host,port,data.split[j],data.args[j],data.precision) - } - - } else { - - osc.send(host,port,data.address,data.args,data.precision) + for (var i in targets) { + if (targets[i] == 'self') { + ipc.send('receiveOsc',data,clientId) + continue } + var host = targets[i].split(':')[0], + port = targets[i].split(':')[1] + + if (port) { + + if (data.split) { + + for (var j in data.split) { + osc.send(host,port,data.split[j],data.args[j],data.precision) + } + + } else { + + osc.send(host,port,data.address,data.args,data.precision) + + } + + + } } diff --git a/resources/docs/widgets/widgets.md b/resources/docs/widgets/widgets.md index 23443075..58e5a544 100644 --- a/resources/docs/widgets/widgets.md +++ b/resources/docs/widgets/widgets.md @@ -77,9 +77,10 @@ All widgets share a set of generic properties described below. - this defines the targets of the widget's osc messages - each element of the `array` must be a string formatted as follows : `"ip:port"` - multiple targets can be specified : `["ip1:port1","ip2:port2"]` - - if no target is set, messages can still be sent if the server has synchronized hosts (`-s / --sync`) - if [`midi`](../extras/midi.md) is enabled, targets can be `"midi:device_name"` - - special target "self" will directly send the message back to the client + - special item `"self"` can be used to refer to the emitting client directly + - if no target is set (empty array `[]`), messages can still be sent if the server has defaults targets (`-s / --send`) + - to disable osc regardless of the previous point, set `target` to `[null]` ### `address` - type: `string` diff --git a/src/browser/js/app/osc.js b/src/browser/js/app/osc.js index 01eab275..9cb9dc66 100644 --- a/src/browser/js/app/osc.js +++ b/src/browser/js/app/osc.js @@ -70,7 +70,7 @@ Osc.prototype.receive = function(data){ // if the message target is provided (when message comes from another client connected to the same server) // then we only update the widgets that have the same target // compare arrays using > and < operators (both false = equality) - if (!target || !(widget[i].getProp('target') < target || widget[i].getProp('target') > target)) { + if (!target || !(widget[i].getProp('target') < target || widget[i].getProp('target') > target || widget[i].getProp('target').length != target.length)) { // update matching widgets if (widget[i] && widget[i].setValue) widget[i].setValue(args,{send:false,sync:true,fromExternal:!target}) } diff --git a/src/browser/js/app/widgets/common/_widgets_base.js b/src/browser/js/app/widgets/common/_widgets_base.js index c93e16b3..b112b634 100644 --- a/src/browser/js/app/widgets/common/_widgets_base.js +++ b/src/browser/js/app/widgets/common/_widgets_base.js @@ -27,12 +27,12 @@ module.exports = class _widgets_base { this.hash = _widgets_base.createHash() // Turn preArgs into array - if (this.props.preArgs != undefined && !Array.isArray(this.resolveProp('preArgs', undefined, false))) { + if (this.props.preArgs !== undefined && !Array.isArray(this.resolveProp('preArgs', undefined, false))) { this.props.preArgs = [this.props.preArgs] } // Turn preArgs into array - if (this.props.target != undefined && !Array.isArray(this.resolveProp('target', undefined, false))) { + if (this.props.target !== undefined && !Array.isArray(this.resolveProp('target', undefined, false))) { this.props.target = [this.props.target] }