Get the prim under the cursor in Solaris

   1456   5   1
User Avatar
Member
61 posts
Joined: Oct. 2013
Offline
I'm exploring python viewer states as a means to add functionality to Solaris. It seems neither viewport.queryNodeAtPixel() or viewport.queryPrimAtPixel() are available in Solaris viewports. Is there another function that provides the same functionality?

I'm just looking to shoot a ray in to the scene and figure out which USD prim it's hitting, perhaps there's another way to achieve that?
Grant Miller
VFX Supervisor
Ingenuity Studios
User Avatar
Staff
4435 posts
Joined: July 2005
Offline
locateSceneGraphPrim()?
User Avatar
Member
61 posts
Joined: Oct. 2013
Offline
Amazing, thanks! Was sniffing up the wrong tree in GeometryViewport.

It seems like a lot of SceneGraph functionality lives in SceneViewer which is good to know and hopefully prevents future questions
Grant Miller
VFX Supervisor
Ingenuity Studios
User Avatar
Member
61 posts
Joined: Oct. 2013
Offline
Celebrated a wee bit too soon. First stumble was that these functions aren't available in .391, but show up in the latest (glad I checked).

Secondly, even w/ a single cube primitive covering the entire screen, I'm unable to get anything but (0, “”) as a return result.

See the attached example, here's my code:

>>> import toolutils
>>> viewer = toolutils.sceneViewer()
>>> vp = viewer.curViewport()
>>> vp.resolutionInPixels()
(1741, 1001)
>>> viewer.locateSceneGraphPrim(870, 500)
(0.0, '')
Edited by blented - March 29, 2020 16:12:41

Attachments:
basic_test.png (293.5 KB)

Grant Miller
VFX Supervisor
Ingenuity Studios
User Avatar
Staff
5156 posts
Joined: July 2005
Offline
This should be fixed in 18.0.424. I'm a little surprised it didn't crash on you
User Avatar
Member
61 posts
Joined: Oct. 2013
Offline
Awesome thanks for the update, those are the best kind of surprises lol.

Confirmed working in 425! I feel like this really unlocks a lot of ideas I have
Grant Miller
VFX Supervisor
Ingenuity Studios
  • Quick Links