diff --git a/nodes/vvvv.nodes.node.js b/nodes/vvvv.nodes.node.js index 2b96945..f713392 100644 --- a/nodes/vvvv.nodes.node.js +++ b/nodes/vvvv.nodes.node.js @@ -3,6 +3,11 @@ // VVVV.js is freely distributable under the MIT license. // Additional authors of sub components are mentioned at the specific code locations. +/** + * The Node Pin Type + * @mixin + * @property {String} typeName "Node" + */ VVVV.PinTypes.Node = { typeName: "Node" } @@ -28,10 +33,10 @@ VVVV.Nodes.IOBoxNode = function(id, graph) { this.auto_evaluate = false; // input pins - var inputnodeIn = this.addInputPin('Input Node', [], this, true, VVVV.PinTypes.Node); + var inputnodeIn = this.addInputPin('Input Node', [], VVVV.PinTypes.Node); // output pins - var outputnodeOut = this.addOutputPin('Output Node', [], this, VVVV.PinTypes.Node); + var outputnodeOut = this.addOutputPin('Output Node', [], VVVV.PinTypes.Node); this.initialize = function() { inputnodeIn.connectionChangedHandlers['nodepin'] = function() { @@ -96,7 +101,7 @@ VVVV.Nodes.IOBoxNode.prototype = new VVVV.Core.Node(); /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ NODE: Switch (Node Input) - Author(s): Matthias Zauner + Author(s): Matthias Zauner, David Gann Original Node Author(s): VVVV Group ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ @@ -105,37 +110,53 @@ VVVV.Nodes.SwitchNodeInput = function(id, graph) { this.constructor(id, "Switch (Node Input)", graph); this.meta = { - authors: ['Matthias Zauner'], + authors: ['Matthias Zauner, David Gann'], original_authors: ['VVVV Group'], credits: [], - compatibility_issues: ['No dynamic pin count yet'] + compatibility_issues: ['Dynamic Input works only after copy and paste node'] }; - var switchIn = this.addInputPin("Switch", [0], this); - var inputcountIn = this.addInvisiblePin("Input Count", [2], this); - var inputIn = [] - - var outputOut = this.addOutputPin("Output", [0.0], this); + var switchIn = this.addInputPin("Switch", [0], VVVV.PinTypes.Value); + var inputCountIn = this.addInvisiblePin("Input Count", [2], VVVV.PinTypes.Value); + var inputIn = []; + + this.initialize = function() { + var inputCount = Math.max(2, inputCountIn.getValue(0)); + VVVV.Helpers.dynamicPins(this, inputIn, inputCount, function(i) { + return this.addInputPin('Input '+(i+1), [], VVVV.PinTypes.Node); + }) + } + + /* this.initialize = function() { - var inputCount = inputcountIn.getValue(0); + var inputCount = inputCountIn.getValue(0); for (var i=inputIn.length; i