c4d.modules.mograph.FieldLayer

class c4d.modules.mograph.FieldLayer

New in version R20.

Warning

Due to core changes in 2024.0.0, sampling of FieldLayer is not working in Python 2024.0.0.
This is going to be fixed in an upcoming version meanwhile you can sample a FieldList.

Methods Signatures

FieldLayer.__init__()

Creates a FieldLayer instance.

FieldLayer.GetStrength()

Gets the field layer’s strength in percent.

FieldLayer.SetStrength()

Sets the field layer’s strength in percent.

FieldLayer.GetBlendingMode()

Gets the field layer’s blending mode.

FieldLayer.SetBlendingMode()

Sets field layer’s blending mode.

FieldLayer.GetUniqueID()

Private.

FieldLayer.SetUniqueID()

Private.

FieldLayer.GetChannelFlags()

Gets the enabled flags for the layer.

FieldLayer.SetChannelFlags()

Sets the enabled flags for the layer.

FieldLayer.GetChannelFlag()

Checks a specific channel flag enabled state.

FieldLayer.SetChannelFlag()

Sets a specific channel flag enabled state.

FieldLayer.InitSampling()

Initializes field sampling.

FieldLayer.FreeSampling()

Frees any data allocated in InitSampling().

FieldLayer.Sample()

Samples the field layer.

FieldLayer.Aggregate()

Private

FieldLayer.GetLayerFlags()

Gets the layer’s execution and display flags.

FieldLayer.SetLayerFlags()

Sets the layer’s execution and display flags.

FieldLayer.GetLinkedObject()

Gets the linked object.

FieldLayer.SetLinkedObject()

Sets the linked object.

FieldLayer.GetMaskHead()

If the c4d.FieldLayer has a mask then this retrieve the list head containing the mask layers.

FieldLayer.AddMask()

Adds a mask to the c4d.FieldLayer, if a mask already exists then this will do nothing.

FieldLayer.RemoveMask()

Removes the mask on the c4d.FieldLayer, if no mask exists then this will do nothing.

Inheritance

Parent Class:

Methods Documentation

FieldLayer.__init__(self, type)

Creates a FieldLayer instance.

Parameters

type (int) – The layer type.

FieldLayer.GetStrength(self)

Gets the field layer’s strength in percent.

Return type

float

Returns

The strength.

FieldLayer.SetStrength(self, strength)

Sets the field layer’s strength in percent.

Parameters

strength (float) – The strength to set.

FieldLayer.GetBlendingMode(self)

Gets the field layer’s blending mode.

Return type

int

Returns

The blending mode. See flbase.h/res for values.

FieldLayer.SetBlendingMode(self, blendingMode)

Sets field layer’s blending mode.

Parameters

blendingMode (int) – The blending mode to set. See flbase.h/res for values.

FieldLayer.GetUniqueID(self)

Private.

FieldLayer.SetUniqueID(self, id)

Private.

FieldLayer.GetChannelFlags(self)

Gets the enabled flags for the layer.

Return type

int

Returns

The channel flags:

FIELDLAYER_CHANNELFLAG_NONE

None.

FIELDLAYER_CHANNELFLAG_ENABLE

Layer is enabled and sampled.

FIELDLAYER_CHANNELFLAG_VALUE

Value sampling is enabled.

FIELDLAYER_CHANNELFLAG_COLOR

Color sampling is enabled.

FIELDLAYER_CHANNELFLAG_DIRECTION

Direction sampling is enabled.

FIELDLAYER_CHANNELFLAG_ROTATION

Rotation sampling is enabled.

FieldLayer.SetChannelFlags(self, flags)

Sets the enabled flags for the layer.

Parameters

flags (int) –

The channel flags to set:

FIELDLAYER_CHANNELFLAG_NONE

None.

FIELDLAYER_CHANNELFLAG_ENABLE

Layer is enabled and sampled.

FIELDLAYER_CHANNELFLAG_VALUE

Value sampling is enabled.

FIELDLAYER_CHANNELFLAG_COLOR

Color sampling is enabled.

FIELDLAYER_CHANNELFLAG_DIRECTION

Direction sampling is enabled.

FIELDLAYER_CHANNELFLAG_ROTATION

Rotation sampling is enabled.

FieldLayer.GetChannelFlag(self, flag)

Checks a specific channel flag enabled state.

Parameters

flag (int) –

The flag to check:

FIELDLAYER_CHANNELFLAG_NONE

None.

FIELDLAYER_CHANNELFLAG_ENABLE

Layer is enabled and sampled.

FIELDLAYER_CHANNELFLAG_VALUE

Value sampling is enabled.

FIELDLAYER_CHANNELFLAG_COLOR

Color sampling is enabled.

FIELDLAYER_CHANNELFLAG_DIRECTION

Direction sampling is enabled.

FIELDLAYER_CHANNELFLAG_ROTATION

Rotation sampling is enabled.

Return type

bool

Returns

True if channel flag is set, otherwise False.

FieldLayer.SetChannelFlag(self, flag, state=True)

Sets a specific channel flag enabled state.

Parameters
  • flags (int) –

    The flag to set:

    FIELDLAYER_CHANNELFLAG_NONE

    None.

    FIELDLAYER_CHANNELFLAG_ENABLE

    Layer is enabled and sampled.

    FIELDLAYER_CHANNELFLAG_VALUE

    Value sampling is enabled.

    FIELDLAYER_CHANNELFLAG_COLOR

    Color sampling is enabled.

    FIELDLAYER_CHANNELFLAG_DIRECTION

    Direction sampling is enabled.

    FIELDLAYER_CHANNELFLAG_ROTATION

    Rotation sampling is enabled.

  • state (bool) – True to enable the flag, False to disable.

FieldLayer.InitSampling(self, info)

Initializes field sampling.

Warning

Must be called before Sample() is invoked.

Parameters

info (c4d.modules.mograph.FieldInfo) – The FieldInfo to initialize sampling with.

FieldLayer.FreeSampling(self, info)

Frees any data allocated in InitSampling().

Warning

Must be called after sampling is finished.

Warning

Due to core changes in 2024.0.0, this function is not working in Python 2024.0.0.
This is going to be fixed in an upcoming version.
Parameters

info (c4d.modules.mograph.FieldInfo) – The FieldInfo instance used for sampling.

FieldLayer.Sample(self, input, output, info)

Samples the field layer.

Warning

InitSampling() must be called before. FreeSampling() must be called once sampling is complete.

Warning

Due to core changes in 2024.0.0, this function is not working in Python 2024.0.0.
This is going to be fixed in an upcoming version.
Parameters
FieldLayer.Aggregate(self, input, output, info)

Private

FieldLayer.GetLayerFlags(self)

Gets the layer’s execution and display flags.

Return type

int

Returns

The layer flags:

FIELDLAYER_FLAG_NONE

None.

FIELDLAYER_FLAG_SKIP

Layer calculation is disabled, e.g. the linked object on a standard layer’s deform mode is false.

FIELDLAYER_FLAG_ERRORSKIP

Layer calculation is disabled due to a non critical error in InitSampling() or as user specified.

FIELDLAYER_FLAG_HIDE

Layer should be completely ignored from both calculation and GUI display, e.g. the linked object has been deleted.

FIELDLAYER_FLAG_MODIFYDATA

The layer modifies existing data and needs the values from layers beneath it in the layer list.

FIELDLAYER_FLAG_PRESERVEALPHA

The layer does not adjust the existing alpha and its color changes should be applied ignoring any alpha values.

FIELDLAYER_FLAG_NOCHILDVALUE

Children of the layer do not output their value.

FIELDLAYER_FLAG_NOCHILDCOLOR

Children of the layer do not output their color.

FIELDLAYER_FLAG_NOCHILDDIRECTION

Children of the layer do not output their direction.

FIELDLAYER_FLAG_NOCHILDROTATION

Children of the layer do not output their rotation.

FIELDLAYER_FLAG_TEMPORARY

Do not save the layer with the list or duplicate it (outside of undo).

FieldLayer.SetLayerFlags(self, flags, state=True)

Sets the layer’s execution and display flags.

Parameters
  • flags (int) –

    The layer flag to set:

    FIELDLAYER_FLAG_NONE

    None.

    FIELDLAYER_FLAG_SKIP

    Layer calculation is disabled, e.g. the linked object on a standard layer’s deform mode is false.

    FIELDLAYER_FLAG_ERRORSKIP

    Layer calculation is disabled due to a non critical error in InitSampling() or as user specified.

    FIELDLAYER_FLAG_HIDE

    Layer should be completely ignored from both calculation and GUI display, e.g. the linked object has been deleted.

    FIELDLAYER_FLAG_MODIFYDATA

    The layer modifies existing data and needs the values from layers beneath it in the layer list.

    FIELDLAYER_FLAG_PRESERVEALPHA

    The layer does not adjust the existing alpha and its color changes should be applied ignoring any alpha values.

    FIELDLAYER_FLAG_NOCHILDVALUE

    Children of the layer do not output their value.

    FIELDLAYER_FLAG_NOCHILDCOLOR

    Children of the layer do not output their color.

    FIELDLAYER_FLAG_NOCHILDDIRECTION

    Children of the layer do not output their direction.

    FIELDLAYER_FLAG_NOCHILDROTATION

    Children of the layer do not output their rotation.

    FIELDLAYER_FLAG_TEMPORARY

    Do not save the layer with the list or duplicate it (outside of undo).

  • state (bool) – True to set, False to clear.

FieldLayer.GetLinkedObject(self, doc)

Gets the linked object.

Parameters

doc (c4d.documents.BaseDocument) – The document the FieldLayer belongs to.

Return type

c4d.BaseList2D

Returns

The linked object.

FieldLayer.SetLinkedObject(self, link)

Sets the linked object.

Parameters

link (c4d.BaseList2D) – The object to link.

FieldLayer.GetMaskHead(self)

If the c4d.FieldLayer has a mask then this retrieve the list head containing the mask layers.

Return type

Optional[c4d.GeListHead]

Returns

The GeListHead containing the mask layers, None if masks aren’t active on this layer.

FieldLayer.AddMask(self)

Adds a mask to the c4d.FieldLayer, if a mask already exists then this will do nothing.

Return type

bool

Returns

True on success.

FieldLayer.RemoveMask(self, link)

Removes the mask on the c4d.FieldLayer, if no mask exists then this will do nothing.

Note

In c++ the parameter link is named deleteLayers, it’s probable that it will change as well in Python.

Parameters

link (bool) – True to delete the layers in the mask, False to retain them so that when enabled again via c4d.AddMask() the layers will reappear.