Eyeon:Script/General Concepts/Creating Tools and Modifiers

From VFXPedia

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

Contents

Getting Started : Adding Tools

Every tool within Fusion has an associated function that can be called to add tools to the composition. This function is named in a similar fashion to a tool's TOOLS_RegID attribute. For example in order to create a merge tool, the following syntax would be used:

Merge({})

One could also pass information into the table brackets with values for various controls within the tool to be added. For instance:

Merge({Blend = 0.5, Comments = "Test"})

When a tool is created it also returns an object handle that can be used to manipulate the newly created tool. For example:

merge1 = Merge({Blend = 0.5, Comments = "Test"})
 
print(merge1)
 
print(merge1.Blend[CurrentTime])
 
merge1.Blend = 0
 
print(merge1.Blend[CurrentTime])

Adding Masks and Modifiers to Tools

Adding Masks

Although you can't effectively add polygons via script (they will come into existence, but without any points), you can add all other masks and manipulate their properties in a similar way to how you add any other tool via script. When adding a mask through script, the tool must be added to a tool's EffectMask (or GlowMask, GarbageMatte, et-cetera) property in order for the mask to have any effect. So, if the desire was to add a rectangle to a Matte Control's effect mask, the procedure would be:

rect1 = Rectangle({})
 
MatteControl1.EffectMask=rect1.Output

However, the EffectMask category can only have one mask in it at a time. If a second rectangle was needed, the procedure would go as such:

rect2 = Rectangle({PaintMode = 2})
 
rect1.EffectMask = rect2.Output

To determine what a tool's effect mask is, use the GetConnectedOutput() and GetTool() functions.

Adding Modifiers

The method used to add modifiers is similar to that of adding masks. Simply create the modifier in a variable and then set the property that will be manipulated equal to the modifier. For example, if an offset position was needed on the rectangle from the above (rect1) Center's property, the following could be done:

op = Offset({})
 
rect1.Center = op

To reset a mask or a modifier, all that is needed is to make the value equal to nil.

rect1.Center = nil
 
rect1.EffectMask = nil

In the case of masks, the mask will just be disconnected. In the case of modifiers, the modifier will be deleted.


Tips for Creating Tools and Modifiers (edit)

  • In Python, you can't just call BezierSpline() or Offset() to create an unconnected modifier. Instead, use composition.AddTool() or a tool's AddModifier() function which connects the new modifier to an input automatically. Of course, both can be used in LUA as well.