Last active
June 20, 2019 11:17
-
-
Save lukpazera/5629217a0ce322a208fa6c9edf53e29b to your computer and use it in GitHub Desktop.
How to set up on idle event in MODO SDK.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "lx_visitor.hpp" | |
/* | |
* OnIdleVisitor is used to perform On Idle Event. | |
* Evaluate() method will be called once the on idle event is registered. | |
* | |
* If you add more methods to this class and want to access them from outside this is how you need to do it: | |
* onIdleVisitorInstance.loc.method(); | |
* You get direct access to this class contents via '.loc'. | |
* Don't ask me why ;). | |
*/ | |
class OnIdleVisitor | |
{ | |
public: | |
LxResult Evaluate (); | |
}; | |
/* | |
* Example class using on idle events. | |
*/ | |
class EventQueue | |
{ | |
public: | |
EventQueue() : | |
_onIdleVisitor() | |
{} | |
private: | |
/* | |
* Call this method when you want to arm on idle event. | |
* Note that only one on idle event can be armed at a time. | |
* This is why we disarm an event that was already there and arm new one. | |
* In my code I make on idle event an event queue. | |
* Each new event adds to the queue. This is to make sure that when on idle event happens | |
* it will process all the events that happened up to the point the event is fired. | |
*/ | |
void _armOnIdleEvent() | |
{ | |
CLxUser_PlatformService platformService; | |
platformService.CancelDoWhenUserIsIdle(_onIdleVisitor, LXfUSERIDLE_MOUSE_BUTTONS_UP | LXfUSERIDLE_CMD_STACK_EMPTY); | |
platformService.DoWhenUserIsIdle(_onIdleVisitor, LXfUSERIDLE_MOUSE_BUTTONS_UP | LXfUSERIDLE_CMD_STACK_EMPTY); | |
} | |
CLxInst_OneVisitor<OnIdleVisitor> _onIdleVisitor; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment