VL: C# old-style plugin

Hi, everybody!

I’m interested in the old-style writing plugins, as for vvvv.

I need ability to make a plugin in the form of one solid node, which creates an instance of the class (not a singleton), and called some function each time by VL. How can i make it by code only? I don’t want to write an additional wrapper with VL (call Create, make pads, call Update, and other boring stuff).
Is it possible?

Also i need some code references for:

  • Access to nodes graph (including remote execution of any node, changing the values of any pins)
  • Generator of nodes
  • Catch mouse button click on node

the wonderful thing about vl is that it operates in the .NET world, it can use any .NET entities (this means it can load .NET dll’s and use 100% of its contents) under the hood it’s also creating clr classes and it also has the potential to to use them anywhere else but it’s not exposed yet until VL becomes standalone. So in other words VL doesn’t require any special semantics or patterns like the PluginInterfaces of vvvv to load your code written for .NET.

If you’re interested in general C# development for “oldschool” vvvv check out the docs under the devvvv submenu.

Accessing the node graph in vvvv is not documented in the clearest way. Also the API for that part can be confusing with weird semantics (an input pin connected to an upstream output pin is a child of that output pin, a pin can be part of multiple nodes if it’s a pin of a subpatch, a subpatch contents are flattened in the graph but the node subpatch is still present as a node in the graph, and quirks like this and I know this because Joreg told me this on riot).
I have no idea if node graph info is exposed at all in vl. But since it compiles to CIL I doubt it. Also VL is not a big flat dynamic graph of nodes anymore as in vvvv, vl patches are analogous to class and function body definition which can be instantiated in runtime as many times as needed and instances will be garbage collected as anything else allocated on the managed heap of the CLR.

Remote execution of any node would break the vvvv dataflow way of doing things around here. Also a vvvv node has multiple ways of code execution (including but not exclusively the Evaluate function, the initialization code in OnImportsSatisfied, or any other events where you might modify spread data) which makes this aspect even more meaningless / breaking. Remote execution of VL nodes is even more meaningless hopefully for clear reasons by now.

Now changing pin values are something can be done in vvvv with the V1 PluginInterfaces, IPin and SetSlice (again in vvvv, in vl this is not a thing and god bless us all if it ever becomes a thing). SetSlice though accepts only a string argument which will be either parsed into a value, enums maybe and of course strings. I don’t know about colors. Other more complex types are vague and wouldn’t bother. Be aware that an input connection overwrites these changes, and for bangs you have to explicitly make sure that a slice is true for single frame (boolean is also value in vvvv, so it’s “1” or “0” in the SetSlice string.

Node factory is a thing in vvvv (that’s how it can display shaders, dynamic plugins and you name it in the NodeBrowser), it’s also not the clearest of all how to work with it but the DX11 repo can be a good starting point on the usage of that. But afaiu you declare a class inheriting from a NodeFactory interface where you need to tell how to find these nodes, how they will be executed and other jazz like it.

UI events on nodes afaik can’t be listened to in .NET land because they’re drawn in delphi with ActiveX (in ye olde days this was the way, and why change it if it ain’t broke yadeeyada). But you can get if they’re selected or not, that’s more than nothing. Also you can get if it has a window or control associated.

boy that was extensive

2 Likes

@microdee thanks for the excellent overview

@stavag i’m adding a few general links since from your question it is not entirely clear to me what you’re looking for.

for vvvv

for vl

hope this helps and please let us know if you need more help on anything specific.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.