Fu fu.UIManager doesn't work on Linux  [FIXED]

Moderator: Chad

User avatar
SecondMan
Site Admin
Posts: 3701
Joined: Thu Jul 31, 2014 5:31 pm
Answers: 7
Location: Vancouver, Canada
Been thanked: 131 times
Contact:

fu.UIManager doesn't work on Linux

#1

Post by SecondMan » Wed Feb 22, 2017 6:58 pm

Fusion version:

Fusion Studio 8.2.1 build 6

OS and version:

Ubuntu 12.04

Description of the bug:

Scripts using the new fu.UIManager in Fu8 run fine on Windows, but not on Linux. When the script is run on Linux, an empty box shows with no UI elements at all. No Console messages are thrown when the script is run.

Severity (Trivial, Minor, Major, Critical)

Minor for the moment, but once people start using this it will gradually get more severe... :)

Steps to reproduce:

Download the below script, add to a Fusion Linux install and run it.

Please, if possible, provide a Fusion setup to help demonstrate the behaviour, either as an attachment or between code tags:
Code: [Select all] [Expand/Collapse] [Download] (hos_ConnectMultipleTools_Fu8.lua)
  1.     -- hos_ConnectMultipleTools_Fu8
  2.     -- Connects multiple tool outputs to multiple tool inputs
  3.      
  4.     -- adjusted to work with the new UI system for Fusion 8 by Pieter Van Houte, by example of the "Licensing" UI script by Blackmagic Design
  5.      
  6.     -- THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
  7.     -- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  8.     -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
  9.     -- THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND
  10.     -- DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
  11.     -- UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  12.      
  13.     -----------------------
  14.     -- UI script Fu8
  15.      
  16.     local ui = fu.UIManager
  17.     local disp = bmd.UIDispatcher(ui)
  18.      
  19.     -----------------------
  20.      
  21.     local inputtools = nil
  22.     local outputtools = nil
  23.      
  24.     -- Connect to Fusion instance
  25.      
  26.     if not fusion then
  27.        -- The second argument is the timeout.  Otherwise it will try to connect forever.
  28.        fusion = Fusion("localhost", 10)
  29.     end
  30.      
  31.     -- See if comp exists, if not, grab the current comp from our Fusion instance
  32.     if not comp then
  33.         comp = fusion:GetCurrentComp()
  34.     end
  35.      
  36.     -- If comp still is nil it's safe to asume there are no comps open or something is wrong, we exit the program.
  37.     if not comp then
  38.         print("No active composition found")
  39.         return
  40.     end
  41.      
  42.     -----------------------
  43.     -- window setup
  44.      
  45.     win = disp:AddWindow(
  46.         {
  47.             ID = "ConnectMultipleTools",
  48.             WindowTitle = "Connect Multiple Tools",
  49.             Composition = comp,
  50.             View = view,
  51.      
  52.             ui:VGroup
  53.             {
  54.                 ID = "root",
  55.      
  56.                 ui:HGroup
  57.                 {
  58.                     Weight = 0,
  59.      
  60.                     ui:Button{ ID = "LoadOutputNodes", Text = "Load Output Nodes" },
  61.                     ui:HGap(5), -- fixed 5 pixels
  62.                     ui:LineEdit{ ID = "OutputList", Events= { ReadOnly=true },
  63.                         PlaceholderText = "Outputs: 0",
  64.                         Weight = 1.5,
  65.                         MinimumSize = {100, 24} },
  66.                 },
  67.                
  68.                 ui:HGroup
  69.                 {
  70.                     Weight = 0,
  71.      
  72.                     ui:Button{ ID = "LoadInputNodes", Text = "Load Input Nodes" },
  73.                     ui:HGap(5), -- fixed 5 pixels
  74.                     ui:LineEdit{ ID = "InputList", Events= { ReadOnly=true },
  75.                         PlaceholderText = "Inputs: 0",
  76.                         Weight = 1.5,
  77.                         MinimumSize = {100, 24} },
  78.                 },
  79.                
  80.                 ui:HGroup
  81.                 {
  82.                     Weight = 0,
  83.      
  84.                     ui:Button{ ID = "ConnectNodes", Text = "Connect Nodes" },
  85.                 },
  86.             },
  87.         })
  88.      
  89.      
  90.     -----------------------
  91.     -- worker functions
  92.      
  93.      
  94.     function addSelectionToOutputList()
  95.         outputtools = comp:GetToolList(true)
  96.         itm.OutputList.Text = "Outputs: " .. table.getn(outputtools)
  97.     end
  98.      
  99.     function addSelectionToInput()
  100.         inputtools = comp:GetToolList(true)
  101.         itm.InputList.Text = "Inputs: "..table.getn(inputtools)
  102.     end
  103.      
  104.     function getInput(tool, i)
  105.         -- This returns the main input with index i
  106.         input = tool:FindMainInput(i)
  107.         return input
  108.     end
  109.      
  110.     function getNextInput(tool)
  111.         -- This will search for the next available non-connected input.
  112.         -- We abuse the pcall function by simply increasing the FindMainInput index
  113.         --  until an error occurs (pcall in this case works like a poor mans
  114.         --  try-catch flow.)
  115.         -- If no error occurs we check if the input is connected already, if not
  116.         --  we'll use that one.
  117.         local i = 1
  118.         local status = true
  119.        
  120.         while status == true do
  121.             if pcall(getInput(tool, i)) then
  122.                 -- No error occurred, check if the input is already connected
  123.                 if tool:FindMainInput(i):GetConnectedOutput() == nil then
  124.                     -- Great, it's not, use this one to connect to an output.
  125.                     status = false
  126.                 else
  127.                     -- Move along, this is not the input you are looking for.
  128.                     i = i + 1
  129.                 end
  130.             else
  131.                 -- An error occured, use the previous input.
  132.                 -- A note here:
  133.                 -- This will overwrite connections when not dealing with Merge3D
  134.                 --  tools (as this was initially designed as an example for that
  135.                 --  useage scenario.)
  136.                 i = i - 1
  137.                 status = false
  138.             end
  139.         end
  140.         return tool:FindMainInput(i)
  141.     end
  142.      
  143.     function connectAll()
  144.         -- Connects all inputtools inputs with outputtools outputs
  145.         if inputtools == nil or outputtools == nil then
  146.             print("error")
  147.             return
  148.         end
  149.         if table.getn(inputtools) < 1 or table.getn(outputtools) < 1 then
  150.             print("error")
  151.             return
  152.         end
  153.         for k1, outputtool in pairs(outputtools) do
  154.             for k2, inputtool in pairs(inputtools) do
  155.                 getNextInput(inputtool):ConnectTo(outputtool:FindMainOutput(1))
  156.             end
  157.         end
  158.     end
  159.      
  160.     -----------------------
  161.     -- UI handlers
  162.      
  163.     function win.On.LoadOutputNodes.Clicked(ev)
  164.         addSelectionToOutputList()
  165.     end
  166.      
  167.     function win.On.LoadInputNodes.Clicked(ev)
  168.         addSelectionToInput()
  169.     end
  170.      
  171.     function win.On.ConnectNodes.Clicked(ev)
  172.         connectAll()
  173.     end
  174.      
  175.     function win.On.ConnectMultipleTools.Close(ev)
  176.         disp:ExitLoop()
  177.     end
  178.      
  179.      
  180.     -----------------------
  181.     -- Init
  182.      
  183.      
  184.     itm = win:GetItems()
  185.      
  186.     -----------------------
  187.     -- Event loop
  188.      
  189.     win:Show()
  190.     disp:RunLoop()
  191.     win:Hide()

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

Re: fu.UIManager doesn't work on Linux

#2

Post by AndrewHazelden » Fri Feb 24, 2017 4:26 pm

I checked on Fusion Studio v8.2.1 Build 6 running on macOS and there is only a blank "Connect Multiple Tools" dialog window visible when the script is run here as well. This would seem to indicate the new Fusion UI is only on Windows at the moment.
macos_hos_ConnectMultipleTools_Fu8.png
You do not have the required permissions to view the files attached to this post.

User avatar
DanielKoch
Posts: 34
Joined: Mon Oct 13, 2014 12:22 am
Location: Sydney, Australia

Re: fu.UIManager doesn't work on Linux

#3

Post by DanielKoch » Thu Mar 30, 2017 1:51 am

This is why the UIManager is an "undocumented feature" still (well, one reason :-) - it's not well-tested yet, and not too hard to break. It is certainly implemented for all three platforms (you only have to run the included Licenses.lua script to verify that), but unexpected settings can hit bugs that can behave randomly.

In this case, the issue is that all weights in the VGroup are explicitly set to 0. If you make sure they're non-zero (e.g. all set to 1), or just left unspecified, it'll work fine.

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

Re: fu.UIManager doesn't work on Linux

#4

Post by AndrewHazelden » Thu Mar 30, 2017 2:17 am

Thanks for the ui:VGroup weights tip! I changed the weights settings in each HGroup entry to a unique value and now see the UI working on macOS! :banana:
Fu.UIManager on macOS v2.png
Code: [Select all] [Expand/Collapse] [Download] (hos_ConnectMultipleTools_Fu8.lua)
  1.      -- hos_ConnectMultipleTools_Fu8
  2.     -- Connects multiple tool outputs to multiple tool inputs
  3.      
  4.     -- adjusted to work with the new UI system for Fusion 8 by Pieter Van Houte, by example of the "Licensing" UI script by Blackmagic Design
  5.      
  6.     -- THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
  7.     -- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  8.     -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
  9.     -- THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND
  10.     -- DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
  11.     -- UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  12.      
  13.     -----------------------
  14.     -- UI script Fu8
  15.      
  16.     local ui = fu.UIManager
  17.     local disp = bmd.UIDispatcher(ui)
  18.      
  19.     -----------------------
  20.      
  21.     local inputtools = nil
  22.     local outputtools = nil
  23.      
  24.     -- Connect to Fusion instance
  25.      
  26.     if not fusion then
  27.        -- The second argument is the timeout.  Otherwise it will try to connect forever.
  28.        fusion = Fusion("localhost", 10)
  29.     end
  30.      
  31.     -- See if comp exists, if not, grab the current comp from our Fusion instance
  32.     if not comp then
  33.         comp = fusion:GetCurrentComp()
  34.     end
  35.      
  36.     -- If comp still is nil it's safe to asume there are no comps open or something is wrong, we exit the program.
  37.     if not comp then
  38.         print("No active composition found")
  39.         return
  40.     end
  41.      
  42.     -----------------------
  43.     -- window setup
  44.      
  45.     win = disp:AddWindow(
  46.         {
  47.             ID = "ConnectMultipleTools",
  48.             WindowTitle = "Connect Multiple Tools",
  49.             Composition = comp,
  50.             View = view,
  51.      
  52.             ui:VGroup
  53.             {
  54.                 ID = "root",
  55.      
  56.                 ui:HGroup
  57.                 {
  58.                     Weight = 0,
  59.      
  60.                     ui:Button{ ID = "LoadOutputNodes", Text = "Load Output Nodes" },
  61.                     ui:HGap(5), -- fixed 5 pixels
  62.                     ui:LineEdit{ ID = "OutputList", Events= { ReadOnly=true },
  63.                         PlaceholderText = "Outputs: 0",
  64.                         Weight = 1.5,
  65.                         MinimumSize = {100, 24} },
  66.                 },
  67.                
  68.                 ui:HGroup
  69.                 {
  70.                     Weight = 1,
  71.      
  72.                     ui:Button{ ID = "LoadInputNodes", Text = "Load Input Nodes" },
  73.                     ui:HGap(5), -- fixed 5 pixels
  74.                     ui:LineEdit{ ID = "InputList", Events= { ReadOnly=true },
  75.                         PlaceholderText = "Inputs: 0",
  76.                         Weight = 1.5,
  77.                         MinimumSize = {100, 24} },
  78.                 },
  79.                
  80.                 ui:HGroup
  81.                 {
  82.                     Weight = 2,
  83.      
  84.                     ui:Button{ ID = "ConnectNodes", Text = "Connect Nodes" },
  85.                 },
  86.             },
  87.         })
  88.      
  89.      
  90.     -----------------------
  91.     -- worker functions
  92.      
  93.      
  94.     function addSelectionToOutputList()
  95.         outputtools = comp:GetToolList(true)
  96.         itm.OutputList.Text = "Outputs: " .. table.getn(outputtools)
  97.     end
  98.      
  99.     function addSelectionToInput()
  100.         inputtools = comp:GetToolList(true)
  101.         itm.InputList.Text = "Inputs: "..table.getn(inputtools)
  102.     end
  103.      
  104.     function getInput(tool, i)
  105.         -- This returns the main input with index i
  106.         input = tool:FindMainInput(i)
  107.         return input
  108.     end
  109.      
  110.     function getNextInput(tool)
  111.         -- This will search for the next available non-connected input.
  112.         -- We abuse the pcall function by simply increasing the FindMainInput index
  113.         --  until an error occurs (pcall in this case works like a poor mans
  114.         --  try-catch flow.)
  115.         -- If no error occurs we check if the input is connected already, if not
  116.         --  we'll use that one.
  117.         local i = 1
  118.         local status = true
  119.        
  120.         while status == true do
  121.             if pcall(getInput(tool, i)) then
  122.                 -- No error occurred, check if the input is already connected
  123.                 if tool:FindMainInput(i):GetConnectedOutput() == nil then
  124.                     -- Great, it's not, use this one to connect to an output.
  125.                     status = false
  126.                 else
  127.                     -- Move along, this is not the input you are looking for.
  128.                     i = i + 1
  129.                 end
  130.             else
  131.                 -- An error occured, use the previous input.
  132.                 -- A note here:
  133.                 -- This will overwrite connections when not dealing with Merge3D
  134.                 --  tools (as this was initially designed as an example for that
  135.                 --  useage scenario.)
  136.                 i = i - 1
  137.                 status = false
  138.             end
  139.         end
  140.         return tool:FindMainInput(i)
  141.     end
  142.      
  143.     function connectAll()
  144.         -- Connects all inputtools inputs with outputtools outputs
  145.         if inputtools == nil or outputtools == nil then
  146.             print("error")
  147.             return
  148.         end
  149.         if table.getn(inputtools) < 1 or table.getn(outputtools) < 1 then
  150.             print("error")
  151.             return
  152.         end
  153.         for k1, outputtool in pairs(outputtools) do
  154.             for k2, inputtool in pairs(inputtools) do
  155.                 getNextInput(inputtool):ConnectTo(outputtool:FindMainOutput(1))
  156.             end
  157.         end
  158.     end
  159.      
  160.     -----------------------
  161.     -- UI handlers
  162.      
  163.     function win.On.LoadOutputNodes.Clicked(ev)
  164.         addSelectionToOutputList()
  165.     end
  166.      
  167.     function win.On.LoadInputNodes.Clicked(ev)
  168.         addSelectionToInput()
  169.     end
  170.      
  171.     function win.On.ConnectNodes.Clicked(ev)
  172.         connectAll()
  173.     end
  174.      
  175.     function win.On.ConnectMultipleTools.Close(ev)
  176.         disp:ExitLoop()
  177.     end
  178.      
  179.      
  180.     -----------------------
  181.     -- Init
  182.      
  183.      
  184.     itm = win:GetItems()
  185.      
  186.     -----------------------
  187.     -- Event loop
  188.      
  189.     win:Show()
  190.     disp:RunLoop()
  191.     win:Hide()
You do not have the required permissions to view the files attached to this post.

User avatar
PeterLoveday
Fusioneer
Posts: 162
Joined: Sun Sep 14, 2014 6:09 pm
Answers: 6
Been thanked: 23 times

Re: fu.UIManager doesn't work on Linux

#5

Post by PeterLoveday » Thu Mar 30, 2017 3:26 am

They don't have to be unique, it just gets upset if they're all 0.

The Weight defines how the space is divided amongst the elements of the UI, so in effect it's saying no one gets the space, and winds up with a divide-by-0.

Probably worth making the window a bit smaller by default for this too...

Code: Select all

    win = disp:AddWindow(
        {
            ...
            BaseSize = { 500, 200 },
            ...

User avatar
SecondMan
Site Admin
Posts: 3701
Joined: Thu Jul 31, 2014 5:31 pm
Answers: 7
Location: Vancouver, Canada
Been thanked: 131 times
Contact:

Re: fu.UIManager doesn't work on Linux

#6

Post by SecondMan » Thu Mar 30, 2017 12:25 pm

Hi Peter,


Where exactly would that line be in the above script? I can't see any influence when I put it in there.

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

Re: fu.UIManager doesn't work on Linux

#7

Post by AndrewHazelden » Thu Mar 30, 2017 12:41 pm

Write the BaseSize option in just before the first ui:VGroup entry.

Code: [Select all] [Expand/Collapse] [Download] (hos_ConnectMultipleTools_Fu8_v3.lua)
  1.          -- hos_ConnectMultipleTools_Fu8
  2.         -- Connects multiple tool outputs to multiple tool inputs
  3.          
  4.         -- adjusted to work with the new UI system for Fusion 8 by Pieter Van Houte, by example of the "Licensing" UI script by Blackmagic Design
  5.          
  6.         -- THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
  7.         -- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  8.         -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
  9.         -- THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND
  10.         -- DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
  11.         -- UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  12.          
  13.         -----------------------
  14.         -- UI script Fu8
  15.          
  16.         local ui = fu.UIManager
  17.         local disp = bmd.UIDispatcher(ui)
  18.          
  19.         -----------------------
  20.          
  21.         local inputtools = nil
  22.         local outputtools = nil
  23.          
  24.         -- Connect to Fusion instance
  25.          
  26.         if not fusion then
  27.            -- The second argument is the timeout.  Otherwise it will try to connect forever.
  28.            fusion = Fusion("localhost", 10)
  29.         end
  30.          
  31.         -- See if comp exists, if not, grab the current comp from our Fusion instance
  32.         if not comp then
  33.             comp = fusion:GetCurrentComp()
  34.         end
  35.          
  36.         -- If comp still is nil it's safe to asume there are no comps open or something is wrong, we exit the program.
  37.         if not comp then
  38.             print("No active composition found")
  39.             return
  40.         end
  41.          
  42.         -----------------------
  43.         -- window setup
  44.          
  45.         win = disp:AddWindow(
  46.             {
  47.                 ID = "ConnectMultipleTools",
  48.                 WindowTitle = "Connect Multiple Tools",
  49.                 Composition = comp,
  50.                 View = view,
  51.                
  52.                 -- Modify the window size:
  53.                 -- BaseSize = { 200, 200 },
  54.                 BaseSize = { 600, 200 },
  55.                 -- BaseSize = { 3000, 200 },
  56.                 ui:VGroup
  57.                 {
  58.                     ID = "root",
  59.          
  60.                     ui:HGroup
  61.                     {
  62.                         Weight = 0,
  63.          
  64.                         ui:Button{ ID = "LoadOutputNodes", Text = "Load Output Nodes" },
  65.                         ui:HGap(5), -- fixed 5 pixels
  66.                         ui:LineEdit{ ID = "OutputList", Events= { ReadOnly=true },
  67.                             PlaceholderText = "Outputs: 0",
  68.                             Weight = 1.5,
  69.                             MinimumSize = {100, 24} },
  70.                     },
  71.                    
  72.                     ui:HGroup
  73.                     {
  74.                         Weight = 1,
  75.          
  76.                         ui:Button{ ID = "LoadInputNodes", Text = "Load Input Nodes" },
  77.                         ui:HGap(5), -- fixed 5 pixels
  78.                         ui:LineEdit{ ID = "InputList", Events= { ReadOnly=true },
  79.                             PlaceholderText = "Inputs: 0",
  80.                             Weight = 1.5,
  81.                             MinimumSize = {100, 24} },
  82.                     },
  83.                    
  84.                     ui:HGroup
  85.                     {
  86.                         Weight = 2,
  87.          
  88.                         ui:Button{ ID = "ConnectNodes", Text = "Connect Nodes" },
  89.                     },
  90.                 },
  91.             })
  92.          
  93.          
  94.         -----------------------
  95.         -- worker functions
  96.          
  97.          
  98.         function addSelectionToOutputList()
  99.             outputtools = comp:GetToolList(true)
  100.             itm.OutputList.Text = "Outputs: " .. table.getn(outputtools)
  101.         end
  102.          
  103.         function addSelectionToInput()
  104.             inputtools = comp:GetToolList(true)
  105.             itm.InputList.Text = "Inputs: "..table.getn(inputtools)
  106.         end
  107.          
  108.         function getInput(tool, i)
  109.             -- This returns the main input with index i
  110.             input = tool:FindMainInput(i)
  111.             return input
  112.         end
  113.          
  114.         function getNextInput(tool)
  115.             -- This will search for the next available non-connected input.
  116.             -- We abuse the pcall function by simply increasing the FindMainInput index
  117.             --  until an error occurs (pcall in this case works like a poor mans
  118.             --  try-catch flow.)
  119.             -- If no error occurs we check if the input is connected already, if not
  120.             --  we'll use that one.
  121.             local i = 1
  122.             local status = true
  123.            
  124.             while status == true do
  125.                 if pcall(getInput(tool, i)) then
  126.                     -- No error occurred, check if the input is already connected
  127.                     if tool:FindMainInput(i):GetConnectedOutput() == nil then
  128.                         -- Great, it's not, use this one to connect to an output.
  129.                         status = false
  130.                     else
  131.                         -- Move along, this is not the input you are looking for.
  132.                         i = i + 1
  133.                     end
  134.                 else
  135.                     -- An error occured, use the previous input.
  136.                     -- A note here:
  137.                     -- This will overwrite connections when not dealing with Merge3D
  138.                     --  tools (as this was initially designed as an example for that
  139.                     --  useage scenario.)
  140.                     i = i - 1
  141.                     status = false
  142.                 end
  143.             end
  144.             return tool:FindMainInput(i)
  145.         end
  146.          
  147.         function connectAll()
  148.             -- Connects all inputtools inputs with outputtools outputs
  149.             if inputtools == nil or outputtools == nil then
  150.                 print("error")
  151.                 return
  152.             end
  153.             if table.getn(inputtools) < 1 or table.getn(outputtools) < 1 then
  154.                 print("error")
  155.                 return
  156.             end
  157.             for k1, outputtool in pairs(outputtools) do
  158.                 for k2, inputtool in pairs(inputtools) do
  159.                     getNextInput(inputtool):ConnectTo(outputtool:FindMainOutput(1))
  160.                 end
  161.             end
  162.         end
  163.          
  164.         -----------------------
  165.         -- UI handlers
  166.          
  167.         function win.On.LoadOutputNodes.Clicked(ev)
  168.             addSelectionToOutputList()
  169.         end
  170.          
  171.         function win.On.LoadInputNodes.Clicked(ev)
  172.             addSelectionToInput()
  173.         end
  174.          
  175.         function win.On.ConnectNodes.Clicked(ev)
  176.             connectAll()
  177.         end
  178.          
  179.         function win.On.ConnectMultipleTools.Close(ev)
  180.             disp:ExitLoop()
  181.         end
  182.          
  183.          
  184.         -----------------------
  185.         -- Init
  186.          
  187.          
  188.         itm = win:GetItems()
  189.          
  190.         -----------------------
  191.         -- Event loop
  192.          
  193.         win:Show()
  194.         disp:RunLoop()
  195.         win:Hide()
200x200 window.png
600x200 window.png
3000x200 window.png
You do not have the required permissions to view the files attached to this post.

User avatar
SecondMan
Site Admin
Posts: 3701
Joined: Thu Jul 31, 2014 5:31 pm
Answers: 7
Location: Vancouver, Canada
Been thanked: 131 times
Contact:

Re: fu.UIManager doesn't work on Linux

#8

Post by SecondMan » Thu Mar 30, 2017 1:13 pm

Nope, no workie on Linux (Ubuntu 12.04).

Perhaps also related to this?

User avatar
PeterLoveday
Fusioneer
Posts: 162
Joined: Sun Sep 14, 2014 6:09 pm
Answers: 6
Been thanked: 23 times

Re: fu.UIManager doesn't work on Linux

#9

Post by PeterLoveday » Thu Mar 30, 2017 3:49 pm

Not working on Linux as in, the whole UI still doesn't work, or that setting the BaseSize doesn't work, but the UI is now showing?

User avatar
SecondMan
Site Admin
Posts: 3701
Joined: Thu Jul 31, 2014 5:31 pm
Answers: 7
Location: Vancouver, Canada
Been thanked: 131 times
Contact:

Re: fu.UIManager doesn't work on Linux

#10

Post by SecondMan » Thu Mar 30, 2017 3:54 pm

Setting the BaseSize doesn't work, the UI is now showing and the script itself works :)

User avatar
PeterLoveday
Fusioneer
Posts: 162
Joined: Sun Sep 14, 2014 6:09 pm
Answers: 6
Been thanked: 23 times

Re: fu.UIManager doesn't work on Linux

#11

Post by PeterLoveday » Thu Mar 30, 2017 4:32 pm

Hmm, that's tedious.

One of those platform specific Qt / window manager interactions that's different I suppose.

Could probably just call win:Resize( { 500,150 }) on it after creating the window too.

User avatar
SecondMan
Site Admin
Posts: 3701
Joined: Thu Jul 31, 2014 5:31 pm
Answers: 7
Location: Vancouver, Canada
Been thanked: 131 times
Contact:

Re: fu.UIManager doesn't work on Linux

#12

Post by SecondMan » Thu Mar 30, 2017 7:28 pm

PeterLoveday wrote: Could probably just call win:Resize( { 500,150 }) on it after creating the window too.
Yes, that works just fine:
Code: [Select all] [Expand/Collapse] [Download] (hos_ConnectMultipleInputs_Fu8.lua)
  1. -- hos_ConnectMultipleTools_Fu8
  2. -- Connects multiple tool outputs to multiple tool inputs
  3.  
  4. -- adjusted to work with the new UI system for Fusion 8 by Pieter Van Houte, by example of the "Licensing" UI script by Blackmagic Design
  5.  
  6. -- THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
  7. -- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  8. -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
  9. -- THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND
  10. -- DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
  11. -- UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  12.  
  13. -----------------------
  14. -- UI script Fu8
  15.  
  16. local ui = fu.UIManager
  17. local disp = bmd.UIDispatcher(ui)
  18.  
  19. -----------------------
  20.  
  21. local inputtools = nil
  22. local outputtools = nil
  23.  
  24. -- Connect to Fusion instance
  25.  
  26. if not fusion then
  27.    -- The second argument is the timeout.  Otherwise it will try to connect forever.
  28.    fusion = Fusion("localhost", 10)
  29. end
  30.  
  31. -- See if comp exists, if not, grab the current comp from our Fusion instance
  32. if not comp then
  33.     comp = fusion:GetCurrentComp()
  34. end
  35.  
  36. -- If comp still is nil it's safe to asume there are no comps open or something is wrong, we exit the program.
  37. if not comp then
  38.     print("No active composition found")
  39.     return
  40. end
  41.  
  42. -----------------------
  43. -- window setup
  44.  
  45. win = disp:AddWindow(
  46.     {
  47.         ID = "ConnectMultipleTools",
  48.         WindowTitle = "Connect Multiple Tools",
  49.         Composition = comp,
  50.         View = view,
  51.        
  52.         ui:VGroup
  53.         {
  54.             ID = "root",
  55.  
  56.             ui:HGroup
  57.             {
  58.                 Weight = 1,
  59.  
  60.                 ui:Button{ ID = "LoadOutputNodes", Text = "Load Output Nodes" },
  61.                 ui:HGap(5), -- fixed 5 pixels
  62.                 ui:LineEdit{ ID = "OutputList", Events= { ReadOnly=true },
  63.                     PlaceholderText = "Outputs: 0",
  64.                     Weight = 1.5,
  65.                     MinimumSize = {100, 24} },
  66.             },
  67.            
  68.             ui:HGroup
  69.             {
  70.                 Weight = 1,
  71.  
  72.                 ui:Button{ ID = "LoadInputNodes", Text = "Load Input Nodes" },
  73.                 ui:HGap(5), -- fixed 5 pixels
  74.                 ui:LineEdit{ ID = "InputList", Events= { ReadOnly=true },
  75.                     PlaceholderText = "Inputs: 0",
  76.                     Weight = 1.5,
  77.                     MinimumSize = {100, 24} },
  78.             },
  79.            
  80.             ui:HGroup
  81.             {
  82.                 Weight = 1,
  83.  
  84.                 ui:Button{ ID = "ConnectNodes", Text = "Connect Nodes" },
  85.             },
  86.         },
  87.     })
  88.  
  89. -- modify the window size
  90.  
  91. win:Resize( { 500,150 })
  92.  
  93. -----------------------
  94. -- worker functions
  95.  
  96.  
  97. function addSelectionToOutputList()
  98.     outputtools = comp:GetToolList(true)
  99.     itm.OutputList.Text = "Outputs: " .. table.getn(outputtools)
  100. end
  101.  
  102. function addSelectionToInput()
  103.     inputtools = comp:GetToolList(true)
  104.     itm.InputList.Text = "Inputs: "..table.getn(inputtools)
  105. end
  106.  
  107. function getInput(tool, i)
  108.     -- This returns the main input with index i
  109.     input = tool:FindMainInput(i)
  110.     return input
  111. end
  112.  
  113. function getNextInput(tool)
  114.     -- This will search for the next available non-connected input.
  115.     -- We abuse the pcall function by simply increasing the FindMainInput index
  116.     --  until an error occurs (pcall in this case works like a poor mans
  117.     --  try-catch flow.)
  118.     -- If no error occurs we check if the input is connected already, if not
  119.     --  we'll use that one.
  120.     local i = 1
  121.     local status = true
  122.    
  123.     while status == true do
  124.         if pcall(getInput(tool, i)) then
  125.             -- No error occurred, check if the input is already connected
  126.             if tool:FindMainInput(i):GetConnectedOutput() == nil then
  127.                 -- Great, it's not, use this one to connect to an output.
  128.                 status = false
  129.             else
  130.                 -- Move along, this is not the input you are looking for.
  131.                 i = i + 1
  132.             end
  133.         else
  134.             -- An error occured, use the previous input.
  135.             -- A note here:
  136.             -- This will overwrite connections when not dealing with Merge3D
  137.             --  tools (as this was initially designed as an example for that
  138.             --  useage scenario.)
  139.             i = i - 1
  140.             status = false
  141.         end
  142.     end
  143.     return tool:FindMainInput(i)
  144. end
  145.  
  146. function connectAll()
  147.     -- Connects all inputtools inputs with outputtools outputs
  148.     if inputtools == nil or outputtools == nil then
  149.         print("error")
  150.         return
  151.     end
  152.     if table.getn(inputtools) < 1 or table.getn(outputtools) < 1 then
  153.         print("error")
  154.         return
  155.     end
  156.     for k1, outputtool in pairs(outputtools) do
  157.         for k2, inputtool in pairs(inputtools) do
  158.             getNextInput(inputtool):ConnectTo(outputtool:FindMainOutput(1))
  159.         end
  160.     end
  161. end
  162.  
  163. -----------------------
  164. -- UI handlers
  165.  
  166. function win.On.LoadOutputNodes.Clicked(ev)
  167.     addSelectionToOutputList()
  168. end
  169.  
  170. function win.On.LoadInputNodes.Clicked(ev)
  171.     addSelectionToInput()
  172. end
  173.  
  174. function win.On.ConnectNodes.Clicked(ev)
  175.     connectAll()
  176. end
  177.  
  178. function win.On.ConnectMultipleTools.Close(ev)
  179.     disp:ExitLoop()
  180. end
  181.  
  182.  
  183. -----------------------
  184. -- Init
  185.  
  186.  
  187. itm = win:GetItems()
  188.  
  189. -----------------------
  190. -- Event loop
  191.  
  192. win:Show()
  193. disp:RunLoop()
  194. win:Hide()
  195.  

User avatar
PeterLoveday
Fusioneer
Posts: 162
Joined: Sun Sep 14, 2014 6:09 pm
Answers: 6
Been thanked: 23 times

Re: fu.UIManager doesn't work on Linux  [FIXED]

#13

Post by PeterLoveday » Tue Aug 22, 2017 1:29 am

I think we can consider this "fixed" ? In that we know what works, and other Qt dependent platform things are unlikely to change.