Follyx Posted June 24, 2016 Share Posted June 24, 2016 (edited) is it in some way possible to save just selected nodes to a hipfile without any rearrangement or similiar. Maybe a python script? Edited June 24, 2016 by Follyx Quote Link to comment Share on other sites More sharing options...
michael Posted June 24, 2016 Share Posted June 24, 2016 select the nodes ctrl+C open new Houdini session ctrl+V Quote Link to comment Share on other sites More sharing options...
Follyx Posted June 24, 2016 Author Share Posted June 24, 2016 yes, of course. I ment without a new session. Quote Link to comment Share on other sites More sharing options...
mestela Posted June 24, 2016 Share Posted June 24, 2016 I RFE'd this at some point, it'd be super handy. Quote Link to comment Share on other sites More sharing options...
goldleaf Posted June 25, 2016 Share Posted June 25, 2016 Here is some code you can put into a shelf tool (only tested under Linux): import os, time, subprocess sel = hou.selectedNodes() parentNode = "hou.node('/obj')" filePath = "/tmp/myTempNodes" p = sel[0].parent() p.saveChildrenToFile(sel,"",filePath) if p.parent is not hou.node("/obj"): parentNode = "hou.node('/obj').createNode('%s','newparent')" %(p.type().name()) saveCode = '"' + "import os, time; newParent = "+parentNode+"; newParent.loadChildrenFromFile('"+filePath+"'); newPath = '/tmp/hipFromSel_' + time.strftime('%Y%m%d_%H%M%S') + '.hip'; hou.hipFile.save(newPath)" + '"' pyCmd = os.environ["HFS"] + '/bin/hython -c ' + saveCode os.system(pyCmd) print "Saved new hip file" You can save nodes to a file using saveChildrenToFile(); then use loadChildrenFromFile() to read them in as they were saved. Quote Link to comment Share on other sites More sharing options...
f1480187 Posted June 25, 2016 Share Posted June 25, 2016 (edited) I save them in HDA, then extract where I need. If merging from HIP is the final goal of such "hip-snippets", just save in HDA too. Edited June 25, 2016 by f1480187 Quote Link to comment Share on other sites More sharing options...
moregion Posted April 15, 2024 Share Posted April 15, 2024 On 6/25/2016 at 11:18 AM, goldleaf said: Here is some code you can put into a shelf tool (only tested under Linux): import os, time, subprocess sel = hou.selectedNodes() parentNode = "hou.node('/obj')" filePath = "/tmp/myTempNodes" p = sel[0].parent() p.saveChildrenToFile(sel,"",filePath) if p.parent is not hou.node("/obj"): parentNode = "hou.node('/obj').createNode('%s','newparent')" %(p.type().name()) saveCode = '"' + "import os, time; newParent = "+parentNode+"; newParent.loadChildrenFromFile('"+filePath+"'); newPath = '/tmp/hipFromSel_' + time.strftime('%Y%m%d_%H%M%S') + '.hip'; hou.hipFile.save(newPath)" + '"' pyCmd = os.environ["HFS"] + '/bin/hython -c ' + saveCode os.system(pyCmd) print "Saved new hip file" You can save nodes to a file using saveChildrenToFile(); then use loadChildrenFromFile() to read them in as they were saved. filePath = "D:/test/myTempNodes.cpio",Need to add suffix,Only then did it run successfully 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.