diff --git a/fusion/Fuses/jsonfromfile.fuse b/fusion/Fuses/jsonfromfile.fuse index 9996604..005f6ac 100644 --- a/fusion/Fuses/jsonfromfile.fuse +++ b/fusion/Fuses/jsonfromfile.fuse @@ -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" , { @@ -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