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
from c4d import plugins

class TimerMessage(plugins.MessageData):

    def GetTimer(self):
        return 100

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

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

Definition

class c4d.plugins.MessageData

Inheritance

Methods

MessageData.GetTimer()
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(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_SHOWIN_SB Show in Scene Browser.
    EVMSG_SHOWIN_TL Show in Timeline.
    EVMSG_SHOWIN_FC Show in Function Curve editor.
    EVMSG_SHOWIN_LM Show in Layer Manager.
    EVMSG_TLOM_MERGE Private.
    EVMSG_SHOWIN_MT Show in Motion editor.
    EVMSG_TIMELINESELECTION A timeline selection has been changed (local event).
    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.