Jump to content
Sign in to follow this  
DeehrBYU

"current selection" call?

Recommended Posts

Hi! Been looking through docs and google for quite some time now. I am at a loss for a "current selection" function (ie in maya, "ls -sl" equivalent) I am trying to write a tool that should make guide hair manipulation easier. For my methods anyway.. :)

Thanks!

Share this post


Link to post
Share on other sites

From what I can gather by looking it up, hou.selectedNodes() is what you are looking for.

Share this post


Link to post
Share on other sites

From what I can gather by looking it up, hou.selectedNodes() is what you are looking for.

Thanks for the reply Graham. I saw that before, but I actually need to be able to call up a point I am selecting, not an entire node. Or is there some argument I can put in selectedNodes() in order to be able to grab the point number?

Share this post


Link to post
Share on other sites

If you are searching for geometry information you'll have to make use of a geometry selection, hou.GeometrySelection, to get that info.

For example the following code prompts for a point selection (or uses an existing selection) and returns a space separated list of the points that were selected:

import toolutils
activepane = toolutils.activePane(kwargs)
selection = activepane.selectGeometry(geometry_types=(hou.geometryType.Points,))
points = selection.mergedSelectionString()

This code assumes it is called from a tool on the shelf or through the tab menu in viewer pane and the kwargs dictionary is available. If you are doing it another way you'll need to use toolutils.sceneViewer() instead of activePane().

Edited by graham

Share this post


Link to post
Share on other sites

Awesome, thank you so much. I am not familiar with most of the stuff you said about activePanel and toolUtils but I love diving in to this stuff. Thanks for the great start.

Share this post


Link to post
Share on other sites

I've been trying something similar using the following to grab a the current point selection.

activepane = toolutils.sceneViewer()

selection = activepane.selectGeometry(geometry_types=(hou.geometryType.Points,))

It seems to work fine in some circumstances eg, off the shelf. But I have been trying to implement it in the Code of a python sop which is executed when a button is pressed which in turn switches a toggle. However the script just hangs and when I go to use the selection tool in the scene viewer houdini crashes with a Segmentation Fault.

Any ideas?

Thanks,

Simon

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×