c4d.plugins.MessageData

class c4d.plugins.MessageData
A data class for creating message plugins.
Use RegisterMessagePlugin() to register a message plugin.

Here is an example of a message plugin, which CoreMessage() method is called each 100 ms.

import c4d

class TimerMessage(c4d.plugins.MessageData):

    def GetTimer(self):
        return 100

    def CoreMessage(self, id, bc):
        if id == c4d.MSG_TIMER:
            # Do something
        return True

if __name__ == "__main__":
    c4d.plugins.RegisterMessagePlugin(id=1234567, str="", info=0, dat=TimerMessage())

Methods Signatures

MessageData.GetTimer(self)

Override - Called to return a time in milliseconds to receive timer messages (MSG_TIMER) with that interval in CoreMessage().

MessageData.CoreMessage(self, id, bc)

Override - Called to receive core messages.

Inheritance

Parent Class:

Methods Documentation

MessageData.GetTimer(self)
Override - Called to return a time in milliseconds to receive timer messages (MSG_TIMER) with that interval in CoreMessage().
This method is queried again after each message.
Return type

int

Returns

The timer interval in milliseconds, or 0 for no timer messages.

MessageData.CoreMessage(self, id, bc)

Override - Called to receive core messages.

Parameters
  • id (int) –

    The core message ID:

    EVMSG_CHANGE

    Sent by EventAdd().

    EVMSG_DOCUMENTRECALCULATED

    Sent while drawing after the animation, expressions and cache building have been done. It allows that certain managers (e.g. attribute manager) update their values to the changes done by the expressions etc. Any reactions on this message should be pretty fast! No modifying stuff must be done here as the draw thread is running at the same time and accesses the same data!

    EVMSG_TOOLCHANGED

    A tool setting has changed (local event).

    EVMSG_GRAPHVIEWCHANGED

    Something in XPresso has been changed (local event).

    EVMSG_AUTKEYMODECHANGED

    The autokey mode was changed.

    EVMSG_UPDATEHIGHLIGHT

    A special message sent by Cinema 4D in the case that only the highlighting changes. This happens for example when the mouse is moved over the viewport. Plugins usually do not need to care about this.

    EVMSG_UPDATEBASEDRAW

    Sent in the case that the view should be redrawn.

    EVMSG_CHANGEDSCRIPTMODE

    Sent when the script mode changed.

    EVMSG_SETMODE

    Private.

    EVMSG_SHOWIN_FC

    Show in Function Curve editor.

    EVMSG_SHOWIN_LM

    Show in Layer Manager.

    EVMSG_SHOWIN_MT

    Show in Motion editor.

    EVMSG_SHOWIN_SB

    Show in Scene Browser.

    EVMSG_SHOWIN_TL

    Show in Timeline.

    EVMSG_TLOM_MERGE

    Private.

    EVMSG_TIMELINESELECTION

    A timeline selection has been changed (local event).

    EVMSG_TL_FCURVE_POS

    Show and frame fcurve position tracks.

    EVMSG_TL_FCURVE_ROT

    Show and frame fcurve rotation tracks.

    EVMSG_TL_FCURVE_SCALE

    Show and frame fcurve scale tracks.

    EVMSG_BROWSERCHANGE

    Something in the browser has been changed (local event).

    EVMSG_MATERIALSELECTION

    A material selection has been changed (local event).

    EVMSG_FCURVECHANGE

    Something in the F-Curve manager has been changed (local event).

    EVMSG_RAYTRACER_FINISHED

    Private.

    EVMSG_MATERIALPREVIEW

    Private.

    EVMSG_ACTIVEVIEWCHANGED

    Private.

    EVMSG_ASYNCEDITORMOVE

    The user moved something in the editor window. Managers should update things like position fields.

    EVMSG_TIMECHANGED

    Private.

    EVMSG_VIEWWINDOW_OUTPUT

    Private.

    EVMSG_VIEWWINDOW_3DPAINTUPD

    Private.

    EVMSG_UPDATESCHEME

    Scheme has been updated.

    EVMSG_TAKECHANGED

    New in version R17.032: Sent by the Take System when the current Take ID changed to let all managers react to the new status.

  • bc (c4d.BaseContainer) – The core message container.

Return type

bool

Returns

Currently not used but a bool has to be returned.