megalith Posted July 19, 2007 Share Posted July 19, 2007 (edited) Hey all, Been struggling through figuring out various aspects of the HDK. Already posted on the SideFX forums, but so far no response--you can see it here. Instead of double-posting, I have a similar question instead. In the signature of handleMouseEvent, you have access to UI_Event. What I want to do is somehow distinguish between the start of dragging and the end. The first can be done easily enough if you have the second. The function does not get called on mouse-down, but only seems to get called during a drag or on the mouse-up. I figured that the event->type (UI_EventType) would tell me what I needed, but it is always UI_EVENT_VALUE_CHANGE. The only way to tell the difference that I can see so far is that the value (event->value) is no longer a valid float array, but that is a pretty terrible, hacky, way to see the type of event. Is there some other way to tell? Any help on this would be immensely appreciated! Thanks! ~Joel Edited July 19, 2007 by megalith Quote Link to comment Share on other sites More sharing options...
megalith Posted July 19, 2007 Author Share Posted July 19, 2007 (edited) Can't believe I'm responding to my own message so quickly, but after posting it, I figured out the answer to my own question. Kinda hate it when that happens. Anyways, here is the solution I came up with. It now seems to make a lot of sense. Here is the code I have: // This event happens when you are dragging the mouse or // when the mouse button is released int MSS_Pen::handleMouseEvent(UI_Event *event) { // Get the renderer for this particular viewport RE_Render *re = event->target->getRenderer(); // This gives you the window that the mouse event was // generated from UI_Object *target = event->target; // Bottom-left corner is (0, 0) int x = event->state.values[1]; int y = event->state.values[2]; // event->type is always going to be UI_EVENT_VALUE_CHANGE in // a mouse event handler, so we need to check the reason for // the event instead. if ( event->reason == UI_VALUE_START ) { // Start creating the curve } else if ( event->reason == UI_VALUE_ACTIVE ) { // Add the points } else if ( event->reason == UI_VALUE_CHANGED ) { // Finish creating the curve } return 0; } My question on the other forum still holds, however, so if anyone has any ideas on how to do that one, please do tell! I'm guessing it has something to do with the target, but getting such a generic UI_Object makes it an obscure solution. I've looked through the headers for possible solutions, but so far no luck. So if any of you with more experience with the HDK can shed some light on it, that would be awesome! Thanks! ~Joel Edited July 19, 2007 by megalith Quote Link to comment Share on other sites More sharing options...
sibarrick Posted July 19, 2007 Share Posted July 19, 2007 I have a feeling I asked about this before and the official response was you can't do it yet. I may be miss remembering or it may have been a slightly different issue. Don't get your hopes up though. Quote Link to comment Share on other sites More sharing options...
megalith Posted July 24, 2007 Author Share Posted July 24, 2007 Good news! Ondrej over at the sidefx forums answered the question and gave the solution, so if anyone ever needs to do this, you can find his reply here: Finding Camera Solution. ~Joel Quote Link to comment Share on other sites More sharing options...
sibarrick Posted July 26, 2007 Share Posted July 26, 2007 Cool, that seems to be a new class that wasn't available in H8, that might be very handy. cheers Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.