Problem with nodeless python states

   2446   10   1
User Avatar
Member
538 posts
Joined: Dec. 2006
Offline
In some situations, nodeless python states lose their ability to generate a mouse click event (hou.uiEventReason.Picked), but other events works as expected. For example, as I noticed, if you use the PolySplit tool or EdgeLoop tool, the subsequent state calls no longer detect mouse clicks.
https://gumroad.com/alexeyvanzhula [gumroad.com]
User Avatar
Staff
397 posts
Joined: Feb. 2018
Offline
Can you post your python state code, I'll have a look.
User Avatar
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
https://gumroad.com/alexeyvanzhula [gumroad.com]
User Avatar
Member
538 posts
Joined: Dec. 2006
Offline
_mab_
Can you post your python state code, I'll have a look.
Hi. Is there any news?
https://gumroad.com/alexeyvanzhula [gumroad.com]
User Avatar
Staff
397 posts
Joined: Feb. 2018
Offline
Seems to work fine here but I don't know what your setup is and what Houdini version you are using. Could you add a scene with your repro steps please ?

Edited by mabelzile - Feb. 15, 2019 09:11:59

Attachments:
vux.PNG (121.7 KB)

User Avatar
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!
https://gumroad.com/alexeyvanzhula [gumroad.com]
User Avatar
Staff
397 posts
Joined: Feb. 2018
Offline
vux
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!
I get the ‘click’ with my scene as well. Can you try the attached scene ?

Image Not Found

Attachments:
test_viewerstate.hip (106.8 KB)

User Avatar
Staff
397 posts
Joined: Feb. 2018
Offline
I was able to get the ‘click’ message but after some time, the picked event is no longer generated. I'm not sure it's caused by PolySplit itself, it seems broken even with the python state alone.

Could you file a bug ?
User Avatar
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
https://gumroad.com/alexeyvanzhula [gumroad.com]
User Avatar
Member
538 posts
Joined: Dec. 2006
Offline
The issue still not fixed in H18
https://gumroad.com/alexeyvanzhula [gumroad.com]
User Avatar
Member
136 posts
Joined: Aug. 2015
Offline
Hello,

I know this is super late but I ran into the same issue, I fixed it by adding a prev UI Event Reason variable, if it == Start, then it's picked. :p
  • Quick Links