Hello,
I am developing a custom component and want to set Data for a Generic output Parameter.
Having data in nested lists, I wanted to use a GH_Structure to maintain the structure. However, my data is not native to GH and thus not an IGH_Goo.
Is there a workaround to use a GH_Structure with generic data ?
You can use IGH_Goo
to create a wrapper, or directly assign the data.
The difference is when using a wrapper, you can expose certain information from your object that can be seen using a panel
.
If you directly assign data, then it will be something like xxxxx class
.
If you have a class for which you can’t or don’t want to implement the IGH_Goo
interface, you can just wrap the objects using GH_ObjectWrapper
.
This is what GH already does to enable generic objects being passed trough params you define using .AddGenericParameter()
.
If you want to change how your class gets represented in eg. Panel components , like @xliotx suggested, you can also just override the .ToString()
method of your class. GH_ObjectWrapper
will call that each time GH needs a string to represent your object instance somewhere in the UI.