Forum

How to get the underlying type of a pin via plugin

I’m trying to extract informations from a patch. I want to know several things:

  • for every output pin of the patch, which name does it have and what type is the pin (string, Color, Transform, ) - basically the information that is shown on hovering the pin (Supports: sometype)

  • for every IOBox, how is that configured (what mode, what slicecount) (if this is not accessible from PluginInterface, I would probably get it from GetPatch)

Currently, I tried using the “CLRType” exposed by the INode2 interface. But that always returns null, even for totally custom types. The “Type” string returns something like “String”, “Value”, “Patch ->”, “generic”, “generic” (and even the generics return a CLRType of “null”).

Some idea from the coders & devvvs out there?

creating a few random template nodes and writing out the interesting properties of IPin2 (Type, CLRType and SubType) i get something like this:

‘vvvv.exe’ (Managed (v4.0.30319)): Loaded ‘D:\devvvv\vvvv\public\vvvv45\lib\nodes\plugins\Template\bin\Dynamic-75365168.dynamic.1.dll’
Type: String, CLRType: , SubType: String, , , -1
Type: Value, CLRType: , SubType: Endless, 1, 1, -1.79769313486232E308, 1.79769313486232E308, 0.01, , 4
Type: Value, CLRType: , SubType: Integer, 1, 0, -1999999, 1999999, 1, , 4
Type: Value, CLRType: , SubType: Endless, 1, 0, -1.79769313486232E308, 1.79769313486232E308, 0.01, , 4
Type: Value, CLRType: , SubType: Integer, 1, 0, 0, 1999999, 1, , 4
‘vvvv.exe’ (Managed (v4.0.30319)): Loaded ‘D:\devvvv\vvvv\public\vvvv45\lib\nodes\plugins\TemplateString\bin\Dynamic-519407540.dynamic.1.dll’
Type: String, CLRType: , SubType: String, , , -1
Type: String, CLRType: , SubType: String, hello c#, , -1
Type: Value, CLRType: , SubType: Integer, 1, 0, -1999999, 1999999, 1, , 4
Type: String, CLRType: , SubType: String, , , -1
Type: Value, CLRType: , SubType: Integer, 1, 0, 0, 1999999, 1, , 4
Type: String, CLRType: , SubType: String, , , -1
Type: String, CLRType: , SubType: String, hello c#, , -1
Type: Value, CLRType: , SubType: Integer, 1, 0, -1999999, 1999999, 1, , 4
Type: String, CLRType: , SubType: String, , , -1
Type: Value, CLRType: , SubType: Integer, 1, 0, 0, 1999999, 1, , 4
‘vvvv.exe’ (Managed (v4.0.30319)): Loaded ‘D:\devvvv\vvvv\public\vvvv45\lib\nodes\plugins\TemplateEX9\bin\Dynamic\1900857410.dynamic.1.dll’
Type: String, CLRType: , SubType: String, , , -1
Type: -> Render State, CLRType: , SubType: Render State
Type: -> Sampler State, CLRType: , SubType: Sampler State
Type: -> Render Transform, CLRType: , SubType: Matrix Transform, Render Transform
Type: Value, CLRType: , SubType: Endless, 3, 0, -3.40282346638529E38, 3.40282346638529E38, 0.01, , 4
Type: String, CLRType: , SubType: Filename, , All Files (.)|., -1
Type: Value, CLRType: , SubType: Integer, 1, 0, -1999999, 1999999, 1, , 4
Type: ex9 Layer ->, CLRType: , SubType: ex9 Layer,
Type: Value, CLRType: , SubType: Integer, 1, 0, 0, 1999999, 1, , 4
‘vvvv.exe’ (Managed (v4.0.30319)): Loaded ‘D:\devvvv\vvvv\public\vvvv45\lib\nodes\plugins\TemplateGeneric\bin\Dynamic-1562925283.dynamic.1.dll’
Type: String, CLRType: , SubType: String, , , -1
Type: Func, CLRType: System.Func`1System.Object, SubType: Func
Type: Value, CLRType: , SubType: Integer, 1, 0, -1999999, 1999999, 1, , 4
Type: String, CLRType: , SubType: String, , , -1
Type: Value, CLRType: , SubType: Integer, 1, 0, 0, 1999999, 1, , 4

so it seems to me that

  • Type is one of “Value”, “Color”, “Enum”, “String”, “-> NODE_TYPE_NAME” (input), “NODE_TYPE_NAME ->” (output) or “generic” if node type is unknown
  • CLRType is only set for node types created by plugins (like System.Func`1System.Object)
  • SubType: contains additional info, like min/max/default value etc.

does that help a little?

Mh, a little. The interesting thing for me is to extract this information “from the outside”, means: reflecting on a given subpatch (which is on the same level as the “reflector”) and getting information about the exposed pins. There CLRType is always null, even when the type is “generic”.