Jump to: Board index » General » Fusion

Old Scripts not running in Fusion 7.x

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

Eric Westphal

  • Posts: 214
  • Joined: Thu Nov 20, 2014 1:59 pm

Old Scripts not running in Fusion 7.x

PostWed Jan 21, 2015 8:35 pm

Sometimes scripts that run fine in Fusion 6 terminate in Fusion 7.6 with a Console-Error like:
[...].eyeonscript:9: attempt to call a table value

Fusion 6.x still had a hack in the scripting-engine that would allow code
(namely For-Next-Loops) to not follow exactly the Lua-specs.
Since the scripting engine has been updated for F7, the Lua specs must be obeyed now.

In other words, while in Fusion 6.x this would work:
Code: Select all
    for i, v in composition:GetToolList() do
        bla
    end

as of F7 you must use ipairs(), or pairs(), that is:
Code: Select all
    for i, v in ipairs(composition:GetToolList()) do

or
Code: Select all
    for i, v in pairs(composition:GetToolList()) do


Cheers.

Eric.
my hovercraft is full of eels.
Offline

Joël Gibbs

  • Posts: 97
  • Joined: Wed Nov 12, 2014 9:18 pm
  • Location: Nashville

Re: Old Scripts not running in Fusion 7.x

PostWed Feb 04, 2015 6:46 pm

Hey Eric,
When I run the Hotkey Manager, and try to add a new Hotkey I get this:

Code: Select all
...Design/Fusion/Scripts/Utility/Hotkey Manager.eyeonscript:978: bad argument #1 to 'pairs' (table expected, got nil)
stack traceback:
   [C]: in function 'pairs'
   ...Design/Fusion/Scripts/Utility/Hotkey Manager.eyeonscript:978: in function 'buildKeyList'
   ...Design/Fusion/Scripts/Utility/Hotkey Manager.eyeonscript:923: in function 'buildHKeyBox'
   ...Design/Fusion/Scripts/Utility/Hotkey Manager.eyeonscript:743: in function <...Design/Fusion/Scripts/Utility/Hotkey Manager.eyeonscript:732>
   [C]: at 0x07feea6bdcc0
   ...Design/Fusion/Scripts/Utility/Hotkey Manager.eyeonscript:1165: in function 'callglob'
   [string "readdir = eyeon.readdir..."]:124: in function 'ldofile'
   [string "ldofile("C:/Program Files/Blackmagic Design/F..."]:1: in main chunk


I'm guessing this is a similar issue?
Thanks,

Joël
Offline
User avatar

Blazej Floch

  • Posts: 191
  • Joined: Tue Nov 11, 2014 12:48 am
  • Location: Toronto, ON

Re: Old Scripts not running in Fusion 7.x

PostWed Feb 04, 2015 8:27 pm

Nope. The Hotkey Manager is simply buggy - probably also because of some transition from Fusion 6.4 -> 7.x but it has not to do with the pairs issue as far as I can tell. It has problems to build the subdialogs menu when there is nothing selected, or the tree root is selected.

However you can still get it to work if you do select some category first before Adding the hotkey.
Offline
User avatar

SvenNeve

  • Posts: 37
  • Joined: Mon Feb 09, 2015 11:13 am
  • Location: Hilversum, Netherlands

Re: Old Scripts not running in Fusion 7.x

PostFri Feb 13, 2015 10:54 am

The error occurs because by default the Hotkeys tree entry is selected, and since Hotkeys is not a category with entries, the table return nil, which breaks the script.

changing the part starting on line 978
Code: Select all
            for k, v in pairs(hKeys[category]) do
               count = count + 1
               exceptionList[count] = k
            end

into

Code: Select all
                if hKeys[category] ~= nil then
                    for k, v in pairs(hKeys[category]) do
                        count = count + 1
                        exceptionList[count] = k
                    end
                end


should fix the script (not sure why this bug is still there as i remember sending this bug and fix quite a while ago to tech@eyeonline, probably got lost somewhere.)

Sven

visit my personal site : http://www.svenneve.com
visit my company site : http://www.houseofsecrets.nl
Offline

Fred Pienkos

  • Posts: 84
  • Joined: Wed Jan 21, 2015 1:57 am

Re: Old Scripts not running in Fusion 7.x

PostFri Feb 20, 2015 2:32 am

Hi everyone.

I am having a couple similar issues with some old fusion scripts not working when it is run in Fusion 7. (build 1462).

For example, trying to use the change paths scripts that comes with fusion, I get
Code: Select all
.../Scripts/Comp/Change Paths.eyeonscript:22: bad argument #1 to 'lower' (string expected, got table)


It is not part of a for loop, so this is obviously different... but not sure why this old script is failing.

Second issue would be
Code: Select all
local secs = math.mod(timescan, 60)

returns
Code: Select all
scripts/.../_4.0.eyeonscript:521: attempt to call field 'mod' (a nil value)


anyone know why those would be happening?
Offline
User avatar

Chad Capeland

  • Posts: 3025
  • Joined: Mon Nov 10, 2014 9:40 pm

Re: Old Scripts not running in Fusion 7.x

PostFri Feb 20, 2015 3:09 am

Fred Pienkos wrote:Second issue would be
Code: Select all
local secs = math.mod(timescan, 60)

returns
Code: Select all
scripts/.../_4.0.eyeonscript:521: attempt to call field 'mod' (a nil value)


anyone know why those would be happening?


Try local secs = math.fmod(timescan, 60)
Chad Capeland
Indicated, LLC
www.floweffects.com
Offline
User avatar

SvenNeve

  • Posts: 37
  • Joined: Mon Feb 09, 2015 11:13 am
  • Location: Hilversum, Netherlands

Re: Old Scripts not running in Fusion 7.x

PostFri Feb 20, 2015 11:12 am

Fred Pienkos wrote:Hi everyone.

I am having a couple similar issues with some old fusion scripts not working when it is run in Fusion 7. (build 1462).

For example, trying to use the change paths scripts that comes with fusion, I get
Code: Select all
.../Scripts/Comp/Change Paths.eyeonscript:22: bad argument #1 to 'lower' (string expected, got table)


It is not part of a for loop, so this is obviously different... but not sure why this old script is failing.

Second issue would be
Code: Select all
local secs = math.mod(timescan, 60)

returns
Code: Select all
scripts/.../_4.0.eyeonscript:521: attempt to call field 'mod' (a nil value)


anyone know why those would be happening?


Change Paths is broken on many level (some by design)

however, changing line 128 :
Code: Select all
        newclip = conf( tool_a.TOOLST_Clip_Name )

into
Code: Select all
        newclip = conf( tool_a.TOOLST_Clip_Name[1] )


would probably fix that error

and while you're at it, and this is especially true for people working from a *nix NAS or server where file names with different case are treated as different files.
Change line 22
Code: Select all
    filepath = string.lower(filepath)

into
Code: Select all
    --filepath = string.lower(filepath)

and change line 48-49
Code: Select all
    srchFor = string.lower( eyeon.trim( x.Source ) )
    srchTo = string.lower( eyeon.trim( x.Replacement ) )

into
Code: Select all
    srchFor = eyeon.trim( x.Source )
    srchTo = eyeon.trim( x.Replacement )


this prevents the script from silently changing everything to lower case, which is a sure way to confuse users who work with cifs/samba hosted files on windows (after all, MyFile and myfile are 2 different files on *nix systems, where as on windows filesystems MyFile and myfile, are the same file)

visit my personal site : http://www.svenneve.com
visit my company site : http://www.houseofsecrets.nl
Offline

Fred Pienkos

  • Posts: 84
  • Joined: Wed Jan 21, 2015 1:57 am

Re: Old Scripts not running in Fusion 7.x

PostFri Feb 20, 2015 10:09 pm

Thank you. Those were very helpful.

What about this one? This one is causing trouble...

Code: Select all
x,y=c.CurrentFrame.FlowView:GetPos(LDR)


..._5.2.eyeonscript:680: attempt to index field 'CurrentFrame' (a nil value)
Offline
User avatar

SvenNeve

  • Posts: 37
  • Joined: Mon Feb 09, 2015 11:13 am
  • Location: Hilversum, Netherlands

Re: Old Scripts not running in Fusion 7.x

PostMon Feb 23, 2015 9:29 am

What script is that error originating from?

visit my personal site : http://www.svenneve.com
visit my company site : http://www.houseofsecrets.nl
Offline

Fred Pienkos

  • Posts: 84
  • Joined: Wed Jan 21, 2015 1:57 am

Re: Old Scripts not running in Fusion 7.x

PostMon Feb 23, 2015 6:45 pm

SvenNeve wrote:What script is that error originating from?

That is a lua script we have in house which is trying to find the position of a tool so that later it can replace it with a new tool in the same location in the comp.

Code: Select all
SetActiveComp(c)
x,y=c.CurrentFrame.FlowView:GetPos(LDR)
...
c.CurrentFrame.FlowView:SetPos(LDR, x, y)
Offline

Fred Pienkos

  • Posts: 84
  • Joined: Wed Jan 21, 2015 1:57 am

Re: Old Scripts not running in Fusion 7.x

PostTue Feb 24, 2015 2:38 am

So actually, I found one more that needs work. This time its the Archive Composition.eyeonscript that comes with fusion.
Code: Select all
for i = v.InitialFrame, v.InitialFrame + (v.Length-1) do
     fname = v.Seq.CleanName..string.format("%0"..v.Seq.Padding.."d", i)..v.Seq.Extension
     total_size = total_size + filesize(v.Seq.Path..fname)
end
Which returns
Code: Select all
...Archive Composition.eyeonscript:354: attempt to concatenate field 'Padding' (a nil value)

And still having trouble getting and setting the position of tools in comp.
Code: Select all
x,y=c.CurrentFrame.FlowView:GetPos(LDR)
returns
Code: Select all
..._5.2.eyeonscript:680: attempt to index field 'CurrentFrame' (a nil value)

If anyone knows the cause of those two it would help me out.
Thanks
Offline
User avatar

Stefan Ihringer

  • Posts: 257
  • Joined: Mon Nov 10, 2014 10:40 pm

Re: Old Scripts not running in Fusion 7.x

PostTue Feb 24, 2015 11:08 am

what is "c" in your script? Can you post the variable assignment and/or the result of dump(c)?
blog and Fusion stuff: http://comp-fu.com/2012/06/fusion-script-macro-collection/
Offline

Fred Pienkos

  • Posts: 84
  • Joined: Wed Jan 21, 2015 1:57 am

Re: Old Scripts not running in Fusion 7.x

PostTue Feb 24, 2015 5:36 pm

Stefan Ihringer wrote:what is "c" in your script? Can you post the variable assignment and/or the result of dump(c)?

Code: Select all
c = FusionRemote:NewComp(true, true, true) or false
   SetActiveComp(c)

Thanks Stefan
Offline
User avatar

Stefan Ihringer

  • Posts: 257
  • Joined: Mon Nov 10, 2014 10:40 pm

Re: Old Scripts not running in Fusion 7.x

PostThu Feb 26, 2015 10:47 pm

Are you running the studio version? I don't know what FusionRemote is (another instance of Fusion that you created or a built-in object?) but the free version of Fusion doesn't allow scripting of remote Fusion instances. So c is probably false which triggers the error.
blog and Fusion stuff: http://comp-fu.com/2012/06/fusion-script-macro-collection/

Return to Fusion

Who is online

Users browsing this forum: jsghost777 and 17 guests