c4d.modules.mograph.FieldOutput

class c4d.modules.mograph.FieldOutput

New in version R20.

Attributes

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._pivot

The rotational velocity (axe + magnitude)

Type: List[c4d.Vector]

FieldOutput._deactivated

The deactivated state array.

Type: List[bool]

Methods Signatures

FieldOutput.__init__()

Creates a FieldOutput instance.

FieldOutput.GetBlock()

Retrieves all arrays in a FieldOutputBlock.

FieldOutput.GetSubBlock()

Gets a sub-section of the sampling arrays.

FieldOutput.Reset()

Resets the FieldOutput instance to an empty state.

FieldOutput.Flush()

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

FieldOutput.GetCount()

Returns the number of elements in the sample arrays.

FieldOutput.IsValid()

Checks if the FieldOutput instance allocations and sizes are valid.

FieldOutput.IsPopulated()

Checks if the FieldOutput is valid and non-empty.

FieldOutput.CopyFrom()

Copies from FieldOutput src. Performs a deep copy.

FieldOutput.CopyArrayContentFrom()

Copies from src array content.

FieldOutput.Resize()

Resizes the arrays held in the FieldOutput.

FieldOutput.ClearMemory()

Resets the sampling data to default values.

FieldOutput.ClearDeactivated()

Clears the deactivated array.

FieldOutput.CalculateCrc()

Calculates a Crc on all internal data.

FieldOutput.GetValue()

Reads value at specified index.

FieldOutput.SetValue()

Writes value at specified index.

FieldOutput.GetAlpha()

Reads alpha at specified index.

FieldOutput.SetAlpha()

Writes alpha at specified index.

FieldOutput.GetColor()

Reads color at specified index.

FieldOutput.SetColor()

Writes color at specified index.

FieldOutput.GetDirection()

Reads direction at specified index.

FieldOutput.SetDirection()

Writes direction at specified index.

FieldOutput.GetRotation()

Reads rotation at specified index.

FieldOutput.SetRotation()

Writes rotation at specified index.

FieldOutput.GetPivot()

Retrieve the rotational velocity (axe + magnitude) at specified index.

FieldOutput.GetDeactivated()

Reads deactivated state at specified index.

FieldOutput.SetDeactivated()

Writes deactivated state at specified index.

Static Methods Signatures

c4d.modules.mograph.FieldOutput.Create()

Creates a FieldOutput with the specified sampling arrays.

Methods Documentation

FieldOutput.__init__(self)

Creates a FieldOutput instance.

FieldOutput.GetBlock(self)

Retrieves all arrays in a FieldOutputBlock.

Return type

c4d.modules.mograph.FieldOutputBlock

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

c4d.modules.mograph.FieldOutputBlock

Returns

The requested sub-block.

FieldOutput.Reset(self)

Resets the FieldOutput instance to an empty state.

Note

All memory is deallocated.

FieldOutput.Flush(self)

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

FieldOutput.GetCount(self)

Returns the number of elements in the sample arrays.

Return type

int

Returns

The number of elements.

FieldOutput.IsValid(self)

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(self)

Checks if the FieldOutput is valid and non-empty.

Return type

bool

Returns

True if the FieldOutput instance is populated, otherwise False.

FieldOutput.CopyFrom(self, 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(self, 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.FieldOutput, c4d.modules.mograph.FieldOutputBlock]) – The source FieldOutput or FieldOutputBlock.

Return type

bool

Returns

True if successful, otherwise False.

FieldOutput.Resize(self, newSize, sampleFlags=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(self, 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(self, state=False)

Clears the deactivated array.

Parameters

state (bool) – The state the deactivated array should be cleared to.

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

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.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.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

c4d.Vector

Returns

The color.

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.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

c4d.Vector

Returns

The direction.

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.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

c4d.Vector

Returns

The rotation.

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.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

c4d.Vector

Returns

The rotational velocity (axe + magnitude).

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

Static Methods Documentation

static c4d.modules.mograph.FieldOutput.Create(size, flags=FIELDSAMPLE_FLAG_VALUE | FIELDSAMPLE_FLAG_DIRECTION | FIELDSAMPLE_FLAG_COLOR, 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.

  • src (Optional[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.