yongbin Posted March 20, 2013 Share Posted March 20, 2013 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') dst.setPosition(src.position()+hou.Vector2(2,0)) 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 dst.setParmTemplateGroup(hou_parm_template_group) 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)[/CODE] Quote Link to comment Share on other sites More sharing options...
edward Posted March 21, 2013 Share Posted March 21, 2013 Er, can't you just embed the .otl into the .hip file? (change it in the Windows > Operator Type Manager > preferences, save, change back). Or, you could just allow editing of the HDA and save the .hip file? Quote Link to comment Share on other sites More sharing options...
yongbin Posted March 21, 2013 Author Share Posted March 21, 2013 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.