Eyeon:Script/Reference/Applications/Fusion/Classes/Fusion/GetData

From VFXPedia

Jump to: navigation, search

Fusion : GetData

Contents


Description

Allows the script to retrieve persistent custom data attached to object types in Fusion. Persistent data can be attached to individual Tools, the Composition, or even Fusion itself with the SetData function.

Usage

value = Fusion:GetData(string name)


Arguments

  • name (optional, string)


Returns

When called without an argument, GetData returns a table listing the index names for all current custom data. If no custom data has been assigned to the object, then the function returns an empty table.

When called with a the name of an index as an argument, GetData returns the value for that index. The return value of GetData can be any type recognized by eyeonScript, including number, string, boolean and table values. The return value will be nil if no data is stored with the index provided by the argument name.


Example

The following example is a simplified version of the Comp Script 'Switch Motion Blur.eyeonscript' which is shipped with Fusion 5 and later. It will toggle the current state of the motion blur checkbox on all selected tools. In this case the GetData and SetData functions are used to attach custom data to each tool which has had its motion blur turned off by the script.

-- get the users input
local ret = composition:AskUser("Toggle Motion Blur", {
			{"disable", Name = "Disable Motion Blur", "Checkbox", Default = 0, NumAcross = 2},
			})
 
-- did they cancel?
if ret == nil then
	return
else 
	tools = composition:GetToolList(true)
end
 
 
if ret.disable == 1 then
	for i,tool in tools do
		if tool.MotionBlur > 0.0 then
			
			if tool.MotionBlur:GetConnectedOutput() == nil then
				tool:SetData("Motion Blur Was On", true)
				tool.MotionBlur = 0
			end
		end
		composition:SetData("Motion Blur Enabled", 0)
		
	end
	
else
	for i,tool in tools do
		if tool:GetData("Motion Blur Was On") then
			tool:SetData("Motion Blur Was On", nil)
			tool.MotionBlur = 1
		end
	end
end

See Also

See Also: SetData


Tips for GetData (edit)

EyeonTips:Script/Reference/Applications/Fusion/Classes/Fusion/GetData