Search - User list
Full Version: Set Geometry Selection in Viewport (Python)
Root » Technical Discussion » Set Geometry Selection in Viewport (Python)
zdimaria
I can't seem to figure out how to take a hou.GeometrySelection, and set it as selected in a SceneViewer.

I was expecting something along the lines of sceneViewer.setSelectedGeometry(hou.GeometrySelection) but can't find anything to that end in the docs.

What is the correct way to do this?
zdimaria
In addition to this, what type is the argument initial_selection of hou.SceneViewer.selectGeometry() looking for?

I have tried both GeometrySelection and but it returns a TypeError.
mtucker
There is no function to set the selection in a SceneViewer because it is only when in a select state that setting a selection makes any sense. So the closest you can come is to use the initial_selection argument when you call selectGeometry (which puts the viewer in a select state, and sets the selection within that select state). The initial_selection argument is a string which can be anything supported by a SOP Group parameter. Or equivalently, any string returned from GeometrySelection.selectionStrings (but only one string - passing an array of initial selection strings is not supported).

Also keep your eyes open for changes and improvements coming in this area in the upcoming release.

Hope that helps,
Mark
zdimaria
Thanks Mark, this helps a lot.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB