IRenderMessageManager Class Reference

IRenderMessageManager Class Referenceabstract

#include <IRenderMessageManager.h>

Class Description

An interface to manage the renderer messages (error, warning, progress, etc.).

Clients log messages to this manager, and the manager will automatically dispatch the messages to the message window, or to Max log system (if Max is running in quite mode or network rendering is taking place).

Remarks
A pointer to this interface may be retrieved using GetRenderMessageManager().
+ Inheritance diagram for IRenderMessageManager:

Public Types

enum  MessageSource { kSource_ProductionRenderer = 0, kSource_MEditRenderer, kSource_ActiveShadeRenderer, kSource_Count }
 Different sources for renderer message. More...
 
enum  MessageType {
  kType_Fatal = 0x0001, kType_Error = 0x0002, kType_Warning = 0x0004, kType_Info = 0x0008,
  kType_Progress = 0x0010, kType_Debug = 0x0020, kType_System = 0x0040
}
 Type of a message. More...
 
typedef void(* rmmPreferencesCallback) (void *param)
 Callback function for client to process the "preference option changed" notification. More...
 

Public Member Functions

virtual ~IRenderMessageManager ()
 
virtual bool OpenMessageWindow ()=0
 Open the message window. More...
 
virtual void ClearDisplayedMessages ()=0
 Clear all the displayed messages on the message window. More...
 
virtual void CloseMessageWindow ()=0
 Destroy the message window. More...
 
virtual void HideMessageWindow ()=0
 Make the message window invisible. More...
 
virtual bool LogMessage (MessageSource msgSource, MessageType msgType, DWORD systemLogType, const MCHAR *msgBody)=0
 Log a message to the manager. More...
 
virtual void FlushPendingMessages (MessageSource source)=0
 Flush pending messages from a certain source. More...
 
virtual void ClearDisplayedMessages (MessageSource source)=0
 Clear displayed messages from a certain source. More...
 
virtual bool OpenLogFile (MessageSource source)=0
 Open the log file for message logging if possible. More...
 
virtual void FlushLogFile (MessageSource source)=0
 Flush buffer to the log file for specific message source. More...
 
virtual void CloseLogFile (MessageSource source)=0
 Close log file for specific message source. More...
 
virtual void RegisterChangeCallback (rmmPreferencesCallback callback, void *param)=0
 Register a client defined callback to get notification whenever a preference option is changed via UI operation, API call, and MAXScript. More...
 
virtual void UnRegisterChangeCallback (rmmPreferencesCallback callback, void *param)=0
 Unregister preference change callbacks. More...
 
virtual bool GetOpenMessageWindowOnError () const =0
 Get the "Open Message Window on Error" option. More...
 
virtual void SetOpenMessageWindowOnError (bool flag)=0
 Set the "Open Message Window on Error" option. More...
 
virtual bool GetShowInformationMessages () const =0
 Get the "Show/Log Information Messages" option. More...
 
virtual void SetShowInformationMessages (bool flag)=0
 Set the "Show/Log Information Messages" option. More...
 
virtual bool GetShowProgressMessages () const =0
 Get the "Show/Log Progress Messages" option. More...
 
virtual void SetShowProgressMessages (bool flag)=0
 Set the "Show/Log Progress Messages" option. More...
 
virtual bool GetLogDebugMessages () const =0
 Get the "Log Debug Messages (To File)" option. More...
 
virtual void SetLogDebugMessages (bool flag)=0
 Set the "Log Debug Messages (To File)" option. More...
 
virtual const MCHARGetLogFileNameTemplate ()=0
 Get the message log file name template. More...
 
virtual void SetLogFileNameTemplate (const MCHAR *fileName)=0
 Set the message log file name template. More...
 
virtual const MCHARGetLogFileName (MessageSource source)=0
 Get the actual message log file name for a specific message source. More...
 
virtual bool GetLogFileON () const =0
 Get the "Write Messages to File" option. More...
 
virtual void SetLogFileON (bool flag)=0
 Set the "Write Messages to File" option. More...
 
virtual bool GetLogFileAppend () const =0
 Get the "Append to File" option. More...
 
virtual void SetLogFileAppend (bool flag)=0
 Set the "Append to File" option. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 

Member Typedef Documentation

typedef void(* rmmPreferencesCallback) (void *param)

Callback function for client to process the "preference option changed" notification.

Parameters
paramA pointer to client data. This will be exactly the same pointer provided by client on calling RegisterChangeCallback, as parameter "param". Client is responsible for interpreting the pointer to a specific type.
See also
RegisterChangeCallback

Member Enumeration Documentation

Different sources for renderer message.

Enumerator
kSource_ProductionRenderer 

Production Renderer.

kSource_MEditRenderer 

Material Editor Renderer.

kSource_ActiveShadeRenderer 

Active Shade Renderer.

kSource_Count 
29  {
32 
35 
38 
40  };
Definition: IRenderMessageManager.h:39
Material Editor Renderer.
Definition: IRenderMessageManager.h:34
Active Shade Renderer.
Definition: IRenderMessageManager.h:37
Production Renderer.
Definition: IRenderMessageManager.h:31

Type of a message.

Enumerator
kType_Fatal 

System/module crash, etc.

Fatal messages are always shown on the message window.

kType_Error 

Coverable errors.

Error messages are always shown on the message window.

kType_Warning 

Minor issues.

Warning messages are always shown on the message window.

kType_Info 

Brief information messages for monitoring, debugging purposes and so on.

Client can choose to show/hide information messages on the message window.

See also
GetShowInformationMessages, SetShowInformationMessages
kType_Progress 

Messages to provide progress information for a time-consuming job.

Client can choose to show/hide progress messages on the message window.

See also
GetShowProgressMessages, SetShowProgressMessages
kType_Debug 

Detailed information messages solely for debugging purpose.

These messages are never shown on the message window. Client can choose to log debug messages to the log file (if present).

See also
GetLogDebugMessages, SetLogDebugMessages
kType_System 

Messages from the system. Client does not use this flag.

44  {
47  kType_Fatal = 0x0001,
48 
51  kType_Error = 0x0002,
52 
55  kType_Warning = 0x0004,
56 
60  kType_Info = 0x0008,
61 
65  kType_Progress = 0x0010,
66 
71  kType_Debug = 0x0020,
72 
74  kType_System = 0x0040,
75  };
Messages to provide progress information for a time-consuming job.
Definition: IRenderMessageManager.h:65
Coverable errors.
Definition: IRenderMessageManager.h:51
Detailed information messages solely for debugging purpose.
Definition: IRenderMessageManager.h:71
System/module crash, etc.
Definition: IRenderMessageManager.h:47
Messages from the system. Client does not use this flag.
Definition: IRenderMessageManager.h:74
Brief information messages for monitoring, debugging purposes and so on.
Definition: IRenderMessageManager.h:60
Minor issues.
Definition: IRenderMessageManager.h:55

Constructor & Destructor Documentation

virtual ~IRenderMessageManager ( )
inlinevirtual
78 {}

Member Function Documentation

virtual bool OpenMessageWindow ( )
pure virtual

Open the message window.

Returns
True if the window is opened successfully, false otherwise.
virtual void ClearDisplayedMessages ( )
pure virtual

Clear all the displayed messages on the message window.

virtual void CloseMessageWindow ( )
pure virtual

Destroy the message window.

virtual void HideMessageWindow ( )
pure virtual

Make the message window invisible.

virtual bool LogMessage ( MessageSource  msgSource,
MessageType  msgType,
DWORD  systemLogType,
const MCHAR msgBody 
)
pure virtual

Log a message to the manager.

Remarks
This function is thread-safe. Message manager caches incoming messages to a queue and returns immediately. Then from main thread it regularly flushes the pending messages to either the message window, or Max log system, depending on if Max is running in "window" mode.
Parameters
msgSourceSource of the message; determines which tab, in the render message dialog, the message is reports in.
msgTypeType of the message for purposes of reporting to the user. Affects how the message is reported to the render message window.
systemLogTypeType of the message for purposes of processing by the system. See systemErrorLogMessageTypes in log.h.
Remarks
The difference between msgType and systemLogType is particularly important when reporting errors. A msgType of kType_Error will cause the message to be shown red in the render message window, while a systemLogType of SYSLOG_ERROR will cause a network render to abort (if the system is set to abort on errors). Both types should not necessarily be set identically! For example, an error in scene translation (say, a material not supported by the renderer) could be reported as an error to the user, but would most likely by a warning to the system as one would not expect network rendering to fail. This will be used if the manager attempts to send the message to Max main log system. Set 0 to let the manager automatically assign a proper value.
Parameters
msgBodyText of the message.
Returns
True if the message is successfully logged, false otherwise.
virtual void FlushPendingMessages ( MessageSource  source)
pure virtual

Flush pending messages from a certain source.

Remarks
This function must be called from main thread. If the manager is working in non-window mode, and the source is kSource_Production, the pending messages will be sent to 3ds Max main log system. If the manager is working in window mode, the pending messages will be flushed to the message window. This function will also get called automatically from a system timer, to ensure that pending messages are always flushed regularly.
Parameters
sourceSource of the message.
virtual void ClearDisplayedMessages ( MessageSource  source)
pure virtual

Clear displayed messages from a certain source.

Parameters
sourceSource of the messages that client wants to clear.
virtual bool OpenLogFile ( MessageSource  source)
pure virtual

Open the log file for message logging if possible.

Typically this is called from a renderer's Open() implementation.

Returns
True if the log file is successfully created.
virtual void FlushLogFile ( MessageSource  source)
pure virtual

Flush buffer to the log file for specific message source.

virtual void CloseLogFile ( MessageSource  source)
pure virtual

Close log file for specific message source.

Typically this is called from a renderer's Close() implementation.

virtual void RegisterChangeCallback ( rmmPreferencesCallback  callback,
void param 
)
pure virtual

Register a client defined callback to get notification whenever a preference option is changed via UI operation, API call, and MAXScript.

Parameters
callbackThe callback function client wants to register.
paramA pointer to client data. This pointer will be used as the only parameter of the callback function.
virtual void UnRegisterChangeCallback ( rmmPreferencesCallback  callback,
void param 
)
pure virtual

Unregister preference change callbacks.

Parameters
callbackThe callback function client wants to unregister.
paramA pointer to client data. Make sure it matches the one passed along with RegisterChangeCallback().
virtual bool GetOpenMessageWindowOnError ( ) const
pure virtual

Get the "Open Message Window on Error" option.

Returns
True if the window will be opened whenever there's a fatal/error message sent in, false otherwise.
Remarks
Note that if Max is running in quite mode, the message window will never show up.
virtual void SetOpenMessageWindowOnError ( bool  flag)
pure virtual

Set the "Open Message Window on Error" option.

Parameters
flagSet true if client wants the manager to open the window whenever there's a fatal/error message sent in, false otherwise.
Remarks
Note that if Max is running in quite mode or is doing network rendering, the message window will never show up.
virtual bool GetShowInformationMessages ( ) const
pure virtual

Get the "Show/Log Information Messages" option.

Returns
True if the manager handles information messages.
virtual void SetShowInformationMessages ( bool  flag)
pure virtual

Set the "Show/Log Information Messages" option.

Parameters
flagSet true if client wants the manager to handle information messages, false otherwise.
virtual bool GetShowProgressMessages ( ) const
pure virtual

Get the "Show/Log Progress Messages" option.

Returns
True if the manager handles progress messages, false otherwise.
virtual void SetShowProgressMessages ( bool  flag)
pure virtual

Set the "Show/Log Progress Messages" option.

Parameters
flagSet true if client wants the manager to handle progress messages, false otherwise.
virtual bool GetLogDebugMessages ( ) const
pure virtual

Get the "Log Debug Messages (To File)" option.

Returns
True if the manager attempts to log debug messages to the log file, false otherwise.
virtual void SetLogDebugMessages ( bool  flag)
pure virtual

Set the "Log Debug Messages (To File)" option.

Parameters
flagSet true if client wants the manager to log debug messages to the log file, false otherwise.
Remarks
Client needs to turn on "Write Messages to File" option to make debug message logging working.
See also
SetLogFileON
virtual const MCHAR* GetLogFileNameTemplate ( )
pure virtual

Get the message log file name template.

Remarks
Different postfixes will be appended to this template for Production/MEditor/ActiveShade renderers. For instance, if the template name is "MaxRendererMessages.log", then messages log file name for Production renderer will be "MaxRendererMessages_Production.log".
Returns
The log file name template.
virtual void SetLogFileNameTemplate ( const MCHAR fileName)
pure virtual

Set the message log file name template.

Parameters
fileNameThe log file name template to set.
virtual const MCHAR* GetLogFileName ( MessageSource  source)
pure virtual

Get the actual message log file name for a specific message source.

Parameters
sourceSource of the messages that the log file is related to.
Returns
The actual log file name which is related to the message source.
virtual bool GetLogFileON ( ) const
pure virtual

Get the "Write Messages to File" option.

Returns
True if the manager logs messages to files, false otherwise.
virtual void SetLogFileON ( bool  flag)
pure virtual

Set the "Write Messages to File" option.

Parameters
flagSet true if client wants the manager to log messages to files, false otherwise.
virtual bool GetLogFileAppend ( ) const
pure virtual

Get the "Append to File" option.

Returns
True if the manager appends messages to log files (rather than creating new ones).
virtual void SetLogFileAppend ( bool  flag)
pure virtual

Set the "Append to File" option.

Parameters
flagSet true if client wants the manager to append messages to log files (rather than creating new ones), false otherwise.