Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions

MSPluginSimpleManipulator Class Reference

Search for all occurrences

#include <mxsPlugin.h>

Inheritance diagram for MSPluginSimpleManipulator:
Inheritance graph
[legend]

List of all members.

Public Member Functions

  MSPluginSimpleManipulator ()
  MSPluginSimpleManipulator (MSPluginClass *pc, BOOL loading, RefTargetHandle hTarget=NULL, INode *pNode=NULL)
  ~MSPluginSimpleManipulator ()
void  DeleteThis ()
HWND  AddRollupPage (HINSTANCE hInst, MCHAR *dlgTemplate, DLGPROC dlgProc, MCHAR *title, LPARAM param=0, DWORD flags=0, int category=ROLLUP_CAT_STANDARD)
void  DeleteRollupPage (HWND hRollup)
IRollupWindow GetRollupWindow ()
ReferenceTarget get_delegate ()
void  GetClassName (MSTR &s)
  Retrieves the name of the plugin class.
Class_ID  ClassID ()
  Retrieves a constant that uniquely identifies the plugin class.
int  NumSubs ()
Animatable SubAnim (int i)
MSTR  SubAnimName (int i)
int  NumParamBlocks ()
IParamBlock2 GetParamBlock (int i)
IParamBlock2 GetParamBlockByID (BlockID id)
void *  GetInterface (ULONG id)
  Inherited from Animatable.
RefResult  NotifyRefChanged (Interval changeInt, RefTargetHandle hTarget, PartID &partID, RefMessage message)
  Receives and responds to messages.
int  NumRefs ()
  Returns the total number of references this ReferenceMaker can hold.
RefTargetHandle  GetReference (int i)
  Returns the 'i-th' reference.
void  RefDeleted ()
void  RefAdded (RefMakerHandle rm)
RefTargetHandle  Clone (RemapDir &remap)
  This method is used by 3ds Max to clone an object.
IOResult  Save (ISave *isave)
IOResult  Load (ILoad *iload)
void  NotifyTarget (int msg, RefMakerHandle rm)
MCHAR *  GetObjectName ()
void  BeginEditParams (IObjParam *ip, ULONG flags, Animatable *prev)
void  EndEditParams (IObjParam *ip, ULONG flags, Animatable *next)
CreateMouseCallBack GetCreateMouseCallBack ()
  This method allows the system to retrieve a callback object used in creating an object in the 3D viewports.
int  UsesWireColor ()
  Implemented by the System.
BOOL  NormalAlignVector (TimeValue t, Point3 &pt, Point3 &norm)
  Objects that don't support the IntersectRay() method (such as helper objects) can implement this method to provide a default vector for use with the normal align command in 3ds Max.
void  UpdateShapes (TimeValue t, MSTR &toolTip)
void  OnButtonDown (TimeValue t, ViewExp *pVpt, IPoint2 &m, DWORD flags, ManipHitData *pHitData)
void  OnMouseMove (TimeValue t, ViewExp *pVpt, IPoint2 &m, DWORD flags, ManipHitData *pHitData)
void  OnButtonUp (TimeValue t, ViewExp *pVpt, IPoint2 &m, DWORD flags, ManipHitData *pHitData)

Static Public Member Functions

static RefTargetHandle  create (MSPluginClass *pc, BOOL loading)
static MSPluginSimpleManipulator create (MSPluginClass *pc, RefTargetHandle hTarget, INode *pNode)

Public Attributes

IObjParam ip

Protected Member Functions

virtual void  SetReference (int i, RefTargetHandle rtarg)
  Stores a ReferenceTarget as its 'i-th' reference`.

Constructor & Destructor Documentation

{ }
MSPluginSimpleManipulator ( MSPluginClass *  pc,
BOOL  loading,
RefTargetHandle  hTarget = NULL,
INode pNode = NULL 
)

Member Function Documentation

static RefTargetHandle create ( MSPluginClass *  pc,
BOOL  loading 
) [static]
static MSPluginSimpleManipulator* create ( MSPluginClass *  pc,
RefTargetHandle  hTarget,
INode pNode 
) [static]
void DeleteThis ( )

Reimplemented from MSPlugin.

HWND AddRollupPage ( HINSTANCE  hInst,
MCHAR *  dlgTemplate,
DLGPROC  dlgProc,
MCHAR *  title,
LPARAM  param = 0,
DWORD  flags = 0,
int  category = ROLLUP_CAT_STANDARD 
) [virtual]
void DeleteRollupPage ( HWND  hRollup ) [virtual]
IRollupWindow* GetRollupWindow ( ) [virtual]
ReferenceTarget* get_delegate ( ) [inline, virtual]

Implements MSPlugin.

Reimplemented in MSSimpleManipulatorXtnd.

{ return NULL; }  // no delegate 
void GetClassName ( MSTR s ) [inline, virtual]

Retrieves the name of the plugin class.

This name is usually used internally for debugging purposes. For Material plug-ins this method is used to put up the material "type" name in the Material Editor.

Parameters:
s Reference to a string filled in with the name of the plugin class

Reimplemented from SimpleManipulator.

Reimplemented in MSSimpleManipulatorXtnd.

{ s = MSTR(pc->class_name->to_string()); }  
Class_ID ClassID ( ) [inline, virtual]

Retrieves a constant that uniquely identifies the plugin class.

This method must return the unique ID for the plugin class. If two ClassIDs conflict, the system will only load the first conflicting one it finds. A program (gencid.exe) is provided to generate unique class id values.

Returns:
A class id that uniquely identifies a plugin class
See also:
Class ClassID, List of Class IDs.

Reimplemented from Animatable.

Reimplemented in MSSimpleManipulatorXtnd.

{ return pc->class_id; }
int NumSubs ( ) [inline, virtual]
Remarks:
The system uses a virtual array mechanism to access the sub-anims of a plug-in. This method returns the total number of sub-anims maintained by the plug-in. If a plug-in is using a parameter block to manage its parameters it should just return 1 for all the parameters directed by the parameter block.
Returns:
The number of sub-anims used by the plug-in.
Default Implementation:
{ return 0; }

Reimplemented from SimpleManipulator.

Reimplemented in MSSimpleManipulatorXtnd.

Animatable* SubAnim ( int  i ) [virtual]
Remarks:
This method returns a pointer to the 'i-th' sub-anim. If a plug-in is using a parameter block to manage all its parameters it should just return a pointer to the parameter block itself from this method. This method may return NULL so developers need to check the return value before calling other sub anim methods (such as SubAnimName()).
Parameters:
i This is the index of the sub-anim to return.
Default Implementation:
{ return NULL };

Reimplemented from SimpleManipulator.

Reimplemented in MSSimpleManipulatorXtnd.

MSTR SubAnimName ( int  i ) [virtual]
Remarks:
This method returns the name of the 'i-th' sub-anim to appear in track view. The system has no idea what name to assign to the sub-anim (it only knows it by the virtual array index), so this method is called to retrieve the name to display. Developer need to make sure the 'i-th' SubAnim() is non-NULL or this method will fail.
Parameters:
i The index of the parameter name to return
Returns:
The name of the 'i-th' parameter.

Reimplemented from SimpleManipulator.

Reimplemented in MSSimpleManipulatorXtnd.

int NumParamBlocks ( ) [inline, virtual]
Remarks:
This method is available in release 3.0 and later only.

This method returns the number of ParamBlock2s in this instance.
Default Implementation:
{ return 0; }

Reimplemented from Animatable.

Reimplemented in MSSimpleManipulatorXtnd.

{ return pblocks.Count(); }
IParamBlock2* GetParamBlock ( int  i ) [inline, virtual]
Remarks:
This method return 'i-th' ParamBlock2 in this instance (or NULL if not available).
Parameters:
i The zero based index of the ParamBlock2 to return.
Default Implementation:
{ return NULL; }

Reimplemented from Animatable.

Reimplemented in MSSimpleManipulatorXtnd.

{ return pblocks[i]; }
IParamBlock2* GetParamBlockByID ( BlockID  id ) [inline]
void* GetInterface ( ULONG  id ) [inline, virtual]

Inherited from Animatable.

Returns a pointer to the interface.

Parameters:
id - The id of the interface.
Returns:
A Pointer to the Interface

Reimplemented from Object.

Reimplemented in MSSimpleManipulatorXtnd.

{ if (id == I_MAXSCRIPTPLUGIN) return (MSPlugin*)this; else return Manipulator::GetInterface(id); }
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.

Reimplemented from SimpleManipulator.

                    { 
                        SimpleManipulator::NotifyRefChanged(changeInt, hTarget, partID, message); 
                        return ((MSPlugin*)this)->NotifyRefChanged(changeInt, hTarget, partID, message); 
                    }
int NumRefs ( ) [virtual]

Returns the total number of references this ReferenceMaker can hold.

The plugin implements this method to indicate the total number of of references it can make. This includes all references whether they are NULL (inactive) or non-NULL (active) at the time when this method is called. A plugin can hold a variable number of references, thus the return value of this method is not to be cached and reused by client code.

Returns:
The total number of references this plugin can hold. The default implementation is return 0.

Reimplemented from SimpleManipulator.

Reimplemented in MSSimpleManipulatorXtnd.

RefTargetHandle GetReference ( int  i ) [virtual]

Returns the 'i-th' reference.

The plugin implements this method to return its 'i-th' reference. The plug-in simply keeps track of its references using an integer index for each one. This method is normally called by the system.

Parameters:
i - The index of the reference to retrieve. Valid values are from 0 to NumRefs()-1.
Returns:
The reference handle of the 'i-th' reference. Note that different calls to this method with the same 'i' value can result in different reference handles being retrieved, as the plugin changes the scene objects it references as its 'i-th' reference.

Reimplemented from SimpleManipulator.

Reimplemented in MSSimpleManipulatorXtnd.

virtual void SetReference ( int  i,
RefTargetHandle  rtarg 
) [protected, virtual]

Stores a ReferenceTarget as its 'i-th' reference`.

The plugin implements this method to store the reference handle passed to it as its 'i-th' reference. In its implementation of this method, the plugin should simply assign the reference handle passed in as a parameter to the member variable that holds the 'i-th' reference. Other reference handling methods such as ReferenceMaker::DeleteReference(), or ReferenceMaker::ReplaceReference() should not be called from within this method. The plugin itself or other plugins should not call this method directly. The system will call this method when a new reference is created or an existing one is replaced by calling ReferenceMaker::ReplaceReference().

Parameters:
i - The index of the reference to store. Valid values are from 0 to NumRefs()-1.
rtarg - The reference handle to store.

Reimplemented from SimpleManipulator.

Reimplemented in MSSimpleManipulatorXtnd.

void RefDeleted ( ) [inline]
void RefAdded ( RefMakerHandle  rm ) [inline]
RefTargetHandle Clone ( RemapDir remap ) [virtual]

This method is used by 3ds Max to clone an object.

See also:
CloneRefHierarchy(), class RemapDir This method is called by 3ds Max to have the plugin clone itself. The plug-in's implementation of this method should copy both the data structure and all the data residing in the data structure of this reference target. The plugin should clone all its references as well. Also, the plug-in's implementation of this method must call BaseClone(). In order for classes derived from this class to clone cleanly, the Clone method should just create the new instance, and then call an implementation of BaseClone that clones the references and copies any other necessary data. For example:
            class MyDerivedPlugin
                : public MyBasePlugin
            {
                const int MY_REFERENCE = 1;

                ReferenceTarget* Clone(RemapDir& remap)
                {
                    ReferenceTarget* result = new MyDerivedPlugin();
                    BaseClone(this, result, remap);
                    return result;
                }

                void BaseClone(ReferenceTarget* from, ReferenceTarget* to, RemapDir& remap)
                {
                    if (!to || !from || from == to)
                        return;    
                    MyBasePlugin::BaseClone(from, to, remap);
                    to->ReplaceReference(MY_REFERENCE, remap->CloneRef(from->GetReference(MY_REFERENCE)));
                }
            };

This method should not be directly called by plug-ins. Instead, either RemapDir::CloneRef() or CloneRefHierachy() should be used to perform cloning. These methods ensure that the mapping from the original object to the clone is added to the RemapDir used for cloning, which may be used during backpatch operations

Note:
See the remarks in method BaseClone() below.
Parameters:
remap - A RemapDir instance used for remapping references during a Clone.
Returns:
A pointer to the cloned item.

Reimplemented from ReferenceTarget.

Reimplemented in MSSimpleManipulatorXtnd.

IOResult Save ( ISave isave ) [inline, virtual]

Reimplemented from MSPlugin.

{ return MSPlugin::Save(isave); }
IOResult Load ( ILoad iload ) [inline]

Reimplemented from MSPlugin.

{ return MSPlugin::Load(iload); }
void NotifyTarget ( int  msg,
RefMakerHandle  rm 
) [inline]

Reimplemented from MSPlugin.

{ MSPlugin::NotifyTarget(msg, rm); }
MCHAR* GetObjectName ( ) [inline, virtual]
Returns:
the name that will appear in the history browser (modifier stack).

Reimplemented from BaseObject.

Reimplemented in MSSimpleManipulatorXtnd.

{ return pc->class_name->to_string(); }
void BeginEditParams ( IObjParam ip,
ULONG  flags,
Animatable prev 
) [virtual]
Remarks:
This method is called by the system when the user may edit the item's (object, modifier, controller, etc.) parameters.
Parameters:
ip Interface pointer. The developer can use it to call methods such as AddRollupPage(). Note that this pointer is only valid between BeginEditParams() and EndEditParams(). It should not be used outside this interval.
flags Describe which branch of the command panel or dialog the item is being edited in. The following are possible values:

BEGIN_EDIT_CREATE
Indicates an item is being edited in the create branch.

BEGIN_EDIT_MOTION
Indicates a controller is being edited in the motion branch.

BEGIN_EDIT_HIERARCHY
Indicates a controller is being edited in the Pivot subtask of the hierarchy branch.

BEGIN_EDIT_IK
Indicates a controller is being edited in the IK subtask of the hierarchy branch.

BEGIN_EDIT_LINKINFO
Indicates a controller is being edited in the Link Info subtask of the hierarchy branch.

prev Pointer to an Animatable object. This parameter may be used in the motion and hierarchy branches of the command panel. This pointer allows a plug-in to look at the ClassID of the previous item that was being edited, and if it is the same as this item, to not replace the entire UI in the command panel, but simply update the values displayed in the UI fields. This prevents the UI from 'flickering' when the current item begins its edit. For example, if you are in the motion branch and are looking at an item's PRS controller values, and then select another item that is displayed with a PRS controller, the UI will not change - only the values displayed in the fields will change. If however you selected a target camera that has a lookat controller (not a PRS controller) the UI will change because a different set of parameters need to be displayed. Note that for items that are edited in the modifier branch this field can be ignored.

Reimplemented from SimpleManipulator.

Reimplemented in MSSimpleManipulatorXtnd.

void EndEditParams ( IObjParam ip,
ULONG  flags,
Animatable next 
) [virtual]
Remarks:
This method is called when the user is finished editing an objects parameters. The system passes a flag into the EndEditParams() method to indicate if the rollup page should be removed. If this flag is TRUE, the plug-in must un-register the rollup page, and delete it from the panel.
Parameters:
ip An interface pointer. The developer may use the interface pointer to call methods such as DeleteRollupPage().

flags The following flag may be set:

END_EDIT_REMOVEUI
If TRUE, the item's user interface should be removed.

next Animatable pointer. Can be used in the motion and hierarchy branches of the command panel. It allows a plug-in to look at the ClassID of the next item that was being edited, and if it is the same as this item, to not replace the entire UI in the command panel. Note that for items that are edited in the modifier branch this field can be ignored.

Reimplemented from SimpleManipulator.

Reimplemented in MSSimpleManipulatorXtnd.

CreateMouseCallBack* GetCreateMouseCallBack ( ) [virtual]

This method allows the system to retrieve a callback object used in creating an object in the 3D viewports.

This method returns a pointer to an instance of a class derived from CreateMouseCallBack. This class has a method proc() which is where the programmer defines the user/mouse interaction during the object creation phase.

Returns:
A pointer to an instance of a class derived from CreateMouseCallBack.

Implements BaseObject.

Reimplemented in MSSimpleManipulatorXtnd.

int UsesWireColor ( ) [inline, virtual]

Implemented by the System.

Returns TRUE to indicate the object color is used for display.

Reimplemented from HelperObject.

Reimplemented in MSSimpleManipulatorXtnd.

{ return HelperObject::UsesWireColor(); }   // TRUE if the object color is used for display
BOOL NormalAlignVector ( TimeValue  t,
Point3 pt,
Point3 norm 
) [inline, virtual]

Objects that don't support the IntersectRay() method (such as helper objects) can implement this method to provide a default vector for use with the normal align command in 3ds Max.

Parameters:
t The time to compute the normal align vector.
pt The point of intersection.
norm The normal at the point of intersection.
Returns:
TRUE if this method is implemented to return the normal align vector; otherwise FALSE.

Reimplemented from HelperObject.

Reimplemented in MSSimpleManipulatorXtnd.

{ return HelperObject::NormalAlignVector(t, pt, norm); }
void UpdateShapes ( TimeValue  t,
MSTR toolTip 
) [virtual]
Remarks:
This method gets called whenever the manipulator needs to update its gizmos. This is implemented by the manipulator to create the gizmos based on the current state of the node being manipulated.
Parameters:
TimeValue t

The time at which to update the shape.

MSTR& toolTip

The tool tip text to update.

Implements SimpleManipulator.

Reimplemented in MSSimpleManipulatorXtnd.

void OnButtonDown ( TimeValue  t,
ViewExp pVpt,
IPoint2 m,
DWORD  flags,
ManipHitData pHitData 
) [virtual]
Remarks:
Implemented by the system.

This method gets called when the mouse buttons is pressed within the manipulator context. Used internally.
Parameters:
TimeValue t

The time to display the object.

ViewExp* pVpt

An interface that may be used to call methods associated with the viewports.

IPoint2& m

The location of the tooltip.

DWORD flags

Not used, should be set to 0.

ManipHitData* pHitData

A pointer to the hitdata containing information on which manipulator was hit.

Reimplemented from SimpleManipulator.

Reimplemented in MSSimpleManipulatorXtnd.

void OnMouseMove ( TimeValue  t,
ViewExp pVpt,
IPoint2 m,
DWORD  flags,
ManipHitData pHitData 
) [virtual]
Remarks:
This method gets called when the mouse is pressed down and moves within the manipulator context. It is the method that does the actual manipulator. It is up to the manipulator code to turn the mouse position into a new value for the parameter(s) being manipulated. It also updates the tooltip with the current value of the parameter.
Parameters:
TimeValue t

The time to display the object.

ViewExp* pVpt

An interface that may be used to call methods associated with the viewports.

IPoint2& m

The location of the tooltip.

DWORD flags

Not used, should be set to 0.

ManipHitData* pHitData

A pointer to the hitdata containing information on which manipulator was hit.

Reimplemented from SimpleManipulator.

Reimplemented in MSSimpleManipulatorXtnd.

void OnButtonUp ( TimeValue  t,
ViewExp pVpt,
IPoint2 m,
DWORD  flags,
ManipHitData pHitData 
) [virtual]
Remarks:
Implemented by the system.

This method gets called when the mouse buttons is released within the manipulator context. Used internally.
Parameters:
TimeValue t

The time to display the object.

ViewExp* pVpt

An interface that may be used to call methods associated with the viewports.

IPoint2& m

The location of the tooltip.

DWORD flags

Not used, should be set to 0.

ManipHitData* pHitData

A pointer to the hitdata containing information on which manipulator was hit.

Reimplemented from SimpleManipulator.

Reimplemented in MSSimpleManipulatorXtnd.


Member Data Documentation


MSPluginSimpleManipulator MSPluginSimpleManipulator MSPluginSimpleManipulator MSPluginSimpleManipulator MSPluginSimpleManipulator MSPluginSimpleManipulator MSPluginSimpleManipulator MSPluginSimpleManipulator MSPluginSimpleManipulator MSPluginSimpleManipulator
MSPluginSimpleManipulator MSPluginSimpleManipulator MSPluginSimpleManipulator MSPluginSimpleManipulator MSPluginSimpleManipulator MSPluginSimpleManipulator MSPluginSimpleManipulator MSPluginSimpleManipulator MSPluginSimpleManipulator MSPluginSimpleManipulator