c4d.modules.mograph.FieldOutput¶
-
class
c4d.modules.mograph.FieldOutput¶ New in version R20.
Attributes
-
c4d.modules.mograph.FieldOutput._value¶ The weight value array.
Type: List[float]
-
c4d.modules.mograph.FieldOutput._alpha¶ The alpha array for color and direction. Only available when color or direction are allocated.
Type: List[float]
-
c4d.modules.mograph.FieldOutput._color¶ The color array.
Type: List[c4d.Vector]
-
c4d.modules.mograph.FieldOutput._direction¶ The slope direction array.
Type: List[c4d.Vector]
-
c4d.modules.mograph.FieldOutput._rotation¶ The rotational velocity array.
Type: List[c4d.Vector]
-
c4d.modules.mograph.FieldOutput._pivot¶ The rotational velocity (axe + magnitude)
Type: List[c4d.Vector]
-
c4d.modules.mograph.FieldOutput._deactivated¶ The deactivated state array.
Type: List[bool]
Overview¶
Creates a |
Construction And Access |
|
Retrieves all arrays in a |
|
Gets a sub-section of the sampling arrays. |
|
Copying |
|
Copies from src array content. |
|
Copies from |
|
Magic Methods |
|
Creates a |
|
Memory Management |
|
Clears the deactivated array. |
|
Resets the sampling data to default values. |
|
Flushes the |
|
Resets the |
|
Resizes the arrays held in the FieldOutput. |
|
Sample Channels |
|
Reads alpha at specified index. |
|
Reads color at specified index. |
|
Reads deactivated state at specified index. |
|
Reads direction at specified index. |
|
Retrieve the rotational velocity (axe + magnitude) at specified index. |
|
Reads rotation at specified index. |
|
Reads value at specified index. |
|
Writes alpha at specified index. |
|
Writes color at specified index. |
|
Writes deactivated state at specified index. |
|
Writes direction at specified index. |
|
Writes rotation at specified index. |
|
Writes value at specified index. |
|
State And Validation |
|
Calculates a Crc on all internal data. |
|
Returns the number of elements in the sample arrays. |
|
Checks if the |
|
Checks if the |
|
Members¶
Construction And Access¶
-
static
FieldOutput.Create(size, flags=3, src=None)¶ Creates a
FieldOutputwith the specified sampling arrays.- Parameters
size (int) – The size.
flags (int) –
The flags:
FIELDSAMPLE_FLAG_VALUE
Sample only the value.
FIELDSAMPLE_FLAG_DIRECTION
Sample the velocity.
FIELDSAMPLE_FLAG_COLOR
Sample the color.
FIELDSAMPLE_FLAG_ROTATION
Sample the rotational velocity.
src (Optional[c4d.modules.mograph.FieldOutputBlock]) – Alternatively pass only a source
FieldOutputBlockto copy its size and arrays.
- Return type
- Returns
The created
FieldOutputinstance.
Construction And Access¶
-
FieldOutput.GetBlock(self)¶ Retrieves all arrays in a
FieldOutputBlock.- Return type
- Returns
A sub-block for the whole
FieldOutput.
-
FieldOutput.GetSubBlock(self, offset, size)¶ Gets a sub-section of the sampling arrays.
- Parameters
offset (int) – The offset index to retrieve a sub-block starting at.
size (int) – The suggested size of the block. Note the function clamps the size against the maximum number of entries.
- Return type
- Returns
The requested sub-block.
Copying¶
-
FieldOutput.CopyArrayContentFrom(self, src)¶ Copies from src array content.
Note
Size and flags are not affected byCopyArrayContentFrom().Source data is copied into target up to current size. If target is bigger than source, the remaining items are cleared.- Parameters
src (Union[c4d.modules.mograph.FieldOutput, c4d.modules.mograph.FieldOutputBlock]) – The source
FieldOutputorFieldOutputBlock.- Return type
bool
- Returns
True if successful, otherwise False.
-
FieldOutput.CopyFrom(self, src)¶ Copies from
FieldOutputsrc. Performs a deep copy.- Parameters
src (c4d.modules.mograph.FieldOutput) – The source
FieldOutput.- Return type
bool
- Returns
True if successful, otherwise False.
Magic Methods¶
-
FieldOutput.__init__(self)¶ Creates a
FieldOutputinstance.
Memory Management¶
-
FieldOutput.ClearDeactivated(self, state=False)¶ Clears the deactivated array.
- Parameters
state (bool) – The state the deactivated array should be cleared to.
-
FieldOutput.ClearMemory(self, startIdx=0, count=<function FieldOutput.GetCount at 0x0000012ECE95E250>, deactivatedOnly=False, deactivatedState=False)¶ Resets the sampling data to default values.
Note
Values are reset to 0, colors to 1.0, direction to 0, deactivated to 0.
- Parameters
startIdx (int) – The index to start at.
count (int) – The number of array elements to reset to default value.
deactivatedOnly (bool) – True to clear deactivated only, otherwise False.
deactivatedState (bool) – The state the deactivated array should be cleared to.
-
FieldOutput.Flush(self)¶ Flushes the
FieldOutputinstance, keeping the arrays allocated for future resize.
-
FieldOutput.Reset(self)¶ Resets the
FieldOutputinstance to an empty state.Note
All memory is deallocated.
-
FieldOutput.Resize(self, newSize, sampleFlags=0, resizeFlags=2)¶ Resizes the arrays held in the FieldOutput.
Note
Unspecified channel arrays are resized to 0 length according to resizeFlags.
- Parameters
newSize (int) – The new size for the arrays.
sampleFlags (int) –
The channels to sample:
resizeFlags (int) – The flags for the resize.
- Return type
bool
- Returns
True if successful, otherwise False.
Sample Channels¶
-
FieldOutput.GetAlpha(self, index)¶ Reads alpha at specified index.
- Parameters
index (int) – The index in the array.
- Raises
IndexError – If the index is out of range : 0<=index<
GetCount().- Return type
float
- Returns
The alpha.
-
FieldOutput.GetColor(self, index)¶ Reads color at specified index.
- Parameters
index (int) – The index in the array.
- Raises
IndexError – If the index is out of range : 0<=index<
GetCount().- Return type
- Returns
The color.
-
FieldOutput.GetDeactivated(self, index)¶ Reads deactivated state at specified index.
- Parameters
index (int) – The index in the array.
- Raises
IndexError – If the index is out of range : 0<=index<
GetCount().- Return type
bool
- Returns
The deactivated state.
-
FieldOutput.GetDirection(self, index)¶ Reads direction at specified index.
- Parameters
index (int) – The index in the array.
- Raises
IndexError – If the index is out of range : 0<=index<
GetCount().- Return type
- Returns
The direction.
-
FieldOutput.GetPivot(self, index)¶ Retrieve the rotational velocity (axe + magnitude) at specified index.
New in version R21.
- Parameters
index (int) – The index in the array.
- Raises
IndexError – If the index is out of range : 0<=index<
GetCount().- Return type
- Returns
The rotational velocity (axe + magnitude).
-
FieldOutput.GetRotation(self, index)¶ Reads rotation at specified index.
- Parameters
index (int) – The index in the array.
- Raises
IndexError – If the index is out of range : 0<=index<
GetCount().- Return type
- Returns
The rotation.
-
FieldOutput.GetValue(self, index)¶ Reads value at specified index.
- Parameters
index (int) – The index in the array.
- Raises
IndexError – If the index is out of range : 0<=index<
GetCount().- Return type
float
- Returns
The value.
-
FieldOutput.SetAlpha(self, index, alpha)¶ Writes alpha at specified index.
- Parameters
index (int) – The index in the array.
alpha (float) – The alpha to set.
- Raises
IndexError – If the index is out of range : 0<=index<
GetCount().
-
FieldOutput.SetColor(self, index, color)¶ Writes color at specified index.
- Parameters
index (int) – The index in the array.
color (c4d.Vector) – The color to set.
- Raises
IndexError – If the index is out of range : 0<=index<
GetCount().
-
FieldOutput.SetDeactivated(self, index, deact)¶ Writes deactivated state at specified index.
- Parameters
index (int) – The index in the array.
deact (bool) – The deactivated state to set.
- Raises
IndexError – If the index is out of range : 0<=index<
GetCount().
-
FieldOutput.SetDirection(self, index, direction)¶ Writes direction at specified index.
- Parameters
index (int) – The index in the array.
direction (c4d.Vector) – The direction to set.
- Raises
IndexError – If the index is out of range : 0<=index<
GetCount().
-
FieldOutput.SetRotation(self, index, rotation, pivot)¶ Writes rotation at specified index.
Changed in version R21.
- Parameters
index (int) – The index in the array.
rotation (c4d.Vector) – The rotation to set.
pivot (c4d.Vector) – The rotational velocity.
- Raises
IndexError – If the index is out of range : 0<=index<
GetCount().
-
FieldOutput.SetValue(self, index, value)¶ Writes value at specified index.
- Parameters
index (int) – The index in the array.
value (float) – The value to set.
- Raises
IndexError – If the index is out of range : 0<=index<
GetCount().
State And Validation¶
-
FieldOutput.CalculateCrc(self)¶ Calculates a Crc on all internal data.
Note
Crc is not kept internally and is calculated from scratch on each
CalculateCrc()call.- Return type
int
- Returns
The calculated Crc.
-
FieldOutput.GetCount(self)¶ Returns the number of elements in the sample arrays.
- Return type
int
- Returns
The number of elements.
-
FieldOutput.IsPopulated(self)¶ Checks if the
FieldOutputis valid and non-empty.- Return type
bool
- Returns
True if the
FieldOutputinstance is populated, otherwise False.
-
FieldOutput.IsValid(self)¶ Checks if the
FieldOutputinstance allocations and sizes are valid.Note
An empty
FieldOutputinstance is considered valid.- Return type
bool
- Returns
True if the
FieldOutputinstance is valid, otherwise False.