Jump to content

Python- creating a node from obj to out


logix1390

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

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