I'm trying to write a custom Python SOP viewer state, where, whenever I start dragging the mouse:
If some visible geometry is under the cursor when the dragging starts, do something in my custom state.
If no visible geometry is under the cursor when the dragging starts, temporarily enter the `sopview` state (manipulating the viewport camera). Return to my custom state when the dragging stops.
So it's like a ZBrush style camera manipulator, where you don't have to hold down the Option/Alt key to transform the camera, as long as nothing is under the cursor when you start a mouse drag.
The first seems feasible with onMouseEvent by testing for a visible geometry when LMB is down. For the second one I don't think what you suggest is feasible. Did you consider using the same python state instead ? With onMouseEvent you could manipulate the viewport camera when there is no visible geometry under the mouse like you said.
mabelzile Did you consider using the same python state instead ? With onMouseEvent you could manipulate the viewport camera when there is no visible geometry under the mouse like you said.
Thanks mab! I'll do that. I thought about it but was too lazy..
Btw, do you happen to have any example file on viewport camera manipulation? Again I'm just a bit lazy so if you don't have one at the moment I'll go figure it out by myself.
mabelzile Did you consider using the same python state instead ? With onMouseEvent you could manipulate the viewport camera when there is no visible geometry under the mouse like you said.
Thanks mab! I'll do that. I thought about it but was too lazy..
Btw, do you happen to have any example file on viewport camera manipulation? Again I'm just a bit lazy so if you don't have one at the moment I'll go figure it out by myself.
I don't but take a look at hou.GeometryViewport.defaultCamera()