mirror of
https://github.com/fluxscape/fluxscape.git
synced 2026-01-12 15:22:54 +01:00
Initial commit
Co-Authored-By: Eric Tuvesson <eric.tuvesson@gmail.com> Co-Authored-By: mikaeltellhed <2311083+mikaeltellhed@users.noreply.github.com> Co-Authored-By: kotte <14197736+mrtamagotchi@users.noreply.github.com> Co-Authored-By: Anders Larsson <64838990+anders-topp@users.noreply.github.com> Co-Authored-By: Johan <4934465+joolsus@users.noreply.github.com> Co-Authored-By: Tore Knudsen <18231882+torekndsn@users.noreply.github.com> Co-Authored-By: victoratndl <99176179+victoratndl@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
'use strict';
|
||||
|
||||
const StringSelectorNode = {
|
||||
name: 'String Selector',
|
||||
displayNodeName: 'Index To String',
|
||||
shortDesc: 'Choose between multiple strings.',
|
||||
category: 'Utilities',
|
||||
deprecated: true,
|
||||
initialize: function () {
|
||||
this._internal.inputs = [];
|
||||
this._internal.currentSelectedIndex = 0;
|
||||
this._internal.indexChanged = false;
|
||||
},
|
||||
getInspectInfo() {
|
||||
return this._internal.inputs[this._internal.currentSelectedIndex];
|
||||
},
|
||||
numberedInputs: {
|
||||
input: {
|
||||
type: 'string',
|
||||
displayPrefix: 'String for ',
|
||||
group: 'Inputs',
|
||||
createSetter: function (index) {
|
||||
return function (value) {
|
||||
value = value ? value.toString() : '';
|
||||
this._internal.inputs[index] = value;
|
||||
if (this._internal.currentSelectedIndex === index) {
|
||||
this.flagOutputDirty('currentValue');
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
},
|
||||
inputs: {
|
||||
index: {
|
||||
type: {
|
||||
name: 'number'
|
||||
},
|
||||
displayName: 'Index',
|
||||
default: 0,
|
||||
set: function (value) {
|
||||
value = value | 0;
|
||||
|
||||
this._internal.currentSelectedIndex = value;
|
||||
this.flagOutputDirty('currentValue');
|
||||
this.sendSignalOnOutput('indexChanged');
|
||||
}
|
||||
}
|
||||
},
|
||||
outputs: {
|
||||
currentValue: {
|
||||
type: 'string',
|
||||
displayName: 'Current Value',
|
||||
group: 'Value',
|
||||
getter: function () {
|
||||
return this._internal.inputs[this._internal.currentSelectedIndex];
|
||||
}
|
||||
},
|
||||
indexChanged: {
|
||||
type: 'signal',
|
||||
displayName: 'Index Changed',
|
||||
group: 'Signals'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
node: StringSelectorNode
|
||||
};
|
||||
Reference in New Issue
Block a user