📄 maxapi.h
字号:
/*********************************************************************
*<
FILE: maxapi.h
DESCRIPTION: These are functions that are exported from the
3DS MAX executable.
CREATED BY: Rolf Berteig
HISTORY: Created 28 November 1994
*> Copyright (c) 1994, All Rights Reserved.
**********************************************************************/
#ifndef __JAGAPI__
#define __JAGAPI__
#include <ole2.h>
#include "cmdmode.h"
#include "sceneapi.h"
#include "rtclick.h"
#include "evuser.h"
#include "maxcom.h"
#include "plugin.h"
#include "log.h"
class ViewParams;
class ModContext;
class HitData;
class HitLog;
class CtrlHitLog;
class MtlBase;
class Mtl;
class Texmap;
class PickNodeCallback;
class Renderer;
class RendParams;
class RendProgressCallback;
class Bitmap;
class BitmapInfo;
class Texmap;
class SoundObj;
class GenCamera;
class GenLight;
class NameTab;
class ShadowType;
class MacroRecorder;
class CommandLineCallback;
// From KbdShortcut.h
class ShortcutTable;
class ShortcutCallback;
typedef long ShortcutTableId;
#ifdef _OSNAP
class IOsnapManager;
class MouseManager;
#endif
class MtlBaseLib;
class Atmospheric;
class IRollupWindow;
class ITrackViewNode;
class DllDir;
class Effect;
class SpaceArrayCallback;
// RB: I didn't want to include render.h here
#ifndef _REND_TYPE_DEFINED
#define _REND_TYPE_DEFINED
enum RendType {
RENDTYPE_NORMAL,
RENDTYPE_REGION,
RENDTYPE_BLOWUP,
RENDTYPE_SELECT,
RENDTYPE_REGIONCROP
};
#endif
// values for dupAction, passed into MergeFromFile
#define MERGE_DUPS_PROMPT 0 // prompt user when duplicates encountered
#define MERGE_DUPS_MERGE 1 // merge new, keep old when duplicates encountered
#define MERGE_DUPS_SKIP 2 // skip duplicates
#define MERGE_DUPS_DELOLD 3 // delete old when duplicates encountered
#define MERGE_LIST_NAMES 4 // Causes a list of objects in the file to be
// placed into mrgList. No actual merging will be done. mergeAll must be TRUE.
// CCJ: Property Set definitions
// For internal reasons these must be bitflags
#define PROPSET_SUMMARYINFO 0x01
#define PROPSET_DOCSUMMARYINFO 0x02
#define PROPSET_USERDEFINED 0x04
// Interface::Execute cmd values
#define I_EXEC_ACTIVATE_TEXTURE 1 // arg1: Texmap *tx; arg2: Mtl *mtl; arg3: int subnum;
#define I_EXEC_DEACTIVATE_TEXTURE 2 // arg1: Texmap *tx; arg2: Mtl *mtl; arg3: int subnum;
#ifdef DESIGN_VER
#define I_EXEC_OFFSET_SPLINE 80 // arg1: INode *spline; arg2: float amount;
#define I_EXEC_OFFSET_MEASURE 81 // arg1: INode *spline; arg2: Point3 *point; arg3: float *result;
#define I_EXEC_TRIM_EXTEND 82 // arg1: INodeTab *all; arg2: INodeTab *act;
#define I_EXEC_NEW_OBJ_XREF_DLG 83 // arg1: INodeTab *nodes; arg2: BOOL forceSingle;
#define I_EXEC_SET_DISABLED_COLOR 84 // arg1: COLORREF
#endif
#define I_EXEC_COUNT_MTL_SCENEREFS 0x2001 // arg1 Mtl *mt: returns number of refs from scene
// Interface::Execute return values
#ifdef DESIGN_VER
#define I_EXEC_RET_NULL_NODE 1
#define I_EXEC_RET_NULL_OBJECT 2
#define I_EXEC_RET_NOT_SPLINE 3
#endif
#define I_EXEC_RET_OFFSET_FAIL 4
// Extension ID's for the Interface class: GetInterface()
#ifdef DESIGN_VER //_COMMANDLINE
#define I_COMMANDLINE 0x2001
#define GetCommandLineInterface(i) i->GetInterface(I_COMMANDLINE)
#endif // DESIGN_VER //_COMMANDLINE
class NameMaker {
public:
virtual void MakeUniqueName(TSTR &name)=0;
virtual void AddName(TSTR &name) = 0;
virtual BOOL NameExists(TSTR& name) = 0;
virtual ~NameMaker() {}
};
//JH 05/06/98
// VIEW_OTHER must be last, since "other" types are then numbered consecutively!!!
// And the order can't be changed, or old MAX files won't load properly DB 11/98
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};
// class for registering a window that can appear in a MAX viewport DB 10/6/98
class ViewWindow {
public:
virtual TCHAR *GetName()=0;
virtual HWND CreateViewWindow(HWND hParent, int x, int y, int w, int h)=0;
virtual void DestroyViewWindow(HWND hWnd)=0;
// CanCreate can be overridden to return FALSE if a ViewWindow can only have
// a single instance, and that instance is already present. If CanCreate
// returns FALSE, then the menu item for this ViewWindow will be grayed out.
virtual BOOL CanCreate() { return TRUE; }
};
// class for accessing the TrackBar (the Mini TrackView)
#define TRACKBAR_FILTER_ALL 1
#define TRACKBAR_FILTER_TMONLY 2
#define TRACKBAR_FILTER_CURRENTTM 3
#define TRACKBAR_FILTER_OBJECT 4
#define TRACKBAR_FILTER_MATERIAL 5
class ITrackBar {
public:
virtual void SetVisible(BOOL bVisible) = 0;
virtual BOOL IsVisible() = 0;
virtual void SetFilter(UINT nFilter) = 0;
virtual UINT GetFilter() = 0;
virtual TimeValue GetNextKey(TimeValue tStart, BOOL bForward) = 0;
};
// This class provides functions that expose the portions of View3D
// that are exported for use by plug-ins.
class ViewExp {
public:
virtual Point3 GetPointOnCP(const IPoint2 &ps)=0;
virtual Point3 SnapPoint(const IPoint2 &in, IPoint2 &out, Matrix3 *plane2d = NULL, DWORD flags = 0)=0;
#ifdef _OSNAP
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;
#endif
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;
// set the affine tm for the view and ret TRUE if the view is ISO_USER or PERSP_USER
// else do nothing and return FALSE
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 float GetScreenScaleFactor(const Point3 worldPoint)=0;
// return the viewPort screen width factor in world space at
// a point in world space
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;
// Get the camera if there is one.
virtual INode *GetViewCamera()=0;
// Set this viewport to a camera view
virtual void SetViewCamera(INode *camNode)=0;
// Set this viewport to a user view
virtual void SetViewUser(BOOL persp)=0;
// Get the spot if there is one
virtual INode *GetViewSpot()=0;
// Set this viewport to a spotlight view
virtual void SetViewSpot(INode *spotNode)=0;
// node level hit-testing
virtual void ClearHitList()=0;
virtual INode *GetClosestHit()=0;
virtual INode *GetHit(int i)=0;
virtual int HitCount()=0;
// subobject level hit-testing
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;
// For controller apparatus hit testing
virtual void CtrlLogHit(INode *nr,DWORD dist,ulong info,DWORD infoExtra)=0;
virtual CtrlHitLog& GetCtrlHitList()=0;
virtual void ClearCtrlHitList()=0;
virtual float NonScalingObjectSize()=0; // 1.0 is "default"
// Turn on and off image background display
virtual BOOL setBkgImageDsp(BOOL onOff)=0;
virtual int getBkgImageDsp(void)=0;
// Turn on and off safe frame display
virtual void setSFDisplay(int onOff)=0;
virtual int getSFDisplay(void)=0;
// This is the window handle of the viewport. This is the
// same window handle past to GetViewport() to get a ViewExp*
virtual HWND GetHWnd()=0;
// Test if the viewport is active
virtual BOOL IsActive() = 0;
// Test if the viewport is enabled
virtual BOOL IsEnabled() = 0;
//methods for floating grids
virtual void TrackImplicitGrid(IPoint2 m, Matrix3* mat = NULL) = 0;
virtual void CommitImplicitGrid(IPoint2 m, int mouseflags, Matrix3* mat = NULL) = 0;
virtual void ReleaseImplicitGrid() = 0;
// Generic expansion function
virtual int Execute(int cmd, ULONG arg1=0, ULONG arg2=0, ULONG arg3=0) { return 0; }
};
// return values for CreateMouseCallBack
#define CREATE_CONTINUE 1
#define CREATE_STOP 0 // creation terminated normally
#define CREATE_ABORT -1 // delete the created object and node
// This is a specific call-back proc for handling the creation process
// of a plug-in object.
// The vpt passed in will have had setTransform called with the
// transform of the current construction plane.
class CreateMouseCallBack {
public:
virtual int proc(
ViewExp *vpt,
int msg,
int point,
int flags,
IPoint2 m,
Matrix3& mat
)=0;
virtual int override(int mode) { return mode; } // Defaults to mode supplied
// Tells the system that we aren't starting a new creation
virtual BOOL StartNewCreation() { return TRUE; }
//Tells the system if ortho mode makes sense for this creation
//In general this won't be true but splines and such...
virtual BOOL TolerateOrthoMode() { return FALSE; }
};
class Object;
class ConstObject;
class MouseCallBack;
class IObjCreate;
class IObjParam;
class ModContext;
class ModContextList;
class INodeTab;
// Passed to getBkgFrameRange()
#define VIEWPORT_BKG_START 0
#define VIEWPORT_BKG_END 1
// Passed to setBkgORType().
#define VIEWPORT_BKG_BLANK 0
#define VIEWPORT_BKG_HOLD 1
#define VIEWPORT_BKG_LOOP 2
// Passed to setBkgImageAspect()
#define VIEWPORT_BKG_ASPECT_VIEW 0
#define VIEWPORT_BKG_ASPECT_BITMAP 1
#define VIEWPORT_BKG_ASPECT_OUTPUT 2
// Identify the transform tool buttons
#define MOVE_BUTTON 1
#define ROTATE_BUTTON 2
#define NUSCALE_BUTTON 3
#define USCALE_BUTTON 4
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -