Jump to content

copy otl to subnet

Recommended Posts

Hi guys~

Recently I made this code for let otl stick to a hip file.

But in this case .asCode() method seems not very intuitive.

And there is some bugs too!

Is there a any better method for it?

Or someone achieved this before?

Help me~ :)

sels = hou.selectedNodes()
context = sels[0].parent()
for src in sels:
dst = context.createNode('subnet',node_name='testname')
templatecode = src.parmTemplateGroup().asCode()

# fix bugs of the templatecode
templatecode=templatecode.replace(", ,", ',')
templatecode=templatecode.replace('default_expression_language=hou.scriptLanguage.Hscripticon_names=([]),', '')

exec templatecode #hou_parm_template_group automatically made by the code

srccode = src.asCode()
srccode = srccode.replace(src.name(),dst.name())
srccode = srccode.replace(src.type().name(),dst.type().name())
srccodelist = srccode.split('\n\n')
srccodelist.pop(1) # delete node creation code
srccode = '\n\n'.join(srccodelist)
exec srccode #hou_node and hou_parent created by the code
del hou_node
del hou_parent
hou.copyNodesTo(src.children(), dst)

Link to comment
Share on other sites

Hi edward~ thank you for your answer!

I use those methods... but It seems not really split with otl nodes from their otl files.

Yes, I said "stick to hip files". But sorry, I really want is freeing otls.

I had some issues from it. (render farm issues, sending hip to others, or even my personal favorite..)

I don't know.. maybe these happened cause I don't have enough knowledge with otl or otl preferences.. anyway.. now I don't want to see the "embed" mark on the otl definition tab.

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.

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