The root of the tree is accessed by
As usual,
will display all variables. The ones in the plural form are usually an array of Element children:
layers
,
modifiers
and
tools
. They themselves can have children arrays, and it's possible to iterate upon them.
Beware that rootElement is different in different Element trees: if the script is located in the Stage it will be a RootStageElement, in the Show it will be a Scene, and so on.
The script.document will return the file (project or compo) you are currently working in. There are a lot of interesting properties that can be accessed; once again use
or Use Oil.docMe() to get a view of the possibilities
a best way to have an idea of what an object can do
Read More to list them. For instance you can get the Stage with
The following properties can be used to navigate more precisely starting from any Element:
parent
returns the object that owns the caller; for instance an array
parentElement
same, but the returned object is an Element (for instance, since an array is not an Element, it will probably fallback to be the owner of the array)
parentElementInTree
some Elements are hidden in the Element tree (Placements for instance). This returns the first Element that is present in the tree.
Most importantly it is possible to drag and drop an Element from the ElementTree directly in the script. The path to this Element will be automatically pasted, but beware that this is a hard-coded path. Also, it works if the script is in the same tree. If you want to have a link robust to path changes, you can Expose Python scripts parameters
Configurable parameter for scripts
Read More in the beginning of the script and drag the Element on it.