Wondering if it is possible to do something similar to RegisterInputParameters on an image sampler so that I can have multiple inputs with different information into the Image Sampler Component. I’m guessing it has something to do with ‘AddSource’ but can’t quite figure out how to get it to run.
Cheers.
> using System;
> using Grasshopper.Kernel;
>
> namespace library
> {
> public class my_component : Grasshopper.Kernel.Special.GH_ImageSampler
> {
>
> public my_component() : base()
> {
> base.Category = "library";
> base.SubCategory = "library_sub";
> }
>
> public override Guid ComponentGuid
> {
> get { return new Guid("12ac74ea-cf57-4796-a702-38aa7e6e9048"); }
> }
AddSource would only connect another object to the input.
I do notice that GH_ImageSampler inherits from IGH_Goo
However that isn’t much help as there is no RegisterInputParameter, nor is there a solver instance to override.
I think you need to modify the CreateAtributes to have a second input node and then add in all necessary properties to get the wire working.
It would probably be better to create a component from GH_Component and override the attributes of the box size and what the box displays.
GH_ImageSampler inherits from GH_Param< IGH_Goo>, so it is a parameter and as such cannot have multiple inputs or outputs. Component inputs and outputs has nothing to do with object attributes, it is just the display. Sources/Targets are what you plug to inputs/outpus, not the input/output parameters. So, the only way to have a version with more parameters is inheriting from GH_Component and recreate its logic or use it internally.