Page 1 of 1

Scriptlib Events & Callbacks Bug in Fusion 8.2.1

Posted: Tue Apr 04, 2017 6:04 am
by AndrewHazelden
Fusion version:
8.2.1

OS and version:
Windows and MacOS

Additional relevant system info:

Description of the bug:
I tested the "Events & Callbacks" example .scriptlib code snippet from the Fusion 8 Script Manual.pdf on Page 26 in Fu 8.2.1. It looks to me like the AddEventSuite() function is broken on Fusion 8.x and results in the following error when Fusion is started with a .scriptlib that tries to use an event:

"attempt to call global 'AddEventSuite' (a nil value)".

Severity (Trivial, Minor, Major, Critical)
Major
Steps to reproduce:

The following Lua code example builds on the techniques presented in the "Events & Callbacks" example .scriptlib code snippet that is found the Fusion 8 Script Manual.pdf on Page 26 in Fu 8.2.1.
SaverReportOnRender.scriptlib

Script Installation:
To use the "PrintSaverPathsOnRender.scriptlib" callback example place it the Fusion "Scripts/Comp" folder and re-launch Fusion.

You can find out what the required folder installation location is by running the following LUA command in the Fusion console:
print('[Script/Comp Installation Folder] ' .. comp:MapPath('Scripts:/Comp'))

Script Usage:
Open a new comp that has saver nodes. When you start a new Fusion rendering the Fusion Console tab will run the OnStartRender(event) handler and list each of the saver nodes in the comp and their current clip filenames.

Script Compatibility Notes:
This script works fine on Fusion 7.x but seems to have issues when I tested it on Fusion 8.2.1.

In Fusion 8.2.1 on Windows and macOS the following startup error is listed in the terminal:
...Design/Fusion/Scripts/Comp/SaverReportOnRender.scriptlib:28: attempt to call global 'AddEventSuite' (a nil value)
Event scriptlib on Fusion Studio 8.2.1 on Windows.png
Event scriptlib on Fusion Studio 8.2.1 on macOS.png
In Fusion 7.7.1 on Windows the script works as expected:

Example output printed to the console when the "render" button is pressed in Fusion 7:

Code: Select all

[Saver Node Report]
[Frame Ranges] 	[Global Time Range]  0-1	[Render Time Range] 0-0
[Renderable Savers] 2 of 4
[Saver4] C:\Users\Hazelden\Desktop\Render\image_output4.0.tif	[Renderable] No
[Saver1] C:\Users\Hazelden\Desktop\Render\image_output1.0.tif	[Renderable] No
[Saver3] C:\Users\Hazelden\Desktop\Render\image_output4.0.tif	[Renderable] Yes
[Saver2] C:\Users\Hazelden\Desktop\Render\image_output2.0.tif	[Renderable] Yes
Event scriptlib on Fusion Studio 7.7.1 on Windows.png

To prove that the Fusion 8.2.1 Callback bug I am reporting is caused by bugs in the related AddEventSuite functions and not the rest of my code, you can paste the following code block into Fusion 8.2.1 and it runs successfully:

Code: Select all

  local toolList=comp:GetToolList('Saver')
  local totalRenderableSavers = 0
  local totalNonRenderableSavers = 0
  local passThroughBol = false
  local renderable = ''
  local nodeName = ''
  local clip = ''
  
  -- Count the active nodes
  for i, tool in pairs(toolList) do
    -- Make sure the node isn't invalid
    if (tool:GetInput('Clip') ~= nil) then
      if tool:GetAttrs().TOOLB_PassThrough == true then
        totalRenderableSavers = totalRenderableSavers + 1
      else 
        totalNonRenderableSavers = totalNonRenderableSavers + 1
      end
    end
  end
  
  print('[Saver Node Report]')

  
  -- Render time frame range
  renderStartFrameRange = comp:GetAttrs().COMPN_RenderStart
  renderEndFrameRange = comp:GetAttrs().COMPN_RenderEnd
  
  -- Global time frame range
  globalStartFrameRange = comp:GetAttrs().COMPN_GlobalStart
  globalEndFrameRange = comp:GetAttrs().COMPN_GlobalEnd
  print('[Frame Ranges] ' .. '\t[Global Time Range]  ' .. globalStartFrameRange .. '-' .. globalEndFrameRange .. '\t[Render Time Range] ' .. renderStartFrameRange .. '-' .. renderEndFrameRange)
  
  print('[Renderable Savers] '  .. totalRenderableSavers .. ' of ' .. (totalNonRenderableSavers + totalRenderableSavers))

  -- Print a report line entry about each saver node
  for i, tool in pairs(toolList) do 
    nodeName = tool:GetAttrs().TOOLS_Name
    
    -- Translate the Saver node's clip relative path map entries into an absolute filepath
    clip = comp:MapPath(tool:GetInput('Clip'))
    
    -- Convert the Saver node's passthrough value into a string
    passThroughBol = tool:GetAttrs().TOOLB_PassThrough
    if passThroughBol == true then
      renderable = "No"
    else
      renderable = "Yes"
      totalRenderableSavers = totalRenderableSavers + 1
    end
    
    -- Double check to make sure the first saver node entry isn't an empty (nil) value
    if (clip ~= nil) and (nodeName ~= nil) then
      print('[' .. nodeName .. '] ' .. clip .. '\t[Renderable] ' .. renderable)
      -- [Saver1] C:\Users\Hazelden\Desktop\output.0.tif  [Renderable] Yes
    end
  end
Here is a very simple Fusion comp example that has four saver nodes that can be used to help test the "SaverReportOnRender.scriptlib" example. Load the scene and click the render button to see if the event handler worked as expected.
OnRender-Callback-Test.comp
Please, if possible, provide a Fusion setup to help demonstrate the behaviour, either as an attachment or between code tags:

Re: Scriptlib Events & Callbacks Bug in Fusion 8.2.1

Posted: Tue Apr 04, 2017 12:17 pm
by pingking
i discovered the same some days ago and then i read this:
DanielKoch wrote: Fusion's internal management of hotkeys, menus, toolbars etc was rewritten and unified for Fusion 8.1, so legacy menu and hotkey files no longer work.

As Peter has described in the hotkeys thread, UI events now trigger Actions,
maybe the events are now also gone and replace by the actions?

Re: Scriptlib Events & Callbacks Bug in Fusion 8.2.1

Posted: Tue Apr 04, 2017 12:27 pm
by AndrewHazelden
Hi PingKing.

This is a screenshot of the exact page I was referencing in the shiny new BMD Fusion 8 Scripting Manual. It seems to me like someone went to a lot of effort to prepare the content so I think it is more likely just a bug. :roll:
Fusion 8 Scripting Manual.png

Re: Scriptlib Events & Callbacks Bug in Fusion 8.2.1

Posted: Tue Apr 04, 2017 1:20 pm
by pingking
i know about this site in the manual, as said i tried this a couple days ago and failed to (even with the manual)

Re: Scriptlib Events & Callbacks Bug in Fusion 8.2.1

Posted: Tue Apr 04, 2017 2:52 pm
by ShadowMaker SdR
What is the most recent version of the scripting manual? On the site I only find april 2016. That's not really shiny in my personal opinion :-)

Re: Scriptlib Events & Callbacks Bug in Fusion 8.2.1

Posted: Tue Apr 04, 2017 4:45 pm
by SecondMan
Check inside your Fusion install folder, in the Help subdirectory.

Re: Scriptlib Events & Callbacks Bug in Fusion 8.2.1

Posted: Tue Apr 04, 2017 4:48 pm
by AndrewHazelden
ShadowMaker SdR wrote:What is the most recent version of the scripting manual? On the site I only find april 2016. That's not really shiny in my personal opinion :-)
It's all relative I guess. :banghead:

I mean in the context of previously having to use the Internet Archive Wayback Machine site to access a snapshot of the Eyeon VFXPedia resource from the distant past, the graphically layed out and illustrated PDF file is still shiny and new...

Re: Scriptlib Events & Callbacks Bug in Fusion 8.2.1

Posted: Tue Apr 04, 2017 5:01 pm
by SecondMan
AndrewHazelden wrote: I mean in the context of previously having to use the Internet Archive Wayback Machine site to access a snapshot of the Eyeon VFXPedia resource from the distant past, the graphically layed out and illustrated PDF file is still shiny and new...
You do know about this, right?

Re: Scriptlib Events & Callbacks Bug in Fusion 8.2.1

Posted: Tue Apr 04, 2017 5:16 pm
by AndrewHazelden
Yes. I know about the Steak Under Water mirror you've created. It's good to have an archive of everything and your version will likely keep the webpage images intact better than Wayback does over the long run! The copyright date is 23 November 2012 though. Lol.

Re: Scriptlib Events & Callbacks Bug in Fusion 8.2.1

Posted: Wed Apr 05, 2017 12:07 am
by ShadowMaker SdR
SecondMan wrote:Check inside your Fusion install folder, in the Help subdirectory.
I have only the Fusion 8 Tool Manual and the User Manual in there. No scripting manual.

Re: Scriptlib Events & Callbacks Bug in Fusion 8.2.1

Posted: Wed Apr 05, 2017 12:09 am
by SecondMan
Ah yes, scripting manual.

:)

Re: Scriptlib Events & Callbacks Bug in Fusion 8.2.1

Posted: Wed Apr 05, 2017 3:17 am
by AndrewHazelden
ShadowMaker SdR wrote:
SecondMan wrote:Check inside your Fusion install folder, in the Help subdirectory.
I have only the Fusion 8 Tool Manual and the User Manual in there. No scripting manual.
The BMD Scripting Manual is found here:

/Applications/Blackmagic Fusion 8/Developer/Fusion 8 Script Manual.pdf (macOS)
C:\Program Files\Blackmagic Design\Fusion 8\Developer\Fusion 8 Script Manual.pdf (Windows)

Re: Scriptlib Events & Callbacks Bug in Fusion 8.2.1

Posted: Wed May 15, 2019 9:53 pm
by SecondMan

Techniques described above have been deprecated so this won't be fixed. Closing topic.