Python - get current sceneViewer(execution from radial menu)

   2187   4   2
User Avatar
Member
8 posts
Joined: 6月 2018
Offline
Hello fellow geeks,
I'm new to Houdini, so my question might sound stupid but, I'm trying to get component(point, prim…) selections from viewports.
As I understand every viewport can have different selections, so the selections should be fetched by viewport.
Got this few lines working:
scene_viewer = toolutils.sceneViewer()
selected_geo = scene_viewer.selectGeometry()
selection_str = selection.selectionStrings()


but the issue is that the viewport is always the main one, it doesn't fetch from others even if I use radial menus which execute these lines.

I even tryied:

toolutils.activePane("sceneViewer")

Anyone know how to call the current active sceneViewer?
Thanks in advance.
User Avatar
Member
538 posts
Joined: 12月 2006
Offline
viewer = hou.ui.paneTabOfType(hou.paneTabType.SceneViewer)
https://gumroad.com/alexeyvanzhula [gumroad.com]
User Avatar
Member
8 posts
Joined: 6月 2018
Offline
Alexey Vanzhula
viewer = hou.ui.paneTabOfType(hou.paneTabType.SceneViewer)

Didn't work mate, it get's always the main scene viewer, no matter from which scene viewer the radial menu item is called.
I quickly made a video capture of my screen to make it more clear what I want to do.
As you can see it always fetches what is in the main sceneViwer, I'm I missing something in here ?
Edited by robert_pashayan - 2020年5月18日 18:29:32
User Avatar
Member
212 posts
Joined: 6月 2023
Offline
This question has bothered me for quite a while. Unfortunately this is the first google search result and it's never answered.

I believe the correct solution is:

viewer = desktop.paneTabUnderCursor()
User Avatar
Member
12 posts
Joined: 11月 2023
Offline
viewer = kwargs["pane"]
Edited by alexeyvanzhula1984 - 2024年2月8日 04:28:07
  • Quick Links