Page 1 of 1

Old Scripts not running in Fusion 7.x

PostPosted: Wed Jan 21, 2015 8:35 pm
by Eric Westphal
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.

Re: Old Scripts not running in Fusion 7.x

PostPosted: Wed Feb 04, 2015 6:46 pm
by Joël Gibbs
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

Re: Old Scripts not running in Fusion 7.x

PostPosted: Wed Feb 04, 2015 8:27 pm
by Blazej Floch
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.

Re: Old Scripts not running in Fusion 7.x

PostPosted: Fri Feb 13, 2015 10:54 am
by SvenNeve
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

Re: Old Scripts not running in Fusion 7.x

PostPosted: Fri Feb 20, 2015 2:32 am
by Fred Pienkos
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?

Re: Old Scripts not running in Fusion 7.x

PostPosted: Fri Feb 20, 2015 3:09 am
by Chad Capeland
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)

Re: Old Scripts not running in Fusion 7.x

PostPosted: Fri Feb 20, 2015 11:12 am
by SvenNeve
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)

Re: Old Scripts not running in Fusion 7.x

PostPosted: Fri Feb 20, 2015 10:09 pm
by Fred Pienkos
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)

Re: Old Scripts not running in Fusion 7.x

PostPosted: Mon Feb 23, 2015 9:29 am
by SvenNeve
What script is that error originating from?

Re: Old Scripts not running in Fusion 7.x

PostPosted: Mon Feb 23, 2015 6:45 pm
by Fred Pienkos
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)

Re: Old Scripts not running in Fusion 7.x

PostPosted: Tue Feb 24, 2015 2:38 am
by Fred Pienkos
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

Re: Old Scripts not running in Fusion 7.x

PostPosted: Tue Feb 24, 2015 11:08 am
by Stefan Ihringer
what is "c" in your script? Can you post the variable assignment and/or the result of dump(c)?

Re: Old Scripts not running in Fusion 7.x

PostPosted: Tue Feb 24, 2015 5:36 pm
by Fred Pienkos
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

Re: Old Scripts not running in Fusion 7.x

PostPosted: Thu Feb 26, 2015 10:47 pm
by Stefan Ihringer
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.