Page 1 of 1

FuScript and a global context

Posted: Mon Apr 25, 2016 11:23 am
by vidjuheffex
Question, what globals are available to FuScript?

I have a scrip that simply makes a new Comp and then saves it. Running this in Fusion as single Lua lines works fine.

Code: Select all

comp = fu:NewComp()
filename = 'C:\\Users\\julian\\Desktop\\test.comp'
comp:Save(filename)
However, if I close Fusion and run fuscript (feeding it the above as a .lua file) I get: test.1.lua:1: attempt to index global 'fu' (a nil value)

Fusion exists as a function, a call to Fusion() returns null (since Fusion is not running I presume.)

If fuscript needs fusion to work then what's the point of fuscript? I more inclined to believe I'm missing something and there is away to do this without a UI.

Re: FuScript and a global context

Posted: Mon Apr 25, 2016 12:29 pm
by Chad
You still need to run Fusion, you just don't need to do so interactively.

Let's say you wanted to have 2 copies of Fusion running, one for interactive work, and one for background rendering. Your script would need to know which copy you wanted to run in.

Re: FuScript and a global context

Posted: Mon Apr 25, 2016 12:50 pm
by vidjuheffex
Is there a headless or UI-less or batch mode to run fusion in?

I am writing an app that creates comps. It ask the host software then generates a script file on the fly. So for AE, I run afterfx -noui -r "pathtoscript", in maya, I can use mayapy with the path to the script, and then start a "batch" maya instance. Again, hidden from view. I'd hate for fusion to come into the picture with its usual pile of back-asswardness and start launching interfaces just to create a couple comps. Alternatively I guess I could modify the text contents of a blank comp, but that's a pain in the butt. And I intend on adding more functionality than comp creation so access to scripting is necessary.

Re: FuScript and a global context

Posted: Mon Apr 25, 2016 3:51 pm
by Chad
Renderslave and Consoleslave. I forget if you can run Fusion.exe sans GUI. It's been a long while since I've needed to.

Re: FuScript and a global context

Posted: Tue Apr 26, 2016 6:25 am
by vidjuheffex
"Renderslave and Consoleslave"

That might be it, thanks!