Eyeon:Script/Reference/Applications/Fusion/Classes/Fusion/SetData
From VFXPedia
Fusion : SetData
Contents |
Description
Allows the script to assign persistent custom data to objects in Fusion. Persistent data can be attached to individual Tools, the Composition, or even Fusion itself. Use the GetData function to retrieve the values assigned by SetData.
Usage
value = Fusion:SetData(string index, value)
Arguments
- name (required, string)
A string value used as the index, or name, of the custom data.
- value (required, any)
The custom data to be assigned to the index specified in the first argument.
Returns
No return value.
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: GetData
Tips for SetData (edit)
EyeonTips:Script/Reference/Applications/Fusion/Classes/Fusion/SetData