Hi,
I have a old pre-render scipt in hscript as follows ..
unix mkdir -p /jobs/renderNode/shots/`chs(“../whichShot”)`/RENDER/$USER/`chs(“../whichShot”)`_v`padzero(3,ch(“../version”))`/ifd ;
unix mkdir -p /jobs/renderNode/shots/`chs(“../whichShot”)`/RENDER/$USER/`chs(“../whichShot”)`_v`padzero(3,ch(“../version”))`/`chs(“../whichShot”)`_beauty_v`padzero(3,ch(“../version”))` ;
set howMany = `ch(“../howManyPasses”)`
set name = ‘chs(“../name’
set i = 1
while ( $i <= $howMany)
unix mkdir -p /jobs/renderNode/shots/`chs(”../whichShot“)`/RENDER/$USER/`chs(”../whichShot“)`_v`padzero(3,ch(”../version“))`/`chs(”../whichShot“)`_`chs(”../name$i“)`_v`padzero(3,ch(”../version"))`
set i = `$i+1`
end
How would I do the same thing as a python script….
I tried making a simple python script with just
print ‘hello’
and that wouldn't work ….
My hda would error with “error rendering child: /out/renderNode1/mantra”
Any pointers would be a great help!
Stephen
How to convert an old pre-render hscript script to python
4158 5 0- anon_user_47126064
- Member
- 24 posts
- Joined: Feb. 2010
- Offline
- graham
- Member
- 1907 posts
- Joined: Nov. 2006
- Offline
Something like this should work if you switch the script to Python and go RMB->Expression->Edit String and paste it in.
import os
ropnode = hou.pwd()
shot = ropnode.evalParm(“whichShot”)
version = ropnode.evalParm(“version”)
num_passes = ropnode.evalParm(“howManyPasses”)
user = os.environ
os.mkdirs(“/jobs/renderNode/shots/%s/RENDER/%s/%s_v%03d/ifd” % (shot, user, shot, version))
os.mkdirs(“/objs/renderNode/shots/%s/RENDER/%s/%s_v%03d/%s_beauty_v%03d” % (shot, user, shot, version, shot, version))
for i in range(num_passes):
os.mkdirs(“/ojbs/renderNode/shots/%s/RENDER/%s/%s_v%03d/%s_%s_v%03d” % (shot, user, shot, version, shot, ropnode.evalParm(“name%s” % i), version))
import os
ropnode = hou.pwd()
shot = ropnode.evalParm(“whichShot”)
version = ropnode.evalParm(“version”)
num_passes = ropnode.evalParm(“howManyPasses”)
user = os.environ
os.mkdirs(“/jobs/renderNode/shots/%s/RENDER/%s/%s_v%03d/ifd” % (shot, user, shot, version))
os.mkdirs(“/objs/renderNode/shots/%s/RENDER/%s/%s_v%03d/%s_beauty_v%03d” % (shot, user, shot, version, shot, version))
for i in range(num_passes):
os.mkdirs(“/ojbs/renderNode/shots/%s/RENDER/%s/%s_v%03d/%s_%s_v%03d” % (shot, user, shot, version, shot, ropnode.evalParm(“name%s” % i), version))
Graham Thompson, Technical Artist @ Rockstar Games
- anon_user_47126064
- Member
- 24 posts
- Joined: Feb. 2010
- Offline
Thanks for the help … not sure - but I think I may have found a bug?
I stripped it all right down - see the attached files
The python script is now vey basic and yet it still won't make a directory … is this a bug or am I missing something?
I am using houdini 11.0.426
the python pre-render script is only …
import os
p = “/tmp/rub/grub/pub”
os.makedirs( p, 0777)
and pre-render script is set to python
Thanks in advance
stephen
I stripped it all right down - see the attached files
The python script is now vey basic and yet it still won't make a directory … is this a bug or am I missing something?
I am using houdini 11.0.426
the python pre-render script is only …
import os
p = “/tmp/rub/grub/pub”
os.makedirs( p, 0777)
and pre-render script is set to python
Thanks in advance
stephen
- graham
- Member
- 1907 posts
- Joined: Nov. 2006
- Offline
I don't think it will actually run disk files as python. What you can do is just put the code in the parameter. You could also have the code in a module somewhere in your script path and then just import it and call the function.
The code I posted above was intended to just be placed in the parameter, not a script file.
The attached file just has the code from new.py placed into the parameter and works fine for me.
The code I posted above was intended to just be placed in the parameter, not a script file.
The attached file just has the code from new.py placed into the parameter and works fine for me.
Graham Thompson, Technical Artist @ Rockstar Games
- anon_user_47126064
- Member
- 24 posts
- Joined: Feb. 2010
- Offline
- anon_user_47126064
- Member
- 24 posts
- Joined: Feb. 2010
- Offline
-
- Quick Links