Hi , how to auto create folder just like maya??
the render or cache file, always need give the right path.
how cloud I let houdini auto detect if path folder exist,
if not exist then will create one folder?
thank you advance!! :wink:
Hi , how to auto create folder just like maya??
13321 9 6- wei750830
- Member
- 46 posts
- Joined: 1月 2012
- Offline
- protozoan
- Member
- 1720 posts
- Joined: 3月 2009
- Offline
This has been a theological dispute for quite some time.
Right now the “the pipeline should do it, not Houdini”-disciples are in favor of the gods and so.. you can't do it.
*What you can do of course is create a script that creates folders and ROPs accordingly, that's what I meant with “pipeline”, but for all I know you can't force the ROP to create it
Right now the “the pipeline should do it, not Houdini”-disciples are in favor of the gods and so.. you can't do it.
*What you can do of course is create a script that creates folders and ROPs accordingly, that's what I meant with “pipeline”, but for all I know you can't force the ROP to create it
Martin Winkler
money man at Alarmstart Germany
money man at Alarmstart Germany
- pinkwerks
- Member
- 49 posts
- Joined: 1月 2007
- Offline
In ROPs at least, ‘Pre-Render Script’ is your friend. Make a Geometry ROP, set the expression type to python then copy pasta this:
import os
path = os.path.dirname(hou.parm('sopoutput').eval())
if not os.path.exists(path):
os.makedirs(path)
Optionally, you can then click on the gear icon and ‘Save as permanant defaults’ - now everytime you create a Geometry ROP you will get a bit of code that makes sure your ‘sopoutput’ (Output File) generates a valid directory. Of course you can tweak the above script to death but it's functional.
For instance, you could substitute ‘sopoutput’ for ‘soho_diskfile’ if this was a Mantra ROP…
import os
path = os.path.dirname(hou.parm('sopoutput').eval())
if not os.path.exists(path):
os.makedirs(path)
Optionally, you can then click on the gear icon and ‘Save as permanant defaults’ - now everytime you create a Geometry ROP you will get a bit of code that makes sure your ‘sopoutput’ (Output File) generates a valid directory. Of course you can tweak the above script to death but it's functional.
For instance, you could substitute ‘sopoutput’ for ‘soho_diskfile’ if this was a Mantra ROP…
- grayOlorin
- Member
- 1799 posts
- Joined: 10月 2010
- Offline
Another option is to use a shell ROP to run a shell command that creates the folder (mkdir in windows). If the folder already exists, it will just spit out that the folder already exists (you can even wrap that as a digital asset with simply using a folder input).
Although i agree the pipeline should handle it, i also see no harm in adding to ROP type operators perhaps a tag to “create output folder if it does not exist”? then that way the user can choose to either make his/her own pipeline or use a built in “create a folder” convenience. I can understand in some cases, it is good to catch that the incorrect folder was inputted, but in some cases, it may do no harm to create the folder if it is applicable in this situation. It all comes down to accessibility
Alternatively, I would at least recommend a noticeable error when the folder does not exist as it currently it is quite quiet when the folder does not exist and it fails to save the file
Although i agree the pipeline should handle it, i also see no harm in adding to ROP type operators perhaps a tag to “create output folder if it does not exist”? then that way the user can choose to either make his/her own pipeline or use a built in “create a folder” convenience. I can understand in some cases, it is good to catch that the incorrect folder was inputted, but in some cases, it may do no harm to create the folder if it is applicable in this situation. It all comes down to accessibility
Alternatively, I would at least recommend a noticeable error when the folder does not exist as it currently it is quite quiet when the folder does not exist and it fails to save the file
-G
- wei750830
- Member
- 46 posts
- Joined: 1月 2012
- Offline
Thanks All Advance to help me so quick^^
pinkwerks' script is veryuseful!
I just write a Shell version to detected the folder is exist or not.
here is code:
import os
sel = hou.selectedNodes()
for n in sel:
tempPath = n.evalParm('vm_picture')
print tempPath
oldPath = tempPath.split('/')
print oldPath
oldPath_new = oldPath
print oldPath_new
tempPath =
for i in range(0,len(oldPath_new),1):
tempPath.append(oldPath_new)
print tempPath
newPath = os.sep.join(tempPath)
print newPath
if os.path.exists(newPath) == False:
os.mkdir(newPath)
but !
pinkwerks , thanks a lot .
your script always get amazing work^^
short script and very helpful , thx!
pinkwerks' script is veryuseful!
I just write a Shell version to detected the folder is exist or not.
here is code:
import os
sel = hou.selectedNodes()
for n in sel:
tempPath = n.evalParm('vm_picture')
print tempPath
oldPath = tempPath.split('/')
print oldPath
oldPath_new = oldPath
print oldPath_new
tempPath =
for i in range(0,len(oldPath_new),1):
tempPath.append(oldPath_new)
print tempPath
newPath = os.sep.join(tempPath)
print newPath
if os.path.exists(newPath) == False:
os.mkdir(newPath)
but !
pinkwerks , thanks a lot .
your script always get amazing work^^
short script and very helpful , thx!
- pelos
- Member
- 621 posts
- Joined: 8月 2008
- Offline
- tas3d
- Member
- 120 posts
- Joined: 1月 2012
- Offline
i cant get it workin
i pase this script into pre-render parameter
import os
path = os.path.dirname(hou.parm('soho_diskfile').eval())
if not os.path.exists(path):
os.makedirs(path)
this is what i put in output path in ROP node:
$HIP/render/$HIPNAME/$HIPNAME.$F4.exr
then i get this error:
im on H12.5 and ubuntu
any fix for that ?
i pase this script into pre-render parameter
import os
path = os.path.dirname(hou.parm('soho_diskfile').eval())
if not os.path.exists(path):
os.makedirs(path)
this is what i put in output path in ROP node:
$HIP/render/$HIPNAME/$HIPNAME.$F4.exr
then i get this error:
User defined plane attribute ‘device:IPlay.s3dleftplane’ ‘string’
User defined plane attribute ‘device:IPlay.s3drightplane’ ‘string’
User defined plane attribute ‘device:IPlay.rendermode’ ‘string’
User defined plane attribute ‘device:IPlay.framerange’ ‘string’
User defined plane attribute ‘device:IPlay.currentframe’ ‘real’
User defined plane attribute ‘device:IPlay.rendersource’ ‘string’
User defined plane attribute ‘device:IPlay.houdiniportnum’ ‘int’
Generating Image: /home/tas/Documents/HoudiniProjects/sub/render/sub17.hipnc/sub17.hipnc.0038.exr (768x431)
Plane: Cf+Af (16-bit float)
SampleFilter: alpha
PixelFilter: gaussian 2 2
VEX Type: vector4
Dither: 0.5
Gamma: 1
Gain: 1
White point: 1
mantra: Could not open imager
Error: Failed to create file “/home/tas/Documents/HoudiniProjects/sub/render/sub17.hipnc/sub17.hipnc.0038.exr : No such file or directory”.
im on H12.5 and ubuntu
any fix for that ?
Michal Tas Maciejewski @ www.vfxtricks.com
- edward
- Member
- 7903 posts
- Joined: 7月 2005
- Offline
- tas3d
- Member
- 120 posts
- Joined: 1月 2012
- Offline
- theAdmira1
- Member
- 7 posts
- Joined: 11月 2008
- Offline
-
- Quick Links