This reference page is linked to from the following overview topics: General Best Practices, How Objects are Drawn in the Viewport, Cameras, Hit Lists, Node Level Hit Testing, Getting and Setting User Preferences, Snapping.
#include <maxapi.h>
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 Point3 | GetPointOnCP (const IPoint2 &ps)=0 |
virtual Point3 | SnapPoint (const IPoint2 &in, IPoint2 &out, Matrix3 *plane2d=NULL, DWORD flags=0)=0 |
virtual float | SnapLength (float in)=0 |
virtual float | GetCPDisp (const Point3 base, const Point3 &dir, const IPoint2 &sp1, const IPoint2 &sp2, BOOL snap=FALSE)=0 |
virtual GraphicsWindow * | getGW ()=0 |
virtual int | IsWire ()=0 |
virtual Rect | GetDammageRect ()=0 |
virtual Point3 | MapScreenToView (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 int | GetViewType ()=0 |
virtual BOOL | IsPerspView ()=0 |
virtual float | GetFOV ()=0 |
virtual float | GetFocalDist ()=0 |
virtual void | SetFocalDist (float fd)=0 |
virtual float | GetScreenScaleFactor (const Point3 worldPoint)=0 |
virtual float | GetFPS ()=0 |
Get the FPS from the active viewport.
|
|
virtual float | GetVPWorldWidth (const Point3 wPoint)=0 |
virtual Point3 | MapCPToWorld (const Point3 cpPoint)=0 |
virtual void | GetConstructionTM (Matrix3 &tm)=0 |
virtual void | SetGridSize (float size)=0 |
virtual float | GetGridSize ()=0 |
virtual BOOL | IsGridVisible ()=0 |
virtual int | GetGridType ()=0 |
virtual INode * | GetViewCamera ()=0 |
virtual void | SetViewCamera (INode *camNode)=0 |
virtual void | SetViewUser (BOOL persp)=0 |
virtual INode * | GetViewSpot ()=0 |
virtual void | SetViewSpot (INode *spotNode)=0 |
virtual void | ClearHitList ()=0 |
virtual INode * | GetClosestHit ()=0 |
virtual INode * | GetHit (int i)=0 |
virtual int | HitCount ()=0 |
virtual void | LogHit (INode *nr, ModContext *mc, DWORD dist, ulong info, HitData *hitdat=NULL)=0 |
virtual HitLog & | GetSubObjHitList ()=0 |
virtual void | ClearSubObjHitList ()=0 |
virtual int | NumSubObjHits ()=0 |
virtual void | CtrlLogHit (INode *nr, DWORD dist, ulong info, DWORD infoExtra)=0 |
virtual CtrlHitLog & | GetCtrlHitList ()=0 |
virtual void | ClearCtrlHitList ()=0 |
virtual float | NonScalingObjectSize ()=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 |
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 |
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) |
anonymous enum |
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. |
{ kEXECUTE_GET_VIEWEXP_10 = 0, kEXECUTE_GET_VIEWPORT_ID = 1, kEXECUTE_GET_VIEWEXP_11 = 2, kEXECUTE_GET_VIEWEXP_13 = 3, };
ps | The 2D screen point to convert to a 3D world space coordinate. |
virtual Point3 SnapPoint | ( | const IPoint2 & | in, |
IPoint2 & | out, | ||
Matrix3 * | plane2d = NULL , |
||
DWORD | flags = 0 |
||
) | [pure virtual] |
in | The 2D screen coordinate to snap. |
out | The snapped 2D screen coordinate. This is used if you need to move the mouse position to the snapped location. |
plane2d | This optional argument allows you to use any plane (not just the current construction plane). |
flags | See List of Snap Flags. |
virtual float SnapLength | ( | float | in | ) | [pure virtual] |
in | The input distance to be snapped. |
virtual float GetCPDisp | ( | const Point3 | base, |
const Point3 & | dir, | ||
const IPoint2 & | sp1, | ||
const IPoint2 & | sp2, | ||
BOOL | snap = FALSE |
||
) | [pure virtual] |
base | Base point in object space. |
dir | Direction vector in object space. |
sp1 | Screen start point. This is the point where the user clicked down with the mouse. |
sp2 | Screen end point. This is the point where the user let up the mouse. |
snap |
float h = vpt->SnapLength(vpt->GetCPDisp(p[1],Point3(0,0,1),sp1,m));
virtual GraphicsWindow* getGW | ( | ) | [pure virtual] |
virtual int IsWire | ( | ) | [pure virtual] |
virtual Rect GetDammageRect | ( | ) | [pure virtual] |
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); }
sp | Point in window coordinates. |
depth | Depth in view coordinates. |
Point3 p0 = vpt->MapScreenToView(mBase,GetPerspMouseSpeed());
virtual void MapScreenToWorldRay | ( | float | sx, |
float | sy, | ||
Ray & | ray | ||
) | [pure virtual] |
virtual BOOL SetAffineTM | ( | const Matrix3 & | m | ) | [pure virtual] |
m | The transformation matrix to set. |
virtual void GetAffineTM | ( | Matrix3 & | tm | ) | [pure virtual] |
tm | The 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->GetActiveViewport(); // 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); ip->ReleaseViewport(ve); return viewDir; } 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. |
virtual int GetViewType | ( | ) | [pure virtual] |
virtual BOOL IsPerspView | ( | ) | [pure virtual] |
virtual float GetFOV | ( | ) | [pure virtual] |
virtual float GetFocalDist | ( | ) | [pure virtual] |
virtual void SetFocalDist | ( | float | fd | ) | [pure virtual] |
fd | Specifies the focal distance to set. |
virtual float GetScreenScaleFactor | ( | const Point3 | worldPoint | ) | [pure virtual] |
worldPoint | The point in world coordinates. |
virtual float GetFPS | ( | ) | [pure virtual] |
Get the FPS from the active viewport.
virtual float GetVPWorldWidth | ( | const Point3 | wPoint | ) | [pure virtual] |
wPoint | The point in world space. |
cpPoint | The point on the construction plane. |
virtual void GetConstructionTM | ( | Matrix3 & | tm | ) | [pure virtual] |
tm | The transformation matrix is returned here. |
virtual void SetGridSize | ( | float | size | ) | [pure virtual] |
size | Specifies the grid spacing. |
virtual float GetGridSize | ( | ) | [pure virtual] |
virtual BOOL IsGridVisible | ( | ) | [pure virtual] |
virtual int GetGridType | ( | ) | [pure virtual] |
virtual INode* GetViewCamera | ( | ) | [pure virtual] |
virtual void SetViewCamera | ( | INode * | camNode | ) | [pure virtual] |
camNode | The camera node to set. |
virtual void SetViewUser | ( | BOOL | persp | ) | [pure virtual] |
persp | TRUE for perspective; FALSE for isometric. |
virtual INode* GetViewSpot | ( | ) | [pure virtual] |
virtual void SetViewSpot | ( | INode * | spotNode | ) | [pure virtual] |
spotNode | The spotlight node to set. |
virtual void ClearHitList | ( | ) | [pure virtual] |
virtual INode* GetClosestHit | ( | ) | [pure virtual] |
virtual INode* GetHit | ( | int | i | ) | [pure virtual] |
i | The index of the hit to retrieve. |
virtual int HitCount | ( | ) | [pure virtual] |
virtual void LogHit | ( | INode * | nr, |
ModContext * | mc, | ||
DWORD | dist, | ||
ulong | info, | ||
HitData * | hitdat =
NULL |
||
) | [pure virtual] |
nr | The node that was hit. |
mc | The ModContext of the modifier. |
dist | The '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. |
info | Identifies the sub-object component that was hit. |
hitdat | If 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. |
virtual HitLog& GetSubObjHitList | ( | ) | [pure virtual] |
virtual void ClearSubObjHitList | ( | ) | [pure virtual] |
virtual int NumSubObjHits | ( | ) | [pure virtual] |
virtual void CtrlLogHit | ( | INode * | nr, |
DWORD | dist, | ||
ulong | info, | ||
DWORD | infoExtra | ||
) | [pure virtual] |
nr | The node that was hit. |
dist | The '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. |
info | A 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. |
infoExtra | If the above hitInfo data member is not sufficient to describe the sub-object element this data member may be used as well. |
virtual CtrlHitLog& GetCtrlHitList | ( | ) | [pure virtual] |
virtual void ClearCtrlHitList | ( | ) | [pure virtual] |
virtual float NonScalingObjectSize | ( | ) | [pure virtual] |
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)); }
virtual BOOL setBkgImageDsp | ( | BOOL | onOff | ) | [pure virtual] |
onOff | TRUE to turn the background image on; FALSE to turn it off. |
virtual int getBkgImageDsp | ( | void | ) | [pure virtual] |
virtual void setSFDisplay | ( | int | onOff | ) | [pure virtual] |
onOff | Nonzero to turn on the safe frame; zero to turn it off. |
virtual int getSFDisplay | ( | void | ) | [pure virtual] |
virtual HWND GetHWnd | ( | ) | [pure virtual] |
virtual BOOL IsActive | ( | ) | [pure virtual] |
virtual BOOL IsEnabled | ( | ) | [pure virtual] |
virtual void TrackImplicitGrid | ( | IPoint2 | m, |
Matrix3 * | mat = NULL , |
||
ULONG | hitTestFlags =
0 |
||
) | [pure virtual] |
m | The 2D screen point that the user clicked on. |
mat | The implicit grid coordinate system matrix can be retrieved by passing a pointer to a matrix here. |
hitTestFlags | See Scene and Node Hit Testing Flags. |
m | The 2D screen point that the user clicked on. |
mouse | flags These flags describe the state of the mouse buttons. See List of Mouse Callback Flags. |
mat | Developers can get the implicit grid coordinate system back by passing in a pointer to a matrix here. |
virtual void ReleaseImplicitGrid | ( | ) | [pure virtual] |
virtual void InvalidateRect | ( | const Rect & | rect | ) | [pure virtual] |
rect | The Rect that define the region on the viewport to be invalidated. |
virtual INT_PTR Execute | ( | int | cmd, |
ULONG_PTR | arg1 = 0 , |
||
ULONG_PTR | arg2 = 0 , |
||
ULONG_PTR | arg3 = 0 |
||
) | [inline, virtual] |
cmd | The index of the command to execute. |
arg1 | Optional argument 1. See the documentation where the cmd option is discussed for more details on these parameters. |
arg2 | Optional argument 2. |
arg3 | Optional argument 3. |
{
UNUSED_PARAM(cmd);
UNUSED_PARAM(arg1);
UNUSED_PARAM(arg2);
UNUSED_PARAM(arg3);
return 0;
}