Jump to content
Sign in to follow this  
logix1390

Python- creating a node from obj to out

Recommended Posts

Hello,

I have run into a problem that needs a bit of python work. Basically what I am trying to do is create a mantra sop in the `out` context when I click a button in the `obj` context.

I found out how to create a node in the same context. For example:

 file_sop = hou.pwd().parent().createNode("file"); file_sop.parm("file").set(hou.pwd().Make_File_Button("sopoutput"))

This will create a file node on spot every time I click the "Make File Button". How can I tell it to place a mantra node in the `out` context where it belongs ?

I'm still a beginner in python, any help would be greatly appreciated . 

I will attach my file for anyone that wants to take a look. 

Thank you

python_make_node_button.hip

Share this post


Link to post
Share on other sites

Try this code in your button.

hou.node("/out").createNode("ifd")

To discover information about any node just drop it into the python shell and print information from the various methods available.

print dir(n), using the variable displayed below, will provide you with the various methods available on any node.

mantra.gif

Edited by Atom

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  

×