algorithmic modeling for Rhino
My colleagues and I are working on some Python code which includes a heads up display containing information about the model.
We'd like for the HUD to only appear when the user is not moving the viewport around, or, in other words, when the current viewport camera is stationary for more than, say, a couple seconds.
Is there a way to listen for an event like a stationary camera?
Tags:
doing such a thing requires - if I'm not mistaken - a bit of fancy footwork. There are events associated with camera motion - but in order to evaluate that a camera has NOT moved, you'll need to start a timer going in a background thread after every camera move that gets reset whenever the camera moves again - and once that timer hits a time threshold it triggers some delegate function.
Disclaimer: I know very little about event handling and even less about threading! so this could all be 100% wrong.
Although, upon rereading your question, it looks like you're doing it in python. You could activate the python component via the boolean returned, in that case.
I've attached a version using GHPython to get the camera location of the active viewport and a subsequent component which uses the sticky to store this vector and check the difference between the stored and the current vector. I think it should be possible to develop this logic within the same GHPython component. Hope that helps get the ball rolling :)
Just noticed that it only worked in perspective view. Added a tolerance input for checking if camera locations are the same. Attached..
Thank you Andrew, Dan, and Anders for your time! Very generous of you.
Will look into these suggestions this week.
B
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
© 2024 Created by Scott Davidson. Powered by