Grasshopper

algorithmic modeling for Rhino

Can we update custom data types PreviewMeshArgs based on a component status?

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

Views: 299

Replies to This Discussion

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.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service