Jump to: Board index » General » Fusion

Help with lua script

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

Ziggy Uszkurat

  • Posts: 46
  • Joined: Fri Sep 04, 2015 12:45 pm

Help with lua script

PostThu Jun 01, 2017 3:42 pm

Hi there,

This script runs automatically when I open a comp and changes the path where the saver saves the video. Can you tell me where I am going wrong with this script? It fails on the line : tx[1].Clip=newpath

Code: Select all
-- if the comp file path does NOT include the directory "Master" and
-- if there is a saver in the comp, it will change the render
-- directory to match the
print("autorun - update saver path if required")
fp=comp:GetAttrs().COMPS_FileName
print(fp)
if string.find(fp,"/Master/") then
   -- master file so nothing to do...
   print("Master file so do nothing")
else
   -- not a master file so do something
   print("checking for saver...")
   tx=comp:GetToolList(false,"Saver")[1]
   if not (tx ==nil) then
      -- we got a saver...
      print("got saver...")
      tablefp=split(fp,"/")
      newdir=tablefp[#tablefp-1]
      if not (comp:GetToolList(false,"Saver")[1] == nil) then
         fn=comp:GetToolList(false,"Saver")[1]:GetAttrs().TOOLST_Clip_Name
         path=fn[1]
         if string.find(path,"/Master/") then
            newpath=string.gsub(path,"Master",newdir)
            tx[1].Clip=newpath
            print("Changed the saver path!")
         else
            print("No change to the saver path")
         end
      end
   else
      print("No saver to update :(")
   end
end


Any help would be greatly appreciated.

Best wishes
Ziggx
Offline

Ziggy Uszkurat

  • Posts: 46
  • Joined: Fri Sep 04, 2015 12:45 pm

Re: Help with lua script

PostThu Jun 01, 2017 5:18 pm

SecondMan over at WeSuckLess gave me the answer - I just needed to change tx[1].Clip=newpath to tx.Clip[1]=newpath.

Hope that helps any other Lua newbie out there

Best wishes
Ziggx

Return to Fusion

Who is online

Users browsing this forum: KrunoSmithy, RCModelReviews and 91 guests