Eyeon:Script/Tutorials/Console Introduction/Object Properties and the Console

From VFXPedia

Jump to: navigation, search

Part 1 : Object properties

The first step to learning eyeonScript is to gain a familiarity with the physical environment you'll be writing scripts in. The Fusion interface has a number of built in features that can be utilized to aid the scripting process. Open a new composition, add a loader, and choose a file sequence. Now, hold your mouse over the Filename area of the Loader. Take note of the text in the bottom left hand corner's status bar:

Loader1.Clip

Add another loader. Do the same thing. What the Fusion interface is telling you in that corner is the name of the tool and the name of the property that the mouse pointer is currently hovering over.

Most property names are obvious - the Global In for a Loader called "Loader" is "Loader.GlobalIn", the loop option is "Loader.Loop", and so forth. Each of these properties can be manipulated by script - the status bar just shows you what the options are called. Many of the scripts you will write will involve reading in or exporting the information held in these properties.

For instance, a loader's Clip property could be used to update a slate's shot name field. Eventually, you could use this information when updating database information, but that's beyond the scope of the current exercise.

Part 2 - The Console

Click on the console view tab - now click on the area that's above the timeline.

Type in the following command:

print("hello")

The console should now have the following text in it (in addition to what was originally there):

print("hello")
hello

The console is generally used as a place where Fusion and where eyeonScript can report messages to the user. Any lines that are preceded by the "" character refer to pieces of information that have been input by the user into the console.

In the above example, we used the print function to display the string "hello" to the user - in this case, you. To display strings in this manner, the quotation marks are required so that eyeonScript doesn't mistake the text for a variable. For example:

print(hello)
nil

In the above case, we attempted to print the value of the variable hello, which is currently undefined. We can define it as anything we want, though:

hello="hey"
print(hello)
hey
hello = "not hello"
print(hello)
not hello
hello = 1+1
print(hello)
2

You can also do mathematical functions within the brackets of the print function:

print(1+10)
11

Displaying string messages like this can be useful if you ever need to return a piece of information about the script to the user, or if you need to find out what the value of a variable/property/attribute is when you're testing scripts. Let's try printing the value of Loader1's Clip:

print(Loader1.Clip)
Input (0x083791a0)

What that message is telling you is that the Clip property is an input - something that we'll learn about later. We are only able to parse an input's value when we relate it to the timeline as though it were a table. In Fusion, any property can change between two time values.

In this case, what we want to see is the value of the Clip at the composition's CurrentTime property (to see what that's currently equal to, print composition.CurrentTime). Table entries can be called by using square brackets.

print(Loader1.Clip[composition.CurrentTime])
C:\Footage\Cineon\aav_lad0001_1k.cin

If you had multiple clips in your loader, the Clip could then equal different values at different times (if you were, for example, to read in the Loader values at their respective GlobalIn points).

To manipulate properties, we can use a similar syntax to what was used before and set the loader's Clip equal to another value.

Loader1.Clip[composition.CurrentTime] = "THIS IS A TEST"

Of course, this isn't a valid path. This is mainly to show how to set a value. Take a bit of time now and try reading in different values of inputs in the composition and setting others. When you feel comfortable with this part of the lesson, move on to the next part.


Tips for Object Properties and the Console (edit)

EyeonTips:Script/Tutorials/Console Introduction/Object Properties and the Console