Eyeon:Script/General Concepts/Inputs and Outputs

From VFXPedia

< Eyeon:Script | General Concepts
Revision as of 14:07, 30 April 2007 by Daniel (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

What is an Input?

An input is an object that will accept any supported datatype, such as a number, a point, or an image. Inputs (especially numeric types) are often driven by a control such as a slider. A simple example of this in Fusion would be a Text Plus tool's StyledText area. In this area the user can enter text data that Fusion will then output as an image of that text.

In eyeonScript, if you attempt to print a text's StyledText input without any further qualification, then it will display the object handle that's used by Fusion for that input. This handle is used for manipulating that input, such as connecting it to an output. In order for the value of an input to be read, Fusion needs to have an indication of where in the timeline the information the user is trying to access comes from. Essentially, the properties of a tool's control are stored in an internal list, indexed by time.

For example, if one wanted to display the text of an unanimated Text Plus tool (named Text1), what one could do is type the following into the console:

print(Text1.StyledText[TIME_UNDEFINED])

In this case, we are referring to the time entry of Text1.StyledText at the time of TIME_UNDEFINED, which is simply a value that says "I don't care what time value you use". If the property eyeonScript is looking at is non-animated, we could just as easily have referred to Text1.StyledText[1] or Text1.StyledText[13525]. In such a case, all time values would print the same thing in the console. If the value was animated, one could find out what the keyframe times are by utilizing the GetKeyFrames() function and then use those to read in what the value is of the StyledText input at those times. If there were key frames at time 3 and 5, their values could be printed with the following code:

print(Text1.StyledText[3])
 
print(Text1.StyledText[5])

To set the value of an input, you can use the following code:

Text.StyledText[10] = "Hello World"

This will set the value of the StyledText input at time 10 to be the text "Hello World". It is also possible to leave the bracketed time value off altogether, as follows:

Text.StyledText = "Hello World"

This is a shorthand approach that sets the value of StyledText at the Current Time (as defined in the Composition object). It is also useful if the input is not animated (in which case, all times will contain the same value).

To view a listing of all inputs available in a tool, use the GetInputList() function, which returns a table of inputs available to a tool.

What is an Output?

Similar to an Input, an Output is instead used to retrieve the result of a tool. As with Inputs, this can be a number, an image, or any other supported datatype. In Fusion's Flow view, a tool's red connector is its output, and is used to get the image that the tool has created from all of its various inputs. Beyond that, individual inputs can be connected to outputs of tools such as Bezier Splines or other controls that aren't visible in the tool's properties.

As another example, an Expression modifiers's output value (called Value, incidentally) can be viewed as a curve in the spline editor, but is not an actual control in its own right that can be viewed in the Controls window.

To view a table of all outputs available to a tool, use the GetOutputList() function.

Final Note

All inputs and outputs in Fusion have attributes much in the same way that tools and other objects have attribute. To view a table of the inputs and outputs available to a tool, use the GetInputList() and GetOutputList() functions. To see what the name of a specific input or output is, use the GetAttrs() function on the appropriate entry to output an attributes table. From this you can obtain the input/output's name and other details.


Tips for Inputs and Outputs (edit)

Example

To extract the names of the inputs from a tool:

for _, input in ipairs(tool:GetInputList()) do print(input:GetAttrs().INPS_Name) end