Jump to content

"current selection" call?


DeehrBYU

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!

Link to comment
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?

Link to comment
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
Link to comment
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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...