I’d like to control component settings accessible from the dropdown menu without actually right-clicking the component. My current solution is to use gates and make multiple components, but I’m working on a big definition and sketching ideas quickly; it got me thinking that maybe there is a nice hacky way to do this. Definitely open to writing some code to get it done, if someone would point me in the right direction…
Here’s an example: I want to control the text that says “Perspective.”
In the case of the Custom Preview component this property is exposed and can be manipulated with a short script. Different components will require different strategies to affect their right-click menu options.
The example here uses Metahopper to grab the component and then a script to manipulate its ViewportFilter property (as well as some cleanup stuff for consistency with the component UI behavior.)
private void RunScript(object x, string y, ref object A)
{
var comp = x as GH_CustomPreviewComponent;
comp.ViewportFilter = y;
comp.Message = y;
comp.Attributes.ExpireLayout();
}