Jump to content
Sign in to follow this  
evilbear

How to create a file node by click a button

Recommended Posts

Hi all:

I have a question,

Let's say I have a ROP OUTPUT DRIVER, I set up a button in it,

and I want the button to add a file node with correct file path which is the path form ROP OUTPUT DRIVER after click it,

what should I do? I'm new to Houdini scripting, so I have no idea where or how to write it.

Could somebody please show me how to do it?

Thank you.

Share this post


Link to post
Share on other sites

Hi all:

I have a question,

Let's say I have a ROP OUTPUT DRIVER, I set up a button in it,

and I want the button to add a file node with correct file path which is the path form ROP OUTPUT DRIVER after click it,

what should I do? I'm new to Houdini scripting, so I have no idea where or how to write it.

Could somebody please show me how to do it?

Thank you.

If I understood correctly, you're trying to create a file node in a specified network path not on the file system.

If so, then there are 2 ways you can do this but you will need to get the path where you want to create the node.

In hscript:

opcf /obj/geo1 # parent path

opadd file myFile # command to create the node

In python:

myNode = hou.node("/obj/geo1") # parent path

myNode.createNode("file", "myFile") # command to create the node

Cheers,

Ron

Share this post


Link to post
Share on other sites

If I understood correctly, you're trying to create a file node in a specified network path not on the file system.

If so, then there are 2 ways you can do this but you will need to get the path where you want to create the node.

In hscript:

opcf /obj/geo1 # parent path

opadd file myFile # command to create the node

In python:

myNode = hou.node("/obj/geo1") # parent path

myNode.createNode("file", "myFile") # command to create the node

Cheers,

Ron

Hi Rony:

Thank you for replying,

Sorry I didn't explain it clearly,

I'll explain with image, please see the attachment, hope you can understand what I was saying

Thank you so much

post-6758-134120364758_thumb.jpg

Edited by evilbear

Share this post


Link to post
Share on other sites

You can do something like this in the callback field of the button.

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

Share this post


Link to post
Share on other sites

You can do something like this in the callback field of the button.

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

Hi Graham:

Thank you so much.

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  

×