Hi,
All in the title ! BTW it is possible to use a hscript command( bonealigncapture…not sure if there is a python version of this command) in a python context?
I am new to houdini…I must learn python but I dont want to spend to much time with hscript .
I have try the hou.Node.setSelected function but can't find the good arguments…I am not a programmer.
Tky !
how to query the currently selected nodes in python?
8504 4 1-
- labuzz
- Member
- 82 posts
- Joined: Oct. 2007
- Offline
-
- graham
- Member
- 1926 posts
- Joined: Nov. 2006
- Offline
There currently is no single command that will give you the currently selected nodes in Houdini. What you have to do is basically iterate over all the nodes at the current level checking if they are selected. The easiest way to do that is something like:
import toolutils
cwd = toolutils.sceneViewer().pwd()
selected =
Also, you can use hscript commands using hou.hscript() and hou.hscriptExpression()
hou.hscript('chwrite tx test.chan')
hou.hscriptExpression('stamp('../copy1', something, 0)
import toolutils
cwd = toolutils.sceneViewer().pwd()
selected =
Also, you can use hscript commands using hou.hscript() and hou.hscriptExpression()
hou.hscript('chwrite tx test.chan')
hou.hscriptExpression('stamp('../copy1', something, 0)
Graham Thompson, Technical Artist @ Rockstar Games
-
- labuzz
- Member
- 82 posts
- Joined: Oct. 2007
- Offline
hi grahamt,
tks for your answer and sorry for the long delay…I am learning python and oop…
I have a question for you. If I do this :
typecwd = type(cwd)
I am getting this result (at the obj level ):
<class ‘hou.Node’> ( which is the scene level or the world level …not sure if I should call this like that… )
Now if I try something like this:
cwd.type ( based on the hou.Node.type method )
I get this result:
<bound method Node.type of <hou.Node at /obj>>
Can you explain me the result?
tky
tks for your answer and sorry for the long delay…I am learning python and oop…
I have a question for you. If I do this :
typecwd = type(cwd)
I am getting this result (at the obj level ):
<class ‘hou.Node’> ( which is the scene level or the world level …not sure if I should call this like that… )
Now if I try something like this:
cwd.type ( based on the hou.Node.type method )
I get this result:
<bound method Node.type of <hou.Node at /obj>>
Can you explain me the result?
tky
-
- photex
- Member
- 119 posts
- Joined:
- Offline
That's python telling you that ‘type’ is a function.
print cwd.type().name() would tell you the actual type.
Please someone correct anything that's not right here because I'm learning this stuff too.
Added to grahamt's example:
import toolutils
cwd = toolutils.sceneViewer().pwd()
selected =
for node in selected:
print node.type().name()
print cwd.type().name() would tell you the actual type.
Please someone correct anything that's not right here because I'm learning this stuff too.
Added to grahamt's example:
import toolutils
cwd = toolutils.sceneViewer().pwd()
selected =
for node in selected:
print node.type().name()
-
- labuzz
- Member
- 82 posts
- Joined: Oct. 2007
- Offline
-
- Quick Links



Tks photex