Merge branch 'master' of github.com:jean-emmanuel/open-stage-control

This commit is contained in:
bordun 2020-05-20 18:32:11 +02:00
commit 213d421a21
5 changed files with 10 additions and 12 deletions

View file

@ -30,10 +30,7 @@ class Editor {
newWidgets = []
for (var w of this.selectedWidgets) {
if (propName === 'address' && value === '') {
// special case
w.props[propName] = '/' + w.props.id
} else if ((propName === 'label' || propName === 'popupLabel') && value === true) {
if ((propName === 'label' || propName === 'popupLabel') && value === true) {
w.props[propName] = 'auto'
} else {
w.props[propName] = value !== '' ? value : deepCopy(defaults[w.props.type][propName].value)

View file

@ -143,7 +143,7 @@ class WidgetManager extends EventEmitter {
preArgs: widget.getProp('preArgs'),
target: widget.getProp('target'),
typeTags: widget.getProp('typeTags'),
address: widget.getProp('address'),
address: widget.getProp('address') === 'auto' ? '/' + widget.getProp('id') : widget.getProp('address'),
}
})

View file

@ -67,10 +67,6 @@ var Parser = class Parser {
props.id = id
}
// Generate default address (also handled in editor/edit-field)
props.address = props.address === 'auto' ? '/' + props.id : props.address
// Remove props that don't apply
for (let j in props) {
if (defaults[j] === undefined || j[0] === '_') delete props[j]

View file

@ -35,7 +35,9 @@ module.exports = class OscReceiver {
if (address) this.address = address
if (this.address[0] !== '/') {
this.prefix = this.parent.getProp('address') || this.parent.resolveProp('address', undefined, false, this)
var parentAddress = this.parent.getProp('address') || this.parent.resolveProp('address', undefined, false, this)
if (parentAddress === 'auto') parentAddress = '/' + this.parent.getProp('id')
this.prefix = parentAddress
if (this.prefix[this.prefix.length - 1] !== '/') this.prefix += '/'
}

View file

@ -103,7 +103,10 @@ class Widget extends EventEmitter {
_osc: 'osc',
address: {type: 'string', value: 'auto', help: 'OSC address for sending messages, it must start with a /'},
address: {type: 'string', value: 'auto', help: [
'OSC address for sending / receiving messages, it must start with a slash (`/`)',
'By default ("auto"), the widget\'s id is used: `/widget_id`',
]},
preArgs: {type: '*|array', value: '', help: [
'A value or array of values that will be prepended to the OSC messages.',
]},
@ -837,7 +840,7 @@ class Widget extends EventEmitter {
var data = {},
oldData = {
preArgs: propName == 'preArgs' ? oldPropValue : this.getProp('preArgs'),
address: propName == 'address' ? oldPropValue : this.getProp('address')
address: propName == 'address' ? oldPropValue : (this.getProp('address') === 'auto' ? '/' + this.getProp('id') : this.getProp('address'))
}
data[propName] = this.getProp(propName)
widgetManager.registerWidget(this, data, oldData)