Forum

Create Pins programatically

I’m writing a plugin where I want pins to be created depending on the input data (input is a string with differing content that gets parsed).

Now there is the “DynamicPinsValueTemplate” but the whole process shown there of creating a pin dynamically is a bit difficult to grasp for me, at least I can’t translate it to my project.

Is there any other example that creates pins dynamically in a different manner than shown in that template? The template creates the pins all at once and I’m not even sure where exactly.
I would like to create individual pins with unique names and different data types depending on the input I get.
A simple example would be nice.

hello, can you describe the problem that you are trying to solve a bit more?
there are several nodes which create pins, but they only do that on a configuration level, never depending on an actual input pin. because if you change the input while the patch is running, pins would pop up or disappear and break connections.

basically you can import the IOFactory:
https://github.com/vvvv/vvvv-sdk/blob/develop/vvvv45/src/nodes/plugins/XML/XMLPruneNode.cs#L34

or the PluginHost FHost;
https://github.com/tebjan/VVVV.Audio/blob/master/Source/Nodes/VST/VSTHostNode.cs#L501

hope that helps.

If you create pins dynamically, you should take special care, so you can recreate them when reloading the patch.

There is a certain time in patch loading, when all the links are loaded. During that time, all your pins must have been re-created already. However, at that point you cannot read normal input pins yet, only config pins!

So if you want to save your pin layout, you must do so in a config pin.

Have a look here or download Message and create a Join or Split to see, how you would create binsized pins.

Thanks for those links, very helpfull!
And yes a config pin would be just fine. I guess what Automata is doing is pretty much what I need, though I can’t seem to find the source for that.