EyeonTips:Script/Reference/Applications/Fuse/Classes/ScriptOperator/AddInput

From VFXPedia

< EyeonTips:Script | Reference/Applications/Fuse/Classes/ScriptOperator
Revision as of 17:05, 3 May 2013 by Tilt (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

ComboIDControl

The ComboIDControl is like a ComboControl that uses FuID parameters instead of numbers. This is useful if you want to re-order the entries in the dropdown which would change the index values that existing code and compositions might already rely on. In addition to CCS_AddString you simply add a CCID_AddID attribute that will be used as the ID. Default values have to be set via INPID_Default instead of INP_Default.

InDirection = self:AddInput("Direction of Camera", "Direction", {
	LINKID_DataType = "FuID",
	INPID_InputControl = "ComboIDControl",
	{ CCS_AddString = "+X Axis: Right", CCID_AddID = "Right", },
	{ CCS_AddString = "-X Axis: Left",  CCID_AddID = "Left", },
	{ CCS_AddString = "-Z Axis: Front", CCID_AddID = "Front", },
	{ CCS_AddString = "+Z Axis: Back",  CCID_AddID = "Back", },
	INPID_DefaultID = "Front",
	})

Return values of a ComboIDControl are of type FuID. You need to use .Value to get the string:

local direction = InDirection:GetValue(request).Value


MultiButtonIDControl

This is to MultiButtonControls what ComboIDControl is to ComboControls: it returns FuIDs instead of numbers. The attributes are as follows:

InInterpolation = self:AddInput("Gradient Interpolation Method", "GradientInterpolationMethod", {
	LINKID_DataType      = "FuID",
	INPID_InputControl   = "MultiButtonIDControl",
	{ MBTNC_AddButton = "RGB", MBTNCID_AddID = "RGB", },
	{ MBTNC_AddButton = "HLS", MBTNCID_AddID = "HLS", },
	{ MBTNC_AddButton = "HSV", MBTNCID_AddID = "HSV", },
	{ MBTNC_AddButton = "LAB", MBTNCID_AddID = "LAB", },
	MBTNC_StretchToFit   = true,
	INPID_DefaultID      = "HLS",
	})


TextEditControl

The Annotate fuse that ships with Fusion demonstrates the use of TextEditControl. These are the available attributes (taken from StandardControls.h of the Fusion SDK):

InTextEntry = self:AddInput("Type Your Text", "Text", {
	LINKID_DataType = "Text",
	INPID_InputControl = "TextEditControl",
	INPS_DefaultText = "hello",  -- use instead of INP_Default!
	TEC_Lines = 3,               -- height of text entry (default is 8)
	TEC_Wrap = true,             -- automatic word-wrapping (default is false)
	TEC_ReadOnly = true,         -- default is false (you should also set INP_External = false)
	TEC_CharLimit = 40,	     -- maximum number of allowed characters (default is 0, no limit)
	TEC_DeferSetInputs = true,   -- call NotifyChanged when focus is lost (default is false, call on every key stroke)
	})

Return values of a TextEditControl are of type Text. You need to use .Value to get the string:

local text = InTextEntry:GetValue(request).Value

Single lines of read-only text (e.g. messages) can also be displayed by using a LabelControl.

IC_ControlID

The value of IC_ControlID is sometimes related to a specific image channel. For example, if an X position slider can have its value set by a pick button (see BeginControlNest), it needs to know that it should read the image's "position x" channel. Also, Image:GetChanSize() accepts these to query available image channels. Here's an abbreviated list of valid values, taken from Pixel.h (part of the SDK). Fusion 6.31 or later supports the uppercase channel constants. Earlier versions accept integers only.

0
1
2
3
4
5
6
7
CHAN_RED
CHAN_GREEN
CHAN_BLUE
CHAN_ALPHA
CHAN_BGR
CHAN_BGG
CHAN_BGB
CHAN_BGA
12
13
14
15
16
17
CHAN_Z
CHAN_U
CHAN_V
CHAN_COVERAGE
CHAN_OBJECT
CHAN_MATERIAL
18
19
20
21
22
23
24
CHAN_NORMALX
CHAN_NORMALY
CHAN_NORMALZ
CHAN_VECTORX
CHAN_VECTORY
CHAN_BACKVECTORX
CHAN_BACKVECTORY
25
26
27
28
29
CHAN_POSITIONX
CHAN_POSITIONY
CHAN_POSITIONZ
CHAN_DISPARITYX
CHAN_DISPARITYY

More Input Attributes

Here's a list of input attributes, some of which are not listed above.