Structure NotifyInfo

3DS Max Plug-In SDK

Structure NotifyInfo

See Also: Class Interface (callback methods), List of Notification Codes.

Description:

3ds max supports a system where a plug-in can ask to receive a callback when certain events occur. These are events such as the system unit settings changing, system time setting changing, or the user executing File/Reset, File/New, etc.

This structure is part of this system. It is available in release 2.0 and later only.

typedef struct {

 int intcode;

 void *callParam;

This pointer is available in release 3.0 and later only.

This parameter can be passed in with the function BroadcastNotification(int code, void *callParam).

} NotifyInfo;

The plug-in creates a callback function to process the notification. The notification callback function (NOTIFYPROC) is defined as follows:

typedef void (* NOTIFYPROC)(void *param, NotifyInfo *info);

The NotifyInfo structure is passed to the NOTIFYPROC to inform it of what it's being notified about.

The sample code below shows how this system may be used.

Sample Code:

// Declare the callback function

static void TimeUnitsChanged(void *param, NotifyInfo *info) {

 // Handle the units changing...

}

// Register the callback

RegisterNotification(TimeUnitsChanged,this,

 NOTIFY_TIMEUNITS_CHANGE);

// When done, unregister the callback

UnRegisterNotification(TimeUnitsChanged,this,

 NOTIFY_TIMEUNITS_CHANGE);

Related Functions:

Function:

int RegisterNotification(NOTIFYPROC proc, void *param, int code);

Remarks:

This global function is called to establish the connection between the event and the callback.

Parameters:

NOTIFYPROC proc

The callback function called when the event occurs.

void *param

A pointer to a parameter which will be passed to the callback function.

int code

Specifies which notification to register. See List of Notification Codes.

Return Value:

Nonzero if the event was registered; otherwise zero.

Function:

int UnRegisterNotification(NOTIFYPROC proc, void *param, int code);

Remarks:

This global function is called to break the connection between the event and the callback. After this function executes the callback is no longer invoked when the event occurs.

Parameters:

NOTIFYPROC proc

The callback function called when the event occurs.

void *param

This parameter must be identical to the param sent into RegisterNotification(). This function will only unregister a callback if this parameter equals the param sent in to the RegisterNotification() function.

int code

Specifies which notification to unregister. See List of Notification Codes.

Return Value:

Nonzero if the event was unregistered; otherwise zero.

Function:

void BroadcastNotification(int code);

Remarks:

Calling this global function causes the callback corresponding to the specified code to be called.

Parameters:

int code

Specifies which notification to broadcast. See List of Notification Codes.

Prototype:

void BroadcastNotification(int code, void *callParam);

Remarks:

This global function is available in release 3.0 and later only.

This causes the callback corresponding to the specified code to be called and passes the specified void* parameter along to the callback.

Parameters:

int code

Specifies which notification to broadcast. See List of Notification Codes.

void *callParam

This parameter is passed to the callback. See the code NOTIFY_BITMAP_CHANGED for an example of this in use.

Function:

int UnRegisterNotification(NOTIFYPROC proc, void *param);

Remarks:

This global function unregisters the callback from all codes

Parameters:

NOTIFYPROC proc

The callback function called when the event occurs.

void *param

A pointer to a parameter which will be passed to the callback function.

Return Value:

Nonzero if the events were unregistered; otherwise zero.