c4d.plugins.FalloffData

class c4d.plugins.FalloffData

This class is the base falloff class. Falloffs will appear in any falloff descriptions (unless the flag PLUGIN_HIDE is used during registration), and extend the functionality of tools such as effectors (or anything that uses the falloffs). Use RegisterFalloffPlugin() to register the plugin.

See also

Py-NoiseFalloff plugin example.

Methods Signatures

FalloffData.Init(self, falldata, bc)

Called when the falloff is first created.

FalloffData.InitFalloff(self, bc, falldata)

Called just before sampling. Allows you to set up any necessary data in falldata or bc.

FalloffData.Sample(self, p, data)

Called to sample any point.

FalloffData.FreeFalloff(self, falldata)

Called when the falloff object is freed.

FalloffData.CheckDirty(self, bc)

type bc

c4d.BaseContainer

FalloffData.GetDVisible(self, id, bc, desc_bc)

Called to change the visibility of any element in the description; just return True or False for the id.

FalloffData.GetHandleCount(self, bc)

Called to get the number of handles the falloff has. Part of the automated handle interface.

FalloffData.GetHandle(self, bc, i, info, data)

Called to get the information for handle at index i. Part of the automated handle interface.

FalloffData.SetHandle(self, bc, i, p, data)

Called to set the information for handle at index i. Part of the automated handle interface.

FalloffData.Draw(self, data, drawpass, ...)

For allowing you to draw the falloff in the viewport. You should use these predefined color constants:

FalloffData.Message(self, type, bc, m_data)

Called when the falloff receives messages.

Inheritance

Parent Class:

Methods Documentation

FalloffData.Init(self, falldata, bc)

Called when the falloff is first created.

Parameters
Return type

bool

Returns

True if successful, otherwise False.

FalloffData.InitFalloff(self, bc, falldata)

Called just before sampling. Allows you to set up any necessary data in falldata or bc.

Parameters
Return type

bool

Returns

True if successful, otherwise False.

FalloffData.Sample(self, p, data)

Called to sample any point.

Note

To get p in world coordinates multiply it by data.mat.

Parameters
Return type

float

Returns

The falloff value.

FalloffData.FreeFalloff(self, falldata)

Called when the falloff object is freed.

Parameters

falldata (c4d.modules.mograph.FalloffDataData) – Falloff data information.

FalloffData.CheckDirty(self, bc)
Parameters

bc (c4d.BaseContainer) – Falloff’s basecontainer; normally this is the owning object’s basecontainer.

Return type

bool

Returns

Dirty state.

FalloffData.GetDVisible(self, id, bc, desc_bc)

Called to change the visibility of any element in the description; just return True or False for the id.

Parameters
  • id (c4d.DescID) – The ID being evaluated.

  • bc (c4d.BaseContainer) – Falloff’s basecontainer; normally this is the owning object’s basecontainer.

  • desc_bc (c4d.BaseContainer) – The description element’s container.

Return type

bool

Returns

Visibility of id.

FalloffData.GetHandleCount(self, bc)

Called to get the number of handles the falloff has. Part of the automated handle interface.

Parameters

bc (c4d.BaseContainer) – Falloff’s container; normally this is the owning falloff’s basecontainer.

Return type

int

Returns

The number of handles.

FalloffData.GetHandle(self, bc, i, info, data)

Called to get the information for handle at index i. Part of the automated handle interface.

Parameters
Return type

c4d.Vector

Returns

The current local position of the handle with index i.

FalloffData.SetHandle(self, bc, i, p, data)
Called to set the information for handle at index i. Part of the automated handle interface.
Called when the user has moved handle i to position p. Update the falloff’s internal data accordingly (e.g. parameter values etc).
Parameters
FalloffData.Draw(self, data, drawpass, bd, bh)

For allowing you to draw the falloff in the viewport. You should use these predefined color constants:

FALLOFFCAGE

Default cage color.

FALLOFFFALLOFF

Default falloff color.

Note

This function is called in a thread context. Please see the important information about threading.

Parameters
  • data (c4d.modules.mograph.FalloffDataData) – Falloff data information.

  • drawpass (int) –

    One of the following:

    DRAWPASS_OBJECT

    Object pass.

    DRAWPASS_BOX

    Box pass.

    DRAWPASS_HANDLES

    Handle pass.

    DRAWPASS_HIGHLIGHTS

    Highlights pass.

    DRAWPASS_XRAY

    X-Ray pass.

    Warning

    Only draw in DRAWPASS_HIGHLIGHTS if you really know what you are doing. Otherwise always check the drawpass and then do not draw if it is DRAWPASS_HIGHLIGHTS.

    Here is an example.

    def Draw(self, data, drawpass, bd, bh):
    
        if drawpass==c4d.DRAWPASS_HIGHLIGHTS:
            return False
    
        # Put here your drawing operations
    
        return True
    

  • bd (c4d.BaseDraw) – The editor’s view.

  • bh (c4d.plugins.BaseDrawHelp) – The BaseDrawHelp editor’s view.

Return type

int

Returns

Success of drawing into the editor view:

DRAWRESULT_ERROR

There was an error while drawing.

DRAWRESULT_OK

Something was drawn.

DRAWRESULT_SKIP

There was nothing to draw in the pass.

Changed in version R18.011: Changed to DRAWRESULT. Returning a bool is still supported for backward compatibility.

FalloffData.Message(self, type, bc, m_data)

Called when the falloff receives messages.

See also

MSG for the information on the messages type, data and input/output.

Parameters
  • type (int) – The message type:

  • bc (c4d.BaseContainer) – Falloff’s basecontainer; normally this is the owning object’s basecontainer.

  • m_data (any) – The message data.

Return type

bool

Returns

Depends on the message type.