Eyeon:Script/Reference/Applications/Fuse/Classes/Input/CrossHairControl
From VFXPedia
Contents |
CrosshairControl
Description
The crosshair control is an preview control that shows a crosshair to represent the position of Point value. The crosshair is added to an Input by setting the INPID_PreviewControl attribute of an input to "CrosshairControl" in the AddInput function's attribute table.
Attributes
CHC_Style string : Determines the appearance of the crosshair control. Can be set to "NormalCross", "DiagonalCross", "Rectangle", or "Circle".
.
Example
The FuseTransform.Fuse example found at Example Fuses is a good example of the CrossHair control.
The following example is a very simplified Fuse which uses a crosshair control to transform an image.
FuRegisterClass("SampleOffset", CT_Tool, { REGS_Category = "Fuses\\Samples", REGS_OpIconString = "SOf", REGS_OpDescription = "SampleOffset", }) function Create() InCenter = self:AddInput("Center", "Center", { LINKID_DataType = "Point", INPID_InputControl = "OffsetControl", INPID_PreviewControl = "CrosshairControl", }) 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 center = InCenter:GetValue(req) out = img:Transform(nil, { XF_XOffset = center.X, XF_YOffset = center.Y, XF_XAxis = 0.5, XF_YAxis = 0.5, XF_XSize = 1, XF_YSize = 1, XF_Angle = 0, XF_EdgeMode = "Black", }) OutImage:Set(req, out) end
Tips for CrossHairControl (edit)
There are attributes that apply to all preview controls. PCD_OffsetX and PCD_OffsetY will shift the crosshair in the viewer by the specified distance. This is useful if you want a pivot crosshair to follow the translation crosshair (as is the case with Fusion's transform tool). To implement this behavior, you need to update those attributes in the NotifyChanged() event handler.