Eyeon:Script/Reference/Applications/Fuse/Classes/ScriptOperator/SetProgress
From VFXPedia
< Eyeon:Script | Reference | Applications | Fuse | Classes | ScriptOperator
Contents |
Summary
The SetProgress function can be used to update a progress bar drawn on the tools tile in the flow. This function will also return the value of the ScriptOperator member Eyeon:Script/Reference/Applications/Fuse/Classes/ScriptOperator/Status and return the boolean value true if the tool is aborting rendering.
Usage
self:SetProgress(number progress)
- progress (number, required)
- A numeric value between 0 and 1 which indicates how to draw the progress bar. A value of .25 would show the tools progress as 25% complete. A value of .75 would show it as 75% complete.
Example
The following example is a slightly modified version of the Gain.Fuse found on the Example Fuses page. The progress bar is updated after each horizontal scanline in the image is complete.
FuRegisterClass("Gain", CT_Tool, { REGS_Category = "Fuses", REGS_OpIconString = "fGn", REGS_OpDescription = "Gain Fuse", }) function Create() InGain = self:AddInput("Gain", "Gain", { LINKID_DataType = "Number", INPID_InputControl = "SliderControl", INP_Default = 2.0, }) InImage = self:AddInput("Input", "Input", { LINKID_DataType = "Image", LINK_Main = 1, }) OutImage = self:AddOutput("Output", "Output", { LINKID_DataType = "Image", LINK_Main = 1, }) end function Process(req) local img = InImage:GetValue(req) local gain = InGain:GetValue(req).Value local out = Image({IMG_Like = img}) local p = Pixel() for y=0,img.Height-1 do if self.Status ~= "OK" then break end for x=0,img.Width-1 do img:GetPixel(x,y, p) p.R = p.R * gain p.G = p.G * gain p.B = p.B * gain out:SetPixel(x,y, p) end self:SetProgress(y/img.Height) end OutImage:Set(req, out) end
Tips for SetProgress (edit)
EyeonTips:Script/Reference/Applications/Fuse/Classes/ScriptOperator/SetProgress