stass3d Posted November 25, 2008 Share Posted November 25, 2008 Hi All! I writing a small snippet, which must create a directory for redner ouput path, if it isn`t exist. Also I have a script: import os import hou cnode = hou.pwd() str_nodePath = cnode.path() str_outputPath = hou.ch(str_nodePath+'/dopoutput') str_path = os.path.dirname(str_outputPath) print >> sys.stdout, str_path if not os.path.exists(str_path): os.makedirs(str_path) RThe script is saved on $HIP/scriptname.py path. I have 2 questions: 1. What i need to write in Pre-Render Script Parameter of the ROP? Something like: python $HIP/scriptname.py or? 2. How should I transfer the current ROP to the script? Quote Link to comment Share on other sites More sharing options...
mic Posted November 25, 2008 Share Posted November 25, 2008 hmm maybe you should transfer you currently selected node, which would be you ROP - net = hou.node("/out") selected = net.selectedChildren()[0] (in 9.1.244 build selectedChildern() not yet implemented!) and this would be the argument of your function you written. and then you define your function in Python Source Editor and then easily execute it in pre-render script parameter. Quote Link to comment Share on other sites More sharing options...
stass3d Posted November 25, 2008 Author Share Posted November 25, 2008 hmmmaybe you should transfer you currently selected node, which would be you ROP - net = hou.node("/out") selected = net.selectedChildren()[0] (in 9.1.244 build selectedChildern() not yet implemented!) and this would be the argument of your function you written. and then you define your function in Python Source Editor and then easily execute it in pre-render script parameter. This is not what I really want. If I write this on Hscript, I must just query current node, like this: set SOP = `oppwf()` If I understand right, the render scripts must be node related. But I dont understand the right syntax. Quote Link to comment Share on other sites More sharing options...
anakin78z Posted November 25, 2008 Share Posted November 25, 2008 (edited) Not sure if this is the best way to do it, but what I would do is write your scrips as a function which you then import into houdini, or add to the session module. For example, if I add this to the session module: def poke(): hou.ui.displayMessage(hou.node(".").name()) I can then put this into the Pre-Render Script: hou.session.poke() and it will show the name of the render node before starting the render. The way we do it over here is to have all our common functions like that in a separate file which we then import in the 456.cmd (or py), using simply import ourmodule (or in the case of 456.cmd: python -c "import ourmodule" ) Then, in houdini, you can access any of your functions using ourmodule.functionname(). Cheers, -z Edited November 25, 2008 by anakin78z 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.