Jump to content
Sign in to follow this  
saca

Parameter Expression by Python

Recommended Posts

hi,

simple python script sample
 

'a_b_c'.split('_')[0]
>'a'

samely, i want to execute python script as parameter value,
example) hip filename is "s001_c001_myScene_v001.001.hip"
 

$HIPNAME.split('_')[0]


but it's retuen same strings, very confuse.
i want get "s001" in this case.
please tell me how to write them?

thanks

2021-03-24_18h46_30.png

Share this post


Link to post
Share on other sites

0. Switch expression language to Python (you've done that already)

1. Set a keyframe on the string parameter. This is required! 

2. Set your expression like this:

hou.expandString("$HIPNAME").split('_')[0]

 

Share this post


Link to post
Share on other sites

that's great!
"Set a keyframe", really need.
thanks

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  

×