Jump to: Board index » General » Fusion

Inherit Saver's Filepath based on Loader's Filepath?

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

bentraje

  • Posts: 78
  • Joined: Mon Feb 24, 2020 5:44 pm
  • Real Name: Ben Traje

Inherit Saver's Filepath based on Loader's Filepath?

PostSun Jun 06, 2021 12:06 pm

Hi,

I'm trying perform basic image correction on several images but they are on different directory.
I would like to have the Saver's Filepath based on Loader's Filepath.

For example, if the loader's filepath is
Code: Select all
D:\food\pork.png

I want the saver's filepath to be:
Code: Select all
D:\food\pork_fixed.png


I tried doing a
Code: Select all
=Loader01.Clip


but it seems like Saver Filepath doesn't accept expressions.
Is there a way around this with expressions so I don't have to redo the filepath for every image?

Regards,
Ben
Offline
User avatar

Bryan Ray

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

Re: Inherit Saver's Filepath based on Loader's Filepath?

PostMon Jun 07, 2021 4:14 am

You can't do it with expressions, but you can with a script.

Here's one that will create Savers based on all selected Loaders, with the requested filename change:

Code: Select all
comp:Lock()
flow = comp.CurrentFrame.FlowView
for i, tool in ipairs(comp:GetToolList(true, "Loader")) do

    local x,y = flow:GetPos(tool)
    local sv = comp:AddTool("Saver", x+2, y)
    pathtable = bmd.parseFilename(tool.Clip[comp.CurrentTime])
    sv.Clip = pathtable.Path..pathtable.CleanName.."_fixed."..pathtable.SNum..pathtable.Extension
end
comp:Unlock()


Simply paste that into the Console's text entry line and hit enter. You'll get a Saver for each selected Loader, positioned two grid units to the right. If your images aren't sequences, you may wind up with an extra . right before the extension. You can remove that from the code—it's in the third-to-last line. Change "_fixed." to "_fixed" to get rid of it, if desired.

edit: If this is something you'll do frequently, you could save the above in your Scripts/comp folder with a .lua extension, and it will show up in the Script menu.
Bryan Ray
http://www.bryanray.name
http://www.sidefx.com
Offline
User avatar

iddos-l

  • Posts: 799
  • Joined: Sat Mar 30, 2019 7:55 pm
  • Real Name: iddo lahman

Re: Inherit Saver's Filepath based on Loader's Filepath?

PostMon Jun 07, 2021 4:25 am

Nice one
Thanks


Sent from my iPhone using Tapatalk

Return to Fusion

Who is online

Users browsing this forum: No registered users and 30 guests