algorithmic modeling for Rhino
Hi all,
I started to play with custom data types and added some preview attribute to one of them using GH_PreviewMeshArgs. My question is quite simple: how can we modify these attributes based on the selected / unselected status of the component that is using this data type? (because it seems that no other material than the default GH material is answering to this).
If someone has a clue...
Thank you,
Thibault Schwartz
Tags:
Found it!
If Attributes.Selected() = True Then ...
And in case someone is searching for the equivalent of the "Enabled" toggle:
If MyBase.Locked() = true Then...
Hi Thibault,
sorry, I didn't realize this is what you were looking for. You're right, to check whether 'you' are selected:
If (Attributes IsNot Nothing) AndAlso (Attributes.Selected) Then
...
End If
To check whether you are enabled:
If (Not Locked) Then
...
End If
And ultimately to check whether you are hidden:
If (Hidden) Then
...
End If
Do note that just because you are hidden it doesn't necessarily mean you shouldn't draw yourself. If the PreviewSelectedObjectsOnly mode is on and you are selected then you should draw yourself regardless of hidden state. Typically Grasshopper will figure out whether you need to draw and only call the DrawViewportXXXX() methods when needed.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Thank you for the tip for PreviewSelectedObjectsOnly David!
T.
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by