Eyeon:Script/Reference/Applications/Fuse/Classes/Image/Use

From VFXPedia

Jump to: navigation, search

Contents


Summary

The Use function increases the reference count for the image. The reference count helps Fusion determine when an image should stay in memory, and when the memory occupied by that image can be recycled. Typically this function is called when the input Image of a tool is being passed directly to the output Image, as in the following example.


Usage

Image:Use()


Example

This is the Null.Fuse example from Eyeon:Script/Reference/Applications/Fuse/Example_Fuses

--[[--
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()
	
	OutImage:Set(req, img)
end


Tips for Use (edit)

Use() as well as its cousin Recycle() should no longer be used for Fuses. In recent versions, the above example will prevent Fusion from freeing the memory allocated for the image object.