Jump to: Board index » General » Fusion

Replace string in Filenames

Learn about 3D compositing, animation, broadcast design and VFX workflows.
  • Author
  • Message
Offline

ThomasManz

  • Posts: 57
  • Joined: Wed Jul 12, 2017 5:59 pm

Replace string in Filenames

PostFri Oct 26, 2018 8:49 am

I have a comp where I process a fixed set of images from different clients. The directory structure is always the same, so for the Filenames of the Savers I have something like this:
Code: Select all
project/<clientname>/highresABC/image.jpg
project/<clientname>/highresXYZ/image.jpg
project/<clientname>/lowresABC/image.jpg
project/<clientname>/lowresXYZ/image.jpg
...

...you get the idea.
Now I want to have a central point where I can type in the <clientname> and have it being evaluated in all the Filenames, so that when a new client comes in I just plug in the clients images, update the <clientname> somewhere central, click on Render and done.
Possible?
Xubuntu 20.04.4 LTS
DaVinci Resolve 17.4.3 Build 10
Offline

Stefan Kirste

  • Posts: 142
  • Joined: Wed Jul 30, 2014 8:45 am

Re: Replace string in Filenames

PostFri Oct 26, 2018 12:52 pm

for sure. the best way is, to build a script for this, and then run this script via shortcut.
if you have no skill in scripting (python/lua), u may look in the scripting section of the WSL Forum.
Offline

ThomasManz

  • Posts: 57
  • Joined: Wed Jul 12, 2017 5:59 pm

Re: Replace string in Filenames

PostFri Oct 26, 2018 1:38 pm

Is there any noticable difference between lua and python?
The scripting guide and reference for Fusion 8 (couldn't find one for Fusion 9) says
Both access the same API
through FusionScript...

Does that mean that they are fully "compatible" to each other or can one language do which the other can't?
Since I'm already familiar with python I would gravitate towards python.
Xubuntu 20.04.4 LTS
DaVinci Resolve 17.4.3 Build 10
Offline
User avatar

Bryan Ray

  • Posts: 2488
  • Joined: Mon Nov 28, 2016 5:32 am
  • Location: Los Angeles, CA, USA

Re: Replace string in Filenames

PostFri Oct 26, 2018 3:18 pm

There may be a couple of attributes in the bmd library that exist in Lua but not in Python. For instance, there was a question about querying Fusion for its version number a few days ago, and while that can be found by querying bmd._VERSION in Lua, it doesn't appear to be anywhere in the bmd Python module. Those are fairly rare occurrences, though.

Python does require an external installation, while Lua is built-in to Fusion. That's not a huge deal, but it may require some extra administration to make certain that all workstations in a facility are running the same version and have all of the required libraries available.

On those occasions when you run into a task that can only be performed by one or the other, or if you have one scripter working in Python and another in Lua, there is some cross-language support. See page 20 of the Scripting Guide.
Bryan Ray
http://www.bryanray.name
http://www.sidefx.com
Offline
User avatar

Bryan Ray

  • Posts: 2488
  • Joined: Mon Nov 28, 2016 5:32 am
  • Location: Los Angeles, CA, USA

Re: Replace string in Filenames

PostFri Oct 26, 2018 3:30 pm

ThomasManz wrote:Now I want to have a central point where I can type in the <clientname> and have it being evaluated in all the Filenames, so that when a new client comes in I just plug in the clients images, update the <clientname> somewhere central, click on Render and done.
Possible?


Doesn't even require any scripting. Add some custom Pathmaps called 'project' and 'client:'. 'project:' points at your projects folder, and 'client' at 'projects:clientname.' Your loader would then have this path:

client:highresABC/image.jpg
client:highresXYZ/image.jpg
...

This can be done in either the global Fusion prefs or in the composition prefs.

edit: Just be aware that if you eventually do want to manipulate those paths by script, you'll have to expand the maps using comp:MapPath() in order to get to the real paths.
Attachments
Untitled.png
Untitled.png (140.21 KiB) Viewed 1136 times
Bryan Ray
http://www.bryanray.name
http://www.sidefx.com
Offline

ThomasManz

  • Posts: 57
  • Joined: Wed Jul 12, 2017 5:59 pm

Re: Replace string in Filenames

PostFri Oct 26, 2018 6:10 pm

Well, I guess I go for Lua then but the Pathmaps are very nice to know, I will keep that in mind.
Thanks, that was helpful.
Xubuntu 20.04.4 LTS
DaVinci Resolve 17.4.3 Build 10
Offline

Travis Schmiesing

  • Posts: 133
  • Joined: Wed Oct 14, 2015 4:01 am

Re: Replace string in Filenames

PostFri Nov 02, 2018 2:49 pm

Not sure if this is too manual for you but I just open my comp with Notepad++ and do a search and replace. Works like a charm.

Return to Fusion

Who is online

Users browsing this forum: No registered users and 23 guests