I am trying to create a component that can toggle between a Custom defined Component Attributes that I have created and the Classic Component Attributes through the Right click menu.
The Custom Component Attribute is working as expected
Custom Append Additional Component Menu Items also working
I am trying to toggle between the radio bottoms UI and the classic parameter access for a Boolean input but I can’t figure out how to change between my custom component attributes and the classical component attribute.
I found this old post but could not get my head around the discussion.
Any suggestions on how I could achieve my goal? it would be greatly appreciated any recommendation!
I was able to figure out how to switch between Component Default Attributes and the Custom Component Attributes.
I only needed to use the menu toggle bool to flip between the the to logics inside the attributes overrides
Default Component Attributes - (base.Layout / base.render / base.MouseEvent / base.ExpireLayout) and the Custom Component Attributes logic!
But now my issue is that I can’t register the optional input Boolean parameters when I toggle to the Component Default attributes.
I really don’t know whether this is something that requires to be handled in the GH_Component or directly in the GH_ComponentAtrributes Class.
I tried handle this directly in the GH_Component with the menu toggle but does not work and throws an message error when I run the component.
The other thing I can think off is to directly override the custom attributes for the input params not sure how to do it or it may affect the aready existing default Attribute tree :s
Thanks to your example I was able to brake down the process for the toggle style option (Thanks again!).
I had to code it differently to make it compatible with my write a read implementation, but overall logic is similar.
The issue seems to be that when I try to call for RecordUndoEventy(“String”) the component crash.
I have literally no experience nor idea on how to setup undo events , allowing reconnecting wires back to the Boolean toggles and also reverting back to the component previous style state while registering back the parameters.
have you got any thoughts or any way on how to approach this?
All resolved!, standard GH_Component do not supports (De)Serialization for “RecordUndoEvent” for Parameters created outside of the provide standard means (RegisterInputParams), that is why there were issue when undoing /redoing events.
The only way, to properly (De)Serialization the component parameters when undoing or redoing (Ctrl+Z or Ctrl+Y), is by implementing the IGH_VariableParameterComponent interface.
As soon as you implement the interface (empty - with minimum for the methods to run), immediately starts to handling the “RecordUndoEvent” (De)Serialization for the custom Parameters like charm!