Difference between revisions of "Object"
Jump to navigation
Jump to search
(5 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | The Object is the common base class for all of Silhouette's primary data objects. All objects have a unique id, user-editable label, and contain [[Property|Properties]]. | + | The Object is the common base class for all of Silhouette's primary data objects. All objects have a unique id, user-editable label, and contain [[Property|Properties]]. |
+ | |||
+ | <source lang="python" enclose> | ||
+ | # print the list of property names for the first selected object | ||
+ | object = fx.selection()[0] | ||
+ | print object.properties.keys() | ||
+ | </source> | ||
=== Attributes === | === Attributes === | ||
Line 47: | Line 53: | ||
! scope="col" | Name | ! scope="col" | Name | ||
! scope="col" class="unsortable" | Description | ! scope="col" class="unsortable" | Description | ||
+ | | scope="col" | Added | ||
|- | |- | ||
|property(name) | |property(name) | ||
Line 54: | Line 61: | ||
|returns a deep clone of the object and children | |returns a deep clone of the object and children | ||
|- | |- | ||
− | |getTransform(frame) | + | |getTransform(frame, collapsed=True) |
− | |returns the accumulated [[Matrix|transform]] at the specified time. This is a convenience method only useful for [[Layer|Layers]] and their children. | + | |returns the accumulated [[Matrix|transform]] at the specified time. This is a convenience method only useful for [[Layer|Layers]] and their children. If the object is a [[Layer]] and collapsed is set to False, this returns only the Layer's transform matrix. |
+ | |- | ||
+ | |prepare(object) | ||
+ | |prepares the object for adding to the target Object. It returns the object that should be added, which may possibly be a new object. For instance, when adding a cloned Roto Shape into a Morph Node, this function will convert the Shape for use in the Morph node. | ||
+ | |6.0 | ||
+ | |- | ||
+ | |isType(tyoe) | ||
+ | |returns True if the object is or is derived from the specified type name. | ||
+ | |6.0 | ||
+ | |- | ||
+ | |uniqueLabel(label) | ||
+ | |returns a label that is unique for the object's [[Session]] | ||
+ | |6.0 | ||
+ | |- | ||
+ | |addProperty(prop, after=None) | ||
+ | |adds the user-defined [[Property]] to the object | ||
+ | |6.0 | ||
+ | |- | ||
+ | |removeProperty(prop) | ||
+ | |removes the user-defined [[Property]] from the object | ||
+ | |6.0 | ||
+ | |} | ||
+ | |||
+ | === Operators === | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! scope="col" | Name | ||
+ | ! scope="col" class="unsortable" | Description | ||
+ | |- | ||
+ | |object[prop_id] | ||
+ | |the map operator can be used as shorthand for <tt>object.property(prop_id)</tt> | ||
|} | |} |
Latest revision as of 17:26, 25 July 2018
The Object is the common base class for all of Silhouette's primary data objects. All objects have a unique id, user-editable label, and contain Properties.
# print the list of property names for the first selected object
object = fx.selection()[0]
print object.properties.keys()
Attributes
Attributes are read-only except where noted.
Name | Description |
---|---|
children | List of child objects or None |
color | the object Color - not all objects have a way of changing their color (read/write) |
id | the unique id as string |
label | the object label (read/write) |
locked | True if locked (read/write) |
note | the object note (read/write) |
parent | the parent Object, or None |
properties | the dictionary of Properties |
selected | True if selected |
type | the object type name |
visible | True if visible (read/write) |
Methods
Name | Description | Added |
---|---|---|
property(name) | returns the Property with the property name, or None | |
clone() | returns a deep clone of the object and children | |
getTransform(frame, collapsed=True) | returns the accumulated transform at the specified time. This is a convenience method only useful for Layers and their children. If the object is a Layer and collapsed is set to False, this returns only the Layer's transform matrix. | |
prepare(object) | prepares the object for adding to the target Object. It returns the object that should be added, which may possibly be a new object. For instance, when adding a cloned Roto Shape into a Morph Node, this function will convert the Shape for use in the Morph node. | 6.0 |
isType(tyoe) | returns True if the object is or is derived from the specified type name. | 6.0 |
uniqueLabel(label) | returns a label that is unique for the object's Session | 6.0 |
addProperty(prop, after=None) | adds the user-defined Property to the object | 6.0 |
removeProperty(prop) | removes the user-defined Property from the object | 6.0 |
Operators
Name | Description |
---|---|
object[prop_id] | the map operator can be used as shorthand for object.property(prop_id) |