Select nodes interactively

   3469   6   1
User Avatar
Member
14 posts
Joined: Oct. 2010
Offline
Hello everyone.

There is a way to select nodes interactively base on pick up selection via Python, I use normally hou.selectedNodes(, bus this must expect that the nodes are alredy pre-selected. I need to run the script and wait until I select a bounch of nodes and I press enter to make that selection or store it in a avariable as a list.

More or less like the tools provide by SESI that run in scene.viewer context but with nodes( no geometry)

Thanks in advance
editor compositor
User Avatar
Staff
3465 posts
Joined: July 2005
Online
check out http://www.sidefx.com/docs/houdini/hom/hou/SceneViewer.html [www.sidefx.com]


make a new shelf tool and pop this in the Script:
import toolutils

def getSelection():
    """ Get geo selection from user """
    active_pane = toolutils.activePane(kwargs)
    viewer = toolutils.sceneViewer()
    
    thingy = viewer.selectObjects(prompt = "Select object, then press Enter to complete.", )
    
    print thingy
    
    
    
getSelection()


oh wait…you want Network Editor selections?
you can use the above and select nodes in the Network Editor - but you'll need to hit Enter in the Viewport…..
Edited by goldfarb - Sept. 18, 2018 10:09:06
Michael Goldfarb | www.odforce.net
Training Lead
SideFX
www.sidefx.com
User Avatar
Member
14 posts
Joined: Oct. 2010
Offline
First of all thanks a lot for the quick answer!

But there is one problem or maybe I didn't explain my self well.

I need to select nodes in Sop context not in Object context, when I use your script allways jump to obj level and its only possible get selection from nodes in obj context not in the Sop context… Did you know if there is a way to do it??

Thanks a lot in advance.
editor compositor
User Avatar
Staff
3465 posts
Joined: July 2005
Online
http://www.sidefx.com/docs/houdini/hom/hou/SceneViewer.html [www.sidefx.com]
has a bunch of different functions…in the example code I'm using viewer.selectObjects()
but you could use any of the others - for geometry you'd use selectGeometry() and change some of the arguments
Michael Goldfarb | www.odforce.net
Training Lead
SideFX
www.sidefx.com
User Avatar
Member
14 posts
Joined: Oct. 2010
Offline
Thanks a lot but any of them didn't help me.

I want that returns me a tuple of selected nodes like hou.selectednodes() but interactively.

1 - click seft tool
2 - Raise prompt “ select sop Targets” - thats not a problem
3 - Select nodes in Geometry context ( lets say I select add, merge, and a file node
4 - return me a tuple of the selected nodes when I press enter in sceneviewer).

(<hou.SopNode of type add at /obj/geo1/add1>, <hou.SopNode of type merge at /obj/geo1/merge1>, <hou.SopNode of type file at /obj/geo1/file1>)

What I checked with out succes in the hou.sceneviewer are not working for this purpose (maybe I'm wrong or I dont find the way to do it)

1 - selectObjects do the job but only in obj context.
2 - selectGeometry dont work for the case because require a geometry_type ( prims,points,vertex etc) selection.

Thanks a lot
editor compositor
User Avatar
Staff
3465 posts
Joined: July 2005
Online
ahhh….I see now.
Houdini doesn't support that currently.
Michael Goldfarb | www.odforce.net
Training Lead
SideFX
www.sidefx.com
User Avatar
Member
14 posts
Joined: Oct. 2010
Offline
Thanks….. There is or do you know a way to do that???

thanks in advance
editor compositor
  • Quick Links