Scriptlib refresh?

User avatar
SecondMan
Site Admin
Posts: 3122
Joined: Thu Jul 31, 2014 5:31 pm
Location: Vancouver, Canada
Been thanked: 35 times
Contact:

Scriptlib refresh?

#1

Post by SecondMan » Sat Feb 25, 2017 9:25 pm

Hello peeps,



Quick question - is there a way to refresh a Scriptlib without restarting Fusion? It's a bit of a drag to work the way I currently am; adjusting some function - restarting Fusion - testing - adjusting - restarting... ad infinitum.

Forgive me if this is in the Scripting manual somewhere, I haven't gone through the whole thing yet. If not possible I can work around it in a couple of ways, but it would be nice...

Thanks!

User avatar
AndrewHazelden
Fusionator
Posts: 1215
Joined: Fri Apr 03, 2015 3:20 pm
Location: West Dover, Nova Scotia, Canada
Been thanked: 11 times
Contact:

Re: Scriptlib refresh?

#2

Post by AndrewHazelden » Sun Feb 26, 2017 6:51 am

I'm only an intermediate skill level Lua scripter so please forgive me if I'm wrong.

But couldn't you just copy the part of the bmd.scriptlib code block you are tweaking into your own separate Lua script file then add a "smurfed" namespace prefix to the function you are tweaking like turning "bmd.trimSequence" into "smTrimSequence()"?

In my mind that would be faster to edit during your rapid development phase and then you can merge the working results back into the original scriptlib file later on if you wanted to.

Cheers,
Andrew

User avatar
SecondMan
Site Admin
Posts: 3122
Joined: Thu Jul 31, 2014 5:31 pm
Location: Vancouver, Canada
Been thanked: 35 times
Contact:

Re: Scriptlib refresh?

#3

Post by SecondMan » Sun Feb 26, 2017 9:15 am

Thanks Andrew.

Yes, that's my current workaround. Thing is that pretty much every time after I copy the functions into the Scriptlib I then think of something and still want to do some adjustments.

It's not a huge deal, just wondering if it can't be done.

User avatar
AndrewHazelden
Fusionator
Posts: 1215
Joined: Fri Apr 03, 2015 3:20 pm
Location: West Dover, Nova Scotia, Canada
Been thanked: 11 times
Contact:

Re: Scriptlib refresh?

#4

Post by AndrewHazelden » Sun Feb 26, 2017 9:18 am

Is the bmd.scriptlib a Lua module? This approach might work (untested):

http://lua-users.org/wiki/ModulesTutorial

When I use the Package Path tip from that Lua tutorial page in Fusion I get back:

Code: Select all

=package.path
./?.lua;@executable_path/share/luajit-2.1.0-beta1/?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;@executable_path/share/lua/5.1/?.lua;@executable_path/share/lua/5.1/?/init.lua

User avatar
SecondMan
Site Admin
Posts: 3122
Joined: Thu Jul 31, 2014 5:31 pm
Location: Vancouver, Canada
Been thanked: 35 times
Contact:

Re: Scriptlib refresh?

#5

Post by SecondMan » Sun Feb 26, 2017 9:48 am

Oh interesting - will test this later today and let you know.

Thanks!

User avatar
SecondMan
Site Admin
Posts: 3122
Joined: Thu Jul 31, 2014 5:31 pm
Location: Vancouver, Canada
Been thanked: 35 times
Contact:

Re: Scriptlib refresh?

#6

Post by SecondMan » Sun Feb 26, 2017 3:58 pm

That didn't quite work. I can clear the scriptllib functions, but not reload it. Consistently, that is.

It's actually weird, I can clear the scriptlib, then when I start a new comp (rather than restart Fusion) the functions in the new scriptlib are there again, and every now and then, and only at the first run, it actually runs the function that has an external update, then it reverts back to the one that way loaded when Fusion was first started.

Lack of time prevents me from doing some more research and getting something I can reproduce, but I'll bookmark this topic for a later date...