Skip to content

Commit

Permalink
Merge pull request #22 from cedricduriau/21-jsonfromfileinput
Browse files Browse the repository at this point in the history
implement show input control to allow input connection to path
  • Loading branch information
cedricduriau authored Mar 16, 2020
2 parents df64ce8 + 5b25eb5 commit 3d95f59
Showing 1 changed file with 34 additions and 4 deletions.
38 changes: 34 additions & 4 deletions fusion/Fuses/jsonfromfile.fuse
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,22 @@ FuRegisterClass(FUSE_NAME, CT_Tool, {

function Create()
-- [[ Creates the user interface. ]]
InFile = self:AddInput("File" , "File" , {
InFile = self:AddInput("Input" , "Input" , {
LINKID_DataType = "Text",
INPID_InputControl = "FileControl",
FC_IsSaver = false,
FC_ClipBrowse = false,
LINK_Main = 1,
LINK_Visible = false,
FCS_FilterString = "JSON (*.json)|*.json"
FCS_FilterString = "JSON (*.json)|*.json",
LINK_Main = 1
})

InShowInput = self:AddInput("Show Input", "ShowInput", {
LINKID_DataType = "Number",
INPID_InputControl = "CheckboxControl",
INP_Integer = true,
INP_Default = 0.0,
INP_External = false,
INP_DoNotifyChanged = true
})

OutText = self:AddOutput("Output" , "Output" , {
Expand All @@ -41,6 +49,28 @@ function Create()
})
end

function NotifyChanged(inp, param, time)
--[[
Handles all input control events.

:param inp: Input that triggered a signal.
:type inp: Input

:param param: Parameter object holding the (new) value.
:type param: Parameter

:param time: Current frame number.
:type time: float
]]
if inp == InShowInput then
if param.Value == 1.0 then
InFile:SetAttrs({LINK_Visible = true})
else
InFile:SetAttrs({LINK_Visible = false})
end
end
end

function Process(req)
-- [[ Creates the output. ]]
local rel_path = InFile:GetValue(req).Value
Expand Down

0 comments on commit 3d95f59

Please sign in to comment.