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:

Children Classes:

  • mycode.ExampleMessageData

  • coremessages.CatchCoreMessages

  • thread_examples.ProgressThreadMessages

  • thread_examples.RenderThreadMessages

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 received core message<MSG_CORE_EVENT>.

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

Return type

bool

Returns

Currently not used but a bool has to be returned.