Public Member Functions | Protected Member Functions

GizmoObject Class Reference

Search for all occurrences

Detailed Description

See also:
Class HelperObject, Class IParamMap, Class IParamBlock, Class Interface, Class ParamDimension.

Description:
This class is available in release 2.0 and later only.

This is the base class for the creation of atmospheric gizmo objects. It provides implementations of most of the methods needed. Developers will probably want to provide their own implementations of BeginEditParams() and EndEditParams() and call the GizmoObject implementations from within their implementation. See the source code for GizmoObject in /MAXSDK/SAMPLES/HOWTO/MISC/GIZMO.CPP to see how the base class methods are implemented.

Note that developers must use the data members below as the base class code relies on these being used.
Data Members:
IParamBlock *pblock;

This is a pointer to the parameter block that should be used to manage the animated parameters of the gizmo object.

static IParamMap *pmapParam;

This is a pointer to the parameter map that should be used to manage the user interface for the gizmo object.

static IObjParam *ip;

This is the interface pointer for the gizmo object.

static GizmoObject *editOb;

This is a pointer to the current gizmo object being edited in the command panel. When BeginEditParams() is called, this pointer is set to the this pointer of the GizmoObject being edited.

#include <gizmo.h>

Inheritance diagram for GizmoObject:
Inheritance graph
[legend]

List of all members.

Public Member Functions

CoreExport RefResult  NotifyRefChanged (Interval changeInt, RefTargetHandle hTarget, PartID &partID, RefMessage message)
  Receives and responds to messages.
Interval  ObjectValidity (TimeValue t)
virtual void  InvalidateUI ()
virtual ParamDimension GetParameterDim (int pbIndex)
virtual MSTR  GetParameterName (int pbIndex)
virtual void  DrawGizmo (TimeValue t, GraphicsWindow *gw)
virtual Point3  WireColor ()
virtual void  GetBoundBox (Matrix3 &mat, TimeValue t, Box3 &box)

Protected Member Functions

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

Member Function Documentation

virtual void SetReference ( int  i,
RefTargetHandle  rtarg 
) [inline, 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 ReferenceMaker.

:
        CoreExport RefResult NotifyRefChanged(Interval changeInt,RefTargetHandle hTarget, 
CoreExport RefResult NotifyRefChanged ( Interval  changeInt,
RefTargetHandle  hTarget,
PartID partID,
RefMessage  message 
) [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.

Interval ObjectValidity ( TimeValue  t ) [inline, virtual]
Remarks:
Returns the validity interval of the gizmo object around the specified time.
Parameters:
TimeValue t

Specifies the time at which the gizmo validity is returned.
Default Implementation:
{return FOREVER;}

Reimplemented from Object.

Reimplemented in SphereGizmoObject, CylGizmoObject, and BoxGizmoObject.

{}
virtual void InvalidateUI ( ) [inline, virtual]
Remarks:
Invalidates the user interface for the gizmo so it will get redrawn on the next screen update.
Default Implementation:
{}
Sample Code:
This is the code from the Sphere GizmoObject implementation of this method. Note that it simply calls Invalidate() on the parameter map.
        void SphereGizmoObject::InvalidateUI() {
            if (pmapParam) pmapParam->Invalidate();
        }

Reimplemented in SphereGizmoObject, CylGizmoObject, and BoxGizmoObject.

{return defaultDim;}
virtual ParamDimension* GetParameterDim ( int  pbIndex ) [inline, virtual]
Remarks:
Returns the dimension of the parameter whose parameter block index is passed.
Parameters:
int pbIndex

Specifies which parameter name to return.
Default Implementation:
{return defaultDim;}
Sample Code:
        ParamDimension *SphereGizmoObject::GetParameterDim(int pbIndex) {
            switch (pbIndex) {
                case PB_GIZMO_RADIUS: return stdWorldDim;
                default: return defaultDim;
            }
        }

Reimplemented in SphereGizmoObject, CylGizmoObject, and BoxGizmoObject.

{return MSTR(_M("Parameter"));}
virtual MSTR GetParameterName ( int  pbIndex ) [inline, virtual]
Remarks:
Returns the name of the parameter whose parameter block index is passed.
Parameters:
int pbIndex

Specifies which parameter name to return.
Default Implementation:
{return MSTR(_M("Parameter"));}

Reimplemented in SphereGizmoObject, CylGizmoObject, and BoxGizmoObject.

{}
virtual void DrawGizmo ( TimeValue  t,
GraphicsWindow gw 
) [inline, virtual]
Remarks:
This method is called to draw the gizmo at the specified time into the specified viewport.
Parameters:
TimeValue t

The time to draw the gizmo.

GraphicsWindow *gw

The GraphicsWindow associated with the viewport in which to draw the gizmo.
Default Implementation:
{}

Reimplemented in SphereGizmoObject, CylGizmoObject, and BoxGizmoObject.

{ return GetUIColor(COLOR_ATMOS_APPARATUS); } // mjm - 4.20.99
virtual Point3 WireColor ( ) [inline, virtual]
Remarks:
Returns the wire frame color for the gizmo in the viewports.
Default Implementation:
{return Point3(1,1,0);}
{}
virtual void GetBoundBox ( Matrix3 mat,
TimeValue  t,
Box3 box 
) [inline, virtual]
Remarks:
Returns the bounding box for the gizmo, as transformed by the matrix passed, at the time passed.
Parameters:
Matrix3 &mat

The points of the gizmo object should be transformed by this matrix before the bounding box is computed from them.

TimeValue t

The time to compute the bounding box.

Box3 &box

The result is stored here.
Default Implementation:
{}
Sample Code:
        void SphereGizmoObject::GetBoundBox(Matrix3 &mat, TimeValue t, Box3 &box) {
            float radius;
            int hemi;
            pblock->GetValue(PB_GIZMO_RADIUS,t,radius,FOREVER);
            pblock->GetValue(PB_GIZMO_HEMI,t,hemi,FOREVER);
            BoxLineProc proc(&mat);
            DrawSphere(proc,radius,hemi);
            box += proc.Box();
        }

Reimplemented in SphereGizmoObject, CylGizmoObject, and BoxGizmoObject.


GizmoObject GizmoObject GizmoObject GizmoObject GizmoObject GizmoObject GizmoObject GizmoObject GizmoObject GizmoObject
GizmoObject GizmoObject GizmoObject GizmoObject GizmoObject GizmoObject GizmoObject GizmoObject GizmoObject GizmoObject