Eyeon:Script/Reference/Applications/Fuse/Classes/Input/GetValue

From VFXPedia

Jump to: navigation, search

Contents


Summary

The GetValue function is used to retrieve the current values of a control from the current render request. The Request object is the only argument this function will accept. GetValue returns either a value or object which represents the current properties of an Input.


Usage

object:GetValue(object Request)

request (required, object)
The Request object is always passed to the Process event function as an argument. See the pages for the Request object and Process event function for more information.


Example

Virtually all Fuse tools use this function. See any of the Example Fuses for details. The following is the complete source code for Null.Fuse, which uses GetValue to pass the input image directly to the output.

--[[--
Null.Fuse 
 
About as simple as it gets. This tool doesn't actually do anything - it just passes the input to the output. An example of the bare minimum required to create a tool.
 
version 1.0
August 21st, 2007
--]]--
 
FuRegisterClass("Null", CT_Tool, {
	REGS_Category = "Fuses\\eyeon\\Examples",
	REGS_OpIconString = "Nul",
	REGS_OpDescription = "Null Fuse",
	REG_OpNoMask = true,
	REG_NoBlendCtrls = true,
	REG_NoObjMatCtrls = true,
	REG_NoMotionBlurCtrls = true,
	})
 
function Create()
 
	InBlank = self:AddInput(" ", "Blank", {
		LINKID_DataType = "Number",
		INPID_InputControl = "LabelControl",
		INP_External = false,
		})			
 
	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)
	img:Use() -- increase the use count, so fusion knows another tools output relies on this image. Helps with caching.
	
	OutImage:Set(req, img)
end


Tips for GetValue (edit)

  • GetValue() returns an object (a subclass of the Parameter class). To get the value as a variable that LUA can process further or compare to other data types, use the corresponding member of the returned object:
Number .Value returns a float variable
Point .X and .Y returns float values of the x and y coordinates
Text .Value returns a string variable
FuID .Value returns a string variable containing the ID