c4d.InstanceObject¶
-
class
c4d.
InstanceObject
¶ - Class that contains the minimal data to represent one or multiple instances of an object.This InstanceObject has two modes : single-instance mode or multi-instance mode.
The instance object class of type Oinstance.
New in version R20.
Methods Signatures
Creates an |
Checks if the instance object is in multi-instance mode. |
|
Return the instantiated object. |
|
Sets the instantiated object used for the multiple instances. |
|
Returns the instance count (number of instances and matrices). |
|
Returns the global matrix of the instance at the specified index. |
|
Returns the instance matrices. |
|
Sets the instance matrices. |
|
Returns the color of the instance at the specified index. |
|
Returns the instance colors. |
|
Sets the instance colors. |
Inheritance
Parent Class:
Methods Documentation
-
InstanceObject.
__init__
(self)¶ Creates an
InstanceObject
.- Return type
- Returns
An
InstanceObject
instance.
-
InstanceObject.
IsMultiInstance
(self)¶ Checks if the instance object is in multi-instance mode.
- Return type
bool
- Returns
True if in multi-instance mode, otherwise False.
-
InstanceObject.
GetReferenceObject
(self, doc)¶ Return the instantiated object.
Note
Same as accessing the INSTANCEOBJECT_LINK parameter in the object’s data container.
- Parameters
doc (c4d.documents.BaseDocument) – The document the instance object belongs to.
- Return type
- Returns
The reference object. None if the instance object is unassigned.
-
InstanceObject.
SetReferenceObject
(self, refObj)¶ Sets the instantiated object used for the multiple instances.
Note
Same as assigning the INSTANCEOBJECT_LINK parameter in the object’s data container.
- Parameters
refObj (c4d.BaseObject) – The reference object to set.
-
InstanceObject.
GetInstanceCount
(self)¶ Returns the instance count (number of instances and matrices).
- Return type
int
- Returns
The instance count.
-
InstanceObject.
GetInstanceMatrix
(self, index)¶ Returns the global matrix of the instance at the specified index.
- Parameters
index (int) – The instance index.
- Return type
- Returns
The instance matrix.
-
InstanceObject.
GetInstanceMatrices
(self)¶ Returns the instance matrices.
- Return type
List[c4d.Matrix]
- Returns
The list of instance matrices.
-
InstanceObject.
SetInstanceMatrices
(self, matrices)¶ Sets the instance matrices.
Note
The size of matrices iterable determines the instance count.
- Parameters
matrices (Union[List[c4d.Matrix], Tuple[c4d.Matrix]]) – The iterable (list or tuple) for the instance matrices to set.
- Return type
bool
- Returns
True if successful, otherwise False.
-
InstanceObject.
GetInstanceColor
(self, index)¶ Returns the color of the instance at the specified index.
- Parameters
index (int) – The instance index.
- Return type
- Returns
The instance color.
-
InstanceObject.
GetInstanceColors
(self)¶ Returns the instance colors.
- Return type
List[c4d.Vector]
- Returns
The list of instance colors.
-
InstanceObject.
SetInstanceColors
(self, colors)¶ Sets the instance colors.
- Parameters
colors (Union[List[c4d.Vector], Tuple[c4d.Vector]]) – The iterable (list or tuple) for the instance colors to set.
- Return type
bool
- Returns
True if successful, otherwise False.