Jump to content

Use a portion of $HIPNAME in ROP


macj89

Recommended Posts

Hi guys!

I was wondering if i could use a portion of the $HIPNAME (scene name) to name my renders.

Example:

SH001_mountain_v1.hip

So, what I want, is my render file name look like this:

SH001_mountain_$OS_v1_$F4.exr

 

So, basically we are looking a way to extract the first 14 characters from the $HIPNAME aswell the last 2 characters (version number).

I know it's posible with Python but i am trying to avoid it, since we tried and it gave us a lot of errors (we are not coders).

Is this thing posible with Hscript or should i go deep into python?

Thank you very much guys!

Link to comment
Share on other sites

You can try doing it in VEX, putting $HIPNAME in a parameter, create a string variable initialized with chs("ref_to_your_param"), and then use the split function on this variable (and other VEX functions on strings), to keep the parts that you want, and use sprintf to concatenate the full path you need, and then putting that into an attribute at detail level. Then create another parameter on your Wrangle, in which you will use detail() to get the path into the parameter, that you can reference on your mantra node inside the image filename.

Alternatively, in this case, I am wondering if you could use substr() :

`substr($HIPNAME, 0, 15)`$OS_`substr($HIPNAME, 16, 2)`_$F4.exr

Try it and let us know

Edited by StepbyStepVFX
  • Thanks 1
Link to comment
Share on other sites

A consistent and user friendly way of doing it would be to add something to the $HSITE launch scripts (123.py, 456.py) where it takes the scene file name and creates a new variable like $HIPBASE that excludes the version number. Then use that variable in the file name rather than screwing around with expressions on the parameter.

  • Thanks 2
Link to comment
Share on other sites

I am not a good coder and i am having a really hard time with this thing. I already had a bad time with python and I was trying to get a solution via the normal hscript.

So, where am I now:

1. My $HIPNAME is this one:  SEQ_SH0000_globalfx_v001_mac

2. I create a $RENDER global variable, non procedural, because this folder has to be on the same level of $HIP but I don't know how to set up procedurally haha

3. Following @StepbyStepVFX advice, i wrote this down:

$RENDER/`substr($HIPNAME, 0, 11)`${OS}/`substr($HIPNAME, (abs(strlen($HIPNAME))-8), (abs(strlen($HIPNAME))-4))`/`substr($HIPNAME, 0, 11)`${OS}_`substr($HIPNAME, (abs(strlen($HIPNAME))-8), (abs(strlen($HIPNAME))-1))`.$F4.exr

 

It should be giving me this naming:

..../render/SEQ_SH0000_object_task/v001/SEQ_SH0000_object_task_v001_mac.1001.exr

but it is giving me this:

..../render/SEQ_SH0000_object_task/v001_mac/SEQ_SH0000_object_task_v001_mac.1001.exr

 

So,  I got it almost!

I just have to get rid of that _mac that is not working as expected, is like the STRLEN is not detecting properly the character numbers for  v001_mac    , i can get rid of the v001 but i can't get rid of the  _mac.

`substr($HIPNAME, 24, 28)` gives me  _mac 

`substr($HIPNAME, 20, 24)`gives me v001_mac instead of v001, that it doesn't make any sense. 

 

Thanks guys! I will get into that $HSITE thing, its the first time that i hear that! haha

 

*attaching the hip

SEQ_SH0000_globalfx_v001_mac.hiplc

Edited by macj89
Link to comment
Share on other sites

  • 1 month later...

so from combing through other similar posts , from lukeiamyourfather post on this topic ,  houdinitricks.com/create-custom-global-variables-houdini/ and mainly sidefx content help

for ex : your scene name = blah_some_someotheting_v016

so when you have the 123.py or 456.py  from the scripts folder , and your python hou module in either one of those

import hou
hou.putenv("VERNAME", hou.expandString("$HIPNAME").split("_").pop())

 

and when you restart houdini , in the textport echo $VERNAME it would return the version number v016

hope this help anyone looking for this 

 

Edited by pxptpw
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...