3ds Max C++ API Reference
Loading...
Searching...
No Matches
ViewExp Class Referenceabstract

#include <maxapi.h>

+ Inheritance diagram for ViewExp:

Public Types

enum  { kEXECUTE_GET_VIEWEXP_10 = 0 , kEXECUTE_GET_VIEWPORT_ID = 1 , kEXECUTE_GET_VIEWEXP_11 = 2 , kEXECUTE_GET_VIEWEXP_13 = 3 }
 

Public Member Functions

virtual int GetViewID ()=0
 Return the unique ID of the viewport represented by the ViewExp.
 
virtual ViewExpToPointer ()=0
 
virtual bool IsAlive ()=0
 
virtual Point2 MapViewToScreen (const Point3 &p)=0
 
virtual float GetFPS ()=0
 Get the FPS from the active viewport.
 
virtual void SetSolidBackgroundColorMode (bool bSolidColor)=0
 Set the viewport background color mode as solid color mode or gradient color mode.
 
virtual bool IsSolidBackgroundColorMode ()=0
 Get the current viewport background color mode.
 
virtual void ResetBackgroundColorMode ()=0
 Reset viewport background color mode.
 
virtual void InvalidateRect (const Rect &rect)=0
 
virtual INT_PTR Execute (int cmd, ULONG_PTR arg1=0, ULONG_PTR arg2=0, ULONG_PTR arg3=0)
 
World Space Conversion
virtual Point3 GetPointOnCP (const IPoint2 &ps)=0
 
virtual float GetCPDisp (const Point3 base, const Point3 &dir, const IPoint2 &sp1, const IPoint2 &sp2, BOOL snap=FALSE)=0
 
virtual Point3 MapScreenToView (const IPoint2 &sp, float depth)=0
 
virtual void MapScreenToWorldRay (float sx, float sy, Ray &ray)=0
 
virtual BOOL SetAffineTM (const Matrix3 &m)=0
 
virtual void GetAffineTM (Matrix3 &tm)=0
 
virtual float GetScreenScaleFactor (const Point3 worldPoint)=0
 
virtual float GetVPWorldWidth (const Point3 wPoint)=0
 
virtual Point3 MapCPToWorld (const Point3 cpPoint)=0
 
virtual float NonScalingObjectSize ()=0
 
Snapping
virtual Point3 SnapPoint (const IPoint2 &in, IPoint2 &out, Matrix3 *plane2d=NULL, DWORD flags=0)=0
 
virtual void SnapPreview (const IPoint2 &in, IPoint2 &out, Matrix3 *plane2d=NULL, DWORD flags=0)=0
 
virtual void GetGridDims (float *MinX, float *MaxX, float *MinY, float *MaxY)=0
 
virtual float SnapLength (float in)=0
 
Access to Viewport Properties


virtual GraphicsWindowgetGW ()=0
 
virtual int IsWire ()=0
 
virtual Rect GetDammageRect ()=0
 
virtual void GetConstructionTM (Matrix3 &tm)=0
 
virtual void SetGridSize (float size)=0
 
virtual float GetGridSize ()=0
 
virtual BOOL IsGridVisible ()=0
 
virtual void SetGridVisibility (BOOL bVisible)=0
 
virtual int GetGridType ()=0
 
virtual BOOL setBkgImageDsp (BOOL onOff)=0
 
virtual int getBkgImageDsp (void)=0
 
virtual void setSFDisplay (int onOff)=0
 
virtual int getSFDisplay (void)=0
 
virtual HWND GetHWnd ()=0
 
virtual BOOL IsActive ()=0
 
virtual BOOL IsEnabled ()=0
 
Perspective/Camera View Properties
virtual int GetViewType ()=0
 
virtual BOOL IsPerspView ()=0
 
virtual BOOL IsCanvasNavigationMode ()=0
 
virtual float GetFOV ()=0
 
virtual float GetFocalDist ()=0
 
virtual void SetFocalDist (float fd)=0
 
virtual INodeGetViewCamera ()=0
 
virtual void SetViewCamera (INode *camNode)=0
 
virtual void SetViewUser (BOOL persp)=0
 
virtual INodeGetViewSpot ()=0
 
virtual void SetViewSpot (INode *spotNode)=0
 
Node Level Hit-testing


virtual void ClearHitList ()=0
 
virtual INodeGetClosestHit ()=0
 
virtual INodeGetHit (int i)=0
 
virtual int HitCount ()=0
 
Subobject Level Hit-testing
virtual void LogHit (INode *nr, ModContext *mc, DWORD dist, ulong info, HitData *hitdata=NULL)=0
 This method records a sub-object level hit record with the system using the specified parameters.
 
virtual HitLogGetSubObjHitList ()=0
 
virtual void ClearSubObjHitList ()=0
 
virtual int NumSubObjHits ()=0
 
Controller Apparatus Hit-testing
virtual void CtrlLogHit (INode *nr, DWORD dist, ulong info, DWORD infoExtra)=0
 
virtual CtrlHitLogGetCtrlHitList ()=0
 
virtual void ClearCtrlHitList ()=0
 
AutoGrid Related Methods
virtual void TrackImplicitGrid (IPoint2 m, Matrix3 *mat=NULL, ULONG hitTestFlags=0)=0
 
virtual void CommitImplicitGrid (IPoint2 m, int mouseflags, Matrix3 *mat=NULL)=0
 
virtual void ReleaseImplicitGrid ()=0
 
- Public Member Functions inherited from InterfaceServer
virtual UtilExport ~InterfaceServer ()
 Destructor.
 
virtual UtilExport BaseInterfaceGetInterface (Interface_ID id)
 
template<class InterfaceType >
InterfaceType * GetTypedInterface ()
 

Additional Inherited Members

- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned.
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned.
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned.
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned.
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects.
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned.
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned.
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen.
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen.
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen.
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen.
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen.
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown.
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator.
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator.
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary.
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary.
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc.
 

Detailed Description

See also
Snap Flags, Class Ray, Class Point3, Class IPoint2, Class Matrix3, Class ModContext, Class HitData, Class GraphicsWindow, Class INode.

Description:
This class provides methods to access properties of the viewport, convert points between viewport and world coordinates, snap points and lengths, etc. Many methods associated with hit testing are also here. All the methods of this class are implemented by the system.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
kEXECUTE_GET_VIEWEXP_10 

Command id to be passed to ViewExp::Execute in order to get the viewport's ViewExp10 interface.

kEXECUTE_GET_VIEWPORT_ID 

Command id to be passed to ViewExp::Execute in order to get the viewport's unique ID (different from its index)

kEXECUTE_GET_VIEWEXP_11 

Command id to be passed to ViewExp::Execute in order to get the viewport's ViewExp11 interface.

kEXECUTE_GET_VIEWEXP_13 

Command id to be passed to ViewExp::Execute in order to get the viewport's ViewExp13 interface.

1389 {
1398 };
@ kEXECUTE_GET_VIEWEXP_13
Command id to be passed to ViewExp::Execute in order to get the viewport's ViewExp13 interface.
Definition: maxapi.h:1397
@ kEXECUTE_GET_VIEWEXP_11
Command id to be passed to ViewExp::Execute in order to get the viewport's ViewExp11 interface.
Definition: maxapi.h:1395
@ kEXECUTE_GET_VIEWPORT_ID
Command id to be passed to ViewExp::Execute in order to get the viewport's unique ID (different from ...
Definition: maxapi.h:1393
@ kEXECUTE_GET_VIEWEXP_10
Command id to be passed to ViewExp::Execute in order to get the viewport's ViewExp10 interface.
Definition: maxapi.h:1391

Member Function Documentation

◆ GetViewID()

virtual int GetViewID ( )
pure virtual

Return the unique ID of the viewport represented by the ViewExp.

NOTE: Each view panel can have 4 viewports whose indexes are usually all from 0 to 3. But their view IDs are unique. Besides, view ID is persistent during FileIO. So user can store this ID during saving. And then after loading, user can use the stored ID to retrieve the same viewExp interface by calling Interface14::GetViewExpByID(int id)

Returns
the view ID of the viewport

◆ ToPointer()

virtual ViewExp * ToPointer ( )
pure virtual

◆ IsAlive()

virtual bool IsAlive ( )
pure virtual

◆ GetPointOnCP()

virtual Point3 GetPointOnCP ( const IPoint2 ps)
pure virtual
Remarks
Returns a point in world space on the current construction plane based on the specified screen coordinate.
Parameters
psThe 2D screen point to convert to a 3D world space coordinate.
Returns
The world space coordinate on the current construction plane.

◆ SnapPoint()

virtual Point3 SnapPoint ( const IPoint2 in,
IPoint2 out,
Matrix3 plane2d = NULL,
DWORD  flags = 0 
)
pure virtual
Remarks
Given a 2D screen coordinate, this method returns a 3D point on the current construction plane based on the current snap settings and flags passed.
Parameters
inThe 2D screen coordinate to snap.
outThe snapped 2D screen coordinate. This is used if you need to move the mouse position to the snapped location.
plane2dThis optional argument allows you to use any plane (not just the current construction plane).
flagsSee Snap Flags.
Returns
The snapped 3D point in construction plane coordinates.

◆ SnapPreview()

virtual void SnapPreview ( const IPoint2 in,
IPoint2 out,
Matrix3 plane2d = NULL,
DWORD  flags = 0 
)
pure virtual
Remarks
This is a method used as part of the osnap system in 3ds Max. It is the method that displays the snap marker in the viewports prior to the first point event. It's really just a call to SnapPoint() which returns nothing. This method should be called in response to a MOUSE_FREEMOVE event from any creation or transformation proc which calls SnapPoint(). Here's an example creation proc:
Sample Code:
int PointHelpObjCreateCallBack::proc(ViewExp *vpt,int msg, int point, int flags, IPoint2 m, Matrix3& mat )
{
if (msg == MOUSE_FREEMOVE)
// Show a preview snap in the viewport prior to the
// first point event.
if (msg==MOUSE_POINT||msg==MOUSE_MOVE)
{
switch(point)
{
case 0:
ob->suspendSnap = TRUE;
break;
case 1:
if (msg==MOUSE_POINT)
{
ob->suspendSnap = FALSE;
return 0;
}
break;
}
}
else if (msg == MOUSE_ABORT)
{
return CREATE_ABORT;
}
return 1;
}
#define NULL
Definition: autoptr.h:18
Definition: ipoint2.h:30
Definition: matrix3.h:99
void SetTrans(const Point3 &p)
Definition: maxapi.h:795
virtual void SnapPreview(const IPoint2 &in, IPoint2 &out, Matrix3 *plane2d=NULL, DWORD flags=0)=0
virtual Point3 SnapPoint(const IPoint2 &in, IPoint2 &out, Matrix3 *plane2d=NULL, DWORD flags=0)=0
#define MOUSE_FREEMOVE
Similar to a MOUSE_MOVE message except it is not called when the mouse is in a 'drag' session.
Definition: mouseman.h:166
#define MOUSE_POINT
Sent when the user has clicked a point.
Definition: mouseman.h:147
#define MOUSE_MOVE
Sent when the mouse input is captured and the user moved the mouse.
Definition: mouseman.h:152
#define MOUSE_ABORT
Sent when the user aborts a mouse procedure.
Definition: mouseman.h:143
#define SNAP_IN_3D
Snap to all points.
Definition: snap.h:34
#define CREATE_ABORT
Definition: maxapi.h:1855
Parameters
inThe 2D screen coordinate to snap.
outThe snapped 2D screen coordinate. This is used if you need to move the mouse position to the snapped location.
plane2dThis optional argument allows you to use any plane (not just the current construction plane).
flagsSee Snap Flags.

◆ GetGridDims()

virtual void GetGridDims ( float *  MinX,
float *  MaxX,
float *  MinY,
float *  MaxY 
)
pure virtual
Remarks
This method is used internally. It fills up it's arguments with the world space extents of the home grid (i.e. the extents of the grid as displayed). It doesn't work for grid helper which always display to their size limits. This was exposed so 3ds Max could do the grid snapping and is not needed by plug-in developers.

◆ SnapLength()

virtual float SnapLength ( float  in)
pure virtual
Remarks
Given the distance passed, this method snaps the length to the nearest snap increment and returns the snapped distance.
Parameters
inThe input distance to be snapped.
Returns
The snapped distance.

◆ GetCPDisp()

virtual float GetCPDisp ( const Point3  base,
const Point3 dir,
const IPoint2 sp1,
const IPoint2 sp2,
BOOL  snap = FALSE 
)
pure virtual
Remarks
This method returns a length in world space given a start screen point, an end screen point, a base point and a direction vector. For example, when creating a cylinder, the user clicks the mouse down to define the center point of the cylinder (base), then drags out a radius. They then drag out a height for the cylinder. This method is used to return intermediate and final heights for the cylinder based on the initial base point, the direction vector (the Z axis), the start mouse point, and the current point the user is interactively adjusting.
Parameters
baseBase point in object space.
dirDirection vector in object space.
sp1Screen start point. This is the point where the user clicked down with the mouse.
sp2Screen end point. This is the point where the user let up the mouse.
snap
Returns
The length in world space based on the screen points and their projection onto the direction vector.
Sample Code:
float h = vpt->SnapLength(vpt->GetCPDisp(p[1],Point3(0,0,1),sp1,m));
Definition: point3.h:54
From /MAXSDK/SAMPLES/OBJECTS/CYL.CPP in CylinderObjCreateCallBack::proc

◆ getGW()

virtual GraphicsWindow * getGW ( )
pure virtual
Remarks
Returns a pointer to the instance of GraphicsWindow associated with this viewport.

Note: A GraphicsWindow always has a transform associated with it, for faster object-to-screen space conversions. The GraphicsWindow * returned by this method may have a non-identity transform already in place. A developer can call gw->setTransform() with a node's transform for fast work in Display routines. But this value must be explicitly set to the identity for world-to-screen displays.

◆ IsWire()

virtual int IsWire ( )
pure virtual
Remarks
Determines if this viewport is in wire-frame rendering mode (as opposed to a shaded mode).
Returns
Nonzero if the viewport is in wire-frame rendering mode; otherwise 0.

◆ GetDammageRect()

virtual Rect GetDammageRect ( )
pure virtual
Remarks
Returns the damaged rectangle of the viewport. This is the area that needs to be updated on the next screen refresh. This can be used for example, to pass into the Mesh method render() to only display the damaged area of the object. A developer could also use this in the implementation of their own Display() method.
Sample Code:
int SimpleObject::Display(TimeValue t, INode* inode, ViewExp *vpt, int flags)
{
if (!OKtoDisplay(t))
return 0;
GraphicsWindow *gw = vpt->getGW();
Matrix3 mat = inode->GetObjectTM(t);
UpdateMesh(t); // UpdateMesh() just calls BuildMesh()
gw->setTransform(mat);
mesh.render(gw, inode->Mtls(), (flags&USE_DAMAGE_RECT) ? &vpt->GetDammageRect() : NULL,
COMP_ALL, inode->NumMtls());
return(0);
}
virtual 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,...
Definition: object.h:599
Definition: GraphicsWindow.h:73
virtual void setTransform(const Matrix3 &m)=0
Definition: inode.h:55
virtual Material * Mtls()=0
virtual int NumMtls()=0
virtual Matrix3 GetObjectTM(TimeValue time, Interval *valid=NULL)=0
virtual Rect GetDammageRect()=0
virtual GraphicsWindow * getGW()=0
#define USE_DAMAGE_RECT
If this flag is set, only the damaged area needs to be displayed.
Definition: object.h:500
#define COMP_ALL
Combination of COMP_TRANSFORM, COMP_IGN_RECT and COMP_LIGHTING.
Definition: MeshFaceFlagConstants.h:65
int TimeValue
Definition: maxtypes.h:31

◆ MapViewToScreen()

virtual Point2 MapViewToScreen ( const Point3 p)
pure virtual
Remarks
Given a point with view coordinates, this method maps the point into screen(windows) coordinates.
Parameters
pPoint in view coordinates.
Returns
Point in screen coordinates.
Sample Code:
Point2 p0 = vpt->MapScreenToView(affinePos);
Definition: point2.h:38

◆ MapScreenToView()

virtual Point3 MapScreenToView ( const IPoint2 sp,
float  depth 
)
pure virtual
Remarks
Given a point on the screen (in window coordinates), and a depth in view coordinates, this method maps the point into view coordinates. This is just a scaling operation for parallel projections, but involves a divide by Z for perspective projections.
Parameters
spPoint in window coordinates.
depthDepth in view coordinates.
Returns
Point in view coordinates.
Sample Code:
Point3 p0 = vpt->MapScreenToView(mBase,GetPerspMouseSpeed());
CoreExport float GetPerspMouseSpeed()

◆ MapScreenToWorldRay()

virtual void MapScreenToWorldRay ( float  sx,
float  sy,
Ray ray 
)
pure virtual
Remarks
Creates a Ray in world space passing through the specified pixel directed toward the scene in the direction of view.
Parameters
sxThe x screen coordinate.
syThe y screen coordinate.
rayThe Ray in world space. See Class Ray.

◆ SetAffineTM()

virtual BOOL SetAffineTM ( const Matrix3 m)
pure virtual
Remarks
This method sets the viewport affine transformation and returns TRUE if the view is a user view (isometric or perspective). If the view is not a user view then the transformation is not changed and the method returns FALSE. See SetViewUser() below.
Parameters
mThe transformation matrix to set.

◆ GetAffineTM()

virtual void GetAffineTM ( Matrix3 tm)
pure virtual
Remarks
This method retrieves the affineTM which transforms from World coordinates to View coordinates. See the sample code below for an example of its use.
Parameters
tmThe matrix to hold the affine TM.
// This routine returns the view direction from the active viewport.
Point3 Utility::GetViewDirection()
{
Matrix3 aTM, coordSysTM;
ViewExp& ve = ip->GetActiveViewExp();
// The affine TM transforms from world coords to view coords
// so we need the inverse of this matrix
ve.GetAffineTM(aTM);
coordSysTM = Inverse(aTM);
// The Z axis of this matrix is the view direction.
Point3 viewDir = coordSysTM.GetRow(2);
return viewDir;
}
Point3 GetRow(int i) const
virtual void GetAffineTM(Matrix3 &tm)=0
DMatrix3 Inverse(const DMatrix3 &m)
Return the inverse of the matrix.
Note: You can also get the view position from this matrix. For example, in the above code, the statement: Point3 viewPt = coordSysTM.GetRow(3); gets the point in space the view is taken from.

◆ GetViewType()

virtual int GetViewType ( )
pure virtual
Remarks
Returns the type of view. One of the following values:

enum ViewType {

VIEW_LEFT,VIEW_RIGHT,VIEW_TOP,VIEW_BOTTOM,VIEW_FRONT,VIEW_BACK,

VIEW_ISO_USER, VIEW_PERSP_USER, VIEW_CAMERA, VIEW_GRID, VIEW_NONE,

VIEW_TRACK, VIEW_SPOT, VIEW_SHAPE, VIEW_SCHEMATIC, VIEW_OTHER

};

◆ IsPerspView()

virtual BOOL IsPerspView ( )
pure virtual
Remarks
Returns TRUE if the viewport is a perspective view; otherwise returns FALSE.

◆ IsCanvasNavigationMode()

virtual BOOL IsCanvasNavigationMode ( )
pure virtual
Remarks
Returns TRUE if the viewport is 2D canvas navigation mode; otherwise returns FALSE.

◆ GetFOV()

virtual float GetFOV ( )
pure virtual
Remarks
Returns the field of view of a perspective viewport in radians.

◆ GetFocalDist()

virtual float GetFocalDist ( )
pure virtual
Remarks
Returns the focal distance of a perspective view.

◆ SetFocalDist()

virtual void SetFocalDist ( float  fd)
pure virtual
Remarks
Sets the focal distance of a perspective view.
Parameters
fdSpecifies the focal distance to set.

◆ GetFPS()

virtual float GetFPS ( )
pure virtual

Get the FPS from the active viewport.

Returns
Return the frame per second of the active viewport.

◆ GetScreenScaleFactor()

virtual float GetScreenScaleFactor ( const Point3  worldPoint)
pure virtual
Remarks
Returns the screen scale factor for a point given in world coordinates. This factor gives the width in world-space units at the point's distance of the viewport.
Parameters
worldPointThe point in world coordinates.
Returns
The screen scale factor in world space units.

◆ GetVPWorldWidth()

virtual float GetVPWorldWidth ( const Point3  wPoint)
pure virtual
Remarks
Returns the viewport screen width factor in world space at a point in world space.
Parameters
wPointThe point in world space.
Returns
The viewport screen width factor in world space.

◆ MapCPToWorld()

virtual Point3 MapCPToWorld ( const Point3  cpPoint)
pure virtual
Remarks
Given a point on the construction plane this method returns the corresponding world space point. For example, if you use GetPointOnCP() to convert a screen coordinate to a point on the construction plane, you could then call this method to convert that point on the construction plane to a world space point.
Parameters
cpPointThe point on the construction plane.
Returns
The world space point.

◆ NonScalingObjectSize()

virtual float NonScalingObjectSize ( )
pure virtual
Remarks
The value returned from this method may be used as a scale factor that will counteract the viewport zoom. For example, lights, cameras, and tape helper objects use this factor so the size of the node in the scene remains constant when the viewport is zoomed in and out.

This value is affected by the 'Non-Scaling Object Size' spinner in the Viewport Preferences dialog, so the user has some control over this as well.
Sample Code:
This sample is from /MAXSDK/SAMPLES/OBJECTS/TAPEHELP.CPP. The computed matrix is used in several places like displaying, snapping, hit testing, etc.
void TapeHelpObject::GetMat(TimeValue t, INode* inode,
ViewExp* vpt, Matrix3& tm)
{
tm = inode->GetObjectTM(t);
tm.NoScale();
float scaleFactor = vpt->NonScalingObjectSize() *
vpt->GetVPWorldWidth(tm.GetTrans())/(float)360.0;
tm.Scale(Point3(scaleFactor,scaleFactor,scaleFactor));
}
void NoScale()
const Point3 & GetTrans() const
void Scale(const Point3 &s, bool trans=false)
virtual float GetVPWorldWidth(const Point3 wPoint)=0
virtual float NonScalingObjectSize()=0

◆ GetConstructionTM()

virtual void GetConstructionTM ( Matrix3 tm)
pure virtual
Remarks
Retrieves the transformation matrix of the construction plane.
Parameters
tmThe transformation matrix is returned here.

◆ SetGridSize()

virtual void SetGridSize ( float  size)
pure virtual
Remarks
Sets the size of the construction grid spacing.
Parameters
sizeSpecifies the grid spacing.

◆ GetGridSize()

virtual float GetGridSize ( )
pure virtual
Remarks
Returns the construction grid spacing. This is the grid spacing on a per viewport basis. It is dependent on how far zoomed in or out the user is. This is the exact same value that you can see in the right most status panel below the viewports.

◆ IsGridVisible()

virtual BOOL IsGridVisible ( )
pure virtual
Remarks
Returns TRUE if the grid is turned on for this viewport; otherwise FALSE.

◆ SetGridVisibility()

virtual void SetGridVisibility ( BOOL  bVisible)
pure virtual
Remarks
Set the grid visibility for this viewport.

◆ GetGridType()

virtual int GetGridType ( )
pure virtual
Remarks
Returns the grid type. One of the following values (from OBJECT.H):

GRID_PLANE_NONE

GRID_PLANE_TOP

GRID_PLANE_LEFT

GRID_PLANE_FRONT

GRID_PLANE_BOTTOM

GRID_PLANE_RIGHT

GRID_PLANE_BACK

◆ GetViewCamera()

virtual INode * GetViewCamera ( )
pure virtual
Remarks
Returns the INode pointer of the camera associated with this viewport. If this is not a camera view then NULL is returned.

◆ SetViewCamera()

virtual void SetViewCamera ( INode camNode)
pure virtual
Remarks
Set this viewport to a camera view.
Parameters
camNodeThe camera node to set.

◆ SetViewUser()

virtual void SetViewUser ( BOOL  persp)
pure virtual
Remarks
This method sets the viewport to be a user view, with the persp argument indicating whether this should be a perspective or iso view. Note that the user viewport defaults are used for field-of-view, etc.
Parameters
perspTRUE for perspective; FALSE for isometric.

◆ GetViewSpot()

virtual INode * GetViewSpot ( )
pure virtual
Remarks
Returns the INode pointer of the spotlight associated with this viewport. If this is not a spotlight view then NULL is returned.

◆ SetViewSpot()

virtual void SetViewSpot ( INode spotNode)
pure virtual
Remarks
Set this viewport to a spotlight view.
Parameters
spotNodeThe spotlight node to set.

◆ ClearHitList()

virtual void ClearHitList ( )
pure virtual
Remarks
Implemented by the System.

Clears the list of node level hit records.

◆ GetClosestHit()

virtual INode * GetClosestHit ( )
pure virtual
Remarks
Implemented by the System.

Returns the INode pointer of the node that was the closest of all those hit. If none were hit, NULL is returned.

◆ GetHit()

virtual INode * GetHit ( int  i)
pure virtual
Remarks
Returns the INode pointer of the 'i-th' node level hit.
Parameters
iThe index of the hit to retrieve.

◆ HitCount()

virtual int HitCount ( )
pure virtual
Remarks
Implemented by the System.

Returns the number of hits recorded by the last node level hit test.

◆ LogHit()

virtual void LogHit ( INode nr,
ModContext mc,
DWORD  dist,
ulong  info,
HitData hitdata = NULL 
)
pure virtual

This method records a sub-object level hit record with the system using the specified parameters.

This hit can later be retrieved using the method GetSubObjHitList() and the methods of class HitLog.

Parameters
nrThe node that was hit.
mcThe ModContext of the modifier.
distThe 'distance' of the hit. What the distance actually represents depends on the rendering level of the viewport. For wireframe modes, it refers to the distance in the screen XY plane from the mouse to the sub-object component. In a shaded mode, it refers to the Z depth of the sub-object component. In both cases, smaller values indicate that the sub-object component is 'closer' to the mouse cursor.
infoIdentifies the sub-object component that was hit.
hitdataIf the info data member is insufficient to indicate the sub-object component that was hit, pass an instance of the HitData class that contains the needed information. The system will be responsible for freeing the memory for the HitData.

◆ GetSubObjHitList()

virtual HitLog & GetSubObjHitList ( )
pure virtual
Remarks
Returns the sub-object hit list. See Class HitLog.

◆ ClearSubObjHitList()

virtual void ClearSubObjHitList ( )
pure virtual
Remarks
Clears the sub-object hit list. This deletes all previously saved HitRecords.

◆ NumSubObjHits()

virtual int NumSubObjHits ( )
pure virtual
Remarks
Returns the number of sub-object hits recorded.

◆ CtrlLogHit()

virtual void CtrlLogHit ( INode nr,
DWORD  dist,
ulong  info,
DWORD  infoExtra 
)
pure virtual
Remarks
This method records a controller sub-object level hit record with the system using the specified parameters. This hit can later be retrieved using the method GetCtrlHitList() and the methods of class CtrlHitLog.
Parameters
nrThe node that was hit.
distThe 'distance' of the hit. What the distance actually represents depends on the rendering level of the viewport. For wireframe modes, it refers to the distance in the screen XY plane from the mouse to the sub-object component. In a shaded mode, it refers to the Z depth of the sub-object component. In both cases, smaller values indicate that the sub-object component is 'closer' to the mouse cursor.
infoA general unsigned long value. Most controllers will just need this to identity the sub-object element. The meaning of this value (how it is used to identify the element) is up to the plug-in.
infoExtraIf the above hitInfo data member is not sufficient to describe the sub-object element this data member may be used as well.

◆ GetCtrlHitList()

virtual CtrlHitLog & GetCtrlHitList ( )
pure virtual
Remarks
Returns the list of controller gizmo hits recorded. See Class CtrlHitLog.

◆ ClearCtrlHitList()

virtual void ClearCtrlHitList ( )
pure virtual
Remarks
Clears the controller hit list. This deletes all the HitRecords previously recorded.

◆ setBkgImageDsp()

virtual BOOL setBkgImageDsp ( BOOL  onOff)
pure virtual
Remarks
This method is used to turn on and off the background image display in this viewport. Note that it is necessary to redraw the viewports in order to see the effect of this method. Use the method Interface::RedrawViews() to do this.
Parameters
onOffTRUE to turn the background image on; FALSE to turn it off.
Returns
TRUE if the image was set; otherwise FALSE.

◆ getBkgImageDsp()

virtual int getBkgImageDsp ( void  )
pure virtual
Remarks
Returns nonzero if the background image is displayed in this viewport; otherwise 0.

◆ setSFDisplay()

virtual void setSFDisplay ( int  onOff)
pure virtual
Remarks
This method may be used to turn the safe frame display on and off in this viewport.
Parameters
onOffNonzero to turn on the safe frame; zero to turn it off.

◆ getSFDisplay()

virtual int getSFDisplay ( void  )
pure virtual
Remarks
Returns nonzero if the safe frame is displayed in this viewport; otherwise 0.

◆ GetHWnd()

virtual HWND GetHWnd ( )
pure virtual
Remarks
This returns the window handle of the viewport - this is the transparent window that catches mouse input. Note that this window handle is different than the handle that can be retrieved from the viewport's GraphicsWindow. getGW()->getHWnd() is the window that things are drawn on.
Returns
The window handle of the viewport.

◆ IsActive()

virtual BOOL IsActive ( )
pure virtual
Remarks
Returns TRUE if the viewport is the active on; otherwise FALSE.

◆ IsEnabled()

virtual BOOL IsEnabled ( )
pure virtual
Remarks
Returns TRUE if the viewport is enabled; FALSE if disabled.

◆ SetSolidBackgroundColorMode()

virtual void SetSolidBackgroundColorMode ( bool  bSolidColor)
pure virtual

Set the viewport background color mode as solid color mode or gradient color mode.

Parameters
[in]bSolidColorif true, solid color mode will be set. Otherwise set gradient color mode will be set.

◆ IsSolidBackgroundColorMode()

virtual bool IsSolidBackgroundColorMode ( )
pure virtual

Get the current viewport background color mode.

Returns
Return true if in solid color mode. Return false if in gradient color mode.

◆ ResetBackgroundColorMode()

virtual void ResetBackgroundColorMode ( )
pure virtual

Reset viewport background color mode.

◆ TrackImplicitGrid()

virtual void TrackImplicitGrid ( IPoint2  m,
Matrix3 mat = NULL,
ULONG  hitTestFlags = 0 
)
pure virtual
Remarks
If AutoGrid is enabled, this method determines a grid coordinate system by casting a ray into the scene through the screen coordinate m, obtaining a surface normal from the closest node , and using the "arbitrary axis algorithm" to orient the xy axes. You can get this coordinate system back by passing in a pointer to a matrix. A tripod is displayed in the viewports showing the orientation.
Parameters
mThe 2D screen point that the user clicked on.
matThe implicit grid coordinate system matrix can be retrieved by passing a pointer to a matrix here.
hitTestFlagsSee Scene and Node Hit Testing Flags.

◆ CommitImplicitGrid()

virtual void CommitImplicitGrid ( IPoint2  m,
int  mouseflags,
Matrix3 mat = NULL 
)
pure virtual
Remarks
If AutoGrid is enabled, this method creates a grid and activates it. The mouseflags parameter is used to determine if the ALT key is down. If it is, this grid will not be deactivated in ReleaseImplicitGrid()(below).
Parameters
mThe 2D screen point that the user clicked on.
mouseflagsThese flags describe the state of the mouse buttons. See Mouse Call Back Flags.
matDevelopers can get the implicit grid coordinate system back by passing in a pointer to a matrix here.

◆ ReleaseImplicitGrid()

virtual void ReleaseImplicitGrid ( )
pure virtual
Remarks
This method deactivates an implicit grid and restores the previously active grid. If the implicit grid was committed with ALT-key held down, then this call does nothing.

◆ InvalidateRect()

virtual void InvalidateRect ( const Rect rect)
pure virtual
Remarks
This is a better way method to invalidate a viewport only if the area define by the Rect argument is not the whole size of the viewport. Calling InvalidateRect on a Rect defined like this: rect.top = 0; rect.bottom = gw->getWinSizeY(); rect.left = 0; rect.right = gw->getWinSizeX(); Will have the same effect of invalidating the viewport.
Parameters
rectThe Rect that define the region on the viewport to be invalidated.

◆ Execute()

virtual INT_PTR Execute ( int  cmd,
ULONG_PTR  arg1 = 0,
ULONG_PTR  arg2 = 0,
ULONG_PTR  arg3 = 0 
)
inlinevirtual
Remarks
This is a general purpose function that allows the API to be extended in the future. The 3ds Max development team can assign new cmd numbers and continue to add functionality to this class without having to 'break' the API.
Parameters
cmdThe index of the command to execute.
arg1Optional argument 1. See the documentation where the cmd option is discussed for more details on these parameters.
arg2Optional argument 2.
arg3Optional argument 3.
Returns
An integer return value. See the documentation where the cmd option is discussed for more details on the meaning of this value.
1380 {
1381 UNUSED_PARAM(cmd);
1382 UNUSED_PARAM(arg1);
1383 UNUSED_PARAM(arg2);
1384 UNUSED_PARAM(arg3);
1385 return 0;
1386 }
#define UNUSED_PARAM(x)
Definition: BuildWarnings.h:18