MessageData Class Referenceabstract

#include <c4d_messagedata.h>

Inheritance diagram for MessageData:

Detailed Description

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:

#include "c4d.h"
#include "c4d_symbols.h"
class TimerMessage : public MessageData
{
virtual Int32 GetTimer();
virtual Bool CoreMessage(Int32 id, const BaseContainer &bc);
};
Int32 TimerMessage::GetTimer()
{
return 100;
}
Bool TimerMessage::CoreMessage(Int32 id, const BaseContainer &bc)
{
if (id==MSG_TIMER)
{
// Do something
}
return true;
}
Bool RegisterTimerMessage()
{
return RegisterMessagePlugin(1234567, String(), 0, NewObj(TimerMessage));
}
Bool RegisterMessagePlugin(Int32 id, const maxon::String &str, Int32 info, MessageData *dat)
#define MSG_TIMER
Definition: c4d_messageplugin.h:19
Definition: c4d_basecontainer.h:47
Definition: c4d_messagedata.h:65
virtual Int32 GetTimer()
virtual Bool CoreMessage(Int32 id, const BaseContainer &bc)=0
Definition: c4d_string.h:39
maxon::Bool Bool
Definition: ge_sys_math.h:55
maxon::Int32 Int32
Definition: ge_sys_math.h:60
#define NewObj(T,...)
Definition: newobj.h:108

Public Member Functions

virtual Int32 GetTimer ()
 
virtual Bool CoreMessage (Int32 id, const BaseContainer &bc)=0
 
- Public Member Functions inherited from BaseData
 BaseData ()
 
virtual ~BaseData ()
 
void Destructor ()
 

Member Function Documentation

◆ GetTimer()

virtual Int32 GetTimer ( )
virtual

Called to return a time in milliseconds to receive timer messages (MSG_TIMER) with that interval in .\n This method is queried again after each message.

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

◆ CoreMessage()

virtual Bool CoreMessage ( Int32  id,
const BaseContainer bc 
)
pure virtual

Called to receive core messages.

See also
The article Core Messages for more information.
Parameters
[in]idThe core message ID: EVMSG
[in]bcThe core message container.
Returns
Currently not used.