Public Member Functions

MCDeviceBinding Class Reference

Search for all occurrences

Detailed Description

See also:
Class ReferenceTarget, Class MCInputDevice, Class IMCParamDlg, Class IRollupWindow.

Description:
An instance of this class is created when a motion capture controller binds one of its parameters to a device. The main purpose of this class is to store any parameters that describe the binding.

#include <mcapdev.h>

Inheritance diagram for MCDeviceBinding:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual  ~MCDeviceBinding ()
virtual MCInputDevice GetDevice ()=0
virtual MSTR  BindingName ()=0
virtual float  Eval (TimeValue t)=0
virtual void  DeleteThis ()=0
virtual void  AddRollup (IMCParamDlg *dlg)=0
virtual void  UpdateRollup (IRollupWindow *iRoll)=0
virtual void  BeginActivate (BOOL reset=TRUE)
virtual void  EndActivate ()
virtual void  Accumulate (TimeValue t)
SClass_ID  SuperClassID ()
  Retrieves a constant representing the type of the plugin.
RefResult  NotifyRefChanged (Interval changeInt, RefTargetHandle hTarget, PartID &partID, RefMessage message)
  Receives and responds to messages.

Constructor & Destructor Documentation

virtual ~MCDeviceBinding ( ) [inline, virtual]
Remarks:
Destructor.
{}

Member Function Documentation

virtual MCInputDevice* GetDevice ( ) [pure virtual]
Remarks:
Returns a pointer to the bound input device.
virtual MSTR BindingName ( ) [pure virtual]
Remarks:
Returns the name of the bound input device.
virtual float Eval ( TimeValue  t ) [pure virtual]
Remarks:
A device binding is the thing that the controller evaluates to get the value of the device. Everything is simply a scalar parameter. So for example even for a device like a mouse that has X and Y motion the device binding will break down into simply X or Y. This method is used to return the value of the device at the instant this method is called.
Parameters:
TimeValue t

The time at which this method is called.
virtual void DeleteThis ( ) [pure virtual]
Remarks:
Deletes this instace of the class.

Reimplemented from Animatable.

virtual void AddRollup ( IMCParamDlg dlg ) [pure virtual]
Remarks:
This method is called to allow the binding to put up any user interface it has into the command panel via rollup pages.
Parameters:
IMCParamDlg *dlg

The IRollupWindow data member of this class may be used to add the rollup page.
Sample Code:
        dlg->iRoll->AppendRollup(hInstance, MAKEINTRESOURCE(IDD_MC_MOUSE),MouseDeviceDlgProc,       GetString(IDS_RB_MOUSEDEVICE), (LPARAM)dlg);
virtual void UpdateRollup ( IRollupWindow iRoll ) [pure virtual]
Remarks:
This method is called to allow the plug-in to update the values in its user interface rollup.
Parameters:
IRollupWindow *iRoll

The interface into the command panel rollups. The GetPanelDlg() method may be used to return the window handle of the dialog and this HWND may be used to update the controls.
virtual void BeginActivate ( BOOL  reset = TRUE ) [inline, virtual]
Remarks:
This method is called when the binding becomes active.
Parameters:
BOOL reset=TRUE

If TRUE 3ds Max is being reset; otherwise this is the first time the binding is becoming active.
Default Implementation:
{}
{}
virtual void EndActivate ( ) [inline, virtual]
Remarks:
This method is called when the binding has been released.
Default Implementation:
{}
{}
virtual void Accumulate ( TimeValue  t ) [inline, virtual]
Remarks:
This method is called 50 times per second during motion capture.

To understand how this is used consider the following two situations for a motion capture device:

1. The motion capture device is a joystick, and the position of the joystick directly maps to a range of some parameter. In this case, if you need to evaluate the parameter, you simply evaluate the joystick (inside the Eval() method). The position establishes the value.

2. A different case is where you have a parameter at a starting value, and if the joystick is moved, to say the right, the value is incremented. If the joystick is moved to the left the value is decremented. In this case the value can theoretically reach any value. What is needed is for the value to be incremented and decremented in a consistent fashion. If the joystick is polled only during the Eval() method, and the value is incremented or decremented there, it may be a problem. If two things are using the same motion capture device, the value will be incremented or decremented twice inside Eval(). This will cause the value to grow or shrink twice as fast. If three things evaluated the same joystick it would move three times as fast because it would get incremented three times per frame. The solution is to use this method. It is called 50 times per second. The increments are done inside this method, and when the Eval() method is called the accumulated state is simply returned. This works because the method is called a fixed number of times per second regardless of the number of items evaluating the device.
Parameters:
TimeValue t

The current time when this method is called.
Default Implementation:
{}
{}
SClass_ID SuperClassID ( ) [inline, virtual]

Retrieves a constant representing the type of the plugin.

Returns:
A super class id that uniquely identifies the type (category) of the plugin. Note that several plugin classes can be of the same type, thus return the same super class id. Plugins are uniquely identified by their class ids. List of Super Class IDs.
See also:
SClass_ID

Reimplemented from ReferenceTarget.

RefResult NotifyRefChanged ( Interval  changeInt,
RefTargetHandle  hTarget,
PartID partID,
RefMessage  message 
) [inline, virtual]

Receives and responds to messages.

A plugin which makes references must implement a method to receive and respond to messages broadcast by its dependents. This is done by implementing NotifyRefChanged(). The plugin developer usually implements this method as a switch statement where each case is one of the messages the plugin needs to respond to. The Method StdNotifyRefChanged calls this, which can change the partID to new value. If it doesn't depend on the particular message& partID, it should return REF_DONTCARE.

  • For developer that need to update a dialog box with data about an object you reference note the following related to this method: This method may be called many times. For instance, say you have a dialog box that displays data about an object you reference. This method will get called many time during the drag operations on that object. If you updated the display every time you'd wind up with a lot of 'flicker' in the dialog box. Rather than updating the dialog box each time, you should just invalidate the window in response to the NotifyRefChanged() call. Then, as the user drags the mouse your window will still receive paint messages. If the scene is complex the user may have to pause (but not let up on the mouse) to allow the paint message to go through since they have a low priority. This is the way many windows in 3ds Max work.
Parameters:
changeInt - This is the interval of time over which the message is active. Currently, all plug-ins will receive FOREVER for this interval.
hTarget - This is the handle of the reference target the message was sent by. The reference maker uses this handle to know specifically which reference target sent the message.
partID - This contains information specific to the message passed in. Some messages don't use the partID at all. See the section List of Reference Messages for more information about the meaning of the partID for some common messages.
message - The message parameters passed into this method is the specific message which needs to be handled.
Returns:
The return value from this method is of type RefResult. This is usually REF_SUCCEED indicating the message was processed. Sometimes, the return value may be REF_STOP. This return value is used to stop the message from being propagated to the dependents of the item.

Implements ReferenceMaker.

                                                  {return REF_SUCCEED;}

MCDeviceBinding MCDeviceBinding MCDeviceBinding MCDeviceBinding MCDeviceBinding MCDeviceBinding MCDeviceBinding MCDeviceBinding MCDeviceBinding MCDeviceBinding
MCDeviceBinding MCDeviceBinding MCDeviceBinding MCDeviceBinding MCDeviceBinding MCDeviceBinding MCDeviceBinding MCDeviceBinding MCDeviceBinding MCDeviceBinding