Jump to content

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.

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

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

Link to comment
Share on other sites

  • 7 years later...

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...