Jump to content
Sign in to follow this  
DerQualle

Get File directory from Input and use in output

Recommended Posts

Hi there!

I'm trying to make a little ACES image converter HDA and I'm a bit stuck right now.
I have a File node in my Cop2 network. This then passes through a vopcop to convert the image.
Afterwards I added a rop File output to output the file. Now here is the part where I'm Stuck:
I want the File Output to be the same as the file input, with _aces added to the filename, and the file extension taken from the parameters in my hda.

For Example:
Input in the File Node: D:/Desktop/filename.png
File Extension in HDA Parameters set by the user: .exr
Output in the ROP Node: D:/Desktop/filename_aces.exr

Is this possible? I added a hip file with the current state of the HDA. Thanks!

aces_converter.hiplc

Share this post


Link to post
Share on other sites

you can construct it using python expression from your input parameters for example

root = ".".join(ch("../img").split(".")[:-1])
ext = ch("../output").split(".")[-1]
suffix = "_aces"
return "{}{}.{}".format(root, suffix, ext)

 

aces_converter_fix.hiplc

  • Thanks 1

Share this post


Link to post
Share on other sites

Hi Anim, this works perfectly. I didnt even know i could use python directly in the Output window. Learned a lot from your answer. Thanks mate!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×