c4d.modules.mograph.FieldOutput

New in version R20.

Members

FieldOutput._value

The weight value array.

Type: List[float]

FieldOutput._alpha

The alpha array for color and direction. Only available when color or direction are allocated.

Type: List[float]

FieldOutput._color

The color array.

Type: List[c4d.Vector]

FieldOutput._direction

The slope direction array.

Type: List[c4d.Vector]

FieldOutput._rotation

The rotational velocity array.

Type: List[c4d.Vector]

FieldOutput._deactivated

The deactivated state array.

Type: List[bool]

FieldOutput.__init__()

Creates a FieldOutput instance.

Return type:c4d.modules.mograph.FieldOutput
Returns:The created FieldOutput instance.
static FieldOutput.Create(size, flags=c4d.FIELDSAMPLE_FLAG_ALL, src=None)

Creates a FieldOutput with 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.
    FIELDSAMPLE_FLAG_ALL Sample all values.
  • src (c4d.modules.mograph.FieldOutputBlock) – Alternatively pass only a source FieldOutputBlock to copy its size and arrays.
Return type:

c4d.modules.mograph.FieldOutput

Returns:

The created FieldOutput instance.

FieldOutput.GetBlock()

Retrieves all arrays in a FieldOutputBlock.

Return type:c4d.modules.mograph.FieldOutputBlock
Returns:A sub-block for the whole FieldOutput.
FieldOutput.GetSubBlock(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:

c4d.modules.mograph.FieldOutputBlock

Returns:

The requested sub-block.

FieldOutput.Reset()

Resets the FieldOutput instance to an empty state. All memory is deallocated.

FieldOutput.Flush()

Flushes the FieldOutput instance, keeping the arrays allocated for future resize.

FieldOutput.GetCount()

Returns the number of elements in the sample arrays.

Return type:int
Returns:The number of elements.
FieldOutput.IsValid()

Checks if the FieldOutput instance allocations and sizes are valid.

Note

An empty FieldOutput instance is considered valid.

Return type:bool
Returns:True if the FieldOutput instance is valid, otherwise False.
FieldOutput.IsPopulated()

Checks if the FieldOutput is valid and non-empty.

Return type:bool
Returns:True if the FieldOutput instance is populated, otherwise False.
FieldOutput.CopyFrom(src)

Copies from FieldOutput src. Performs a deep copy.

Parameters:src (c4d.modules.mograph.FieldOutput) – The source FieldOutput.
Return type:bool
Returns:True if successful, otherwise False.
FieldOutput.CopyArrayContentFrom(src)

Copies from src array content.

Note

Size and flags are not affected by CopyArrayContentFrom().
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.FieldOutputBlock, c4d.modules.mograph.FieldOutputBlock]) – The source FieldOutput or FieldOutputBlock.
Return type:bool
Returns:True if successful, otherwise False.
FieldOutput.Resize(newSize, sampleFlags=c4d.FIELDSAMPLE_FLAG_VALUE, 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.

FieldOutput.ClearMemory(startIdx=0, count=GetCount(), 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.ClearDeactivated(state=False)

Clears the deactivated array.

Parameters:state (bool) – The state the deactivated array should be cleared to.
FieldOutput.CalculateCrc()

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.GetValue(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.SetValue(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().

FieldOutput.GetAlpha(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.SetAlpha(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.GetColor(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:c4d.Vector
Returns:The color.
FieldOutput.SetColor(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.GetDirection(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:c4d.Vector
Returns:The direction.
FieldOutput.SetDirection(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.GetRotation(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:c4d.Vector
Returns:The rotation.
FieldOutput.SetRotation(index, rotation)

Writes rotation at specified index.

Parameters:
  • index (int) – The index in the array.
  • rotation (c4d.Vector) – The rotation to set.
Raises:

IndexError – If the index is out of range : 0<=index<GetCount().

FieldOutput.GetDeactivated(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.SetDeactivated(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().