Jump to content

How to run the code generated by hou.Node.asCode()?


magneto

Recommended Posts

Hi,

 

I wrote the outputs of this function into a text file but I don't know how to run this Python code in Houdini. File > Run Script only support .cmd files.

 

I pasted the contents into the Python shell but it only created the container, and then errored out saying it couldn't find the parm.

 

 

 

Thanks.

Link to comment
Share on other sites

exec()

import hou

out = hou.selectedNodes()[0]    #select first selected node
strCode = out.asCode(True,True) #get code, skip defaults, recursively
out.setName("newName",1)        #rename old node
exec(strCode)                   #run saved code
out.moveToGoodPosition()        #move old node so it's not overlapping


 

  • Like 1
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...