Jump to: Board index » General » Fusion

Relink footage in fusion

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

Edwin Rivera

  • Posts: 160
  • Joined: Wed Aug 03, 2016 4:53 pm

Relink footage in fusion

PostFri Mar 17, 2017 7:29 pm

Hi guys

I had a lot of comps that for some reason got offline
I managed to import it again and for now it has worked

But i was wondering if there is an easier way to do it, so i can have a lot of comps relinked in 1 click or is doing it manually one by one the only way to do it?

Please and thank you so much
Offline
User avatar

michael vorberg

  • Posts: 943
  • Joined: Wed Nov 12, 2014 8:47 pm
  • Location: stuttgart, germany

Re: Relink footage in fusion

PostFri Mar 17, 2017 7:34 pm

there are some older scripts flying around which can be adopted to fusion8 which offers a "search and replace" function


or you could open your comp in any text editor and do the search and replace there
Offline

Edwin Rivera

  • Posts: 160
  • Joined: Wed Aug 03, 2016 4:53 pm

Re: Relink footage in fusion

PostSat Mar 18, 2017 1:05 am

I've never worked with a script before so im lost there

Is it easy to do?
Offline
User avatar

michael vorberg

  • Posts: 943
  • Joined: Wed Nov 12, 2014 8:47 pm
  • Location: stuttgart, germany

Re: Relink footage in fusion

PostSat Mar 18, 2017 9:20 am

save this into your "fusionFolder/scripts/comp" as ChangePath.lua

when you start fusion you should find a new item under "scripts" called "ChangePath"

beacuse this is an adoption of an old script i dont know if it works correct on OsX and Linux


Code: Select all
------------------------------------------------------
-- Change Paths script, Revision: 2.1
--
-- search for (and replace) a pattern in all filenames in the flow,
-- including Loader Filename, Proxy,  and Savers. Full support for
-- cliplists.
--
-- place in Fusion:/Scripts/Comp
--
-- TODO Add regular expressions support
--    - partial / multi matches
--    - autodetection of missing files in dfscriptlib?
--
-- written by Isaac Guenard (izyk@eyeonline.com)
-- created : unknown date, by Isaac Guenard
-- updated : Sept 27, 2005
-- changes : updated for 5
-- update for Fu8 michael vorberg mv@empty98.de
------------------------------------------------------


function conf(filepath)
   filepath = string.lower(filepath)
   findStart, findEnd   = string.find( filepath, srchFor, 1, true )
   print(findStart, findEnd, filepath)
   if findStart == nil then return nil end
   
   -- build the new filename using strStart
   newclip =   string.sub(filepath, 1, findStart - 1) ..
            srchTo ..
            string.sub(filepath, findEnd + 1)
            
   return newclip
end


-- ask the user for some information
x = composition:AskUser("Repath All Loaders", {
   {"Loaders", "Checkbox", Name = "Loaders", NumAcross = 3, Default = 1},
   {"Savers", "Checkbox", Name = "Savers", NumAcross = 3, Default = 1},
   {"Proxy", "Checkbox", Name = "Proxy", NumAcross = 3, Default = 1},
   {"GeoLoaders", "Checkbox", Name = "GeoLoaders", NumAcross = 3, Default = 1},
   {"Source", "Text", Name = "Enter pattern to search for"},
   {"Replacement", "Text", Name = "Enter the replacement path"},
   {"Valid", "Checkbox", Name = "Check If New Path is Valid", Default = 1},
   } )

-- did we get a response, or did they cancel
if x then
   srchFor   = string.lower( bmd.trim( x.Source ) )
   srchTo   = string.lower( bmd.trim( x.Replacement ) )
else
   return nil
end

if srchFor == "" then
   print("What are you searching for?\n")
   return nil
end

if srchTo == "" then
   print("What are you changing ".. srchFor .." to?\n")
   return nil
end

-------------------------
-- lock the flow
-------------------------
composition:Lock()

-------------------------
-- start an undo event
-------------------------
 composition:StartUndo("Path Remap - " .. srchFor .. " to " ..srchTo)

-------------------------
-- get table of tools in flow
-------------------------
toollist   = composition:GetToolList(false)

-------------------------
-- for every tool in the flow
-------------------------

for i, tool in ipairs(toollist) do
   tool_a   = tool:GetAttrs()

   -- process only loaders and savers
   if tool_a.TOOLS_RegID == "Loader" then
      
      clipTable = tool_a.TOOLST_Clip_Name
      altclipTable = tool_a.TOOLST_AltClip_Name
      startTime = tool_a.TOOLNT_Clip_Start
      
      -- pass a function the filename, get the newclip back, or nil
      if x.Loaders == 1 then
         for i = 1, table.getn( clipTable ) do
            newclip = conf( clipTable[i] )
            
            if newclip ~= nil then
               if (fileexists(composition:MapPath(newclip)) == false) and (x.Valid == 1) then
                  print( "FAILED : New clip does not exist; skipping sequence.\n   " .. newclip)
               else
                  tool.Clip[startTime[i]] = newclip
               end
            end
         end
      end
      
      -- pass a function the filename, get the newclip back, or nil
      if x.Proxy == 1 then
         for i = 1, table.getn( altclipTable ) do
            if altclipTable[i] ~= "" then
               newclip = conf( altclipTable[i] )
      
               if newclip ~= nil then
                  if (fileexists(composition:MapPath(newclip)) == false) and (x.Valid == 1) then
                     print( "FAILED : New proxy clip does not exist; skipping sequence.\n   " .. newclip)
                  else
                     tool.ProxyFilename[startTime[i]] = newclip
                  end
               end
            end
         end
      end
   end
   
   if tool_a.TOOLS_RegID == "Saver" and x.Savers == 1 then
   
      newclip = conf( tool_a.TOOLST_Clip_Name )

      if newclip ~= nil then
         tool.Clip[fu.TIME_UNDEFINED] = newclip
      end
      
   end
   if tool_a.TOOLS_RegID == "SurfaceFBXMesh" and x.GeoLoaders == 1 then
   
      old_name = tool.ImportFile[1]
      newclip = conf(old_name)

      if newclip ~= nil then
         tool.ImportFile[fu.TIME_UNDEFINED] = newclip
      end
      
   end
end

-------------------------
-- close the undo event
-------------------------
composition:EndUndo(true)

-------------------------
-- unlock the comp
-------------------------
composition:Unlock()
Offline

draSar

  • Posts: 1
  • Joined: Sun Oct 13, 2019 12:53 pm
  • Real Name: Dragomir Sarachev

Re: Relink footage in fusion

PostSun Oct 13, 2019 1:13 pm

Tested with fusion 9 doesn't work for savers . You can change loaders only . Haven't tested Proxy and GeoLoaders how is it.
If somebody has working version please share it.
Offline

UserNoah

  • Posts: 458
  • Joined: Fri Oct 04, 2019 3:32 pm
  • Location: Germany
  • Real Name: Noah Hähnel

Re: Relink footage in fusion

PostSat Jul 18, 2020 6:46 pm

Just found this thread. Probably too long ago to actually help you but I actually created a script that can search and replace in filepaths as well as names, expression and in Styled text boxes.
It's basically like ChangePaths only with more features.

Here is a link on how to search and replace in filepaths using Change Strings:

https://noahhaehnel.com/blog/how-to-bat ... filepaths/
Offline

Travis Schmiesing

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

Re: Relink footage in fusion

PostTue Jul 21, 2020 11:29 pm

Open in Notepad++ and do a find and replace on the file path.

Return to Fusion

Who is online

Users browsing this forum: Bryan Ray, Sander de Regt and 42 guests