Problem with nodeless python states
2446 10 1- Alexey Vanzhula
- Member
- 538 posts
- Joined: Dec. 2006
- Offline
- mabelzile
- Staff
- 397 posts
- Joined: Feb. 2018
- Offline
- Alexey Vanzhula
- Member
- 538 posts
- Joined: Dec. 2006
- Offline
_mab_
Can you post your python state code, I'll have a look.
Thanks for answer
import hou class TestTemplate(object): def __init__(self, scene_viewer, state_name): self.scene_viewer = scene_viewer self.state_name = state_name def onGenerate(self, kwargs): self.scene_viewer.setPromptMessage('Hello World!') self._drag_started = False def onMouseEvent(self, kwargs): event = kwargs["ui_event"] reason = event.reason() # MOUSE MOVE if reason == hou.uiEventReason.Active and self._drag_started: print 'mouse drag' # MOUSE PRESS elif reason == hou.uiEventReason.Start: print 'mouse press' self._drag_started = True # MOUSE CLICK elif reason == hou.uiEventReason.Picked: print 'click' # MOUSE RELEASE elif reason == hou.uiEventReason.Changed and self._drag_started: print 'mouse release' self._drag_started = False template = hou.ViewerStateTemplate('test_state', 'Test State', hou.sopNodeTypeCategory()) template.bindFactory(TestTemplate) hou.ui.registerViewerState(template)
It is just simple example script. It works well and prints “click” when I invoke mouse click. But it stops generate click events after using EdgeLoop (or PolySplit) SOP state
Edited by Alexey Vanzhula - Feb. 11, 2019 09:03:28
- Alexey Vanzhula
- Member
- 538 posts
- Joined: Dec. 2006
- Offline
- mabelzile
- Staff
- 397 posts
- Joined: Feb. 2018
- Offline
- Alexey Vanzhula
- Member
- 538 posts
- Joined: Dec. 2006
- Offline
1. Houdini Linux version: 17.0.491
2. In your image I see mouse press and release events. But click is another event (hou.uiEventReason.Picked), which invokes when mouse quickly released without moving. Can you test my script from Python Source Editor? In my H17 click event occurs and script prints “click”, but only if I don't use polysplit or edgeloop states before.
Thank you!
2. In your image I see mouse press and release events. But click is another event (hou.uiEventReason.Picked), which invokes when mouse quickly released without moving. Can you test my script from Python Source Editor? In my H17 click event occurs and script prints “click”, but only if I don't use polysplit or edgeloop states before.
Thank you!
- mabelzile
- Staff
- 397 posts
- Joined: Feb. 2018
- Offline
vuxI get the ‘click’ with my scene as well. Can you try the attached scene ?
1. Houdini Linux version: 17.0.491
2. In your image I see mouse press and release events. But click is another event (hou.uiEventReason.Picked), which invokes when mouse quickly released without moving. Can you test my script from Python Source Editor? In my H17 click event occurs and script prints “click”, but only if I don't use polysplit or edgeloop states before.
Thank you!
Image Not Found
- mabelzile
- Staff
- 397 posts
- Joined: Feb. 2018
- Offline
- Alexey Vanzhula
- Member
- 538 posts
- Joined: Dec. 2006
- Offline
_mab_
PolySplit
Same thing with your file. It is not only PolySplit bug. Something happens with scene viewer. If I start this state in new scene viewer click event starts working until you start using PolySplit state. There are other situations when click event broke scene viewer, but I can't remember when it was
Edited by Alexey Vanzhula - Feb. 15, 2019 13:04:19
- Alexey Vanzhula
- Member
- 538 posts
- Joined: Dec. 2006
- Offline
- Wout Tengrootenhuysen
- Member
- 136 posts
- Joined: Aug. 2015
- Offline
-
- Quick Links