Public Member Functions | Friends

DummyObject Class Reference

Search for all occurrences

Detailed Description

See also:
Class HelperObject, Class Animatable, Class ReferenceMaker, Class ReferenceTarget, Class BaseObject, Class Object, Class GeomObject, Class Mesh.

Description:
This class represents a dummy helper object. There are several methods plug-ins may call to get and set the size, and set the color of the dummy object. These are used when a plug-in needs to create a dummy object in the scene. This class provides implementations of all the required methods of Animatable, ReferenceMaker, ReferenceTarget, BaseObject, Object, and GeomObject. All methods of this class are implemented by the system.

#include <dummy.h>

Inheritance diagram for DummyObject:
Inheritance graph
[legend]

List of all members.

Public Member Functions

CoreExport  DummyObject ()
CoreExport Box3  GetBox () const
CoreExport void  SetBox (Box3 &b)
CoreExport void  SetColor (Point3 color)
CoreExport void  EnableDisplay ()
CoreExport void  DisableDisplay ()
CoreExport void  SetValidity (Interval v)
CoreExport int  HitTest (TimeValue t, INode *inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt)
  This method is called to determine if the specified screen point intersects the item.
CoreExport void  Snap (TimeValue t, INode *inode, SnapInfo *snap, IPoint2 *p, ViewExp *vpt)
  Checks the point passed for a snap and updates the SnapInfo structure.
CoreExport int  Display (TimeValue t, INode *inode, ViewExp *vpt, int flags)
  This is called by the system to have the item display itself (perform a quick render in viewport, using the current TM).
CoreExport CreateMouseCallBack GetCreateMouseCallBack ()
  This method allows the system to retrieve a callback object used in creating an object in the 3D viewports.
CoreExport RefTargetHandle  Clone (RemapDir &remap)
  This method is used by 3ds Max to clone an object.
Interval  ObjectValidity (TimeValue t)
  This method returns the validity interval of the object as a whole at the specified time.
CoreExport ObjectState  Eval (TimeValue time)
  This method is called to evaluate the object and return the result as an ObjectState.
void  InitNodeName (MSTR &s)
  Implemented by the System.
int  DoOwnSelectHilite ()
  If an object wants to draw itself in the 3D viewports in its selected state in some custom manner this method should return nonzero.
int  IsRenderable ()
  Implemented by the System.
MCHAR *  GetObjectName ()
CoreExport void  GetWorldBoundBox (TimeValue t, INode *mat, ViewExp *vpt, Box3 &box)
  This method returns the world space bounding box for Objects (see below for the Sub-object gizmo or Modifiers gizmo version).
CoreExport void  GetLocalBoundBox (TimeValue t, INode *mat, ViewExp *vpt, Box3 &box)
  This is the object space bounding box, the box in the object's local coordinates.
CoreExport void  GetDeformBBox (TimeValue t, Box3 &box, Matrix3 *tm, BOOL useSel=FALSE)
  This method computes the bounding box in the objects local coordinates or the optional space defined by tm.
CoreExport IOResult  Save (ISave *isave)
  Called for saving data.
CoreExport IOResult  Load (ILoad *iload)
  Called for loading data.
CoreExport void  RescaleWorldUnits (float f)
  Rescale size of all world units in reference hierarchy.
CoreExport void  DeleteThis ()
  Deletes an instance of this class.
Class_ID  ClassID ()
  Retrieves a constant that uniquely identifies the plugin class.
void  GetClassName (MSTR &s)
  Retrieves the name of the plugin class.
int  IsKeyable ()
LRESULT CALLBACK  TrackViewWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
  This function is obsolete.

Friends

class  LuminaireObject
class  LuminaireObjectCreateCallBack
class  DummyObjectCreateCallBack
class  CharacterObject
INT_PTR CALLBACK  DummyParamDialogProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)

Constructor & Destructor Documentation

CoreExport DummyObject ( )
Remarks:
Constructor. The size of the object is set to a minimal value, and the color of the object is initialized to (0.6f, 0.8f, 1.0f);

Member Function Documentation

CoreExport Box3 GetBox ( ) const
Remarks:
Returns the size of the dummy object box representation.
CoreExport void SetBox ( Box3 b )
Remarks:
Sets the size of the dummy object box representation.
CoreExport void SetColor ( Point3  color )
Remarks:
Sets the display color of the dummy object in its normal state (not selected or frozen).
CoreExport void EnableDisplay ( )
Remarks:
Enables the dummy object so it may be displayed, hit tested, snapped, etc.
CoreExport void DisableDisplay ( )
Remarks:
Prevents the dummy object from being displayed, hit tested, snapped, etc.
CoreExport void SetValidity ( Interval  v )
CoreExport int HitTest ( TimeValue  t,
INode inode,
int  type,
int  crossing,
int  flags,
IPoint2 p,
ViewExp vpt 
) [virtual]

This method is called to determine if the specified screen point intersects the item.

The method returns nonzero if the item was hit; otherwise 0.

Parameters:
t The time to perform the hit test.
inode A pointer to the node to test.
type The type of hit testing to perform. See Scene and Node Hit Test Types. for details.
crossing The state of the crossing setting. If TRUE crossing selection is on.
flags The hit test flags. See Scene and Node Hit Testing Flags for details.
p The screen point to test.
vpt An interface pointer that may be used to call methods associated with the viewports.
Returns:
Nonzero if the item was hit; otherwise 0.

Reimplemented from BaseObject.

CoreExport void Snap ( TimeValue  t,
INode inode,
SnapInfo snap,
IPoint2 p,
ViewExp vpt 
) [virtual]

Checks the point passed for a snap and updates the SnapInfo structure.

Note:
Developers wanting to find snap points on an Editable Mesh object should see the method XmeshSnap::Snap() in /MAXSDK/SAMPLES/SNAPS/XMESH/XMESH.CPP.
Parameters:
t The time to check.
inode The node to check.
snap The snap info structure to update.
p The screen point to check.
vpt An interface pointer that may be used to call methods associated with the viewports.

Reimplemented from BaseObject.

CoreExport int Display ( TimeValue  t,
INode inode,
ViewExp vpt,
int  flags 
) [virtual]

This is called by the system to have the item display itself (perform a quick render in viewport, using the current TM).

Note: For this method to be called the object's validity interval must be invalid at the specified time t. If the interval is valid, the system may not call this method since it thinks the display is already valid.

Parameters:
t The time to display the object.
inode The node to display.
vpt An interface pointer that may be used to call methods associated with the viewports.
flags See Display Flags.
Returns:
The return value is not currently used.

Reimplemented from BaseObject.

CoreExport 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.

CoreExport 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.

Interval ObjectValidity ( TimeValue  t ) [inline, virtual]

This method returns the validity interval of the object as a whole at the specified time.

Parameters:
t The time to compute the validity interval.
Default Implementation:
{ return FOREVER; }
Returns:
The validity interval of the object.

Reimplemented from Object.

{ return valid; }
CoreExport ObjectState Eval ( TimeValue  t ) [virtual]

This method is called to evaluate the object and return the result as an ObjectState.

When the system has a pointer to an object it doesn't know if it's a procedural object or a derived object. So it calls Eval() on it and gets back an ObjectState. A derived object managed by the system may have to call Eval() on its input for example. A plug-in (like a procedural object) typically just returns itself. A plug-in that does not just return itself is the Morph Object (/MAXSDK/SAMPLES/OBJECTS/MORPHOBJ.CPP). This object uses a morph controller to compute a new object and fill in an ObjectState which it returns.

Parameters:
t Specifies the time to evaluate the object.
Returns:
The result of evaluating the object as an ObjectState.
Sample Code:
Typically this method is implemented as follows:
    { return ObjectState(this); }

Implements Object.

void InitNodeName ( MSTR s ) [virtual]

Implemented by the System.

Sets the default node name to "Helper".

Reimplemented from HelperObject.

int DoOwnSelectHilite ( ) [inline, virtual]

If an object wants to draw itself in the 3D viewports in its selected state in some custom manner this method should return nonzero.

If this item returns nonzero, the BaseObject::Display() method should respect the selected state of the object when it draws itself. If this method returns zero the system will use its standard method of showing the object as selected.

Returns:
Nonzero if the object will draw itself in the selected state; otherwise 0. If nonzero, the plug-in developer is responsible for displaying the object in the selected state as part of its Display() method.

Reimplemented from Object.

{return 1; }        
int IsRenderable ( ) [inline, virtual]

Implemented by the System.

Returns 0 to indicate this object type may not be rendered.

Reimplemented from HelperObject.

{ return 0; }
MCHAR* GetObjectName ( ) [virtual]
Returns:
the name that will appear in the history browser (modifier stack).

Reimplemented from BaseObject.

CoreExport void GetWorldBoundBox ( TimeValue  t,
INode inode,
ViewExp vp,
Box3 box 
) [virtual]

This method returns the world space bounding box for Objects (see below for the Sub-object gizmo or Modifiers gizmo version).

The bounding box returned by this method does not need to be precise. It should however be calculated rapidly. The object can handle this by transforming the 8 points of its local bounding box into world space and take the minimums and maximums of the result. Although this isn't necessarily the tightest bounding box of the objects points in world space, it is close enough.

Parameters:
t The time to compute the bounding box.
inode The node to calculate the bounding box for.
vp An interface pointer that can be used to call methods associated with the viewports.
box Contains the returned bounding box.

Reimplemented from BaseObject.

CoreExport void GetLocalBoundBox ( TimeValue  t,
INode inode,
ViewExp vp,
Box3 box 
) [virtual]

This is the object space bounding box, the box in the object's local coordinates.

The system expects that requesting the object space bounding box will be fast.

Parameters:
t The time to retrieve the bounding box.
inode The node to calculate the bounding box for.
vp An interface pointer that may be used to call methods associated with the viewports.
box Contains the returned bounding box.

Reimplemented from BaseObject.

CoreExport void GetDeformBBox ( TimeValue  t,
Box3 box,
Matrix3 tm,
BOOL  useSel = FALSE 
) [virtual]

This method computes the bounding box in the objects local coordinates or the optional space defined by tm.

Note: If you are looking for a precise bounding box, use this method and pass in the node's object TM (INode::GetObjectTM()) as the matrix.

Parameters:
t The time to compute the box.
box A reference to a box the result is stored in.
tm This is an alternate coordinate system used to compute the box. If the tm is not NULL this matrix should be used in the computation of the result.
useSel If TRUE, the bounding box of selected sub-elements should be computed; otherwise the entire object should be used.

Reimplemented from Object.

CoreExport IOResult Save ( ISave isave ) [virtual]

Called for saving data.

Called by the system to allow the plugin to save its data.

Parameters:
isave - This pointer may be used to call methods to write data to disk. See the section on Loading and Saving for an overview of the load/save process.
Returns:
The default implementation is return IO_OK.
  • IO_OK means the result was acceptable, with no errors.
  • IO_ERROR This should be returned if an error occurred.

Reimplemented from ReferenceMaker.

CoreExport IOResult Load ( ILoad iload ) [virtual]

Called for loading data.

Called by the system to allow the plug-in to load its data. See the section on Loading and Saving for an overview of the load - save process.

Parameters:
iload - This interface pointer may be used to call methods to read data from disk.
Returns:
The default implementation is return IO_OK.
  • IO_OK means the result was acceptable, with no errors.
  • IO_ERROR This should be returned if an error occurred.

Reimplemented from ReferenceMaker.

CoreExport void RescaleWorldUnits ( float  f ) [virtual]

Rescale size of all world units in reference hierarchy.

This method is available in release 2.0 and later only. Must call ClearAFlagInHierarchy(rm, A_WORK1) or ClearAFlagInAllAnimatables(A_WORK1) before doing this on a reference hierarchy. This may be implemented to rescale the size of all world units in a reference hierarchy. Developers must call

        if (TestAFlag(A_WORK1))
            return;
        SetAFlag(A_WORK1);

before doing this on a reference hierarchy.

Parameters:
f - The scale factor.

Reimplemented from ReferenceMaker.

CoreExport void DeleteThis ( ) [virtual]

Deletes an instance of this class.

3ds Max calls this method when it needs to delete a plugin object (an instance of a class derived from Animatable). Similarly, plugins that need to delete instances of an Animatable or a class directly derived from it via an Animatable pointer, should call this method instead of calling directly operator delete. Following these rules will ensure that the same memory manager is used to allocate and deallocate the object. The default implementation of this method deletes the object. Plugin instances that never need to be deleted from the heap can overwrite this method to do nothing.

Note:
See the method ClassDesc::Create() for details on how Max allocates plugin objects.
See ReferenceMaker::DeleteMe() and ReferenceTarget::MaybeAutoDelete() for information on how plugin instances are deleted by the system.
Remarks:
See Memory Allocation.

See also:
Plugin DLL Functions, Class ClassDesc.

Reimplemented from Animatable.

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.

{ return dummyClassID; }  
void GetClassName ( MSTR s ) [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 ReferenceTarget.

int IsKeyable ( ) [inline]
LRESULT CALLBACK TrackViewWinProc ( HWND  hwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
) [inline, virtual]

This function is obsolete.

Reimplemented from Animatable.

                                                {return(0);}

Friends And Related Function Documentation

friend class LuminaireObject [friend]
friend class LuminaireObjectCreateCallBack [friend]
friend class DummyObjectCreateCallBack [friend]
friend class CharacterObject [friend]
INT_PTR CALLBACK DummyParamDialogProc ( HWND  hDlg,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
) [friend]

DummyObject DummyObject DummyObject DummyObject DummyObject DummyObject DummyObject DummyObject DummyObject DummyObject
DummyObject DummyObject DummyObject DummyObject DummyObject DummyObject DummyObject DummyObject DummyObject DummyObject