class TestTemplate(object): _drawable_geo = hou.Geometry() circle = hou.sopNodeTypeCategory().nodeVerb("circle") circle.setParms({ "type": 2 }) circle.execute(_drawable_geo, []) del circle def __init__(self, scene_viewer, state_name): self.scene_viewer = scene_viewer self.state_name = state_name self._drawable = hou.SimpleDrawable(self.scene_viewer, self._drawable_geo, "test_drawable") def onGenerate(self, kwargs): self._drawable.enable(True) self._drawable.show(True) self.scene_viewer.curViewport().draw() # UNREGISTER if hou.ui.isRegisteredViewerState('test_state'): hou.ui.unregisterViewerState('test_state') # CREATE AND REGISTER template = hou.ViewerStateTemplate('test_state', 'Test State', hou.sopNodeTypeCategory()) template.bindFactory(TestTemplate) hou.ui.registerViewerState(template) # ACTIVATE scene_viewer = hou.ui.paneTabOfType(hou.paneTabType.SceneViewer) scene_viewer.setCurrentState("test_state")
Found 536 posts.
Search results Show results as topic list.
Technical Discussion » Python Viewer States Issues
- Alexey Vanzhula
- 538 posts
- Offline
In this example, I want the circle to appear immediately after the state is activated. But it appears only after I start to manipulate the viewport using the Alt key.
Technical Discussion » Python Viewer States Issues
- Alexey Vanzhula
- 538 posts
- Offline
Thank you for answers!
Yes, but this did not work in my case. I will show my example in a few hours
mabelzilevux
Currently, we can't draw the drawable geometry immediately after activating the state in the onEnter or onGenerate methods. In the current Python states implementation, we must first move the mouse to update the drawables. So, we need a method to force update.
Use `hou.GeometryViewport.draw()` to force a redraw.
Yes, but this did not work in my case. I will show my example in a few hours
Technical Discussion » hou.SceneViewer.isWorldSpaceLocal
- Alexey Vanzhula
- 538 posts
- Offline
tamte
usually when your scene viewer is at SOP level and you show or ghost other objects, you are in true world space
if you Hide Other Objects, you are in object space of the current object sops belong to
so in the first case you should get False in second True
Thanks, I got it!
Technical Discussion » hou.SceneViewer.isWorldSpaceLocal
- Alexey Vanzhula
- 538 posts
- Offline
Hi. How to use the hou.SceneViewer.isWorldSpaceLocal method? It always returns False. The documentation did not help.
Technical Discussion » Python Viewer States Issues
- Alexey Vanzhula
- 538 posts
- Offline
Technical Discussion » Python Viewer States Issues
- Alexey Vanzhula
- 538 posts
- Offline
Currently, we can't draw the drawable geometry immediately after activating the state in the onEnter or onGenerate methods. In the current Python states implementation, we must first move the mouse to update the drawables. So, we need a method to force update.
Edited by Alexey Vanzhula - 2019年12月22日 09:18:36
Technical Discussion » Problem with nodeless python states
- Alexey Vanzhula
- 538 posts
- Offline
Technical Discussion » Python Viewer States Issues
- Alexey Vanzhula
- 538 posts
- Offline
In H17.5 and H18 I can't change the wireframe display mode color with the hou.SimpleDrawable.setWireframeColor method.
Technical Discussion » SceneViewer as QWidget in H18
- Alexey Vanzhula
- 538 posts
- Offline
Technical Discussion » Python Viewer States Issues
- Alexey Vanzhula
- 538 posts
- Offline
Technical Discussion » Python Viewer States Issues
- Alexey Vanzhula
- 538 posts
- Offline
I have solve the problem myself
Anyway, according to the documentation:
this value have to be True by default, but in fact it is not.
def onGenerate(self, kwargs): kwargs['state_flags']['mouse_drag'] = True
Anyway, according to the documentation:
Mouse drag events are generated by default (True)
this value have to be True by default, but in fact it is not.
Edited by Alexey Vanzhula - 2019年12月15日 08:30:56
Technical Discussion » Python Viewer States Issues
- Alexey Vanzhula
- 538 posts
- Offline
I decided to post python viewer states problems in this thread.
In H17.5, after activation with onResume method, the state continues to generate the mouse move event (hou.uiEventReason.Located). But in H18 this type of event stops happening.
Test build: Houdini 18.0.318 Linux version
In H17.5, after activation with onResume method, the state continues to generate the mouse move event (hou.uiEventReason.Located). But in H18 this type of event stops happening.
Test build: Houdini 18.0.318 Linux version
Edited by Alexey Vanzhula - 2019年12月15日 08:16:45
Technical Discussion » SceneViewer as QWidget in H18
- Alexey Vanzhula
- 538 posts
- Offline
@pezetko
Great! Even my function works. All I need is to declare main_widget as global variable. Thank you!
Great! Even my function works. All I need is to declare main_widget as global variable. Thank you!
Edited by Alexey Vanzhula - 2019年12月11日 07:38:22
Technical Discussion » SceneViewer as QWidget in H18
- Alexey Vanzhula
- 538 posts
- Offline
Technical Discussion » SceneViewer as QWidget in H18
- Alexey Vanzhula
- 538 posts
- Offline
Stackenblocken-Sidefxsame result
What happens if you cast the widget pointer to int instead of long?
Technical Discussion » SceneViewer as QWidget in H18
- Alexey Vanzhula
- 538 posts
- Offline
So, the changes in H18 broke my tools.
This code works well in H17.5, but gives an error in H18. Please help me.
This code works well in H17.5, but gives an error in H18. Please help me.
import shiboken2 import PySide2.QtWidgets as qtw def get_viewer_widget(): main_widget = hou.qt.mainWindow() for widget in main_widget.findChildren(qtw.QWidget, 'RE_Window'): if widget.windowTitle() == 'DM_ViewLayout': for l in widget.findChildren(qtw.QVBoxLayout): if l.count()==1: w = l.itemAt(0).widget() if w.objectName() == 'RE_GLDrawable': i = long(shiboken2.getCppPointer(w)[0]) mouse_widget = shiboken2.wrapInstance(i, qtw.QWidget) return mouse_widget
Edited by Alexey Vanzhula - 2019年12月9日 23:39:23
Technical Discussion » SceneViewer as QWidget in H18
- Alexey Vanzhula
- 538 posts
- Offline
Why we still don’t have a native way to get scene viewer area as Qt widget? Why it is not a problem for Maya and Modo for many years. After every major release I have to come up with a new way to fix the problem
3rd Party » DM 2
- Alexey Vanzhula
- 538 posts
- Offline
Houdini Lounge » Will we be able to select&edit multiple points in Curve node in Houdini 18?
- Alexey Vanzhula
- 538 posts
- Offline
goatvux
The next goal is an effective curve tool based on python states.
free tool?
I think, when it will be finished, I will upload it as a free tool
Edited by Alexey Vanzhula - 2019年11月9日 13:37:06
Houdini Lounge » Will we be able to select&edit multiple points in Curve node in Houdini 18?
- Alexey Vanzhula
- 538 posts
- Offline
-
- Quick Links