Jump to content
Travis

Import Automate with String replace

Recommended Posts

Hi guys, I am trying to automate my alembic imports by using a string replace on my File path. For example: on my alembic File Name parameter I've written the expression -
`strreplace($HIP, "home/fx", "fx/waterfountain_v001")`.abc
I would like to be able to replace the version number with a wildcard so that it picks up the file regardless of what the version number is, but an (*)asterisk doesn't work. How should that be scripted?

Thank you in advance!

Share this post


Link to post
Share on other sites

Thank you Alex. I don't think I need frame padding, as the alembic isn't a sequence. I am just wondering how to add a wildcard for the version number? I think the Alembic node in Houdini may not recognize wild cards though. Is that the case? Do you know a work around?

Share this post


Link to post
Share on other sites

wildcards or simple expressions don't check files on disk so they will not go find what is the actual version in there (even then what would you expect if wildcard matches more than one file? )

path built by expression has to result in a specific file path that will be loaded if found

 

your best bet would be using python script that actually looks up the directory and finds the latest version for example

but rather than using it as a live expression it may be safer to have it as a menu script in a dropdown and then just reference picked value in your path expression, so that it doesn't have to check the disk all the time, just when the menu is invoked

Edited by anim

Share this post


Link to post
Share on other sites

Thanks Tomas,
The wild card would only grab the correct file, because there is only ever one file in that directory. I will look into a solution using python. Thank you very much for responding!

 

Share this post


Link to post
Share on other sites
26 minutes ago, Travis said:

...The wild card would only grab the correct file, because there is only ever one file in that directory....

right, but I meant in general, if pattern matches more existing files it's a bit ambiguous, so yeah, with python you can make up the exact logic what would be looked for and picked

Edited by anim

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

×