Initial full mirror of c:\VWE (source + assets + toolchain + outputs) via Git LFS

Complete disaster-recovery snapshot: engine/game source, game data assets,
VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive.
Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false,
no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
This commit is contained in:
Cyd
2026-06-24 21:28:16 -05:00
commit 2b8ca921cb
66341 changed files with 7923174 additions and 0 deletions
@@ -0,0 +1,386 @@
/**********************************************************************
*<
FILE: ActionTable.h
DESCRIPTION: Action Table definitions
CREATED BY: Scott Morrison
HISTORY: Created 8 February, 2000,
Based on KbdAction.h.
*> Copyright (c) 1998, All Rights Reserved.
**********************************************************************/
// The ActionTable class is used by plug-ins (and core) to export
// tables of items that can be used by the UI to attach to keyboard
// shorcuts, assign to toolbar buttons, and add to menus.
#pragma once
#include "stack.h"
#include "iFnPub.h"
class MaxIcon;
class MacroEntry;
typedef DWORD ActionTableId;
typedef DWORD ActionContextId;
// ActionTableIds used by the system
const ActionTableId kActionMainUI = 0;
const ActionTableId kActionTrackView = 1;
const ActionTableId kActionMaterialEditor = 2;
const ActionTableId kActionVideoPost = 3;
const ActionTableId kActionSchematicView = 5;
const ActionTableId kActionCommonIReshade = 6;
const ActionTableId kActionScanlineIReshade = 7;
class ActionTable;
class IMenu;
// Context IDs used by the system. Several tables may share the same context id.
const ActionContextId kActionMainUIContext = 0;
const ActionContextId kActionTrackViewContext = 1;
const ActionContextId kActionMaterialEditorContext = 2;
const ActionContextId kActionVideoPostContext = 3;
const ActionContextId kActionSchematicViewContext = 5;
const ActionContextId kActionIReshadeContext = 6;
// Description of a command for building action tables from static data
struct ActionDescription {
// A unique identifier for the command (must be uniqe per table)
int mCmdID;
// A string resource id that describes the command
int mDescriptionResourceID;
// A string resource ID for a short name for the action
int mShortNameResourceID;
// A string resource for the category of an operation
int mCategoryResourceID;
};
// Describes an single operation that can be attached to a UI elements
class ActionItem : public InterfaceServer {
public:
virtual int GetId() = 0;
// return true if action executed, and FALSE otherwise
virtual BOOL ExecuteAction() = 0;
// override this if you wish to customize macroRecorder output for this action
CoreExport virtual void EmitMacro();
// internal Execute(), handles macroRecording, etc. and call ExecuteAction() - jbw 9.9.00
CoreExport BOOL Execute();
// Get the text to put on a button
virtual void GetButtonText(TSTR& buttonText) = 0;
// Get the text to use in a menu
virtual void GetMenuText(TSTR& menuText) = 0;
// Get the long description text for tool tips etc.
virtual void GetDescriptionText(TSTR& descText) = 0;
// Get the string describing the category of the item
virtual void GetCategoryText(TSTR& catText) = 0;
// check to see if menu items should be checked, or button pressed
virtual BOOL IsChecked() = 0;
// Check to see if menu item should show up in context menu
virtual BOOL IsItemVisible() = 0;
// Check to see if menu item should be enabled in a menu
virtual BOOL IsEnabled() = 0;
virtual MaxIcon* GetIcon() = 0;
virtual void DeleteThis() = 0;
CoreExport ActionTable* GetTable() { return mpTable; }
CoreExport void SetTable(ActionTable* pTable) { mpTable = pTable; }
CoreExport TCHAR* GetShortcutString();
virtual MacroEntry* GetMacroScript() { return NULL; }
// If this method returns true, then the ActionItem creates
// a menu instead of performing an action
CoreExport virtual BOOL IsDynamicMenu() { return FALSE; }
// This can be called after an action item is created to tell the
// system that is is a dynamic menu action.
CoreExport virtual void SetIsDynamicMenu() {}
// If the ActionItem does produce a menu, this method is called To
// get the menu. See the DynamicMenu class below for an easy way
// to produce these menus. If the menu is requested by a
// right-click quad menu, then hwnd is the window where the click
// occurred, and m is the point in the window where the user
// clicked. If the item is used from a menu bar, hwnd will be NULL.
CoreExport virtual IMenu* GetDynamicMenu(HWND hwnd, IPoint2& m) { return NULL; }
// ActionItems that are deleted after they execute should return TRUE.
CoreExport virtual BOOL IsDynamicAction() { return FALSE; }
protected:
ActionTable* mpTable; // The table that owns the action
};
class ActionCallback;
// A table of actions that can be tied to UI elements (buttons, menus, RC menu,
// keyboard shortcuts)
class ActionTable : public BaseInterfaceServer {
public:
CoreExport ActionTable(ActionTableId id,
ActionContextId contextId,
TSTR& name,
HACCEL hDefaults,
int numIds,
ActionDescription* pOps,
HINSTANCE hInst);
CoreExport ActionTable(ActionTableId id,
ActionContextId contextId,
TSTR& name);
CoreExport ~ActionTable();
// Get/Set the current keyboard accelerators for the table
CoreExport HACCEL GetHAccel() { return mhAccel; }
CoreExport void SetHAccel(HACCEL hAccel) { mhAccel = hAccel; }
// Get the default keyboard accelerator table. This is used when
// the user has not assigned any accelerators.
CoreExport HACCEL GetDefaultHAccel() { return mhDefaultAccel; }
CoreExport void SetDefaultHAccel(HACCEL accel) { mhDefaultAccel = accel; }
CoreExport TSTR& GetName() { return mName; }
CoreExport ActionTableId GetId() { return mId; }
CoreExport ActionContextId GetContextId() { return mContextId; }
// Get the current callback assocuated with this table.
// returns NULL if the table is not active.
CoreExport ActionCallback* GetCallback() { return mpCallback; }
CoreExport void SetCallback(ActionCallback* pCallback) { mpCallback = pCallback; }
// Methods to iterate over the actions in the table
CoreExport int Count() { return mOps.Count(); }
CoreExport ActionItem* operator[](int i) { return mOps[i]; }
// Get an action by its command id.
CoreExport ActionItem* GetAction(int cmdId);
// Add an operation to the table
CoreExport void AppendOperation(ActionItem* pAction);
// Remove an operation from the table
CoreExport BOOL DeleteOperation(ActionItem* pAction);
CoreExport void DeleteThis() { delete this; }
// Get the text to put on a button
CoreExport virtual BOOL GetButtonText(int cmdId, TSTR& buttonText);
// Get the text to use in a menu
CoreExport virtual BOOL GetMenuText(int cmdId, TSTR& menuText)
{ return GetButtonText(cmdId, menuText); }
// Get the long description text for tool tips etc.
CoreExport virtual BOOL GetDescriptionText(int cmdId, TSTR& descText);
// check to see if menu items should be checked, or button pressed
CoreExport virtual BOOL IsChecked(int cmdId) { return FALSE; }
// Check to see if menu item should show up in context menu
CoreExport virtual BOOL IsItemVisible(int cmdId) { return TRUE; }
// Check to see if menu item should be enabled in a menu
CoreExport virtual BOOL IsEnabled(int cmdId) { return TRUE; }
// Write an action identifier to a CUI file or KBD file
// Default implementation is to write the integer ID.
// This is over-riden when command IDs are not persistent
CoreExport virtual void WritePersistentActionId(int cmdId, TSTR& idString);
// Read an action identifier from a CUI file or KBD file
// Default implementation is to read the integer ID.
// This is over-riden when command IDs are not persistent
// Returns -1 if the command is not found in the table
CoreExport virtual int ReadPersistentActionId(TSTR& idString);
// return an optional icon for the command
CoreExport virtual MaxIcon* GetIcon(int cmdId) { return NULL; };
// Fill the action table with the given action descriptions
CoreExport void BuildActionTable(HACCEL hDefaults,
int numIds,
ActionDescription* pOps,
HINSTANCE hInst);
// Get the action assigned to the given accelerator, if any
CoreExport ActionItem* GetCurrentAssignment(ACCEL accel);
// Assign the command to th given accelerator. Also removes any
// previous assignment to that accelerator
CoreExport void AssignKey(int cmdId, ACCEL accel);
// removes the given assignment from the shortcut table
void RemoveShortcutFromTable(ACCEL accel);
private:
// These values are set by the plug-in to describe a action table
// Unique identifier of table (like a class id)
ActionTableId mId;
// An identifier to group tables use the same context. Tables with the
// same context cannot have overlapping keyboard shortcuts.
ActionContextId mContextId;
// Name to use in preference dlg drop-down
TSTR mName;
// Descriptors of all operations that can have Actions
Tab<ActionItem*> mOps;
// The windows accelerator table in use when no keyboard shortcuts saved
HACCEL mhDefaultAccel;
// The windows accelerator table in use
HACCEL mhAccel;
// The currently active callback
ActionCallback* mpCallback;
};
class ActionCallback : public BaseInterfaceServer {
public:
CoreExport virtual ~ActionCallback(){};
CoreExport virtual BOOL ExecuteAction(int id) { return FALSE; }
// called when an action item says it is a dynamic menu
CoreExport virtual IMenu* GetDynamicMenu(int id, HWND hwnd, IPoint2& m) { return NULL; }
// Access to the table the callback uses
ActionTable* GetTable() { return mpTable; }
void SetTable(ActionTable* pTable) { mpTable = pTable; }
private:
ActionTable *mpTable;
};
// An ActionContext is an identifer of a group of keyboard shortcuts.
// Examples are Main UI, Tack View, and Editable Mesh. They are
// registered using Interface::RegisterActionContext().
//
class ActionContext {
public:
ActionContext(ActionContextId contextId, TCHAR *pName)
{ mContextId = contextId; mName = pName; mActive = true; }
TCHAR* GetName() { return mName.data(); }
ActionContextId GetContextId() { return mContextId; }
bool IsActive() { return mActive; }
void SetActive(bool active) { mActive = active; }
private:
ActionContextId mContextId;
TSTR mName;
bool mActive;
};
// The ActionManager manages a set of ActionTables, callbacks and ActionContexts.
// The manager handles the keyboard accelerator tables for each ActionTable
// as well. You get a pointer to this class using Interface::GetActionManager().
#define ACTION_MGR_INTERFACE Interface_ID(0x4bb71a79, 0x4e531e4f)
class IActionManager : public FPStaticInterface {
public:
// Register an action table with the manager.
// Note that most plug-ins will not need this method. Instead,
// plug-ins export action table with the methods in ClassDesc.
virtual void RegisterActionTable(ActionTable* pTable) = 0;
// Methods to iterate over the action table
virtual int NumActionTables() = 0;
virtual ActionTable* GetTable(int i) = 0;
// These methods are used to turn a table on and off.
virtual int ActivateActionTable(ActionCallback* pCallback, ActionTableId id) = 0;
virtual int DeactivateActionTable(ActionCallback* pCallback, ActionTableId id) = 0;
// Find a table based on its id.
virtual ActionTable* FindTable(ActionTableId id) = 0;
// Get the string that describes the keyboard shortcut for the operation
virtual BOOL GetShortcutString(ActionTableId tableId, int commandId, TCHAR* buf) = 0;
// Get A string the descibes an operation
virtual BOOL GetActionDescription(ActionTableId tableId, int commandId, TCHAR* buf) = 0;
// Register an action context. This is called when you create the
// action table that uses this context.
virtual BOOL RegisterActionContext(ActionContextId contextId, TCHAR* pName) = 0;
// Methods to iterate over the action contexts
virtual int NumActionContexts() = 0;
virtual ActionContext* GetActionContext(int i) = 0;
// Find a context based on it's ID.
virtual ActionContext* FindContext(ActionContextId contextId) = 0;
// Query whether a context is active.
virtual BOOL IsContextActive(ActionContextId contextId) = 0;
// Internal methods used by the keyboard shotcut UI
virtual TCHAR* GetShortcutFile() = 0;
virtual TCHAR* GetShortcutDir() = 0;
virtual int IdToIndex(ActionTableId id) = 0;
virtual void SaveAllContextsToINI() = 0;
virtual int MakeActionSetCurrent(TCHAR* pDir, TCHAR* pFile) = 0;
virtual int LoadAccelConfig(LPACCEL *accel, int *cts, ActionTableId tableId = -1,
BOOL forceDefault = FALSE) = 0;
virtual int SaveAccelConfig(LPACCEL *accel, int *cts) = 0;
virtual int GetCurrentActionSet(TCHAR *buf) = 0;
virtual BOOL SaveKeyboardFile(TCHAR* pFileName) = 0;
virtual BOOL LoadKeyboardFile(TCHAR* pFileName) = 0;
virtual TCHAR* GetKeyboardFile() = 0;
// Function IDs
enum {
executeAction,
saveKeyboardFile,
loadKeyboardFile,
getKeyboardFile,
};
};
// The DynamicMenu class provides a way for plugins to produce
// the menu needed in the ActionItem::GetDynamicMenu() method.
class DynamicMenuCallback {
public:
virtual void MenuItemSelected(int itemId) = 0;
};
class DynamicMenu {
public:
CoreExport DynamicMenu(DynamicMenuCallback* pCallback);
// Called after menu creation to get the IMenu created.
// This is the value returned from ActionItem::GetDynamicMenu()
CoreExport IMenu* GetMenu();
enum DynamicMenuFlags {
kDisabled = 1 << 0,
kChecked = 1 << 1,
kSeparator = 1 << 2,
};
// Add an item to the dynamic menu.
CoreExport void AddItem(DWORD flags, UINT itemId, TCHAR* pItemTitle);
CoreExport void BeginSubMenu(TCHAR* pTitle);
CoreExport void EndSubMenu();
private:
Stack<IMenu*> mMenuStack;
DynamicMenuCallback *mpCallback;
};
@@ -0,0 +1,58 @@
/**********************************************************************
*<
FILE: ChkMtlAPI.h
DESCRIPTION: Enhances material handling for particles API
CREATED BY: Eric Peterson
HISTORY: 3-8-99
*> Copyright (c) 2000 Discreet, All Rights Reserved.
*********************************************************************/
// This header defines interface methods used to support indirect material
// referencing and enhanced face/material associations. Generally, these
// methods will need to be implemented by the plugin using them and cannot
// be called from a standard library, since the information required is
// intimately associated with the geometry of the
#ifndef __CHKMTLAPI_H__
#define __CHKMTLAPI_H__
class IChkMtlAPI
{
public:
// SupportsParticleIDbyFace returns TRUE if the object can associate
// a particle number with a face number, and FALSE by default.
virtual BOOL SupportsParticleIDbyFace() { return FALSE; }
// GetParticleFromFace returns the particle to which the face identified
// by faceID belongs.
virtual int GetParticleFromFace(int faceID) { return 0; }
// SupportsIndirMtlRefs returns TRUE if the object can return a material
// pointer given a face being rendered, and FALSE if the object will be
// associated for that render pass with only the object applied to the
// node,
virtual BOOL SupportsIndirMtlRefs() { return FALSE; }
// If SupportsIndirMtlRefs returns TRUE, then the following methods are meaningful.
// NumberOfMtlsUsed returns the number of different materials used on the object
// This number is used in enumerating the different materials via GetNthMtl and getNthMaxMtlID.
virtual int NumberOfMtlsUsed() { return 0; }
// Returns the different materials used on the object.
virtual Mtl *GetNthMtl(int n) { return NULL; }
// Returns the maximum material ID number used with each of the materials on the object
virtual int GetNthMaxMtlID(int n) { return 0; }
// Get MaterialFromFace returns a pointer to the material associated
// with the face identified by faceID.
virtual Mtl *GetMaterialFromFace(int faceID) { return NULL; }
};
#endif //__CHKMTLAPI_H__
@@ -0,0 +1,27 @@
/**********************************************************************
*<
FILE: CustAttrib.h
DESCRIPTION: Defines CustAttrib class
CREATED BY: Nikolai Sander
HISTORY: created 5/25/00
*> Copyright (c) 2000, All Rights Reserved.
**********************************************************************/
#ifndef _ICUSTATTRIB_H_
#define _ICUSTATTRIB_H_
class ICustAttribContainer;
class CustAttrib: public ReferenceTarget
{
public:
virtual TCHAR* GetName(){ return "Custom Attribute";}
virtual ParamDlg *CreateParamDlg(HWND hwMtlEdit, IMtlParams *imp){return NULL;}
virtual bool CheckCopyAttribTo(ICustAttribContainer *to) { return true; }
};
#endif
@@ -0,0 +1,147 @@
/*********************************************************************
*<
FILE: FileLinkApi.h
DESCRIPTION: File Link interface class
CREATED BY: Nikolai Sander
HISTORY: Created 29 January 1998
*> Copyright (c) 1997-1999, All Rights Reserved.
**********************************************************************/
#ifndef FILELINKAPI_H
#define FILELINKAPI_H
#include <maxtypes.h>
/******
Accessing the Link Table:
If you want your plugin to be able to access the IVizLinkTable interface
without incurring a load-time dependency, add the following function to
your plugin. With this, your plugin will load whether or not the
VizLink plugin is available.
// Returns NULL if the LinkTable plugin is not present on this system.
IVizLinkTable* GetLinkTable()
{
// Look for the LinkTable node in track view.
ITrackViewNode* tvRoot = GetCOREInterface()->GetTrackViewRootNode();
int i = tvRoot->FindItem(VIZLINKTABLE_CLASS_ID);
if (i < 0)
return NULL;
// Get the node's controller.
ITrackViewNode* tvNode = tvRoot->GetNode(i);
Control* pc = tvNode->GetController(VIZLINKTABLE_CLASS_ID);
if (pc == NULL)
return NULL;
// Call GetInterface to confirm that this is the proper instance.
return GetVizLinkTable(pc);
}
******/
#define VIZLINKTABLE_CLASS_ID Class_ID(0xa20bbe82, 0x70c763d)
#define I_VIZLINKCONTROLLER (I_USERINTERFACE+0x1739)
#define GetVizLinkTable(anim) ((IVizLinkTable*)anim->GetInterface(I_VIZLINKCONTROLLER))
#define kFILES_FORMAT -1
class VizLinkList;
class FormatRegistry;
class FormatFactory;
class LinkTableRecord;
class LinkedObjectsEnum;
class IFileLinkManager;
// Interface to the underlying implementation. Also designed as
// a Facade to the more complicated linking process.
//
class IVizLinkTable : public StdControl
{
public :
typedef int Iterator;
// Access to the UI driver.
virtual IFileLinkManager* GetFileLinkManager() = 0;
// If you pass in kFILES_FORMAT for the format argument, the format type will be
// determined from the filename.
virtual BOOL DoAttach(const TCHAR* filename,
int format = 0,
BOOL suppressPrompts = FALSE,
BOOL readOnly = TRUE) = 0;
virtual int NumLinkedFiles() const = 0;
virtual bool GetLinkID(int i, Iterator& iter) const = 0;
virtual bool DoReload(Iterator iter, BOOL suppressPrompts = FALSE) = 0;
virtual bool DoDetach(Iterator iter) = 0;
virtual bool DoBind(Iterator iter) = 0;
virtual LinkTableRecord* RecordAt(IVizLinkTable::Iterator id) = 0;
virtual bool ChangeLinkFile(Iterator iter, const TSTR& str) = 0;
// Auto-reload event handling.
protected:
friend class DBManUI;
// Only DBManUI can turn this on and off.
virtual void EnableAutoReload(bool enable) = 0;
public:
virtual void WaitForReloadThread() const = 0;
public:
// List updating notification.
virtual void RegisterForListUpdates(VizLinkList*) = 0;
virtual void UnregisterForListUpdates(VizLinkList*) = 0;
virtual void UpdateList() = 0;
// For iterating over all linked nodes.
virtual void EnumerateLinkedObjects(LinkedObjectsEnum* EnumProc) = 0;
// Linked splines can be rendered.
virtual void SetRenderSplines(BOOL b) = 0;
virtual BOOL GetRenderSplines() const = 0;
virtual BOOL SetSplineRenderThickness(float f) = 0;
virtual float GetSplineRenderThickness() const = 0;
virtual void SetGenUVs(BOOL b) = 0;
virtual BOOL GetGenUVs() const = 0;
virtual void SetShapeRenderFlags(Object *pObj) const = 0;
// If you are supporting a new format, register your factory class
// here.
virtual BOOL RegisterFactory(Class_ID& cid) = 0;
virtual FormatRegistry* Registry() = 0;
};
// This interface provides access to some of the link manager's functions.
class IFileLinkManager
{
public:
// Select a file, prompt for settings, and link the file.
virtual BOOL DoAttach(BOOL suppressPrompts = FALSE) = 0;
// Display the manager.
virtual void OpenFileLinkManager(Interface* ip) = 0;
// Enable/Disable the manager
virtual void EnableFileLinkManager(BOOL enable) = 0;
};
// If you have a list that you want dynamically updated whenever a
// linked file's status changes, derive your class from this, and
// implement the inherited method(s). For example, a utility plugin
// would derive from both UtilityObj and from VizLinkList.
class VizLinkList
{
public:
virtual void RefreshLinkedFileList() = 0;
};
#endif //FILELINKAPI_H
@@ -0,0 +1,71 @@
/**********************************************************************
*<
FILE: IAggregation.h
DESCRIPTION: Interface to object aggregation manager
CREATED BY: John Hutchinson
HISTORY: Created January 9, 1999
*> Copyright (c) 1994, All Rights Reserved.
**********************************************************************/
#pragma once
// DESCRIPTION:
// The IAggregation class is the interface class for representing
// the process of object aggregation
//some constants passed to association class descriptors when editing parameters
#define BEGIN_EDIT 1
#define END_EDIT 2
#define IMAGE_LOAD 3
#define DISPLAY_XRAY 1
typedef enum {eUncommitted,
ePending,
ePartial,
eFully,
eRejecting,
eAborting}
commitlevels;
typedef enum {eNoAffinity,
eSuperClassAffinity,
ePseudoSuperClassAffinity,
eClassAffinity,
eInterfaceAffinity,
eInstanceAffinity}
aggregationaffinity;
class IAggregation
{
public:
virtual void SetActiveComplex(INode* node) = 0;
virtual INode* GetActiveComplex() = 0;
virtual void Reset() = 0;
virtual bool SetProductFactory(SClass_ID superID, Class_ID classID) = 0;
virtual bool RegisterIntermediateFactory(ClassDesc* cd, int affinity) = 0;
virtual void ResetFactories() = 0;
virtual IRollupWindow* GetParamRollup() = 0;
virtual ClassDesc* GetSelClassDesc() = 0;
virtual Animatable* GetSelClassTemplate() = 0;
virtual int ToolbarIndex(ClassDesc* cd) = 0;
virtual HIMAGELIST ToolbarImagelist(int which) = 0;
virtual bool RegisterAssocClass(ClassDesc* cd, int whichbar, int ioe_idx, int iod_idx, int iie_idx, int iid_idx) = 0;
virtual int CommitAggregation(int action, int flag) = 0;
virtual void Suspend() = 0;
virtual void Resume() = 0;
virtual bool isSuspended() = 0;
virtual INode* ReactToNode(INode* newnode) = 0;
virtual commitlevels Status() = 0;
virtual DWORD DisplayFlags() = 0;
};
class ValenceData
{
public:
ValenceData():m_type(0){};
int m_type;
};
@@ -0,0 +1,443 @@
/**********************************************************************
*<
FILE: ICollision.h
DESCRIPTION: An interface class to our collisions
CREATED BY: Peter Watje
HISTORY: 3-15-00
*> Copyright (c) 200, All Rights Reserved.
**********************************************************************/
#ifndef __ICOLLSION__H
#define __ICOLLISION__H
#include "Max.h"
#include "iparamm2.h"
#include "iFnPub.h"
#define PLANAR_COLLISION_ID Class_ID(0x14585111, 0x444a7dcf)
#define SPHERICAL_COLLISION_ID Class_ID(0x14585222, 0x555a7dcf)
#define MESH_COLLISION_ID Class_ID(0x14585333, 0x666a7dcf)
#define COLLISION_FO_INTERFACE Class_ID(0x14585444, 0x777a7dcf)
#define GetCollisionOpsInterface(cd) \
(CollisionOps *)(cd)->GetInterface(COLLISION_FO_INTERFACE)
#define POINT_COLLISION 1
#define SPHERE_COLLISION 2
#define BOX_COLLISION 4
#define EDGE_COLLISION 8
class ICollision : public ReferenceTarget {
public:
//return what is supported for collision engine
//right now all we support is point to surface collision
//but in the future the others maybe support by us or 3rd party
//it returns the or'd flags above
virtual int SuppportedCollisions() = 0;
//This method is called once before the checkcollision is called for each frame
//which allows you to do some data initializations
virtual void PreFrame(TimeValue t, TimeValue dt) = 0;
//This method is called at the end f each frame solve to allow
//you to destroy any data you don't need want
virtual void PostFrame(TimeValue t, TimeValue dt) = 0;
//point to surface collision
//computes the time at which the particle hit the surface
//t is the end time of the particle
//dt is the delta of time that particle travels
// t-dt = start of time of the particle
//pos the position of the particle in world space
//vel the velocity of the particle in world space
//at is the point in time that the collision occurs with respect to dt
//norm is bounce vector component of the final velocity
//friction is the friction vector component of the final velocity
//inheritVel is the amount of velocity inherited from the motion of the delfector
// this is a rough apporximate
virtual BOOL CheckCollision (TimeValue t,Point3 pos, Point3 vel, float dt,
float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel) = 0;
//sphere to surface collision
virtual BOOL CheckCollision (TimeValue t,Point3 pos, float radius, Point3 vel, float dt,
float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel) = 0;
//box to surface collision
virtual BOOL CheckCollision (TimeValue t, Box3 box, Point3 vel, float dt,
float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel) = 0;
//edge to surface collision
virtual BOOL CheckCollision (TimeValue t,Point3 edgeA,Point3 edgeB ,Point3 vel, float dt,
float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel) = 0;
};
enum { collision_supportedcollisions, collision_preframe,collision_postframe,
collision_point_to_surface,collision_sphere_to_surface ,collision_box_to_surface,
collision_edge_to_surface };
class CollisionOps : public FPInterface
{
virtual int SuppportedCollisions(ReferenceTarget *r) = 0;
virtual void PreFrame(ReferenceTarget *r, TimeValue &t, TimeValue &dt) = 0;
virtual void PostFrame(ReferenceTarget *r, TimeValue &t, TimeValue &dt) = 0;
virtual BOOL CheckCollision (ReferenceTarget *r, TimeValue &t,Point3 *pos, Point3 *vel, float &dt,
float &at, Point3 *hitPoint, Point3 *norm, Point3 *friction, Point3 *inheritedVel) = 0;
//sphere to surface collision
virtual BOOL CheckCollision (ReferenceTarget *r, TimeValue &t,Point3 *pos, float &radius, Point3 *vel, float &dt,
float &at, Point3 *hitPoint, Point3 *norm, Point3 *friction, Point3 *inheritedVel) = 0;
//box to surface collision FIX ME can't publish box3
virtual BOOL CheckCollision (ReferenceTarget *r, TimeValue &t,
Point3 *boxCenter,float &w, float &h, float &d, Point3 *vel, float &dt,
float &at, Point3 *hitPoint, Point3 *norm, Point3 *friction, Point3 *inheritedVel) = 0;
//edge to surface collision
virtual BOOL CheckCollision (ReferenceTarget *r, TimeValue &t,Point3 *edgeA,Point3 *edgeB ,Point3 *vel, float &dt,
float &at, Point3 *hitPoint, Point3 *norm, Point3 *friction, Point3 *inheritedVel) = 0;
};
// block IDs
enum { collisionplane_params, };
// geo_param param IDs
enum { collisionplane_width,
collisionplane_height,
collisionplane_quality,
collisionplane_node,
};
class CollisionPlane : public ICollision
{
private:
INode *node;
public:
IParamBlock2 *pblock;
Interval validity;
CollisionPlane();
~CollisionPlane();
//determines what type of collisions are supported
int SuppportedCollisions()
{
return POINT_COLLISION;
}
void PreFrame(TimeValue t, TimeValue dt) ;
void PostFrame(TimeValue t, TimeValue dt) {}
BOOL CheckCollision (TimeValue t,Point3 pos, Point3 vel, float dt,
float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel);
//sphere to surface collision
BOOL CheckCollision (TimeValue t,Point3 pos, float radius, Point3 vel, float dt,
float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel)
{
return FALSE;
}
//box to surface collision
BOOL CheckCollision (TimeValue t, Box3 box, Point3 vel, float dt,
float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel)
{
return FALSE;
}
//edge to surface collision
BOOL CheckCollision (TimeValue t,Point3 edgeA,Point3 edgeB ,Point3 vel, float dt,
float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel)
{
return FALSE;
}
//access functions to the pblock
void SetWidth(TimeValue t, float w) { pblock->SetValue(collisionplane_width,t,w); }
void SetHeight(TimeValue t, float h) { pblock->SetValue(collisionplane_height,t,h); }
void SetQuality(TimeValue t, int q) { pblock->SetValue(collisionplane_quality,t,q); }
// void SetTM(TimeValue t, Matrix3 tm) { pblock->SetValue(collisionplane_tm,t,&tm); }
void SetNode(TimeValue t, INode *n) { pblock->SetValue(collisionplane_node,t,n);
node = n; }
void SetWidth(Control *c) { pblock->SetController(collisionplane_width,0,c); }
void SetHeight(Control *c) { pblock->SetController(collisionplane_height,0,c); }
void SetQuality(Control *c) { pblock->SetController(collisionplane_quality,0,c); }
// void SetTM(Control *c);
Matrix3 tm, invtm;
Matrix3 prevInvTm;
int initialTime;
Tab<Matrix3> invTmList;
float width, height;
int quality;
// Methods from Animatable
void DeleteThis() { delete this; }
Class_ID ClassID() {return PLANAR_COLLISION_ID;}
SClass_ID SuperClassID() {return REF_MAKER_CLASS_ID;}
// Methods from ReferenceTarget :
int NumRefs() { return 1; }
RefTargetHandle GetReference(int i) { return pblock; }
void SetReference(int i, RefTargetHandle rtarg) {pblock = (IParamBlock2*)rtarg;}
RefTargetHandle Clone(RemapDir &remap = NoRemap())
{
CollisionPlane* newob = new CollisionPlane();
newob->ReplaceReference(0,pblock->Clone(remap));
BaseClone(this, newob, remap);
return newob;
}
RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, PartID& partID,RefMessage message)
{
switch (message) {
case REFMSG_CHANGE:
if (hTarget == pblock)
validity.SetEmpty();
break;
}
//note this is ref_stop because we don't want the engine updating it references
//may need a flag to turn this off or on
return( REF_STOP);
}
};
// block IDs
enum { collisionsphere_params, };
// geo_param param IDs
enum { collisionsphere_radius,
collisionsphere_node, //using a node right now this really needs to be a TM but it does not look like tms are hooked up yet in pb2
};
class CollisionSphere : public ICollision
{
private:
INode *node;
public:
IParamBlock2 *pblock;
Interval validity;
CollisionSphere();
~CollisionSphere();
//determines what type of collisions are supported
int SuppportedCollisions()
{
return POINT_COLLISION;
}
void PreFrame(TimeValue t, TimeValue dt) ;
void PostFrame(TimeValue t, TimeValue dt) {}
BOOL CheckCollision (TimeValue t,Point3 pos, Point3 vel, float dt,
float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel);
//sphere to surface collision
BOOL CheckCollision (TimeValue t,Point3 pos, float radius, Point3 vel, float dt,
float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel)
{
return FALSE;
}
//box to surface collision
BOOL CheckCollision (TimeValue t, Box3 box, Point3 vel, float dt,
float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel)
{
return FALSE;
}
//edge to surface collision
BOOL CheckCollision (TimeValue t,Point3 edgeA,Point3 edgeB ,Point3 vel, float dt,
float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel)
{
return FALSE;
}
//access functions to the pblock
void SetRadius(TimeValue t, float r) { pblock->SetValue(collisionsphere_radius,t,r); }
void SetNode(TimeValue t, INode *n) { pblock->SetValue(collisionsphere_node,t,n);
node = n; }
void SetRadius(Control *c) { pblock->SetController(collisionsphere_radius,0,c); }
Matrix3 tm, invtm;
Matrix3 prevInvTm;
Point3 Vc;
float radius;
// Methods from Animatable
void DeleteThis() { delete this; }
Class_ID ClassID() {return SPHERICAL_COLLISION_ID;}
SClass_ID SuperClassID() {return REF_MAKER_CLASS_ID;}
// Methods from ReferenceTarget :
int NumRefs() { return 1; }
RefTargetHandle GetReference(int i) { return pblock; }
void SetReference(int i, RefTargetHandle rtarg) {pblock = (IParamBlock2*)rtarg;}
RefTargetHandle Clone(RemapDir &remap = NoRemap())
{
CollisionSphere* newob = new CollisionSphere();
newob->ReplaceReference(0,pblock->Clone(remap));
BaseClone(this, newob, remap);
return newob;
}
RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, PartID& partID,RefMessage message)
{
switch (message) {
case REFMSG_CHANGE:
if (hTarget == pblock)
validity.SetEmpty();
break;
}
//note this is ref_stop because we don't want the engine updating it references
//may need a flag to turn this off or on
return( REF_STOP);
}
};
class CollisionVNormal {
public:
Point3 norm;
DWORD smooth;
CollisionVNormal *next;
BOOL init;
CollisionVNormal() {smooth=0;next=NULL;init=FALSE;norm=Point3(0,0,0);}
CollisionVNormal(Point3 &n,DWORD s) {next=NULL;init=TRUE;norm=n;smooth=s;}
~CollisionVNormal() {delete next;}
void AddNormal(Point3 &n,DWORD s);
Point3 &GetNormal(DWORD s);
void Normalize();
};
// block IDs
enum { collisionmesh_params, };
// geo_param param IDs
enum {
collisionmesh_hit_face_index,
collisionmesh_hit_bary,
collisionmesh_node //using a node right now this really needs to be a TM but it does not look like tms are hooked up yet in pb2
};
class CollisionMesh : public ICollision
{
private:
INode *node;
public:
IParamBlock2 *pblock;
Interval validity;
DWORD outFi;
Point3 outBary;
CollisionMesh();
~CollisionMesh();
//determines what type of collisions are supported
int SuppportedCollisions()
{
return POINT_COLLISION;
}
void PreFrame(TimeValue t, TimeValue dt) ;
void PostFrame(TimeValue t, TimeValue dt) {}
BOOL CheckCollision (TimeValue t,Point3 pos, Point3 vel, float dt,
float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel);
//sphere to surface collision
BOOL CheckCollision (TimeValue t,Point3 pos, float radius, Point3 vel, float dt,
float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel)
{
return FALSE;
}
//box to surface collision
BOOL CheckCollision (TimeValue t, Box3 box, Point3 vel, float dt,
float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel)
{
return FALSE;
}
//edge to surface collision
BOOL CheckCollision (TimeValue t,Point3 edgeA,Point3 edgeB ,Point3 vel, float dt,
float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel)
{
return FALSE;
}
//access functions to the pblock
void SetNode(TimeValue t, INode *n) {
//check for circle loop here
pblock->SetValue(collisionmesh_node,t,n);
node = n; }
Matrix3 tm, invtm;
Matrix3 tmPrev,invtmPrev;
Mesh *dmesh;
int nv,nf;
CollisionVNormal *vnorms;
Point3 *fnorms;
// Mesh *dmeshPrev;
// VNormal *vnormsPrev;
// Point3 *fnormsPrev;
// Methods from Animatable
void DeleteThis() { delete this; }
Class_ID ClassID() {return MESH_COLLISION_ID;}
SClass_ID SuperClassID() {return REF_MAKER_CLASS_ID;}
// Methods from ReferenceTarget :
int NumRefs() { return 1; }
RefTargetHandle GetReference(int i) { return pblock; }
void SetReference(int i, RefTargetHandle rtarg) {pblock = (IParamBlock2*)rtarg;}
RefTargetHandle Clone(RemapDir &remap = NoRemap())
{
CollisionSphere* newob = new CollisionSphere();
newob->ReplaceReference(0,pblock->Clone(remap));
BaseClone(this, newob, remap);
return newob;
}
RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, PartID& partID,RefMessage message)
{
switch (message) {
case REFMSG_CHANGE:
if (hTarget == pblock)
validity.SetEmpty();
break;
}
//note this is ref_stop because we don't want the engine updating it references
//may need a flag to turn this off or on
return( REF_STOP);
}
};
#endif __ICOLLSION__H
@@ -0,0 +1,34 @@
/**********************************************************************
*<
FILE: ICommandPanel
DESCRIPTION: Command Panel API
CREATED BY: Nikolai Sander
HISTORY: created 7/11/00
*> Copyright (c) 1994, All Rights Reserved.
**********************************************************************/
#ifndef __ICOMMANDPANEL_H__
#define __ICOMMANDPANEL_H__
class ICommandPanel : public FPStaticInterface
{
public:
// function IDs
enum {
fnIdGetRollupThreshhold,
fnIdSetRollupThreshhold,
};
virtual int GetRollupThreshold()=0;
virtual void SetRollupThreshold(int iThresh)=0;
};
#define COMMAND_PANEL_INTERFACE Interface_ID(0x411753f6, 0x69a93710)
inline ICommandPanel* GetICommandPanel() { return (ICommandPanel*)GetCOREInterface(COMMAND_PANEL_INTERFACE); }
#endif
@@ -0,0 +1,34 @@
/**********************************************************************
*<
FILE: ICustAttribContainer.h
DESCRIPTION: Defines ICustAttribContainer class
CREATED BY: Nikolai Sander
HISTORY: created 5/22/00
*> Copyright (c) 2000, All Rights Reserved.
**********************************************************************/
#ifndef _ICUSTATTRIBCONTAINER_H_
#define _ICUSTATTRIBCONTAINER_H_
class CustAttrib;
class ICustAttribContainer : public ReferenceTarget
{
public:
virtual int GetNumCustAttribs()=0;
virtual CustAttrib *GetCustAttrib(int i)=0;
virtual void AppendCustAttrib(CustAttrib *attribute)=0;
virtual void SetCustAttrib(int i, CustAttrib *attribute)=0;
virtual void InsertCustAttrib(int i, CustAttrib *attribute)=0;
virtual void RemoveCustAttrib(int i)=0;
virtual ParamDlg* CreateParamDlg(HWND hwMtlEdit, IMtlParams *imp)=0;
virtual void CopyParametersFrom(ReferenceMaker *from, RemapDir &remap)=0;
virtual Animatable *GetOwner()=0;
virtual void DeleteThis()=0;
};
#endif
@@ -0,0 +1,63 @@
/**********************************************************************
*<
FILE: ID3DGraphicsWindow.h
DESCRIPTION: Direct3D Graphics Window Extension Interface class
CREATED BY: Norbert Jeske
HISTORY:
*> Copyright (c) 2000, All Rights Reserved.
**********************************************************************/
#ifndef _D3D_GRAPHICS_WINDOW_H_
#define _D3D_GRAPHICS_WINDOW_H_
#include <d3dx8.h>
#define D3D_GRAPHICS_WINDOW_INTERFACE_ID Interface_ID(0x681121c4, 0x6e9a797d)
class Mesh;
class ID3DGraphicsWindow : public BaseInterface
{
public:
virtual Interface_ID GetID() { return D3D_GRAPHICS_WINDOW_INTERFACE_ID; }
// Interface Lifetime
virtual LifetimeType LifetimeControl() { return noRelease; }
// Get Direct3D Device from GFX
virtual LPDIRECT3DDEVICE8 GetDevice() = 0;
// Get VertexBuffer from GFX. Unless older Flexible Vertex Formats are in
// use, FVF should be zero.
virtual LPDIRECT3DVERTEXBUFFER8 GetVertexBuffer(UINT length, DWORD FVF) = 0;
// Get IndexBuffer from GFX
virtual LPDIRECT3DINDEXBUFFER8 GetIndexBuffer(UINT length, D3DFORMAT format) = 0;
// Get Transforms from GFX
virtual D3DXMATRIX GetWorldXform() = 0;
virtual D3DXMATRIX GetViewXform() = 0;
virtual D3DXMATRIX GetProjXform() = 0;
// Get Constant Color of specified type from GFX
virtual D3DCOLOR GetColor(ColorType t) = 0;
// Get a pointer to a 'Tab' table array of pointers to enabled Direct3D
// Lights from GFX
virtual Tab<D3DLIGHT8 *> *GetLights() = 0;
// Get Material from GFX
virtual D3DMATERIAL8 GetMaterial() = 0;
// Get Texture Tiling for specified texStage and texCoord from GFX
virtual DWORD GetTextureTiling(int texStage, int coord) = 0;
// Get Texture Transfrom for specified texStage from GFX
virtual D3DXMATRIX GetTexXform(int texStage) = 0;
};
#endif
@@ -0,0 +1,51 @@
/**********************************************************************
*<
FILE: IDX8PixelShader.h
DESCRIPTION: DirectX 8 Pixel Shader Interface Definition
CREATED BY: Nikolai Sander and Norbert Jeske
HISTORY: Created 9/27/00
*> Copyright (c) 2000, All Rights Reserved.
**********************************************************************/
#include <d3dx8.h>
#define DX8_PIXEL_SHADER_INTERFACE_ID Interface_ID(0x56df1953, 0xc6121a3)
class ID3DGraphicsWindow;
class IDX8VertexShader;
class Material;
class IDX8PixelShader: public BaseInterface
{
public:
virtual Interface_ID GetID() { return DX8_PIXEL_SHADER_INTERFACE_ID; }
// Confirm that the Direct3D Device can handle this PixelShader
virtual HRESULT ConfirmDevice(ID3DGraphicsWindow *gw) = 0;
// Confirm that an associated VertexShader will work with this PixelShader
virtual HRESULT ConfirmVertexShader(IDX8VertexShader *pvs) = 0;
// Load PixelShader instructions and textures. PixelShader instructions
// should be loaded once and shared among all the nodes using this
// PixelShader. In addition, any textures necessary for the PixelShader
// effect should be loaded once and shared among all the nodes using this
// PixelShader.
virtual HRESULT Initialize(Material *mtl, INode *node) = 0;
// Number of passes for the effect this PixelShader creates. Note that
// this value will depend on the hardware currently in use.
virtual int GetNumMultiPass() = 0;
// Retrieve the PixelShader handle for the specified pass for use in GFX
virtual DWORD GetPixelShaderHandle(int numPass) = 0;
// Set the PixelShader for the specified pass. This call will be made at
// least once per object to set the per object data for the PixelShader
// such as the PixelShader constants.
virtual HRESULT SetPixelShader(ID3DGraphicsWindow *gw, int numPass) = 0;
};
@@ -0,0 +1,146 @@
/**********************************************************************
*<
FILE: IDX8VertexShader.h
DESCRIPTION: DirectX 8 Vertex Shader Interface Definition
CREATED BY: Nikolai Snader and Norbert Jeske
HISTORY: Created 9/22/00
*> Copyright (c) 2000, All Rights Reserved.
**********************************************************************/
#include <d3dx8.h>
#include "IHardwareShader.h"
#define DX8_VERTEX_SHADER_INTERFACE_ID Interface_ID(0x476a10d9, 0x7f531d40)
struct DX8VSConstant
{
float a,b,c,d;
// Access operators
float& operator[](int i) { return (&a)[i]; }
const float& operator[](int i) const { return (&a)[i]; }
};
class ID3DGraphicsWindow;
class IDX8PixelShader;
class IDX8VertexShader : virtual public IVertexShader, public BaseInterface
{
public:
virtual Interface_ID GetID() { return DX8_VERTEX_SHADER_INTERFACE_ID; }
// Confirm that the Direct3D Device can handle this VertexShader
virtual HRESULT ConfirmDevice(ID3DGraphicsWindow *gw) = 0;
// Confirm that an associated PixelShader will work with this VertexShader
virtual HRESULT ConfirmPixelShader(IDX8PixelShader *pps) = 0;
// Can try tristrips for drawing or must geometry using this VertexShader
// be drawn as triangles? This should return 'true' unless additional per
// vertex data is generated by this VertexShader and this data does not map
// to the Mesh vertices in the same way as existing data the Mesh knows
// about such as texture coordinates.
virtual bool CanTryStrips() = 0;
// Number of passes for the effect this VertexShader creates. Note that
// this value will depend on the hardware currently in use.
virtual int GetNumMultiPass() = 0;
// Retrieve the VertexShader handle for the specified pass for use in GFX
virtual DWORD GetVertexShaderHandle(int numPass) = 0;
// Set the VertexShader for the specified pass. This call will be made at
// least once per object to set the per object data for the VertexShader
// such as the VertexShader constants.
virtual HRESULT SetVertexShader(ID3DGraphicsWindow *gw, int numPass) = 0;
// Drawing functions. These functions are necessary as something other
// than a simple default body if:
//
// 1. The VertexShader needs to add additional per vertex data unknown to
// the Mesh to the VertexBuffer.
//
// 2. The VertexShader needs to have per vertex data ordered differently
// than the standard position, normal, {color, tex coords ordering}.
//
// 3. The VertexShader is being used to create cached VertexBuffers or
// using higher order surfaces.
//
// In the first two cases, the VertexShader has the option of not only
// locking and filling the VertexBuffer with data, but also of making the
// actual DrawPrimitive call. In the third case, the VertexShader must
// make the DrawPrimitive call. The VertexShader indicates that it has
// done the drawing by returning 'true' in the Draw() functions below.
//
// In the case where the VertexShader does not want to do the drawing but
// does want to fill in a VertexBuffer with data, the VertexShader can
// request the GFX to create a VertexBuffer (and possibly an IndexBuffer)
// of appropriate size. The GetVertexBuffer and GetIndexBuffer calls on
// the ID3DGraphicsWindow object will do this and return the allocated
// buffers in subsequent calls or reallocate them if necessary.
//
// Please note that if a PixelShader or PixelShaders are in use, these
// Draw() functions may need to set them for the appropriate passes of a
// multipass rendering if the drawing is done in these Draw() functions.
// If the GFX is doing the drawing, then these Draw() functions are only
// being used to fill in the VertexBuffer with data; the GFX will be doing
// the drawing and will be setting the PixelShaders as appropriate.
// Draw 3D Mesh as TriStrips. Fill in the VertexBuffer with data in the
// order desired by the VertexShader. Return 'true' if the Mesh has
// actually been drawn in this call, 'false' if the GFX is required to make
// the DrawPrimitive call.
virtual bool DrawMeshStrips(ID3DGraphicsWindow *gw, MeshData *data) = 0;
// Draw 3D Mesh as wireframe. Fill in the VertexBuffer with data in the
// order desired by the VertexShader. Return 'true' if the Mesh has
// actually been drawn in this call, 'false' if the GFX is required to make
// the DrawPrimitive call.
virtual bool DrawWireMesh(ID3DGraphicsWindow *gw, WireMeshData *data) = 0;
// Draw 3D lines. A Mesh is being drawn by having line segments handed
// down one at a time.
// Pass in the Mesh data in preparation for drawing 3D lines.
virtual void StartLines(ID3DGraphicsWindow *gw, WireMeshData *data) = 0;
// Add the connectivity information for one two point line segment.
virtual void AddLine(ID3DGraphicsWindow *gw, DWORD *vert, int vis) = 0;
// Draw the line segments accumulated. This should restart the filling of
// a VertexBuffer with the next AddLine call if additional data needs to
// be drawn before EndLines is called. Return 'true' if the Mesh line
// segments have actually been drawn in this call, 'false' if the GFX is
// required to make the DrawPrimitive call.
virtual bool DrawLines(ID3DGraphicsWindow *gw) = 0;
// Let the Mesh know that all drawing and data access is finished.
virtual void EndLines(ID3DGraphicsWindow *gw, GFX_ESCAPE_FN fn) = 0;
// Draw 3D triangles. A Mesh is being drawn by having triangles handed
// down one at a time.
// Pass in the Mesh data in preparation for drawing 3D triangles.
virtual void StartTriangles(ID3DGraphicsWindow *gw, MeshFaceData *data) = 0;
// Add the connectivity information for one triangle.
virtual void AddTriangle(ID3DGraphicsWindow *gw, DWORD index, int *edgeVis) = 0;
// Draw the triangles accumulated. This should restart the filling of a
// VertexBuffer with the next AddTriangle call if additional data needs to
// be drawn before EndTriangles is called. Return 'true' if the Mesh
// triangles have actually been drawn in this call, 'false' if the GFX is
// required to make the DrawPrimitive call.
virtual bool DrawTriangles(ID3DGraphicsWindow *gw) = 0;
// Let the Mesh know that all drawing and data access is finished.
virtual void EndTriangles(ID3DGraphicsWindow *gw, GFX_ESCAPE_FN fn) = 0;
};
@@ -0,0 +1,181 @@
/**********************************************************************
FILE: IDataChannel.h
DESCRIPTION: Intelligent Data Channel API
CREATED BY: Attila Szabo, Discreet
HISTORY: [attilas|19.6.2000]
*> Copyright (c) 1998-2000, All Rights Reserved.
**********************************************************************/
#ifndef __IDATACHANNEL__H
#define __IDATACHANNEL__H
#include "maxtypes.h"
// Macros to be used if any of the method below are implemented in a dll
// The dll project that implements the methods needs to define DATACHANNEL_IMP
#ifdef DATACHANNEL_IMP
#define DataChanExport __declspec(dllexport)
#else
#define DataChanExport __declspec(dllimport)
#endif
// forward declaration
class FPInterface;
//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
// A data channel is a homogeneous collection of objects of a user defined
// type (data objects). Data channels are uniquely identified by a Class_ID.
//
// Data channels can be associated with any element type of a Max object:
// faces or vertexes of Meshes, etc.
//________________________________________________________________________
class IDataChannel : public InterfaceServer
{
public:
// Returns the unique id of the channel
virtual Class_ID DataChannelID() const =0;
// Returns the number of data objects in this channel
virtual ULONG Count() const { return 0; }
// Self destruction
virtual void DeleteThis() = 0;
};
// interface ID
#define DATACHANNEL_INTERFACE Interface_ID(0x38a718a8, 0x14685b4b)
#define GetDataChannelInterface(obj) ((IDataChannel*)obj->GetInterface(DATACHANNEL_INTERFACE))
//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
// Face-data channel interface
//
// This is an abstraction of a collection of data objects that is
// associated with faces of Max objects
// Max objects that have face-data channels call the methods of this interface
// when those faces change in some way. The data channels can then react to
// the changes to the faces.
//
// Currently only Meshes support face-data channels.
//________________________________________________________________________
class IFaceDataChannel : public IDataChannel
{
public:
//
// --- face specific operations\events ---
//
// These methods are called by the owner of face-data channels
// when its faces change in some way. It's up to the face-data channel
// to do wathever it wants to do on these notification methods.
// Called when num new faces were created at index at in the
// object's list of faces. Returns TRUE on success
// ULONG at - index in the object's array of faces where the new faces
// were inserted
// ULONG num - the number of new faces created
virtual BOOL FacesCreated( ULONG at, ULONG num ) = 0;
// Called when the owner object has cloned some of its faces and appended
// then to its list of faces.
// BitArray& set - bitarray with as many bits as many faces the owner
// object has. Bits set to 1 correspond to cloned faces
virtual BOOL FacesClonedAndAppended( BitArray& set ) = 0;
// Called when faces were deleted in the owner object. Returns TRUE on success
// BitArray& set - bitarray with as many bits as many faces the owner
// object has. Bits set to 1 correspond to deleted faces
virtual BOOL FacesDeleted( BitArray& set ) = 0;
// Called when faces were deleted in the owner object. Returns TRUE on success
// Allwos for a more efficient deletion of a range of data objects
// than using a BitArray
// ULONG from - index in the object's array of faces. Faces starting
// from this index were deleted
// ULONG num - number of faces that were deleted
virtual BOOL FacesDeleted( ULONG from, ULONG num ) = 0;
// Called when all faces in the owner object are deleted
virtual void AllFacesDeleted() = 0;
// Called when a face has been copied from index from in the owner object's
// array of faces to the face at index to.
// ULONG from - index of source face
// ULONG to - index of dest face
virtual BOOL FaceCopied( ULONG from, ULONG to ) = 0;
// Called when a new face has been created in the owner object based on
// data interpolated from other faces
// ULONG numSrc - the number of faces used in the interpolation
// ULONG* srcFaces - array of numSrc face indeces in the owner object's
// face array. These faces were used when creating the new face
// float* coeff - array of numSrc coefficients used in the interpolation
// ULONG targetFace - the index in the owner object's array of faces of the
// newly created face
virtual BOOL FaceInterpolated( ULONG numSrc,
ULONG* srcFaces,
float* coeff,
ULONG targetFace ) = 0;
//
// --- geometry pipeline (stack) specific methods ---
//
// These methods are called when the owner object is flowing up the
// pipeline (stack). They must be implemented to ensure that the
// face-data channel flows up the pipeline correctly.
// The owner object expects the face-data to do exactly what the
// names of these methods imply. These can be seen as commands that are
// given by the owner object to the face-data channel
// Allocates an empty data-channel
virtual IFaceDataChannel* CreateChannel( ) = 0;
// The data-channel needs to allocate a new instance of itself and fill it
// with copies of all data items it stores.
// This method exist to make it more efficient to clone the whole data-channel
virtual IFaceDataChannel* CloneChannel( ) = 0;
// The data-channel needs to append the data objects in the fromChan
// to itself.
virtual BOOL AppendChannel( const IFaceDataChannel* fromChan ) = 0;
};
// interface ID
#define FACEDATACHANNEL_INTERFACE Interface_ID(0x181358d5, 0x3cab1bc9)
#define GetFaceDataChannelInterface(obj) ((IFaceDataChannel*)obj->GetInterface(FACEDATACHANNEL_INTERFACE))
//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
// Interface class that allows to execute a callback method (Proc) for all
// face-data channels of an object.
//
// Developers should derive their own classes from this interface and
// overwrite the Proc method to call the desired IFaceDataChannel method
// It is up to derived class to interpret the context parameter passed to
// Proc.
//
// --- Usage ---
// Classes that hold face-data channels, can implement a method called
// EnumFaceDataChannels( IFaceDataEnumCallBack& cb, void* pContext)
// This method would be called with a reference to an instance of a class
// derived from IFaceDataEnumCallBack in which Proc was overwritten. The
// implementation of EnumFaceDataChannels would call cb.Proc for each of
// the face-data channels of the object
//
// Warning:
// Deleting data channels from within Proc can lead to unexpected behaviour
//________________________________________________________________________
class IFaceDataChannelsEnumCallBack
{
public:
virtual BOOL Proc( IFaceDataChannel* pChan, void* pContext ) = 0;
};
#endif
@@ -0,0 +1,83 @@
/**********************************************************************
FILE: IFaceDataMgr.h
DESCRIPTION: Face-Data management API
CREATED BY: Attila Szabo, Discreet
HISTORY: [attilas|30.8.2000]
*> Copyright (c) 1998-2000, All Rights Reserved.
**********************************************************************/
#ifndef __IFACEDATAMGR__H
#define __IFACEDATAMGR__H
#include "idatachannel.h"
#include "baseinterface.h"
// GUID that identifies this ifc (interface)
#define FACEDATAMGR_INTERFACE Interface_ID(0x1b454148, 0x6a066927)
//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
// Interface for managing face-data channels.
// Objects that want to have face-data channels should implement this ifc
//
// If this interface needs to b changed, a new one should be derived from
// it and changed (IFaceDataMgr2) and made sure objects that support
// face-data implement both old and new interfaces
//________________________________________________________________________
class IFaceDataMgr : public BaseInterface
{
public:
//
// Modifiers and procedural objects should call these methods
// to add\remove\retrieve a face-data channel on an object (mesh,patch,poly)
//
// Returns the number of face-data-channels
virtual ULONG NumFaceDataChans( ) const = 0;
// Retrieves a face-data-channel
virtual IFaceDataChannel* GetFaceDataChan( const Class_ID& ID ) const = 0;
// Adds a face-data-channel to the object. Returns TRUE on success
virtual BOOL AddFaceDataChan( IFaceDataChannel* pChan ) = 0;
// Removes a face-data-channel from the object. Returns TRUE on success
virtual BOOL RemoveFaceDataChan( const Class_ID& ID ) = 0;
//
// The "system" (Max) should call these methods to manage the
// face-data channels when the object flows up the stack
//
// Appends a face-data-channel to the object. Returns TRUE on success
virtual BOOL AppendFaceDataChan( const IFaceDataChannel* pChan ) = 0;
// Adds or appends face-data channels from the from object, to this object
// If the channel already exists on this object, it's appended otherwise
// gets added
virtual BOOL CopyFaceDataChans( const IFaceDataMgr* pFrom ) = 0;
// Deletes all face-data-channels from this object
virtual void RemoveAllFaceDataChans() = 0;
// Mechanism for executing an operation for all face-data-channels on this object:
// For all face-data-channels calls IFaceDataEnumCallBack::proc() with
// a pointer to that face-data- channel and a context data
// Returns FALSE if the call back returns FALSE for any of the face-data-channels
virtual BOOL EnumFaceDataChans( IFaceDataChannelsEnumCallBack& cb, void* pContext ) const = 0;
// Allow persistance of info kept in object implementing this interface
virtual IOResult Save(ISave* isave) = 0;
virtual IOResult Load(ILoad* iload) = 0;
// --- from GenericInterface
virtual Interface_ID GetID() { return FACEDATAMGR_INTERFACE; }
};
#endif
@@ -0,0 +1,72 @@
/**********************************************************************
FILE: IMeshFaceDataMgrmpl.h
DESCRIPTION: Face-Data management API implementation
CREATED BY: Attila Szabo, Discreet
HISTORY: [attilas|30.8.2000]
*> Copyright (c) 1998-2000, All Rights Reserved.
**********************************************************************/
#ifndef __IFACEDATAMGRIMPL__H
#define __IFACEDATAMGRIMPL__H
#include "ifacedatamgr.h"
#pragma warning (disable: 4786)
#include <map>
#include "export.h"
//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
// Face-data management implementation
//________________________________________________________________________
class IFaceDataMgrImpl : public IFaceDataMgr
{
public:
typedef std::map<Class_ID, IFaceDataChannel*> FaceDataChannels;
typedef FaceDataChannels::iterator FaceDataChanIt;
typedef FaceDataChannels::const_iterator FaceDataChanConstIt;
// --- from IFaceDataMgr
DllExport virtual ULONG NumFaceDataChans( ) const;
DllExport virtual IFaceDataChannel* GetFaceDataChan( const Class_ID& ID ) const;
DllExport virtual BOOL AddFaceDataChan( IFaceDataChannel* pChan );
DllExport virtual BOOL RemoveFaceDataChan( const Class_ID& ID );
DllExport virtual BOOL AppendFaceDataChan( const IFaceDataChannel* pChan );
DllExport virtual BOOL CopyFaceDataChans( const IFaceDataMgr* pFrom );
DllExport virtual void RemoveAllFaceDataChans();
DllExport virtual BOOL EnumFaceDataChans( IFaceDataChannelsEnumCallBack& cb, void* pContext ) const;
// Allow persistance of info kept in object implementing this interface
virtual IOResult Save(ISave* isave) { return IO_OK; };
virtual IOResult Load(ILoad* iload) { return IO_OK; };
// --- from GenericInterface
DllExport virtual BaseInterface* CloneInterface(void* remapDir = NULL);
// --- our own methods
DllExport IFaceDataMgrImpl( );
DllExport virtual ~IFaceDataMgrImpl( );
// --- typedefs
class CopyFaceDataCB : public IFaceDataChannelsEnumCallBack
{
public:
DllExport virtual BOOL Proc( IFaceDataChannel* pChan, void* pContext );
};
class DeleteFaceDataSetCB : public IFaceDataChannelsEnumCallBack
{
public:
DllExport virtual BOOL Proc( IFaceDataChannel* pChan, void* pContext );
};
protected:
FaceDataChannels fDataChans;
};
#endif
@@ -0,0 +1,371 @@
/**********************************************************************
*<
FILE: IGeomImp.h
DESCRIPTION: Declaration of the interface which a puppet must implement.
A puppet is essentially a geometry machine with a series of
set poses and operations.
CREATED BY: John Hutchinson
HISTORY: Dec 9, 1997
*> Copyright (c) 1997, All Rights Reserved.
**********************************************************************/
#ifndef __IGEOMPUPPET_H
#define __IGEOMPUPPET_H
#include "export.h"
#include <windows.h>
#include "maxtypes.h"
//FIX ME
//THis should not depend on GE
//but for now we use some of its classes
class AcGePoint3d;
class AcGeVector3d;
class AcGePlane;
class AcGePoint2d;
class AcGeVector2d;
#define OP_TIMING
//FIX ME
//This shouldn't depend on amodeler
//but for now we use some of its classes
//JH 3/9/99 Removing references to vertexdata
//#include "../msdkamodeler/inc/vertdata.h"
//need the mesh class for TriangulateMesh
#include "max.h"
class INode;
class ViewExp;
extern inline AcGePoint3d* MaxArToGeAr(const Point3* maxPt, int numverts);
#define MAX_MESH_ID 0x00000001
#define AMODELER_BODY_ID 0x00000002
#define AMODELER_BODY_EX_ID 0x00000003
class OpTimer;
class IGeomImp {
enum TesselationType
{
kTriangles,
kQuadrilaterals,
kTriStrips
};
protected:
public:
static DllExport OpTimer opstatistics; //exported from core, initialized in hostcomp.cpp
//access to the actual internal geometry representation
// virtual void SetInternalRepresentation(LONG RepID, void *rep);
virtual ~IGeomImp(void) {};
virtual void Init(void *prep = NULL, LONG RepID = -1) = 0;
virtual void *GetInternalRepresentation(LONG RepID, bool* needsdelete)= 0;// access to the wrapped cache
virtual LONG NativeRepresentationID() = 0;
///////////////////////////////////////////////////////////////////////////
//
// pseudoconstructors
//
//JH In the process of overloading these for ease of use in MAX 03/26/99
virtual bool createBox(const Point3& p) = 0;
virtual bool createBox(const AcGePoint3d& p, const AcGeVector3d& vec) = 0;
virtual bool createSphere(float radius, int sides, BOOL smooth = TRUE) = 0;
virtual bool createSphere(const AcGePoint3d& p, double radius, int approx) = 0;
virtual bool createCylinder(float height, float radius, int sides , BOOL smooth = TRUE) = 0;
virtual bool createCylinder(const AcGePoint3d& axisStart, const AcGePoint3d& axisEnd,
double radius, int approx) = 0;
virtual bool createCone(float height, float radius1, float radius2, int sides , BOOL smooth = TRUE) = 0;
virtual bool createCone(const AcGePoint3d& axisStart, const AcGePoint3d& axisEnd,
const AcGeVector3d& baseNormal, double radius1, double radius2, int approx) = 0;
virtual bool createPipe(float height, float radius1, float radius2, int sides , BOOL smooth = TRUE) = 0;
virtual bool createPipe(const AcGePoint3d& axisStart, const AcGePoint3d& axisEnd,
const AcGeVector3d& baseNormal,
double dblOuterRadius, double dblInnerRadius,
int approx) = 0;
virtual void createPipeConic(const AcGePoint3d& axisStart, const AcGePoint3d& axisEnd,
const AcGeVector3d& baseNormal,
double outterRadius1, double innerRadius1,
double outterRadius2, double innerRadius2,
int approx) = 0;
virtual void createTetrahedron(const AcGePoint3d& p1, const AcGePoint3d& p2,
const AcGePoint3d& p3, const AcGePoint3d& p4) = 0;
virtual bool createTorus(float majorRadius, float minorRadius, int sidesa, int segs, BOOL smooth = TRUE) = 0;
virtual bool createTorus(const AcGePoint3d& axisStart, const AcGePoint3d& axisEnd,
double majorRadius, double minorRadius, int majorApprox, int minorApprox) = 0;
/*
virtual void createReducingElbow(const AcGePoint3d& elbowCenter, const AcGePoint3d& endCenter1,
const AcGePoint3d& endCenter2, double endRadius1, double endRadius2,
int majorApprox, int minorApprox) = 0;
virtual void createRectToCircleReducer(
const AcGePoint3d& baseCorner,
const AcGeVector2d& baseSizes,
const AcGePoint3d& circleCenter,
const AcGeVector3d& circleNormal,
double circleRadius,
int approx) = 0;
*/
virtual bool createConvexHull(const AcGePoint3d vertices[], int numVertices) = 0;
virtual bool createConvexHull(const Point3 vertices[], int numVertices) = 0;
// Create a body consisting of one face
//
/*
virtual void createFace(const AcGePoint3d vertices[], AModeler::PolygonVertexData* vertexData[],
int numVertices, const AcGeVector3d &normal) = 0;
*/
virtual void createFace(const AcGePoint3d vertices[], int numVertices, BOOL smooth = TRUE) = 0;
//The boolean operators
virtual void prepBoolean(unsigned short opnum = 0) = 0;
virtual void operator +=(IGeomImp& b) = 0;
virtual void operator -=(IGeomImp& b) = 0;
virtual void operator *=(IGeomImp& b) = 0;
virtual int interfere (IGeomImp& b) = 0;
//combination
virtual bool Combine(IGeomImp& b) = 0;
//assignment
virtual IGeomImp& operator =(IGeomImp& b) = 0;
// The section method removes part of the body in the positive halfplane
//
virtual void section(const Matrix3& tm) = 0;
virtual void section(const AcGePlane& p) = 0;
// Sweeps
//
virtual bool createPyramid(float width, float depth, float height)=0;
virtual bool createPyramid(
const AcGePoint3d vertices[],
// AModeler::PolygonVertexData* vertexData[],
int numVertices,
const AcGeVector3d &plgNormal,
const AcGePoint3d &apex) = 0;
// virtual bool createExtrusion(const Point3 vertices[], int numVertices, const float height )=0;
virtual bool createExtrusion(
PolyPt vertices[],
int numVertices,
const float height,
const BOOL smooth,
const BOOL genMatIDs,
const BOOL useShapeIDs)=0;
virtual bool createExtrusion(
const AcGePoint3d vertices[],
// AModeler::PolygonVertexData* vertexData[],
int numVertices,
const AcGeVector3d &plgNormal,
const AcGeVector3d &extusionVector,
const AcGePoint3d &fixedPt,
double scaleFactor,
double twistAngle) = 0;
virtual void createAxisRevolution(
const AcGePoint3d vertices[],
// AModeler::PolygonVertexData* vertexData[],
int numVertices,
const AcGeVector3d &normal,
const AcGePoint3d &axisStart,
const AcGePoint3d &axisEnd,
double revolutionAngle,
int approx,
const AcGePoint3d &fixedPt,
double scaleFactor,
double twistAngle) = 0;
virtual void createEndpointRevolution(
const AcGePoint3d vertices[],
// AModeler::PolygonVertexData* vertexData[],
int numVertices,
const AcGeVector3d &normal,
double revolutionAngle,
int approx)=0;
/*
void createSkin(
AsdkBody* profiles[],
int numProfiles,
bool isClosed,
MorphingMap* morphingMaps[]);
*/
//Max-friendly overload
virtual bool createExtrusionAlongPath(
const PolyPt profilevertices[],
int profileNumVertices,
const PolyPt pathvertices[],
int pathNumVertices,
bool pathIsClosed,
bool bCheckValidity,
const Point3 &scaleTwistFixedPt,
double scaleFactor,
double twistAngle) = 0;
virtual bool createExtrusionAlongPath(
const AcGePoint3d profilevertices[],
int profileNumVertices,
const AcGePoint3d pathvertices[],
int pathNumVertices,
bool pathIsClosed,
bool bCheckValidity,
const AcGePoint3d &scaleTwistFixedPt,
double scaleFactor,
double twistAngle) = 0;
virtual void createWallCorner(
const AcGePoint2d& pt1, // Start of wall 1
const AcGePoint2d& pt2, // End of wall 1, start of wall 2
const AcGePoint2d& pt3, // End of wall 2
bool materialToTheLeft,
double width1, // Wall 1 width
double width2, // Wall 2 width
double height, // Wall height
AcGePlane& matingPlane1,
AcGePlane& matingPlane2,
bool& wall1NeedsToBeSectioned,
bool& wall2NeedsToBeSectioned) = 0;
///////////////////////////////////////////////////////////////////////////
//
// transforms
//
virtual void transform(Matrix3 & mat, bool override_locks = true) = 0;
///////////////////////////////////////////////////////////////////////////
//
// triangulation
//
// Saves the triangles directly to a Mesh //
virtual void triangulateMesh(TimeValue t, Mesh& m,
TesselationType type = kTriangles, bool cacheTriangles = true) = 0;
/* TO DO
// saves the triangle back to the callback object
virtual void triangulate (TimeValue t, OutputTriangleCallback*,
TriangulationType type = kGenerateTriangles, bool cacheTriangles = true) = 0;
*/
///////////////////////////////////////////////////////////////////////////
//
// display
//
virtual void Display(TimeValue t, INode* inode, ViewExp *vpt, int flags) = 0;
virtual void Invalidate() = 0;
//Validity
virtual bool isNull() = 0;
//////////////////////////////////////////////////////////////////////////
//
// Copy
//
virtual IGeomImp * Copy(void) = 0;
//////////////////////////////////////////////////////////////////////////
//
// BondingBox methods
//
virtual void GetDeformBBox(TimeValue t, Box3& box, Matrix3 *tm=NULL, BOOL useSel=FALSE ) = 0;
//////////////////////////////////////////////////////////////////////////
//
// Constraining transform
//
virtual bool GetTransformLock(int type, int axis) = 0;
virtual void SetTransformLock(int type, int axis, BOOL onOff) = 0;
//////////////////////////////////////////////////////////////////////////
//
// Material ID offset.
//
virtual void SetMaterialBase(int matidx) = 0;
virtual int OpCount() = 0;
};
//#ifdef IMPORTING
//#error
//#endif
#define HIRES
class OpTimer: public MeshOpProgress
{
private:
#ifdef HIRES
LARGE_INTEGER opstart;
LARGE_INTEGER optime;
LARGE_INTEGER cumtime;
LARGE_INTEGER res;
#else
int opstart, optime, cumtime;
#endif
int m_errorcode;
int m_errcount;
int m_opcount;
TSTR curopname;
public:
//From MeshOpProgress
OpTimer():m_errorcode(0), m_opcount(0){curopname = "??";}
void Init(int total)
{
++m_opcount;
m_errorcode = 0;
#ifdef HIRES
QueryPerformanceFrequency(&res);
optime.QuadPart = 0;
QueryPerformanceCounter(&opstart);
#else
opstart = GetTickCount();
#endif
}
BOOL Progress(int p)
{
#ifdef HIRES
LARGE_INTEGER opnow;
QueryPerformanceCounter(&opnow);
cumtime.QuadPart += (opnow.QuadPart - (opstart.QuadPart + optime.QuadPart));
optime.QuadPart = opnow.QuadPart - opstart.QuadPart;
#else
integer opnow = GetTickCount();
cumtime += (opnow - (opstart + optime));
optime = opnow - opstart;
#endif
return true;
}
void OutputMetrics(HWND hDlg);
void InitName(char *opname){curopname = opname;}
void ExtendName(char *opname){curopname += opname;}
void FlagError(int errcode = 999){m_errorcode = errcode;++m_errcount;}
void Reset(){
m_errcount = 0; m_opcount=0;
#ifdef HIRES
cumtime.QuadPart = 0;
#else
optime = 0;
#endif
}
};
extern "C" __declspec(dllexport) IGeomImp* CreateAmodelerBody();
extern "C" __declspec(dllexport) IGeomImp* CreateMeshAdapter();
#endif //__IGEOMPUPPET_H
@@ -0,0 +1,30 @@
/**********************************************************************
*<
FILE: IGuest.h
DESCRIPTION: Declares Host/Guest protocol
CREATED BY: John Hutchinson
HISTORY: Created April 24, 1999
*> Copyright (c) 1994, All Rights Reserved.
**********************************************************************/
#pragma once
class IGeomImp;
class IHost;
class IGuest
{
public:
virtual void rsvp(IHost* host, IGeomImp* return_envelope, Matrix3& tm) = 0;
};
class IHost
{
public:
virtual void accomodate(IGeomImp* guestrep, Matrix3 &tm, HitRecord *rec = NULL) = 0;
virtual bool locate(INode *host, Control *c, Matrix3 &oldP, Matrix3 &newP) = 0;
};
@@ -0,0 +1,30 @@
/**********************************************************************
*<
FILE: IHardwareMNMesh.h
DESCRIPTION: Hardware MNMesh Extension Interface
CREATED BY: Norbert Jeske
HISTORY: Created 10/11/00
*> Copyright (c) 2000, All Rights Reserved.
**********************************************************************/
#ifndef _HARDWARE_MNMESH_H_
#define _HARDWARE_MNMESH_H_
#define HARDWARE_MNMESH_INTERFACE_ID Interface_ID(0x65b154eb, 0x87d2b74)
class MNMesh;
class IHardwareMNMesh : public BaseInterface
{
public:
virtual Interface_ID GetID() { return HARDWARE_MNMESH_INTERFACE_ID; }
// Interface Lifetime
virtual LifetimeType LifetimeControl() { return noRelease; }
};
#endif
@@ -0,0 +1,30 @@
/**********************************************************************
*<
FILE: IHardwareMesh.h
DESCRIPTION: Hardware Mesh Extension Interface
CREATED BY: Norbert Jeske
HISTORY: Created 10/10/00
*> Copyright (c) 2000, All Rights Reserved.
**********************************************************************/
#ifndef _HARDWARE_MESH_H_
#define _HARDWARE_MESH_H_
#define HARDWARE_MESH_INTERFACE_ID Interface_ID(0x6215327f, 0x6fb14d7a)
class Mesh;
class IHardwareMesh : public BaseInterface
{
public:
virtual Interface_ID GetID() { return HARDWARE_MESH_INTERFACE_ID; }
// Interface Lifetime
virtual LifetimeType LifetimeControl() { return noRelease; }
};
#endif
@@ -0,0 +1,268 @@
/**********************************************************************
*<
FILE: IHardwareShader.h
DESCRIPTION: Hardware Shader Extension Interface class
CREATED BY: Norbert Jeske
HISTORY:
*> Copyright (c) 2000, All Rights Reserved.
**********************************************************************/
#ifndef _HARDWARE_SHADER_H_
#define _HARDWARE_SHADER_H_
#define HARDWARE_SHADER_INTERFACE_ID Interface_ID(0x7bbd585b, 0x75bb641c)
#define GFX_MAX_COLORS 2
class Mesh;
class MNMesh;
class TriStrip {
public:
DWORD rndMode;
MtlID mID;
DWORD smGrp;
int clrMode;
int texMode;
DWTab v;
DWTab n;
DWTab c[GFX_MAX_COLORS];
DWTab tv[GFX_MAX_TEXTURES];
TriStrip()
: rndMode(0),
mID(0),
smGrp(0),
clrMode(0),
texMode(0)
{}
void AddVertN(DWORD vtx, DWORD nor) { v.Append(1, &vtx); n.Append(1, &nor); }
void AddVertNC1(DWORD vtx, DWORD nor, DWORD col) { v.Append(1, &vtx); n.Append(1, &nor); c[0].Append(1, &col); }
void AddVertNT1(DWORD vtx, DWORD nor, DWORD tvtx) {
v.Append(1, &vtx); n.Append(1, &nor);
tv[0].Append(1, &tvtx);
}
void AddVertNC1T1(DWORD vtx, DWORD nor, DWORD col, DWORD tvtx) {
v.Append(1, &vtx); n.Append(1, &nor); c[0].Append(1, &col);
tv[0].Append(1, &tvtx);
}
void AddVertNT2(DWORD vtx, DWORD nor, DWORD tvtx1, DWORD tvtx2) {
v.Append(1, &vtx); n.Append(1, &nor);
tv[0].Append(1, &tvtx1); tv[1].Append(1, &tvtx2);
}
void AddVertNC1T2(DWORD vtx, DWORD nor, DWORD col, DWORD tvtx1, DWORD tvtx2) {
v.Append(1, &vtx); n.Append(1, &nor); c[0].Append(1, &col);
tv[0].Append(1, &tvtx1); tv[1].Append(1, &tvtx2);
}
void AddVertNT3(DWORD vtx, DWORD nor, DWORD tvtx1, DWORD tvtx2, DWORD tvtx3) {
v.Append(1, &vtx); n.Append(1, &nor);
tv[0].Append(1, &tvtx1); tv[1].Append(1, &tvtx2); tv[2].Append(1, &tvtx3);
}
void AddVertNC1T3(DWORD vtx, DWORD nor, DWORD col, DWORD tvtx1, DWORD tvtx2, DWORD tvtx3) {
v.Append(1, &vtx); n.Append(1, &nor); c[0].Append(1, &col);
tv[0].Append(1, &tvtx1); tv[1].Append(1, &tvtx2); tv[2].Append(1, &tvtx3);
}
void AddVertNT4(DWORD vtx, DWORD nor, DWORD tvtx1, DWORD tvtx2, DWORD tvtx3, DWORD tvtx4) {
v.Append(1, &vtx); n.Append(1, &nor);
tv[0].Append(1, &tvtx1); tv[1].Append(1, &tvtx2); tv[2].Append(1, &tvtx3); tv[3].Append(1, &tvtx4);
}
void AddVertNC1T4(DWORD vtx, DWORD nor, DWORD col, DWORD tvtx1, DWORD tvtx2, DWORD tvtx3, DWORD tvtx4) {
v.Append(1, &vtx); n.Append(1, &nor); c[0].Append(1, &col);
tv[0].Append(1, &tvtx1); tv[1].Append(1, &tvtx2); tv[2].Append(1, &tvtx3); tv[3].Append(1, &tvtx4);
}
};
typedef TriStrip *TriStripPtr;
typedef Tab<TriStripPtr> TriStripTab;
class MeshData
{
public:
int numStrips;
TriStripTab *strips;
DWORD mapFlags;
int numXYZ;
Point3 *xyz;
int numNor;
Point3 *nor;
int numRGB[GFX_MAX_COLORS];
Point3 *rgb[GFX_MAX_COLORS];
int numUVW[GFX_MAX_TEXTURES];
Point3 *uvw[GFX_MAX_TEXTURES];
MeshData()
: numStrips(0),
strips(NULL),
mapFlags(0),
numXYZ(0),
xyz(NULL),
numNor(0),
nor(NULL)
{
int kk;
for (kk = 0; kk < GFX_MAX_COLORS; kk++) {
numRGB[kk] = 0;
rgb[kk] = NULL;
}
for (kk = 0; kk < GFX_MAX_TEXTURES; kk++) {
numUVW[kk] = 0;
uvw[kk] = NULL;
}
}
};
class WireMeshData
{
public:
int numFaces;
GWFace *faces;
int numXYZ;
Point3 *xyz;
int displayFlags;
BitArray *faceSel;
BitArray *edgeSel;
int numMat;
Material *mtlArray;
WireMeshData()
: numFaces(0),
faces(NULL),
numXYZ(0),
xyz(NULL),
displayFlags(0),
faceSel(NULL),
edgeSel(NULL),
numMat(0),
mtlArray(NULL)
{}
};
class MeshFaceData
{
public:
int numFaces;
GWFace *faces;
Point3 *faceNor;
DWORD mapFlags;
Point3 selectClr;
int numClrFaces[GFX_MAX_COLORS];
GWFace *clrFaces[GFX_MAX_COLORS];
int numTexFaces[GFX_MAX_TEXTURES];
GWFace *texFaces[GFX_MAX_TEXTURES];
int numXYZ;
Point3 *xyz;
int numNor;
Point3 *nor;
int numRGB[GFX_MAX_COLORS];
Point3 *rgb[GFX_MAX_COLORS];
int numUVW[GFX_MAX_TEXTURES];
Point3 *uvw[GFX_MAX_TEXTURES];
MeshFaceData()
: numFaces(0),
faces(NULL),
faceNor(NULL),
mapFlags(0),
selectClr(0,0,0),
numXYZ(0),
xyz(NULL),
numNor(0),
nor(NULL)
{
int kk;
for (kk = 0; kk < GFX_MAX_COLORS; kk++) {
numClrFaces[kk] = 0;
clrFaces[kk] = NULL;
numRGB[kk] = 0;
rgb[kk] = NULL;
}
for (kk = 0; kk < GFX_MAX_TEXTURES; kk++) {
numTexFaces[kk] = 0;
texFaces[kk] = NULL;
numUVW[kk] = 0;
uvw[kk] = NULL;
}
}
};
class IHardwareShader : public BaseInterface
{
public:
virtual Interface_ID GetID() { return HARDWARE_SHADER_INTERFACE_ID; }
virtual Interface_ID GetVSID() = 0;
virtual Interface_ID GetPSID() = 0;
// Interface Lifetime
virtual LifetimeType LifetimeControl() { return noRelease; }
// Start to draw object
virtual void StartObject(Mesh *mesh) = 0;
virtual void StartObject(MNMesh *mnmesh) = 0;
// Initialize HardwareShader first time or frame-by-frame
virtual void InitializeShaders(Mesh *mesh, BaseInterface *pbvs, Material *mtlArray, int numMtl, GFX_ESCAPE_FN fn) = 0;
virtual void InitializeShaders(MNMesh *mnmesh, BaseInterface *pbvs, Material *mtlArray, int numMtl, GFX_ESCAPE_FN fn) = 0;
// Try to draw as tristrips?
virtual bool CanTryStrips() = 0;
// Retrive the current rendering mode
virtual DWORD GetRndMode() = 0;
// Retrieve a Material
virtual Material *GetMaterial(int numMat) = 0;
// Set a Material
virtual void SetMaterial(const Material &m, int index=0) = 0;
// Retrieve number of passes for specified Material in Material array
virtual int GetNumMultiPass(int numMtl) = 0;
// Set the number of the current pass
virtual void SetNumMultiPass(int numPass) = 0;
// Draw 3D mesh as TriStrips
virtual void DrawMeshStrips(MeshData *data, GFX_ESCAPE_FN fn) = 0;
// Draw 3D mesh as wireframe
virtual void DrawWireMesh(WireMeshData *data, GFX_ESCAPE_FN fn) = 0;
// Draw 3D lines
virtual void StartLines(WireMeshData *data) = 0;
virtual void AddLine(DWORD *vert, int vis) = 0;
virtual void DrawLines() = 0;
virtual void EndLines(GFX_ESCAPE_FN fn) = 0;
// Draw 3D triangles
virtual void StartTriangles(MeshFaceData *data) = 0;
virtual void AddTriangle(DWORD index, int *edgeVis) = 0;
virtual void DrawTriangles() = 0;
virtual void EndTriangles(GFX_ESCAPE_FN fn) = 0;
// End of drawing object
virtual void EndObject(Mesh *mesh) = 0;
virtual void EndObject(MNMesh *mnmesh) = 0;
};
class IVertexShader
{
public:
// Load VertexShader instructions, create any additional per vertex data on
// a per node basis. VertexShader instructions should be loaded once and
// shared among all the nodes using this VertexShader. Additional per
// vertex data should be (re)created only when the associated node data
// changes. In addition, if there is sufficient memory, VertexBuffers can
// be created and updated only when node data changes in order to improve
// rendering performance.
virtual HRESULT Initialize(Mesh *mesh, INode *node) = 0;
virtual HRESULT Initialize(MNMesh *mnmesh, INode *node) = 0;
};
#endif
@@ -0,0 +1,204 @@
/**********************************************************************
*<
FILE: IIKSys.h
DESCRIPTION: Interfaces into IK sub-system classes/functions.
CREATED BY: Jianmin Zhao
HISTORY: created 3 April 2000
*> Copyright (c) 1994, All Rights Reserved.
**********************************************************************/
#ifndef __IIKSys__H
#define __IIKSys__H
#include "iFnPub.h"
// Class ids
#define IKCONTROL_CLASS_ID Class_ID(0xe6f5815, 0x717f99a4)
#define IKCHAINCONTROL_CLASS_ID Class_ID(0x78724378, 0x8a4fd9)
#define GET_IKCHAIN_CD (GetCOREInterface()->GetDllDir().ClassDir().FindClass(CTRL_MATRIX3_CLASS_ID, IKCHAINCONTROL_CLASS_ID))
#define IK_FP_INTERFACE_ID Interface_ID(0x5b734601, 0x7c7c7ece)
#define IKCHAIN_FP_INTERFACE_ID Interface_ID(0x5a5e7cbe, 0x55367776)
#define GET_IK_OPS_INTERFACE ((IKCmdOps*)GetCOREInterface(IK_FP_INTERFACE_ID))
#define GET_IKCHAIN_FP_INTERFACE ((IKChainActions*)GET_IKCHAIN_CD->GetInterface(IKCHAIN_FP_INTERFACE_ID))
class IKCmdOps : public FPStaticInterface {
public:
virtual INode* CreateIKChain(INode* start, INode* end, const TCHAR* solver) =0;
};
class IKChainActions : public FPStaticInterface {
public:
virtual FPStatus SnapAction() =0;
virtual FPStatus IKSnapAction() =0;
virtual FPStatus FKSnapAction() =0;
virtual BOOL IsSnapEnabled() =0;
};
namespace IKSys {
class ZeroPlaneMap;
}
//
// IIKChainControl
//
class IKSolver;
class IIKChainControl {
public:
// Reference index:
//
enum {
kPBlockRef = 0, // ParamBlock
kGoalTMRef, // Matrix3 controller
kEndJointRef, // INode
kEnableRef, // Bool (float) controller
kStartJointRef, // INode
kLastRef
};
// Parameter block index:
//
enum {
kParamBlock,
kNumParamBlocks
};
// Paramter index of parameters in param-block of index kParamBlock:
//
enum {
kStartJoint, // INode, referenced by kStartJointRef
kEndJoint, // INode, referenced by kEndJointRef
kSolverName, // String
kAutoEnable, // BOOL
kSwivel, // Angle
kPosThresh, // Float
kRotThresh, // Float
kIteration, // Integer
kEEDisplay, // BOOL
kEESize, // Float
kGoalDisplay, // BOOL
kGoalSize, // Float
kVHDisplay, // BOOL
kVHSize, // Float
kVHLength, // Float
kSolverDisplay, // BOOL
kAutoSnap, // BOOL
kVHUseTarget, // BOOL
kVHTarget, // INode
kSAParent, // RadioBtn_Index
kLastParam
};
enum SAParentSpace {
kSAInGoal,
kSAInStartJoint
};
// IK chain delimiters
virtual INode* StartJoint() const =0;
virtual INode* EndJoint() const =0;
virtual INode* GetNode() const =0;
// Vector Handle
// InitPlane/InitEEAxis are the normal and End Effector Axis at the
// initial pose. They are represented in the parent space.
// ChainNormal is the InitPlane represented in the object space:
// InitPlane() == ChainNormal * StartJoint()->InittialRotation()
virtual Point3 ChainNormal(TimeValue t, Interval& valid) =0;
virtual Point3 InitPlane(TimeValue t) =0;
virtual Point3 InitEEAxis(TimeValue t) =0;
virtual float InitChainLength(TimeValue t) =0;
virtual float SwivelAngle(TimeValue, Interval&)=0;
virtual const IKSys::ZeroPlaneMap*
DefaultZeroPlaneMap(TimeValue t) =0;
virtual SAParentSpace SwivelAngleParent() const =0;
// Solver
virtual IKSolver* Solver() const =0;
virtual bool SolverEnabled(TimeValue, Interval* =0)=0;
virtual bool CanAutoEnable() const =0;
virtual bool AutoEnableSet() const =0;
virtual bool Valid() const =0;
};
namespace IKSys {
enum DofAxis {
TransX = 0, TransY, TransZ,
RotX, RotY, RotZ,
DofX = 0, DofY, DofZ
};
enum JointType {
SlidingJoint,
RotationalJoint
};
struct DofSet {
DofSet() : bits(0) {}
DofSet(const DofSet& src) : bits(src.bits) {}
void Add(DofAxis dn) { bits |= (1 << dn); }
void Clear(DofAxis dn) { bits &= ~(unsigned(1 << dn)); }
int Include(DofAxis dn) const { return bits & (1 << dn); }
int Count() const;
unsigned bits;
};
inline int DofSet::Count() const
{
for (unsigned b = bits, ret = 0, i = TransX; i <= RotZ; ++i) {
if (b == 0) break;
else if (b & 01u) {
ret++;
}
b = b >> 1;
}
return ret;
}
}; // namespace IKSys
//
// IIKControl
//
class IIKControl {
public:
typedef IKSys::DofAxis DofAxis;
typedef IKSys::JointType JointType;
typedef IKSys::DofSet DofSet;
//Queries
virtual bool DofActive(DofAxis) const =0;
virtual DofSet ActiveTrans() const =0;
virtual DofSet ActiveRot() const =0;
virtual DofSet ActiveDofs() const =0;
virtual INodeTab IKChains(JointType) const =0;
virtual bool DofLowerLimited(DofAxis) const =0;
virtual bool DofUpperLimited(DofAxis) const =0;
virtual Point2 DofLimits(DofAxis) const =0;
virtual Point3 TransLowerLimits() const =0;
virtual Point3 TransUpperLimits() const =0;
virtual Point3 RotLowerLimits() const =0;
virtual Point3 RotUpperLimits() const =0;
virtual bool IKBound(TimeValue t, JointType jt)=0;
virtual Control* FKSubController() const =0;
virtual INode* GetNode() const =0;
virtual Point3 PrefPosition(TimeValue t, Interval& validityInterval) =0;
virtual Point3 PrefRotation(TimeValue t, Interval& validityInterval) =0;
// DOF values
virtual Point3 TransValues(TimeValue, Interval* =0)=0;
virtual Point3 RotValues(TimeValue, Interval* =0)=0;
virtual void AssignTrans(const Point3&, const Interval&)=0;
virtual void AssignRot(const Point3&, const Interval&)=0;
virtual void AssignActiveTrans(const Point3&, const Interval&)=0;
virtual void AssignActiveRot(const Point3&, const Interval&)=0;
virtual void AssignActiveTrans(const DofSet&, const float[],
const Interval&)=0;
virtual void AssignActiveRot(const DofSet&, const float[],
const Interval&)=0;
virtual void SetTransValid(const Interval& valid) =0;
virtual void SetRotValid(const Interval& valid) =0;
virtual void SetTRValid(const Interval& valid) =0;
virtual void SetPrefTrans(const Point3& val, TimeValue t =0) =0;
virtual void SetPrefRot(const Point3& val, TimeValue t =0) =0;
virtual void SetPrefTR(const Point3& trans, const Point3& rot,
TimeValue t =0) =0;
};
#endif // #ifndef __IIKSys__H
@@ -0,0 +1,384 @@
/**********************************************************************
*<
FILE: IKHierarchy.h
DESCRIPTION: Geometrical representation of the ik problem. Note that
this file should not dependent on Max SDK, except for
some math classes, such as Matrix3, Point3, etc.
CREATED BY: Jianmin Zhao
HISTORY: created 16 March 2000
*> Copyright (c) 1994, All Rights Reserved.
**********************************************************************/
#ifndef __IKHierarchy__H
#define __IKHierarchy__H
namespace IKSys {
class ZeroPlaneMap {
public:
virtual Point3 operator()(const Point3& EEAxis) const =0;
virtual ~ZeroPlaneMap() {}
};
// A LinkChain consists of a RootLink and a number of Links.
// A RootLink consists of a rotation plus a rigidExtend. It transforms
// like this:
// To_Coordinate_Frame = rigidExtend * rotXYZ * From_Coordinate_Frame.
// where rotXYZ = Rot_x(rotXYZ[0]) * Rot_y(rotXYZ[1]) * Rot_z(rotXYZ[2]).
//
// * Note that not all the x, y, and z, are degrees of freedom. Only
// Active() ones are. We put the whole rotation here so that some
// solver may choose to use it as a full rotation and then clamp the
// result to the permissible range.
//
// * LinkMatrix(bool include_rot) returns rigidExtend if include_rot is
// false and returns the whole matrix from the From_Coordinate_Fram to
// To_Coordinate_Frame, i.e., rigidExtend*rotXYZ.rotXYZ are not all degrees of freedom. Only the active ones are.
//
// * Matrix3& ApplyLinkMatrix(Matrix3& mat, bool) applies the LinkMatrix() to
// the input matrix from the left, i.e., mat = LinkMatrix(bool)*mat,
// and returns the reference to the input matrix.
//
// * Matrix3& RotateByAxis(Matrix3&, unsigned i) pre-applies the
// rotation about x, y, or z (corresponding to i=0,1,or 2).
// Therefore, starting with the identity matrix, mat,
// ApplyLinkMatrix(
// RotateByAxis(
// RotateByAxis(
// RotateByAxis(mat, 2),
// 1),
// 0),
// false)
// should equal to LinkMatrix(true).
//
class RootLink {
public:
RootLink():flags(7){} // x,y,z, are all active. No joint limits.
Point3 rotXYZ;
Point3 initXYZ;
Point3 llimits;
Point3 ulimits;
Matrix3 rigidExtend;
bool GetActive(unsigned i) const { return flags&(1<<i)?true:false;}
bool GetLLimited(unsigned i) const { return flags&(1<<(i+3))?true:false;}
bool GetULimited(unsigned i) const { return flags&(1<<(i+6))?true:false;}
Matrix3& RotateByAxis(Matrix3& mat, unsigned i) const;
Matrix3 LinkMatrix(bool include_rot) const;
Matrix3& ApplyLinkMatrix(Matrix3& mat, bool include_rot) const;
// Set methods:
//
void SetActive(unsigned i, bool s);
void SetLLimited(unsigned i, bool s);
void SetULimited(unsigned i, bool s);
private:
unsigned flags;
};
// A Link is a 1-dof rotation followed by a rigidExtend. The dof
// axis is specified by dofAxis. It is always active.
//
// * LinkMatrix(true) == rigidExtend * Rotation(dofAxis, dofValue).
// LinkMatrix(false) == rigidExtend.
//
// * Matrix3& ApplyLinkMatrix(Matrix3& mat, bool) pre-applies the
// LinkMatrix(bool) to the input matrix, mat.
//
// * A typical 3-dof (xyz) joint is decomposed into three links. z and
// y dofs don't have rigid extension, called NullLink(). Let's use
// ++o
// to denote NullLink() and
// ---o
// to denote !NullLink(). Then, a 3-dof joint will be decomposed into
// three Links, as:
// ---o++o++o
// x y z
//
// * For an xyz rotation joint, if y is not active (Active unchecked),
// then y will be absorbed into the z-link, as:
// ---o---o
// x z
// In this case, the z-link is not NullLink(). But its length is
// zero. It is called ZeroLengh() link.
//
class Link {
public:
Link():rigidExtend(0),dofAxis(RotZ){}
~Link(){if (rigidExtend) delete rigidExtend; rigidExtend = 0;}
enum DofAxis {
TransX,
TransY,
TransZ,
RotX,
RotY,
RotZ
};
DofAxis dofAxis;
float dofValue;
float initValue;
Point2 limits;
bool NullLink() const {return rigidExtend?false:true;}
bool ZeroLength() const {
return NullLink() ? true :
(rigidExtend->GetIdentFlags() & POS_IDENT) ? true : false; }
bool LLimited() const { return llimited?true:false; }
bool ULimited() const { return ulimited?true:false; }
Matrix3 DofMatrix() const;
Matrix3& DofMatrix(Matrix3& mat) const;
Matrix3 LinkMatrix(bool include_dof =true) const;
Matrix3& ApplyLinkMatrix(Matrix3& mat, bool include_dof =true) const;
// Set methods:
//
void SetLLimited(bool s) { llimited = s?1:0; }
void SetULimited(bool s) { ulimited = s?1:0; }
void SetRigidExtend(const Matrix3& mat);
private:
Matrix3* rigidExtend;
byte llimited : 1;
byte ulimited : 1;
};
// A LinkChain consists of a RootLink and LinkCount() of Links.
//
// * parentMatrix is where the root joint starts with respect to the
// world. It should not concern the solver. Solvers should derive their
// solutions in the parent space.
//
// * goal is represented in the parent space, i.e.,
// goal_in_world = goal * parentMatrix
//
// * Bone(): The Link of index i may be a NullLink(). Bone(i) gives
// the index j so that j >= i and LinkOf(j).NullLink() is false. If j
// >= LinkCount() means that the chain ends up with NullLink().
//
// * PreBone(i) gives the index, j, so that j < i and LinkOf(j) is not
// NullLink(). For the following 3-dof joint:
// ---o++o++o---o
// i
// Bone(i) == i+1, and PreBone(i) == i-2. Therefore, degrees of
// freedom of LinkOf(i) == Bone(i) - PreBone(i).
//
// * A typical two bone chain with elbow being a ball joint has this
// structure:
// ---o++o++o---O
// 2 1 0 rootLink
// It has 3 links in addition to the root link.
//
// * A two-bone chain with the elbow being a hinge joint has this
// structure:
// ---o---O
// 0 rootLink
// It has one link. Geometrically, the axis of LinkOf(0) should be
// perpendicular to the two bones.
//
// * The matrix at the end effector is
// End_Effector_matrix == LinkOf(n-1).LinkMatrix(true) * ... *
// LinkOf(0).LinkMatrix(true) * rootLink.LinkMatrix(true).
//
// * swivelAngle, chainNormal, and defaultZeroMap concerns solvers that
// answer true to IKSolver::UseSwivelAngle().
//
// * chainNormal is the normal to the plane that is intrinsic to the
// chain when it is constructed. It is represented in the object space
// of the root joint.
//
// * A zero-map is a map that maps the end effector axis (EEA) to a
// plane normal perpendicular to the EEA. The IK System will provide a
// default one to the solver. However, a solver may choose to use its
// own.
//
// * Given the swivelAngle, the solver is asked to adjust the rotation
// at the root joint, root_joint_rotation, so that:
// (A) EEA stays fixed
// (B) chainNormal * root_joint_rotation
// == zeroMap(EEA) * RotationAboutEEA(swivelAngle)
// By definition, zeroMap(EEA) is always perpendicular to EEA. At the
// initial pose, chainNormal is also guarranteed to be perpendicular
// to zeroMap(EEA). When it is not, root_joint_rotation has to
// maintain (A) absolutely and satisfy (B) as good as it is possible.
//
class LinkChain {
public:
enum SAParentSpace {
kSAInGoal,
kSAInStartJoint
};
LinkChain():links(0),linkCount(0),defaultZeroMap(0),swivelAngle(0){}
LinkChain(unsigned lc):linkCount(lc),defaultZeroMap(0),swivelAngle(0)
{links = new Link[lc];}
virtual ~LinkChain(){delete[] links; links = NULL;}
virtual void* GetInterface(ULONG i) const { return NULL; }
Matrix3 parentMatrix;
RootLink rootLink;
const Link& LinkOf(unsigned i) const {return links[i];}
Link& LinkOf(unsigned i) {return links[i];}
unsigned LinkCount() const { return linkCount; }
int PreBone(unsigned i) const;
unsigned Bone(unsigned i) const;
bool useVHTarget;
union {
float swivelAngle;
float vhTarget[3];
};
SAParentSpace swivelAngleParent;
Point3 chainNormal; // plane normal
const ZeroPlaneMap* defaultZeroMap;
Matrix3 goal;
protected:
void SetLinkCount(unsigned lc){
delete links;
linkCount = lc;
links = new Link[linkCount];}
private:
Link* links;
unsigned linkCount;
};
// Inlines:
//
inline void RootLink::SetActive(unsigned i, bool s)
{
unsigned mask = 1 << i;
if (s) flags |= mask;
else flags &= ~mask;
}
inline void RootLink::SetLLimited(unsigned i, bool s)
{
unsigned mask = 1 << (3 + i);
if (s) flags |= mask;
else flags &= ~mask;
}
inline void RootLink::SetULimited(unsigned i, bool s)
{
unsigned mask = 1 << (6 + i);
if (s) flags |= mask;
else flags &= ~mask;
}
inline Matrix3& RootLink::RotateByAxis(Matrix3& mat, unsigned i) const
{
switch (i) {
case 0: mat.PreRotateX(rotXYZ[0]); return mat;
case 1: mat.PreRotateY(rotXYZ[1]); return mat;
case 2: mat.PreRotateZ(rotXYZ[2]); return mat;
default: return mat;
}
}
inline Matrix3& RootLink::ApplyLinkMatrix(Matrix3& mat, bool include_rot) const
{
if (include_rot) {
RotateByAxis(mat, 2);
RotateByAxis(mat, 1);
RotateByAxis(mat, 0);
}
mat = rigidExtend * mat;
return mat;
}
inline Matrix3 RootLink::LinkMatrix(bool include_rot) const
{
Matrix3 mat(TRUE);
return ApplyLinkMatrix(mat, include_rot);
}
inline void Link::SetRigidExtend(const Matrix3& mat)
{
if (mat.IsIdentity()) {
if (rigidExtend) {
delete rigidExtend;
rigidExtend = NULL;
}
} else {
if (rigidExtend) *rigidExtend = mat;
else rigidExtend = new Matrix3(mat);
}
}
inline Matrix3 Link::DofMatrix() const
{
switch (dofAxis) {
case TransX:
case TransY:
case TransZ:
{
Point3 p(0.0f,0.0f,0.0f);
p[dofAxis] = dofValue;
return TransMatrix(p);
}
case RotX:
return RotateXMatrix(dofValue);
case RotY:
return RotateYMatrix(dofValue);
case RotZ:
return RotateZMatrix(dofValue);
default:
return Matrix3(1);
}
}
inline Matrix3& Link::DofMatrix(Matrix3& mat) const
{
switch (dofAxis) {
case TransX:
case TransY:
case TransZ:
{
Point3 p(0.0f,0.0f,0.0f);
p[dofAxis] = dofValue;
mat.PreTranslate(p);
}
return mat;
case RotX:
mat.PreRotateX(dofValue); return mat;
case RotY:
mat.PreRotateY(dofValue); return mat;
case RotZ:
mat.PreRotateZ(dofValue); return mat;
default:
return mat;
}
}
inline Matrix3 Link::LinkMatrix(bool include_dof) const
{
Matrix3 ret;
if (include_dof) {
ret = DofMatrix();
ApplyLinkMatrix(ret, false);
} else {
ret = rigidExtend ? *rigidExtend : Matrix3(1);
}
return ret;
}
inline Matrix3& Link::ApplyLinkMatrix(Matrix3& mat, bool include_dof) const
// premultiply mat
{
if (include_dof) DofMatrix(mat);
if (rigidExtend) mat = *rigidExtend * mat;
return mat;
}
inline int LinkChain::PreBone(unsigned i) const
// return number < i. Returning -1 means that the previous bone is the root
// link.
{
for (int j = i - 1; j >= 0; --j)
if (!links[j].ZeroLength()) break;
return j;
}
inline unsigned LinkChain::Bone(unsigned i) const
// return number >= i.
{
for (size_t j = i; j < linkCount; ++j)
if (!links[j].ZeroLength()) break;
return j;
}
}; // namespace IKSys
#endif __IKHierarchy__H
@@ -0,0 +1,72 @@
/**********************************************************************
*<
FILE: IKSolver.h
DESCRIPTION: IK Solver Class definition
CREATED BY: Jianmin Zhao
HISTORY: created 16 March 2000
*> Copyright (c) 1994, All Rights Reserved.
**********************************************************************/
#ifndef __IKSolver__H
#define __IKSolver__H
#include "IKHierarchy.h"
class IKSolver : public BaseInterfaceServer {
public:
typedef unsigned ReturnCondition;
enum ConditionBit {
bLimitReached = 0x00000001,
bLimitClamped = 0x00000002,
bMaxIterationReached = 0x00000004,
// The first eight bits are reserved for mild condition.
// They are still considered successful.
bGoalTooCloseToEE = 0x00000100,
bInvalidArgument = 0x00000200,
bInvalidInitialValue = 0x00000400
};
// Plugins derived from this class are supposed to have this super class id.
virtual SClass_ID SuperClassID() {return IK_SOLVER_CLASS_ID;}
virtual Class_ID ClassID() =0;
virtual void GetClassName(TSTR& s) { s= TSTR(_T("IKSolver")); }
virtual ~IKSolver(){}
// History independent solver does need time input.
virtual bool IsHistoryDependent() const =0;
virtual bool DoesOneChainOnly() const =0;
// Interactive solver does need initial pose. It needs current pose.
virtual bool IsInteractive() const =0;
virtual bool UseSlidingJoint() const =0;
virtual bool UseSwivelAngle() const =0;
// Solutions of an analytic solver is not dependent on Pos/Rot threshold
// or MaxInteration number.
virtual bool IsAnalytic() const { return false; }
// The result will be simply clamped into joint limits by the ik system
// if the solver does not do joint limits.
virtual bool DoesRootJointLimits() const { return false;}
virtual bool DoesJointLimitsButRoot() const { return false;}
// RotThreshold() is not relevant to solver that does not SolveEERotation().
// UseSwivelAngle() and SolveEERotation() cannot both be true.
virtual bool SolveEERotation() const =0;
// A solver may have its own zero map. If so, the IK system may want
// to know through this method.
virtual const IKSys::ZeroPlaneMap*
GetZeroPlaneMap(const Point3& a0, const Point3& n0) const
{ return NULL; }
virtual float GetPosThreshold() const =0;
virtual float GetRotThreshold() const =0;
virtual unsigned GetMaxIteration() const =0;
virtual void SetPosThreshold(float) =0;
virtual void SetRotThreshold(float) =0;
virtual void SetMaxIteration(unsigned) =0;
// The derived class should override this method if it answers true
// to DoesOneChainOnly() and false to HistoryDependent().
// The solver is not designed to be invoked recursively. The
// recursion logic existing among the ik chains is taken care of by
// the Max IK (sub-)System.
virtual ReturnCondition Solve(IKSys::LinkChain&) =0;
};
#endif // #ifndef __IKSolver__H
@@ -0,0 +1,329 @@
#ifndef __ILAG__H
#define __ILAG__H
#include "iFnPub.h"
#define LAZYID 0xDE17A34f, 0x8A41E2B0
class SpringClass
{
public:
Point3 vel, pos, init_pos;
float InheritVel;
BOOL modified;
Point3 LocalPt;
Point3 tempVel[6];
Point3 tempPos[6];
float dist;
float mass;
};
class EdgeBondage
{
public:
float dist;
int v1,v2;
int flags;
};
class CacheClass
{
public:
Point3 vel, pos;
};
class LagModData : public LocalModData {
public:
Tab<EdgeBondage> edgeSprings;
int id;
INode *SelfNode;
Tab<SpringClass> SpringList;
Tab<CacheClass> WholeFrameCache;
Tab<BYTE> esel; //selection for edges vertices
Tab<BYTE> wsel; //vertex weight selection
Tab<BYTE> psel;
Matrix3 InverseTM;
BOOL isMesh;
BOOL isPatch;
BOOL addSprings;
BOOL removeSprings;
BOOL computeEdges;
BOOL ignoreInteriorHandles;
BOOL simpleSoft;
Point3 hitPoint;
BOOL isHit;
TimeValue lastFrame;
BOOL nukeRenderCache;
Tab<Point3> pointCache;
LagModData()
{
SelfNode = NULL;
id = -1;
computeEdges = TRUE;
isMesh = FALSE;
isPatch = FALSE;
lastFrame = 999999999;
nukeRenderCache = TRUE;
addSprings = FALSE;
removeSprings = FALSE;
simpleSoft = FALSE;
}
LagModData(int i, INode *n)
{
id = i;
SelfNode = n;
isMesh = FALSE;
isPatch = FALSE;
lastFrame = 999999999;
nukeRenderCache = TRUE;
computeEdges = TRUE;
addSprings = FALSE;
removeSprings = FALSE;
simpleSoft = FALSE;
}
~LagModData()
{
SelfNode = NULL;
}
LocalModData* Clone()
{
LagModData* d = new LagModData();
d->id = id;
d->SelfNode = NULL;
isMesh = FALSE;
isPatch = FALSE;
computeEdges = TRUE;
addSprings = FALSE;
removeSprings = FALSE;
simpleSoft = FALSE;
d->edgeSprings = edgeSprings;
d->esel = esel;
d->wsel = wsel;
d->psel = psel;
// d->edgeSprings = edgeSpings;
// d->WholeFrameCache = WholeFrameCache;
return d;
}
};
class ILagMod;
// block IDs
enum { lag_params };
// lag_param param IDs
enum { lag_flex, lag_strength, lag_sway, lag_referenceframe, lag_paint_strength,
lag_paint_radius,lag_paint_feather,lag_paint_backface, lag_force_node, lag_absolute,
lag_solver, lag_samples,
lag_chase, lag_center,
lag_endframeon, lag_endframe,
lag_collider_node,
lag_stretch_str, lag_stretch_sway,
lag_torque_str, lag_torque_sway,
lag_extra_str, lag_extra_sway,
lag_hold_radius,
lag_add_mode,
lag_displaysprings,
lag_holdlength,
lag_holdlengthpercent,
lag_lazyeval,
lag_stretch,
lag_stiffness,
lag_enable_advance_springs,
lag_springcolors,
lag_customspringdisplay,
lag_affectall,
lag_createspringdepth,
lag_createspringmult,
};
//***************************************************************
//Function Publishing System stuff
//****************************************************************
#define LAG_INTERFACE Interface_ID(0xDE17A34f, 0x8A41E3C1)
#define GetILagInterface(cd) \
(ILagMod *)(cd)->GetInterface(LAG_INTERFACE)
enum { lag_paint, lag_setreference, lag_reset,
lag_addforce, lag_removeforce,
lag_numbervertices,
lag_selectvertices,lag_getselectedvertices,
lag_getvertexweight,lag_setvertexweight,
lag_setedgelist,lag_getedgelist,
lag_addspringselection,
lag_addspring,
lag_removeallsprings,
lag_addspring_button,
lag_removespring_button,
lag_option_button,
lag_simplesoft_button,
lag_removespring_by_end,
lag_removespring_by_both_ends,
lag_removespringbyindex,
lag_numbersprings,
lag_getspringgroup,
lag_setspringgroup,
lag_getspringlength,
lag_setspringlength,
lag_getindex
};
//****************************************************************
class ILagMod : public FPMixinInterface
{
public:
//Function Publishing System
//Function Map For Mixin Interface
//*************************************************
BEGIN_FUNCTION_MAP
VFN_0(lag_paint, fnPaint);
VFN_0(lag_setreference, fnSetReference);
VFN_0(lag_reset, fnReset);
VFN_1(lag_addforce, fnAddForce,TYPE_INODE);
VFN_1(lag_removeforce, fnRemoveForce,TYPE_INT);
FN_0(lag_numbervertices,TYPE_INT, fnNumberVertices);
VFN_2(lag_selectvertices, fnSelectVertices, TYPE_BITARRAY, TYPE_BOOL);
FN_0(lag_getselectedvertices, TYPE_BITARRAY, fnGetSelectedVertices);
FN_1(lag_getvertexweight, TYPE_FLOAT, fnGetVertexWeight, TYPE_INT);
VFN_2(lag_setvertexweight, fnSetVertexWeight, TYPE_INT_TAB,TYPE_FLOAT_TAB);
VFN_2(lag_setedgelist, fnSetEdgeList, TYPE_BITARRAY, TYPE_BOOL);
FN_0(lag_getedgelist, TYPE_BITARRAY, fnGetEdgeList);
VFN_2(lag_addspringselection, fnAddSingleSpringFromSelection,TYPE_INT,TYPE_BOOL);
VFN_4(lag_addspring, fnAddSpring,TYPE_INT,TYPE_INT,TYPE_INT,TYPE_BOOL);
VFN_0(lag_removeallsprings, fnRemoveAllSprings);
VFN_0(lag_addspring_button, fnAddSpringButton);
VFN_0(lag_removespring_button, fnRemoveSpringButton);
VFN_0(lag_option_button, fnOptionButton);
VFN_0(lag_simplesoft_button, fnSimpleSoftButton);
VFN_1(lag_removespring_by_end,fnRemoveSpring,TYPE_INT);
VFN_2(lag_removespring_by_both_ends,fnRemoveSpring,TYPE_INT,TYPE_INT);
VFN_1(lag_removespringbyindex,fnRemoveSpringByIndex,TYPE_INT);
FN_0(lag_numbersprings,TYPE_INT,fnNumberSprings);
FN_1(lag_getspringgroup,TYPE_FLOAT,fnGetSpringGroup,TYPE_INT);
VFN_2(lag_setspringgroup,fnSetSpringGroup,TYPE_INT,TYPE_INT);
FN_1(lag_getspringlength,TYPE_FLOAT,fnGetSpringLength,TYPE_INT);
VFN_2(lag_setspringlength,fnSetSpringLength,TYPE_INT,TYPE_FLOAT);
FN_2(lag_getindex,TYPE_INT,fnGetIndex,TYPE_INT,TYPE_INT);
END_FUNCTION_MAP
FPInterfaceDesc* GetDesc(); // <-- must implement
//note functions that start with fn are to be used with maxscript since these expect 1 based indices
BitArray tempBitArray;
virtual void fnPaint()=0;
virtual void fnSetReference()=0;
virtual void fnReset()=0;
virtual void fnAddForce(INode *node)=0;
virtual void fnRemoveForce(int whichNode)=0;
virtual int fnNumberVertices()=0;
virtual void fnSelectVertices(BitArray *selList, BOOL updateViews)=0;
virtual BitArray *fnGetSelectedVertices()=0;
virtual float fnGetVertexWeight(int index)=0;
virtual void fnSetVertexWeight(Tab<int> *indexList, Tab<float> *values)=0;
virtual void fnSetEdgeList(BitArray *selList, BOOL updateViews)=0;
virtual BitArray *fnGetEdgeList()=0;
virtual void fnAddSingleSpringFromSelection(int flag,BOOL addDupes)=0;
virtual void AddSingleSpringFromSelection(LagModData *lmd, int flag,BOOL addDupes)=0;
virtual void fnAddSpring(int a, int b, int flag,BOOL addDupes)=0;
virtual void AddSpring(LagModData *lmd, int a, int b, int flag,BOOL addDupes)=0;
virtual void fnRemoveAllSprings()=0;
virtual void RemoveAllSprings(LagModData *lmd)=0;
/* virtual void fnDeleteSpring(int a, int b)=0;
virtual void fnDeleteSpring(int index)=0;
virtual void DeleteSpring(LagModData *lmd, int a, int b)=0;
virtual void DeleteSpring(LagModData *lmd, int index)=0;
virtual void fnSetSpringFlag(int index, int flag)=0;
virtual void SetSpringFlag(LagModData *lmd,int index, int flag)=0;
virtual int fnGetSpringFlag(int index)=0;
virtual int GetSpringFlag(LagModData *lmd,int index)=0;
*/
virtual void fnAddSpringButton()=0;
virtual void fnRemoveSpringButton()=0;
virtual void fnOptionButton()=0;
virtual void fnSimpleSoftButton()=0;
virtual void fnRemoveSpring(int a) = 0;
virtual void RemoveSpring(LagModData *lmd,int a) = 0;
virtual void fnRemoveSpring(int a,int b) = 0;
virtual void RemoveSpring(LagModData *lmd,int a,int b)=0;
virtual void fnRemoveSpringByIndex(int index) = 0;
virtual void RemoveSpringByIndex(LagModData *lmd,int index) = 0;
virtual int fnNumberSprings()=0;
virtual int NumberSprings(LagModData *lmd)=0;
virtual int fnGetSpringGroup(int index) = 0;
virtual int GetSpringGroup(LagModData *lmd,int index)=0;
virtual void fnSetSpringGroup(int index, int group)=0;
virtual void SetSpringGroup(LagModData *lmd,int index, int group)=0;
virtual float fnGetSpringLength(int index)=0;
virtual float GetSpringLength(LagModData *lmd,int index) = 0;
virtual void fnSetSpringLength(int index,float dist)=0;
virtual void SetSpringLength(LagModData *lmd,int index,float dist) = 0;
virtual int fnGetIndex(int a, int b)=0;
virtual int GetIndex(LagModData *lmd,int a, int b)=0;
};
#endif // __ILAG__H
@@ -0,0 +1,138 @@
/**********************************************************************
*<
FILE: ILayer.h
DESCRIPTION: Declaration of the ILayer interface
CREATED BY: Peter Sauerbrei
HISTORY: Created 19 October 1998
*> Copyright (c) 1998-99, All Rights Reserved.
**********************************************************************/
#pragma once
#ifndef __ILAYER_H__
#define __ILAYER_H__
#include <maxtypes.h>
#define NODE_LAYER_REF 6
class LayerProperty : public ReferenceTarget
{
private:
int m_id;
TSTR m_name;
public:
LayerProperty() : m_id(-1), m_name("") {}
LayerProperty(const TSTR & name, int id) : m_id(id), m_name(name) {}
virtual ~LayerProperty() {}
// child methods
virtual void SetProperty(const int d) = 0;
virtual void SetProperty(const float d) = 0;
virtual void SetProperty(const Point3 & d) = 0;
virtual void SetProperty(const TSTR & d) = 0;
virtual void SetProperty(void * d) = 0;
virtual bool GetProperty(int & i) const = 0;
virtual bool GetProperty(float & f) const = 0;
virtual bool GetProperty(Point3 & p) const = 0;
virtual bool GetProperty(TSTR & n) const = 0;
virtual bool GetProperty(void * v) const = 0;
// local methods
int GetID() const { return m_id; }
void SetID(int id) { m_id = id; }
TSTR GetName() const { return m_name; }
void SetName(const TSTR & name) { m_name = name; }
};
class ILayer : public ReferenceTarget
{
public:
static const SClass_ID kLayerSuperClassID;
// from Animatable
SClass_ID SuperClassID() { return kLayerSuperClassID; }
// from ILayerRecord
virtual bool AddToLayer(INode * rtarg) = 0;
virtual bool DeleteFromLayer(INode * rtarg) = 0;
virtual void SetName(const TSTR & name) = 0;
virtual TSTR GetName() const = 0; // user must delete the string
virtual void SetWireColor(DWORD newcol) = 0;
virtual DWORD GetWireColor() const = 0;
virtual void Hide(bool onOff) = 0;
virtual bool IsHidden() const = 0;
virtual void Freeze(bool onOff) = 0;
virtual bool IsFrozen() const = 0;
virtual void SetRenderable(bool onOff) = 0;
virtual bool Renderable() const = 0;
// mjm - 06.12.00 - begin
virtual void SetPrimaryVisibility(bool onOff) = 0;
virtual bool GetPrimaryVisibility() const = 0;
virtual void SetSecondaryVisibility(bool onOff) = 0;
virtual bool GetSecondaryVisibility() const = 0;
// mjm - end
virtual void XRayMtl(bool onOff) = 0;
virtual bool HasXRayMtl() const = 0;
virtual void IgnoreExtents(bool onOff) = 0;
virtual bool GetIgnoreExtents() const = 0;
virtual void BoxMode(bool onOff) = 0;
virtual bool GetBoxMode() const = 0;
virtual void AllEdges(bool onOff) = 0;
virtual bool GetAllEdges() const = 0;
virtual void VertTicks(bool onOff) = 0;
virtual bool GetVertTicks() const = 0;
virtual void BackCull(bool onOff) = 0;
virtual bool GetBackCull() const = 0;
virtual void SetCVertMode(bool onOff) = 0;
virtual bool GetCVertMode() const = 0;
virtual void SetShadeCVerts(bool onOff) = 0;
virtual bool GetShadeCVerts() const = 0;
virtual void SetCastShadows(bool onOff) = 0;
virtual bool CastShadows() const = 0;
virtual void SetRcvShadows(bool onOff) = 0;
virtual bool RcvShadows() const = 0;
// mjm - 06.12.00 - begin
virtual void SetApplyAtmospherics(bool onOff) = 0;
virtual bool ApplyAtmospherics() const = 0;
// mjm - end
virtual void SetMotBlur(int kind) = 0;
virtual int MotBlur() const = 0;
virtual int GetRenderFlags() const = 0;
virtual void SetRenderFlags(int flags) = 0;
virtual int GetDisplayFlags() const = 0;
virtual int AddProperty(LayerProperty & lprop) = 0;
virtual int SetProperty(LayerProperty & lprop) = 0;
virtual int GetProperty(LayerProperty & lprop) const = 0;
virtual bool Used(void) const = 0;
virtual bool GetFlag(int mask) const = 0;
virtual bool GetFlag2(int mask) const = 0;
virtual void UpdateSelectionSet(void) = 0;
virtual int GetRenderFlags(int oldlimits) const = 0;
virtual void SetInheritVisibility(bool onOff) = 0;
virtual bool GetInheritVisibility() const = 0;
virtual void Trajectory(bool onOff, bool temp = false) = 0;
virtual bool GetTrajectory() const = 0;
virtual void SetDisplayByLayer(BOOL onOff, INode *) = 0;
virtual void SetRenderByLayer(BOOL onOff, INode *) = 0;
virtual void SetMotionByLayer(BOOL onOff, INode *) = 0;
virtual BOOL GetDisplayByLayer(INode *) = 0;
virtual BOOL GetRenderByLayer(INode *) = 0;
virtual BOOL GetMotionByLayer(INode *) = 0;
virtual void SelectObjects(void) = 0;
virtual void SetVisibility(TimeValue t, float vis) = 0;
virtual float GetVisibility(TimeValue t,Interval *valid=NULL) = 0;
virtual float GetVisibility(TimeValue t,View & view, Interval *valid=NULL) = 0;
virtual float GetImageBlurMultiplier(TimeValue t) = 0;
virtual void SetImageBlurMultiplier(TimeValue t, float m) = 0;
virtual bool GetMotBlurOnOff(TimeValue t) = 0;
virtual void SetMotBlurOnOff(TimeValue t, bool m) = 0;
virtual bool IsHiddenByVisControl() = 0;
virtual float GetLocalVisibility(TimeValue t,Interval *valid) = 0;
};
#endif //__ILAYER_H__
@@ -0,0 +1,54 @@
/**********************************************************************
*<
FILE: ILayerManager.h
DESCRIPTION: Declaration of the ILayerManager interface
CREATED BY: Peter Sauerbrei
HISTORY: Created 19 October 1998
*> Copyright (c) 1998-99, All Rights Reserved.
**********************************************************************/
#pragma once
#ifndef __ILAYERMANAGER_H__
#define __ILAYERMANAGER_H__
//#include <ILayer.h>
class ILayer;
class LayerIterator;
class ConstLayerIterator;
class ILayerManager : public ReferenceTarget
{
public:
static const SClass_ID kLayerManagerSuperClassID;
// from Animatable
SClass_ID SuperClassID() { return kLayerManagerSuperClassID; }
// local methods
virtual bool AddLayer(ILayer * layer) = 0;
virtual ILayer * CreateLayer(void) = 0; // creates a new layer
virtual BOOL DeleteLayer(const TSTR & name) = 0; // deletes a layer
virtual void SetCurrentLayer(const TSTR & name) = 0; // sets the current layer
virtual void SetCurrentLayer(void) = 0;
virtual ILayer * GetCurrentLayer(void) const = 0; // gets the current layer
virtual void EditLayer(const TSTR & name) = 0;
virtual void DoLayerPropDialog(HWND hWnd) = 0;
virtual LayerIterator * MakeIterator(void) = 0;
virtual ConstLayerIterator * MakeConstIterator(void) const = 0;
virtual int GetLayerCount(void) = 0;
virtual ILayer * GetLayer(const TSTR & name) const = 0;
virtual void DoLayerSelDialog(HWND hWnd) = 0;
//virtual void SetupToolList(HWND hWnd) = 0;
virtual void SetupToolList2(HWND hWnd, HWND hParent) = 0;
virtual void ExtendMenu(HMENU hMenu, bool geometry = true, bool grid = false) = 0;
virtual TSTR GetSavedLayer(int i) const = 0;
virtual ILayer * GetRootLayer() const = 0;
virtual void Reset(BOOL fileReset = FALSE) = 0;
virtual void SelectObjectsByLayer(HWND hWnd) = 0;
};
#endif //__ILAYERMANAGER_H__
@@ -0,0 +1,33 @@
/**********************************************************************
*<
FILE: IMaterial.h
DESCRIPTION: Material extension Interface class
CREATED BY: Nikolai Sander
HISTORY:
*> Copyright (c) 2000, All Rights Reserved.
**********************************************************************/
#ifndef _MTATERIAL_H_
#define _MTATERIAL_H_
#define IMATERIAL_INTERFACE_ID Interface_ID(0x578773a5, 0x44cc0d7d)
class MtlBase;
class INode;
class IMaterial : public BaseInterface
{
public:
// We'll do this as soon as Animatable derives from GenericInterfaceServer<BaseInterface>
virtual void SetMtl(MtlBase *mtl)=0;
virtual MtlBase *GetMtl()=0;
virtual void SetINode(INode *node)=0;
virtual INode *GetINode()=0;
};
#endif
@@ -0,0 +1,42 @@
/**********************************************************************
*<
FILE: IMtlEdit.h
DESCRIPTION: Material Editor Interface
CREATED BY: Nikolai Sander
HISTORY: Created 6/22/00
*> Copyright (c) 2000, All Rights Reserved.
**********************************************************************/
class MtlBase;
class IMtlEditInterface : public FPStaticInterface
{
public:
// function IDs
enum {
fnIdGetCurMtl,
fnIdSetActiveMtlSlot,
fnIdGetActiveMtlSlot,
fnIdPutMtlToMtlEditor,
fnIdGetTopMtlSlot,
fnIdOkMtlForScene,
fnIdUpdateMtlEditorBrackets,
};
virtual MtlBase *GetCurMtl() = 0;
virtual void SetActiveMtlSlot(int i, BOOL forceUpdate = FALSE)=0;
virtual int GetActiveMtlSlot()=0;
virtual void PutMtlToMtlEditor(MtlBase *mtlBase, int slot)=0;
virtual MtlBase* GetTopMtlSlot(int slot)=0;
virtual BOOL OkMtlForScene(MtlBase *m)=0;
virtual void UpdateMtlEditorBrackets()=0;
};
#define MTLEDIT_INTERFACE Interface_ID(0x2c7b3f6e, 0x16fb35d4)
inline IMtlEditInterface* GetMtlEditInterface () { return (IMtlEditInterface *)GetCOREInterface(MTLEDIT_INTERFACE); }
@@ -0,0 +1,45 @@
/**********************************************************************
FILE: IPipelineClient.h
DESCRIPTION: Geometry pipeline client API
CREATED BY: Attila Szabo, Discreet
HISTORY: [attilas|19.09.2000]
*> Copyright (c) 1998-2000, All Rights Reserved.
**********************************************************************/
#ifndef __IPIPELINECLIENT__H
#define __IPIPELINECLIENT__H
#include "baseinterface.h"
// GUID that identifies this ifc (interface)
#define PIPELINECLIENT_INTERFACE Interface_ID(0x62383d51, 0x2d0f7d6a)
//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
// This interface should be implemented by objects that flow up the
// geometry pipeline and have data members that belong to the pipeline
// channels (geometry, topology, texmap, etc)
// ... in other words by objects that are part of the data flow evaluation
// of the Max stack.
//________________________________________________________________________
class IPipelineClient : public BaseInterface
{
public:
// --- IPipelineClient methods
virtual void ShallowCopy( IPipelineClient* from, ULONG_PTR channels ) = 0;
virtual void DeepCopy( IPipelineClient* from, ULONG_PTR channels ) = 0;
virtual void NewAndCopyChannels( ULONG_PTR channels ) = 0;
virtual void FreeChannels( ULONG_PTR channels, int zeroOthers = 1 ) = 0;
virtual void ZeroChannels( ULONG_PTR channels ) = 0;
virtual void AppendAllChannels( IPipelineClient* from ) = 0;
// --- from BaseInterface
virtual Interface_ID GetID() { return PIPELINECLIENT_INTERFACE; }
};
#endif
@@ -0,0 +1,130 @@
//-------------------------------------------------------------
// Access to Point Cache
//
#ifndef __IPOINTCACHE__H
#define __IPOINTCACHE__H
#include "iFnPub.h"
#define POINTCACHE_CLASS_ID Class_ID(0x21d07ae1, 0x48d30bec)
#define POINTCACHEWSM_CLASS_ID Class_ID(0x21d07ae1, 0x48d30bed)
#define PARTICLECACHE_CLASS_ID Class_ID(0x21d07ae1, 0x48d30bee)
enum { pointcache_params };
//enums for various parameters
//note pb_record_file is no longer used and legacy
//pb_disable_mods is no longer used and legacy
//pb_fastcache is fast caching scheme but right now can potential cause crashes
// or extremely slow conditions are systems that spawn particles
enum {
pb_time,pb_start_time,pb_end_time,pb_samples, pb_disable_mods, pb_cache_file, pb_record_file,pb_relative,pb_strength,pb_fastcache
};
class IPointCache;
class IPointCacheWSM;
class IParticleCache;
//***************************************************************
//Function Publishing System stuff
//****************************************************************
#define POINTCACHE_INTERFACE Interface_ID(0x53b4409b, 0x18ee7cc8)
#define GetIPointCacheInterface(cd) \
(IPointCache *)(cd)->GetInterface(POINTCACHE_INTERFACE)
#define POINTCACHEWSM_INTERFACE Interface_ID(0x53b4409b, 0x18ee7cc9)
#define GetIPointCacheWSMInterface(cd) \
(IPointCacheWSM *)(cd)->GetInterface(POINTCACHEWSM_INTERFACE)
#define PARTICLECACHE_INTERFACE Interface_ID(0x53b4409b, 0x18ee7cd0)
#define GetIParticleCacheInterface(cd) \
(IParticleCache *)(cd)->GetInterface(PARTICLECACHE_INTERFACE)
enum { pointcache_record, pointcache_setcache, pointcache_enablemods,pointcache_disablemods
};
//****************************************************************
class IPointCache : public FPMixinInterface
{
public:
//Function Publishing System
//Function Map For Mixin Interface
//*************************************************
BEGIN_FUNCTION_MAP
VFN_0(pointcache_record, fnRecord);
VFN_0(pointcache_setcache, fnSetCache);
VFN_0(pointcache_enablemods, fnEnableMods);
VFN_0(pointcache_disablemods, fnDisableMods);
END_FUNCTION_MAP
FPInterfaceDesc* GetDesc(); // <-- must implement
virtual void fnRecord()=0;
virtual void fnSetCache()=0;
virtual void fnEnableMods()=0;
virtual void fnDisableMods()=0;
};
class IPointCacheWSM : public FPMixinInterface
{
public:
//Function Publishing System
//Function Map For Mixin Interface
//*************************************************
BEGIN_FUNCTION_MAP
VFN_0(pointcache_record, fnRecord);
VFN_0(pointcache_setcache, fnSetCache);
VFN_0(pointcache_enablemods, fnEnableMods);
VFN_0(pointcache_disablemods, fnDisableMods);
END_FUNCTION_MAP
FPInterfaceDesc* GetDesc(); // <-- must implement
virtual void fnRecord()=0;
virtual void fnSetCache()=0;
virtual void fnEnableMods()=0;
virtual void fnDisableMods()=0;
};
class IParticleCache : public FPMixinInterface
{
public:
//Function Publishing System
//Function Map For Mixin Interface
//*************************************************
BEGIN_FUNCTION_MAP
VFN_0(pointcache_record, fnRecord);
VFN_0(pointcache_setcache, fnSetCache);
END_FUNCTION_MAP
FPInterfaceDesc* GetDesc(); // <-- must implement
virtual void fnRecord()=0;
virtual void fnSetCache()=0;
};
#endif // __IPOINTCACHE__H
@@ -0,0 +1,80 @@
/**********************************************************************
*<
FILE: IReagent.h
DESCRIPTION: Declares a class of objects which react
CREATED BY: John Hutchinson
HISTORY: Created January 9, 1999
*> Copyright (c) 1994, All Rights Reserved.
**********************************************************************/
#pragma once
#include <IAggregation.h>
class IAggregation;
class IGeomImp;
class IValence;
class ValenceDescIterator;
class IHost;
class IReagent
{
public:
//completes the construction process
virtual void InitializeSubstrate(INode* n) = 0;//completes the construction process
virtual IValence* OpenValence() = 0;
virtual void OpenValenceTM(TimeValue t, Matrix3& tm)= 0;
virtual int OpenValenceIndex() = 0;
virtual void CloseValence(IValence* val, bool done = false)= 0;
virtual int NumValenceTypes() = 0;
virtual Class_ID GetValenceClassID(int which) = 0;
//create a valence given a class descriptor and a node(used for its location)
//may create a new instance of this type
virtual IValence* PrepValence(ClassDesc* cd, INode* me, INode* loc) = 0;
//pass back the chemistry/geometry of the reagent viz-a-viz the current reaction
//Thus this excludes any pending reaction results.
//Currently we assumes one reaction at a time. Could pass a valence to identify which.
virtual IGeomImp* ReactionSite() = 0;
};
class IValence
{
public:
enum bondtype {
eStrongBond,//absorb the node
eWeakBond,//don't absorb the node
eTransientBond,//temporary but affect permanaent change to object stack
eTopicalBond};//unused but coneptually a weaker type of transient bonds which just copy node properties
//set up a controller and possibly record subobj hit data from the host
virtual Control* Locate(INode* host, INode *loc, Control* c, Matrix3& oldP, Matrix3& newP) = 0;//may clone the controller
virtual commitlevels Occupy(Object* obj) = 0;
virtual Object* Occupant()=0;
virtual bool Bind(TimeValue t, IGeomImp &complex_geom, Matrix3& tm, Interval iv, IHost* attentivehost = NULL, bool expedite = false) = 0;
virtual commitlevels Validate(TimeValue t, int action, commitlevels current, Matrix3* tm) = 0;
virtual bondtype BondStrength()=0;
virtual void SetOwner(Object* owner)=0;
virtual void SetMaterialBase(int matidx) = 0;
};
/*
class ValenceDescIterator
{
public:
ValenceDescIterator();
~ValenceDescIterator();
Class_ID First();
virtual bool IsDone();
Class_ID Next();
private:
int m_current;
};
*/
//mechanism to test compatibility needs to be done at the class descriptor level.
//Since this is what gets enumerated at the point prio to the valence getting created.
@@ -0,0 +1,45 @@
/**********************************************************************
*<
FILE: IRefHierarchy.h
DESCRIPTION: Interface for accessing reference hierarchy related info
CREATED BY: Attila Szabo
HISTORY: Created Nov/27/00
*> Copyright (c) 2000, All Rights Reserved.
**********************************************************************/
#ifndef __IREFHIERARCHY__H
#define __IREFHIERARCHY__H
#include "iFnPub.h"
// This interface is supposed to group reference hierarchy related methods
class IRefHierarchy : public FPStaticInterface
{
public:
// function IDs
enum
{
fnIdIsRefTargetInstanced,
};
// This method can be used to find out if an object is instanced
// (instanced pipeline).
// It Checks if the Derived Object is instanced. If it is, the pipeline
// part below and including that derived object is instanced.
// If the argument is NULL, returns FALSE
virtual BOOL IsRefTargetInstanced( ReferenceTarget* refTarget ) = 0;
};
#define REFHIERARCHY_INTERFACE Interface_ID(0x296e2793, 0x247d12e4)
inline IRefHierarchy* GetRefHierarchyInterface()
{
return static_cast<IRefHierarchy*>(GetCOREInterface(REFHIERARCHY_INTERFACE));
}
#endif // __IREFHIERARCHY__H
@@ -0,0 +1,52 @@
/**********************************************************************
*<
FILE: IRollupSettings
DESCRIPTION: Rollup Window Settings Interface
CREATED BY: Nikolai Sander
HISTORY: created 8/8/00
*> Copyright (c) 2000, All Rights Reserved.
**********************************************************************/
#ifndef __IROLLUP_H__
#define __IROLLUP_H__
class ICatRegistry;
#define EFFECTS_ROLLUPCFG_CLASSID Class_ID(0x559c705d, 0x32573fe3)
#define ATMOSPHERICS_ROLLUPCFG_CLASSID Class_ID(0x40ef5775, 0x5b5606f)
#define DISPLAY_PANEL_ROLLUPCFG_CLASSID Class_ID(0x12d45445, 0x3a5779a2)
#define MOTION_PANEL_ROLLUPCFG_CLASSID Class_ID(0xbea1816, 0x50de0291)
#define HIERARCHY_PANEL_ROLLUPCFG_CLASSID Class_ID(0x5d6c08d4, 0x7e5e2c2b)
#define UTILITY_PANEL_ROLLUPCFG_CLASSID Class_ID(0x2e256000, 0x6a5b2b34)
class IRollupSettings : public FPStaticInterface
{
public:
virtual ICatRegistry *GetCatReg()=0;
};
class ICatRegistry
{
public:
// This method gets the category (order field) for the given SuperClass ID, ClassID and Rollup Title
virtual int GetCat(SClass_ID sid, Class_ID cid, TCHAR *title,int category)=0;
// This method updates (sets) the category (order field) for the given SuperClass ID, ClassID and Rollup Title
virtual void UpdateCat(SClass_ID sid, Class_ID cid, TCHAR *title,int category)=0;
// This method Saves the category settings in File "UI\RollupOrder.cfg"
virtual void Save()=0;
// This method Loads the category settings from File "UI\RollupOrder.cfg"
virtual void Load()=0;
// This method Erases all category settings (in memory only)
virtual void EmptyRegistry()=0;
// This method deletes a category list for a given superclass ID and class ID
virtual void DeleteList(SClass_ID sid, Class_ID cid)=0;
};
#define ROLLUP_SETTINGS_INTERFACE Interface_ID(0x281a65e8, 0x12db025d)
inline IRollupSettings* GetIRollupSettings() { return (IRollupSettings*)GetCOREInterface(ROLLUP_SETTINGS_INTERFACE); }
#endif
@@ -0,0 +1,234 @@
/**********************************************************************
FILE: ISkin.h
DESCRIPTION: Skin Bone Deformer API
CREATED BY: Nikolai Sander, Discreet
HISTORY: 7/12/99
*> Copyright (c) 1998, All Rights Reserved.
**********************************************************************/
#ifndef __ISKIN__H
#define __ISKIN__H
#include "ISkinCodes.h"
#define I_SKIN 0x00010000
#define I_GIZMO 9815854
#define SKIN_INVALID_NODE_PTR 0
#define SKIN_OK 1
//#define SKIN_CLASSID Class_ID(0x68477bb4, 0x28cf6b86)
#define SKIN_CLASSID Class_ID(9815843,87654)
class ISkinContextData
{
public:
virtual int GetNumPoints()=0;
virtual int GetNumAssignedBones(int vertexIdx)=0;
virtual int GetAssignedBone(int vertexIdx, int boneIdx)=0;
virtual float GetBoneWeight(int vertexIdx, int boneIdx)=0;
// These are only used for Spline animation
virtual int GetSubCurveIndex(int vertexIdx, int boneIdx)=0;
virtual int GetSubSegmentIndex(int vertexIdx, int boneIdx)=0;
virtual float GetSubSegmentDistance(int vertexIdx, int boneIdx)=0;
virtual Point3 GetTangent(int vertexIdx, int boneIdx)=0;
virtual Point3 GetOPoint(int vertexIdx, int boneIdx)=0;
};
class ISkin
{
public:
virtual int GetBoneInitTM(INode *pNode, Matrix3 &InitTM, bool bObjOffset = false)=0;
virtual int GetSkinInitTM(INode *pNode, Matrix3 &InitTM, bool bObjOffset = false)=0;
virtual int GetNumBones()=0;
virtual INode *GetBone(int idx)=0;
virtual DWORD GetBoneProperty(int idx)=0;
virtual ISkinContextData *GetContextInterface(INode *pNode)=0;
//new stuff
virtual TCHAR *GetBoneName(int index) = 0;
virtual int GetSelectedBone() = 0;
virtual void UpdateGizmoList() = 0;
virtual void GetEndPoints(int id, Point3 &l1, Point3 &l2) = 0;
virtual Matrix3 GetBoneTm(int id) = 0;
virtual INode *GetBoneFlat(int idx)=0;
virtual int GetNumBonesFlat()=0;
virtual int GetRefFrame()=0;
};
class IGizmoBuffer
{
public:
Class_ID cid;
void DeleteThis() { delete this; }
};
class GizmoClass : public ReferenceTarget
{
// all the refernce stuff and paramblock stuff here
public:
ISkin *bonesMod;
IParamBlock2 *pblock_gizmo_data;
int NumParamBlocks() { return 1; }
IParamBlock2* GetParamBlock(int i)
{
if (i == 0) return pblock_gizmo_data;
else return NULL;
}
IParamBlock2* GetParamBlockByID(BlockID id)
{
if (pblock_gizmo_data->ID() == id) return pblock_gizmo_data ;
else return NULL;
}
int NumRefs() {return 1;}
RefTargetHandle GetReference(int i)
{
if (i==0)
{
return (RefTargetHandle)pblock_gizmo_data;
}
return NULL;
}
void SetReference(int i, RefTargetHandle rtarg)
{
if (i==0)
{
pblock_gizmo_data = (IParamBlock2*)rtarg;
}
}
void DeleteThis() {
delete this;
}
int NumSubs() {return 1;}
Animatable* SubAnim(int i) { return GetReference(i);}
TSTR SubAnimName(int i) {return _T(""); }
int SubNumToRefNum(int subNum) {return -1;}
RefResult NotifyRefChanged( Interval changeInt,RefTargetHandle hTarget,
PartID& partID, RefMessage message)
{
return REF_SUCCEED;
}
virtual void BeginEditParams(IObjParam *ip, ULONG flags,Animatable *prev) {}
virtual void EndEditParams(IObjParam *ip,ULONG flags,Animatable *next) {}
virtual IOResult Load(ILoad *iload) {return IO_OK;}
virtual IOResult Save(ISave *isave) {return IO_OK;}
// void* GetInterface(ULONG id);
//this retrieves the boudng bx of the gizmo in world space
virtual void GetWorldBoundBox(TimeValue t,INode* inode, ViewExp *vpt, Box3& box, ModContext *mc){}
// this called in the bonesdef display code to show the gizmo
virtual int Display(TimeValue t, GraphicsWindow *gw, Matrix3 tm ) { return 1;}
virtual Interval LocalValidity(TimeValue t) {return FOREVER;}
virtual BOOL IsEnabled() { return TRUE; }
virtual BOOL IsVolumeBased() {return FALSE;}
virtual BOOL IsInVolume(Point3 p, Matrix3 tm) { return FALSE;}
//this is what deforms the point
// this is passed in from the Map call in bones def
virtual Point3 DeformPoint(TimeValue t, int index, Point3 initialP, Point3 p, Matrix3 tm)
{return p;}
//this is the suggested name that the gizmo should be called in the list
virtual void SetInitialName() {}
//this is the final name of the gizmo in th list
virtual TCHAR *GetName(){return NULL;}
//this sets the final name of the gizmo in the list
virtual void SetName(TCHAR *name) {}
// this is called when the gizmo is initially created
// it is passed to the current selected verts in the world space
//count is the number of vertice in *p
//*p is the list of point being affected in world space
//numberOfInstances is the number of times this modifier has been instanced
//mapTable is an index list into the original vertex table for *p
virtual BOOL InitialCreation(int count, Point3 *p, int numbeOfInstances, int *mapTable) { return TRUE;}
//this is called before the deformation on a frame to allow the gizmo to do some
//initial setupo
virtual void PreDeformSetup(TimeValue t) {}
virtual void PostDeformSetup(TimeValue t) {}
virtual IGizmoBuffer *CopyToBuffer() { return NULL;}
virtual void PasteFromBuffer(IGizmoBuffer *buffer) {}
virtual void Enable(BOOL enable) {}
virtual BOOL IsEditing() { return FALSE;}
virtual void EndEditing() {}
virtual void EnableEditing(BOOL enable) {}
// From BaseObject
virtual int HitTest(TimeValue t, INode* inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt, ModContext* mc, Matrix3 tm) {return 0;}
virtual void SelectSubComponent(HitRecord *hitRec, BOOL selected, BOOL all, BOOL invert=FALSE) {}
virtual void Move( TimeValue t, Matrix3& partm, Matrix3& tmAxis, Point3& val, Matrix3 tm, BOOL localOrigin=FALSE ) {}
virtual void GetSubObjectCenters(SubObjAxisCallback *cb,TimeValue t,INode *node, Matrix3 tm) {}
virtual void GetSubObjectTMs(SubObjAxisCallback *cb,TimeValue t,INode *node, Matrix3 tm) {}
virtual void ClearSelection(int selLevel) {}
virtual void SelectAll(int selLevel) {}
virtual void InvertSelection(int selLevel) {}
};
/*
Modifier* FindSkinModifier (INode* node)
{
// Get object from node. Abort if no object.
Object* pObj = node->GetObjectRef();
if (!pObj) return NULL;
// Is derived object ?
while (pObj->SuperClassID() == GEN_DERIVOB_CLASS_ID)
{
// Yes -> Cast.
IDerivedObject* pDerObj = static_cast<IDerivedObject*>(pObj);
// Iterate over all entries of the modifier stack.
int ModStackIndex = 0;
while (ModStackIndex < pDerObj->NumModifiers())
{
// Get current modifier.
Modifier* mod = pDerObj->GetModifier(ModStackIndex);
// Is this Skin ?
if (mod->ClassID() == SKIN_CLASSID )
{
// Yes -> Exit.
return mod;
}
// Next modifier stack entry.
ModStackIndex++;
}
pObj = pDerObj->GetObjRef();
}
// Not found.
return NULL;
}
*/
#endif
@@ -0,0 +1,24 @@
/**********************************************************************
FILE: ISkinCodes.h
DESCRIPTION: Skin Bone Deformer defines
CREATED BY: Nikolai Sander, Discreet
HISTORY: 7/12/99
*> Copyright (c) 1998, All Rights Reserved.
**********************************************************************/
#ifndef __ISKINCODES__H
#define __ISKINCODES__H
#define BONE_LOCK_FLAG 1
#define BONE_ABSOLUTE_FLAG 2
#define BONE_SPLINE_FLAG 4
#define BONE_SPLINECLOSED_FLAG 8
#define BONE_DRAW_ENVELOPE_FLAG 16
#define BONE_BONE_FLAG 32
#define BONE_DEAD_FLAG 64
#endif
@@ -0,0 +1,81 @@
/**********************************************************************
*<
FILE: jiggleAPI.h
DESCRIPTION: Public header file for Spring controller
CREATED BY: Adam Felt
HISTORY:
*> Copyright (c) 1999-2000, All Rights Reserved.
**********************************************************************/
#ifndef IJIGGLE
#define IJIGGLE
#define JIGGLEPOS 0x79697d2a
#define JIGGLEP3 0x13892172
#define JIGGLE_POS_CLASS_ID Class_ID(JIGGLEPOS, 0xf2b8a1c8)
#define JIGGLE_P3_CLASS_ID Class_ID(JIGGLEP3, 0x68976279)
#define JIGGLE_CONTROL_REF 0
#define JIGGLE_PBLOCK_REF1 1
#define JIGGLE_PBLOCK_REF2 2
//parameter defaults
#define JIGGLE_DEFAULT_TENSION 2.0f
#define JIGGLE_DEFAULT_DAMPENING 0.5f
#define JIGGLE_DEFAULT_MASS 300.0f
#define JIGGLE_DEFAULT_DRAG 1.0f
#define SET_PARAMS_RELATIVE 0
#define SET_PARAMS_ABSOLUTE 1
class IJiggle : public FPMixinInterface
{
public:
enum { get_mass, set_mass, get_drag, set_drag, get_tension, set_tension, get_dampening, set_dampening,
add_spring, get_spring_count, remove_spring_by_index, remove_spring, get_spring_system, };
BEGIN_FUNCTION_MAP
FN_0 (get_mass, TYPE_FLOAT, GetMass);
VFN_1 (set_mass, SetMass, TYPE_FLOAT);
FN_0 (get_drag, TYPE_FLOAT, GetDrag);
VFN_1 (set_drag, SetDrag, TYPE_FLOAT);
FN_1 (get_tension, TYPE_FLOAT, GetTension, TYPE_INDEX);
VFN_2 (set_tension, SetTension, TYPE_INDEX, TYPE_FLOAT);
FN_1 (get_dampening, TYPE_FLOAT, GetDampening, TYPE_INDEX);
VFN_2 (set_dampening, SetDampening, TYPE_INDEX, TYPE_FLOAT);
FN_1 (add_spring, TYPE_BOOL, AddSpring, TYPE_INODE);
FN_0 (get_spring_count, TYPE_INT, GetSpringCount);
VFN_1 (remove_spring_by_index, RemoveSpring, TYPE_INDEX);
VFN_1 (remove_spring, RemoveSpring, TYPE_INODE);
//FN_0 (get_spring_system, TYPE_INTERFACE, GetSpringSystem);
END_FUNCTION_MAP
FPInterfaceDesc* GetDesc(); // <-- must implement
SpringSys* partsys;
virtual SpringSys* GetSpringSystem()=0;
virtual float GetMass()=0;
virtual void SetMass(float mass, bool update=true)=0;
virtual float GetDrag()=0;
virtual void SetDrag(float drag, bool update=true)=0;
virtual float GetTension(int index)=0;
virtual void SetTension(int index, float tension, int absolute=1, bool update=true)=0;
virtual float GetDampening(int index)=0;
virtual void SetDampening(int index, float dampening, int absolute=1, bool update=true)=0;
virtual BOOL AddSpring(INode *node)=0;
virtual INT GetSpringCount()=0;
virtual void RemoveSpring(int which)=0;
virtual void RemoveSpring(INode *node)=0;
};
#endif //IJIGGLE
@@ -0,0 +1,55 @@
/**********************************************************************
*<
FILE: IStdDualVS.h
DESCRIPTION: Standard Dual VertexShader helper class interface definition
CREATED BY: Nikolai Sander, Discreet
HISTORY: created 10/11/00
*> Copyright (c) 2000, All Rights Reserved.
**********************************************************************/
#ifndef __ISTDDUALVS__H
#define __ISTDDUALVS__H
#include "IHardwareShader.h"
#define STD_DUAL_VERTEX_SHADER Class_ID(0x40e6b1a0, 0x549cbf06)
class VertexShaderCache
{
bool valid;
INode *node;
public:
VertexShaderCache(){ node = NULL; valid = false;}
~VertexShaderCache(){}
INode *GetNode() { return node;}
void SetNode(INode *node) { this->node = node;}
bool GetValid() { return valid;}
void SetValid(bool valid) { this->valid = valid;}
};
class IStdDualVSCallback
{
public:
virtual ReferenceTarget *GetRefTarg()=0;
virtual VertexShaderCache *CreateVertexShaderCache()=0;
virtual HRESULT InitValid(Mesh* mesh, INode *node)=0;
virtual HRESULT InitValid(MNMesh* mnmesh, INode *node)=0;
};
class IStdDualVS : public IVertexShader, public ReferenceMaker
{
public:
virtual ~IStdDualVS(){};
virtual void SetCallback(IStdDualVSCallback *callback)=0;
virtual int FindNodeIndex(INode *node)=0;
virtual Class_ID ClassID(){ return STD_DUAL_VERTEX_SHADER;}
virtual SClass_ID SuperClassID() { return REF_MAKER_CLASS_ID;}
virtual void DeleteThis() { delete this; }
};
#endif
@@ -0,0 +1,44 @@
// MNBigMat.h
// Created by Steve Anderson, Nov. 22 1996.
// BigMatrix is for when I need good old-fashioned mxn matrices.
// Classes:
// BigMatrix
#ifndef __MN_BIGMAT_H_
#define __MN_BIGMAT_H_
#define BIGMAT_MAX_SIZE 10000
class BigMatrix {
public:
int m, n;
float *val;
BigMatrix () { val=NULL; m=0; n=0; }
DllExport BigMatrix (int mm, int nn);
DllExport BigMatrix (const BigMatrix & from);
~BigMatrix () { Clear (); }
DllExport void Clear ();
DllExport int SetSize (int mm, int nn);
DllExport float *operator[](int i) const;
DllExport BigMatrix & operator= (const BigMatrix & from);
DllExport void SetTranspose (BigMatrix & trans) const;
DllExport float Invert();
DllExport void Identity ();
// Debugging functions:
DllExport void Randomize (float scale);
DllExport void MNDebugPrint ();
// Do not use -- does nothing. (Replaced by MNDebugPrint.)
DllExport void dump (FILE *fp);
};
DllExport extern BOOL BigMatMult (BigMatrix & a, BigMatrix & b, BigMatrix &c);
#endif
@@ -0,0 +1,62 @@
// Common macros for all MNMath.
#ifndef __MN_COMMON_H__
#define __MN_COMMON_H__
#ifndef MNEPS
#define MNEPS 1e-04f
#endif
// Selection levels for internal use:
#define MN_SEL_DEFAULT 0 // Default = use whatever's in mesh.
#define MN_SEL_OBJECT 1
#define MN_SEL_VERTEX 2
#define MN_SEL_EDGE 3
#define MN_SEL_FACE 4
// Got sick of redoing the following everywhere:
class FlagUser {
DWORD FlagUserFlags;
public:
FlagUser () { FlagUserFlags=0; }
void SetFlag (DWORD fl, bool val=TRUE) { if (val) FlagUserFlags |= fl; else FlagUserFlags -= (FlagUserFlags & fl); }
void ClearFlag (DWORD fl) { FlagUserFlags -= (FlagUserFlags & fl); }
bool GetFlag (DWORD fl) const { return (FlagUserFlags & fl) ? 1 : 0; }
void ClearAllFlags () { FlagUserFlags = 0; }
void CopyFlags (DWORD fl) { FlagUserFlags = fl; }
void CopyFlags (const FlagUser & fu) { FlagUserFlags = fu.FlagUserFlags; }
void CopyFlags (const FlagUser * fu) { FlagUserFlags = fu->FlagUserFlags; }
void CopyFlags (DWORD fl, DWORD mask) { FlagUserFlags |= (fl & mask); }
void CopyFlags (const FlagUser &fu, DWORD mask) { FlagUserFlags |= (fu.FlagUserFlags & mask); }
void CopyFlags (const FlagUser *fu, DWORD mask) { FlagUserFlags |= (fu->FlagUserFlags & mask); }
void OrFlags (const FlagUser & fu) { FlagUserFlags |= fu.FlagUserFlags; }
void OrFlags (const FlagUser * fu) { FlagUserFlags |= fu->FlagUserFlags; }
void AndFlags (const FlagUser & fu) { FlagUserFlags &= fu.FlagUserFlags; }
void AndFlags (const FlagUser * fu) { FlagUserFlags &= fu->FlagUserFlags; }
bool FlagMatch (DWORD fmask, DWORD fl) const {
return ((FlagUserFlags & fmask) == (fl & fmask));
}
bool FlagMatch (DWORD fmask, const FlagUser & fu) const {
return ((FlagUserFlags & fmask) == (fu.FlagUserFlags & fmask));
}
bool FlagMatch (DWORD fmask, const FlagUser * fu) const {
return ((FlagUserFlags & fmask) == (fu->FlagUserFlags & fmask));
}
DWORD ExportFlags () const { return FlagUserFlags; }
void ImportFlags (DWORD fl) { FlagUserFlags = fl; }
IOResult WriteFlags (ISave *isave, ULONG *nb) const {
return isave->Write(&FlagUserFlags, sizeof(DWORD), nb);
}
IOResult ReadFlags (ILoad *iload, ULONG *nb) {
return iload->Read (&FlagUserFlags, sizeof(DWORD), nb);
}
};
#endif // __MN_COMMON_H__
@@ -0,0 +1,11 @@
// MN Math.h
// Collection of headers for MNMath library
#ifndef __MNMATH_H_
#define __MNMATH_H_
#include "MNCommon.h"
#include "MNMesh.h"
#include "MNBigMat.h"
#endif
@@ -0,0 +1,905 @@
/**********************************************************************
*<
FILE: MNMesh.h
DESCRIPTION: Special mesh structures useful for face and edge based mesh operations.
CREATED BY: Steve Anderson, working for Kinetix!
HISTORY: created March 1997 from old SDMesh and WMesh.
*> Copyright (c) 1996 Autodesk, Inc., All Rights Reserved.
**********************************************************************/
// Necessary prior inclusions: max.h
// Classes:
// MNMesh
// MNVert
// MNEdge
// MNFace
// MNMeshBorder
#ifndef __MN_MESH_H_
#define __MN_MESH_H_
#include "export.h"
#include "baseinterface.h"
#define REALLOC_SIZE 10
// Boolean types: we use the same ones defined in mesh.h
//#define MESHBOOL_UNION 1
//#define MESHBOOL_INTERSECTION 2
//#define MESHBOOL_DIFFERENCE 3
// General flags for all components
// For MNVerts, MNEdges, and MNFaces, bits 0-7 are used for common characteristics
// of all components. Bits 8-15 are used for component-specific flags. Bits 16-23 are reserved
// for temporary use in MNMesh algorithms. Bits 24-31 are reserved for MNMath.lib users.
#define MN_SEL (1<<0)
#define MN_DEAD (1<<1)
#define MN_TARG (1<<2)
#define MN_BACKFACING (1<<3)
#define MN_HIDDEN (1<<4)
#define MN_WHATEVER (1<<16) // Temporary flag used internally for whatever.
#define MN_LOCAL_SEL (1<<17) // Alternate selections (not passed up the pipe).
#define MN_USER (1<<24) // Anything above this can be used by applications.
// Vertex flags
#define MN_VERT_DONE (1<<8)
class IHardwareShader;
class TriStrip;
class MNMesh;
class MNVert : public FlagUser {
public:
Point3 p;
int orig; // Original point this vert comes from
MNVert () { orig = -1; }
DllExport MNVert & operator= (MNVert & from);
bool operator==(MNVert & from) { return (from.p==p)&&(from.ExportFlags()==ExportFlags()); }
};
// Edge flags
#define MN_EDGE_INVIS (1<<8)
#define MN_EDGE_NOCROSS (1<<9)
#define MN_EDGE_MAP_SEAM (1<<10)
// Edge goes from v1 to v2
// f1 is forward-indexing face (face on "left" if surface normal above, v2 in front)
// f2 is backward-indexing face, or -1 if no such face exists. (Face on "right")
class MNEdge : public FlagUser {
public:
int v1, v2;
int f1, f2;
int track; // Keep track of whatever.
MNEdge() { Init(); }
MNEdge (int vv1, int vv2, int fc) { f1=fc; f2=-1; v1=vv1; v2=vv2; track=-1; }
void Init() { v1=v2=f1=0; f2=-1; track=-1; }
int OtherFace (int ff) { return (ff==f1) ? f2 : f1; }
int OtherVert (int vv) { return (vv==v1) ? v2 : v1; }
void Invert () { int hold=v1; v1=v2; v2=hold; hold=f1; f1=f2; f2=hold; }
DllExport void ReplaceFace (int of, int nf, int vv1=-1);
void ReplaceVert (int ov, int nv) { if (v1 == ov) v1 = nv; else { MaxAssert (v2==ov); v2 = nv; } }
DllExport bool Uncrossable ();
DllExport MNEdge & operator= (const MNEdge & from);
bool operator==(MNEdge & f) { return (f.v1==v1)&&(f.v2==v2)&&(f.f1==f1)&&(f.f2==f2)&&(f.ExportFlags()==ExportFlags()); }
int& operator[](int i) { return i ? v2 : v1; }
const int& operator[](int i) const { return i ? v2 : v1; }
DllExport void MNDebugPrint ();
};
class MNFace;
class MNMapFace {
friend class MNMesh;
int dalloc;
public:
int deg;
int *tv;
MNMapFace() { Init(); }
DllExport MNMapFace (int d);
~MNMapFace () { Clear(); }
DllExport void Init();
DllExport void Clear();
DllExport void SetAlloc (int d);
void SetSize (int d) { SetAlloc(d); deg=d; }
DllExport void MakePoly (int fdeg, int *tt);
DllExport void Insert (int pos, int num=1);
DllExport void Delete (int pos, int num=1);
DllExport void RotateStart (int newstart);
DllExport void Flip (); // Reverses order of verts. 0 remains start.
DllExport int VertIndex (int vv);
DllExport void ReplaceVert (int ov, int nv);
DllExport MNMapFace & operator= (const MNMapFace & from);
DllExport MNMapFace & operator= (const MNFace & from);
DllExport bool operator== (const MNMapFace & from);
DllExport void MNDebugPrint ();
};
// MNFace flags:
#define MN_FACE_OPEN_REGION (1<<8) // Face is not part of closed submesh.
#define MN_FACE_CHECKED (1<<9) // for recursive face-and-neighbor-checking
#define MN_FACE_CHANGED (1<<10)
// Diagonal sorting algorithm:
// Puts diagonals in increase-by-last-index, decrease-by-first order:
DllExport void DiagSort (int dnum, int *diag);
class MNFace : public FlagUser {
friend class MNMesh;
int dalloc;
void SwapContents (MNFace & from);
public:
int deg; // Degree: number of vtx's and edg's that are relevant.
int *vtx; // Defining verts of this face.
int *edg; // edges on this face.
int *diag; // Diagonals
DWORD smGroup;
MtlID material;
int track; // Keep track of whatever -- MNMesh internal use only.
BitArray visedg, edgsel;
MNFace() { Init(); }
MNFace (int d) { Init(); SetDeg (d); }
DllExport MNFace (const MNFace *from);
~MNFace () { Clear(); }
DllExport void Init();
DllExport void SetDeg (int d);
DllExport void Clear();
int TriNum() { return deg-2; }
DllExport int FindTriPoint (int edge); // finds point that makes tri with this edge.
DllExport int FindTriPoint (int a, int b); // does the same for nonsequential verts - result is between a,b.
DllExport void GetTriangles (Tab<int> &tri);
DllExport void SetAlloc (int d);
DllExport void MakePoly (int fdeg, int *vv, bool *vis=NULL, bool *sel=NULL);
DllExport void Insert (int pos, int num=1);
DllExport bool Delete (int pos, int num=1, int edir=1, bool fixtri=TRUE);
DllExport void RotateStart (int newstart);
DllExport void Flip (); // Reverses order of verts. 0 remains start.
DllExport int VertIndex (int vv, int ee=-1);
DllExport int EdgeIndex (int ee, int vv=-1);
DllExport void ReplaceVert (int ov, int nv, int ee=-1);
DllExport void ReplaceEdge (int oe, int ne, int vv=-1);
DllExport MNFace & operator= (const MNFace & from);
DllExport bool operator== (const MNFace &from);
int& operator[](int i) { return vtx[i]; }
const int& operator[](int i) const { return vtx[i]; }
DllExport void MNDebugPrint (bool triprint=FALSE);
DllExport IOResult Save (ISave *isave);
DllExport IOResult Load (ILoad *iload);
};
class MNMap : public FlagUser {
friend class MNMesh;
int nv_alloc, nf_alloc;
public:
MNMapFace *f;
UVVert *v;
int numv, numf;
MNMap () { Init(); }
~MNMap () { ClearAndFree (); }
// Initialization, allocation:
DllExport void Init ();
DllExport void VAlloc (int num, bool keep=TRUE);
DllExport void FAlloc (int num, bool keep=TRUE);
// Data access:
int VNum () const { return numv; }
UVVert V(int i) const { return v[i]; }
int FNum () const { return numf; }
MNMapFace *F(int i) const { return &(f[i]); }
// Adding new components -- all allocation should go through here!
DllExport int NewTri (int a, int b, int c);
DllExport int NewTri (int *vv);
DllExport int NewQuad (int a, int b, int c, int d);
DllExport int NewQuad (int *vv);
DllExport int NewFace (int degg=0, int *vv=NULL);
DllExport void setNumFaces (int nfnum);
DllExport int NewVert (UVVert p, int uoff=0, int voff=0);
DllExport void setNumVerts (int nvnum);
DllExport void CollapseDeadVerts (MNFace *faces); // Figures out which are dead.
DllExport void CollapseDeadFaces (MNFace *faces);
DllExport void Clear (); // Deletes everything.
DllExport void ClearAndFree (); // Deletes everything, frees all memory
DllExport void Transform (Matrix3 & xfm); // o(n) -- transforms verts
// operators and debug printing
DllExport MNMap & operator= (const MNMap & from);
DllExport MNMap & operator+= (const MNMap & from);
DllExport MNMap & operator+= (const MNMesh & from);
DllExport void ShallowCopy (const MNMap & from);
DllExport void NewAndCopy ();
DllExport void MNDebugPrint (MNFace *faces);
DllExport bool CheckAllData (int mp, int nf, MNFace *faces);
DllExport IOResult Save (ISave *isave, MNFace *faces=NULL);
DllExport IOResult Load (ILoad *iload, MNFace *faces=NULL);
};
// Per-edge data
#define MAX_EDGEDATA 10
#define EDATA_KNOT 0
#define EDATA_CREASE 1
DllExport int EdgeDataType (int edID);
DllExport void *EdgeDataDefault (int edID);
#define MN_MESH_NONTRI (1<<0) // At least 2 triangles have been joined
#define MN_MESH_FILLED_IN (1<<1) // All topological links complete
#define MN_MESH_RATSNEST (1<<2) // Set if we've replicated points to avoid rats' nest meshes.
#define MN_MESH_NO_BAD_VERTS (1<<3) // Set if we've established that each vert has exactly one connected component of faces & edges.
#define MN_MESH_VERTS_ORDERED (1<<4) // Set if we've ordered the fac, edg tables in each vert.
#define MN_MESH_HAS_VOLUME (1<<7) // Some subset of mesh describes closed surface of solid
#define MN_MESH_CACHE_FLAGS (MN_MESH_FILLED_IN|MN_MESH_NO_BAD_VERTS|MN_MESH_VERTS_ORDERED)
class MNMeshBorder;
class MNChamferData;
class MNFaceClusters;
// MNMesh selection levels:
enum PMeshSelLevel { MNM_SL_OBJECT, MNM_SL_VERTEX, MNM_SL_EDGE, MNM_SL_FACE };
// MNMesh display flags
#define MNDISP_VERTTICKS 0x01
#define MNDISP_SELVERTS 0x02
#define MNDISP_SELFACES 0x04
#define MNDISP_SELEDGES 0x08
#define MNDISP_NORMALS 0x10
#define MNDISP_SMOOTH_SUBSEL 0x20
#define MNDISP_BEEN_DISP 0x40
#define MNDISP_DIAGONALS 0x80
// Flags for sub object hit test
// NOTE: these are the same bits used for object level.
//#define SUBHIT_SELONLY (1<<0)
//#define SUBHIT_UNSELONLY (1<<2)
//#define SUBHIT_ABORTONHIT (1<<3)
//#define SUBHIT_SELSOLID (1<<4)
#define SUBHIT_MNUSECURRENTSEL (1<<22) // When this bit is set, the sel only and unsel only tests will use the current level (edge or face) selection when doing a vertex level hit test
#define SUBHIT_OPENONLY (1<<23)
#define SUBHIT_MNVERTS (1<<24)
#define SUBHIT_MNFACES (1<<25)
#define SUBHIT_MNEDGES (1<<26)
#define SUBHIT_MNTYPEMASK (SUBHIT_MNVERTS|SUBHIT_MNFACES|SUBHIT_MNEDGES)
// Subdivision flags:
#define MN_SUBDIV_NEWMAP 0x01
class MNMesh : public FlagUser, public BaseInterfaceServer {
friend class HardwareMNMesh;
friend void gfxCleanup(void *data);
private:
static int refCount;
static HANDLE workMutex;
static HANDLE workEndEvent;
int nv_alloc, ne_alloc, nf_alloc, nm_alloc;
// Cache geometric data for quick rendering
Box3 bdgBox;
Point3 *fnorm;
RVertex *rVerts; // <<< instance specific.
GraphicsWindow *cacheGW; // identifies rVerts cache
int normalsBuilt;
float norScale;
// Hidden map channels
// There are always NUM_HIDDENMAPS of these, but we dynamically allocate them
// so that M(mp) can be a const method. (This wouldn't work if we had hmap[NUM_HIDDENMAPS].)
MNMap *hmap;
// Formerly public normal map channels:
MNMap *m;
// Vertex color arrays - for display use.
int curVCChan; // current map channel to use for colors (default = 0)
UVVert *curVCVerts; // possible external color array (default = NULL)
MNMapFace *curVCFaces; // possible external face array (default = NULL)
DWTab norInd; // indirection array for fast normal lookup
int normalCount; // total number of normals
Point3 * gfxNormals; // flattened list of normals
// Derived arrays to contain generated texture coordinates
int numTexCoords[GFX_MAX_TEXTURES];
Point3 * texCoords[GFX_MAX_TEXTURES];
// Derived table of TriStrips, depends on topology
Tab<TriStrip *> *tstab;
// Internal part of SabinDoo method:
void SDVEdgeFace (int id, int vid, int *fv, Tab<Tab<int> *> & fmv, int selLevel);
// Internal part of recursive smoothing-group search.
DWORD FindReplacementSmGroup (int ff, DWORD os, int call);
// Internal parts of Boolean. (MNBool.cpp)
int BooleanZip (DWORD sortFlag, float weldThresh);
bool BoolZipSeam (Tab<int> *lpi, Tab<int> *lpj, int & starth, int & startk, float weldThresh);
void BoolPaintClassification (int ff, DWORD classification);
// Internal data cache stuff (MNPipe.cpp)
void buildBoundingBox ();
void buildFaceNormals ();
GraphicsWindow *getCacheGW() { return cacheGW; }
void setCacheGW (GraphicsWindow *gw) { cacheGW = gw; }
// New MNMesh routines to drive HardwareShaders
bool CanDrawTriStrips(DWORD rndMode, int numMtls, Material *mtl);
bool BuildTriStrips(DWORD rndMode, int numMtls, Material *mtl);
void TriStripify(DWORD rndMode, int numTex, TVFace *tvf[], TriStrip *s, StripData *sd, int vtx);
void Draw3DTriStrips(IHardwareShader *phs, int numMat, Material *ma);
void Draw3DWireTriStrips(IHardwareShader *phs, int numMat, Material *ma);
void Draw3DVisEdgeList(IHardwareShader *phs, DWORD flags);
int render3DTriStrips(IHardwareShader *phs, int kmat, int kstrips);
int render3DWireTriStrips(IHardwareShader *phs, int kmat, int kstrips);
int render3DFaces(IHardwareShader *phs, DWORD index, int *custVis=NULL);
public:
MNVert *v;
MNEdge *e;
MNFace *f;
int numv, nume, numf, numm;
// Vertex Data -- handled as in Meshes:
PerData *vd;
BitArray vdSupport;
// Edge Data
PerData *ed;
BitArray edSupport;
int selLevel;
DWORD dispFlags;
// Derived data:
Tab<int> *vedg;
Tab<int> *vfac;
// Basic class ops
MNMesh () { Init(); DefaultFlags (); }
MNMesh (const Mesh & from) { Init(); SetFromTri (from); FillInMesh (); }
MNMesh (const MNMesh & from) { Init(); DefaultFlags(); *this = from; }
DllExport ~MNMesh();
// Initialization:
void DefaultFlags () { ClearAllFlags (); }
DllExport void Init ();
// Array allocation: these functions (& Init) have sole control over nvalloc, etc.
DllExport void VAlloc (int num, bool keep=TRUE);
DllExport void VShrink (int num=-1); // default means "Shrink array allocation to numv"
DllExport void freeVEdge();
DllExport void VEdgeAlloc();
DllExport void freeVFace();
DllExport void VFaceAlloc();
DllExport void EAlloc (int num, bool keep=TRUE);
DllExport void EShrink (int num=-1);
DllExport void FAlloc (int num, bool keep=TRUE);
DllExport void FShrink (int num=-1);
DllExport void MAlloc (int num, bool keep=TRUE);
DllExport void MShrink (int num=-1);
// Access to components
int VNum () const { return numv; }
MNVert *V(int i) const { return &(v[i]); }
Point3 & P(int i) const { return v[i].p; }
int ENum () const { return nume; }
MNEdge *E(int i) const { return &(e[i]); }
int FNum () const { return numf; }
MNFace *F(int i) const { return &(f[i]); }
int MNum () const { return numm; }
DllExport MNMap *M(int mp) const;
DllExport void SetMapNum (int mpnum);
DllExport void InitMap (int mp); // Inits to current MNMesh topology.
DllExport void ClearMap (int mp);
DllExport UVVert MV (int mp, int i) const;
DllExport MNMapFace *MF (int mp, int i) const;
DllExport int TriNum () const;
// Per Vertex Data:
DllExport void setNumVData (int ct, BOOL keep=FALSE);
int VDNum () const { return vdSupport.GetSize(); }
DllExport BOOL vDataSupport (int vdChan) const;
DllExport void setVDataSupport (int vdChan, BOOL support=TRUE);
void *vertexData (int vdChan) const { return vDataSupport(vdChan) ? vd[vdChan].data : NULL; }
float *vertexFloat (int vdChan) const { return (float *) vertexData (vdChan); }
DllExport void freeVData (int vdChan);
DllExport void freeAllVData ();
// Two specific vertex data: these VDATA constants are defined in mesh.h
float *getVertexWeights () { return vertexFloat(VDATA_WEIGHT); }
void SupportVertexWeights () { setVDataSupport (VDATA_WEIGHT); }
void freeVertexWeights () { freeVData (VDATA_WEIGHT); }
float *getVSelectionWeights () { return vertexFloat(VDATA_SELECT); }
void SupportVSelectionWeights () { setVDataSupport (VDATA_SELECT); }
void freeVSelectionWeights () { freeVData (VDATA_SELECT); }
// Per Edge Data:
DllExport void setNumEData (int ct, BOOL keep=FALSE);
int EDNum () const { return edSupport.GetSize(); }
DllExport BOOL eDataSupport (int edChan) const;
DllExport void setEDataSupport (int edChan, BOOL support=TRUE);
void *edgeData (int edChan) const { return eDataSupport(edChan) ? ed[edChan].data : NULL; }
float *edgeFloat (int edChan) const { return (float *) edgeData (edChan); }
DllExport void freeEData (int edChan);
DllExport void freeAllEData ();
// One specific edge data: this EDATA constant is defined above
float *getEdgeKnots () { return edgeFloat(EDATA_KNOT); }
void SupportEdgeKnots () { setEDataSupport (EDATA_KNOT); }
void freeEdgeKnots () { freeEData (EDATA_KNOT); }
// Vertex face/edge list methods:
DllExport void VClear (int vv);
DllExport void VInit (int vv);
DllExport int VFaceIndex (int vv, int ff, int ee=-1);
DllExport int VEdgeIndex (int vv, int ee);
void VDeleteEdge (int vv, int ee) { if (vedg) vedg[vv].Delete (VEdgeIndex(vv, ee), 1); }
DllExport void VDeleteFace (int vv, int ff);
DllExport void VReplaceEdge (int vv, int oe, int ne);
DllExport void VReplaceFace (int vv, int of, int nf);
DllExport void CopyVert (int nv, int ov); // copies face & edge too if appropriate
DllExport void MNVDebugPrint (int vv);
// Adding new components -- all allocation should go through here!
DllExport int NewTri (int a, int b, int c, DWORD smG=0, MtlID mt=0);
DllExport int NewTri (int *vv, DWORD smG=0, MtlID mt=0);
DllExport int NewQuad (int a, int b, int c, int d, DWORD smG=0, MtlID mt=0);
DllExport int NewQuad (int *vv, DWORD smG=0, MtlID mt=0);
DllExport int NewFace (int initFace, int degg=0, int *vv=NULL, bool *vis=NULL, bool *sel=NULL);
DllExport int AppendNewFaces (int nfnum);
DllExport void setNumFaces (int nfnum);
DllExport int RegisterEdge (int v1, int v2, int f, int fpos);
DllExport int SimpleNewEdge (int v1, int v2);
DllExport int NewEdge (int v1, int v2, int f, int fpos);
DllExport int AppendNewEdges (int nenum);
DllExport void setNumEdges (int nenum);
DllExport int NewVert (Point3 & p);
DllExport int NewVert (Point3 & p, int vid);
DllExport int NewVert (int vid);
DllExport int NewVert (int v1, int v2, float prop);
DllExport int AppendNewVerts (int nvnum);
DllExport void setNumVerts (int nvnum);
// To delete, set MN_*_DEAD flag and use following routines, which are all o(n).
DllExport void CollapseDeadVerts ();
DllExport void CollapseDeadEdges ();
DllExport void CollapseDeadFaces ();
DllExport void CollapseDeadStructs();
DllExport void Clear (); // Deletes everything.
DllExport void ClearAndFree (); // Deletes everything, frees all memory
DllExport void freeVerts();
DllExport void freeEdges();
DllExport void freeFaces();
DllExport void freeMap(int mp);
DllExport void freeMaps();
// En Masse flag-clearing and setting:
void ClearVFlags (DWORD fl) { for (int i=0; i<numv; i++) v[i].ClearFlag (fl); }
void ClearEFlags (DWORD fl) { for (int i=0; i<nume; i++) e[i].ClearFlag (fl); }
void ClearFFlags (DWORD fl) { for (int i=0; i<numf; i++) f[i].ClearFlag (fl); }
DllExport void PaintFaceFlag (int ff, DWORD fl, DWORD fenceflags=0x0);
DllExport void VertexSelect (const BitArray & vsel);
DllExport void EdgeSelect (const BitArray & esel);
DllExport void FaceSelect (const BitArray & fsel);
bool getVertexSel (BitArray & vsel) { return getVerticesByFlag (vsel, MN_SEL); }
bool getEdgeSel (BitArray & esel) { return getEdgesByFlag (esel, MN_SEL); }
bool getFaceSel (BitArray & fsel) { return getFacesByFlag (fsel, MN_SEL); }
// In following 3, if fmask is 0 it's set to flags, so only those flags are compared.
DllExport bool getVerticesByFlag (BitArray & vset, DWORD flags, DWORD fmask=0x0);
DllExport bool getEdgesByFlag (BitArray & eset, DWORD flags, DWORD fmask=0x0);
DllExport bool getFacesByFlag (BitArray & fset, DWORD flags, DWORD fmask=0x0);
DllExport void ElementFromFace (int ff, BitArray & fset);
DllExport void BorderFromEdge (int ee, BitArray & eset);
// Following also set visedg, edgsel bits on faces:
DllExport void SetEdgeVis (int ee, BOOL vis=TRUE);
DllExport void SetEdgeSel (int ee, BOOL sel=TRUE);
// I/O with regular Meshes.
void SetFromTri (const Mesh & from) { Clear (); AddTri (from); }
DllExport void AddTri (const Mesh & from); // o(n) -- Add another mesh -- simple union
DllExport void OutToTri (Mesh & tmesh); // o(n)
// Internal computation routines
// These three build on each other and should go in order:
// FillInMesh, EliminateBadVerts, OrderVerts.
DllExport void FillInMesh (); // o(n*5) or so
DllExport void FillInFaceEdges (); // o(n).
DllExport void FillInVertEdgesFaces (); // o(n)
DllExport bool EliminateBadVerts (DWORD flag=0); // o(n*8) or so
DllExport void OrderVerts (); // o(n*3) or so
DllExport void OrderVert (int vid);
DllExport void Triangulate (); // o(n)
DllExport void TriangulateFace (int ff); // o(triangles)
// Random useful stuff.
DllExport void Transform (Matrix3 & xfm); // o(n) -- transforms verts
bool IsClosed() { for (int i=0; i<nume; i++) if (e[i].f2<0) return FALSE; return nume?TRUE:FALSE; } // o(n)
DllExport void FaceBBox (int ff, Box3 & bbox);
DllExport void BBox (Box3 & bbox, bool targonly=FALSE);
DllExport Box3 getBoundingBox (Matrix3 *tm=NULL, bool targonly=FALSE);
// Methods for handling MN_TARG flags.
DllExport int TargetVertsBySelection (int selLevel); // o(n)
DllExport int TargetEdgesBySelection (int selLevel); // o(n)
DllExport int TargetFacesBySelection (int selLevel); // o(n)
DllExport int PropegateComponentFlags (int slTo, DWORD flTo,
int slFrom, DWORD flFrom, bool ampersand=FALSE, bool set=TRUE);
DllExport void DetargetVertsBySharpness (float sharpval); // o(n*deg)
// Face-center methods
DllExport void ComputeCenters (Point3 *ctr, bool targonly=FALSE); // o(n)
DllExport void ComputeCenter (int ff, Point3 & ctr);
DllExport void ComputeNormal (int ff, Point3 & normal, Point3 *ctr=NULL);
DllExport void ComputeSafeCenters (Point3 *ctr, bool targonly=FALSE, bool detarg=FALSE); // o(n)
DllExport bool ComputeSafeCenter (int ff, Point3 & ctr); // o(deg^2)
// Triangulation-of-polygon methods:
DllExport void RetriangulateFace (int ff); // o(deg^2)
DllExport void FindDiagonals (int ff, int *diag);
DllExport void FindDiagonals (int deg, int *vv, int *diag);
DllExport void BestConvexDiagonals (int ff, int *diag=NULL);
DllExport void BestConvexDiagonals (int deg, int *vv, int *diag);
DllExport bool SetDiagonal (int ff, int d1, int d2);
// Normal methods
DllExport int FindEdgeFromVertToVert (int vrt1, int vrt2); // o(deg)
DllExport void GetVertexSpace (int vrt, Matrix3 & tm); // o(deg)
DllExport Point3 GetVertexNormal (int vrt); // o(deg)
DllExport Point3 GetEdgeNormal (int ed); // o(deg)
DllExport Point3 GetFaceNormal (int fc, bool nrmlz=FALSE); //o(deg)
Point3 GetEdgeNormal (int vrt1, int vrt2) { return GetEdgeNormal (FindEdgeFromVertToVert(vrt1, vrt2)); }
DllExport float EdgeAngle (int ed);
DllExport void FlipNormal(int faceIndex);
// Smoothing-group handling
DllExport void Resmooth (bool smooth=TRUE, bool targonly=FALSE, DWORD targmask=~0x0); // o(n)
DllExport DWORD CommonSmoothing (bool targonly=FALSE); // o(n)
DllExport DWORD GetNewSmGroup (bool targonly=FALSE); // o(n)
DllExport MtlID GetNewMtlID (bool targonly = FALSE); // o(n)
DllExport DWORD GetOldSmGroup (bool targonly=FALSE); // up to o(n).
DllExport DWORD GetAllSmGroups (bool targonly=FALSE); // up to o(n)
DllExport DWORD FindReplacementSmGroup (int ff, DWORD os);
DllExport void PaintNewSmGroup (int ff, DWORD os, DWORD ns);
DllExport bool SeparateSmGroups (int v1, int v2);
DllExport void AutoSmooth(float angle,BOOL useSel,BOOL preventIndirectSmoothing);
// Use following to unify triangles into polygons across invisible edges.
DllExport void MakePolyMesh (int maxdeg=0, BOOL elimCollin=TRUE);
// NOTE: MakeConvexPolyMesh result not guaranteed for now. Still requires MakeConvex() afterwards to be sure.
DllExport void MakeConvexPolyMesh (int maxdeg=0);
DllExport void RemoveEdge (int edge);
DllExport void MakeConvex ();
DllExport void MakeFaceConvex (int ff);
DllExport void RestrictPolySize (int maxdeg);
DllExport void MakePlanar (float planarThresh);
DllExport void MakeFacePlanar (int ff, float planarThresh);
DllExport void EliminateCollinearVerts ();
DllExport void EliminateCoincidentVerts (float thresh=MNEPS);
// Following set NOCROSS flags, delete INVIS flags to make "fences" for Sabin-Doo
DllExport void FenceMaterials ();
DllExport void FenceSmGroups ();
DllExport void FenceFaceSel ();
DllExport void FenceOneSidedEdges();
DllExport void FenceNonPlanarEdges (float thresh=.9999f, bool makevis=FALSE);
DllExport void SetMapSeamFlags ();
DllExport void SetMapSeamFlags (int mp);
// Find get detail about a point on a face.
DllExport int FindFacePointTri (int ff, Point3 & pt, double *bary, int *tri);
DllExport UVVert FindFacePointMapValue (int ff, Point3 & pt, int mp);
// Extrapolate map information about a point near a face.
DllExport UVVert ExtrapolateMapValue (int face, int edge, Point3 & pt, int mp);
// Useful for tessellation algorithms
DllExport void Relax (float relaxval, bool targonly=TRUE);
// Returns map verts for both ends of each edge (from f1's perspective)
// (Very useful for creating new faces at borders.) mv[j*2] corresponds to edge j's v1.
DllExport void FindEdgeListMapVerts (const Tab<int> & lp, Tab<int> & mv, int mp);
// Following functions can be used to find & fix holes in a mesh, if any.
DllExport void GetBorder (MNMeshBorder & brd, int selLevel=MNM_SL_OBJECT, DWORD targetFlag=MN_SEL);
DllExport void FillInBorders (MNMeshBorder *b=NULL);
DllExport void FindOpenRegions ();
// Doubled mapping verts are individual map vertices that are used to correspond
// to different regular vertices. For instance, a box could have a single (1,1,0)
// vertex that it uses in the upper-right corner of all quads. This design is
// harmful to some of our algorithms, such as the various Tessellators. So the
// following two methods detect and fix such vertices.
// This method is not really appropriate for release, it's more of a debugging
// tool. All doubled mapping verts will be DebugPrinted.
DllExport BOOL CheckForDoubledMappingVerts();
// This one's ok and encouraged for release. (Linear-time algorithm.)
DllExport void EliminateDoubledMappingVerts();
DllExport void EliminateIsoMapVerts();
DllExport void EliminateIsoMapVerts(int mp);
// operators and debug printing (MNFace.cpp)
DllExport MNMesh & operator= (const MNMesh & from);
DllExport MNMesh & operator+= (const MNMesh & from);
DllExport void MNDebugPrint (bool triprint=FALSE);
DllExport void MNDebugPrintVertexNeighborhood (int vv, bool triprint=FALSE);
DllExport bool CheckAllData ();
// Split functions maintain topological info. (MNSplit.cpp)
DllExport int SplitTriEdge (int ee, float prop=.5f, float thresh=MNEPS,
bool neVis=TRUE, bool neSel=FALSE);
DllExport int SplitTriFace (int ff, double *bary=NULL, float thresh=MNEPS,
bool neVis=TRUE, bool neSel=FALSE);
DllExport void SplitTri6 (int ff, double *bary=NULL, int *nv=NULL);
DllExport int SplitEdge (int ee, float prop=.5f);
DllExport int SplitEdge (int ee, float prop, Tab<int> *newTVerts);
DllExport int SplitEdge (int ff, int ed, float prop, bool right, int *nf=NULL,
int *ne=NULL, bool neVis=FALSE, bool neSel=FALSE, bool allconvex=FALSE);
DllExport int IndentFace (int ff, int ei, int nv, int *ne=NULL, bool nevis=TRUE, bool nesel=FALSE);
DllExport void SeparateFace (int ff, int a, int b, int & nf, int & ne, bool neVis=FALSE, bool neSel=FALSE);
DllExport bool Slice (Point3 & N, float off, float thresh, bool split, bool remove, bool flaggedFacesOnly=false, DWORD faceFlags=MN_SEL);
DllExport void DeleteFlaggedFaces (DWORD deathflags, DWORD nvCopyFlags=0x0);
DllExport bool WeldVerts (int a, int b);
DllExport bool WeldEdge (int ee);
// Tessellation methods: (MNTess.cpp)
DllExport void TessellateByEdges (float bulge, MeshOpProgress *mop=NULL);
DllExport bool AndersonDo (float interp, int selLevel, MeshOpProgress *mop=NULL, DWORD subdivFlags=0);
DllExport void TessellateByCenters (MeshOpProgress *mop=NULL);
// Sabin-Doo tessellation: (MNSabDoo.cpp)
DllExport void SabinDoo (float interp, int selLevel, MeshOpProgress *mop=NULL, Tab<Point3> *offsets=NULL);
DllExport void SabinDooVert (int vid, float interp, int selLevel, Point3 *ctr, Tab<Point3> *offsets=NULL);
// Non-uniform Rational Mesh Smooth (NURMS.cpp)
DllExport void CubicNURMS (MeshOpProgress *mop=NULL,
Tab<Point3> *offsets=NULL, DWORD subdivFlags=0);
// Boolean functions: (MNBool.cpp)
DllExport void PrepForBoolean ();
DllExport bool BooleanCut (MNMesh & m2, int cutType, int fstart=0, MeshOpProgress *mop=NULL);
DllExport bool MakeBoolean (MNMesh & m1, MNMesh & m2, int type, MeshOpProgress *mop=NULL);
DllExport void Connect (MNMeshBorder & borderList, int segs, float tension,
bool sm_bridge, bool sm_ends, Tab<int> *vsep=NULL);
DllExport void ConnectLoops (Tab<int> & loop1, Tab<int> & loop2,
int segs, float tension, DWORD smGroup, MtlID mat, bool sm_ends);
// Small-scale Operations - in MNOps.cpp
DllExport void FacePointBary (int ff, Point3 & p, Tab<float> & bary);
DllExport void CloneVerts (DWORD cloneFlag = MN_SEL, bool clear_orig=TRUE);
DllExport void CloneFaces (DWORD cloneFlag = MN_SEL, bool clear_orig=TRUE);
DllExport int DivideFace (int ff, Tab<float> & bary);
DllExport int CreateFace (int degg, int *vv);
DllExport bool MakeFlaggedPlanar (int selLev, DWORD flag=MN_SEL, Point3 *delta=NULL);
DllExport bool MoveVertsToPlane (Point3 & norm, float offset, DWORD flag=MN_SEL, Point3 *delta=NULL);
DllExport bool SplitFlaggedVertices (DWORD flag=MN_SEL);
DllExport bool SplitFlaggedEdges (DWORD flag=MN_SEL);
DllExport bool DetachFaces (DWORD flag=MN_SEL);
DllExport bool DetachElementToObject (MNMesh & nmesh, DWORD fflags=MN_SEL, bool delDetached=true);
DllExport bool ExtrudeFaceClusters (MNFaceClusters & fclust);
DllExport bool ExtrudeFaceCluster (MNFaceClusters & fclust, int cl);
DllExport bool ExtrudeFaces (DWORD flag=MN_SEL); // Does each face separately
// GetExtrudeDirection is based on faces with MN_SEL flag if face clusters are NULL.
DllExport void GetExtrudeDirection (MNChamferData *mcd,
MNFaceClusters *fclust=NULL, Point3 *clustNormals=NULL);
DllExport bool SetVertColor (UVVert clr, int mp, DWORD flag=MN_SEL);
DllExport bool SetFaceColor (UVVert clr, int mp, DWORD flag=MN_SEL);
DllExport bool ChamferVertices (DWORD flag=MN_SEL, MNChamferData *mcd=NULL);
DllExport bool ChamferEdges (DWORD flag=MN_SEL, MNChamferData *mcd=NULL);
DllExport bool FlipElementNormals (DWORD flag=MN_SEL);
DllExport void SmoothByCreases (DWORD creaseFlag);
DllExport int CutFace (int f1, Point3 & p1, Point3 & p2, Point3 & Z, bool split);
DllExport int CutEdge (int e1, float prop1, int e2, float prop2, Point3 & Z, bool split);
DllExport int Cut (int startv, Point3 & end, Point3 & Z, bool split);
DllExport bool WeldBorderVerts (int v1, int v2, Point3 *destination);
DllExport bool WeldBorderEdges (int e1, int e2);
DllExport bool WeldBorderVerts (float thresh, DWORD flag=MN_SEL);
// Pipeline object requirements. (MNPipe.cpp)
DllExport void ApplyMapper (UVWMapper & mp, int channel=0, BOOL useSel=FALSE);
DllExport void InvalidateGeomCache ();
DllExport void InvalidateTopoCache ();
DllExport void UpdateDisplayVertexColors ();
DllExport void SetDisplayVertexColors (int chan);
DllExport void SetDisplayVertexColors (UVVert *mv, MNMapFace *mf);
DllExport void PrepForPipeline ();
DllExport void allocRVerts ();
DllExport void updateRVerts (GraphicsWindow *gw);
DllExport void freeRVerts ();
DllExport void checkNormals (BOOL illum);
DllExport void buildNormals ();
DllExport void buildRenderNormals ();
DllExport void UpdateBackfacing (GraphicsWindow *gw, bool force);
// Display flags
void SetDispFlag(DWORD f) { dispFlags |= f; }
DWORD GetDispFlag(DWORD f) { return dispFlags & f; }
void ClearDispFlag(DWORD f) { dispFlags &= ~f; }
DllExport void render(GraphicsWindow *gw, Material *ma, RECT *rp, int compFlags, int numMat=1, InterfaceServer *pi=NULL);
DllExport void renderFace (GraphicsWindow *gw, int ff);
DllExport void render3DFace (GraphicsWindow *gw, int ff);
DllExport void render3DDiagonals (GraphicsWindow *gw, DWORD compFlags);
DllExport void renderDiagonals (GraphicsWindow *gw, DWORD compFlags);
DllExport void renderDiagonal (GraphicsWindow *gw, int ff, bool useSegments=false, bool *lastColorSubSel=NULL);
DllExport void render3DEdges (GraphicsWindow *gw, DWORD compFlags);
DllExport void renderEdges (GraphicsWindow *gw, DWORD compFlags);
DllExport void renderEdge (GraphicsWindow *gw, int ee, bool useSegments=false, bool *lastColorSubSel=NULL);
DllExport BOOL select (GraphicsWindow *gw, Material *ma, HitRegion *hr, int abortOnHit=FALSE, int numMat=1);
DllExport BOOL SubObjectHitTest(GraphicsWindow *gw, Material *ma, HitRegion *hr,
DWORD flags, SubObjHitList& hitList, int numMat=1 );
DllExport int IntersectRay (Ray& ray, float& at, Point3& norm);
DllExport int IntersectRay (Ray& ray, float& at, Point3& norm, int &fi, Tab<float> & bary);
DllExport BitArray VertexTempSel (DWORD fmask=MN_DEAD|MN_SEL, DWORD fset=MN_SEL);
DllExport void ShallowCopy(MNMesh *amesh, ULONG_PTR channels);
// WIN64 Cleanup: Shuler
DllExport void NewAndCopyChannels(ULONG_PTR channels);
// WIN64 Cleanup: Shuler
DllExport void FreeChannels (ULONG_PTR channels, BOOL zeroOthers=1);
// WIN64 Cleanup: Shuler
DllExport IOResult Save (ISave *isave);
DllExport IOResult Load (ILoad *iload);
DllExport void ClearFlag (DWORD fl);
// --- from InterfaceServer
DllExport BaseInterface* GetInterface(Interface_ID id);
};
class MNMeshBorder {
friend class MNMesh;
Tab<Tab<int> *> bdr;
BitArray btarg;
public:
~MNMeshBorder () { Clear(); }
void Clear () { for (int i=0; i<bdr.Count(); i++) if (bdr[i]) delete bdr[i]; bdr.ZeroCount(); }
int Num () { return bdr.Count(); }
Tab<int> *Loop (int i) { return bdr[i]; }
bool LoopTarg (int i) { return ((i>=0) && (i<bdr.Count()) && (btarg[i])); }
DllExport void MNDebugPrint (MNMesh *m);
};
class MNFaceElement {
public:
// For each face, which element is it in
Tab<int> elem;
int count;
DllExport MNFaceElement (MNMesh &mesh);
int operator[](int i) {return elem[i];}
};
class MNFaceClusters {
public:
// Cluster #, one for each face - non-selected faces have -1 for their id.
Tab<int> clust;
int count;
// Makes clusters from distinct selected components.
DllExport MNFaceClusters (MNMesh & mesh, DWORD clusterFlags);
// This version separates cluster also using a minimum angle and optionally by flags.
DllExport MNFaceClusters (MNMesh & mesh, float angle, DWORD clusterFlags);
int operator[](int i) { return clust[i]; }
DllExport void MakeVertCluster(MNMesh &mesh, Tab<int> & vclust);
DllExport void GetNormalsCenters (MNMesh &mesh, Tab<Point3> & norm, Tab<Point3> & ctr);
DllExport void GetBorder (MNMesh &mesh, int clustID, Tab<int> & cbord);
DllExport void GetOutlineVectors (MNMesh & m, Tab<Point3> & cnorms, Tab<Point3> & odir);
};
class MNEdgeClusters {
public:
Tab<int> clust;
int count;
DllExport MNEdgeClusters (MNMesh &mesh, DWORD clusterFlags);
int operator[](int i) {return clust[i];}
DllExport void MakeVertCluster (MNMesh &mesh, Tab<int> & vclust);
DllExport void GetNormalsCenters (MNMesh &mesh, Tab<Point3> & norm, Tab<Point3> & ctr);
};
class MNChamferData {
Tab<UVVert> hmdir[NUM_HIDDENMAPS];
public:
Tab<Point3> vdir;
Tab<float> vmax;
Tab<UVVert> *mdir;
MNChamferData () { mdir=NULL; }
MNChamferData (const MNMesh & m) { mdir=NULL; InitToMesh(m); }
~MNChamferData () { if (mdir) delete [] mdir; }
DllExport void InitToMesh (const MNMesh & m);
DllExport void setNumVerts (int nv, bool keep=TRUE, int resizer=0);
DllExport void ClearLimits ();
DllExport void GetDelta (float amount, Tab<Point3> & delta);
DllExport bool GetMapDelta (MNMesh & mm, int mapChannel, float amount, Tab<UVVert> & delta);
Tab<UVVert> & MDir (int mp) { return (mp<0) ? hmdir[-1-mp] : mdir[mp]; }
};
class MNTempData : public BaseInterfaceServer {
private:
MNEdgeClusters *edgeCluster;
MNFaceClusters *faceCluster;
Tab<int> *vertCluster;
Tab<Point3> *normals;
Tab<Point3> *centers;
Tab<Point3> *vnormals;
Tab<Tab<float> *> *clustDist;
Tab<float> *selDist;
Tab<float> *vsWeight;
MNChamferData *chamData;
//Tab<Point3> *extDir;
Tab<Point3> *outlineDir;
MNMesh *mesh;
public:
DllExport MNTempData ();
DllExport MNTempData (MNMesh *m);
DllExport ~MNTempData ();
void SetMesh (MNMesh *m) { mesh = m; }
DllExport MNFaceClusters *FaceClusters (DWORD clusterFlags=MN_SEL);
DllExport MNEdgeClusters *EdgeClusters (DWORD clusterFlags=MN_SEL);
DllExport Tab<int> *VertexClusters (int sl, DWORD clusterFlags=MN_SEL);
DllExport Tab<Point3> *ClusterNormals (int sl, DWORD clusterFlags=MN_SEL);
DllExport Tab<Point3> *ClusterCenters (int sl, DWORD clusterFlags=MN_SEL);
DllExport Matrix3 ClusterTM (int clust);
DllExport Tab<Point3> *VertexNormals ();
DllExport Tab<float> *VSWeight (BOOL useEdgeDist, int edgeIts,
BOOL ignoreBack, float falloff, float pinch, float bubble,
DWORD selFlags=MN_SEL);
DllExport Tab<float> *SelectionDist (BOOL useEdgeDist, int edgeIts, DWORD selFlags=MN_SEL);
DllExport Tab<float> *ClusterDist (int sl, DWORD clusterFlags, int clustId, BOOL useEdgeDist, int edgeIts);
//DllExport Tab<Point3> *FaceExtDir (int extrusionType);
DllExport Tab<Point3> *OutlineDir (int extrusionType, DWORD clusterFlags=MN_SEL);
DllExport MNChamferData *ChamferData();
DllExport void Invalidate (DWORD part);
DllExport void InvalidateDistances ();
DllExport void InvalidateSoftSelection ();
DllExport void freeClusterDist ();
DllExport void freeBevelInfo ();
DllExport void freeChamferData();
DllExport void freeAll ();
};
DllExport void SelectionDistance (MNMesh & mesh, float *selDist, DWORD selFlags);
DllExport void SelectionDistance (MNMesh & mesh, float *selDist, int iters, DWORD selFlags);
DllExport void ClustDistances (MNMesh & mesh, int numClusts, int *vclust,
Tab<float> **clustDist);
DllExport void ClustDistances (MNMesh & mesh, int numClusts, int *vclust,
Tab<float> **clustDist, int iters);
#endif
@@ -0,0 +1,541 @@
/**********************************************************************
*<
FILE: Manipulator.h
DESCRIPTION: Defines Manipulator clasess
CREATED BY: Scott Morrison
HISTORY: created 18 October 1999
*> Copyright (c) 1999, All Rights Reserved.
**********************************************************************/
#pragma once
#ifdef MANIPSYS_IMP
#define ManipExport __declspec(dllexport)
#else
#define ManipExport __declspec(dllimport)
#endif
#include "iparamb2.h"
#include "iFnPub.h"
// Helper geometry classes
enum DisplayState { kNoRedrawNeeded, kFullRedrawNeeded, kPostRedrawNeeded };
#define MANIP_PLANE_INTERFACE Interface_ID(0x44460ea4, 0xbf73be6)
class Plane : public FPMixinInterface {
public:
ManipExport Plane(Point3& normal, Point3& point);
ManipExport Plane(Point3& p1, Point3& p2, Point3& p3);
ManipExport Plane(): mNormal(0,0,1), mPoint(0,0,0), mD(0.0f) {}
ManipExport bool Intersect(Ray& ray, Point3& intersectionPoint);
ManipExport Point3& GetNormal() { return mNormal; }
ManipExport Point3& GetPoint() { return mPoint; }
ManipExport float GetPlaneConstant() { return mD; }
ManipExport Plane& MostOrthogonal(Ray& viewDir, Plane& plane);
ManipExport static Plane msXYPlane;
ManipExport static Plane msXZPlane;
ManipExport static Plane msYZPlane;
// Function IDs
enum { intersect, mostOrthogonal, getNormal, getPoint, getPlaneConstant, };
// Function Map
BEGIN_FUNCTION_MAP
FN_2(intersect, TYPE_BOOL, Intersect, TYPE_RAY_BV, TYPE_POINT3_BR);
FN_2(mostOrthogonal, TYPE_INTERFACE, FPMostOrthogonal, TYPE_RAY_BV, TYPE_INTERFACE);
RO_PROP_FN(getNormal, GetNormal, TYPE_POINT3_BV);
RO_PROP_FN(getPoint, GetPoint, TYPE_POINT3_BV);
RO_PROP_FN(getPlaneConstant, GetPlaneConstant, TYPE_FLOAT);
END_FUNCTION_MAP
// FP interface type-converter wrappers
ManipExport Plane* FPMostOrthogonal(Ray& viewRay, FPInterface* plane);
ManipExport FPInterfaceDesc* GetDesc();
private:
Point3 mNormal; // Plane normal vector
Point3 mPoint; // Point that the plane passes through
float mD; // Plane equation constant
};
#define MANIP_GIZMO_INTERFACE Interface_ID(0x124e3169, 0xf067ad4)
class GizmoShape: public FPMixinInterface {
public:
ManipExport GizmoShape() { mLine.Init(); }
ManipExport void StartNewLine() {
if (mLine.numPts > 0)
mPolyShape.Append(mLine);
mLine.Init();
}
ManipExport void AppendPoint(Point3& p) {
mLine.Append(PolyPt(p));
}
ManipExport PolyShape* GetPolyShape() {
if (mLine.numPts > 0)
mPolyShape.Append(mLine);
mLine.Init();
return &mPolyShape;
}
ManipExport void Transform(Matrix3& tm);
// Function IDs
enum { startNewLine, appendPoint, transform};
// Function Map
BEGIN_FUNCTION_MAP
VFN_0(startNewLine, StartNewLine);
VFN_1(appendPoint, AppendPoint, TYPE_POINT3_BV);
VFN_1(transform, Transform, TYPE_MATRIX3_BV);
END_FUNCTION_MAP
ManipExport FPInterfaceDesc* GetDesc();
private:
PolyShape mPolyShape;
PolyLine mLine;
};
// Manipulator system static FnPub interace
#define MANIP_MGR_INTERFACE Interface_ID(0x2c450aa2, 0x7b9d0365)
class IManipulatorMgr : public FPStaticInterface
{
public:
// stock gizmos
virtual Mesh* MakeSphere(Point3& pos, float radius, int segments)=0;
virtual Mesh* MakeTorus(Point3& pos, float radius, float radius2, int segs, int sides)=0;
virtual Mesh* MakeBox(Point3& pos, float l, float w, float h, int lsegs, int wsegs, int hsegs)=0;
// plane construction
virtual Plane* MakePlane()=0;
virtual Plane* MakePlane(Point3& p1, Point3& p2, Point3& p3)=0;
virtual Plane* MakePlane(Point3& normal, Point3& point)=0;
// constant planes
virtual Plane* GetmsXYPlane()=0;
virtual Plane* GetmsXZPlane()=0;
virtual Plane* GetmsYZPlane()=0;
// PolyShape gizmos
virtual GizmoShape* MakeGizmoShape()=0;
virtual GizmoShape* MakeCircle(Point3& center, float radius, int segments)=0;
// Function IDs
enum { makeSphere, makeTorus, makeBox, makePlane, makePlaneFromPts,
makePlaneFromNormal, getmsXYPlane, getmsXZPlane, getmsYZPlane,
makeGizmoShape, makeCircle, };
};
class ManipHitData;
class Manipulator : public HelperObject
{
public:
ManipExport Manipulator(INode* pINode) { mpINode = pINode; }
BOOL IsManipulator() { return TRUE; }
virtual int HitTest(TimeValue t, INode* pNode, int type, int crossing,
int flags, IPoint2 *pScreenPoint, ViewExp *pVpt) = 0;
virtual int Display(TimeValue t, INode* pNode, ViewExp *pVpt, int flags) = 0;
virtual void GetLocalBoundBox(TimeValue t, INode* inode, ViewExp* vp, Box3& box ) = 0;
// Used for manipulator set manager, which is always active.
ManipExport virtual bool AlwaysActive() { return false; }
virtual TSTR& GetManipName() = 0;
// FIXME these methods should use an FP interface.
virtual DisplayState MouseEntersObject(TimeValue t, ViewExp* pVpt, IPoint2& m, ManipHitData* pHitData)
{return kNoRedrawNeeded; }
virtual DisplayState MouseLeavesObject(TimeValue t, ViewExp* pVpt, IPoint2& m, ManipHitData* pHitData)
{return kNoRedrawNeeded; }
virtual void OnMouseMove(TimeValue t, ViewExp* pVpt, IPoint2& m, DWORD flags, ManipHitData* pHitData) {}
virtual void OnButtonDown(TimeValue t, ViewExp* pVpt, IPoint2& m, DWORD flags, ManipHitData* pHitData) {}
virtual void OnButtonUp(TimeValue t, ViewExp* pVpt, IPoint2& m, DWORD flags, ManipHitData* pHitData) {}
virtual INode* GetINode() { return mpINode; }
virtual void DeleteThis() { delete this; }
protected:
INode* mpINode; // The node being manipulated
};
class ManipHitList;
class ManipulatorGizmo : public BaseInterfaceServer
{
public:
ManipExport ManipulatorGizmo();
ManipExport ManipulatorGizmo(PolyShape* pShape, DWORD flags,
Point3& unselColor,
Point3& selColor = GetSubSelColor());
ManipExport ManipulatorGizmo(Mesh* pMesh, DWORD flags,
Point3& unselColor,
Point3& selColor = GetSubSelColor());
ManipExport ManipulatorGizmo(MarkerType markerType, Point3& position,
DWORD flags,
Point3& unselColor,
Point3& selColor = GetSubSelColor());
ManipExport ManipulatorGizmo(TCHAR* pText, Point3& position,
DWORD flags,
Point3& unselColor,
Point3& selColor = GetSubSelColor());
ManipExport ~ManipulatorGizmo();
ManipExport BOOL HitTest(GraphicsWindow* pGW, HitRegion* pHR, ManipHitList* pHitList,
Matrix3* tm, IPoint2 pScreenPoint, int gizmoIndex);
ManipExport void Render(ViewExp* pVpt, TimeValue t, INode* pNode, int flags, bool selected, BOOL isStandAlone);
ManipExport Box3 GetBoundingBox(INode* pNode, ViewExp* pVpt);
// Gizmo flags
// Don't display this gizmo. It is still hit-tested.
ManipExport static const DWORD kGizmoDontDisplay;
// Don't hit test this gizmo. It is still displayed.
ManipExport static const DWORD kGizmoDontHitTest;
// Scale this gizmo to viewport size, using mGizmoSize as the size in pixels
// Only for mesh and shape gizmos.
ManipExport static const DWORD kGizmoScaleToViewport;
// The coordinates are in normalized screen space. the X and Y values are
// in the range 0.0 to 1.0, and interpreted as percentages of screen space.
// This is only supported for PolyShape, Marker and Text gizmos.
ManipExport static const DWORD kGizmoUseRelativeScreenSpace;
// The coordinates are in screen space.
// This is only supported for PolyShape, Marker and Text gizmos.
ManipExport static const DWORD kGizmoUseScreenSpace;
// Only display the gizmo in the active viewport.
ManipExport static const DWORD kGizmoActiveViewportOnly;
private:
void RenderMesh(ViewExp* pVpt, TimeValue t, INode* pNode, int flags, bool selected, BOOL isStandAlone);
void RenderShape(ViewExp* pVpt, TimeValue t, INode* pNode, int flags, bool selected, BOOL isStandAlone);
void RenderMarker(ViewExp* pVpt, TimeValue t, INode* pNode, int flags, bool selected, BOOL isStandAlone);
void RenderText(ViewExp* pVpt, TimeValue t, INode* pNode, int flags, bool selected, BOOL isStandAlone);
BOOL HitTestShape(GraphicsWindow* pGW, HitRegion* pHR, ManipHitList* pHitList,
Matrix3* tm, IPoint2 pScreenPoint, int gizmoIndex);
BOOL HitTestMesh(GraphicsWindow* pGW, HitRegion* pHR, ManipHitList* pHitList,
Matrix3* tm, IPoint2 pScreenPoint, int gizmoIndex);
BOOL HitTestMarker(GraphicsWindow* pGW, HitRegion* pHR, ManipHitList* pHitList,
Matrix3* tm, IPoint2 pScreenPoint, int gizmoIndex);
BOOL HitTestText(GraphicsWindow* pGW, HitRegion* pHR, ManipHitList* pHitList,
Matrix3* tm, IPoint2 pScreenPoint, int gizmoIndex);
Box3 GetShapeBoundingBox(INode* pNode, ViewExp* pVpt);
Box3 GetMeshBoundingBox(INode* pNode, ViewExp* pVpt);
Point3 GetMarkerBoundingBox(INode* pNode, ViewExp* pVpt);
Box3 GetTextBoundingBox(INode* pNode, ViewExp* pVpt);
void GetScaleFactor(GraphicsWindow* pGW, Point3& scale, Point3& center);
void GetScreenCoords(GraphicsWindow* pGW, Point3& input, int& x, int& y);
BOOL UseScreenSpace() { return mFlags & kGizmoUseRelativeScreenSpace ||
mFlags & kGizmoUseScreenSpace; }
PolyShape* mpShape; // Polyshape gizmo
Mesh* mpMesh; // Mesh gizmo
Point3 mPosition; // Used for markers and text
MarkerType* mpMarkerType; // Used for marker gizmos
TSTR* mpText; // Used for text gizmos
Point3 mUnselColor; // Color of gizmo
Point3 mSelColor; // Color of gizmo when selected
DWORD mFlags; // Display and hit testing flags
// The size of the gizmo in pixels for kGizmoScaleToViewport gizmos.
int mGizmoSize;
};
enum MouseState {
kMouseIdle,
kMouseDragging,
kMouseOverManip,
};
// Manipulator with a built-in ParamBlock2 and many methods implemented
// by default.
// SimpleManipulator also provides support for a table of meshes ,
// poly shapes, markers and text for use as gizmos.
// FnPub interface to SimpleManipulators (for scripted manipulators)
#define SIMPLE_MANIP_INTERFACE Interface_ID(0x617c41d4, 0x6af06a5f)
class ISimpleManipulator : public FPMixinInterface
{
public:
// the published API
virtual void ClearPolyShapes()=0;
virtual void AppendPolyShape(PolyShape* pPolyShape, DWORD flags,
Point3& unselColor,
Point3& selColor = ColorMan()->GetColorAsPoint3(kManipulatorsSelected))=0;
virtual void AppendGizmo(GizmoShape* pGizmoShape, DWORD flags,
Point3& unselColor,
Point3& selColor = ColorMan()->GetColorAsPoint3(kManipulatorsSelected))=0;
virtual void AppendMesh(Mesh* pMesh, DWORD flags,
Point3& unselColor,
Point3& selColor = ColorMan()->GetColorAsPoint3(kManipulatorsSelected))=0;
virtual void AppendMarker(MarkerType markerType, Point3& position,
DWORD flags,
Point3& unselColor,
Point3& selColor = ColorMan()->GetColorAsPoint3(kManipulatorsSelected))=0;
virtual void AppendText(TCHAR* pText, Point3& position,
DWORD flags,
Point3& unselColor,
Point3& selColor = ColorMan()->GetColorAsPoint3(kManipulatorsSelected))=0;
virtual MouseState GetMouseState()=0;
virtual void GetLocalViewRay(ViewExp* pVpt, IPoint2& m, Ray& viewRay)=0;;
virtual void UpdateShapes(TimeValue t, TSTR& toolTip)=0;
virtual void OnMouseMove(TimeValue t, ViewExp* pVpt, IPoint2& m, DWORD flags, ManipHitData* pHitData)=0;
// Function IDs
enum { clearPolyShapes, appendPolyShape, appendMesh, getMouseState, getLocalViewRay,
updateShapes, onMouseMove, appendGizmo, appendMarker, appendText};
// enumeration IDs
enum { mouseState, markerType, };
// Function Map
BEGIN_FUNCTION_MAP
VFN_0(clearPolyShapes, ClearPolyShapes );
VFN_4(appendMesh, FPAppendMesh, TYPE_MESH, TYPE_INT, TYPE_POINT3_BV, TYPE_POINT3_BV);
VFN_4(appendGizmo, FPAppendGizmo, TYPE_INTERFACE, TYPE_INT, TYPE_POINT3_BV, TYPE_POINT3_BV);
VFN_5(appendMarker, FPAppendMarker, TYPE_ENUM, TYPE_POINT3_BV, TYPE_INT, TYPE_POINT3_BV, TYPE_POINT3_BV);
VFN_5(appendText, AppendText, TYPE_STRING, TYPE_POINT3_BV, TYPE_INT, TYPE_POINT3_BV, TYPE_POINT3_BV);
VFN_2(updateShapes, UpdateShapes, TYPE_TIMEVALUE, TYPE_TSTR_BR);
// VFN_3(onMouseMove, FPOnMouseMove, TYPE_TIMEVALUE, TYPE_POINT2_BV, TYPE_INT);
FN_1(getLocalViewRay, TYPE_RAY_BV, FPGetLocalViewRay, TYPE_POINT2_BV);
RO_PROP_FN(getMouseState, GetMouseState, TYPE_ENUM);
END_FUNCTION_MAP
// FP interface type-converter wrappers
ManipExport Ray FPGetLocalViewRay(Point2& m);
ManipExport void FPAppendMesh(Mesh* pMesh, DWORD flags, Point3& unselColor, Point3& selColor);
ManipExport void FPAppendGizmo(FPInterface* pGizmo, DWORD flags, Point3& unselColor, Point3& selColor);
// ManipExport void FPOnMouseMove(TimeValue t, Point2& m, DWORD flags);
ManipExport void FPAppendMarker(int markerType, Point3& position,
DWORD flags, Point3& unselColor, Point3& selColor);
ManipExport FPInterfaceDesc* GetDesc();
};
class SimpleManipulator: public Manipulator, public ISimpleManipulator
{
public:
ManipExport SimpleManipulator();
ManipExport SimpleManipulator(INode* pNode);
ManipExport ~SimpleManipulator();
// ReferenceMaker functions
ManipExport int NumRefs();
ManipExport RefTargetHandle GetReference(int i);
ManipExport void SetReference(int i, RefTargetHandle rtarg);
ManipExport RefResult NotifyRefChanged(Interval changeInt,RefTargetHandle hTarget,
PartID& partID, RefMessage message);
// From Object
ManipExport ObjectState Eval(TimeValue time);
void InitNodeName(TSTR& s) {s = GetObjectName();}
ManipExport Interval ObjectValidity(TimeValue t);
// From GeomObject
ManipExport void GetWorldBoundBox(TimeValue t, INode* inode, ViewExp* vpt, Box3& box );
ManipExport void GetLocalBoundBox(TimeValue t, INode* inode, ViewExp* vpt, Box3& box );
ManipExport void GetDeformBBox(TimeValue t, Box3& box, Matrix3 *tm, BOOL useSel );
ManipExport void BeginEditParams( IObjParam *ip, ULONG flags,Animatable *prev);
ManipExport void EndEditParams( IObjParam *ip, ULONG flags,Animatable *next);
// Animatable methods
ManipExport void GetClassName(TSTR& s) {s = GetObjectName();}
ManipExport int NumSubs() { return 1; }
ManipExport Animatable* SubAnim(int i) { return mpPblock; }
ManipExport TSTR SubAnimName(int i);
BaseInterface* GetInterface(Interface_ID id) { if (id == SIMPLE_MANIP_INTERFACE) return (ISimpleManipulator*)this; else return FPMixinInterface::GetInterface(id); }
// Implement the basic manipulator operations
ManipExport int HitTest(TimeValue t, INode* pNode, int type, int crossing,
int flags, IPoint2 *pScreenPoint, ViewExp *pVpt);
ManipExport int Display(TimeValue t, INode* pNode, ViewExp *pVpt, int flags);
ManipExport static const int kNoneSelected;
ManipExport void ClearPolyShapes();
ManipExport void AppendPolyShape(PolyShape* pPolyShape, DWORD flags,
Point3& unselColor,
Point3& selColor = ColorMan()->GetColorAsPoint3(kManipulatorsSelected));
ManipExport void AppendGizmo(GizmoShape* pGizmoShape, DWORD flags,
Point3& unselColor,
Point3& selColor = ColorMan()->GetColorAsPoint3(kManipulatorsSelected));
ManipExport void AppendMesh(Mesh* pMesh, DWORD flags,
Point3& unselColor,
Point3& selColor = ColorMan()->GetColorAsPoint3(kManipulatorsSelected));
ManipExport void AppendMarker(MarkerType markerType, Point3& position,
DWORD flags,
Point3& unselColor,
Point3& selColor = ColorMan()->GetColorAsPoint3(kManipulatorsSelected));
ManipExport void AppendText(TCHAR* pText, Point3& position,
DWORD flags,
Point3& unselColor,
Point3& selColor = ColorMan()->GetColorAsPoint3(kManipulatorsSelected));
ManipExport TSTR& GetManipName() {return mToolTip; }
ManipExport void SetGizmoScale(float gizmoScale) { mGizmoScale = gizmoScale; }
ManipExport TSTR& GetToolTip() { return mToolTip; }
ManipExport void SetToolTipWnd(HWND hWnd) { mToolTipWnd = hWnd; }
ManipExport void SetToolTipTimer(UINT timer) { mToolTipTimer = timer; }
ManipExport UINT GetToolTipTimer() { return mToolTipTimer; }
ManipExport HWND GetToolTipWnd() { return mToolTipWnd; }
ManipExport IParamBlock2* GetPBlock() { return mpPblock; }
// These must be implemented in the sub-class of SimpleManipulator
// Called when the sub-class needs to update it's poly shapes
// The toolTip string is used to signal
virtual void UpdateShapes(TimeValue t, TSTR& toolTip) = 0;
ManipExport virtual void ManipulatorSelected() {};
ManipExport void SetManipTarget(RefTargetHandle hTarg);
ManipExport RefTargetHandle GetManipTarget() { return mhTarget; }
ManipExport void SetMouseState(MouseState state) { mState = state; }
ManipExport MouseState GetMouseState() { return mState; }
ManipExport void OnButtonDown(TimeValue t, ViewExp* pVpt, IPoint2& m, DWORD flags, ManipHitData* pHitData);
ManipExport void OnMouseMove(TimeValue t, ViewExp* pVpt, IPoint2& m, DWORD flags, ManipHitData* pHitData);
ManipExport void OnButtonUp(TimeValue t, ViewExp* pVpt, IPoint2& m, DWORD flags, ManipHitData* pHitData);
ManipExport DisplayState MouseEntersObject(TimeValue t, ViewExp* pVpt, IPoint2& m, ManipHitData* pHitData);
ManipExport DisplayState MouseLeavesObject(TimeValue t, ViewExp* pVpt, IPoint2& m, ManipHitData* pHitData);
ManipExport IPoint2& GetTipPos() { return mToolTipPos; }
// Get the view ray going through the given screen coordinate.
// result is in local coordinates of the owning INode.
ManipExport void GetLocalViewRay(ViewExp* pVpt, IPoint2& m, Ray& viewRay);
ManipExport Invalidate() { mValid = NEVER; }
// From Object
BOOL UseSelectionBrackets() { return FALSE; }
ManipExport void UnRegisterViewChange(BOOL fromDelete = FALSE);
void RegisterViewChange();
void SetResettingFlag(BOOL val) { mResetting = val; }
BOOL GetResettingFlag() { return mResetting; }
ManipExport void KillToolTip();
ManipExport Point3 GetUnselectedColor();
ManipExport BOOL ActiveViewOnly() { return mActiveViewOnly; }
protected:
// Index of manip that mouse is over, for display
int mDispSelectedIndex;
TSTR mToolTip; // text and location for tooltip
float mGizmoScale;
IParamBlock2 *mpPblock;
Interval mValid; // Validity of reference
RefTargetHandle mhTarget; // The object/modifier/controller being manipulated
MouseState mState;
BOOL mActiveViewOnly;
BOOL mResetting;
private:
void StartToolTipTimer(HWND hWnd, IPoint2& m);
Tab<ManipulatorGizmo*> mGizmos;
// Tooltip management
HWND mToolTipWnd;
HWND mToolTipParent;
UINT mToolTipTimer;
IPoint2 mToolTipPos;
bool mNotificationsRegistered;
};
// Stock gizmo objects
ManipExport Mesh* MakeSphere(Point3& pos, float radius, int segments);
ManipExport Mesh* MakeTorus(Point3& pos, float radius, float radius2, int segs, int sides);
ManipExport Mesh* MakeBox(Point3& pos, float l, float w, float h, int lsegs, int wsegs, int hsegs);
ManipExport void AddCubeShape(PolyShape& shape, Point3& pos, float size);
// Special storage class for hit records so we can know which manipulator was hit
class ManipHitData : public HitData
{
public:
Manipulator* mpManip;
int mShapeIndex;
ManipExport ManipHitData(Manipulator* pManip) {
mpManip = pManip;
mShapeIndex = -1;
}
ManipExport ManipHitData() {
mpManip = NULL;
}
virtual ManipHitData* Copy() { return new ManipHitData(mpManip); }
ManipExport ~ManipHitData() {}
};
// Special storage class for hit records so we can know which manipulator was hit
class SimpleManipHitData : public ManipHitData
{
public:
ManipExport SimpleManipHitData(int shapeIndex, Manipulator* pManip) {
mpManip = pManip;
mShapeIndex = shapeIndex;
}
ManipExport SimpleManipHitData() {
mShapeIndex = -1;
mpManip = NULL;
}
ManipExport ~SimpleManipHitData() {}
virtual ManipHitData* Copy() { return new SimpleManipHitData(mShapeIndex, mpManip); }
};
@@ -0,0 +1,94 @@
/**********************************************************************
*<
FILE: MaxIcon.h
DESCRIPTION: Max Icon and Icon Table definitions
CREATED BY: Scott Morrison
HISTORY: Created 15 March, 2000,
*> Copyright (c) 2000, All Rights Reserved.
**********************************************************************/
#ifndef __ICONMAN__
#define __ICONMAN__
// A MaxIcon is an abstract class that represents an icon image for
// toolbar buttons, icons in list boxes, etc. The class is based
// on Win32 ImageLists. MaxIcons must provide an image list and
// index into the list for both large (24x24) and small (16x15) icons.
#include "object.h"
#include "iColorMan.h"
class ICustButton;
class MaxIcon : public InterfaceServer {
public:
// Get the image list for the size of icons that the user has chose
virtual HIMAGELIST GetDefaultImageList() = 0;
// Get the image list for small icons
virtual HIMAGELIST GetSmallImageList() = 0;
// Get the image list for large icons
virtual HIMAGELIST GetLargeImageList() = 0;
// Get the index into the image list for the small version of this
// particular icon.
virtual int GetSmallImageIndex(bool enabledVersion = true,
COLORREF backgroundColor =
GetCustSysColor( COLOR_BTNFACE) ) = 0;
// Get the index into the image list for the large version of this
// particular icon.
virtual int GetLargeImageIndex(bool enabledVersion = true,
COLORREF backgroundColor =
GetCustSysColor( COLOR_BTNFACE) ) = 0;
// Get the index into the image list for the default version of this
// particular icon.
int GetDefaultImageIndex(bool enabledVersion = true,
COLORREF backgroundColor =
GetCustSysColor( COLOR_BTNFACE) );
// returns true if the icons has an alpha mask that needs to be blended
// with the background color.
virtual bool UsesAlphaMask() = 0;
};
// This implementation of MaxIcon is for the icon images that are stored
// as ".bmp" files in MAX's UI directory. This is used by the macroScript
// facility in MAXSrcipt to specify icons. See the documentation for
// "macroScript" for the exact meaning of the filename and index.
class MaxBmpFileIcon: public MaxIcon {
public:
CoreExport MaxBmpFileIcon(TCHAR* pFilePrefix, int index);
CoreExport MaxBmpFileIcon(SClass_ID sid, Class_ID cid);
CoreExport HIMAGELIST GetDefaultImageList();
CoreExport HIMAGELIST GetSmallImageList();
CoreExport HIMAGELIST GetLargeImageList();
CoreExport int GetSmallImageIndex(bool enabledVersion = true,
COLORREF backgroundColor =
GetCustSysColor( COLOR_BTNFACE) );
CoreExport int GetLargeImageIndex(bool enabledVersion = true,
COLORREF backgroundColor =
GetCustSysColor( COLOR_BTNFACE) );
CoreExport bool UsesAlphaMask();
CoreExport TSTR& GetFilePrefix() { return mFilePrefix; }
CoreExport int GetIndex() { return mIndex; }
private:
int mIndex;
TSTR mFilePrefix;
};
CoreExport HIMAGELIST GetIconManDefaultImageList();
CoreExport HIMAGELIST GetIconManSmallImageList();
CoreExport HIMAGELIST GetIconManLargeImageList();
CoreExport BOOL LoadMAXFileIcon(TCHAR* pFile, HIMAGELIST hImageList, ColorId color, BOOL disabled);
#endif
@@ -0,0 +1,372 @@
/* 3DMath.h - the 3D math family of classes - vectors, rays, quat, matrices for MAXScript
*
* Copyright (c) John Wainwright, 1996
*
*
*/
#ifndef _H_3DMATH
#define _H_3DMATH
#include "Max.h"
extern ScripterExport void _QuatToEuler(Quat &q, float *ang);
extern ScripterExport void _EulerToQuat(float *ang, Quat &q);
/* ------------------------ Point3Value ------------------------------ */
applyable_class (Point3Value)
class Point3Value : public Value
{
public:
Point3 p;
ENABLE_STACK_ALLOCATE(Point3Value);
ScripterExport Point3Value(Point3 init_point);
ScripterExport Point3Value(float x, float y, float z);
ScripterExport Point3Value(Value* x, Value* y, Value* z);
classof_methods(Point3Value, Value);
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
# define is_point3(p) ((p)->tag == class_tag(Point3Value))
static Value* make(Value**arg_list, int count);
/* operations */
#include "defimpfn.h"
# include "vectpro.h"
use_generic ( coerce, "coerce");
use_generic ( copy, "copy");
use_generic ( get, "get");
use_generic ( put, "put");
/* built-in property accessors */
def_property ( x );
def_property ( y );
def_property ( z );
Point3 to_point3() { return p; }
AColor to_acolor() { return AColor (p.x / 255.0f, p.y / 255.0f, p.z / 255.0f); }
Point2 to_point2() { return Point2 (p.x, p.y); }
void to_fpvalue(FPValue& v) { v.p = new Point3 (p); v.type = (ParamType2)TYPE_POINT3; }
// scene I/O
IOResult Save(ISave* isave);
static Value* Load(ILoad* iload, USHORT chunkID, ValueLoader* vload);
};
class ConstPoint3Value : public Point3Value
{
public:
ScripterExport ConstPoint3Value(float x, float y, float z)
: Point3Value (x, y, z) { }
void collect() { delete this; }
BOOL is_const() { return TRUE; }
Value* set_x(Value** arg_list, int count) { throw RuntimeError (_T("Constant vector, not settable")); return NULL; }
// Win64 Cleanup: Shuler
Value* set_y(Value** arg_list, int count) { throw RuntimeError (_T("Constant vector, not settable")); return NULL; }
// Win64 Cleanup: Shuler
Value* set_z(Value** arg_list, int count) { throw RuntimeError (_T("Constant vector, not settable")); return NULL; }
// Win64 Cleanup: Shuler
};
/* ------------------------ RayValue ------------------------------ */
applyable_class (RayValue)
class RayValue : public Value
{
public:
Ray r;
ENABLE_STACK_ALLOCATE(RayValue);
ScripterExport RayValue(Point3 init_origin, Point3 init_dir);
ScripterExport RayValue(Ray init_ray);
classof_methods (RayValue, Value);
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
/* operations */
use_generic ( copy, "copy");
/* built-in property accessors */
def_property ( pos );
def_property_alias ( position, pos );
def_property ( dir );
Ray to_ray() { return r; }
void to_fpvalue(FPValue& v) { v.ray = new Ray (r); v.type = TYPE_RAY; }
// scene I/O
IOResult Save(ISave* isave);
static Value* Load(ILoad* iload, USHORT chunkID, ValueLoader* vload);
};
/* ------------------------ QuatValue ------------------------------ */
applyable_class (QuatValue)
class QuatValue : public Value
{
public:
Quat q;
ENABLE_STACK_ALLOCATE(QuatValue);
ScripterExport QuatValue(const Quat& init_quat);
ScripterExport QuatValue(float w, float x, float y, float z);
ScripterExport QuatValue(Value* w, Value* x, Value* y, Value* z);
ScripterExport QuatValue(Value* val);
ScripterExport QuatValue(AngAxis& aa);
ScripterExport QuatValue(float* angles);
ScripterExport QuatValue(Matrix3& m);
classof_methods (QuatValue, Value);
# define is_quat(o) ((o)->tag == class_tag(QuatValue))
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
/* operations */
#include "defimpfn.h"
# include "quatpro.h"
use_generic ( copy, "copy");
/* built-in property accessors */
def_property ( w );
def_property ( x );
def_property ( y );
def_property ( z );
def_property ( angle );
def_property ( axis );
Quat to_quat() { return q; }
AngAxis to_angaxis() { return AngAxis(q); }
void to_fpvalue(FPValue& v) { v.q = new Quat (q); v.type = TYPE_QUAT; }
// scene I/O
IOResult Save(ISave* isave);
static Value* Load(ILoad* iload, USHORT chunkID, ValueLoader* vload);
};
/* ------------------------ AngleAxis ------------------------------ */
applyable_class (AngAxisValue)
class AngAxisValue : public Value
{
public:
AngAxis aa;
ENABLE_STACK_ALLOCATE(AngAxisValue);
ScripterExport AngAxisValue(const AngAxis& iaa);
ScripterExport AngAxisValue(const Quat& q);
ScripterExport AngAxisValue(const Matrix3& m);
ScripterExport AngAxisValue(float* angles);
ScripterExport AngAxisValue(float angle, Point3 axis);
ScripterExport AngAxisValue(Value*);
ScripterExport AngAxisValue(Value* angle, Value* axis);
classof_methods (AngAxisValue, Value);
# define is_angaxis(o) ((o)->tag == class_tag(AngAxisValue))
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
/* operations */
#include "defimpfn.h"
use_generic( coerce, "coerce" );
use_generic( eq, "=");
use_generic( ne, "!=");
use_generic( random, "random");
use_generic( copy, "copy");
/* built-in property accessors */
def_property ( angle );
def_property ( axis );
def_property ( numrevs );
AngAxis to_angaxis() { return aa; }
Quat to_quat() { return Quat (aa); }
void to_fpvalue(FPValue& v) { v.aa = new AngAxis (aa); v.type = TYPE_ANGAXIS; }
// scene I/O
IOResult Save(ISave* isave);
static Value* Load(ILoad* iload, USHORT chunkID, ValueLoader* vload);
};
/* ------------------------ EulerAngles ------------------------------ */
applyable_class (EulerAnglesValue)
class EulerAnglesValue : public Value
{
public:
float angles[3];
ENABLE_STACK_ALLOCATE(EulerAnglesValue);
ScripterExport EulerAnglesValue(float ax, float ay, float az);
ScripterExport EulerAnglesValue(const Quat&);
ScripterExport EulerAnglesValue(const Matrix3&);
ScripterExport EulerAnglesValue(const AngAxis&);
classof_methods (EulerAnglesValue, Value);
# define is_eulerangles(o) ((o)->tag == class_tag(EulerAnglesValue))
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
/* operations */
#include "defimpfn.h"
use_generic( coerce, "coerce" );
use_generic( eq, "=");
use_generic( ne, "!=");
use_generic( random, "random");
use_generic( copy, "copy");
/* built-in property accessors */
def_property ( x );
def_property ( y );
def_property ( z );
def_property ( x_rotation );
def_property ( y_rotation );
def_property ( z_rotation );
AngAxis to_angaxis() { return AngAxis (to_quat()); }
Quat to_quat() { Quat q; _EulerToQuat(angles, q); return Quat (q); }
void to_fpvalue(FPValue& v) { Quat q; _EulerToQuat(angles, q); v.q = new Quat (q); v.type = TYPE_QUAT; }
float* to_eulerangles() { return angles; }
// scene I/O
IOResult Save(ISave* isave);
static Value* Load(ILoad* iload, USHORT chunkID, ValueLoader* vload);
};
/* ------------------------ Matrix ------------------------------ */
applyable_class (Matrix3Value)
class Matrix3Value : public Value
{
public:
Matrix3 m;
ENABLE_STACK_ALLOCATE(Matrix3Value);
ScripterExport Matrix3Value(int i);
ScripterExport Matrix3Value(const Matrix3& im);
ScripterExport Matrix3Value(const Quat& q);
ScripterExport Matrix3Value(const AngAxis& aa);
ScripterExport Matrix3Value(float* angles);
ScripterExport Matrix3Value(const Point3& row0, const Point3& row1, const Point3& row2, const Point3& row3);
classof_methods (Matrix3Value, Value);
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
# define is_matrix3(p) ((p)->tag == class_tag(Matrix3Value))
/* operations */
#include "defimpfn.h"
# include "matpro.h"
use_generic( copy, "copy");
/* built-in property accessors */
def_property ( row1 );
def_property ( row2 );
def_property ( row3 );
def_property ( row4 );
def_property ( translation );
def_property ( pos );
def_property ( rotation );
def_property ( scale );
use_generic( get, "get");
use_generic( put, "put");
Value* get_property(Value** arg_list, int count);
Value* set_property(Value** arg_list, int count);
Matrix3& to_matrix3() { return m; }
Quat to_quat() { return Quat (m); }
void to_fpvalue(FPValue& v) { v.m = new Matrix3; *v.m = m; v.type = TYPE_MATRIX3; }
// scene I/O
IOResult Save(ISave* isave);
static Value* Load(ILoad* iload, USHORT chunkID, ValueLoader* vload);
};
/* ------------------------ Point2Value ------------------------------ */
applyable_class (Point2Value)
class Point2Value : public Value
{
public:
Point2 p;
ENABLE_STACK_ALLOCATE(Point2Value);
ScripterExport Point2Value(Point2 ipoint);
ScripterExport Point2Value(POINT ipoint);
ScripterExport Point2Value(float x, float y);
ScripterExport Point2Value(Value* x, Value* y);
classof_methods(Point2Value, Value);
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
# define is_point2(p) ((p)->tag == class_tag(Point2Value))
static Value* make(Value**arg_list, int count);
/* operations */
#include "defimpfn.h"
use_generic( plus, "+" );
use_generic( minus, "-" );
use_generic( times, "*" );
use_generic( div, "/" );
use_generic( eq, "=");
use_generic( ne, "!=");
use_generic( random, "random");
use_generic( length, "length");
use_generic( distance, "distance");
use_generic( normalize, "normalize");
use_generic( copy, "copy");
use_generic( get, "get");
use_generic( put, "put");
/* built-in property accessors */
def_property ( x );
def_property ( y );
Point2 to_point2() { return p; }
void to_fpvalue(FPValue& v) { v.p2 = new Point2(p); v.type = TYPE_POINT2; }
// scene I/O
IOResult Save(ISave* isave);
static Value* Load(ILoad* iload, USHORT chunkID, ValueLoader* vload);
};
#endif
@@ -0,0 +1,124 @@
/* Arrays.h - the Array family of classes for MAXScript
*
* Copyright (c) John Wainwright, 1996
*
*
*/
#ifndef _H_ARRAYS
#define _H_ARRAYS
#include "Collect.h"
/* ------------------------ Array ------------------------------ */
visible_class (Array)
class Array : public Value, public Collection
{
public:
int size; // array size
int data_size; // allocated array buffer size (in Value*'s)
Value** data; // the array elements (uninitialized are set to undefined)
static CRITICAL_SECTION array_update; // for syncing array updates
ScripterExport Array(int init_size);
ScripterExport ~Array() { if (data) free(data); }
classof_methods (Array, Value);
static Value* make(Value** arg_list, int count);
static void setup();
Value*& operator[](const int i) const { return data[i]; } // access ith array entry.
# define is_array(v) ((v)->tag == class_tag(Array))
BOOL _is_collection() { return 1; }
BOOL _is_selection() { return 1; }
void gc_trace();
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
// operations
#include "defimpfn.h"
# include "arraypro.h"
use_generic( plus, "+" );
use_generic( copy, "copy" );
use_generic( coerce, "coerce");
ScripterExport Value* map(node_map& m);
ScripterExport Value* map_path(PathName* path, node_map& m);
ScripterExport Value* find_first(BOOL (*test_fn)(INode* node, int level, void* arg), void* test_arg);
ScripterExport Value* get_path(PathName* path);
// built-in property accessors
def_property ( count );
ScripterExport Value* append(Value*);
ScripterExport Value* join(Value*);
ScripterExport Value* sort();
ScripterExport Value* push(Value*);
ScripterExport Value* drop();
ScripterExport Value* get(int index);
ScripterExport BOOL deep_eq(Value* other);
// get selection iterator for an array
SelectionIterator* selection_iterator();
// scene I/O
IOResult Save(ISave* isave);
static Value* Load(ILoad* iload, USHORT chunkID, ValueLoader* vload);
void to_fpvalue(FPValue& v);
};
/* ------------------------ BitArray ------------------------------ */
visible_class (BitArrayValue)
class BitArrayValue : public Value
{
public:
BitArray bits; // the bits
ScripterExport BitArrayValue();
ScripterExport BitArrayValue(BitArray& b);
ScripterExport BitArrayValue(int count);
classof_methods (BitArrayValue, Value);
static Value* make(Value** arg_list, int count);
# define is_BitArrayValue(v) ((v)->tag == class_tag(BitArrayValue))
// BOOL _is_collection() { return 1; }
BOOL _is_selection() { return 1; }
void collect() { delete this; }
void sprin1(CharStream* s);
void can_hold(int index) { if (bits.GetSize() <= index) bits.SetSize(index); }
// operations
#include "defimpfn.h"
# include "arraypro.h"
use_generic( plus, "+" );
use_generic( minus, "-" );
def_generic( uminus, "u-");
use_generic( times, "*" );
use_generic( copy, "copy" );
use_generic( coerce, "coerce");
ScripterExport Value* map(node_map& m);
// built-in property accessors
def_property ( count );
def_property ( numberSet );
def_property ( isEmpty );
SelectionIterator* selection_iterator();
BitArray& to_bitarray() { return bits; }
void to_fpvalue(FPValue& v) { v.bits = &bits; v.type = TYPE_BITARRAY; }
};
#endif
@@ -0,0 +1,163 @@
/*
* BitMaps.h - MAX bitmap access classes
*
* Copyright © John Wainwright 1996
*
*/
#ifndef _H_BITMAPS
#define _H_BITMAPS
#include "Max.h"
#include "MAXObj.h"
#include "COMMDLG.H"
#include "bmmlib.h"
class MAXBitMapWindow;
class MotionTracker;
class MAXBitMap;
typedef struct // entry in MAXBitMap window table
{
HWND window;
MAXBitMap* mbm;
} mbm_window;
/* ------------------------ MAXBitMap ------------------------------ */
applyable_class (MAXBitMap)
class MAXBitMap : public Value
{
public:
BitmapInfo bi; // our BitMapInfo
Bitmap* bm; // the actual bitmap
Tab<MotionTracker*> trackers; // any motion trackers
MotionTracker* dragger; // tracker currently under drag
WNDPROC main_window_proc; // original display window proc if ours installed
GBuffer* gb; // GBuffer if non-NULL
GBufReader* gbr; // current GBuffer reader if non-NULL
short flags;
static Tab<mbm_window> windows; // table of MAXBitMap windows currently open
ScripterExport MAXBitMap();
ScripterExport MAXBitMap(BitmapInfo bi, Bitmap* bm);
~MAXBitMap();
static void setup();
static MAXBitMap* find_window_mbm(HWND hwnd);
classof_methods (MAXBitMap, Value);
# define is_bitmap(o) ((o)->tag == class_tag(MAXBitMap))
void collect() { delete this; }
void gc_trace();
ScripterExport void sprin1(CharStream* s);
Value* new_motionTracker();
void install_window_proc();
#include "defimpfn.h"
def_visible_generic ( display, "display");
def_visible_generic ( unDisplay, "unDisplay" );
def_visible_generic ( save, "save" );
def_visible_generic ( gotoFrame, "gotoFrame");
def_visible_generic ( close, "close");
def_visible_generic ( getTracker, "getTracker" );
def_visible_generic ( deleteTracker, "deleteTracker" );
use_generic ( copy, "copy" );
def_visible_generic ( zoom, "zoom" );
def_visible_generic ( crop, "crop" );
def_visible_generic ( setAsBackground, "setAsBackground" );
def_visible_generic ( getPixels, "getPixels" );
def_visible_generic ( setPixels, "setPixels" );
def_visible_generic ( getIndexedPixels, "getIndexedPixels" );
def_visible_generic ( setIndexedPixels, "setIndexedPixels" );
def_visible_generic ( getChannel, "getChannel" );
def_visible_generic ( getChannelAsMask, "getChannelAsMask" );
Value* get_property(Value** arg_list, int count);
Value* set_property(Value** arg_list, int count);
void to_fpvalue(FPValue& v) { v.bm = new PBBitmap (bi); v.type = TYPE_BITMAP; }
};
#define BM_SAVED 0x0001 // bitmap has been written to.
#define BM_READONLY 0x0002 // existing bitmap opened (and so readonly).
/* -------------------- MotionTracker -------------------------- */
applyable_class (MotionTracker)
class MotionTracker : public Value
{
public:
MAXBitMap* mbm; // the bitmap I'm tracking
int index; // which tracker in that bitmap
int cur_frame; // frame I last tracked
POINT center; // current feature center
RECT bounds; // feature bounds relative to center
RECT motion_bounds; // maximum frame-to-frame motion relative to feature center
POINT mouse_down_at; // mouse pos at mousedown
int handle_x; // handle pos at mouse_down..
int handle_y; // handle pos at mouse_down..
int handle; // which handle is dragging
BYTE* target; // current target image as 3 BYTE RGB per pixel
POINT* track_cache; // keeps a cache of tracking coords, one per frame (inval if change gizmo)
short compare_mode; // feature matching space: rgb color, luminence, edge-filtered, etc.
float match_distance; // last tracking match 'distance'
HBITMAP id_bitmap; // unbelievable - I need to use a bitmap copy to do XOR text drawing
short flags;
MotionTracker(MAXBitMap* imbm, int iindex);
~MotionTracker();
classof_methods(MotionTracker, Value);
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
void gc_trace();
void track();
void clear_track_cache();
void set_center(int x, int y);
void set_index(int i);
void copy_target();
void draw(HWND hWnd);
void draw_gizmo(HDC hdc);
void inval_gizmo();
BOOL start_drag(HWND hwnd, int wParam, long lParam);
void drag(HWND hwnd, int wParam, long lParam);
void end_drag(HWND hwnd);
void move(HWND hwnd, int dx, int dy);
void deselect(HWND hwnd);
def_visible_generic ( resample, "resample");
def_visible_generic ( reset, "reset");
def_property ( center );
Value* get_property(Value** arg_list, int count);
Value* set_property(Value** arg_list, int count);
};
#define MT_GIZMO_SELECTED 0x0001
#define MT_GIZMO_MOVED 0x0002
#define MT_ENABLED 0x0004
#define MT_MATCH_RGB 0
#define MT_MATCH_GRAY 1
#define MT_MATCH_EDGE 2
#define MT_MATCH_RANK 3
#define MT_NO_HANDLE 0 // handle codes...
#define MT_CENTER 1
#define MT_TOPLEFT_BOUNDS 2
#define MT_BOTLEFT_BOUNDS 3
#define MT_TOPRIGHT_BOUNDS 4
#define MT_BOTRIGHT_BOUNDS 5
#define MT_TOPLEFT_MBOUNDS 6
#define MT_BOTLEFT_MBOUNDS 7
#define MT_TOPRIGHT_MBOUNDS 8
#define MT_BOTRIGHT_MBOUNDS 9
#endif
@@ -0,0 +1,149 @@
/* CodeTree.h - the CodeTree class - parser output
*
* Copyright (c) John Wainwright, 1996
*
*
*/
#ifndef _H_CODETREE
#define _H_CODETREE
class CodeTree : public Value
{
public:
Value* fn; /* the function to apply */
short count; /* number of arguments */
Value** arg_list; /* the argument list */
long pos; /* source stream pos */
CodeTree(CharStream* source, Value* codeFn, ...);
~CodeTree();
void gc_trace();
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
ScripterExport Value* eval();
Value* add(Value* arg1, ...);
Value* append(Value* arg);
Value* put(int index, Value* arg);
};
/* Maker class, a special CodeTree node that encodes runtime object
* instantiation. contains a reference to a maker
* static method on the class to be instantiated. It is
* supplied an arg_list like any other codetree fn apply
*/
class Maker : public Value
{
value_cf maker; /* the maker class static fn */
short count; /* number of arguments */
Value** arg_list; /* the argument list */
public:
Maker(value_cf maker_fn, ...);
Maker(Value** arg_list, int count, value_cf maker_fn);
~Maker();
void gc_trace();
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
ScripterExport Value* eval();
Value* add(Value* arg1, ...);
Value* append(Value* arg);
};
/* ------------- debugging support classes -------------- */
// SourceFileWrapper wraps a piece of code in a source file
// context. Evaling this pushes the 'source-file' thread-local,
// evals the wrapped code & pops source-file.
class SourceFileWrapper : public Value
{
public:
Value* file_name;
int pos;
Value* code;
MSZipPackage* package;
SourceFileWrapper(Value* file_name, Value* code, int pos = -1);
void gc_trace();
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s) { code->sprin1(s); }
BOOL _is_function() { return code->_is_function(); }
Value* classOf_vf(Value** arg_list, int count) { return code->classOf_vf(arg_list, count); }
Value* superClassOf_vf(Value** arg_list, int count) { return code->superClassOf_vf(arg_list, count); }
Value* isKindOf_vf(Value** arg_list, int count) { return code->isKindOf_vf(arg_list, count); }
BOOL is_kind_of(ValueMetaClass* c) { return code->is_kind_of(c); }
ScripterExport Value* eval();
ScripterExport Value* eval_no_wrapper();
ScripterExport Value* apply(Value** arglist, int count, CallContext* cc=NULL);
};
// SourceLineMarker instances are stuck in code
// as lines are change
class SourceLineMarker : public Value
{
public:
int pos;
SourceLineMarker(int pos);
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s) { s->printf(_T("<line %d>"), pos); }
ScripterExport Value* eval() { thread_local(source_pos) = pos; return &ok; }
};
// top-level code block, provides a storage for top-level locals
// R4: CodeBlocks can now optionally be 'structured', made of on-handlers and local decls
// So it now supports call_handler() methods and property access to get at locals.
// If structured, there must at least be an 'on execute' handler which becomes the main
// executable body of the CodeBlock, and simple eval()'s onthe codeblock turn into
// call_handler(n_execute...);
// Further, locals in a structured codeblock are now effectively static, as are
// locals in rollups and plugins, they are initialized once the first time the block
// is used and have a lifetime corresponding to the lifetime of the codeblock. The
// per-execution-lifetime locals should be moved into the body of the 'on execute'
// handler. -- JBW 2/29/00
class CodeBlock : public Value
{
public:
Value* code; // the code
Value** locals; // local var array
int local_count; // " " count
HashTable* local_scope; // local name space
HashTable* handlers; // handler tables
BOOL initialized; // if locals in structured macroScript have been inited
CodeBlock();
~CodeBlock();
#define is_codeblock(v) (v->tag == INTERNAL_CODEBLOCK_TAG)
void init(Value* code, HashTable* local_scope);
void init_locals();
void collect() { delete this; }
void gc_trace();
void sprin1(CharStream* s);
void add_local();
Value* call_handler(Value* handler_or_name, Value** arg_list, int count);
Value* get_handler(Value* name);
Value* eval();
Value* get_property(Value** arg_list, int count);
Value* set_property(Value** arg_list, int count);
};
#endif
@@ -0,0 +1,130 @@
/* Collectable.h - Collectables include
*
* Copyright (c) John Wainwright, 1996
*
*/
#ifndef _H_COLLECTIBLE
#define _H_COLLECTIBLE
enum col_state {booting, pre_gc, in_mutator, in_mark, in_sweep, closing_down };
typedef struct free_mem free_mem; // free mem linked list entry
struct free_mem
{
free_mem* next;
free_mem* prev;
size_t size;
};
// collection flag bits ...
enum gc_flags
{
GC_IN_USE = 0x0001,
GC_GARBAGE = 0x0002,
GC_PERMANENT = 0x0004,
GC_IN_HEAP = 0x0008,
GC_NOT_NEW = 0x0010,
GC_STATIC = 0x0020,
GC_ON_STACK = 0x0040,
GC_MIGRATED_TO_HEAP = 0x0080,
};
class Value;
class ValueMapper;
#define ALLOCATOR_STACK_SIZE 1024000 // initial size of allocation stack per thread
extern ScripterExport void push_alloc_frame(); // manage alloc stack...
extern ScripterExport void pop_alloc_frame();
extern ScripterExport void pop_alloc_frame(Value*& result); // pops & moves result into callers frame if only on stack
#define ENABLE_STACK_ALLOCATE(_class) \
ScripterExport void* operator new (size_t sz) { return stack_alloc(sz); } \
ScripterExport void* operator new (size_t sz, char flag) { return Collectable::operator new (sz, flag); }
// free-list is kept in a number of separate size-related sub-lists, specifically
// for the high-bandwidth low size allocs.
// the heads of these are in the free_list static array in Collectable.
// each consecutive sub-list is for chunks one GC_ALLOC_MULTIPLE greater than the previous.
// the following defines determine the number of sub-lists.
#define GC_NUM_SUBLISTS 128
#define GC_LOW_SUBLIST 16 // <16, 16, 20, 24, 28, 32, ... 512, >512
#define GC_SUBLIST_INDEX_SHIFT 4 // log2(LOW_SUBLIST)
class Collectable
{
public:
Collectable* next; // in heap: links (in whichever collector list this value is in);
// on stack: pointer to heap migrated value, NULL if not migrated
Collectable* prev;
static CRITICAL_SECTION heap_update; // for syncing allocation list updates
short flags; // collection flags
static Collectable* collectable_list; // head of the collectable list
static Collectable* permanent_list; // head of the permanent list
static free_mem* free_list[GC_NUM_SUBLISTS]; // head of the free list
static size_t heap_allocated; // running count of MAXScript heap usage
static size_t heap_size; // alloc'd heap size
static col_state state; // current collector state
ScripterExport Collectable();
ScripterExport ~Collectable();
static ScripterExport void for_all_values(void (*map_fn)(Value* val), ValueMapper* mapper = NULL, ValueMetaClass* c = NULL);
ScripterExport static void* heap_alloc(size_t sz);
ScripterExport static void* stack_alloc(size_t sz);
ScripterExport static void heap_free(void* p);
ScripterExport void* operator new (size_t sz, char flag);
ScripterExport void* operator new (size_t sz) { return heap_alloc(sz); }
ScripterExport void operator delete (void* val);
ScripterExport void operator delete (void* val, char flag) { Collectable::operator delete(val); }
static void mark();
static void sweep();
static void setup(size_t);
ScripterExport static void gc();
static void coalesce_free_list();
virtual void collect() = 0; // does the actual collecting, needs to be virtual to get right size to operator delete
virtual void gc_trace() { mark_in_use(); } // the marking scanner, default is mark me in use
static void close_down();
static void drop_maxwrapper_refs();
ScripterExport void make_collectable();
void make_permanent(); // no long exported, must use make_heap_permanent AND use its result as the made-permament value
void make_static(); // " " " make_heap_static AND " " "
ScripterExport static void push_alloc_stack_frame();
ScripterExport static void pop_alloc_stack_frame();
int is_marked() { return (flags & GC_IN_USE); }
int is_not_marked()
{
assert (!is_on_stack()); // debugging new stack-based collector
return !is_marked();
}
int is_garbage() { return is_not_marked(); }
int is_permanent() { return (flags & GC_PERMANENT); }
void mark_in_use() { flags |= GC_IN_USE; }
void unmark_in_use() { flags &= ~GC_IN_USE; }
int has_heap_copy() { return (flags & (GC_IN_HEAP | GC_MIGRATED_TO_HEAP | GC_STATIC)); }
int is_in_heap() { return (flags & GC_IN_HEAP); }
int is_on_stack() { return (flags & GC_ON_STACK); }
};
// mapping object for Collectable::for_all_values()
class ValueMapper
{
public:
virtual void map(Value* val)=0;
};
ScripterExport void ms_free(void* p);
ScripterExport void* ms_malloc(size_t sz);
inline void ms_make_collectable(Collectable* v) { if (v != NULL && Collectable::state != closing_down) v->make_collectable(); }
#endif
@@ -0,0 +1,34 @@
/* Collection.h - MAXScript Collection classes
*
* Copyright (c) John Wainwright, 1996
*
*
*/
#ifndef _H_COLLECTION
#define _H_COLLECTION
class PathName;
class Collection
{
public:
# define is_collection(v) ((v)->_is_collection())
virtual Value* map_path(PathName* path, value_vf vfn_ptr, value_cf cfn_ptr, Value** arg_list, int count);
virtual Value* find_first(BOOL (*test_fn)(INode* node, int level, void* arg), void* test_arg);
virtual Value* get_path(PathName* path_name);
};
class SelectionIterator
{
public:
# define is_selection(v) ((v)->_is_selection())
virtual int next() { return -1; }
virtual BOOL more() { return FALSE; }
virtual void rewind() { }
virtual BOOL selected(int index) { return FALSE; }
};
#endif
@@ -0,0 +1,94 @@
/* ColorValue.h - the color class for MAXScript
*
* Copyright (c) John Wainwright, 1997
*
*/
#ifndef _H_COLORVALUE
#define _H_COLORVALUE
#include "Max.h"
#include "COMMDLG.H"
#include "bmmlib.h"
#include "3DMath.h"
#define COLOR_CACHE_SIZE 1024 // must be power of 2
/* ------------------------ Color ------------------------------ */
applyable_class (ColorValue)
class ColorValue : public Value
{
public:
AColor color;
ENABLE_STACK_ALLOCATE(ColorValue);
ScripterExport ColorValue (AColor col);
ScripterExport ColorValue (Color col);
ScripterExport ColorValue (COLORREF col);
ScripterExport ColorValue (BMM_Color_64& col);
ScripterExport ColorValue (Point3 col);
ScripterExport ColorValue (Point3Value* col);
ScripterExport ColorValue (float r, float g, float b, float a = 1.0f);
static ScripterExport Value* intern(AColor col);
static ScripterExport Value* intern(float r, float g, float b, float a = 1.0f);
static ScripterExport Value* intern(BMM_Color_64& col);
classof_methods (ColorValue, Value);
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
# define is_color(c) ((c)->tag == class_tag(ColorValue))
#include "defimpfn.h"
# include "colorpro.h"
def_generic ( coerce, "coerce");
def_generic ( copy, "copy");
def_property ( red );
def_local_prop_alias ( r, red );
def_property ( green );
def_local_prop_alias ( g, green );
def_property ( blue );
def_local_prop_alias ( b, blue );
def_property ( alpha );
def_local_prop_alias ( a, alpha );
def_property ( hue );
def_local_prop_alias ( h, hue );
def_property ( saturation );
def_local_prop_alias ( s, saturation );
def_property ( value );
def_local_prop_alias ( v, value );
AColor to_acolor() { return color; }
Color to_color() { return Color (color.r, color.g, color.b); }
COLORREF to_colorref() { return RGB((int)(color.r * 255.0f), (int)(color.g * 255.0f), (int)(color.b * 255.0f)); }
Point3 to_point3() { return Point3 (color.r * 255.0, color.g * 255.0, color.b * 255.0); }
void to_fpvalue(FPValue& v) { v.clr = new Color (color.r, color.g, color.b); v.type = TYPE_COLOR; }
// scene I/O
IOResult Save(ISave* isave);
static Value* Load(ILoad* iload, USHORT chunkID, ValueLoader* vload);
};
class ConstColorValue : public ColorValue
{
public:
ScripterExport ConstColorValue (float r, float g, float b, float a = 1.0f)
: ColorValue(r, g, b, a) { }
void collect() { delete this; }
BOOL is_const() { return TRUE; }
Value* set_red(Value** arg_list, int count) { throw RuntimeError (_T("Constant color, not settable")); return NULL; }
Value* set_green(Value** arg_list, int count) { throw RuntimeError (_T("Constant color, not settable")); return NULL; }
Value* set_blue(Value** arg_list, int count) { throw RuntimeError (_T("Constant color, not settable")); return NULL; }
Value* set_alpha(Value** arg_list, int count) { throw RuntimeError (_T("Constant color, not settable")); return NULL; }
Value* set_hue(Value** arg_list, int count) { throw RuntimeError (_T("Constant color, not settable")); return NULL; }
Value* set_h(Value** arg_list, int count) { throw RuntimeError (_T("Constant color, not settable")); return NULL; }
Value* set_saturation(Value** arg_list, int count) { throw RuntimeError (_T("Constant color, not settable")); return NULL; }
Value* set_value(Value** arg_list, int count) { throw RuntimeError (_T("Constant color, not settable")); return NULL; }
};
#endif
@@ -0,0 +1,183 @@
/* Exception.h - exception class for MAXScript
*
* Copyright (c) John Wainwright, 1996
*
*
*/
#ifndef _H_EXCEPTION
#define _H_EXCEPTION
class Value;
class Thunk;
class ValueMetaClass;
extern TCHAR* null_string;
class ScripterExport MAXScriptException
{
public:
virtual void sprin1(CharStream* s);
};
class ScripterExport UnknownSystemException : public MAXScriptException
{
public:
UnknownSystemException() {}
void sprin1(CharStream* s);
};
class ScripterExport SignalException : public MAXScriptException
{
public:
void sprin1(CharStream* s);
};
class ScripterExport CompileError : public MAXScriptException
{
public:
TCHAR* description;
TCHAR* info;
TCHAR* line;
TCHAR* file;
CompileError (TCHAR* d, TCHAR* i, TCHAR* l, TCHAR* f = null_string);
CompileError () { description = NULL; info = null_string; line = null_string; file = null_string; }
~CompileError ();
void sprin1(CharStream* s);
void set_file(TCHAR* f);
};
class ScripterExport SyntaxError : public CompileError
{
TCHAR* wanted;
TCHAR* got;
TCHAR* line;
public:
SyntaxError (TCHAR* w, TCHAR* g, TCHAR* l = null_string, TCHAR* f = null_string);
~SyntaxError ();
void sprin1(CharStream* s);
};
class ScripterExport TypeError : public MAXScriptException
{
Value* target;
ValueMetaClass* wanted_class;
TCHAR* description;
public:
TypeError (TCHAR* d, Value* t, ValueMetaClass* c = NULL);
~TypeError ();
void sprin1(CharStream* s);
};
class ScripterExport NoMethodError : public MAXScriptException
{
Value* target;
TCHAR* fn_name;
public:
NoMethodError (TCHAR* fn, Value* t);
~NoMethodError ();
void sprin1(CharStream* s);
};
#define unimplemented(m, t) throw NoMethodError (m, t)
class ScripterExport AccessorError : public MAXScriptException
{
Value* target;
Value* prop;
public:
AccessorError (Value* t, Value* p) { target = t; prop = p; }
void sprin1(CharStream* s);
};
class ScripterExport AssignToConstError : public MAXScriptException
{
Thunk* thunk;
public:
AssignToConstError (Thunk* t) { thunk = t; }
void sprin1(CharStream* s);
};
class ScripterExport ArgCountError : public MAXScriptException
{
int wanted;
int got;
TCHAR* fn_name;
public:
ArgCountError (TCHAR* fn, int w, int g);
~ArgCountError ();
void sprin1(CharStream* s);
};
class ScripterExport RuntimeError : public MAXScriptException
{
TCHAR* desc1;
TCHAR* desc2;
Value* info;
public:
RuntimeError (TCHAR* d1);
RuntimeError (TCHAR* d1, TCHAR* d2);
RuntimeError (TCHAR* d1, Value* ii);
RuntimeError (TCHAR* d1, TCHAR* d2, Value* ii);
RuntimeError (Value* ii);
~RuntimeError ();
void init(TCHAR* d1, TCHAR* d2, Value* ii);
void sprin1(CharStream* s);
};
class ScripterExport IncompatibleTypes : public MAXScriptException
{
Value* val1;
Value* val2;
public:
IncompatibleTypes (Value* v1, Value* v2) { val1 = v1; val2 = v2; }
void sprin1(CharStream* s);
};
class ScripterExport ConversionError : public MAXScriptException
{
Value* val;
TCHAR* type;
public:
ConversionError (Value* v, TCHAR* t);
~ConversionError ();
void sprin1(CharStream* s);
};
class FunctionReturn : public MAXScriptException
{
public:
Value* return_result;
FunctionReturn (Value* v) { return_result = v; }
void sprin1(CharStream* s);
};
class LoopExit : public MAXScriptException
{
public:
Value* loop_result;
LoopExit (Value* v) { loop_result = v; }
void sprin1(CharStream* s);
};
class LoopContinue : public MAXScriptException
{
public:
LoopContinue () { }
void sprin1(CharStream* s);
};
#endif
@@ -0,0 +1,467 @@
/* Functions.h - the Function family class - primitives, generics
*
* Copyright (c) John Wainwright, 1996
*
*/
#ifndef _H_FUNCTION
#define _H_FUNCTION
#undef def_generic
#define def_generic(fn, name) \
ScripterExport Value* fn##_vf(Value** arglist, int arg_count)
/* --- function base class -- */
visible_class (Function)
class Function : public Value
{
public:
TCHAR* name;
TCHAR* struct_name; // packaged in a struct if non-null
Function() { name = NULL; struct_name = NULL; }
ScripterExport Function(TCHAR* name, TCHAR* struct_name=NULL);
ScripterExport ~Function();
classof_methods (Function, Value);
# define is_function(o) ((o)->_is_function())
BOOL _is_function() { return 1; }
ScripterExport void sprin1(CharStream* s);
ScripterExport void export_to_scripter();
};
/* ---------------- call context base class ----------------- */
class CallContext
{
CallContext* previous;
public:
CallContext() : previous(NULL) { }
CallContext(CallContext* previous) : previous(previous) { }
// called by fn applier to establish context AFTER arguments eval'd
virtual void push_context() { if (previous) previous->push_context(); }
virtual void pop_context() { if (previous) previous->pop_context(); }
};
/* ----------------------- Generics ------------------------- */
visible_class (Generic)
class Generic : public Function
{
public:
value_vf fn_ptr;
Generic() { }
ScripterExport Generic(TCHAR* name, value_vf fn, TCHAR* struct_name = NULL);
Generic(TCHAR* name) : Function(name) { }
classof_methods (Generic, Function);
BOOL _is_function() { return 1; }
ScripterExport void init(TCHAR* name, value_vf fn);
void collect() { delete this; }
ScripterExport Value* apply(Value** arglist, int count, CallContext* cc=NULL);
};
visible_class (MappedGeneric)
class MappedGeneric : public Generic
{
public:
MappedGeneric() { }
ScripterExport MappedGeneric(TCHAR* name, value_vf fn);
MappedGeneric(TCHAR* name) : Generic(name) { }
classof_methods (MappedGeneric, Generic);
BOOL _is_function() { return 1; }
void collect() { delete this; }
ScripterExport Value* apply(Value** arglist, int count, CallContext* cc=NULL);
};
visible_class (NodeGeneric)
class NodeGeneric : public MappedGeneric
{
public:
ScripterExport NodeGeneric(TCHAR* name, value_vf fn);
NodeGeneric(TCHAR* name) : MappedGeneric(name) { }
classof_methods (NodeGeneric, MappedGeneric);
BOOL _is_function() { return 1; }
void collect() { delete this; }
ScripterExport Value* apply(Value** arglist, int count, CallContext* cc=NULL);
};
/* -------------------------- Primitives ------------------------------ */
#define LAZY_PRIMITIVE 0x0001
visible_class (Primitive)
class Primitive : public Function
{
public:
short flags;
value_cf fn_ptr;
Primitive() { }
ScripterExport Primitive(TCHAR* name, value_cf fn, short init_flags=0);
ScripterExport Primitive(TCHAR* name, TCHAR* structure, value_cf fn, short init_flags=0);
Primitive(TCHAR* name) : Function(name) { }
classof_methods (Primitive, Function);
BOOL _is_function() { return 1; }
void collect() { delete this; }
ScripterExport Value* apply(Value** arglist, int count, CallContext* cc=NULL);
};
visible_class (MappedPrimitive)
class MappedPrimitive : public Primitive
{
public:
ScripterExport MappedPrimitive(TCHAR* name, value_cf fn);
classof_methods (MappedPrimitive, Primitive);
BOOL _is_function() { return 1; }
void collect() { delete this; }
ScripterExport Value* apply(Value** arglist, int count, CallContext* cc=NULL);
};
/* ----- */
visible_class (MAXScriptFunction)
class MAXScriptFunction : public Function
{
public:
short parameter_count;
short local_count;
short keyparm_count;
short flags;
Value** keyparms;
Value* body;
HashTable* local_scope;
value_cf c_callable_fn;
ScripterExport MAXScriptFunction(TCHAR* name, int parm_count, int keyparm_count, Value** keyparms,
int local_count, Value* body, HashTable* local_scope, short flags = 0);
~MAXScriptFunction();
classof_methods (MAXScriptFunction, Function);
BOOL _is_function() { return TRUE; }
void collect() { delete this; }
void gc_trace();
void sprin1(CharStream* s);
Value* apply(Value** arglist, int count, CallContext* cc=NULL);
Value* apply_no_alloc_frame(Value** arglist, int count, CallContext* cc=NULL);
value_cf get_c_callable_fn();
Value* operator()(Value** arg_list, int count);
};
#define FN_MAPPED_FN 0x0001 // declared a collection-mapped function
#define FN_BODY_FN 0x0002 // a loop or other body function, don't trap exits here
#define FN_HAS_REFARGS 0x0004 // function has reference arguments
// UserProp & UserGeneric instances represent dynamically-added, user-defined generics
// on built-in classes. They are kept in sorted tables in ValueMetaClass instances,
// suitable for bsearching.
class UserProp
{
public:
Value* prop;
value_cf getter;
value_cf setter;
UserProp (Value* p, value_cf g, value_cf s) { prop = p; getter = g; setter = s; }
};
class UserGeneric
{
public:
Value* name;
value_cf fn;
UserGeneric(Value* n, value_cf f) { name = n; fn = f; }
};
// UserGenericValue is the scripter-visible generic fn value that dispatches the
// UserGeneric 'methods' in a target object's class
visible_class (UserGenericValue)
class UserGenericValue : public Function
{
public:
Value* fn_name;
Value* old_fn; // if non-NULL, the original global fn that this usergeneric replaced
ScripterExport UserGenericValue(Value* name, Value* old_fn);
classof_methods (UserGenericValue, Function);
BOOL _is_function() { return TRUE; }
void collect() { delete this; }
void gc_trace();
Value* apply(Value** arglist, int count, CallContext* cc=NULL);
};
#define def_user_prop(_prop, _cls, _getter, _setter) \
_cls##_class.add_user_prop(#_prop, _getter, _setter)
#define def_user_generic(_fn, _cls, _name) \
_cls##_class.add_user_generic(#_name, _fn)
// ------- MAXScript Function Publishing interface ----------------------
#include "iFnPub.h"
class InterfaceMethod;
class FPMixinInterfaceValue;
class FPEnum;
// FnPub function, a function published by a plugin using theFnPub system
// automatically exposed by MAXScript boot code during intial plugin scan
visible_class (InterfaceFunction)
class InterfaceFunction : public Function
{
public:
FPInterfaceDesc* fpid;
FPFunctionDef* fd;
InterfaceFunction(FPInterface* fpi, FPFunctionDef* fd);
~InterfaceFunction();
classof_methods (InterfaceFunction, Function);
BOOL _is_function() { return TRUE; }
void collect() { delete this; }
void gc_trace();
void sprin1(CharStream* s);
Value* apply(Value** arglist, int count, CallContext* cc=NULL);
Value* get_property(Value** arg_list, int count);
// parameter conversion utilities
static void val_to_FPValue(Value* v, ParamType2 type, FPValue& fpv, FPEnum* e=NULL);
static Value* FPValue_to_val(FPValue& fpv, FPEnum* e=NULL);
static void release_param(FPValue& fpv, ParamType2 type, Value* v, FPEnum* e=NULL);
static void init_param(FPValue& fpv, ParamType2 type);
static void validate_params(FPInterface* fpi, FunctionID fid, FPParamDef* pd, ParamType2 type, int paramNum, FPValue& val, Value* v);
static FPEnum* FindEnum(short id, FPInterfaceDesc* fpid);
};
// InterfaceMethod - wraps an InterfaceFunction and its target object for shorthand mixin calls
class InterfaceMethod : public InterfaceFunction
{
private:
InterfaceMethod(FPMixinInterfaceValue* fpiv, FPFunctionDef* fd);
static InterfaceMethod* interface_method_cache[128];
friend void Collectable::mark();
public:
FPMixinInterfaceValue* fpiv;
static ScripterExport InterfaceMethod* intern(FPMixinInterfaceValue* fpiv, FPFunctionDef* fd);
~InterfaceMethod();
void collect() { delete this; }
void gc_trace();
Value* apply(Value** arglist, int count, CallContext* cc=NULL);
};
// Action predicate function wrappers...
visible_class (ActionPredicate)
class ActionPredicate : public InterfaceFunction
{
public:
short pred;
ActionPredicate(FPInterface* fpi, FPFunctionDef* fd, short pred);
classof_methods (ActionPredicate, Function);
BOOL _is_function() { return TRUE; }
void collect() { delete this; }
Value* apply(Value** arglist, int count, CallContext* cc=NULL);
};
// IObject, generic wrapper for objects that inherit from IObject
// this is a way to give simple interface-based wrappers to
// classes in MAX or 3rd-party plugins that MAXScript knows
// nothing about. The IObject instance must implement GetInterface()
visible_class (IObjectValue)
class IObjectValue : public Value
{
public:
IObject* iobj; // the IObject pointer
IObjectValue(IObject* io);
~IObjectValue();
# define is_iobject(c) ((c)->tag == class_tag(IObjectValue))
classof_methods (IObjectValue, Value);
void collect() { delete this; }
void sprin1(CharStream* s);
BaseInterface* GetInterface(Interface_ID id) { return iobj->GetInterface(id); }
//accesses interfaces on the IObject
Value* get_property(Value** arg_list, int count);
Value* set_property(Value** arg_list, int count);
};
// FPInterfaceValue, represents FPInterfaces in MAXScript
visible_class (FPInterfaceValue)
class FPInterfaceValue : public Value, public InterfaceNotifyCallback
{
public:
FPInterface* fpi; // interface
HashTable* fns; // interface fn lookup
HashTable* props; // interface prop lookup
FPInterface::LifetimeType lifetime; // interface lifetime control type
static bool enable_test_interfaces; // test interface enable flag
FPInterfaceValue(FPInterface* fpi);
~FPInterfaceValue();
# define is_fpstaticinterface(c) ((c)->tag == class_tag(FPInterfaceValue))
classof_methods (FPInterfaceValue, Value);
def_generic ( show_interface, "showInterface"); // LAM: 08/29/00
void collect() { delete this; }
void gc_trace();
void sprin1(CharStream* s);
// from InterfaceNotifyCallback
void InterfaceDeleted(BaseInterface* bi) { fpi = NULL; }
// accesses methods & props in the interface
Value* _get_property(Value* prop);
Value* _set_property(Value* prop, Value* val);
Value* get_property(Value** arg_list, int count);
Value* set_property(Value** arg_list, int count);
};
extern ScripterExport void print_FP_interface(CharStream* out, FPInterface* fpi, bool getPropNames = true,
bool getMethodNames = true, bool getInterfaceNames = true, bool getActionTables = true);
// FPMixinInterfaceValue provides wrappers for mixin interfaces on individual target objects
// stored in a cache for fast retrieval and to minimize over-consing
visible_class (FPMixinInterfaceValue)
class FPMixinInterfaceValue : public Value, public InterfaceNotifyCallback
{
private:
FPMixinInterfaceValue(FPInterface* fpi);
~FPMixinInterfaceValue();
static FPMixinInterfaceValue* interface_cache[128];
friend void Collectable::mark();
public:
FPInterface* fpi; // interface
FPInterface::LifetimeType lifetime; // interface lifetime control type
static ScripterExport FPMixinInterfaceValue* intern(Value* prop_name, Value* target);
static ScripterExport FPMixinInterfaceValue* intern(FPInterface* fpi);
# define is_fpmixininterface(c) ((c)->tag == class_tag(FPMixinInterfaceValue))
classof_methods (FPMixinInterfaceValue, Value);
def_generic ( show_interface, "showInterface"); // LAM: 08/29/00
void collect() { delete this; }
void sprin1(CharStream* s);
// from InterfaceNotifyCallback
void InterfaceDeleted(BaseInterface* bi) { fpi = NULL; }
// accesses methods & props in the interface
Value* _get_property(Value* prop);
Value* _set_property(Value* prop, Value* val);
Value* get_property(Value** arg_list, int count);
Value* set_property(Value** arg_list, int count);
};
// FPStaticMethodInterfaceValue provides wrappers for static interfaces that
// have been registered with individual Value metaclasses as property
// interfaces on instances of the metaclasses' class, such that calls
// on methods in these interfaces pass the intance along as the first
// argument wrapped in an FPValue.
// these are used to allow factored static interfaces (such as meshOps)
// to appear as though they are mixin interfaces on several MAXScript value
// classes (such as node, baseobject, meshvalue), in which the target object
// is sent as a polymorphic first argument (via FPValue) to static interface
// method call, rather than as a 'this' pointer to a virtual mixin interface method
visible_class (FPStaticMethodInterfaceValue)
class FPStaticMethodInterfaceValue : public Value, public InterfaceNotifyCallback
{
private:
FPStaticMethodInterfaceValue(FPInterface* fpi, ParamType2 type, void* object);
~FPStaticMethodInterfaceValue();
static FPStaticMethodInterfaceValue* interface_cache[128];
friend void Collectable::mark();
public:
FPInterface* fpi; // interface
FPValue value; // the target object as FPValue first argument
FPInterface::LifetimeType lifetime; // interface lifetime control type
static ScripterExport FPStaticMethodInterfaceValue* intern(FPInterface* fpi, ParamType2 type, void* object);
# define is_fpstaticmethodinterface(c) ((c)->tag == class_tag(FPStaticMethodInterfaceValue))
classof_methods (FPStaticMethodInterfaceValue, Value);
def_generic ( show_interface, "showInterface"); // LAM: 08/29/00
void collect() { delete this; }
void sprin1(CharStream* s);
// from InterfaceNotifyCallback
void InterfaceDeleted(BaseInterface* bi) { fpi = NULL; }
// accesses methods & props in the interface
Value* _get_property(Value* prop);
Value* _set_property(Value* prop, Value* val);
Value* get_property(Value** arg_list, int count);
Value* set_property(Value** arg_list, int count);
};
// StaticInterfaceMethod - wraps an FPStaticMethodInterfaceValue and its target object for property-based calls
class StaticInterfaceMethod : public InterfaceFunction
{
private:
StaticInterfaceMethod(FPStaticMethodInterfaceValue* fpiv, FPFunctionDef* fd);
static StaticInterfaceMethod* interface_method_cache[128];
friend void Collectable::mark();
public:
FPStaticMethodInterfaceValue* fpiv;
static ScripterExport StaticInterfaceMethod* intern(FPStaticMethodInterfaceValue* fpiv, FPFunctionDef* fd);
~StaticInterfaceMethod();
void collect() { delete this; }
void gc_trace();
Value* apply(Value** arglist, int count, CallContext* cc=NULL);
};
#endif
@@ -0,0 +1,90 @@
/*
* HashTable.h - HashTable class for MAXScript
*
* Copyright © John Wainwright 1996
*
*/
#ifndef _H_HASHTABLE
#define _H_HASHTABLE
typedef struct
{
void* key;
void* value;
} binding;
typedef struct /* secondary extent struct */
{
size_t size; /* size of secondary extent */
binding* bindings; /* table of bindings */
} secondary;
#define KEY_IS_OBJECT 0x0001 /* init flags that indicate whether keys & values are full MXS collectable objects */
#define VALUE_IS_OBJECT 0x0002
int default_eq_fn(void* key1, void* key2); /* default comparator & hash fns */
INT_PTR default_hash_fn(void* key);
class HashTabMapper;
visible_class (HashTable)
class HashTable : public Value
{
secondary **table; /* primary extent: tbl of second's */
size_t size; /* table size */
int n_entries; /* no. entries in primary extent */
int (*eq_fn)(void*, void*); /* key equivalence function */
INT_PTR (*hash_fn)(void*); /* key hgashing function */
// Win64 Cleanup: Shuler
int cursor; /* cursors used for sequencing... */
int secondCursor;
short flags;
HashTable* inner; /* links to next & prev tables when */
HashTable* outer; /* used as a lexical scope table */
int level; // scope nesting level
static CRITICAL_SECTION hash_update; // for syncing allocation hashtable updates
public:
ScripterExport HashTable(size_t primary_size, int (*key_eq_fn)(void*, void*), INT_PTR (*key_hash_fn)(void*), int flags);
// Win64 Cleanup: Shuler
HashTable() { init(17, default_eq_fn, default_hash_fn, KEY_IS_OBJECT + VALUE_IS_OBJECT); }
HashTable(size_t primary_size) { init(primary_size, default_eq_fn, default_hash_fn, KEY_IS_OBJECT + VALUE_IS_OBJECT); }
~HashTable();
void init(size_t primary_size, int (*key_eq_fn)(void*, void*), INT_PTR (*key_hash_fn)(void*), int flags);
// Win64 Cleanup: Shuler
static void setup();
classof_methods (HashTable, Value);
void collect() { delete this;}
void gc_trace();
ScripterExport Value* get(void* key);
ScripterExport Value* put(void* key, void* val);
ScripterExport Value* put_new(void* key, void* val);
ScripterExport Value* find_key(void *val);
ScripterExport Value* set(void* key, void* val);
ScripterExport void remove(void* key);
ScripterExport void map_keys_and_vals(void (*fn)(void* key, void* val, void* arg), void* arg);
ScripterExport void map_keys_and_vals(HashTabMapper* mapper);
ScripterExport int num_entries() { return n_entries; }
HashTable* enter_scope();
HashTable* leave_scope();
HashTable* next_scope();
int scope_level() { return level; }
};
class HashTabMapper
{
public:
virtual void map(void* key, void* val)=0;
};
#define SECONDARY_BUCKET 5
#endif
@@ -0,0 +1,131 @@
/*
* IVisualMS.h - public interfaces to VisualMS
*
* IVisualMSMgr - core interface to the VisualMS manager
* IVisualMSForm - interface to an existing form
*
* Copyright © Autodesk, Inc, 2000. John Wainwright.
*
*/
#ifndef _H_IVISUALMS
#define _H_IVISUALMS
#include "max.h"
#include "iFnPub.h"
class IVisualMSMgr;
class IVisualMSForm;
class IVisualMSItem;
class IVisualMSCallback;
// -------- Core interface to the VisualMS manager -----------
class IVisualMSMgr : public FPStaticInterface
{
public:
virtual IVisualMSForm* CreateForm()=0; // create a new form
virtual IVisualMSForm* CreateFormFromFile(TCHAR* fname)=0; // create form from a .vms file
// function IDs
enum { createForm,
createFormFromFile,
};
};
#define VISUALMS_MGR_INTERFACE Interface_ID(0x423d2cf2, 0x526706b5)
inline IVisualMSMgr* GetVisualMSMgr() { return (IVisualMSMgr*)GetCOREInterface(VISUALMS_MGR_INTERFACE); }
// ------- interface to individual VisiualMS forms ------------
class IVisualMSForm : public FPMixinInterface
{
public:
virtual void Open(IVisualMSCallback* cb=NULL, TCHAR* source=NULL)=0; // open the form editor on this form
virtual void Close()=0; // close the form editor
virtual void InitForm(TCHAR* formType, TCHAR* formName, TCHAR* caption)=0;
virtual void SetWidth(int w)=0;
virtual void SetHeight(int h)=0;
virtual IVisualMSItem* AddItem(TCHAR* itemType, TCHAR* itemName, TCHAR* text, int src_from=-1, int src_to=-1)=0;
virtual IVisualMSItem* AddCode(TCHAR* code, int src_from=-1, int src_to=-1)=0;
virtual IVisualMSItem* FindItem(TCHAR* itemName)=0;
virtual BOOL GenScript(TSTR& script, TCHAR* indent=NULL)=0;
virtual BOOL HasSourceBounds(int& from, int& to)=0;
virtual void SetSourceBounds(int from, int to)=0;
FPInterfaceDesc* GetDesc();
// function IDs
enum { open,
close,
genScript,
};
// dispatch map
BEGIN_FUNCTION_MAP
VFN_0(open, Open);
VFN_0(close, Close);
FN_1( genScript, TYPE_BOOL, GenScript, TYPE_TSTR_BR);
END_FUNCTION_MAP
};
#define VISUALMS_FORM_INTERFACE Interface_ID(0x446b6824, 0x39502f75)
// ------- interface to individual VisiualMS form items ------------
class IVisualMSItem : public FPMixinInterface
{
public:
virtual void SetPropery(TCHAR* propName, float f)=0;
virtual void SetPropery(TCHAR* propName, int i)=0;
virtual void SetPropery(TCHAR* propName, bool b)=0;
virtual void SetPropery(TCHAR* propName, TCHAR* s)=0;
virtual void SetProperyLit(TCHAR* propName, TCHAR* s)=0;
virtual void SetPropery(TCHAR* propName, Point2 pt)=0;
virtual void SetPropery(TCHAR* propName, Point3 pt)=0;
virtual void SetPropery(TCHAR* propName, Tab<TCHAR*>* sa)=0;
virtual void SetHandler(TCHAR* eventName, TCHAR* source, int arg_start, int arg_end, int body_start, int body_end)=0;
virtual void GetShape(int& left, int& top, int& width, int& height)=0;
virtual void SetShape(int left, int top, int width, int height)=0;
virtual void AddComment(TCHAR* code, int src_from, int src_to)=0;
FPInterfaceDesc* GetDesc();
};
#define VISUALMS_ITEM_INTERFACE Interface_ID(0x13a403e4, 0x5f920eed)
// ------- base class for VMS edit callbacks ------------
// instances supplied to VMSMgr::CreateForm() and called-back
// when edit events happen
#define VISUALMS_CALLBACK_INTERFACE Interface_ID(0x612b70df, 0xef77884)
class IVisualMSCallback : public FPMixinInterface
{
public:
virtual void Save() { } // save changes
virtual void Close() { } // form editor close (already saved)
virtual void DeleteThis() { }
virtual HWND GetEditBox() { return NULL; }
FPInterfaceDesc* GetDesc() { return (FPInterfaceDesc*)GetCOREInterface(VISUALMS_CALLBACK_INTERFACE); }
// function IDs
enum { save,
close,
};
// dispatch map
BEGIN_FUNCTION_MAP
VFN_0(save, Save);
VFN_0(close, Close);
END_FUNCTION_MAP
};
#endif
@@ -0,0 +1,27 @@
/*
* lclabsfn.h - abstract generic function definitions for MAXScript SDK plug-ins
*/
#include "ClassCfg.h"
#ifdef def_local_generic
# undef def_local_generic
# undef use_local_generic
#endif
#ifdef use_generic
# undef use_generic
#endif
#define def_local_generic(fn, name) \
virtual Value* fn##_vf(Value** arglist, int arg_count) { ABSTRACT_FUNCTION(_T(#name), this, Value*); }
#define use_generic(fn, name)
#define use_local_generic(fn, name)
/* abstract function 'bodies'... if these are called, we have a 'type doesnt implement' error */
#ifndef ABSTRACT_FUNCTION
# define ABSTRACT_FUNCTION(m, v, t) throw NoMethodError (m, v); return (t)0
# define ABSTRACT_CONVERTER(t, l) throw ConversionError (this, _T(#l)); return (t)0
# define ABSTRACT_WIDENER(a) throw IncompatibleTypes (this, a); return (Value*)&undefined
#endif
@@ -0,0 +1,66 @@
/* LclClass.h - macros for defining local classes and generics in a MAXScript extension .dlx
*
*
* Copyright (c) Autodesk, Inc. 1988. John Wainwright.
*
*/
#ifndef _H_LOCALCLASS
#define _H_LOCALCLASS
#include "ClassCfg.h"
#define local_visible_class(_cls) \
class _cls##Class : public ValueMetaClass \
{ \
public: \
_cls##Class(TCHAR* name) : ValueMetaClass (name) { } \
void collect() { delete this; } \
}; \
extern _cls##Class _cls##_class;
#define local_applyable_class(_cls) \
class _cls##Class : public ValueMetaClass \
{ \
public: \
_cls##Class(TCHAR* name) : ValueMetaClass (name) { } \
void collect() { delete this; } \
Value* apply(Value** arglist, int count, CallContext* cc=NULL); \
}; \
extern _cls##Class _cls##_class;
#define local_visible_class_instance(_cls, _name) \
_cls##Class _cls##_class (_T(_name));
class MS_LOCAL_ROOT_CLASS;
typedef Value* (MS_LOCAL_ROOT_CLASS::*local_value_vf)(Value**, int);
#define cat0(_a) _a
#define cat1(_a) cat0(_a)
#define cat2(_a, _b) cat0(_a)##cat0(_b)
#define MS_LOCAL_ROOT_CLASS_TAG &cat2(MS_LOCAL_ROOT_CLASS, _class)
#define MS_LOCAL_GENERIC_CLASS_TAG &cat2(MS_LOCAL_GENERIC_CLASS, _class)
#define MS_LOCAL_GENERIC_CLASS_CLASS cat2(MS_LOCAL_GENERIC_CLASS, Class)
#define MS_LOCAL_GENERIC_CLASS_class cat2(MS_LOCAL_GENERIC_CLASS, _class)
#define str0(_c) #_c
#define str1(_c) str0(_c)
#define declare_local_generic_class \
class MS_LOCAL_GENERIC_CLASS_CLASS : public ValueMetaClass \
{ \
public: \
MS_LOCAL_GENERIC_CLASS_CLASS(TCHAR* name) : ValueMetaClass (name) { } \
void collect() { delete this; } \
}; \
extern MS_LOCAL_GENERIC_CLASS_CLASS MS_LOCAL_GENERIC_CLASS_class; \
class MS_LOCAL_GENERIC_CLASS : public Generic \
{ \
public: \
local_value_vf fn_ptr; \
MS_LOCAL_GENERIC_CLASS() { } \
MS_LOCAL_GENERIC_CLASS(TCHAR* name, local_value_vf fn); \
classof_methods (MS_LOCAL_GENERIC_CLASS, Generic); \
void collect() { delete this; } \
Value* apply(Value** arglist, int count, CallContext* cc=NULL); \
};
#endif
@@ -0,0 +1,24 @@
/*
* lclextfn.h - abstract generic function definitions for MAXScript SDK plug-ins
*/
#include "ClassCfg.h"
#ifdef def_local_generic
# undef def_local_generic
# undef use_local_generic
#endif
#ifdef use_generic
# undef use_generic
#endif
#define def_local_generic(fn, name) \
extern MS_LOCAL_GENERIC_CLASS fn##_gf
#define use_local_generic(fn, name) \
def_local_generic(fn, name)
#define use_generic(fn, name) \
extern Generic fn##_gf
#undef def_name
#define def_name(name) extern Value* n_##name;
@@ -0,0 +1,27 @@
/*
* lclimpfn.h - generic function implementation macros for MAXScript SDK plug-ins
*/
#include "ClassCfg.h"
#ifdef def_local_generic
# undef def_local_generic
# undef use_local_generic
#endif
#ifdef use_generic
# undef use_generic
#endif
#define def_local_generic(fn, name) \
Value* fn##_vf(Value** arglist, int arg_count)
#define use_local_generic(fn, name) \
def_local_generic(fn, name)
#define use_generic(fn, name) \
Value* fn##_vf(Value** arglist, int arg_count)
#undef def_name
#define def_name(name) n_##name = Name::intern(_T(#name));
@@ -0,0 +1,54 @@
/*
* lclinsfn.h - generic function instantiation macros for MAXScript SDK plug-ins
*/
#include "ClassCfg.h"
#ifdef def_local_generic
# undef def_local_generic
# undef use_local_generic
#endif
#ifdef use_generic
# undef use_generic
#endif
#pragma pointers_to_members(full_generality, virtual_inheritance)
#define def_local_generic(fn, name) \
MS_LOCAL_GENERIC_CLASS fn##_gf (_T(name), &MS_LOCAL_ROOT_CLASS::fn##_vf)
#define use_generic(fn, name)
#define use_local_generic(fn, name)
#undef def_name
#define def_name(name) Value* n_##name;
#define define_local_generic_class \
MS_LOCAL_GENERIC_CLASS::MS_LOCAL_GENERIC_CLASS(TCHAR*fn_name, local_value_vf fn)\
{ \
tag = MS_LOCAL_GENERIC_CLASS_TAG; \
fn_ptr = fn; \
name = save_string(fn_name); \
} \
Value* MS_LOCAL_GENERIC_CLASS::apply(Value** arg_list, int count, CallContext* cc) \
{ \
Value* result; \
Value** evald_args; \
Value **ap, **eap; \
int i; \
if (count < 1) \
throw ArgCountError("Generic apply", 1, count); \
value_local_array(evald_args, count); \
for (i = count, ap = arg_list, eap = evald_args; i--; eap++, ap++) \
*eap = (*ap)->eval(); \
if (evald_args[0]->local_base_class() == MS_LOCAL_ROOT_CLASS_TAG) \
result = (((MS_LOCAL_ROOT_CLASS*)evald_args[0])->*fn_ptr)(&evald_args[1], count - 1); \
else \
throw NoMethodError (name, evald_args[0]); \
pop_value_local_array(evald_args); \
return result; \
} \
MS_LOCAL_GENERIC_CLASS_CLASS MS_LOCAL_GENERIC_CLASS_class (str1(MS_LOCAL_GENERIC_CLASS));
@@ -0,0 +1,105 @@
/* Listener.h - the Listener class - MAXScript listener windows
*
* Copyright (c) John Wainwright, 1996
*
*/
#ifndef _H_LISTENER
#define _H_LISTENER
#include <windowsx.h>
#include "Pipe.h"
#include "Thunks.h"
extern GlobalThunk* listener_result_thunk;
extern ScripterExport BOOL end_keyboard_input;
extern ScripterExport BOOL start_keyboard_input;
extern ScripterExport TCHAR* keyboard_input;
extern ScripterExport Value* keyboard_terminator;
extern ScripterExport Array* keyboard_input_terminators;
// listener flag values
#define LSNR_INPUT_MODE_MASK 0x000F
#define LSNR_KEYINPUT_OFF 0x0000
#define LSNR_KEYINPUT_LINE 0x0001
#define LSNR_KEYINPUT_CHAR 0x0002
#define LSNR_SHOWING 0x0010 // MAXScript is forcing a show, ignore all other ShowWindows
#define LSNR_NO_MACRO_REDRAW 0x0020 // disable drawing in macro-rec box (to get round bug in WM_SETREDRAW)
#define EDIT_BOX_ITEM 1001 // listener edit box dlg item #
#define MACROREC_BOX_ITEM 1002 // listener macro-recorder edit box dlg item #
class ListenerViewWindow;
class Listener : public Value
{
HANDLE listener_thread;
DWORD thread_id;
public:
HWND listener_window; // main listener window
HWND edit_box; // edit control for main type-in
HWND macrorec_box; // edit control for macro-recorder output
HWND mini_listener; // mini-listener parent window in the MAX status panel
HWND mini_edit; // mini-listener edit control for type_in
HWND mini_macrorec; // mini-listener edit control for macro-recorder output
WindowStream* edit_stream; // stream for the main edit box
WindowStream* macrorec_stream; // stream for the macro-recorder edit box
WindowStream* mini_edit_stream; // stream for the mini edit box
WindowStream* mini_macrorec_stream; // stream for the mini macro-recorder edit box
Pipe* source_pipe; // the source pipe for the listener, source written to, compiler reads from
int flags;
ListenerViewWindow* lvw; // the ViewWindow instance for the listener
Listener(HINSTANCE mxs_instance, HWND MAX_window);
~Listener();
static DWORD run(Listener *l);
void create_listener_window(HINSTANCE hInstance, HWND hwnd);
void gc_trace();
void collect() { delete this; }
ScripterExport void set_keyinput_mode(int mode) { flags = (flags & ~LSNR_INPUT_MODE_MASK) | mode; }
};
// ViewWindow subclass for putting the listener in a MAX viewport
class ListenerViewWindow : public ViewWindow
{
public:
TCHAR *GetName();
HWND CreateViewWindow(HWND hParent, int x, int y, int w, int h);
void DestroyViewWindow(HWND hWnd);
BOOL CanCreate();
};
class ListenerMessageData
{
public:
WPARAM wParam;
LPARAM lParam;
HANDLE message_event;
ListenerMessageData(WPARAM wp, LPARAM lp, HANDLE me) { wParam = wp; lParam = lp; message_event = me; }
};
#define CLICK_STACK_SIZE 8 // number of clicked-at locations to remember for ctrl-R return
typedef struct edit_window edit_window;
struct edit_window
{
edit_window* next;
edit_window* prev;
Value* file_name;
bool dont_flag_save;
bool needs_save;
HWND window;
HWND edit_box;
int sr_offset;
int click_tos;
int click_at[CLICK_STACK_SIZE];
bool editing;
INT_PTR new_rollout();
INT_PTR edit_rollout();
};
#endif
@@ -0,0 +1,143 @@
/*
* MAXKeys.h - MAX controller keyframe access classes
*
* Copyright © John Wainwright 1996
*
*/
#ifndef _H_MAXKEYS
#define _H_MAXKEYS
#include "Max.h"
#include "MaxObj.h"
visible_class (MAXKeyArray)
class MAXKeyArray : public MAXWrapper
{
public:
Control* controller; /* the controller */
ParamDimension* dim; /* dimension from originating animatable */
IKeyControl* ik;
MAXKeyArray(Control* icont, ParamDimension* idim);
static ScripterExport Value* intern(Control* icont, ParamDimension* idim);
classof_methods (MAXKeyArray, MAXWrapper);
BOOL _is_collection() { return 1; }
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
TCHAR* class_name();
/* operations */
#include "defimpfn.h"
# include "arraypro.h"
def_generic ( sortKeys, "sortKeys");
def_generic ( addNewKey, "addNewKey");
def_generic ( deleteKeys, "deleteKeys");
def_generic ( deleteKey, "deleteKey");
def_generic (show_props, "showProperties");
def_generic (get_props, "getPropNames");
ScripterExport Value* map(node_map& m);
/* built-in property accessors */
def_property ( count );
};
typedef union AnyKey AnyKey;
union AnyKey
{
TCHAR lfk[sizeof ILinFloatKey];
TCHAR lp3k[sizeof ILinPoint3Key];
TCHAR lrk[sizeof ILinRotKey];
TCHAR lsk[sizeof ILinScaleKey];
TCHAR bfk[sizeof IBezFloatKey];
TCHAR bp3k[sizeof IBezPoint3Key];
TCHAR bqk[sizeof IBezQuatKey];
TCHAR bsk[sizeof IBezScaleKey];
TCHAR tfk[sizeof ITCBFloatKey];
TCHAR tp3k[sizeof ITCBPoint3Key];
TCHAR trk[sizeof ITCBRotKey];
TCHAR tsk[sizeof ITCBScaleKey];
};
#define ToTCBUI(a) (((a)+1.0f)*25.0f) // HEY!! pinched from TCBINTRP.CPP, why not in a header or documented?
#define FromTCBUI(a) (((a)/25.0f)-1.0f)
#define ToEaseUI(a) ((a)*50.0f)
#define FromEaseUI(a) ((a)/50.0f)
visible_class (MAXKey)
class MAXKey : public MAXWrapper
{
public:
Control* controller; /* MAX-side controller */
ParamDimension* dim; /* dimension from originating animatable */
int key_index;
ScripterExport MAXKey (Control* icont, int ikey, ParamDimension* dim);
ScripterExport MAXKey (Control* icont, int ikey);
static ScripterExport Value* intern(Control* icont, int ikey, ParamDimension* dim);
static ScripterExport Value* intern(Control* icont, int ikey);
static void setup();
classof_methods (MAXKey, MAXWrapper);
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
TCHAR* class_name();
def_generic ( delete, "delete");
def_generic ( copy, "copy");
def_generic ( show_props, "showProperties");
def_generic ( get_props, "getPropNames");
ScripterExport IKey* setup_key_access(AnyKey& ak, IKeyControl** kip);
def_property (time);
def_property (selected);
def_property (value);
def_property (inTangent);
def_property (outTangent);
def_property (inTangentLength);
def_property (outTangentLength);
def_property (inTangentType);
def_property (outTangentType);
def_property (x_locked);
def_property (y_locked);
def_property (z_locked);
def_property (constantVelocity);
def_property (freeHandle);
def_property (tension);
def_property (continuity);
def_property (bias);
def_property (easeTo);
def_property (easeFrom);
#if 0 // HEY!! obsolete
def_nested_prop ( angle );
def_nested_prop ( x_rotation );
def_nested_prop ( y_rotation );
def_nested_prop ( z_rotation );
def_nested_prop ( axis );
def_nested_prop ( x );
def_nested_prop ( y );
def_nested_prop ( z );
#endif
// add implementations of the recursive time controller fns here to complain
// since they wuill default to operating on the key's controller which can be very confusing
// the user should use them on the controller or track, not the key
#ifdef def_time_fn
# undef def_time_fn
#endif
#define def_time_fn(_fn) \
Value* MAXKey::_fn##_vf(Value** arg_list, int count) { ABSTRACT_FUNCTION(#_fn, this, Value*); }
#include "time_fns.h"
};
#endif
@@ -0,0 +1,207 @@
/*
* MAXMaterials.h - MAX material & map wrapper classes
*
* Copyright © John Wainwright 1996
*
*/
#ifndef _H_MAXMATERIALS
#define _H_MAXMATERIALS
#include "Max.h"
#include "MaxObj.h"
//#include "sceneapi.h"
#if 0 // HEY!! add material library access
virtual int LoadMaterialLib(const TCHAR *name)=0;
virtual int SaveMaterialLib(const TCHAR *name)=0;
virtual MtlBaseLib& GetMaterialLibrary()=0;
static Class_ID mtlBaseLibClassID(MTLBASE_LIB_CLASS_ID,0);
#endif
/* -------------------------- MAXMaterial -------------------------- */
visible_class (MAXMaterial)
class MAXMaterial : public MAXWrapper
{
public:
Mtl* mat; /* the MAX-side material */
MAXMaterial(Mtl* imat);
static ScripterExport MAXMaterial* intern(Mtl* imat);
static Value* make(MAXClass* cls, Value** arg_list, int count);
BOOL is_kind_of(ValueMetaClass* c) { return (c == class_tag(MAXMaterial)) ? 1 : MAXWrapper::is_kind_of(c); }
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
TCHAR* class_name();
#include "defimpfn.h"
Value* copy_vf(Value** arg_list, int count) { return MAXWrapper::copy_no_undo(arg_list, count); }
def_property ( name );
def_property ( effectsChannel );
def_prop_setter( showInViewport );
Mtl* to_mtl() { check_for_deletion(); return mat; }
MtlBase* to_mtlbase() { check_for_deletion(); return mat; }
void to_fpvalue(FPValue& v) { v.mtl = mat; v.type = TYPE_MTL; }
};
/* ---------------------- MAXMultiMaterial ----------------------- */
visible_class (MAXMultiMaterial)
class MAXMultiMaterial : public MAXWrapper
{
public:
MultiMtl* mat; /* the MAX-side material */
MAXMultiMaterial(MultiMtl* imat);
static ScripterExport MAXMultiMaterial* intern(MultiMtl* imat);
static Value* make(MAXClass* cls, Value** arg_list, int count);
BOOL is_kind_of(ValueMetaClass* c) { return (c == class_tag(MAXMultiMaterial)) ? 1 : MAXWrapper::is_kind_of(c); }
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
TCHAR* class_name();
def_generic (get, "get");
def_generic (put, "put");
Value* copy_vf(Value** arg_list, int count) { return MAXWrapper::copy_no_undo(arg_list, count); }
ScripterExport Value* map(node_map& m);
def_property( name );
def_property( numsubs );
def_property( count );
Mtl* to_mtl() { return mat; }
MtlBase* to_mtlbase() { check_for_deletion(); return mat; }
void to_fpvalue(FPValue& v) { v.mtl = mat; v.type = TYPE_MTL; }
};
/* ---------------------- Material Library ----------------------- */
applyable_class (MAXMaterialLibrary)
class MAXMaterialLibrary : public MAXWrapper
{
public:
MtlBaseLib new_lib;
MtlBaseLib& lib;
MAXMaterialLibrary(MtlBaseLib& ilib);
MAXMaterialLibrary(MtlBaseLib* ilib);
MAXMaterialLibrary();
static ScripterExport Value* intern(MtlBaseLib& ilib);
static ScripterExport Value* intern(MtlBaseLib* ilib);
classof_methods (MAXMaterialLibrary, MAXWrapper);
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
MtlBase* get_mtlbase(int index);
MtlBase* find_mtlbase(TCHAR* name);
TCHAR* class_name();
/* operations */
ScripterExport Value* map(node_map& m);
#include "defimpfn.h"
# include "arraypro.h"
Value* copy_vf(Value** arg_list, int count) { return MAXWrapper::copy_no_undo(arg_list, count); }
/* built-in property accessors */
def_property ( count );
};
/* ------------------------- MAXTexture ------------------------ */
visible_class (MAXTexture)
class MAXTexture : public MAXWrapper
{
public:
Texmap* map; /* the MAX-side map */
MAXTexture(Texmap* imap);
static ScripterExport MAXTexture* intern(Texmap* imap);
static Value* make(MAXClass* cls, Value** arg_list, int count);
BOOL is_kind_of(ValueMetaClass* c) { return (c == class_tag(MAXTexture)) ? 1 : MAXWrapper::is_kind_of(c); }
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
TCHAR* class_name();
#include "defimpfn.h"
# include "texmapro.h"
Value* copy_vf(Value** arg_list, int count) { return MAXWrapper::copy_no_undo(arg_list, count); }
def_property( name );
Texmap* to_texmap() { check_for_deletion(); return map; }
MtlBase* to_mtlbase() { check_for_deletion(); return map; }
void to_fpvalue(FPValue& v) { v.tex = map; v.type = TYPE_TEXMAP; }
};
/* -------------------------- MAXMtlBase -------------------------- */
// a generic wrapper for MtlBase classes such as UVGen, XYZGen, TexOut, etc.
visible_class (MAXMtlBase)
class MAXMtlBase : public MAXWrapper
{
public:
MtlBase* mtl; /* the MAX-side mtlbase */
MAXMtlBase(MtlBase* imtl);
static ScripterExport MAXMtlBase* intern(MtlBase* imtl);
static Value* make(MAXClass* cls, Value** arg_list, int count);
BOOL is_kind_of(ValueMetaClass* c) { return (c == class_tag(MAXMtlBase)) ? 1 : MAXWrapper::is_kind_of(c); }
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
TCHAR* class_name() { return _T("MapSupportClass"); }
Value* copy_vf(Value** arg_list, int count) { return MAXWrapper::copy_no_undo(arg_list, count); }
MtlBase* to_mtlbase() { check_for_deletion(); return mtl; }
};
/* ------------------ MEdit materials virtual array -------------------- */
visible_class (MAXMeditMaterials)
class MAXMeditMaterials : public Value
{
public:
MAXMeditMaterials() { tag = &MAXMeditMaterials_class; }
classof_methods (MAXMeditMaterials, Value);
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
MtlBase* get_mtl(int index);
MtlBase* find_mtl(TCHAR* name);
static SceneAPI *sceneapi;
static void setup();
// operations
ScripterExport Value* map(node_map& m);
#include "defimpfn.h"
# include "arraypro.h"
// built-in property accessors
def_property ( count );
};
extern ScripterExport MAXMeditMaterials medit_materials;
#endif
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,231 @@
/*
* MAX_commands.h - defines all the invocable MAX UI commands - for the 'max' scripter construct
*
* Copyright © John Wainwright 1996
*
*/
#ifndef _H_MAX_COMMANDS
#define _H_MAX_COMMANDS
#include "maxcom.h"
/* the commands... these are the command codes defined in "maxcom.h". they MUST be in
* alphabetical order */
"accel pan", MAXCOM_ACCEL_PAN, 0,
"acthomegrid", MAXCOM_ACTHOMEGRID, MR_R2,
"activate grid object", MAXCOM_ACTGRIDOBJ , 0,
"activate home grid", MAXCOM_ACTHOMEGRID, 0,
"adaptive persp grid", MAXCOM_ADAPTIVE_PERSP_GRID_TOGGLE, 0,
"adaptive perspective grid toggle", MAXCOM_ADAPTIVE_PERSP_GRID_TOGGLE, MR_R2,
"align", MAXCOM_ALIGN, 0,
"align camera", MAXCOM_TOOLS_ALIGNCAMERA, 0,
"align normals", MAXCOM_ALIGNNORMALS, 0,
"alignnormals", MAXCOM_ALIGNNORMALS, MR_R2,
"angle snap toggle", MAXCOM_ANGLE_SNAP_TOGGLE, 0,
"apply ik", MAXCOM_APPLY_IK, 0,
"array", MAXCOM_ARRAY, 0,
"backface", MAXCOM_BACKFACE, MR_R2,
"backface cull toggle", MAXCOM_BACKFACE, 0,
"background", MAXCOM_BACKGROUND, MR_R2,
"background display toggle", MAXCOM_BACKGROUND, 0,
"bind space warp mode", MAXCOM_BINDWSM, 0,
"bindwsm", MAXCOM_BINDWSM, MR_R2,
"box mode", MAXCOM_BOX_MODE, MR_R2,
"box mode selected", MAXCOM_BOX_MODE, 0,
"box mode toggle", MAXCOM_BOX_TOGGLE, 0,
"box toggle", MAXCOM_BOX_TOGGLE, MR_R2,
"configure paths", MAXCOM_CONFIGURE_PATHS, 0,
"create mode", MAXCOM_CREATE_MODE, 0,
"customize UI", MAXCOM_CUSTOMIZE_CUSTOMIZEUI, 0,
"cycle select", MAXCOM_CYCLE_SELECT_METHOD , 0,
"cycle sublevel", MAXCOM_CYCLE_SUBLEVEL, MR_R2,
"cycle subobject level", MAXCOM_CYCLE_SUBLEVEL, 0,
"def lgt toggle", MAXCOM_DEF_LGT_TOGGLE, MR_R2,
"default lighting toggle", MAXCOM_DEF_LGT_TOGGLE, 0,
"delete", MAXCOM_EDIT_DELETE , 0,
"display floater", MAXCOM_TOOLS_DISPLAYFLOATER, 0,
"display mode", MAXCOM_DISPLAY_MODE, 0,
"dolly", MAXCOM_DOLLY, MR_R2,
"dolly mode", MAXCOM_DOLLY, 0,
"drawing aids", MAXCOM_DRAWINGAIDS, 0,
"drawingaids", MAXCOM_DRAWINGAIDS, MR_R2,
"fetch", MAXCOM_FETCH, 0,
"file archive", MAXCOM_FILE_ARCHIVE, 0,
"file export", MAXCOM_FILE_EXPORT, 0,
"file export selected", MAXCOM_FILE_EXPORTSELECTED, 0,
"file import", MAXCOM_FILE_IMPORT, 0,
"file insert tracks", MAXCOM_FILE_INSERTTRACKS, 0,
"file merge", MAXCOM_FILE_MERGE, 0,
"file new", MAXCOM_FILE_NEW, 0,
"file open", MAXCOM_FILE_OPEN, 0,
"file preferences", MAXCOM_FILE_PREFERENCES, 0,
"file replace", MAXCOM_FILE_REPLACE, 0,
"file save", MAXCOM_FILE_SAVE, 0,
"file save selected", MAXCOM_FILE_SAVESELECTED, 0,
"file saveas", MAXCOM_FILE_SAVEAS, 0,
"file summary", MAXCOM_FILE_SUMMARYINFO, 0,
"file xref object", MAXCOM_FILE_XREFOBJECT, 0,
"file xref scene", MAXCOM_FILE_XREFSCENE, 0,
"fov", MAXCOM_FOV, 0,
"freeze inv", MAXCOM_FREEZE_INV, 0,
"freeze selection", MAXCOM_FREEZE_SELECTION, 0,
"fullinteract", MAXCOM_FULLINTERACT, 0,
"grid nudge down", MAXCOM_GRID_NUDGE_DOWN, 0,
"grid nudge up", MAXCOM_GRID_NUDGE_UP, 0,
"grid toggle", MAXCOM_GRID_TOGGLE, 0,
"grids align", MAXCOM_GRIDS_ALIGN, 0,
"group attach", MAXCOM_GROUP_ATTACH, 0,
"group close", MAXCOM_GROUP_CLOSE, 0,
"group detach", MAXCOM_GROUP_DETACH, 0,
"group explode", MAXCOM_GROUP_EXPLODE, 0,
"group group", MAXCOM_GROUP_GROUP, 0,
"group open", MAXCOM_GROUP_OPEN, 0,
"group ungroup", MAXCOM_GROUP_UNGROUP, 0,
"help about", MAXCOM_HELP_ABOUT, 0,
"hide camera toggle", MAXCOM_HIDE_CAMERA_TOGGLE, 0,
"hide command panel toggle", MAXCOM_HIDE_CMD_PAN, 0,
"hide floating toolbars toggle", MAXCOM_HIDE_FLOATERS, 0,
"hide helper toggle", MAXCOM_HIDE_HELPER_TOGGLE, 0,
"hide inv", MAXCOM_HIDE_INV, 0,
"hide light toggle", MAXCOM_HIDE_LIGHT_TOGGLE, 0,
"hide main toolbar toggle", MAXCOM_HIDE_MAIN_TB, 0,
"hide object toggle", MAXCOM_HIDE_OBJECT_TOGGLE, 0,
"hide selection", MAXCOM_HIDE_SELECTION, 0,
"hide shape toggle", MAXCOM_HIDE_SHAPE_TOGGLE, 0,
"hide system toggle", MAXCOM_HIDE_SYSTEM_TOGGLE, 0,
"hide tab panel toggle", MAXCOM_HIDE_SHELF, 0,
"hide wsm toggle", MAXCOM_HIDE_WSM_TOGGLE, 0,
"hierarchy mode", MAXCOM_HIERARCHY_MODE, 0,
"hold", MAXCOM_HOLD, 0,
"ik terminator", MAXCOM_IK_TERMINATOR, 0,
"ipan", MAXCOM_IPAN, 0,
"izoom in", MAXCOM_IZOOM_IN, 0,
"izoom out", MAXCOM_IZOOM_OUT, 0,
"key mode", MAXCOM_KEY_MODE, 0,
"link", MAXCOM_LINK, 0,
"load custom UI", MAXCOM_CUSTOMIZE_LOADCUI, 0,
"lock UI layout", MAXCOM_CUSTOMIZE_LOCKUILAYOUT, 0,
"material browser", MAXCOM_TOOLS_MTLMAPBROWSER, 0,
"mirror", MAXCOM_MIRROR, 0,
"modify mode", MAXCOM_MODIFY_MODE, 0,
"motion mode", MAXCOM_MOTION_MODE, 0,
"move", MAXCOM_MOVE, 0,
"mtledit", MAXCOM_MTLEDIT, 0,
"next mod", MAXCOM_NEXT_MOD, 0,
"override", MAXCOM_OVERRIDE, 0,
"pancamera", MAXCOM_PANCAMERA, 0,
"panview", MAXCOM_PANVIEW, 0,
"percent snap toggle", MAXCOM_PERCENT_SNAP_TOGGLE, 0,
"persp", MAXCOM_PERSP, 0,
"place highlight", MAXCOM_EDIT_PLACEHIGHLIGHT, 0,
"prev mod", MAXCOM_PREV_MOD, 0,
"preview", MAXCOM_PREVIEW, 0,
"properties", MAXCOM_PROPERTIES, 0,
"quick render", MAXCOM_QUICK_RENDER, 0,
"redo", MAXCOM_EDIT_REDO , 0,
"renamepreview", MAXCOM_RENAMEPREVIEW, 0,
"render last", MAXCOM_RENDER_LAST, 0,
"render scene", MAXCOM_RENDER_SCENE, 0,
"reset file", MAXCOM_RESET_FILE, 0,
"revert custom UI", MAXCOM_CUSTOMIZE_REVERTCUI, 0,
"rns", MAXCOM_RNS, 0,
"roll", MAXCOM_ROLL, 0,
"rotate", MAXCOM_ROTATE, 0,
"rotateview", MAXCOM_ROTATEVIEW, 0,
"safeframe toggle", MAXCOM_SAFEFRAME_TOGGLE, 0,
"save custom UI as", MAXCOM_CUSTOMIZE_SAVECUIAS, 0,
"saveplus", MAXCOM_SAVEPLUS, 0,
"scale", MAXCOM_SCALE, 0,
"scale cycle", MAXCOM_SCALE_CYCLE, 0,
"select", MAXCOM_SELECT, 0,
"select all", MAXCOM_EDIT_SELECTALL , 0,
"select by color", MAXCOM_SELECT_BY_COLOR, 0,
"select child", MAXCOM_SELECT_CHILD, 0,
"select invert", MAXCOM_EDIT_SELECTINVERT , 0,
"select none", MAXCOM_EDIT_SELECTNONE , 0,
"select parent", MAXCOM_SELECT_PARENT, 0,
"selection floater", MAXCOM_TOOLS_SELECTIONFLOATER, 0,
"shade selected", MAXCOM_SHADE_SELECTED, 0,
"show last img", MAXCOM_SHOW_LAST_IMG, 0,
"showaxisicon", MAXCOM_SHOWAXISICON, 0,
"showhomegrid", MAXCOM_SHOWHOMEGRID, 0,
"snap toggle", MAXCOM_SNAP_TOGGLE, 0,
"snapshot", MAXCOM_EDIT_SNAPSHOT, 0,
"spacebar", MAXCOM_SPACEBAR, 0,
"spacing tool", MAXCOM_TOOLS_SPACINGTOOL, 0,
"spinsnap toggle", MAXCOM_SPINSNAP_TOGGLE, 0,
"subobject sel", MAXCOM_SUBOBJECT_SEL, 0,
"swap layouts", MAXCOM_SWAP_LAYOUTS, 0,
"texture correct", MAXCOM_TEXTURE_CORRECT, 0,
"time back", MAXCOM_TIME_BACK, MR_DISABLED,
"time config", MAXCOM_TIME_CONFIG, 0,
"time end", MAXCOM_TIME_END, 0,
"time forward", MAXCOM_TIME_FORWARD, MR_DISABLED,
"time play", MAXCOM_TIME_PLAY, 0,
"time start", MAXCOM_TIME_START, 0,
"toggle ik", MAXCOM_TOGGLE_IK, 0,
"toggle key mode", MAXCOM_KEYMODE_TOGGLE, 0,
"toggle keyboard shortcuts",MAXCOM_KBDSHORTCUT_TOGGLE, 0,
"toggle sound", MAXCOM_TOGGLE_SOUND, 0,
"tool animmode", MAXCOM_TOOL_ANIMMODE, 0,
"tool center", MAXCOM_TOOL_CENTER, 0,
"tool dualplanes", MAXCOM_TOOL_DUALPLANES, 0,
"tool hlist", MAXCOM_TOOL_HLIST, 0,
"tool maximize", MAXCOM_TOOL_MAXIMIZE, 0,
"tool region toggle", MAXCOM_TOOL_REGION_TOGGLE, 0,
"tool x", MAXCOM_TOOL_X, 0,
"tool xy", MAXCOM_TOOL_XY, 0,
"tool y", MAXCOM_TOOL_Y, 0,
"tool z", MAXCOM_TOOL_Z, 0,
"tool zoom", MAXCOM_TOOL_ZOOM, 0,
"tool zoomall", MAXCOM_TOOL_ZOOMALL, 0,
"tool zoomextents", MAXCOM_TOOL_ZOOMEXTENTS, 0,
"tool zoomextents all", MAXCOM_TOOL_ZOOMEXTENTS_ALL, 0,
"tool zoomregion", MAXCOM_TOOL_ZOOMREGION, 0,
"trajectories", MAXCOM_TRAJECTORIES, 0,
"treeview", MAXCOM_TREEVIEW, 0,
"truck", MAXCOM_TRUCK, 0,
"tti", MAXCOM_TTI, 0,
"undo", MAXCOM_EDIT_UNDO , 0,
"unfreeze all", MAXCOM_UNFREEZE_ALL, 0,
"unfreeze by hit", MAXCOM_UNFREEZE_BY_HIT, 0,
"unfreeze by name", MAXCOM_UNFREEZE_BY_NAME, 0,
"unhide all", MAXCOM_UNHIDE_ALL, 0,
"unhide by name", MAXCOM_UNHIDE_BY_NAME, 0,
"unitsetup", MAXCOM_UNITSETUP, 0,
"unlink", MAXCOM_UNLINK, 0,
"utility mode", MAXCOM_UTILITY_MODE, 0,
"videopost", MAXCOM_VIDEOPOST, 0,
"view file", MAXCOM_VIEW_FILE, 0,
"view redo", MAXCOM_VIEW_REDO, 0,
"viewpreview", MAXCOM_VIEWPREVIEW, 0,
"views redraw", MAXCOM_VIEWS_REDRAW, 0,
"views undo", MAXCOM_VIEWS_UNDO, 0,
"vpt back", MAXCOM_VPT_BACK, 0,
"vpt bottom", MAXCOM_VPT_BOTTOM, 0,
"vpt camera", MAXCOM_VPT_CAMERA, 0,
"vpt disable", MAXCOM_VPT_DISABLE, 0,
"vpt front", MAXCOM_VPT_FRONT, 0,
"vpt grid", MAXCOM_VPT_GRID, 0,
"vpt iso user", MAXCOM_VPT_ISO_USER, 0,
"vpt left", MAXCOM_VPT_LEFT, 0,
"vpt persp user", MAXCOM_VPT_PERSP_USER, 0,
"vpt right", MAXCOM_VPT_RIGHT, 0,
"vpt shape", MAXCOM_VPT_SHAPE, 0,
"vpt spot", MAXCOM_VPT_SPOT, 0,
"vpt tab", MAXCOM_VPT_TAB, 0,
"vpt top", MAXCOM_VPT_TOP, 0,
"vpt track", MAXCOM_VPT_TRACK, 0,
"vptconfig", MAXCOM_VPTCONFIG, 0,
"wire facet", MAXCOM_WIRE_FACET, 0,
"wire smooth", MAXCOM_WIRE_SMOOTH, 0,
"zoom in 2x", MAXCOM_ZOOM_IN_2X, 0,
"zoom in 2x all", MAXCOM_ZOOM_IN_2X_ALL, 0,
"zoom out 2x", MAXCOM_ZOOM_OUT_2X, 0,
"zoom out 2x all", MAXCOM_ZOOM_OUT_2X_ALL, 0,
"zoomext sel", MAXCOM_ZOOMEXT_SEL, 0,
"zoomext sel all", MAXCOM_ZOOMEXT_SEL_ALL, 0,
#endif
@@ -0,0 +1,135 @@
/*
* MSCustAttrib.h - MAXScript scriptable custom attributes MAX objects
*
* Copyright © Autodesk, Inc, 2000. John Wainwright.
*
*/
#ifndef _H_MSCUST_ATTRIB
#define _H_MSCUST_ATTRIB
// ---------- scripter Custom Attribute classes -------------------
#include "CustAttrib.h"
#define I_SCRIPTEDCUSTATTRIB 0x000010C1
// special subclass for holding custom attribute definitions
// these can be applied to any existing object, adding a CustAttrib to it
// instances of MSCustAttrib (an MSPlugin subclass) refer to CustAttribDefs for metadata
visible_class (MSCustAttribDef)
class MSCustAttribDef : public MSPluginClass
{
public:
static Tab<MSCustAttribDef*> ms_attrib_defs; // table of existing scripted attribute defs to enable redefinition
Value* defData; // persistent definition data, used by the scripter attribute editor
TSTR source; // extracted definition source, stored persistently with the def & automatically recompiled on
// reload
MSCustAttribDef(Class_ID& attrib_id);
~MSCustAttribDef();
// definition and redefinition
static MSCustAttribDef* intern(Class_ID& attrib_id);
void init(int local_count, Value** inits, HashTable* local_scope, HashTable* handlers, Array* pblock_defs, Array* rollouts, CharStream* source);
// MAXScript required
BOOL is_kind_of(ValueMetaClass* c) { return (c == class_tag(MSCustAttribDef)) ? 1 : Value::is_kind_of(c); }
# define is_attribute_def(v) ((v)->tag == class_tag(MSCustAttribDef))
void collect() { delete this; }
void gc_trace();
void sprin1(CharStream* s);
bool is_custAttribDef() { return true; }
MSCustAttribDef* unique_clone();
// from Value
Value* apply(Value** arg_list, int count, CallContext* cc=NULL) { return Value::apply(arg_list, count, cc); } // CustAttribDef's are not applyable
// scene I/O
static IOResult save_custattrib_defs(ISave* isave);
static IOResult load_custattrib_defs(ILoad* iload);
// ClassDesc delegates
RefTargetHandle Create(BOOL loading);
Value* get_property(Value** arg_list, int count);
Value* set_property(Value** arg_list, int count);
};
// MSCustAttrib - instances contain individual custom attribute blocks
// that are added to customized objects.
class MSCustAttrib : public MSPlugin, public CustAttrib, public ISubMap
{
public:
IObjParam* cip; // ip for any currently open command panel dialogs
static MSAutoMParamDlg* masterMDlg; // master dialog containing all scripted rollout
IMtlParams* mip; // ip for any open mtlEditor panel dlgs
MSCustAttrib() : cip(NULL), mip(NULL) { }
MSCustAttrib(MSCustAttribDef* pc, BOOL loading);
~MSCustAttrib() { DeleteAllRefsFromMe(); }
void sprin1(CharStream* s);
// From MSPlugin
HWND AddRollupPage(HINSTANCE hInst, TCHAR *dlgTemplate, DLGPROC dlgProc, TCHAR *title, LPARAM param=0,DWORD flags=0, int category=ROLLUP_CAT_STANDARD);
void DeleteRollupPage(HWND hRollup);
IRollupWindow* GetRollupWindow();
ReferenceTarget* get_delegate() { return NULL; } // no delegates in MSCustAttribs
// from CustAttrib
TCHAR* GetName() { return pc->class_name->to_string(); }
ParamDlg* CreateParamDlg(HWND hwMtlEdit, IMtlParams *imp);
// From Animatable
void GetClassName(TSTR& s) { s = TSTR(pc->class_name->to_string()); }
Class_ID ClassID() { return pc->class_id; }
SClass_ID SuperClassID() { return pc->sclass_id; }
void FreeCaches() { }
int NumSubs() { return pblocks.Count(); }
Animatable* SubAnim(int i) { return pblocks[i]; }
TSTR SubAnimName(int i) { return pblocks[i]->GetLocalName(); }
int NumParamBlocks() { return pblocks.Count(); }
IParamBlock2* GetParamBlock(int i) { return pblocks[i]; }
IParamBlock2* GetParamBlockByID(BlockID id) { return MSPlugin::GetParamBlockByID(id); }
void* GetInterface(ULONG id);
void DeleteThis();
void BeginEditParams( IObjParam *ip, ULONG flags,Animatable *prev);
void EndEditParams( IObjParam *ip, ULONG flags,Animatable *next);
// From ReferenceMaker
RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message)
{
if (!(pc->mpc_flags & MPC_REDEFINITION))
return ((MSPlugin*)this)->NotifyRefChanged(changeInt, hTarget, partID, message);
else
return REF_SUCCEED;
}
// From ReferenceTarget
int NumRefs() { return pblocks.Count(); }
RefTargetHandle GetReference(int i) { return pblocks[i]; }
void SetReference(int i, RefTargetHandle rtarg)
{
if (i >= pblocks.Count()) pblocks.SetCount(i+1); pblocks[i] = (IParamBlock2*)rtarg;
}
void RefDeleted() { MSPlugin::RefDeleted(); }
RefTargetHandle Clone(RemapDir& remap = NoRemap());
IOResult Save(ISave *isave) { return MSPlugin::Save(isave); }
IOResult Load(ILoad *iload) { return MSPlugin::Load(iload); }
// from ISubMap
int NumSubTexmaps();
Texmap* GetSubTexmap(int i);
void SetSubTexmap(int i, Texmap *m);
TSTR GetSubTexmapSlotName(int i);
int MapSlotType(int i) { return MAPSLOT_TEXTURE; }
TSTR GetSubTexmapTVName(int i) { return GetSubTexmapSlotName(i); }
ReferenceTarget *GetRefTarget() { return this; }
};
#endif
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,50 @@
//***************************************************************************
//* SceneAPI - Implementation of Scene Extension API for 3D Studio MAX 1.2
//*
//* By Christer Janson
//* Kinetix Development
//*
//* November 2, 1996 CCJ Initial coding
//* January 8, 1997 CCJ Added material editor slot access
//* March 15, 1997 CCJ Added scene materials access
//*
//* This class implements a couple of missing API calls.
//*
//* WARNING:
//* These functions depend on the internal structure of 3D Studio MAX 1.2.
//* Do not attempt to use it with other versions.
//*
// If you encounter this error, you are using this file with an unsupported
// version of the 3D Studio Max SDK.
//#if VERSION_3DSMAX != 120
//#error "STOP!!! This file is only for use with 3D Studio MAX Version 1.2"
//#endif
class SceneAPI {
public:
SceneAPI(Interface* i);
int GetNumAtmos();
Atmospheric* GetAtmospheric(int i);
Control* GetAmbientLightController();
Color GetAmbientLight(TimeValue t);
Texmap* GetBackgroundEnvironment();
Control* GetBackgroundColorController();
Color GetBackgroundColor(TimeValue t);
MtlBase* GetMtlSlot(int i);
MtlBase* GetActiveSlot();
void SetMtlSlot(int i, MtlBase* m);
void SetActiveSlot(MtlBase* m);
int NumMtlSlots();
MtlBaseLib* GetSceneMtls();
ReferenceMaker* GetScene() { return scene; }
private:
void FindScene();
void FindRenderEnvironment();
Interface* ip;
ReferenceMaker* scene;
ReferenceMaker* rendEnv;
};
@@ -0,0 +1,86 @@
/* MSTime.h - the time family of classes for MAXScript
*
* Copyright (c) John Wainwright, 1996
*
*
*/
#ifndef _H_MSTIME
#define _H_MSTIME
#include "Max.h"
/* ------------------------ Time ------------------------------ */
visible_class (MSTime)
class MSTime : public Value
{
public:
TimeValue time;
ENABLE_STACK_ALLOCATE(MSTime);
MSTime (TimeValue t);
static ScripterExport Value* intern(TimeValue t);
# define is_time(o) ((o)->tag == class_tag(MSTime))
classof_methods (MSTime, Value);
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
#include "defimpfn.h"
# include "timepro.h"
def_generic ( coerce, "coerce");
def_property ( ticks );
def_property ( frame );
def_property ( normalized );
TimeValue to_timevalue() { return time; }
float to_float() { return (float)time / GetTicksPerFrame(); }
int to_int() { return (int)time / GetTicksPerFrame(); }
void to_fpvalue(FPValue& v) { v.i = time; v.type = TYPE_TIMEVALUE; }
Value* widen_to(Value* arg, Value** arg_list);
BOOL comparable(Value* arg);
// scene I/O
IOResult Save(ISave* isave);
static Value* Load(ILoad* iload, USHORT chunkID, ValueLoader* vload);
};
/* ------------------------ Interval ------------------------------ */
applyable_class (MSInterval)
class MSInterval : public Value
{
public:
Interval interval;
ENABLE_STACK_ALLOCATE(MSInterval);
MSInterval () {};
ScripterExport MSInterval (Interval i);
ScripterExport MSInterval (TimeValue s, TimeValue e);
# define is_interval(o) ((o)->tag == class_tag(MSInterval))
classof_methods (MSInterval, Value);
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
#include "defimpfn.h"
def_property ( start );
def_property ( end );
Interval to_interval() { return interval; }
void to_fpvalue(FPValue& v) { v.intvl = new Interval (interval.Start(), interval.End()); v.type = TYPE_INTERVAL; }
// scene I/O
IOResult Save(ISave* isave);
static Value* Load(ILoad* iload, USHORT chunkID, ValueLoader* vload);
};
#endif
@@ -0,0 +1,126 @@
/*
* MSZipPackage.h - MAXScript Zip Package file classes & utilities
*
* Copyright © Autodesk, Inc, 2000. John Wainwright.
*
*/
#ifndef _H_MSZIPPACKAGE
#define _H_MSZIPPACKAGE
#include "Parser.h"
class MSZipPackage;
class DotRunParser;
class MZPExtraction;
class TabMZPExtraction;
// MZPExtraction & TabMZPExtraction, for maintaing a table of
// file extractions so far giving name in .zip and local extracted name
class MZPExtraction
{
public:
TSTR zip_name;
TSTR extracted_name;
MZPExtraction(TCHAR* zip_name, TCHAR* extracted_name) :
zip_name(zip_name), extracted_name(extracted_name) { }
};
class TabMZPExtraction : public Tab<MZPExtraction*>
{
public:
~TabMZPExtraction();
TCHAR* find(TCHAR* zip_name);
void add(TCHAR* zip_name, TCHAR* extracted_name);
};
// MSZipPackage: instances represent open .mzp package files
class MSZipPackage : public Value
{
public:
enum clear_modes { CLEAR_NOW, CLEAR_ON_MAX_EXIT, CLEAR_ON_RESET, KEEP, }; // clear temp modes
TSTR file_name; // zip package file name
TSTR package_name; // parsed from mzp.run file...
TSTR description;
int version;
TSTR extract_dir; // current extract dir
TSTR drop_file; // primary drop file (if any in found)
TabMZPExtraction extractions; // currently extracted files
clear_modes clear_mode;
WORD flags; // flag bits
MSZipPackage(TCHAR* file_name) : file_name(file_name), flags(0), clear_mode(CLEAR_ON_MAX_EXIT) { tag = INTERNAL_CLASS_TAG; }
void collect() { delete this; }
// main zip package file in function
ScripterExport static bool file_in_package(TCHAR* file_name, TSTR* extract_dir=NULL);
static int WINAPI output_callback(char far *buf, unsigned long size);
// package SearchFile
ScripterExport static BOOL search_current_package(TCHAR* file_name, TCHAR* found_path);
// extraction
bool extract_to(TCHAR* dir);
TCHAR* find_extraction(TCHAR* zip_name) { return extractions.find(zip_name); }
void add_extraction(TCHAR* zip_name, TCHAR* extracted_name);
// directory & file manipulation
static TSTR expand_dir(TCHAR* dir);
static TSTR expand_file(TCHAR* file_name);
TSTR expand_dir_for_extraction(TCHAR* dir);
TSTR expand_file_for_extraction(TCHAR* file_name);
// running
void run_all_scripts();
bool run_script(TCHAR* zip_name);
};
// MZP flags
#define MZP_DONT_RUN 0x0001 // just loading, don't run any scripts
#define MZP_HAVE_DROPFILE 0x0002 // 'drop' command encountered
#define MZP_HAVE_OPEN 0x0004 // 'open' command encountered
// interpret copy() function type bits...
#define MZP_COPY 0x00
#define MZP_MOVE 0x01
#define MZP_FILES 0x00
#define MZP_TREE 0x02
#define MZP_NOREPLACE 0x04
// parser specialization to parse & run mzp.run control file
class DotRunParser : public Parser
{
MSZipPackage* mzp;
public:
DotRunParser (MSZipPackage* mzp) : mzp(mzp) { }
// parse & run mzp.run file
bool interpret(TCHAR* src);
// parser production functions
void name();
void version();
void description();
void extract();
void run();
void drop();
void open();
void merge();
void xref();
void import();
void copy(BYTE type);
void clear();
void keep();
// utils
void copy_files(TCHAR* from, TCHAR* to, BYTE type);
bool create_dir(TCHAR* dir);
};
#endif
@@ -0,0 +1,142 @@
/*
* MSController.h - MAXScript scriptable controllers for MAX
*
* Copyright © John Wainwright 1996
*
*/
#ifndef _H_MSCONTROLLER
#define _H_MSCONTROLLER
#define SCRIPT_POS_CONTROL_CLASS_ID Class_ID(0x236c6aa5, 0x27590853)
#define SCRIPT_P3_CONTROL_CLASS_ID Class_ID(0x3d7b231d, 0x2b986df3)
#define SCRIPT_FLOAT_CONTROL_CLASS_ID Class_ID(0x151d5ead, 0x55626f88)
#define SCRIPT_SCALE_CONTROL_CLASS_ID Class_ID(0x5f346d25, 0x2c67ff7)
#define SCRIPT_ROT_CONTROL_CLASS_ID Class_ID(0xc6625, 0xb003c2a)
class ScriptControl : public StdControl
{
public:
int type;
Interval ivalid;
Interval range;
HWND hParams;
IObjParam * ip;
TSTR desc;
HWND hDlg;
ScriptControl(int type, ScriptControl &ctrl);
ScriptControl(int type, BOOL loading);
~ScriptControl();
// Animatable methods
int TrackParamsType() { return TRACKPARAMS_WHOLE; }
void DeleteThis() { delete this; }
int IsKeyable() { return 0; }
BOOL IsAnimated() {return TRUE;}
Interval GetTimeRange(DWORD flags) { return range; }
void EditTimeRange(Interval range,DWORD flags);
void Hold();
void MapKeys( TimeMap *map, DWORD flags );
void BeginEditParams( IObjParam *ip, ULONG flags,Animatable *prev );
void EndEditParams( IObjParam *ip, ULONG flags,Animatable *next );
void EditTrackParams(
TimeValue t, // The horizontal position of where the user right clicked.
ParamDimensionBase *dim,
TCHAR *pname,
HWND hParent,
IObjParam *ip,
DWORD flags);
// Reference methods
int NumRefs() { return StdControl::NumRefs() + refTab.Count(); }
ReferenceTarget* GetReference(int i);
void SetReference(int i, RefTargetHandle rtarg);
RefResult NotifyRefChanged(Interval, RefTargetHandle, PartID&, RefMessage);
void RefDeleted();
IOResult Save(ISave *isave);
IOResult Load(ILoad *iload);
// Control methods
void Copy(Control *from);
RefTargetHandle Clone(RemapDir& remap=NoRemap()) { ScriptControl *newob = new ScriptControl(this->type, *this); BaseClone(this, newob, remap); return(newob); }
BOOL IsLeaf() { return TRUE; }
void GetValueLocalTime(TimeValue t, void *val, Interval &valid, GetSetMethod method=CTRL_ABSOLUTE);
void SetValueLocalTime(TimeValue t, void *val, int commit, GetSetMethod method) {}
void Extrapolate(Interval range,TimeValue t,void *val,Interval &valid,int type);
void *CreateTempValue();
void DeleteTempValue(void *val);
void ApplyValue(void *val, void *delta);
void MultiplyValue(void *val, float m);
};
class ScriptPosControl : public ScriptControl
{
public:
ScriptPosControl(ScriptPosControl &ctrl) : ScriptControl(CTRL_POSITION_CLASS_ID, ctrl) {}
ScriptPosControl(BOOL loading=FALSE) : ScriptControl(CTRL_POSITION_CLASS_ID, loading) {}
~ScriptPosControl() {}
RefTargetHandle Clone(RemapDir& remap=NoRemap()) { ScriptPosControl *newob = new ScriptPosControl(*this); BaseClone(this, newob, remap); return(newob); }
void GetClassName(TSTR& s) { s = _T("Position_script"); }
Class_ID ClassID() { return Class_ID(SCRIPT_POS_CONTROL_CLASS_ID,0); }
SClass_ID SuperClassID() { return CTRL_POSITION_CLASS_ID; }
};
class ScriptP3Control : public ScriptControl
{
public:
ScriptP3Control(ScriptP3Control &ctrl) : ScriptControl(CTRL_POINT3_CLASS_ID, ctrl) {}
ScriptP3Control(BOOL loading=FALSE) : ScriptControl(CTRL_POINT3_CLASS_ID, loading) {}
~ScriptP3Control() {}
RefTargetHandle Clone(RemapDir& remap=NoRemap()) { ScriptP3Control *newob = new ScriptP3Control(*this); BaseClone(this, newob, remap); return(newob); }
void GetClassName(TSTR& s) { s = _T("Point_script"); }
Class_ID ClassID() { return Class_ID(SCRIPT_P3_CONTROL_CLASS_ID,0); }
SClass_ID SuperClassID() { return CTRL_POINT3_CLASS_ID; }
};
class ScriptFloatControl : public ScriptControl
{
public:
ScriptFloatControl(ScriptFloatControl &ctrl) : ScriptControl(CTRL_FLOAT_CLASS_ID, ctrl) {}
ScriptFloatControl(BOOL loading=FALSE) : ScriptControl(CTRL_FLOAT_CLASS_ID, loading) {}
~ScriptFloatControl() {}
RefTargetHandle Clone(RemapDir& remap=NoRemap()) { ScriptFloatControl *newob = new ScriptFloatControl(*this); BaseClone(this, newob, remap); return(newob); }
void GetClassName(TSTR& s) { s = _T("Float_script"); }
Class_ID ClassID() { return Class_ID(SCRIPT_FLOAT_CONTROL_CLASS_ID,0); }
SClass_ID SuperClassID() { return CTRL_FLOAT_CLASS_ID; }
};
class ScriptScaleControl : public ScriptControl
{
public:
ScriptScaleControl(ScriptScaleControl &ctrl) : ScriptControl(CTRL_SCALE_CLASS_ID, ctrl) {}
ScriptScaleControl(BOOL loading=FALSE) : ScriptControl(CTRL_SCALE_CLASS_ID, loading) {}
~ScriptScaleControl() {}
RefTargetHandle Clone(RemapDir& remap=NoRemap()) { ScriptScaleControl *newob = new ScriptScaleControl(*this); BaseClone(this, newob, remap); return(newob); }
void GetClassName(TSTR& s) { s = _T("Scale_script"); }
Class_ID ClassID() { return Class_ID(SCRIPT_SCALE_CONTROL_CLASS_ID,0); }
SClass_ID SuperClassID() { return CTRL_SCALE_CLASS_ID; }
};
class ScriptRotControl : public ScriptControl
{
public:
ScriptRotControl(ScriptRotControl &ctrl) : ScriptControl(CTRL_ROTATION_CLASS_ID, ctrl) {}
ScriptRotControl(BOOL loading=FALSE) : ScriptControl(CTRL_ROTATION_CLASS_ID, loading) {}
~ScriptRotControl() {}
RefTargetHandle Clone(RemapDir& remap=NoRemap()) { ScriptRotControl *newob = new ScriptRotControl(*this); BaseClone(this, newob, remap); return(newob); }
void GetClassName(TSTR& s) { s = _T("Rotation_script"); }
Class_ID ClassID() { return Class_ID(SCRIPT_ROT_CONTROL_CLASS_ID,0); }
SClass_ID SuperClassID() { return CTRL_ROTATION_CLASS_ID; }
};
#endif
@@ -0,0 +1,647 @@
/*
* MAX_classes.h - class object for all the MAX built-in types
*
* Copyright © John Wainwright 1996
*
*/
#ifndef _H_MAX_CLASSES
#define _H_MAX_CLASSES
#include "MAXObj.h"
extern ScripterExport MAXSuperClass maxwrapper_class;
extern ScripterExport MAXSuperClass non_reftarg_maxwrapper_class;
extern ScripterExport MAXSuperClass referencetarget_class;
extern ScripterExport MAXSuperClass referencemaker_class;
extern ScripterExport MAXSuperClass node_class;
extern ScripterExport MAXClass inode_object;
extern ScripterExport MAXSuperClass geom_class;
extern ScripterExport MAXSuperClass modifier;
extern ScripterExport MAXSuperClass shape;
extern ScripterExport MAXSuperClass helper_object;
extern ScripterExport MAXSuperClass spacewarp_object;
extern ScripterExport MAXSuperClass spacewarp_modifier;
extern ScripterExport MAXSuperClass float_controller;
extern ScripterExport MAXSuperClass point3_controller;
extern ScripterExport MAXSuperClass position_controller;
extern ScripterExport MAXSuperClass quat_controller;
extern ScripterExport MAXSuperClass rotation_controller;
extern ScripterExport MAXSuperClass scale_controller;
extern ScripterExport MAXSuperClass matrix3_controller;
extern ScripterExport MAXSuperClass morph_controller;
extern ScripterExport MAXSuperClass master_block_controller;
extern ScripterExport MAXSuperClass light_object;
extern ScripterExport MAXSuperClass camera_object;
extern ScripterExport MAXSuperClass material_class;
extern ScripterExport MAXSuperClass shader_class;
extern ScripterExport MAXSuperClass texture_map;
extern ScripterExport MAXSuperClass system_object;
extern ScripterExport MAXSuperClass utility_plugin;
extern ScripterExport MAXSuperClass gup_plugin;
extern ScripterExport MAXSuperClass atmos_object;
extern ScripterExport MAXSuperClass render_effect; // RK: Added this
extern ScripterExport MAXSuperClass shadowtype_class; //LE Added this
extern ScripterExport MAXSuperClass custAttrib_class;
extern ScripterExport MAXSuperClass renderer_class;
extern ScripterExport MAXSuperClass render_element_class;
extern ScripterExport MAXSuperClass radiosity_effect_class;
extern ScripterExport MAXSuperClass tone_operator_class;
extern ScripterExport MAXSuperClass bitmap_io_class;
extern ScripterExport MAXSuperClass iksolver_class; //LAM Added this
extern ScripterExport MAXSuperClass mpass_cam_effect_class; //LAM Added this
extern MAXClass box;
extern MAXClass sphere;
extern Value* node_get_ishidden(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_ishidden(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* node_get_boxmode(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_boxmode(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* node_get_alledges(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_alledges(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* node_get_backfacecull(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_backfacecull(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* node_get_castshadows(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_castshadows(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* node_get_receiveshadows(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_receiveshadows(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* node_get_motionblur(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_motionblur(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* node_get_wirecolor(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_wirecolor(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* node_get_isselected(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_isselected(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* node_get_isdependent(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_isdependent(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* node_get_istarget(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_istarget(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* node_get_gbufferchannel(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_gbufferchannel(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* node_get_visibility(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_visibility(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* node_get_targetDistance(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_targetDistance(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* node_get_imageblurMultiplier(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_imageblurMultiplier(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* node_get_showLinks(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_showLinks(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* node_get_showLinksOnly(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_showLinksOnly(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* node_get_isfrozen(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_isfrozen(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* node_get_showTrajectory(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_showTrajectory(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* node_get_renderable(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_renderable(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* node_get_showVertexColors(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_showVertexColors(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* node_get_vertexColorsShaded(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_vertexColorsShaded(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* node_get_inheritVisibility(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_inheritVisibility(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* node_get_baseObject(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_baseObject(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* node_get_lookAtNode(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_lookAtNode(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* node_get_transform(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_transform(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* node_get_showFrozenInGray(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_showFrozenInGray(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
#ifdef DESIGN_VER //KENNY MERGE
extern Value* node_get_displayByLayer(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_displayByLayer(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* node_get_motionByLayer(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_motionByLayer(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* node_get_renderByLayer(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_renderByLayer(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
#endif
//RK: Added these
extern Value* node_get_ignoreExtents(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_ignoreExtents(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* node_get_xray(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_xray(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* node_get_renderOccluded(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_renderOccluded(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* node_get_motionbluron(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_motionbluron(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* node_get_motionbluroncontroller(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_motionbluroncontroller(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* node_get_rcvCaustics(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_rcvCaustics(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* node_get_generateCaustics(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_generateCaustics(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* node_get_rcvGlobalIllum(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_rcvGlobalIllum(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* node_get_generateGlobalIllum(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_generateGlobalIllum(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* node_get_primaryVisibility(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_primaryVisibility(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* node_get_secondaryVisibility(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_secondaryVisibility(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
// LAM added this
extern Value* node_get_vertexTicks(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void node_set_vertexTicks(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* campoint_get_showAxis(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void campoint_set_showAxis(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* campoint_get_axisLength(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void campoint_set_axisLength(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* point_get_showAxis(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void point_set_showAxis(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* point_get_axisLength(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void point_set_axisLength(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_pa_emitter(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_pa_emitter(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_pa_instancingObject(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_pa_instancingObject(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_pa_lifespanValueQueue(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_pa_lifespanValueQueue(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_pa_objectMutationQueue(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_pa_objectMutationQueue(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_ss_instancingObject(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_ss_instancingObject(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_ss_lifespanValueQueue(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_ss_lifespanValueQueue(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_ss_objectMutationQueue(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_ss_objectMutationQueue(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_bliz_instancingObject(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_bliz_instancingObject(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_bliz_lifespanValueQueue(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_bliz_lifespanValueQueue(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_bliz_objectMutationQueue(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_bliz_objectMutationQueue(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_pc_emitter(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_pc_emitter(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_pc_motionReferenceObject(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_pc_motionReferenceObject(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_pc_instancingObject(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_pc_instancingObject(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_pc_lifespanValueQueue(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_pc_lifespanValueQueue(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_pc_objectMutationQueue(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_pc_objectMutationQueue(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_light_on(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_light_on(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_light_hsv(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_light_hsv(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_light_hue(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_light_hue(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_light_sat(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_light_sat(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_light_val(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_light_val(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_light_excludeList(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_light_excludeList(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_light_includeList(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_light_includeList(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_light_inclExclType(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_light_inclExclType(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_light_softenDiffuseEdge(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_light_softenDiffuseEdge(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_light_affectDiffuse(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_light_affectDiffuse(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_light_affectSpecular(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_light_affectSpecular(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_light_useNearAtten(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_light_useNearAtten(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_light_showNearAtten(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_light_showNearAtten(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_light_useFarAtten(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_light_useFarAtten(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_light_showFarAtten(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_light_showFarAtten(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_light_attenDecay(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_light_attenDecay(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_light_useshadowProjMap(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_light_useshadowProjMap(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_light_projector(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_light_projector(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_light_projectorMap(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_light_projectorMap(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_light_castShadows(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_light_castShadows(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_light_useGlobalShadowSettings(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_light_useGlobalShadowSettings(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_light_absoluteMapBias(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_light_absoluteMapBias(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_light_raytracedShadows(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_light_raytracedShadows(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_light_showCone(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_light_showCone(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_light_overShoot(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_light_overShoot(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_light_coneShape(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_light_coneShape(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
// RK: Added these
extern Value* get_light_atmosShadows(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_light_atmosShadows(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_light_lightAffectsShadow(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_light_lightAffectsShadow(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_light_shadowProjMap(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_light_shadowProjMap(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_light_ambientOnly(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_light_ambientOnly(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_light_type(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_light_type(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern void set_light_shadowGenerator(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_light_shadowGenerator(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
//extern Value* get_cam_lens(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
//extern void set_cam_lens(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
//extern Value* get_cam_fovType(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
//extern void set_cam_fovType(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_cam_orthoProjection(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_cam_orthoProjection(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_cam_showCone(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_cam_showCone(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_cam_showHorizon(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_cam_showHorizon(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_cam_showRanges(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_cam_showRanges(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_cam_clipManualy(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_cam_clipManualy(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
// RK: Added these
extern Value* get_cam_type(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_cam_type(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
// LAM: Added these
extern Value* get_cam_mpassEffect(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_cam_mpassEffect(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
/*
extern Value* get_stdmat_map(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_stdmat_map(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_stdmat_mapamount(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_stdmat_mapamount(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_stdmat_mapenable(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_stdmat_mapenable(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_stdmat_shading(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_stdmat_shading(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_stdmat_soften(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_stdmat_soften(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_stdmat_facemap(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_stdmat_facemap(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_stdmat_twosided(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_stdmat_twosided(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_stdmat_wire(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_stdmat_wire(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_stdmat_wireunits(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_stdmat_wireunits(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_stdmat_falloff(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_stdmat_falloff(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_stdmat_opacitytype(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_stdmat_opacitytype(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_stdmat_lockambientdiffuse(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_stdmat_lockambientdiffuse(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_stdmat_superSample(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_stdmat_superSample(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_stdmat_applyReflectionDimming(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_stdmat_applyReflectionDimming(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
*/
extern Value* get_mtl_gbufID(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid) ;
extern void set_mtl_gbufID(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
/*
extern Value* get_blend_material1(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_blend_material1(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_blend_material2(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_blend_material2(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_blend_mask(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_blend_mask(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_blend_material1Enabled(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_blend_material1Enabled(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_blend_material2Enabled(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_blend_material2Enabled(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_blend_maskEnabled(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_blend_maskEnabled(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_blend_useCurve(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_blend_useCurve(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_double_facingMat(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_double_facingMat(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_double_backMat(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_double_backMat(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_double_facingEnabled(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_double_facingEnabled(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_double_backEnabled(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_double_backEnabled(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_topbot_coordinates(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_topbot_coordinates(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_topbot_topMat(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_topbot_topMat(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_topbot_bottomMat(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_topbot_bottomMat(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_topbot_topEnabled(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_topbot_topEnabled(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_topbot_bottomEnabled(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_topbot_bottomEnabled(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
*/
extern Value* get_raymat_map(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_raymat_map(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_raymat_mapamount(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_raymat_mapamount(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_raymat_mapenable(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_raymat_mapenable(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
/*
extern Value* get_matte_opaqueAlpha(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_matte_opaqueAlpha(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_matte_applyAtmosphere(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_matte_applyAtmosphere(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_matte_atmosphereDepth(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_matte_atmosphereDepth(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_matte_receiveShadows(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_matte_receiveShadows(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_matte_affectAlpha(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_matte_affectAlpha(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* bmt_get_filename(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void bmt_set_filename(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* bmt_get_filtertype(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void bmt_set_filtertype(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* bmt_get_alphasource(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void bmt_set_alphasource(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* bmt_get_endcondition(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void bmt_set_endcondition(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* bmt_get_monooutput(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void bmt_set_monooutput(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* bmt_get_playbackrate(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void bmt_set_playbackrate(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* bmt_get_starttime(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void bmt_set_starttime(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* bmt_get_mappingtype(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void bmt_set_mappingtype(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* bmt_get_uoffset(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void bmt_set_uoffset(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* bmt_get_voffset(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void bmt_set_voffset(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* bmt_get_utiling(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void bmt_set_utiling(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* bmt_get_vtiling(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void bmt_set_vtiling(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* bmt_get_angle(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void bmt_set_angle(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* bmt_get_blur(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void bmt_set_blur(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* bmt_get_bluroffset(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void bmt_set_bluroffset(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* bmt_get_umirror(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void bmt_set_umirror(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* bmt_get_utile(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void bmt_set_utile(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* bmt_get_vmirror(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void bmt_set_vmirror(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* bmt_get_vtile(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void bmt_set_vtile(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* bmt_get_showmap(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void bmt_set_showmap(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
//RK: Added these
extern Value* bmt_get_bitmap(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void bmt_set_bitmap(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* msk_get_map(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void msk_set_map(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* msk_get_mask(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void msk_set_mask(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* msk_get_mapEnabled(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void msk_set_mapEnabled(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* msk_get_maskEnabled(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void msk_set_maskEnabled(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* msk_get_maskInverted(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void msk_set_maskInverted(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* noise_get_noiseType(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void noise_set_noiseType(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* noise_get_map1(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void noise_set_map1(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* noise_get_map2(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void noise_set_map2(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* noise_get_map1Enabled(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void noise_set_map1Enabled(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* noise_get_map2Enabled(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void noise_set_map2Enabled(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* planet_get_blend(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void planet_set_blend(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* grad_get_map1(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void grad_set_map1(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* grad_get_map2(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void grad_set_map2(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* grad_get_map3(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void grad_set_map3(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* grad_get_map1Enabled(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void grad_set_map1Enabled(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* grad_get_map2Enabled(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void grad_set_map2Enabled(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* grad_get_map3Enabled(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void grad_set_map3Enabled(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* flatm_get_applyBlur(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void flatm_set_applyBlur(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* flatm_get_renderType(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void flatm_set_renderType(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* flatm_get_renderFrameStep(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void flatm_set_renderFrameStep(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* flatm_get_useEnvMap(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void flatm_set_useEnvMap(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* flatm_get_applyToMatIDFaces(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void flatm_set_applyToMatIDFaces(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* flatm_get_matID(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void flatm_set_matID(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* flatm_get_distortionType(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void flatm_set_distortionType(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* flatm_get_noiseType(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void flatm_set_noiseType(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
*/
extern Value* uvg_get_mappingType(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void uvg_set_mappingType(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* uvg_get_mapping(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void uvg_set_mapping(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* uvg_get_mapChannel(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void uvg_set_mapChannel(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* xyzg_get_coordType(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void xyzg_set_coordType(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* xyzg_get_mapChannel(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void xyzg_set_mapChannel(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_text_string(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_text_string(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_text_font(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_text_font(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_text_italic(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_text_italic(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_text_underline(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_text_underline(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_text_alignment(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_text_alignment(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_lxform_control(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_lxform_control(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_cammap_cam(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_cammap_cam(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
/*
extern Value* pth_get_path(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void pth_set_path(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* pth_get_follow(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void pth_set_follow(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* pth_get_bank(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void pth_set_bank(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* pth_get_bankAmount(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void pth_set_bankAmount(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* pth_get_smoothness(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void pth_set_smoothness(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* pth_get_constantVelocity(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void pth_set_constantVelocity(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* pth_get_allowUpsideDown(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void pth_set_allowUpsideDown(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* pth_get_axis(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void pth_set_axis(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* pth_get_axisFlip(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void pth_set_axisFlip(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
*/
extern Value* noiz_get_seed(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void noiz_set_seed(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* noiz_get_frequency(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void noiz_set_frequency(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* noiz_get_fractal(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void noiz_set_fractal(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* noiz_get_roughness(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void noiz_set_roughness(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* noiz_get_strength(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void noiz_set_strength(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* noiz_get_x_strength(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void noiz_set_x_strength(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* noiz_get_y_strength(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void noiz_set_y_strength(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* noiz_get_z_strength(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void noiz_set_z_strength(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* noiz_get_rampin(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void noiz_set_rampin(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* noiz_get_rampout(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void noiz_set_rampout(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* noiz_get_positive(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void noiz_set_positive(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* noiz_get_x_positive(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void noiz_set_x_positive(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* noiz_get_y_positive(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void noiz_set_y_positive(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* noiz_get_z_positive(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void noiz_set_z_positive(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* spcdsp_get_bitmap(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void spcdsp_set_bitmap(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* spcdsp_get_map(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void spcdsp_set_map(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* dsp_get_bitmap(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void dsp_set_bitmap(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* dsp_get_map(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void dsp_set_map(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* pathdef_get_path(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void pathdef_set_path(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* surfdef_get_surface(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void surfdef_set_surface(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* scriptctrl_get_script(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void scriptctrl_set_script(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* shape_get_renderable(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void shape_set_renderable(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* shape_get_thickness(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void shape_set_thickness(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* shape_get_mapcoords(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void shape_set_mapcoords(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* shape_get_angle(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void shape_set_angle(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* shape_get_sides(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void shape_set_sides(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* shape_get_vpt_thickness(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void shape_set_vpt_thickness(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* shape_get_vpt_sides(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void shape_set_vpt_sides(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* shape_get_vpt_angle(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void shape_set_vpt_angle(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* shape_get_displayrendermesh(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void shape_set_displayrendermesh(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* shape_get_use_vpt_settings(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void shape_set_use_vpt_settings(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* shape_get_disp_rndr_settings(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void shape_set_disp_rndr_settings(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* spline_get_steps(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void spline_set_steps(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* spline_get_optimize(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void spline_set_optimize(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* spline_get_adaptive(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void spline_set_adaptive(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* smplspline_get_steps(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void smplspline_set_steps(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* smplspline_get_optimize(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void smplspline_set_optimize(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* smplspline_get_adaptive(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void smplspline_set_adaptive(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* mirror_get_copy(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void mirror_set_copy(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
//LE added this
extern Value* get_shadow_absMapBias(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_shadow_absMapBias(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
//end LE
// RK: Start -- object xrefs
extern Value* get_oxref_proxyFileName(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_oxref_proxyFileName(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_oxref_fileName(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_oxref_fileName(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_oxref_currentFileName(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_oxref_currentFileName(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_oxref_proxyObjectName(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_oxref_proxyObjectName(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_oxref_objectName(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_oxref_objectName(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_oxref_currentObjectName(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_oxref_currentObjectName(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_oxref_useProxy(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_oxref_useProxy(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_oxref_renderProxy(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_oxref_renderProxy(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_oxref_updateMaterial(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_oxref_updateMaterial(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* get_oxref_ignoreAnimation(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void set_oxref_ignoreAnimation(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
// RK: End
/* -------------- Added by AF 4/5/99 ------------------------------------*/
extern Value* surfctrl_get_surface(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void surfctrl_set_surface(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* surfctrl_get_align(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void surfctrl_set_align(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
extern Value* surfctrl_get_flip(ReferenceTarget* obj, Value* prop, TimeValue t, Interval& valid);
extern void surfctrl_set_flip(ReferenceTarget* obj, Value* prop, TimeValue t, Value* val);
//AF: End
#endif
@@ -0,0 +1,409 @@
/* MAXScript.h - main include for MAXScript sources
*
* Copyright (c) John Wainwright, 1996
*
*
*/
#ifndef _H_MAXSCRIPT
#define _H_MAXSCRIPT
#define STRICT // strict type-checking - conformance with MAX SDK libs
#define WIN32_LEAN_AND_MEAN // trims win32 includes
#include <stdlib.h>
#include <stdio.h>
#include <windows.h>
#include <float.h>
#include "Max.h"
/* utility defines */
#define END NULL // null varargs arg list terminator
class Value;
class CharStream;
class Rollout;
class MAXScriptException;
class MSPlugin;
class Struct;
class MSZipPackage;
class String;
#define MAXSCRIPT_UTILITY_CLASS_ID Class_ID(0x4d64858, 0x16d1751d)
#define MAX_SCRIPT_DIR _T("scripts")
#define SCRIPT_AUTOLOAD_DIR _T("Startup\\")
#ifdef BLD_MAXSCRIPT
# define ScripterExport __declspec( dllexport )
#else
# define ScripterExport __declspec( dllimport )
#endif
// check whether we are UNICODE or Code page 0 (==> no mbcs code)
#ifdef _UNICODE
# define no_mb_chars TRUE
# define bytelen(s) (sizeof(wchar_t) * wcslen(s))
#else
# define no_mb_chars (MB_CUR_MAX == 1)
# define bytelen(s) strlen(s)
#endif
inline double EPS(double v) { return _isnan(v) ? (v) : fabs(v) < FLT_EPSILON ? 0.0 : (v); } // small number round down for %g float printing
/* MAXScript-specific window messages */
#define MXS_ADD_ROLLOUT_PAGE (WM_USER + 0x100)
#define MXS_DELETE_ROLLOUT_PAGE (WM_USER + 0x101)
#define MXS_REDRAW_VIEWS (WM_USER + 0x102)
#define MXS_EDIT_SCRIPT (WM_USER + 0x103)
#define MXS_NEW_SCRIPT (WM_USER + 0x104)
#define MXS_DISPLAY_BITMAP (WM_USER + 0x105)
#define MXS_ERROR_MESSAGE_BOX (WM_USER + 0x106)
#define MXS_PRINT_STRING (WM_USER + 0x107)
#define MXS_LISTENER_EVAL (WM_USER + 0x108)
#define MXS_MESSAGE_BOX (WM_USER + 0x109)
#define MXS_INITIALIZE_MAXSCRIPT (WM_USER + 0x10A)
#define MXS_KEYBOARD_INPUT (WM_USER + 0x10B)
#define MXS_SHOW_SOURCE (WM_USER + 0x10C)
#define MXS_TAKE_FOCUS (WM_USER + 0x10D)
#define MXS_STOP_CREATING (WM_USER + 0x10E)
#define MXS_CLOSE_DOWN (WM_USER + 0x10F)
#define MXS_STOP_EDITING (WM_USER + 0x110)
#define MXS_LOAD_STARTUP_SCRIPTS (WM_USER + 0x111)
typedef struct // LPARAM for MXS_MESSAGE_BOX contains a pointer to this structure
{
TCHAR* title;
TCHAR* message;
BOOL beep;
int flags;
BOOL result;
} message_box_data;
/* thread-local storage struct decl & access macros */
typedef struct MAXScript_TLS MAXScript_TLS;
struct MAXScript_TLS
{
MAXScript_TLS* next; /* links... */
MAXScript_TLS* prev;
HANDLE my_thread; /* thread that owns this TLS struct */
DWORD my_thread_id;
#undef def_thread_local
#define def_thread_local(type, lcl, init_val) type lcl
# include "thrdlcls.h"
};
#define thread_local(x) (((MAXScript_TLS*)TlsGetValue(thread_locals_index))->x)
/* index, tls struct list globals */
extern ScripterExport int thread_locals_index;
extern int thread_id_index;
extern MAXScript_TLS* MAXScript_TLS_list;
#define needs_redraw_set() thread_local(needs_redraw) = 1
#define needs_complete_redraw_set() thread_local(needs_redraw) = 2
#define needs_redraw_clear() thread_local(needs_redraw) = 0
#define MAXScript_time() \
(thread_local(use_time_context) ? thread_local(current_time) : MAXScript_interface->GetTime())
void alloc_thread_locals();
ScripterExport void init_thread_locals();
void free_thread_locals();
/* error handlers */
void out_of_memory();
void bad_delete();
/* arg count check & keyword arg accessors (assume conventional names for arg_list & count in using function) */
extern ScripterExport Value* _get_key_arg(Value** arg_list, int count, Value* key_name);
extern ScripterExport Value* _get_key_arg_or_default(Value** arg_list, int count, Value* key_name, Value* def);
#define key_arg(key) _get_key_arg(arg_list, count, n_##key)
#define key_arg_or_default(key, def) _get_key_arg_or_default(arg_list, count, n_##key##, def)
#define int_key_arg(key, var, def) ((var = _get_key_arg(arg_list, count, n_##key)) == &unsupplied ? def : var->to_int())
#define float_key_arg(key, var, def) ((var = _get_key_arg(arg_list, count, n_##key)) == &unsupplied ? def : var->to_float())
#define bool_key_arg(key, var, def) ((var = _get_key_arg(arg_list, count, n_##key)) == &unsupplied ? def : var->to_bool())
#define check_arg_count(fn, w, g) if ((w) != (g)) throw ArgCountError (_T(#fn), w, g)
#define check_gen_arg_count(fn, w, g) if ((w) != (g + 1)) throw ArgCountError (_T(#fn), w, g + 1)
#define check_arg_count_with_keys(fn, w, g) if (!(g == w || (g > w && arg_list[w] == &keyarg_marker))) throw ArgCountError (_T(#fn), w, count_with_keys())
#define check_gen_arg_count_with_keys(fn, w, g) if (!(g == w || (g > w && arg_list[w-1] == &keyarg_marker))) throw ArgCountError (_T(#fn), w, count_with_keys() + 1)
#define count_with_keys() _count_with_keys(arg_list, count)
/* value local macros - for managing C local variable references to Value*'s for the collector - see Collectable.cpp */
#define one_value_local(n1) \
struct { int count; Value** link; Value* n1; } vl = \
{ 1, NULL, NULL }; \
vl.link = thread_local(current_locals_frame); \
thread_local(current_locals_frame) = (Value**)&vl;
#define one_typed_value_local(n1) \
struct { int count; Value** link; n1; } vl = \
{ 1, NULL, NULL }; \
vl.link = thread_local(current_locals_frame); \
thread_local(current_locals_frame) = (Value**)&vl;
#define two_value_locals(n1, n2) \
struct { int count; Value** link; Value *n1, *n2; } vl = \
{ 2, NULL, NULL, NULL }; \
vl.link = thread_local(current_locals_frame); \
thread_local(current_locals_frame) = (Value**)&vl;
#define two_typed_value_locals(n1, n2) \
struct { int count; Value** link; n1; n2; } vl = \
{ 2, NULL, NULL, NULL }; \
vl.link = thread_local(current_locals_frame); \
thread_local(current_locals_frame) = (Value**)&vl;
#define three_value_locals(n1, n2, n3) \
struct { int count; Value** link; Value *n1, *n2, *n3; } vl = \
{ 3, NULL, NULL, NULL, NULL }; \
vl.link = thread_local(current_locals_frame); \
thread_local(current_locals_frame) = (Value**)&vl;
#define three_typed_value_locals(n1, n2, n3) \
struct { int count; Value** link; n1; n2; n3; } vl = \
{ 3, NULL, NULL, NULL, NULL }; \
vl.link = thread_local(current_locals_frame); \
thread_local(current_locals_frame) = (Value**)&vl;
#define four_value_locals(n1, n2, n3, n4) \
struct { int count; Value** link; Value *n1, *n2, *n3, *n4; } vl = \
{ 4, NULL, NULL, NULL, NULL, NULL }; \
vl.link = thread_local(current_locals_frame); \
thread_local(current_locals_frame) = (Value**)&vl;
#define four_typed_value_locals(n1, n2, n3, n4) \
struct { int count; Value** link; n1; n2; n3; n4; } vl = \
{ 4, NULL, NULL, NULL, NULL, NULL }; \
vl.link = thread_local(current_locals_frame); \
thread_local(current_locals_frame) = (Value**)&vl;
#define five_value_locals(n1, n2, n3, n4, n5) \
struct { int count; Value** link; Value *n1, *n2, *n3, *n4, *n5; } vl = \
{ 5, NULL, NULL, NULL, NULL, NULL, NULL }; \
vl.link = thread_local(current_locals_frame); \
thread_local(current_locals_frame) = (Value**)&vl;
#define five_typed_value_locals(n1, n2, n3, n4, n5) \
struct { int count; Value** link; n1; n2; n3; n4; n5; } vl = \
{ 5, NULL, NULL, NULL, NULL, NULL, NULL }; \
vl.link = thread_local(current_locals_frame); \
thread_local(current_locals_frame) = (Value**)&vl;
#define six_value_locals(n1, n2, n3, n4, n5, n6) \
struct { int count; Value** link; Value *n1, *n2, *n3, *n4, *n5, *n6; } vl = \
{ 6, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; \
vl.link = thread_local(current_locals_frame); \
thread_local(current_locals_frame) = (Value**)&vl;
#define six_typed_value_locals(n1, n2, n3, n4, n5, n6) \
struct { int count; Value** link; n1; n2; n3; n4; n5; n6; } vl = \
{ 6, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; \
vl.link = thread_local(current_locals_frame); \
thread_local(current_locals_frame) = (Value**)&vl;
#define seven_value_locals(n1, n2, n3, n4, n5, n6, n7) \
struct { int count; Value** link; Value *n1, *n2, *n3, *n4, *n5, *n6, *n7; } vl = \
{ 7, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; \
vl.link = thread_local(current_locals_frame); \
thread_local(current_locals_frame) = (Value**)&vl;
#define seven_typed_value_locals(n1, n2, n3, n4, n5, n6, n7) \
struct { int count; Value** link; n1; n2; n3; n4; n5; n6; n7; } vl = \
{ 7, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; \
vl.link = thread_local(current_locals_frame); \
thread_local(current_locals_frame) = (Value**)&vl;
#define eight_value_locals(n1, n2, n3, n4, n5, n6, n7, n8) \
struct { int count; Value** link; Value *n1, *n2, *n3, *n4, *n5, *n6, *n7, *n8; } vl = \
{ 8, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; \
vl.link = thread_local(current_locals_frame); \
thread_local(current_locals_frame) = (Value**)&vl;
#define eight_typed_value_locals(n1, n2, n3, n4, n5, n6, n7, n8) \
struct { int count; Value** link; n1; n2; n3; n4; n5; n6; n7; n8; } vl = \
{ 8, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; \
vl.link = thread_local(current_locals_frame); \
thread_local(current_locals_frame) = (Value**)&vl;
#define value_local_array(var, count) { \
var = &((Value**)_alloca(((count) + 2) * sizeof(Value*)))[2]; \
memset(var, 0, (count) * sizeof(Value*)); \
var[-2] = (Value*)(count); \
var[-1] = (Value*)thread_local(current_locals_frame); \
thread_local(current_locals_frame) = &var[-2]; }
#define pop_value_local_array(var) \
thread_local(current_locals_frame) = (Value**)var[-1];
#define value_temp_array(var, count) { \
var = &((Value**)malloc(((count) + 2) * sizeof(Value*)))[2]; \
memset(var, 0, (count) * sizeof(Value*)); \
var[-2] = (Value*)(count); \
var[-1] = (Value*)thread_local(current_locals_frame); \
thread_local(current_locals_frame) = &var[-2]; }
#define realloc_value_temp_array(var, count, old_count) { \
var = &((Value**)realloc(&var[-2], ((count) + 2) * sizeof(Value*)))[2]; \
if ((count) > (old_count)) \
memset(&var[(old_count)], 0, ((count) - (old_count)) * sizeof(Value*)); \
var[-2] = (Value*)(count); \
thread_local(current_locals_frame) = &var[-2]; }
#define pop_value_temp_array(var) { \
thread_local(current_locals_frame) = (Value**)var[-1]; \
free(&var[-2]); }
#define return_value(r) { \
thread_local(current_result) = r; \
thread_local(current_locals_frame) = vl.link; \
return r; }
#define return_value_no_pop(r) { \
thread_local(current_result) = r; \
return r; }
#define return_protected(r) { \
thread_local(current_result) = r; \
return r; }
#define pop_value_locals() \
thread_local(current_locals_frame) = vl.link;
#define reset_locals_frame() \
thread_local(current_locals_frame) = (Value**)&vl;
#define reset_locals_array_frame(var) \
thread_local(current_locals_frame) = &var[-2];
#define clear_current_frames() \
thread_local(current_locals_frame) = NULL; \
thread_local(current_frame) = NULL;
#define save_current_frames() \
Value** _sclf = thread_local(current_locals_frame); \
Value** _scsf = thread_local(current_scan_frame); \
Value** _scf = thread_local(current_frame);
#define restore_current_frames() \
thread_local(current_locals_frame) = _sclf; \
thread_local(current_scan_frame) = _scsf; \
thread_local(current_frame) = _scf;
/* general utilities */
ScripterExport TCHAR* save_string(TCHAR* str);
TCHAR wputch(HWND w, TCHAR* buf, TCHAR* bufp, const TCHAR c); /* edit window output... */
TCHAR* wputs(HWND w, TCHAR* buf, TCHAR* bufp, const TCHAR *str);
int wprintf(HWND w, TCHAR* buf, TCHAR* bufp, const TCHAR *format, ...);
void wflush(HWND w, TCHAR* buf, TCHAR* bufp);
#define mputs thread_local(current_stdout)->puts /* current MAXScript stdout output... */
#define mprintf thread_local(current_stdout)->printf
#define mflush thread_local(current_stdout)->flush
extern TCHAR *GetString(int id);
class Rollout;
class HashTable;
ScripterExport void install_utility_page(Rollout* rollout);
class Value;
typedef Value* (Value::*value_vf)(Value**, int);
typedef Value* (*value_cf)(Value**, int);
typedef Value* (Value::*getter_vf)(Value**, int);
typedef Value* (Value::*setter_vf)(Value**, int);
typedef Value* (*max_getter_cf)(ReferenceTarget*, Value*, TimeValue, Interval&);
typedef void (*max_setter_cf)(ReferenceTarget*, Value*, TimeValue, Value*);
/* MAXScript signal flags */
#define INTERRUPT_EVAL 0x0001
#define EXIT_LISTENER 0x0002
extern ScripterExport Interface* MAXScript_interface;
extern ScripterExport int MAXScript_signals;
extern ScripterExport BOOL check_maxscript_interrupt;
extern ScripterExport void escape_checker();
extern ScripterExport BOOL MAXScript_detaching;
extern ScripterExport int mxs_rand();
extern ScripterExport void mxs_seed(int);
extern ScripterExport void dlx_detaching(HINSTANCE hinstance);
extern ScripterExport void define_system_global(TCHAR* name, Value* (*getter)(), Value* (*setter)(Value*));
// LAM 4/1/00 - added following to be able to overwrite existing global value in hash table.
extern ScripterExport void define_system_global_replace(TCHAR* name, Value* (*getter)(), Value* (*setter)(Value*));
extern ScripterExport void define_struct_global(TCHAR* name, TCHAR* struct_name, Value* (*getter)(), Value* (*setter)(Value*));
extern ScripterExport HashTable* english_to_local;
extern ScripterExport HashTable* local_to_english;
extern ScripterExport BOOL non_english_numerics;
extern ScripterExport void printable_name(TSTR& name);
extern ScripterExport void show_source_pos();
extern ScripterExport void show_listener();
extern ScripterExport void init_MAXScript();
extern ScripterExport BOOL MAXScript_running;
extern ScripterExport HWND main_thread_window;
extern ScripterExport BOOL progress_bar_up;
extern ScripterExport BOOL trace_back_active;
extern ScripterExport BOOL disable_trace_back;
typedef void (*utility_installer)(Rollout* ro);
extern ScripterExport void set_utility_installer(utility_installer ui);
extern ScripterExport void reset_utility_installer();
extern ScripterExport void error_message_box(MAXScriptException& e, TCHAR* caption);
typedef Value* (*autocad_point_reader)(TCHAR* str);
extern ScripterExport void set_autocad_point_reader(autocad_point_reader apr);
#define check_interrupts() if (check_maxscript_interrupt) escape_checker(); if (MAXScript_signals) throw SignalException()
#define type_check(val, cl, where) if (val->tag != class_tag(cl)) throw TypeError (where, val, &cl##_class);
// macros for setting numeric printing to English locale and back again - all numeric output in MAXScript is English
#define set_english_numerics() \
TCHAR* locale; \
TCHAR slocale[256]; \
if (non_english_numerics != NULL) \
{ \
locale = setlocale(LC_NUMERIC, NULL); \
_tcsncpy(slocale, locale, sizeof(slocale)); \
setlocale(LC_NUMERIC, "C"); \
}
#define reset_numerics() \
if (non_english_numerics != NULL) \
setlocale(LC_NUMERIC, slocale);
#include "Excepts.h"
#include "iFnPub.h"
#include "Value.h"
#include "Streams.h"
#include "SceneIO.h"
#include "IParamm2.h"
class HashTable;
class Listener;
extern ScripterExport HashTable* globals;
extern ScripterExport HashTable* persistents;
extern ScripterExport Listener* the_listener;
extern ScripterExport HWND the_listener_window;
extern HINSTANCE hInstance;
extern ScripterExport void listener_message(UINT iMsg, WPARAM wParam, LPARAM lParam, BOOL block_flag);
inline int _count_with_keys(Value** arg_list, int count)
{
// compute # args before any key-args
for (int i = 0; i < count; i++)
if (arg_list[i] == (Value*)&keyarg_marker)
return i;
return count;
}
#endif
@@ -0,0 +1,193 @@
/*
* MeshSub.h - edit mesh sub-object classes & functions
* also includes MeshDelta and MNMesh scripter classes
*
* exposes the new-with-R3 MeshDelta, MapDelta & MeshSel tools for
* working with meshes. Also provides access to MNMesh tools and
* mesh sub-objects as direct properties on nodes.
*
* Copyright © Autodesk, Inc., 1998
* John Wainwright
*/
#ifndef _H_MESHSUB
#define _H_MESHSUB
// mesh selection types
#define MSEL_ALL 1 // whole mesh selected
#define MSEL_CUR 2 // current selection
#define MSEL_EXP 3 // explicit selection (in vsel)
#define MSEL_SINGLE 4 // explicit single index
#define MSEL_NAMED 5 // named selection set - name in nss_name
/* -------------- base class for mesh sub-object selections ------------------- */
class MeshSelection : public Value
{
public:
MAXWrapper* owner; // owner node or modifier if any
BYTE sel_type; // selection type
BitArray vsel; // stand-alone selection if any
DWORD index; // single vert index
TSTR nss_name; // name of named selection set
void gc_trace();
virtual MeshSelection* new_sel(MAXWrapper* own, BYTE stype, DWORD indx = 0) = 0;
// utility functions to be specialized
virtual BitArray get_sel() = 0; // my element selection
virtual BitArray get_owner_sel() = 0; // get owner's element selection
virtual void set_owner_sel(BitArray &sel) = 0; // set owner's element selection
virtual BitArray get_sel_vertices(Mesh* m) = 0; // vertexes involved in my element selection
virtual BitArray get_sel_vertices(MNMesh* m) = 0; // vertexes involved in my element selection
virtual BitArray get_sel_vertices(PatchMesh* m) = 0; // vertexes involved in my element selection
virtual GenericNamedSelSetList& get_named_sel_set_list() = 0;
virtual int num_elements(Mesh* m) = 0;
virtual int num_elements(MNMesh* m) = 0;
virtual int num_elements(PatchMesh* m) = 0;
virtual BOOL is_same_selection(Value* s) = 0;
virtual void delete_sel(Mesh& m, MeshDelta& md, BitArray &sel) = 0;
virtual void delete_sel(MNMesh* m, ReferenceTarget* owner, BitArray &sel) = 0;
// utility functions
DWORD get_sel_index(BitArray &vs, int n); // index for n'th item vertex in BitArray
void update_sel();
void set_sel(BitArray &vs);
void sprin1(TCHAR* type, CharStream* s);
// operations
#include "defimpfn.h"
# include "arraypro.h"
def_generic ( move, "move");
def_generic ( scale, "scale");
def_generic ( rotate, "rotate");
def_generic ( delete, "delete");
def_generic ( select, "select");
def_generic ( deselect, "deselect");
def_generic ( selectmore, "selectMore");
use_generic ( coerce, "coerce");
ScripterExport Value* map(node_map& m);
void to_fpvalue(FPValue& v);
ScripterExport Value* to_bitarrayValue();
// built-in property accessors
def_property ( count );
def_property ( index );
def_property ( selSetNames );
};
/* ---------------- mesh vertex selection --------------------- */
visible_class (VertSelectionValue)
class VertSelectionValue : public MeshSelection
{
public:
ScripterExport VertSelectionValue(MAXWrapper* own, BYTE stype, DWORD indx = 0);
MeshSelection* new_sel(MAXWrapper* own, BYTE stype, DWORD indx = 0);
classof_methods (VertSelectionValue, Value);
# define is_vertselection(v) ((v)->tag == class_tag(VertSelectionValue))
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
// specialized utility functions
BitArray get_sel();
BitArray get_owner_sel() { return (owner == NULL) ? BitArray() : owner->get_vertsel(); }
void set_owner_sel(BitArray &sel) {if (owner != NULL) owner->set_vertsel(sel); }
BitArray get_sel_vertices(Mesh* m);
BitArray get_sel_vertices(MNMesh* m);
BitArray get_sel_vertices(PatchMesh* m);
GenericNamedSelSetList& get_named_sel_set_list() { return owner->get_named_vertsel_set(); }
int num_elements(Mesh* m) { return m->getNumVerts(); }
int num_elements(MNMesh* m) { return m->VNum(); }
int num_elements(PatchMesh* m) { return m->getNumVerts(); }
BOOL is_same_selection(Value* s) { return is_vertselection(s); }
void delete_sel(Mesh& m, MeshDelta& md, BitArray &sel) { md.DeleteVertSet(m, sel); }
void delete_sel(MNMesh* m, ReferenceTarget* owner, BitArray &sel);
// operations
def_generic ( put, "put");
// built-in property accessors
def_property ( pos );
};
/* ---------------- mesh face selection --------------------- */
visible_class (FaceSelectionValue)
class FaceSelectionValue : public MeshSelection
{
public:
ScripterExport FaceSelectionValue(MAXWrapper* own, BYTE stype, DWORD indx = 0);
MeshSelection* new_sel(MAXWrapper* own, BYTE stype, DWORD indx = 0);
classof_methods (FaceSelectionValue, Value);
# define is_faceselection(v) ((v)->tag == class_tag(FaceSelectionValue))
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
// specialized utility functions
BitArray get_sel();
BitArray get_owner_sel() { return (owner == NULL) ? BitArray() : owner->get_facesel(); }
void set_owner_sel(BitArray &sel) {if (owner != NULL) owner->set_facesel(sel); }
BitArray get_sel_vertices(Mesh* m);
BitArray get_sel_vertices(MNMesh* m);
BitArray get_sel_vertices(PatchMesh* m);
GenericNamedSelSetList& get_named_sel_set_list() { return owner->get_named_facesel_set(); }
int num_elements(Mesh* m) { return m->getNumFaces(); }
int num_elements(MNMesh* m) { return m->FNum(); }
int num_elements(PatchMesh* m) { return m->getNumPatches(); }
BOOL is_same_selection(Value* s) { return is_faceselection(s); }
void delete_sel(Mesh& m, MeshDelta& md, BitArray &sel) { md.DeleteFaceSet(m, sel); }
void delete_sel(MNMesh* m, ReferenceTarget* owner, BitArray &sel);
// operations
def_generic ( put, "put");
// built-in property accessors
};
/* ---------------- edge face selection --------------------- */
visible_class (EdgeSelectionValue)
class EdgeSelectionValue : public MeshSelection
{
public:
ScripterExport EdgeSelectionValue(MAXWrapper* own, BYTE stype, DWORD indx = 0);
MeshSelection* new_sel(MAXWrapper* own, BYTE stype, DWORD indx = 0);
classof_methods (EdgeSelectionValue, Value);
# define is_edgeselection(v) ((v)->tag == class_tag(EdgeSelectionValue))
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
// specialized utility functions
BitArray get_sel();
BitArray get_owner_sel() { return (owner == NULL) ? BitArray() : owner->get_edgesel(); }
void set_owner_sel(BitArray &sel) {if (owner != NULL) owner->set_edgesel(sel); }
BitArray get_sel_vertices(Mesh* m);
BitArray get_sel_vertices(MNMesh* m);
BitArray get_sel_vertices(PatchMesh* m);
GenericNamedSelSetList& get_named_sel_set_list() { return owner->get_named_edgesel_set(); }
int num_elements(Mesh* m) { return m->getNumFaces() * 3; }
int num_elements(MNMesh* m) { return m->ENum(); }
int num_elements(PatchMesh* m) { return m->getNumEdges(); }
BOOL is_same_selection(Value* s) { return is_edgeselection(s); }
void delete_sel(Mesh& m, MeshDelta& md, BitArray &sel) { md.DeleteEdgeSet(m, sel); }
void delete_sel(MNMesh* m, ReferenceTarget* owner, BitArray &sel);
// operations
// built-in property accessors
};
#endif
@@ -0,0 +1,96 @@
/*
* MouseTool.h - scriptable mouse CommandModes for MAX
*
* Copyright © Autodesk, Inc, 1998. John Wainwright.
*
*/
#ifndef _H_MOUSETOOL
#define _H_MOUSETOOL
class MouseTool;
class MSPlugin;
// tool context local indexes - MUST match order in Parser::tool_def()
enum { cl_viewPoint, cl_worldPoint, cl_worldDist, cl_worldAngle, cl_gridPoint, cl_gridDist, cl_gridAngle, cl_nodeTM, cl_shift, cl_ctrl, cl_alt, cl_lbutton, cl_mbutton, cl_rbutton, };
/* --------- MouseTool command mode & callback classes ------------- */
class MouseToolCallBack : public MouseCallBack
{
public:
MouseTool* tool;
IPoint2 last_mp;
Point3 last_wp;
Point3 last_cpp;
MouseToolCallBack() {}
int proc(HWND hwnd, int msg, int point, int flags, IPoint2 m);
int mouse_proc(ViewExp *vpt, int msg, int point, int flags, IPoint2 m, Matrix3& mat, BOOL createMouseCallback = FALSE);
void set_context_locals(ViewExp* vpx, int snap, int point, int flag, IPoint2 mp, Point3 cpp, Matrix3& mat);
void reset_context_locals();
};
#define MOUSE_TOOL_COMMAND 7364
#define CID_MOUSE_TOOL CID_USER + 45237
class MouseToolCommandMode : public CommandMode
{
public:
MouseToolCallBack proc;
BOOL active;
TCHAR* prompt;
int num_points;
int cmd_class;
int Class() { return cmd_class; }
int ID() { return CID_MOUSE_TOOL; }
MouseCallBack *MouseProc(int *points) { *points = num_points; return &proc; }
ChangeForegroundCallback *ChangeFGProc() { return NULL; }
BOOL ChangeFG(CommandMode *oldMode) { return FALSE; }
void EnterMode();
void ExitMode();
};
/* ------------- MouseTool MAXScript value class -------------- */
visible_class (MouseTool)
class MouseTool : public Value
{
public:
Value* name; // tool name
HashTable* local_scope; // local name space
Value** locals; // local var array
Value** local_inits; // " " " init vals
int local_count; // " " count
HashTable* handlers; // handler tables
short flags; // tool flags
int cmd_class; // command mode class
int num_points; // number of points
Value* prompt; // staus line prompt if non-null
BOOL init_values; // whether to init ctrl/local values on (re)open
BOOL end_tool_mode; // signals end of tool cmd mode
MouseToolCommandMode cmdmode; // my command mode
// command mode locals...
Value* result; // tool result
Value* snap_mode; // #2D or #3D or #none
MSPlugin* plugin; // current plugin under manip if non-NULL
MouseTool(short iflags);
void init(Value* name, int local_count, Value** inits, HashTable* local_scope, HashTable* handlers);
~MouseTool();
classof_methods (MouseTool, Value);
void collect() { delete this; }
void gc_trace();
ScripterExport void sprin1(CharStream* s);
BOOL call_event_handler(Value* handler, Value** arg_list, int count, BOOL enable_redraw = TRUE);
void init_locals();
virtual Value* get_property(Value** arg_list, int count);
virtual Value* set_property(Value** arg_list, int count);
};
#endif
@@ -0,0 +1,53 @@
/*
* Name.h - Name class for MAXScript
*
* Copyright © John Wainwright 1996
*
*/
#ifndef _H_NAME
#define _H_NAME
#include "HashTab.h"
visible_class (Name)
class Name : public Value
{
public:
TCHAR* string;
static HashTable* intern_table;
Name(TCHAR *init_string);
~Name() { if (string) free(string); }
# define is_name(o) ((o)->tag == class_tag(Name))
static void setup();
static ScripterExport Value* intern(TCHAR* str);
static ScripterExport Value* find_intern(TCHAR* str);
classof_methods (Name, Value);
ScripterExport void sprin1(CharStream* s);
void collect() { delete this; }
TCHAR* to_string() { return string; }
void to_fpvalue(FPValue& v) { v.s = to_string(); v.type = TYPE_NAME; }
#include "defimpfn.h"
use_generic( coerce, "coerce");
use_generic( gt, ">");
use_generic( lt, "<");
use_generic( ge, ">=");
use_generic( le, "<=");
// scene I/O
IOResult Save(ISave* isave);
static Value* Load(ILoad* iload, USHORT chunkID, ValueLoader* vload);
};
/* core interned names */
#include "defextfn.h"
# include "corename.h"
#endif
@@ -0,0 +1,70 @@
/*
* NamedSet.h - scripter access to named node selection sets
*
* John Wainwright
* Copyright © Autodesk, Inc. 1997
*
*/
#ifndef _H_NAMEDSET
#define _H_NAMEDSET
/* ---------------------- MAXNamedSetArray ----------------------- */
// provides array-like access to the table of named selection sets
visible_class (MAXNamedSetArray)
class MAXNamedSetArray : public Value, public Collection
{
public:
MAXNamedSetArray();
classof_methods (MAXNamedSetArray, Value);
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
// operations
ScripterExport Value* map(node_map& m);
#include "defimpfn.h"
# include "arraypro.h"
// built-in property accessors
def_property ( count );
};
/* ---------------------- MAXNamedSet ----------------------- */
visible_class (MAXNamedSet)
class MAXNamedSet : public Value, public Collection
{
public:
TSTR name;
MAXNamedSet(TCHAR* iname);
classof_methods (MAXNamedSet, Value);
BOOL _is_collection() { return 1; }
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
// operations
ScripterExport Value* map(node_map& m);
#include "defimpfn.h"
# include "arraypro.h"
// built-in property accessors
def_property ( count );
def_property ( center );
def_property ( min );
def_property ( max );
};
extern MAXNamedSetArray theNamedSetArray;
#endif
@@ -0,0 +1,115 @@
/* Numbers.h - the number family of classes - numbers for MAXScript
*
* Copyright (c) John Wainwright, 1996
*
*
*/
#ifndef _H_NUMBER
#define _H_NUMBER
#include "MSTime.h"
#define FLOAT_CACHE_SIZE 1024 // must be power of 2
#define INT_CACHE_SIZE 512 // " " "
#define LOW_INT_RANGE 100
class Float;
class Integer;
extern Float* float_cache[];
extern Integer* int_cache[];
visible_class (Number)
class Number : public Value
{
public:
# define is_number(o) ((o)->tag == class_tag(Float) || (o)->tag == class_tag(Integer))
classof_methods (Number, Value);
static Value* read(TCHAR* str, bool heapAlloc = false);
static void setup();
#include "defimpfn.h"
def_generic( coerce, "coerce");
def_generic( copy, "copy");
};
applyable_class (Float)
applyable_class (Integer) // forward decls for float class
#define is_integer(o) ((o)->tag == class_tag(Integer))
class Float : public Number
{
public:
float value;
ENABLE_STACK_ALLOCATE(Float);
Float() { }
ScripterExport Float(float init_val);
static ScripterExport Value* intern(float init_val) { return new Float (init_val); } // hey!! no longer interns, stack alloc'd instead
static ScripterExport Value* heap_intern(float init_val);
classof_methods (Float, Number);
# define is_float(o) ((o)->tag == class_tag(Float))
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
/* include all the protocol declarations */
#include "defimpfn.h"
# include "mathpro.h"
float to_float() { return value; }
int to_int() { return (int)value; }
TimeValue to_timevalue() { return (TimeValue)(value * GetTicksPerFrame()); } // numbers used as times are in frames
void to_fpvalue(FPValue& v) { v.f = to_float(); v.type = (ParamType2)TYPE_FLOAT; }
Value* widen_to(Value* arg, Value** arg_list);
BOOL comparable(Value* arg) { return (is_integer(arg) || is_float(arg) || is_time(arg)); }
// scene I/O
IOResult Save(ISave* isave);
static Value* Load(ILoad* iload, USHORT chunkID, ValueLoader* vload);
};
class Integer : public Number
{
public:
int value;
ENABLE_STACK_ALLOCATE(Integer);
Integer() { };
ScripterExport Integer(int init_val);
static ScripterExport Value* intern(int init_val) { return new Integer (init_val); } // hey!! no longer interns, stack alloc'd instead
static ScripterExport Value* heap_intern(int init_val);
classof_methods (Integer, Number);
# define is_int(o) ((o)->tag == class_tag(Integer))
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
/* include all the protocol declarations */
#include "defimpfn.h"
# include "mathpro.h"
float to_float() { return (float)value; }
int to_int() { return value; }
TimeValue to_timevalue() { return (TimeValue)(value * GetTicksPerFrame()); } // numbers used as times are in frames
void to_fpvalue(FPValue& v) { v.i = to_int(); v.type = (ParamType2)TYPE_INT; }
Value* widen_to(Value* arg, Value** arg_list);
BOOL comparable(Value* arg) { return (is_integer(arg) || is_float(arg) || is_time(arg)); }
// scene I/O
IOResult Save(ISave* isave);
static Value* Load(ILoad* iload, USHORT chunkID, ValueLoader* vload);
};
#endif
@@ -0,0 +1,73 @@
/*
* NurbsSub.h - Nurbs sub-object classes & functions
*
* mirrors the mesh sub-object selection classes for NURBS sub-objects.
*
* Copyright © Autodesk, Inc., 1998
* John Wainwright
*/
#ifndef _H_NURBSSUB
#define _H_NURBSSUB
// Nurbs selection types
#define NSEL_ALL 1 // whole Nurbs selected
#define NSEL_CUR 2 // current selection
#define NSEL_EXP 3 // explicit selection (in vsel)
#define NSEL_SINGLE 4 // explicit single index
/* -------------- base class for Nurbs sub-object selections ------------------- */
visible_class (NURBSSelection)
class NURBSSelection : public Value
{
public:
MAXNode* owner; // owner node if any
Object* obj; // NURBS base obj if any
NURBSSubObjectLevel level; // subobject level of this selection
BYTE sel_type; // selection type
BitArray vsel; // stand-alone selection if any or copy of current owner level selection
DWORD index; // single vert index
ScripterExport NURBSSelection(MAXNode* own, NURBSSubObjectLevel lvl, BYTE stype, DWORD indx = 0);
classof_methods (NURBSSelection, Value);
# define is_NURBSSelection(v) ((v)->tag == class_tag(NURBSSelection))
void collect() { delete this; }
void gc_trace();
ScripterExport void sprin1(CharStream* s);
// utility functions
BitArray* get_sel(); // my element selection
void get_owner_sel(BitArray& osel); // owner's element selection
int num_elements();
BOOL is_same_selection(Value* s) { return is_NURBSSelection(s) && ((NURBSSelection*)s)->level == level; }
void setup_xform(BitArray& os, BOOL& local_org, Matrix3& axis);
DWORD get_sel_index(BitArray* vs, int n); // index for n'th item vertex in BitArray
void update_sel();
void sprin1(TCHAR* type, CharStream* s);
// operations
#include "defimpfn.h"
# include "arraypro.h"
def_generic ( move, "move");
def_generic ( scale, "scale");
def_generic ( rotate, "rotate");
def_generic ( delete, "delete");
def_generic ( select, "select");
def_generic ( deselect, "deselect");
def_generic ( selectmore, "selectMore");
ScripterExport Value* map(node_map& m);
// built-in property accessors
def_property ( count );
def_property ( index );
def_property ( selSetNames );
def_property ( pos );
};
#endif
@@ -0,0 +1,119 @@
/*
* OLEAutomation.h - OLE Automation services for MAXScript
*
* Copyright © John Wainwright 1996
*
*/
#ifndef _H_MAX_OLE_AUTOMATION
#define _H_MAX_OLE_AUTOMATION
#include "Arrays.h"
#include "classIDs.h"
#include "Funcs.h"
/* error scodes */
#define MS_E_EXCEPTION MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x0200)
#define MS_E_ILLEGAL_RETURN_VALUE MS_E_EXCEPTION + 0x001
/* ------- the MAXScript OLE object class factory ---------- */
class MSClassFactory : public IClassFactory
{
public:
static IClassFactory* Create();
/* IUnknown methods */
STDMETHOD(QueryInterface)(REFIID iid, void** ppv);
STDMETHOD_(unsigned long, AddRef)(void);
STDMETHOD_(unsigned long, Release)(void);
/* IClassFactory methods */
STDMETHOD(CreateInstance)(IUnknown* pUnkOuter, REFIID iid, void** ppv);
STDMETHOD(LockServer)(BOOL fLock);
private:
MSClassFactory();
unsigned long m_refs;
};
/* ---------- the MAXScript OLE object class -------------- */
class MSOLEObject : public IDispatch
{
public:
static MSOLEObject* Create();
/* IUnknown methods */
STDMETHOD(QueryInterface)(REFIID riid, void** ppvObj);
STDMETHOD_(unsigned long, AddRef)(void);
STDMETHOD_(unsigned long, Release)(void);
/* IDispatch methods */
STDMETHOD(GetTypeInfoCount)(unsigned int* pcTypeInfo);
STDMETHOD(GetTypeInfo)(unsigned int iTypeInfo, LCID lcid, ITypeInfo** ppTypeInfo);
STDMETHOD(GetIDsOfNames)(REFIID riid, OLECHAR** rgszNames, unsigned int cNames, LCID lcid, DISPID* rgdispid);
STDMETHOD(Invoke)(DISPID dispidMember, REFIID riid, LCID lcid, unsigned short wFlags,
DISPPARAMS* pdispparams, VARIANT* pvarResult, EXCEPINFO* pexcepinfo, unsigned int* puArgErr);
/* MSOLEObject stuff */
unsigned long m_refs;
static Array* exposed_fns; // array of exposed MAXScript functions, DISPID is 1-based index in array
MSOLEObject();
static void install_fns(Array* fns);
};
/* ---------------- client-side classes -------------------- */
visible_class (OLEObject)
class OLEObject : public Value
{
public:
Value* progID; // user-supplied progID string
CLSID clsid; // CLSID of ActiveX object.
LPDISPATCH pdisp; // IDispatch of ActiveX object.
OLEObject(Value* progID, CLSID cslid, LPDISPATCH pdisp);
OLEObject(Value* progID, LPDISPATCH pdisp);
~OLEObject();
classof_methods (OLEObject, Value);
void collect() { delete this; }
void gc_trace();
ScripterExport void sprin1(CharStream* s);
Value* get_property(Value** arg_list, int count);
Value* set_property(Value** arg_list, int count);
Value* get_fn_property(Value* prop);
};
visible_class (OLEMethod)
class OLEMethod : public Function
{
public:
OLEObject* ole_obj; // my OLE object
DISPID dispid; // method dispatch ID
OLEMethod() { }
OLEMethod(TCHAR* name, OLEObject* ole_obj, DISPID mth_id);
classof_methods (OLEMethod, Function);
void collect() { delete this; }
void gc_trace();
Value* apply(Value** arglist, int count, CallContext* cc=NULL);
};
BOOL init_MAXScript_OLE();
void uninit_OLE();
#define UNUSED(X) (X)
#endif
@@ -0,0 +1,87 @@
/*
* ObjectSets.h - ObjectSet classes for MAXScript
*
* Copyright © John Wainwright 1996
*
*/
#ifndef _H_OBJECTSET
#define _H_OBJECTSET
#include "Collect.h"
visible_class (Set)
class Set : public Value, public Collection
{
public:
classof_methods (Set, Value);
BOOL _is_collection() { return 1; }
#include "defimpfn.h"
def_generic (coerce, "coerce");
};
#include "PathName.h"
visible_class_s (ObjectSet, Set)
class ObjectSet : public Set
{
protected:
ObjectSet() { }
public:
TCHAR* set_name;
BOOL (*selector)(INode* node, int level, void* arg); // set selector function
void* selector_arg; // selector fn argument
ObjectSet(TCHAR* name, SClass_ID class_id);
ObjectSet(TCHAR* init_name, BOOL (*sel_fn)(INode*, int, void*), void* init_arg = NULL);
void init(TCHAR* name);
classof_methods (ObjectSet, Set);
static void setup();
TCHAR* name() { return set_name; }
void collect() { delete this; }
void sprin1(CharStream* s) { s->printf(_T("$%s"), set_name); }
void export_to_scripter();
ScripterExport Value* map(node_map& m);
ScripterExport Value* map_path(PathName* path, node_map& m);
ScripterExport Value* find_first(BOOL (*test_fn)(INode* node, int level, void* arg), void* test_arg);
ScripterExport Value* get_path(PathName* path);
#include "defimpfn.h"
def_generic (get, "get"); // indexed get (no put or append)
def_property ( count );
def_property ( center );
def_property ( min );
def_property ( max );
};
class CurSelObjectSet : public ObjectSet
{
public:
CurSelObjectSet(TCHAR* name);
void collect() { delete this; }
ScripterExport Value* map(node_map& m);
#include "defimpfn.h"
def_generic (get, "get"); // indexed get (no put or append)
def_generic (coerce, "coerce");
def_property ( count );
};
extern ObjectSet all_objects;
extern ObjectSet all_geometry;
extern ObjectSet all_lights;
extern ObjectSet all_cameras;
extern ObjectSet all_helpers;
extern ObjectSet all_shapes;
extern ObjectSet all_systems;
extern ObjectSet all_spacewarps;
extern CurSelObjectSet current_selection;
#endif
@@ -0,0 +1,228 @@
/*
* Parser.h - a compiler for the 3DS MAX MAXScript scripting language
*
* Copyright © John Wainwright 1996
*
*/
#ifndef _H_PARSER
#define _H_PARSER
#include "Strings.h"
#include "HashTab.h"
#include "Name.h"
#include "Rollouts.h"
#include "imacroscript.h"
#define MAX_TOKEN_SIZE 256
#define UNDEFINED_MACRO -1
extern ScripterExport HashTable* globals;
class MSPluginClass;
class CodeBlock;
class MouseTool;
class RCMenu;
class IVisualMSForm;
class MSCustAttribDef;
/* tokens ... */
enum lex_token
{
t_local, t_global, t_fn, t_mapped,
t_if, t_then, t_else, t_do, t_collect, t_while, t_case,
t_open_paren, t_close_paren, t_plus, t_times, t_minus, t_div, t_power, t_end,
t_pluseq, t_minuseq, t_timeseq, t_diveq,
t_and, t_or, t_not,
t_number, t_string, t_assign, t_semicolon, t_bad,
t_badNum, t_eol, t_comma, t_open_bracket, t_close_bracket, t_colon,
t_quote, t_doubleQuote, t_ampersand, t_name, t_dot, t_name_literal,
t_openCurly, t_closeCurly, t_hash, t_eq, t_ne, t_lt, t_gt,
t_ge, t_le, t_for, t_in, t_from, t_to, t_by, t_of, t_where,
t_as, t_parameter_keyword, t_path_name,
t_query, t_slash, t_ellipsis, t_level_name, t_wild_card_name,
t_dot_dot, t_end_of_path,
t_with, t_animate, t_coordsys, t_set, t_undo,
t_about, t_at, t_on, t_off,
t_max, t_nullary_call, t_utility, t_rollout,
t_return, t_exit, t_when, t_continue,
t_struct, t_try, t_catch, t_throw, t_eos,
t_plugin, t_tool, t_persistent, t_parameters, t_rcmenu,
t_macroScript, t_dropScript, t_attributes,
t_missing // always last
};
typedef RolloutControl* (*create_fn)(Value* name, Value* caption, Value** keyparms, int keyparm_count);
typedef struct
{
Value* name;
create_fn creator;
} rollout_control;
extern ScripterExport void install_rollout_control(Value* name, create_fn creator);
class Parser : public Value
{
public:
ScripterExport Parser();
ScripterExport Parser(CharStream* errout);
ScripterExport Parser(HashTable* scope);
ScripterExport Parser(CharStream* errout, HashTable* scope);
void init();
ScripterExport Value* compile(CharStream* stream);
ScripterExport Value* compile_factor(CharStream* stream);
ScripterExport Value* compile_all(CharStream* stream);
static void setup();
static Tab<rollout_control> rollout_controls;
static TCHAR *token_names[];
void collect() { delete this; }
void gc_trace();
CharStream* source; // input stream
lex_token token; // parser's current lexical token
Value* token_value; // and value
BOOL at_EOL; // positioned at \r
BOOL back_tracked; // we back-tracked
BOOL EOL_at_back_track; // remember EOL state at back_track
BOOL quoted_level_name; // if path level name was quote
BOOL spaced; // if space after token
BOOL space_before; // if '-' had a space before
BOOL space_after; // if '-' had a space after
BOOL throws_ok; // indicates if empty throws are OK (only in catches)
BOOL in_rollout; // compiling rollout, no new locals by default
BOOL in_macroscript; // compiling macroscript, disallow macroscript nesting
HashTable* current_scope; // current lexical scope hashtable
int parm_count; // current function def params
int keyparm_count; // " " " keyword parms
int local_count; // " " " locals
int frame_index; // running fn frame index for locals,args
int frame_level; // running frame level
int expr_level; // running nested expression level
CharStream* stdout_stream; // message & debug output stream (usually listener's window)
Value* lookahead_factor; // store for factor lookahead
TCHAR line_buf[256]; // current line capture for error printing
TCHAR* line_buf_p; // " " " pointer
CharStream* source_capture; // non-null, capture source to this stream
int ungetch_count;
Tab<CharStream*> src_stack; // include source stack
BOOL no_free_refs; // if on, disallow free refs
int tok_start; // store stream seek pos of token start
int last_tok_end; // store stream seek pos of end of last token
CodeBlock* code_block; // top-level code block if any
int code_block_level; // expr level for code block, used to provide context for 'on handler' parsing
bool dotted_names_ok; // allows '.' as part of a name (for event handler name parsing)
bool ignore_string_escapes; // ignores '\' escapes in string literals
bool mzp_names; // used by .mzp parser, allows . \ $ * in names
int current_y, bottom_y, group_num; // used by VMS form editor construction code
Value* single_expr(Value* stream);
Value* single_factor(Value* stream);
Value* compound_expr(Value* stream);
Value* compile_macro_script(Value* stream, MacroID id);
bool parse_rollout_for_edit(CharStream* source_stream, IVisualMSForm* form, Value* filename=NULL);
Value* compile_attributes(MSCustAttribDef* cad, CharStream* stream, Class_ID* attribID = NULL);
/* lexical analysis methods */
int token_must_be(lex_token wanted_token);
int next_token_must_be(lex_token wanted_token);
int next_token_must_be_name(Value* wanted_name);
void back_track(void);
void back_track_factor(Value* fac);
int white_space(TCHAR& c);
void check_for_EOL(TCHAR c);
void flush_EO_expr(void);
void reset();
TCHAR get_char();
void unget_char(TCHAR c);
void flush_to_eobuf();
Value* get_string(TCHAR delim);
Value* get_path_name();
Value* get_name_thunk(Value* name, BOOL make_new);
lex_token get_punct(TCHAR c);
lex_token get_token(void);
lex_token get_path_token(void);
int get_max_command(Value*& code);
void add_event_handler(HashTable* handlers, BOOL item_based = TRUE, IVisualMSForm* form = NULL);
void add_tool_local(TCHAR* var, MouseTool* tool, int& local_count, Value**& local_inits);
void add_plugin_local(TCHAR* var, MSPluginClass* plugin, int& local_count, Value**& local_inits, BOOL constant = FALSE);
Value** add_rollout_control(Value** controls, int control_index, Rollout* rollout, IVisualMSForm* form = NULL);
Value** add_rcmenu_item(Value** items, int& item_count, RCMenu* menu, BOOL subMenu = FALSE);
void open_include_file(TCHAR c);
void check_for_const_lvalue(Value*& lval);
Value* optimize_return(Value* expr);
/* recursive descent parse methods */
Value* expr_seq(lex_token delimiter);
Value* vector_literal();
Value* index_or_vector();
Value* hash_literals();
Value* array_literal();
Value* bit_array_literal();
Value* factor();
// Value* property_access();
// Value* array_index();
Value* property_index_array();
Value* coercion();
Value* deref_expr();
Value* function_call();
Value* power_expr();
Value* uminus_expr();
Value* term();
Value* plus_expr();
Value* compare_expr();
Value* not_expr();
Value* and_expr();
Value* simple_expr();
Value* variable_declaration();
Value* context_expr();
Value* change_handler();
Value* function(TCHAR* name, short flags = 0);
Value* function_def();
Value* mapped_fn_def();
Value* max_command();
Value* handler_def();
Value* struct_body(Value* name);
Value* struct_def();
Value* try_catch();
Value* tool_body(Value* name);
Value* tool_def();
Value* rcmenu_body(Value* name);
Value* rcmenu_def();
void plugin_paramblock(MSPluginClass* plugin, Array* pblock_defs, HashTable* handlers, int base_refno);
Value* plugin_def();
Value* attributes_body(MSCustAttribDef* cad);
Value* attributes_def(MSCustAttribDef* cad = NULL, Class_ID* attribID = NULL);
Value* macro_script(MacroID mid = UNDEFINED_MACRO);
Value* rollout_body(Value* name, lex_token type = t_rollout, IVisualMSForm* form = NULL);
Value* utility_def();
Value* rollout_def();
Value* exit_expr();
Value* continue_expr();
Value* return_expr();
Value* for_expr();
Value* do_expr();
Value* while_expr();
Value* case_expr();
Value* if_expr();
Value* assign_expr();
Value* expr();
Value* top_level_expr();
};
typedef struct
{
TCHAR* name;
getter_vf getter;
setter_vf setter;
} property_accessors;
extern property_accessors* get_property_accessors(Value* prop);
extern TCHAR* command_name_from_code(int com);
#define token_name(tok) token_names[(int)tok]
#endif
@@ -0,0 +1,53 @@
/*
* PathName.h - PathName class for MAXScript
*
* Copyright © John Wainwright 1996
*
*/
#ifndef _H_PATHNAME
#define _H_PATHNAME
#include "Collect.h"
#include "Thunks.h"
#include "ObjSets.h"
enum path_flags { rooted_path = 1, wild_card_path = 2 };
visible_class (PathName)
class PathName : public Set
{
public:
int flags;
short n_levels;
TCHAR** path_levels;
Thunk* root_set_thunk;
Value* root_set;
PathName();
~PathName();
classof_methods (PathName, Set);
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
ScripterExport Value* eval();
void append(TCHAR* level_name);
Value* find_object(TCHAR* name);
Value* get_object();
ScripterExport Value* map(node_map& m);
#include "defimpfn.h"
def_generic (get, "get"); // indexed get (no put or append)
def_property ( count );
def_property ( center );
def_property ( min );
def_property ( max );
};
extern TCHAR* ellipsis_level_name;
extern TCHAR* parent_level_name;
#endif
@@ -0,0 +1,92 @@
/*
* Pipe.h - NT TCHAR Pipe wrapper for MAXScript
*
* Copyright © John Wainwright 1996
*
*/
#ifndef _H_PIPE
#define _H_PIPE
#include "Strings.h"
class FileStream;
#define PIPE_BUF_SIZE 512
// The undelivered data in the pipe is held in a linked list of
// buffers, pointed into by read and write cursors.
// A side list is kept if writers supply info about sourcing files.
// This is provided to readers like the compiler to add source
// tags to generated code.
typedef struct src_info src_info;
struct src_info
{
src_info* next; // next marker
TCHAR* start; // source start character in buffer chain
Value* file; // sourcing file name if any
int offset; // starting offset into source
};
class Pipe : public CharStream
{
public:
TCHAR* write_buffer; // pipe buffers & cursors
TCHAR* write_cursor;
TCHAR* read_buffer;
TCHAR* read_cursor;
int ungetch_count;
CRITICAL_SECTION pipe_update; // for syncing pipe updates
HANDLE pipe_event; // for signalling data ready
HANDLE restart_event; // used to restart a stopped pipe
BOOL waiting; // reader is waiting for data
BOOL stopped; // pipe reading is blocked
FileStream* log; // log stream if non-NULL
Value* read_source_file; // sourcing file for reading if supplied by writer
int read_source_offset; // running reader offset in source
src_info* markers; // marker list...
src_info* marker_tail;
TCHAR* next_source_start; // upcoming marker starting character
Value* write_source_file; // current write source file, used to determine source change
int write_source_offset;// running writer offset
Pipe();
~Pipe();
# define is_pipe(o) ((o)->tag == INTERNAL_PIPE_TAG)
void collect() { delete this; }
void gc_trace();
TCHAR get_char();
void unget_char(TCHAR c);
TCHAR peek_char();
int at_eos();
int pos() { return read_source_offset; }
void rewind();
void flush_to_eol();
void flush_to_eobuf();
void put_char(TCHAR c, Value* source_file = NULL, int offset = 0);
void put_str(TCHAR* str, Value* source_file = NULL, int offset = 0);
void put_buf(TCHAR* str, size_t count, Value* source_file = NULL, int offset = 0);
void new_write_buffer();
void check_write_source_change(Value* file, int offset, int new_len);
void read_source_change();
void clear_source();
void stop();
void go();
TCHAR* puts(TCHAR* str);
int printf(const TCHAR *format, ...);
void log_to(FileStream* log);
void close_log();
CharStream* get_log() { return log; }
Value* get_file_name();
};
#endif
@@ -0,0 +1,908 @@
/*
* Rollouts.h - Rollout panel classes & functions for MAXScript
*
* Copyright © John Wainwright 1996
*
*/
#ifndef _H_ROLLOUTS
#define _H_ROLLOUTS
#include "Arrays.h"
typedef struct // rollout control layout data
{
int left;
int top;
int width;
int height;
int columns;
} layout_data;
/* some layout constants (in pixels) ... */
#define TOP_MARGIN 2
#define SIDE_MARGIN 4
#define RADIO_DOT_WIDTH 23
#define CHECK_BOX_WIDTH 24
#define LEFT_ALIGN 13
#define RIGHT_ALIGN 13
#define GROUP_BOX_Y_MARGIN 6
#define GROUP_BOX_X_MARGIN 4
#define SPACING_BEFORE 5
/* ---------------------- Rollout class ----------------------- */
/* contains the defintion of rollout panel. This includes:
* - an 'instance variable' array, these variables can be accessed as locals in rollout handlers
* - a control array, containing rolout control instances
* - a hashtable of event handler functions
* there are associated Thunks for the locals & controls so you can ref them as variables in
* handlers
*/
class RolloutControl;
class RolloutFloater;
class MSPlugin;
class RolloutChangeCallback;
class PB2Param;
visible_class (Rollout)
class Rollout : public Value
{
public:
Value* name; // rollout's variable name
Value* title; // title factor
HashTable* local_scope; // local name space
Value** locals; // local var array
Value** local_inits; // " " " init vals
int local_count; // " " count
RolloutControl** controls; // control array
int control_count; // " " count
HashTable* handlers; // handler tables
short flags; // rollout flags
short order; // rollout open order no.
Interface* ip; // Interface pointer
HWND page; // my dialog HWND when visible
HDC rollout_dc; // my dialog dev. context
HFONT font; // dialog's default font
int text_height; // metrics....
int default_control_leading;
int rollout_width;
int rollout_height;
int rollout_category;
int current_width; // used for across: processing...
int current_left;
int max_y, last_y;
int across_count;
WORD close_button_ID; // id of gen'd close button
BOOL selected; // selected to be open
BOOL disabled; // error in handler -> ro disabled
CharStream* source; // source text if available
BOOL init_values; // whether to init ctrl/local values on (re)open
MSPlugin* plugin; // plugin I'm open on if non-NULL
RolloutChangeCallback* tcb; // timechange callback if rollout has controller-linked spinners
IMtlParams* imp; // MtlEditor interface if open in Mtl Editor and other stuff...
TexDADMgr* texDadMgr;
MtlDADMgr* mtlDadMgr;
HWND hwMtlEdit;
RolloutFloater* rof; // owning rolloutfloater window if present there
WORD next_id; // dialog item ID allocators
Tab<RolloutControl*> id_map; // dialog item ID map for taking item ID's to associated RolloutControl
Rollout(short iflags);
void init(Value* name, Value* title, int local_count, Value** inits, HashTable* local_scope, RolloutControl** controls, int control_count, HashTable* handlers, CharStream* source);
~Rollout();
classof_methods (Rollout, Value);
void collect() { delete this; }
void gc_trace();
ScripterExport void sprin1(CharStream* s);
ScripterExport BOOL add_page(Interface *ip, HINSTANCE hInstance, int ro_flags = 0, RolloutFloater* rof = NULL);
ScripterExport void delete_page(Interface *ip, RolloutFloater* rof = NULL);
void open(Interface *ip, BOOL rolled_up = FALSE);
ScripterExport void close(Interface *ip, RolloutFloater* rof = NULL);
ScripterExport BOOL ok_to_close(RolloutFloater* rof = NULL);
ScripterExport void run_event_handler(Value* event, Value** arg_list, int count);
Value* call_event_handler(Value* event, Value** arg_list, int count);
void add_close_button(HINSTANCE hInstance, int& current_y);
void edit_script();
void TimeChanged(TimeValue t);
// various open/close for scripted plug-in rollouts
// command panel
void BeginEditParams(IObjParam* ip, MSPlugin* plugin, ULONG flags, Animatable *prev);
void EndEditParams(IObjParam* ip, MSPlugin* plugin, ULONG flags, Animatable *next);
// mtl editor
void CreateParamDlg(HWND hwMtlEdit, IMtlParams* imp, MSPlugin* plugin, TexDADMgr* texDadMgr, MtlDADMgr* mtlDadMgr);
void SetThing(MSPlugin* plugin);
void ReloadDialog();
void SetTime(TimeValue t);
void DeleteThis();
// update/reload
void InvalidateUI();
void InvalidateUI(ParamID id, int tabIndex=-1); // nominated param
virtual Value* get_property(Value** arg_list, int count);
virtual Value* set_property(Value** arg_list, int count);
};
#define RO_NO_CLOSEBUTTON 0x0001
#define RO_HIDDEN 0x0002
#define RO_ROLLED_UP 0x0004
#define RO_IN_FLOATER 0x0008
#define RO_INSTALLED 0x0010
#define RO_UTIL_MASTER 0x0020
#define RO_SILENT_ERRORS 0x0040
/* --------------------- RolloutFloater class ------------------------ */
visible_class (RolloutFloater)
class RolloutFloater : public Value
{
public:
HWND window; // modeless dialog window
HWND ru_window; // host rollup winddow cust control
IRollupWindow* irw;
Tab<Rollout*> rollouts; // my rollouts
int width, height; // window size...
int left, top;
bool inDelete;
RolloutFloater(TCHAR* title, int left, int top, int width, int height);
~RolloutFloater();
classof_methods (RolloutFloater, Value);
void collect() { delete this; }
void add_rollout(Rollout* ro, BOOL rolledUp);
void remove_rollout(Rollout* ro);
Value* get_property(Value** arg_list, int count);
Value* set_property(Value** arg_list, int count);
};
/* -------------------- RolloutControl classes ----------------------- */
/* represent controls such as buttons & spinners on rollout panels, RolloutControl is abstract
* root of all controls */
visible_class (RolloutControl)
class RolloutControl : public Value, public ReferenceMaker
{
public:
Value* name;
Value* caption;
Value* init_caption;
BOOL enabled;
Value** keyparms;
int keyparm_count;
Rollout* parent_rollout;
WORD control_ID;
Control* controller; // optional linked animation controller
ParamDimension* dim; // controllers dimension
PB2Param* pid; // if non-NULL, indicates this control is associated with an MSPlugin parameter &
// points at ParamUIRep-like data for it
short flags;
ScripterExport RolloutControl();
ScripterExport RolloutControl(Value* name, Value* caption, Value** keyparms, int keyparm_count);
ScripterExport ~RolloutControl();
classof_methods (RolloutControl, Value);
BOOL _is_rolloutcontrol() { return 1; }
# define is_rolloutcontrol(o) ((o)->_is_rolloutcontrol())
void collect() { delete this; }
ScripterExport void gc_trace();
virtual ScripterExport void add_control(Rollout *ro, HWND parent, HINSTANCE hInstance, int& current_y);
virtual LPCTSTR get_control_class() = 0;
virtual DWORD get_control_style() { return WS_TABSTOP; }
virtual DWORD get_control_ex_style() { return 0; }
virtual void init_control(HWND control) { }
virtual void compute_layout(Rollout *ro, layout_data* pos) { }
virtual ScripterExport void compute_layout(Rollout *ro, layout_data* pos, int& current_y);
virtual ScripterExport void process_layout_params(Rollout *ro, layout_data* pos, int& current_y);
virtual ScripterExport void setup_layout(Rollout *ro, layout_data* pos, int& current_y);
virtual ScripterExport void process_common_params();
virtual ScripterExport void call_event_handler(Rollout *ro, Value* event, Value** arg_list, int count);
virtual ScripterExport void run_event_handler(Rollout *ro, Value* event, Value** arg_list, int count);
virtual BOOL handle_message(Rollout *ro, UINT message, WPARAM wParam, LPARAM lParam) { return FALSE; }
ScripterExport WORD next_id();
virtual ScripterExport Value* get_property(Value** arg_list, int count);
virtual ScripterExport Value* set_property(Value** arg_list, int count);
virtual ScripterExport void set_text(TCHAR* text, HWND ctl = NULL, Value* align = NULL);
virtual ScripterExport void set_enable();
virtual ScripterExport BOOL set_focus();
virtual ScripterExport int num_controls() { return 1; }
ScripterExport Value* get_event_handler(Value* event);
// ReferenceMaker
int NumRefs() { return (controller != NULL) ? 1 : 0; }
RefTargetHandle GetReference(int i) { return controller; }
void SetReference(int i, RefTargetHandle rtarg) { controller = (Control*)rtarg; }
ScripterExport RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message);
virtual void controller_changed() { }
virtual BOOL controller_ok(Control* c) { return FALSE; }
// PB2 UI update
ScripterExport IParamBlock2* get_pblock();
virtual void Reload() { }
virtual void InvalidateUI() { }
virtual void set_pb2_value() { }
virtual void get_pb2_value(BOOL load_UI=TRUE) { }
virtual void SetTexDADMgr(DADMgr* dad) { }
virtual int FindSubTexFromHWND(HWND hw) { return -1; }
virtual void SetMtlDADMgr(DADMgr* dad) { }
virtual int FindSubMtlFromHWND(HWND hw) { return -1; }
};
#define ROC_FIXED_WIDTH 0x0001 // a specific width: supplied, don't resize buttons on .text =
#define ROC_MAKING_EDIT 0x0002
extern LPCTSTR cust_button_class;
/* ------------- PB2Param class -------------------- */
// present in a UI control if rollout is part of a scripted plugin
// and this control is associated with a ParamBlock2 param
class PB2Param
{
public:
ParamID id; // pblock param ID
int index; // pblock direct index of param
int tabIndex; // element index if param is Tab<>
int block_id; // owning block's ID
int subobjno; // texmap or mtl param subobjno in the block
ParamDimension* dim;// parameter's dimension
ParamType2 type; // parameter's type
PB2Param(ParamDef& pd, int index, int block_id, int subobjno, int tabIndex = -1);
};
/* -------------------- LabelControl ------------------- */
visible_class (LabelControl)
class LabelControl : public RolloutControl
{
public:
LabelControl(Value* name, Value* caption, Value** keyparms, int keyparm_count)
: RolloutControl(name, caption, keyparms, keyparm_count) { tag = class_tag(LabelControl); }
static RolloutControl* create(Value* name, Value* caption, Value** keyparms, int keyparm_count)
{ return new LabelControl (name, caption, keyparms, keyparm_count); }
classof_methods (LabelControl, RolloutControl);
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s) { s->printf(_T("LabelControl:%s"), name->to_string()); }
LPCTSTR get_control_class() { return _T("STATIC"); }
DWORD get_control_style() { return 0; }
void compute_layout(Rollout *ro, layout_data* pos);
};
/* -------------------- ButtonControl ------------------- */
visible_class (ButtonControl)
class ButtonControl : public RolloutControl
{
public:
HIMAGELIST images;
int image_width, image_height;
int iOutEn, iInEn, iOutDis, iInDis;
ButtonControl(Value* name, Value* caption, Value** keyparms, int keyparm_count)
: RolloutControl(name, caption, keyparms, keyparm_count)
{
tag = class_tag(ButtonControl);
images = NULL;
}
~ButtonControl();
static RolloutControl* create(Value* name, Value* caption, Value** keyparms, int keyparm_count)
{ return new ButtonControl (name, caption, keyparms, keyparm_count); }
classof_methods (ButtonControl, RolloutControl);
void collect() { delete this; }
void sprin1(CharStream* s) { s->printf(_T("ButtonControl:%s"), name->to_string()); }
LPCTSTR get_control_class() { return cust_button_class; }
void init_control(HWND control);
void compute_layout(Rollout *ro, layout_data* pos);
BOOL handle_message(Rollout *ro, UINT message, WPARAM wParam, LPARAM lParam);
Value* get_property(Value** arg_list, int count);
Value* set_property(Value** arg_list, int count);
void set_enable();
};
/* -------------------- CheckButtonControl ------------------- */
visible_class (CheckButtonControl)
class CheckButtonControl : public RolloutControl
{
public:
BOOL checked;
HIMAGELIST images;
int image_width, image_height;
int iOutEn, iInEn, iOutDis, iInDis;
CheckButtonControl(Value* name, Value* caption, Value** keyparms, int keyparm_count)
: RolloutControl(name, caption, keyparms, keyparm_count)
{
tag = class_tag(CheckButtonControl);
images = NULL;
}
~CheckButtonControl();
static RolloutControl* create(Value* name, Value* caption, Value** keyparms, int keyparm_count)
{ return new CheckButtonControl (name, caption, keyparms, keyparm_count); }
classof_methods (CheckButtonControl, RolloutControl);
void collect() { delete this; }
void sprin1(CharStream* s) { s->printf(_T("CheckButtonControl:%s"), name->to_string()); }
LPCTSTR get_control_class() { return cust_button_class; }
void init_control(HWND control);
void compute_layout(Rollout *ro, layout_data* pos);
BOOL handle_message(Rollout *ro, UINT message, WPARAM wParam, LPARAM lParam);
Value* get_property(Value** arg_list, int count);
Value* set_property(Value** arg_list, int count);
void set_enable();
void Reload();
void InvalidateUI();
void set_pb2_value();
void get_pb2_value(BOOL load_UI=TRUE);
};
/* -------------------- EditTextControl ------------------- */
visible_class (EditTextControl)
class EditTextControl : public RolloutControl
{
public:
Value* text;
Value* bold;
bool in_setvalue;
EditTextControl(Value* name, Value* caption, Value** keyparms, int keyparm_count);
static RolloutControl* create(Value* name, Value* caption, Value** keyparms, int keyparm_count)
{ return new EditTextControl (name, caption, keyparms, keyparm_count); }
classof_methods (EditTextControl, RolloutControl);
void collect() { delete this; }
void sprin1(CharStream* s) { s->printf(_T("EditTextControl:%s"), name->to_string()); }
void gc_trace();
void add_control(Rollout *ro, HWND parent, HINSTANCE hInstance, int& current_y);
LPCTSTR get_control_class() { return CUSTEDITWINDOWCLASS; }
void compute_layout(Rollout *ro, layout_data* pos, int& current_y);
BOOL handle_message(Rollout *ro, UINT message, WPARAM wParam, LPARAM lParam);
Value* get_property(Value** arg_list, int count);
Value* set_property(Value** arg_list, int count);
void set_enable();
int num_controls() { return 2; }
void Reload();
void InvalidateUI();
void set_pb2_value();
void get_pb2_value(BOOL load_UI=TRUE);
};
/* -------------------- ComboBoxControl ------------------- */
visible_class (ComboBoxControl)
class ComboBoxControl : public RolloutControl
{
public:
Array* item_array;
int selection;
short type;
short flags;
ComboBoxControl(Value* name, Value* caption, Value** keyparms, int keyparm_count, int type = CBS_SIMPLE);
static RolloutControl* create_cb(Value* name, Value* caption, Value** keyparms, int keyparm_count)
{ return new ComboBoxControl (name, caption, keyparms, keyparm_count); }
static RolloutControl* create_dd(Value* name, Value* caption, Value** keyparms, int keyparm_count)
{ return new ComboBoxControl (name, caption, keyparms, keyparm_count, CBS_DROPDOWNLIST); }
classof_methods (ComboBoxControl, RolloutControl);
void collect() { delete this; }
void sprin1(CharStream* s) { s->printf(_T("ComboBoxControl:%s"), name->to_string()); }
void gc_trace();
void add_control(Rollout *ro, HWND parent, HINSTANCE hInstance, int& current_y);
LPCTSTR get_control_class() { return _T("COMBOBOX"); }
DWORD get_control_style() { return CBS_DROPDOWNLIST | CBS_NOINTEGRALHEIGHT | WS_TABSTOP; }
void compute_layout(Rollout *ro, layout_data* pos, int& current_y);
BOOL handle_message(Rollout *ro, UINT message, WPARAM wParam, LPARAM lParam);
Value* get_property(Value** arg_list, int count);
Value* set_property(Value** arg_list, int count);
void set_enable();
int num_controls() { return 2; }
void Reload();
void InvalidateUI();
void set_pb2_value();
void get_pb2_value(BOOL load_UI=TRUE);
};
#define CBF_EDIT_FIELD_CHANGING 0x0001
/* -------------------- ListBoxControl ------------------- */
visible_class (ListBoxControl)
class ListBoxControl : public RolloutControl
{
public:
Array* item_array;
int selection;
ListBoxControl(Value* name, Value* caption, Value** keyparms, int keyparm_count);
static RolloutControl* create(Value* name, Value* caption, Value** keyparms, int keyparm_count)
{ return new ListBoxControl (name, caption, keyparms, keyparm_count); }
classof_methods (ListBoxControl, RolloutControl);
void collect() { delete this; }
void sprin1(CharStream* s) { s->printf(_T("ListBoxControl:%s"), name->to_string()); }
void gc_trace();
void add_control(Rollout *ro, HWND parent, HINSTANCE hInstance, int& current_y);
LPCTSTR get_control_class() { return _T("LISTBOX"); }
DWORD get_control_style() { return WS_TABSTOP; }
void compute_layout(Rollout *ro, layout_data* pos, int& current_y);
BOOL handle_message(Rollout *ro, UINT message, WPARAM wParam, LPARAM lParam);
Value* get_property(Value** arg_list, int count);
Value* set_property(Value** arg_list, int count);
void set_enable();
int num_controls() { return 2; }
};
/* -------------------- SpinnerControl ------------------- */
visible_class (SpinnerControl)
class SpinnerControl : public RolloutControl
{
public:
float value;
float max, min;
float scale;
EditSpinnerType spin_type;
SpinnerControl(Value* name, Value* caption, Value** keyparms, int keyparm_count)
: RolloutControl(name, caption, keyparms, keyparm_count) { tag = class_tag(SpinnerControl); }
static RolloutControl* create(Value* name, Value* caption, Value** keyparms, int keyparm_count)
{ return new SpinnerControl (name, caption, keyparms, keyparm_count); }
classof_methods (SpinnerControl, RolloutControl);
void collect() { delete this; }
void sprin1(CharStream* s) { s->printf(_T("SpinnerControl:%s"), name->to_string()); }
void add_control(Rollout *ro, HWND parent, HINSTANCE hInstance, int& current_y);
LPCTSTR get_control_class() { return SPINNERWINDOWCLASS; }
void compute_layout(Rollout *ro, layout_data* pos, int& current_y);
BOOL handle_message(Rollout *ro, UINT message, WPARAM wParam, LPARAM lParam);
Value* get_property(Value** arg_list, int count);
Value* set_property(Value** arg_list, int count);
void set_enable();
BOOL set_focus();
int num_controls() { return 3; }
void controller_changed();
BOOL controller_ok(Control* c) { return c->SuperClassID() == CTRL_FLOAT_CLASS_ID; }
void Reload();
void InvalidateUI();
void set_pb2_value();
void get_pb2_value(BOOL load_UI=TRUE);
};
/* -------------------- SliderControl ------------------- */
visible_class (SliderControl)
class SliderControl : public RolloutControl
{
public:
float value;
float max, min;
int ticks;
int slider_type;
bool vertical;
bool sliding;
SliderControl(Value* name, Value* caption, Value** keyparms, int keyparm_count)
: RolloutControl(name, caption, keyparms, keyparm_count), sliding(false) { tag = class_tag(SliderControl); }
static RolloutControl* create(Value* name, Value* caption, Value** keyparms, int keyparm_count)
{ return new SliderControl (name, caption, keyparms, keyparm_count); }
classof_methods (SliderControl, RolloutControl);
void collect() { delete this; }
void sprin1(CharStream* s) { s->printf(_T("SliderControl:%s"), name->to_string()); }
void add_control(Rollout *ro, HWND parent, HINSTANCE hInstance, int& current_y);
LPCTSTR get_control_class() { return TRACKBAR_CLASS; }
void compute_layout(Rollout *ro, layout_data* pos, int& current_y);
BOOL handle_message(Rollout *ro, UINT message, WPARAM wParam, LPARAM lParam);
Value* get_property(Value** arg_list, int count);
Value* set_property(Value** arg_list, int count);
void set_enable();
int num_controls() { return 2; }
void Reload();
void InvalidateUI();
void set_pb2_value();
void get_pb2_value(BOOL load_UI=TRUE);
};
/* -------------------- PickerControl ------------------- */
class PickerControl;
class PickerControlFilter : public PickNodeCallback
{
public:
Value* filter_fn;
PickerControl* picker;
PickerControlFilter(Value* filter, PickerControl* picker) : filter_fn(filter), picker(picker) { }
BOOL Filter(INode *node);
};
class PickerControlMode : public PickModeCallback
{
public:
PickerControlFilter* pick_filter;
TCHAR* msg;
PickerControl* picker;
PickerControlMode(PickerControlFilter* ifilter, TCHAR* imsg, PickerControl* ipick);
BOOL HitTest(IObjParam *ip, HWND hWnd, ViewExp *vpt, IPoint2 m, int flags);
BOOL Pick(IObjParam *ip, ViewExp *vpt);
PickNodeCallback *GetFilter() { return pick_filter; }
BOOL RightClick(IObjParam *ip, ViewExp *vpt) { return TRUE; }
void EnterMode(IObjParam *ip);
void ExitMode(IObjParam *ip);
};
visible_class (PickerControl)
class PickerControl : public RolloutControl
{
public:
PickerControlFilter* pick_filter;
PickerControlMode* pick_mode;
ICustButton* cust_button;
Value* picked_object;
PickerControl(Value* name, Value* caption, Value** keyparms, int keyparm_count);
~PickerControl();
static RolloutControl* create(Value* name, Value* caption, Value** keyparms, int keyparm_count)
{ return new PickerControl (name, caption, keyparms, keyparm_count); }
classof_methods (PickerControl, RolloutControl);
void collect() { delete this; }
void gc_trace();
void sprin1(CharStream* s) { s->printf(_T("PickerControl:%s"), name->to_string()); }
LPCTSTR get_control_class() { return cust_button_class; }
void compute_layout(Rollout *ro, layout_data* pos);
void init_control(HWND control);
BOOL handle_message(Rollout *ro, UINT message, WPARAM wParam, LPARAM lParam);
Value* get_property(Value** arg_list, int count);
Value* set_property(Value** arg_list, int count);
void set_enable();
void Reload();
void InvalidateUI();
void set_pb2_value();
void get_pb2_value(BOOL load_UI=TRUE);
};
/* -------------------- ColorPickerControl ------------------- */
visible_class (ColorPickerControl)
class ColorPickerControl : public RolloutControl
{
public:
Value* color;
IColorSwatch* csw;
Value* title;
ColorPickerControl(Value* name, Value* caption, Value** keyparms, int keyparm_count);
~ColorPickerControl();
static RolloutControl* create(Value* name, Value* caption, Value** keyparms, int keyparm_count)
{ return new ColorPickerControl (name, caption, keyparms, keyparm_count); }
classof_methods (ColorPickerControl, RolloutControl);
void collect() { delete this; }
void gc_trace();
void sprin1(CharStream* s) { s->printf(_T("ColorPickerControl:%s"), name->to_string()); }
LPCTSTR get_control_class() { return COLORSWATCHWINDOWCLASS; }
void init_control(HWND control);
void add_control(Rollout *ro, HWND parent, HINSTANCE hInstance, int& current_y);
void compute_layout(Rollout *ro, layout_data* pos, int& current_y);
BOOL handle_message(Rollout *ro, UINT message, WPARAM wParam, LPARAM lParam);
Value* get_property(Value** arg_list, int count);
Value* set_property(Value** arg_list, int count);
void set_enable();
int num_controls() { return 2; }
void Reload();
void InvalidateUI();
void set_pb2_value();
void get_pb2_value(BOOL load_UI=TRUE);
};
/* -------------------- RadioControl ------------------- */
visible_class (RadioControl)
class RadioControl : public RolloutControl
{
public:
int state;
int btn_count;
RadioControl(Value* name, Value* caption, Value** keyparms, int keyparm_count)
: RolloutControl(name, caption, keyparms, keyparm_count) { tag = class_tag(RadioControl); }
static RolloutControl* create(Value* name, Value* caption, Value** keyparms, int keyparm_count)
{ return new RadioControl (name, caption, keyparms, keyparm_count); }
classof_methods (RadioControl, RolloutControl);
void collect() { delete this; }
void sprin1(CharStream* s) { s->printf(_T("RadioControl:%s"), name->to_string()); }
void add_control(Rollout *ro, HWND parent, HINSTANCE hInstance, int& current_y);
LPCTSTR get_control_class() { return _T("BUTTON"); }
DWORD get_control_style() { return BS_AUTORADIOBUTTON; }
void compute_layout(Rollout *ro, layout_data* pos, int& current_y);
BOOL handle_message(Rollout *ro, UINT message, WPARAM wParam, LPARAM lParam);
Value* get_property(Value** arg_list, int count);
Value* set_property(Value** arg_list, int count);
void set_enable();
BOOL set_focus();
int num_controls() { return btn_count + 1; }
void Reload();
void InvalidateUI();
void set_pb2_value();
void get_pb2_value(BOOL load_UI=TRUE);
};
/* -------------------- CheckBoxControl ------------------- */
visible_class (CheckBoxControl)
class CheckBoxControl : public RolloutControl
{
public:
BOOL checked;
CheckBoxControl(Value* name, Value* caption, Value** keyparms, int keyparm_count)
: RolloutControl(name, caption, keyparms, keyparm_count) { tag = class_tag(CheckBoxControl); }
static RolloutControl* create(Value* name, Value* caption, Value** keyparms, int keyparm_count)
{ return new CheckBoxControl (name, caption, keyparms, keyparm_count); }
classof_methods (CheckBoxControl, RolloutControl);
void collect() { delete this; }
void sprin1(CharStream* s) { s->printf(_T("CheckBoxControl:%s"), name->to_string()); }
LPCTSTR get_control_class() { return _T("BUTTON"); }
DWORD get_control_style() { return BS_AUTOCHECKBOX | WS_TABSTOP; }
void init_control(HWND control);
void compute_layout(Rollout *ro, layout_data* pos);
BOOL handle_message(Rollout *ro, UINT message, WPARAM wParam, LPARAM lParam);
Value* get_property(Value** arg_list, int count);
Value* set_property(Value** arg_list, int count);
void Reload();
void InvalidateUI();
void set_pb2_value();
void get_pb2_value(BOOL load_UI=TRUE);
};
/* -------------------- BitmapControl ------------------- */
visible_class (BitmapControl)
class BitmapControl : public RolloutControl
{
public:
Value* file_name;
Value* max_bitmap; // if supplied
HBITMAP bitmap;
BitmapControl(Value* name, Value* caption, Value** keyparms, int keyparm_count);
~BitmapControl();
static RolloutControl* create(Value* name, Value* caption, Value** keyparms, int keyparm_count)
{ return new BitmapControl (name, caption, keyparms, keyparm_count); }
classof_methods (BitmapControl, RolloutControl);
void collect() { delete this; }
void sprin1(CharStream* s) { s->printf(_T("BitmapControl:%s"), name->to_string()); }
void gc_trace();
LPCTSTR get_control_class() { return _T("STATIC"); }
DWORD get_control_style() { return SS_BITMAP + SS_CENTERIMAGE; }
DWORD get_control_ex_style() { return WS_EX_CLIENTEDGE; }
void compute_layout(Rollout *ro, layout_data* pos);
void process_layout_params(Rollout *ro, layout_data* pos, int& current_y);
void init_control(HWND control);
Value* get_property(Value** arg_list, int count);
Value* set_property(Value** arg_list, int count);
};
/* -------------------- MapButtonControl ------------------- */
visible_class (MapButtonControl)
class MapButtonControl : public ButtonControl
{
public:
Value* map;
ICustButton* btn;
MapButtonControl(Value* name, Value* caption, Value** keyparms, int keyparm_count)
: ButtonControl(name, caption, keyparms, keyparm_count)
{
tag = class_tag(MapButtonControl);
btn = NULL;
map = NULL;
}
~MapButtonControl() { if (btn != NULL) ReleaseICustButton(btn); }
static RolloutControl* create(Value* name, Value* caption, Value** keyparms, int keyparm_count)
{ return new MapButtonControl (name, caption, keyparms, keyparm_count); }
classof_methods (MapButtonControl, RolloutControl);
void gc_trace();
void collect() { delete this; }
void sprin1(CharStream* s) { s->printf(_T("MapButtonControl:%s"), name->to_string()); }
void init_control(HWND control);
BOOL handle_message(Rollout *ro, UINT message, WPARAM wParam, LPARAM lParam);
Value* get_property(Value** arg_list, int count);
Value* set_property(Value** arg_list, int count);
void Reload();
void InvalidateUI();
void set_pb2_value();
void get_pb2_value(BOOL load_UI=TRUE);
void SetTexDADMgr(DADMgr* dad) { if (btn) btn->SetDADMgr(dad); }
int FindSubTexFromHWND(HWND hw);
};
/* -------------------- MtlButtonControl ------------------- */
visible_class (MtlButtonControl)
class MtlButtonControl : public ButtonControl
{
public:
Value* mtl;
ICustButton* btn;
MtlButtonControl(Value* name, Value* caption, Value** keyparms, int keyparm_count)
: ButtonControl(name, caption, keyparms, keyparm_count)
{
tag = class_tag(MtlButtonControl);
btn = NULL;
mtl = NULL;
}
~MtlButtonControl() { if (btn != NULL) ReleaseICustButton(btn); }
static RolloutControl* create(Value* name, Value* caption, Value** keyparms, int keyparm_count)
{ return new MtlButtonControl (name, caption, keyparms, keyparm_count); }
classof_methods (MtlButtonControl, RolloutControl);
void gc_trace();
void collect() { delete this; }
void sprin1(CharStream* s) { s->printf(_T("MtlButtonControl:%s"), name->to_string()); }
void init_control(HWND control);
BOOL handle_message(Rollout *ro, UINT message, WPARAM wParam, LPARAM lParam);
Value* get_property(Value** arg_list, int count);
Value* set_property(Value** arg_list, int count);
void Reload();
void InvalidateUI();
void set_pb2_value();
void get_pb2_value(BOOL load_UI=TRUE);
void SetMtlDADMgr(DADMgr* dad) { if (btn) btn->SetDADMgr(dad); }
int FindSubMtlFromHWND(HWND hw);
};
/* ----------------------- GroupControls ---------------------- */
visible_class (GroupStartControl)
class GroupStartControl : public RolloutControl
{
public:
int start_y; /* y coord of top of group */
GroupStartControl(Value* caption)
: RolloutControl(NULL, caption, NULL, 0) { tag = class_tag(GroupStartControl); }
classof_methods (GroupStartControl, RolloutControl);
void collect() { delete this; }
void sprin1(CharStream* s) { s->printf(_T("GroupStartControl:%s"), caption->to_string()); }
void add_control(Rollout *ro, HWND parent, HINSTANCE hInstance, int& current_y);
LPCTSTR get_control_class() { return _T(""); }
void compute_layout(Rollout *ro, layout_data* pos) { }
};
visible_class (GroupEndControl)
class GroupEndControl : public RolloutControl
{
GroupStartControl* my_start; /* link back to my group start control */
public:
GroupEndControl(GroupStartControl* starter)
: RolloutControl(NULL, starter->caption, NULL, 0) { tag = class_tag(GroupEndControl); my_start = starter; }
classof_methods (GroupEndControl, RolloutControl);
void collect() { delete this; }
void sprin1(CharStream* s) { s->printf(_T("GroupEndControl:%s"), caption->to_string()); }
void add_control(Rollout *ro, HWND parent, HINSTANCE hInstance, int& current_y);
LPCTSTR get_control_class() { return _T(""); }
void compute_layout(Rollout *ro, layout_data* pos) { }
};
// ---- time change callback for rollouts with controller-linked spinners in them ----
class RolloutChangeCallback : public TimeChangeCallback
{
public:
Rollout* ro;
RolloutChangeCallback(Rollout* iro) { ro = iro; }
void TimeChanged(TimeValue t) { ro->TimeChanged(t); }
};
/* control keyword parameter access macros... */
extern ScripterExport Value* _get_control_param(Value** keyparms, int count, Value* key_name);
extern ScripterExport Value* _get_control_param_or_default(Value** keyparms, int count, Value* key_name, Value* def);
#define control_param(key) _get_control_param(keyparms, keyparm_count, n_##key)
#define control_param_or_default(key, def) _get_control_param_or_default(keyparms, keyparm_count, n_##key##, def)
#define int_control_param(key, var, def) ((var = _get_control_param(keyparms, keyparm_count, n_##key)) == &unsupplied ? def : var->to_int())
#define float_control_param(key, var, def) ((var = _get_control_param(keyparms, keyparm_count, n_##key)) == &unsupplied ? def : var->to_float())
#endif
@@ -0,0 +1,105 @@
/*
* SceneIO.h - MAXScript-related scene file I/O (persistent globals, on-open script, etc.)
*
* Copyright © Autodesk, Inc, 1998. John Wainwright.
*
*/
#ifndef _H_SCENEIO
#define _H_SCENEIO
class ValueLoader;
/* --------- Scene I/O chunk ID's ---------- */
#define OPENSCRIPT_CHUNK 0x0010 // obsoleted by CALLBACKSCRIPT_CHUNK
#define SAVESCRIPT_CHUNK 0x0020 // obsoleted by CALLBACKSCRIPT_CHUNK
#define PSGLOBALS_CHUNK 0x0030
#define MSPLUGINCLASS_CHUNK 0x0040
#define MSPLUGINCLASSHDR_CHUNK 0x0050
#define LENGTH_CHUNK 0x0060
#define CALLBACKSCRIPT_CHUNK 0x0070
#define CUSTATTRIBDEF_CHUNK 0x0080
#define SOURCE_CHUNK 0x00a0
/* ---- persistent global value loading ----- */
typedef Value* (*load_fn)(ILoad* iload, USHORT chunkID, ValueLoader* vl);
enum LoadableClassID
{
Undefined_Chunk = 0, Boolean_Chunk, Ok_Chunk,
Integer_Chunk, Float_Chunk, String_Chunk,
Name_Chunk, Array_Chunk, Point3Value_Chunk,
QuatValue_Chunk, RayValue_Chunk, AngAxisValue_Chunk,
EulerAnglesValue_Chunk, Matrix3Value_Chunk, Point2Value_Chunk,
ColorValue_Chunk, MSTime_Chunk, MSInterval_Chunk,
MAXWrapper_Chunk, Unsupplied_Chunk, Struct_Chunk,
// add more here...
HIGH_CLASS_CHUNK // must be last
};
extern ScripterExport Value* load_value(ILoad* iload, ValueLoader* vload);
extern void save_persistent_callback_scripts(ISave* isave);
extern IOResult load_persistent_callback_script(ILoad* iload);
extern Tab<ValueLoader*> value_loaders;
// post global load callback scheme, allows different loaders to
// permit ::Load() fns to register a callback to clean-up a load.
// Eg, Array loader gets such a callback from MAXWrapper::Load() which
// uses this to build the MAXWrapper at post-load time, after object pointers
// have been back-patched.
// ::Load()'s that need to specialize this to provide a callback
class ValueLoadCallback
{
public:
virtual Value* post_load() { return &undefined; } // return the cleaned-up value
};
// each loader specializes this and gives it to the ::Load()
class ValueLoader
{
public:
virtual void register_callback(ValueLoadCallback* cb) { }
virtual void call_back() { }
};
// A post load callback to process persistent value load callbacks
class ValueLoadPLCB : public PostLoadCallback
{
public:
void proc(ILoad *iload)
{
for (int i = 0; i < value_loaders.Count(); i++)
value_loaders[i]->call_back();
value_loaders.ZeroCount();
delete this;
}
};
// callback script (see MAXCallbacks.cpp)
class CallbackScript
{
public:
TSTR script; // callback script or script filename
Value* code; // cached compiled code
Value* id; // script ID
short flags; // flags
CallbackScript(TCHAR* iscript, Value* iid, short iflags)
{
script = iscript; code = NULL; id = iid; flags = iflags;
}
};
#define MCB_SCRIPT_IS_FILE 0x0001
#define MCB_PERSISTENT 0x0002
#define MCB_HAS_ID 0x0004
#define MCB_INVALID 0x0008
extern Tab<CallbackScript*>* callback_scripts[];
#endif
@@ -0,0 +1,63 @@
/************************************************************************
* ScriptEd.h - wrapper classes for script editor windows *
* *
* Author: Ravi Karra *
************************************************************************/
#ifndef _SCRIPTEDITOR_H
#define _SCRIPTEDITOR_H
#include "MaxScrpt.h"
#include "Listener.h"
// defines for script editor window menu items
#define IDM_NEW 10
#define IDM_OPEN 11
#define IDM_EVAL_ALL 40026
#define IDM_CLOSE 40024
// wrapper class for script editor windows
class ScriptEditor
{
TCHAR* editScript;
TSTR title;
protected:
WNDPROC originalWndProc;
IntTab disable_menus;
edit_window *ew;
HWND hScript;
public:
ScriptEditor(TCHAR* ititle=NULL) :
title(ititle),
ew(NULL),
hScript(NULL),
editScript(NULL) { }
~ScriptEditor() { if (editScript) delete editScript; editScript = NULL; }
virtual LRESULT APIENTRY proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
return CallWindowProc(originalWndProc, hwnd, uMsg, wParam, lParam);
}
ScripterExport virtual HWND DisplayWindow(HWND hParent=NULL/*for future use*/);
ScripterExport virtual void CloseWindow(bool notify=false);
ScripterExport virtual TCHAR* GetEditScript();
ScripterExport virtual void SetEditScript(TCHAR* script);
ScripterExport virtual void SetTitle(TCHAR* t) { title = t; }
ScripterExport virtual bool OnFileOpen(HWND hwnd);
ScripterExport virtual bool OnClose(HWND hwnd);
virtual TCHAR* GetTitle() { return title; }
virtual Value* GetValueTitle() { return (ew) ? ew->file_name : NULL; }
virtual bool OnExecute(HWND hwnd){ return false; } // return false to default handling
virtual bool IsDisplayed() { return ew!=NULL; }
virtual IntTab& GetDisabledMenuTab(){ return disable_menus; }
};
// open new editor on existing file, pop openfilename dialog if no filename supplied
// if ew is NULL, a new editor window is opened
ScripterExport void open_script(TCHAR* filename=NULL, edit_window *ew=NULL);
#endif //_SCRIPTEDITOR_H
@@ -0,0 +1,44 @@
/*
* ScrpCtrl.h - interface to scripter-based expression controllers
*
* John Wainwright
* Copyright © Autodesk, Inc. 1997
*/
#ifndef _H_SCRPTCTRL
#define _H_SCRPTCTRL
#define FLOAT_SCRIPT_CONTROL_CNAME GetString(IDS_RB_SCRIPTFLOAT)
#define FLOAT_SCRIPT_CONTROL_CLASS_ID Class_ID(0x498702e6, 0x71f11548)
#define POSITION_SCRIPT_CONTROL_CNAME GetString(IDS_RB_SCRIPTPOSITION)
#define POSITION_SCRIPT_CONTROL_CLASS_ID Class_ID(0x5065767b, 0x683a42a5)
#define POINT3_SCRIPT_CONTROL_CNAME GetString(IDS_RB_SCRIPTPOINT3)
#define POINT3_SCRIPT_CONTROL_CLASS_ID Class_ID(0x46972869, 0x2f7f05ce)
#define ROTATION_SCRIPT_CONTROL_CNAME GetString(IDS_RB_SCRIPTROTATION)
#define ROTATION_SCRIPT_CONTROL_CLASS_ID Class_ID(0x31381912, 0x3a904166)
#define SCALE_SCRIPT_CONTROL_CNAME GetString(IDS_RB_SCRIPTSCALE)
#define SCALE_SCRIPT_CONTROL_CLASS_ID Class_ID(0x7c8f3a2a, 0x1e954d91)
#define PRS_SCRIPT_CONTROL_CNAME GetString(IDS_RB_SCRIPTPRS)
#define PRS_SCRIPT_CONTROL_CLASS_ID Class_ID(0x7f56455c, 0x1be66c68)
class IBaseScriptControl : public StdControl {
public:
virtual TCHAR* get_script_text() = 0;
virtual void set_script_text(TCHAR* text) = 0;
virtual bool update_refs() = 0;
virtual void depends_on(ReferenceTarget* ref) = 0;
};
#define push_control(_c) \
Control* _save_cc = thread_local(current_controller); \
thread_local(current_controller) = _c;
#define pop_control() \
thread_local(current_controller) = _save_cc;
#endif
@@ -0,0 +1,165 @@
/*
* Streams.h - stream family for MAXScript
*
* Copyright © John Wainwright 1996
*
*/
#ifndef _H_STREAM
#define _H_STREAM
class Listener;
class FileStream;
class Parser;
visible_class (CharStream)
class CharStream : public Value
{
public:
classof_methods (CharStream, Value);
BOOL _is_charstream() { return 1; }
# define is_charstream(o) ((o)->_is_charstream())
virtual TCHAR get_char() = 0;
virtual void unget_char(TCHAR c) = 0;
virtual TCHAR peek_char() = 0;
virtual int at_eos() = 0;
virtual void rewind() = 0;
virtual int pos() { return 0; }
virtual void seek(int pos) { };
virtual void flush_to_eol() = 0;
virtual void flush_to_eobuf() {}
virtual void flush_whitespace();
virtual TCHAR putch(TCHAR c) { return c; }
virtual TCHAR* puts(TCHAR* str) { return str; }
virtual int printf(const TCHAR *format, ...) { return 0; }
virtual void close() {}
virtual void flush() {}
virtual void log_to(CharStream* log) {}
virtual void close_log() {}
virtual Listener* get_listener() { return NULL; }
virtual CharStream* get_log() { return NULL; }
virtual Value* get_file_name() { return NULL; }
};
visible_class (FileStream)
class FileStream : public CharStream
{
public:
Value* file_name;
TCHAR* mode;
FILE* file;
CharStream* log;
int ungetchar_count;
TCHAR ungetchar_buf[8];
Parser* reader;
BOOL decrypt;
ScripterExport FileStream ();
ScripterExport ~FileStream ();
classof_methods (FileStream, CharStream);
# define is_filestream(v) ((v)->tag == class_tag(FileStream))
void collect() { delete this; }
void gc_trace();
ScripterExport void sprin1(CharStream* s);
#include "defimpfn.h"
# include "streampr.h"
/* internal char stream protocol */
ScripterExport TCHAR get_char();
ScripterExport void unget_char(TCHAR c);
ScripterExport TCHAR peek_char();
ScripterExport int at_eos();
ScripterExport int pos();
ScripterExport void seek(int pos);
ScripterExport void rewind();
ScripterExport void flush_to_eol();
ScripterExport TCHAR putch(TCHAR c);
ScripterExport TCHAR* puts(TCHAR* str);
ScripterExport int printf(const TCHAR *format, ...);
ScripterExport FileStream* open_decrypt(TCHAR* ifile_name, int seed);
ScripterExport FileStream* open(TCHAR* ifile_name, TCHAR* imode);
ScripterExport void flush();
ScripterExport void close();
void log_to(CharStream* log);
void close_log();
Value* get_file_name() { return file_name; }
void undo_lookahead();
void check_readable();
void check_writeable();
};
visible_class (WindowStream)
class WindowStream : public CharStream
{
public:
HWND window;
int cursor;
TCHAR* title;
Listener* listener;
CharStream* log;
TCHAR wputs_buf[512]; // edit control output buffer
TCHAR* wputs_p;
HWND echo;
WindowStream(HWND iwin);
WindowStream(TCHAR* title); /* for background scripts; window with given title will open if output generated */
~WindowStream();
classof_methods (WindowStream, CharStream);
void collect() { delete this; }
void gc_trace();
ScripterExport void sprin1(CharStream* s);
#include "defimpfn.h"
def_generic(sprint, "sprint");
use_generic( coerce, "coerce");
/* internal TCHAR stream protocol */
TCHAR get_char() { return 0; }
void unget_char(TCHAR c) {}
TCHAR peek_char() {return 0; }
int at_eos() { return TRUE; }
void rewind() {}
void flush_to_eol() {}
ScripterExport TCHAR putch(TCHAR c);
ScripterExport TCHAR* puts(TCHAR* str);
ScripterExport int printf(const TCHAR *format, ...);
ScripterExport void flush();
void ensure_window_open();
void log_to(CharStream* log);
void close_log();
Listener* get_listener() { return listener; }
CharStream* get_log() { return log; }
// edit control output primitives
ScripterExport TCHAR* wputs(const TCHAR *str);
ScripterExport void wflush();
ScripterExport TCHAR wputch(const TCHAR c);
ScripterExport int wprintf(const TCHAR *format, ...);
void set_echo_window(HWND wnd) { echo = wnd; }
void echo_cur_line();
int get_cur_line(TSTR& line);
};
#endif
@@ -0,0 +1,93 @@
/*
* Strings.h - string family for MAXScript
*
* Copyright © John Wainwright 1996
*
*/
#ifndef _H_STRING
#define _H_STRING
#include "streams.h"
visible_class (String)
class String : public Value
{
TCHAR* string;
public:
ScripterExport String(TCHAR *init_string);
~String() { if (string) free(string); }
classof_methods (String, Value);
# define is_string(o) ((o)->tag == class_tag(String))
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
Value* append(TCHAR* str);
Value* append(Value* str_val) { return append(str_val->to_string()); }
#include "defimpfn.h"
# include "strngpro.h"
def_property( count );
TCHAR* to_string() { return string; }
void to_fpvalue(FPValue& v) { v.s = to_string(); v.type = TYPE_STRING; }
// scene I/O
IOResult Save(ISave* isave);
static Value* Load(ILoad* iload, USHORT chunkID, ValueLoader* vload);
friend class StringStream;
};
applyable_class (StringStream)
class StringStream : public CharStream
{
public:
TCHAR* content_string; /* the content string */
TCHAR* cursor; /* current read/write cursor */
size_t buf_len; /* allocated buffer length */
int ungetchar_count;
Parser* reader;
ScripterExport StringStream();
ScripterExport ~StringStream();
ScripterExport StringStream(TCHAR* init_string);
ScripterExport StringStream(int ilen);
ScripterExport StringStream(Value* init_string_value);
ScripterExport void init(TCHAR* init_string);
classof_methods (StringStream, CharStream);
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
#include "defimpfn.h"
# include "streampr.h"
use_generic( coerce, "coerce");
use_generic( copy, "copy");
ScripterExport TCHAR get_char();
ScripterExport void unget_char(TCHAR c);
ScripterExport TCHAR peek_char();
ScripterExport int pos();
void seek(int pos);
ScripterExport int at_eos();
ScripterExport void rewind();
ScripterExport void set_size(int size);
ScripterExport void flush_to_eol();
ScripterExport void flush_to_eobuf();
void undo_lookahead();
ScripterExport TCHAR* puts(TCHAR* str);
ScripterExport TCHAR putch(TCHAR c);
ScripterExport int printf(const TCHAR *format, ...);
TCHAR* to_string() { return content_string; }
void to_fpvalue(FPValue& v) { v.s = to_string(); v.type = TYPE_STRING; }
};
#endif
@@ -0,0 +1,94 @@
/* Structs.h - the MAXSript struct definition classes
*
* Copyright (c) John Wainwright, 1996
*
*/
#ifndef _H_STRUCT
#define _H_STRUCT
visible_class (StructDef)
class StructDef : public Value
{
public:
Value* name; /* struct's global var name */
Value** member_inits; /* member init vals */
int member_count; /* " count */
HashTable* members; /* member name to index table */
ScripterExport StructDef(Value* name, int member_count, Value** inits, HashTable* members);
~StructDef();
classof_methods (StructDef, Value);
# define is_structdef(o) ((o)->tag == class_tag(StructDef))
void collect() { delete this; }
void gc_trace();
ScripterExport void sprin1(CharStream* s);
#include "defimpfn.h"
def_generic ( get_props, "getPropNames"); // LAM: added 4/27/00
ScripterExport Value* apply(Value** arglist, int count, CallContext* cc=NULL);
ScripterExport Value* get_property(Value** arg_list, int count);
ScripterExport Value* set_property(Value** arg_list, int count);
};
class Struct : public Value
{
public:
StructDef* definition; /* pointer to my struct def */
Value** member_data; /* data elements, indexed via struct def hashtable */
ScripterExport Struct(StructDef* idef, int mem_count);
~Struct();
# define is_struct(o) ((o)->tag == INTERNAL_STRUCT_TAG)
Value* classOf_vf(Value** arg_list, int count);
Value* superClassOf_vf(Value** arg_list, int count);
Value* isKindOf_vf(Value** arg_list, int count);
BOOL is_kind_of(ValueMetaClass* c) { return (c == class_tag(StructDef)) ? 1 : Value::is_kind_of(c); }
void collect() { delete this; }
void gc_trace();
ScripterExport void sprin1(CharStream* s);
#include "defimpfn.h"
use_generic ( copy, "copy" );
def_generic ( get_props, "getPropNames"); // LAM: added 4/27/00
Value* get_property(Value** arg_list, int count);
Value* set_property(Value** arg_list, int count);
// scene I/O
IOResult Save(ISave* isave);
static Value* Load(ILoad* iload, USHORT chunkID, ValueLoader* vload);
};
// StructMethods wrap member functions accessed on a struct instance
// their apply() sets up the appropriate struct instance thread-local
// for member data access thunks
class StructMethod : public Value
{
public:
Struct* this_struct;
Value* fn;
StructMethod(Struct* t, Value* f);
void gc_trace();
void collect() { delete this; }
void sprin1(CharStream* s) { fn->sprin1(s); }
BOOL _is_function() { return fn->_is_function(); }
Value* classOf_vf(Value** arg_list, int count) { return fn->classOf_vf(arg_list, count); }
Value* superClassOf_vf(Value** arg_list, int count) { return fn->superClassOf_vf(arg_list, count); }
Value* isKindOf_vf(Value** arg_list, int count) { return fn->isKindOf_vf(arg_list, count); }
BOOL is_kind_of(ValueMetaClass* c) { return fn->is_kind_of(c); }
Value* get_property(Value** arg_list, int count) { return fn->get_property(arg_list, count); }
Value* eval() { return fn->eval(); }
Value* apply(Value** arglist, int count, CallContext* cc=NULL);
};
#endif
@@ -0,0 +1,519 @@
/* Numbers.h - the Thunk family of classes - variable accessors for MAXScript
*
* Copyright (c) John Wainwright, 1996
*
*
*/
#ifndef _H_THUNKS
#define _H_THUNKS
#include "Name.h"
#include "Arrays.h"
#include "Rollouts.h"
#include "MouseTool.h"
#include "UIExtend.h"
/* ----------------------- Thunk ---------------------- */
visible_class (Thunk)
class Thunk : public Value
{
public:
Value* name;
BOOL clear_container; // outer-level prop in a prop sequence, clear current_container when done
classof_methods (Thunk, Value);
# define is_thunk(o) ((o)->_is_thunk())
# define is_indirect_thunk(o) ((o)->_is_indirect_thunk())
BOOL _is_thunk() { return TRUE; }
void gc_trace();
Thunk() : clear_container(FALSE), name(NULL) { }
Thunk* to_thunk() {return this; }
virtual Thunk* make_free_thunk(int level) { return NULL; }
void assign(Value* val) { assign_vf(&val, 1); }
Value* get_property(Value** arg_list, int count);
Value* set_property(Value** arg_list, int count);
};
/* -------------------- GlobalThunk ------------------- */
class GlobalThunk : public Thunk
{
public:
Value* cell;
GlobalThunk(Value* init_name) { init(init_name); }
GlobalThunk(Value* init_name, Value* init_val);
void init(Value* init_name);
# define is_globalthunk(p) ((p)->tag == INTERNAL_GLOBAL_THUNK_TAG)
ScripterExport Value* eval();
void gc_trace();
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
Value* assign_vf(Value**arg_list, int count);
};
class ConstGlobalThunk : public GlobalThunk
{
public:
ConstGlobalThunk(Value* iname) : GlobalThunk(iname) { tag = INTERNAL_CONST_GLOBAL_THUNK_TAG; }
ConstGlobalThunk(Value* iname, Value* ival) : GlobalThunk(iname, ival) { tag = INTERNAL_CONST_GLOBAL_THUNK_TAG; }
# define is_constglobalthunk(p) ((p)->tag == INTERNAL_CONST_GLOBAL_THUNK_TAG)
Value* eval() { return cell->is_const() ? cell->copy_vf(NULL, 0) : cell; }
void collect() { delete this; }
Value* assign_vf(Value**arg_list, int count) { throw AssignToConstError (this); return &undefined; }
};
/* -------------------- SystemGlobalThunk ------------------- */
/* system globals are abstractions over some system state accessing functions, such as
* animation_range, current_renderer,e tc. */
class SystemGlobalThunk : public Thunk
{
Value* (*get_fn)();
Value* (*set_fn)(Value*);
public:
SystemGlobalThunk(Value* init_name, Value* (*iget)(), Value* (*iset)(Value*));
// LAM 4/1/00 - added following to prevent AF in name clash debugging output in HashTable::put_new()
# define is_systemglobalthunk(p) ((p)->tag == INTERNAL_SYS_GLOBAL_THUNK_TAG)
ScripterExport Value* eval();
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s) { s->printf(_T("SystemGlobal:%s"), name->to_string()); }
Value* assign_vf(Value**arg_list, int count);
};
/* -------------------- LocalThunk ------------------- */
class LocalThunk : public Thunk
{
public:
int frame_level; // frame nest level at declaration
int index; // local var's index in local frame
LocalThunk(Value* init_name, int init_index, int iframe_lvl);
# define is_localthunk(p) ((p)->tag == INTERNAL_LOCAL_THUNK_TAG)
Thunk* make_free_thunk(int level);
Value* eval();
void collect() { delete this; }
void sprin1(CharStream* s);
Value* assign_vf(Value**arg_list, int count);
};
class IndirectLocalThunk : public LocalThunk
{
public:
IndirectLocalThunk(Value* init_name, int init_index, int iframe_lvl) :
LocalThunk(init_name, init_index, iframe_lvl) { }
BOOL _is_indirect_thunk() { return TRUE; }
Thunk* make_free_thunk(int level);
Value* eval();
void collect() { delete this; }
void sprin1(CharStream* s) { s->printf(_T("&")); LocalThunk::sprin1(s); }
Value* assign_vf(Value**arg_list, int count);
};
// ContextThunk created from an IndirectLocal/FreeThunk on entry to a MAXScript function apply
// to contain the callers frame context for evals and assigns
class ContextThunk : public Thunk
{
public:
Thunk* thunk; // the wrapped thunk
Value** frame; // callers frame
ENABLE_STACK_ALLOCATE(ContextLocalThunk);
ContextThunk(Thunk* thunk, Value** frame) :
thunk(thunk), frame(frame) { }
void collect() { delete this; }
void sprin1(CharStream* s) { s->printf(_T("&")); thunk->sprin1(s); }
Value* eval();
Value* assign_vf(Value**arg_list, int count);
};
/* -------------------- FreeThunk ------------------- */
class FreeThunk : public Thunk
{
public:
int level; // how many levels to reach back
int index; // index there
FreeThunk(Value* init_name, int level, int index);
# define is_freethunk(p) ((p)->tag == INTERNAL_FREE_THUNK_TAG)
Thunk* make_free_thunk(int level);
void collect() { delete this; }
void sprin1(CharStream* s);
Value* eval();
Value* assign_vf(Value**arg_list, int count);
};
class IndirectFreeThunk : public FreeThunk
{
public:
IndirectFreeThunk(Value* init_name, int level, int index) :
FreeThunk(init_name, level, index) { }
BOOL _is_indirect_thunk() { return TRUE; }
Thunk* make_free_thunk(int level);
void collect() { delete this; }
void sprin1(CharStream* s) { s->printf(_T("&")); FreeThunk::sprin1(s); }
Value* eval();
Value* assign_vf(Value**arg_list, int count);
};
/* -------------------- ClosureFreeThunk ------------------- */
class ClosureFreeThunk : public Thunk
{
public:
ScripterExport Value* eval();
void gc_trace();
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
ClosureFreeThunk();
~ClosureFreeThunk();
};
/* -------------------- PropertyThunk ------------------- */
class PropertyThunk : public Thunk
{
public:
Value* target_code; // code to eval to get target
Value* property_name; // property name
getter_vf getter; // getter virtual fn for built-in properties
setter_vf setter; // setter " " " "
PropertyThunk(Value* target, Value* prop_name);
PropertyThunk(Value* target, Value* prop_name, getter_vf get_fn, setter_vf set_fn);
void gc_trace();
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
# define is_propertythunk(p) ((p)->tag == INTERNAL_PROP_THUNK_TAG)
ScripterExport Value* eval();
Value* assign_vf(Value**arg_list, int count);
Value* op_assign_vf(Value**arg_list, int count);
};
// a PropThunk subclass that is used when a Prop access occurs in a function call
// this is basically a hack to support OLE client method calls, since OLE IDISPATCH
// cannot distinguish methods from props
class FnCallPropertyThunk : public PropertyThunk
{
public:
FnCallPropertyThunk(Value* target, Value* prop_name, getter_vf get_fn, setter_vf set_fn)
: PropertyThunk (target, prop_name, get_fn, set_fn) {}
void collect() { delete this; }
ScripterExport Value* eval();
};
#ifdef USE_PROPERTY_PATH_THUNKS
/* PropertyPathThunk encodes a multi-level property access, such as $foo.twist.gizmo.pos.x
* in a single thunk so that MAXWrapper objects (and others that want) can look-ahead doing the whole path at once and
* not need backreferencing leaf-values for some of the funnier pseudo property accesses
* allowed in MAXScript */
class PropertyPathThunk : public Thunk
{
Value* target_code; // code to eval to get target
Array* property_path; // list of property names
public:
PropertyPathThunk(Value* target, Array* prop_path);
void gc_trace();
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
Value* append_property(Value* prop_name);
ScripterExport Value* eval();
Value* assign_vf(Value**arg_list, int count);
};
#endif
/* -------------------- IndexThunk ------------------- */
class IndexThunk : public Thunk
{
Value* target_code; // code to eval to get target
Value* index_code; // code to eval to get index
public:
IndexThunk(Value* index);
# define is_indexthunk(o) ((o)->tag == INTERNAL_INDEX_THUNK_TAG)
void gc_trace();
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
Value* set_target(Value* targ) { target_code = targ; return this; }
ScripterExport Value* eval();
Value* assign_vf(Value**arg_list, int count);
};
/* -------------------- RolloutControlThunk ------------------- */
class RolloutControlThunk : public Thunk
{
public:
int index;
Rollout* rollout;
RolloutControlThunk(Value* name, int control_index, Rollout* rollout);
BOOL _is_rolloutthunk() { return 1; }
# define is_rolloutthunk(o) ((o)->_is_rolloutthunk())
Value* eval() { return rollout->controls[index]; }
void ScripterExport gc_trace();
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
Value* assign_vf(Value**arg_list, int count);
};
/* -------------------- RolloutLocalThunk ------------------- */
class RolloutLocalThunk : public Thunk
{
public:
int index;
Rollout* rollout;
RolloutLocalThunk(Value* name, int control_index, Rollout* rollout);
BOOL _is_rolloutthunk() { return 1; }
ScripterExport Value* eval();
void gc_trace();
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
Value* assign_vf(Value**arg_list, int count);
};
class ConstRolloutLocalThunk : public RolloutLocalThunk
{
public:
ConstRolloutLocalThunk(Value* name, int control_index, Rollout* rollout)
: RolloutLocalThunk(name, control_index, rollout) { }
void collect() { delete this; }
Value* assign_vf(Value**arg_list, int count) { throw AssignToConstError (this); return &undefined; }
};
/* -------------------- ToolLocalThunk ------------------- */
class ToolLocalThunk : public Thunk
{
public:
int index;
MouseTool* tool;
ToolLocalThunk(Value* name, int iindex, MouseTool* tool);
ScripterExport Value* eval();
void gc_trace();
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
Value* assign_vf(Value**arg_list, int count);
};
/* -------------------- CodeBlockLocalThunk ------------------- */
class CodeBlock;
class CodeBlockLocalThunk : public Thunk
{
public:
int index;
CodeBlock* block;
CodeBlockLocalThunk(Value* name, int iindex, CodeBlock* block);
ScripterExport Value* eval();
void gc_trace();
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
Value* assign_vf(Value**arg_list, int count);
};
/* -------------------- RCMenuItemThunk ------------------- */
class RCMenuItemThunk : public Thunk
{
public:
int index;
RCMenu* rcmenu;
RCMenuItemThunk(Value* name, int item_index, RCMenu* menu);
BOOL _is_rolloutthunk() { return 1; }
# define is_rcmenuthunk(o) ((o)->_is_rcmenuthunk())
Value* eval() { return rcmenu->items[index]; }
void ScripterExport gc_trace();
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
Value* assign_vf(Value**arg_list, int count);
};
/* -------------------- RCMenuLocalThunk ------------------- */
class RCMenuLocalThunk : public Thunk
{
public:
int index;
RCMenu* rcmenu;
RCMenuLocalThunk(Value* name, int iindex, RCMenu* menu);
BOOL _is_rcmenuthunk() { return 1; }
ScripterExport Value* eval();
void gc_trace();
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
Value* assign_vf(Value**arg_list, int count);
};
/* -------------------- PluginLocalThunk ------------------- */
class PluginLocalThunk : public Thunk
{
public:
int index; // access via current_plugin thread local
BOOL re_init; // indicate whether this local needs re-initialization on a redefinition (say for local rollouts, fns, etc.)
PluginLocalThunk(Value* name, int iindex, BOOL re_init = FALSE);
# define is_pluginlocalthunk(p) ((p)->tag == INTERNAL_PLUGIN_LOCAL_THUNK_TAG)
ScripterExport Value* eval();
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
Value* assign_vf(Value**arg_list, int count);
};
class ConstPluginLocalThunk : public PluginLocalThunk
{
public:
ConstPluginLocalThunk(Value* name, int iindex, BOOL re_init = FALSE) : PluginLocalThunk(name, iindex, re_init) { }
void collect() { delete this; }
Value* assign_vf(Value**arg_list, int count) { throw AssignToConstError (this); return &undefined; }
};
/* -------------------- PluginParamThunk ------------------- */
class PluginParamThunk : public Thunk
{
public:
PluginParamThunk(Value* name);
ScripterExport Value* eval();
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
Value* assign_vf(Value**arg_list, int count);
Value* get_container_property(Value* prop, Value* cur_prop);
Value* set_container_property(Value* prop, Value* val, Value* cur_prop);
};
#define push_plugin(_pi) \
MSPlugin* _save_cp = thread_local(current_plugin); \
thread_local(current_plugin) = _pi;
#define pop_plugin() \
thread_local(current_plugin) = _save_cp;
/* -------------------- StructMemberThunk ------------------- */
class StructMemberThunk : public Thunk
{
public:
int index; // access via current_plugin thread local
StructMemberThunk(Value* name, int iindex);
ScripterExport Value* eval();
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
Value* assign_vf(Value**arg_list, int count);
};
/* -------------------- ThunkReference ------------------- */
// indirect thunk (eg, &foo)
class ThunkReference : public Thunk
{
public:
Thunk* target; // the target thunk
ThunkReference(Thunk* target);
# define is_thunkref(p) ((p)->tag == INTERNAL_THUNK_REF_TAG)
void gc_trace();
void collect() { delete this; }
void sprin1(CharStream* s);
Value* eval();
};
class DerefThunk : public Thunk // generated by a '*' prefix operator
{
public:
Value* target; // the target to deref
DerefThunk(Value* target);
void gc_trace();
void collect() { delete this; }
void sprin1(CharStream* s) { s->printf(_T("*")); target->sprin1(s); }
Value* eval();
Value* assign_vf(Value**arg_list, int count);
};
#endif
@@ -0,0 +1,97 @@
/**********************************************************************
*<
FILE: UIExtend.h
DESCRIPTION: MaxScript user interface extensions
CREATED BY: Ravi Karra, 1998
HISTORY:
*> Copyright (c) 1994, All Rights Reserved.
**********************************************************************/
#ifndef _H_UIEXTEND
#define _H_UIEXTEND
#define MF_SUBMENU_START (MF_SEPARATOR+10)
#define MF_SUBMENU_END (MF_SEPARATOR+11)
class RCMenu;
visible_class (MenuItem)
class MenuItem : public Value
{
public:
Value *name, *caption, *flt_fn;
Value **keyparms;
RCMenu *menu;
int keyparm_count;
UINT flags;
MenuItem (RCMenu *m, Value* n, Value* c, Value **keyparms, int keyparm_count, UINT f=0);
MenuItem () {menu= NULL; name=caption=NULL; keyparms=NULL; flags=keyparm_count=0;}
~MenuItem ();
void setup_params();
void collect() { delete this; }
void gc_trace();
ScripterExport void sprin1(CharStream* s);
virtual Value* get_property(Value** arg_list, int count);
virtual Value* set_property(Value** arg_list, int count);
};
class MSRightClickMenu : public RightClickMenu
{
public:
RCMenu *menu;
void Init(RightClickMenuManager* manager, HWND hWnd, IPoint2 m);
void Selected(UINT id);
Value* call_filt_fn(Value* fn);
};
visible_class (RCMenu)
class RCMenu : public Value
{
public:
Value* name; // menu name
HashTable* local_scope; // local name space
MenuItem** items; // menu item array
int item_count; // " " count
Value** locals; // local var array
Value** local_inits; // " " " init vals
int local_count; // " " count
HashTable* handlers; // handler tables
short flags; // menu flags
BOOL init_values; // whether to init ctrl/local values on (re)open
BOOL end_rcmenu_mode; // signals end of rcmenu mode
MSRightClickMenu msmenu; // right-click menu
// command mode locals...
Value* result; // rcmenu result
MSPlugin* plugin; // current plugin under manip if non-NULL
RCMenu(short iflags);
void init(Value* name, int local_count, Value** inits, HashTable* local_scope, MenuItem** iitems, int iitem_count, HashTable* handlers);
~RCMenu();
classof_methods (RCMenu, Value);
void collect() { delete this; }
void gc_trace();
ScripterExport void sprin1(CharStream* s);
Value* get_event_handler(Value* name, Value* event);
BOOL call_event_handler(Value* name, Value* event, Value** arg_list, int count);
virtual Value* get_property(Value** arg_list, int count);
virtual Value* set_property(Value** arg_list, int count);
};
#endif //_H_UIEXTEND
@@ -0,0 +1,533 @@
/* Value.h - metaclass system MAXScript values
*
* All MAXScript-specific C++ objects are subclasses of a single root class, Value,
* and allocated & automatically freed in a specially maintained heap. There is also
* a metaclass system to provide a runtime type calculus for the scripter. Value subclasses
* are divided into those that are scripter-visible, (ie, may wind up as objects that the
* scripter may pass around or store in variables, etc.), and those that are entirely
* internal to the scripter operation (such as thunks, etc.). The scripter-visible
* classes (the majority) are represented in the metasystem by instances of separate
* metaclasses. The metaclasses are all subclasses of ValueMetaClass, the metaclass of
* a class X is named XClass and its sole instance is X_class. The class instances are
* made visible in globals (usually) named X.
*
* Each Value instance has a tag word that either contains a pointer to the instance's
* class instance (in the case of scripter-visible classes) or the reserved value INTERNAL_CLASS_TAG.
* This value is used in performing runtimne type tests and for yielding results to classOf
* methods.
*
* The metaclass, its instance and some of the class calculus methods are usually defined via
* a bunch of macros defined here (see visible_class, visible_class_instance, etc.)
*
* Some of the classes are can be instanced directly as literals in a script, such as strings,
* Point3s, arrays, etc. Some others are instantiable directly by applying the class value
* to a set of initializing parameters, ie, using the class as a function in a function call,
* for example, ray, quat, interval, etc. These are defined via a variant macro: applyable_class().
* A special case of this is provided in the MAXWrapper subsytem for creatable MAX objects, such as
* boxes, lights, camera, etc.. These are represnted by instances of the class MAXClass, and again, thses
* instances are exposed in globals to be applied to creation paramters. These instances
* contain a lot of property metadata and are defined in MAX_classes.cpp. See MAXObject.h for more
* info.
*
* Copyright (c) John Wainwright, 1996
*
*/
#ifndef _H_VALUE
#define _H_VALUE
#include "Colctble.h"
#include "Max.h"
#include "STDMAT.H"
#include "Surf_api.h"
#include "Collect.h"
class Name;
#include "defextfn.h"
# include "corename.h"
// forward declarations...
class PathName;
class Undefined;
class UserProp;
class UserGeneric;
class CallContext;
extern ScripterExport Undefined undefined;
class ValueMetaClass;
typedef struct node_map node_map;
// the root MAXScript class
class Value : public Collectable
{
private:
ScripterExport static Matrix3 s_error_matrix;
ScripterExport static Box2 s_error_box2;
public:
ValueMetaClass* tag; // runtime type tag; filled in by subclasses
ScripterExport virtual BOOL is_kind_of(ValueMetaClass* c);
ScripterExport virtual ValueMetaClass* local_base_class(); // local base class in this class's plug-in
virtual Value* eval() { check_interrupts(); return this; }
virtual Value* eval_no_wrapper() { check_interrupts(); return this; }
virtual Value* apply(Value** arglist, int count, CallContext* cc=NULL) { throw TypeError (_T("Call needs function or class"), this); return this; }
virtual void export_to_scripter() { }
virtual Value* map(node_map& m) { unimplemented(_T("map"), this) ; return this; }
virtual Value* map_path(PathName* path, node_map& m) { unimplemented(_T("map_path"), this) ; return this; }
virtual Value* find_first(BOOL (*test_fn)(INode* node, int level, void* arg), void* test_arg) { unimplemented(_T("find_first"), this) ; return this; }
virtual Value* get_path(PathName* path) { unimplemented(_T("get"), this) ; return this; }
ScripterExport virtual void sprin1(CharStream* stream);
ScripterExport virtual void sprint(CharStream* stream);
virtual void prin1() { sprin1(thread_local(current_stdout)); }
virtual void print() { sprint(thread_local(current_stdout)); }
/* include all the protocol declarations */
#include "defabsfn.h"
# include "mathpro.h"
# include "vectpro.h"
# include "matpro.h"
# include "quatpro.h"
# include "arraypro.h"
# include "streampr.h"
# include "strngpro.h"
# include "timepro.h"
# include "colorpro.h"
# include "nodepro.h"
# include "ctrlrpro.h"
# include "prims.h"
# include "biprops.h"
# include "bitmapro.h"
# include "texmapro.h"
# include "atmspro.h"
# include "nurbspro.h"
# include "ctbmapro.h"
// MXSAgni specific -- START --
# include "bmatpro.h"
# include "boxpro.h"
# include "phyblpro.h"
# include "phymcpro.h"
# include "bipedpro.h"
# include "notespro.h"
# include "xrefspro.h"
// MXSAgni specific -- END --
ScripterExport virtual Class_ID get_max_class_id() { return Class_ID(0, 0); }
ScripterExport virtual Value* delete_vf(Value** arglist, int arg_count) { ABSTRACT_FUNCTION(_T("delete"), this, Value*); }
ScripterExport virtual Value* clearSelection_vf(Value** arglist, int arg_count) { ABSTRACT_FUNCTION(_T("clearSelection"), this, Value*); }
#undef def_generic
#define def_generic(fn, name) ScripterExport virtual Value* fn##_vf(Value** arglist, int arg_count);
# include "kernlpro.h"
virtual float to_float() { ABSTRACT_CONVERTER(float, Float); }
virtual TCHAR* to_string() { ABSTRACT_CONVERTER(TCHAR*, String); }
virtual int to_int() { ABSTRACT_CONVERTER(int, Integer); }
virtual BOOL to_bool() { ABSTRACT_CONVERTER(BOOL, Boolean); }
virtual BitArray& to_bitarray() { throw ConversionError (this, _T("BitArray")); return *(BitArray*)NULL; }
virtual Point3 to_point3() { ABSTRACT_CONVERTER(Point3, Point3); }
virtual Point2 to_point2() { ABSTRACT_CONVERTER(Point2, Point2); }
virtual AColor to_acolor() { throw ConversionError (this, _T("Color")); return AColor(0,0,0); }
virtual COLORREF to_colorref() { throw ConversionError (this, _T("Color")); return RGB(0,0,0); }
virtual INode* to_node() { ABSTRACT_CONVERTER(INode*, <node>); }
virtual Ray to_ray() { throw ConversionError (this, _T("Ray")); return Ray(); }
virtual Interval to_interval() { throw ConversionError (this, _T("Interval")); return Interval(); }
virtual Quat to_quat() { throw ConversionError (this, _T("Quaternion")); return Quat(); }
virtual AngAxis to_angaxis() { throw ConversionError (this, _T("AngleAxis")); return AngAxis(); }
virtual Matrix3& to_matrix3() { throw ConversionError (this, _T("Matrix")); return s_error_matrix; }
virtual float* to_eulerangles() { ABSTRACT_CONVERTER(float*, Float); }
virtual Mtl* to_mtl() { ABSTRACT_CONVERTER(Mtl*, Material); }
virtual Texmap* to_texmap() { ABSTRACT_CONVERTER(Texmap*, TextureMap); }
virtual MtlBase* to_mtlbase() { ABSTRACT_CONVERTER(MtlBase*, MtlBase); }
virtual Modifier* to_modifier() { ABSTRACT_CONVERTER(Modifier*, Modifier); }
virtual TimeValue to_timevalue() { ABSTRACT_CONVERTER(TimeValue, Time); }
virtual Control* to_controller() { ABSTRACT_CONVERTER(Control*, Controller); }
virtual Atmospheric* to_atmospheric() { ABSTRACT_CONVERTER(Atmospheric*, Atmospheric); }
virtual Effect* to_effect() { ABSTRACT_CONVERTER(Effect*, Effect); } // RK: Added this
virtual IMultiPassCameraEffect* to_mpassCamEffect() { ABSTRACT_CONVERTER(IMultiPassCameraEffect*, Effect); } // LAM: Added this
virtual ShadowType* to_shadowtype() { ABSTRACT_CONVERTER(ShadowType*, ShadowType); } // RK: Added this
virtual FilterKernel* to_filter() { ABSTRACT_CONVERTER(FilterKernel*, FilterKernel); } // RK: Added this
virtual INode* to_rootnode() { ABSTRACT_CONVERTER(INode*, <root>); } // RK: Added this
virtual ITrackViewNode* to_trackviewnode() { ABSTRACT_CONVERTER(ITrackViewNode*, TrackViewNode); }
virtual NURBSIndependentPoint* to_nurbsindependentpoint() { throw ConversionError (this, _T("NURBSIndependentPoint")); return (NURBSIndependentPoint*)0; }
virtual NURBSPoint* to_nurbspoint() { throw ConversionError (this, _T("NURBSPoint")); return (NURBSPoint*)0; }
virtual NURBSObject* to_nurbsobject() { throw ConversionError (this, _T("NURBSObject")); return (NURBSObject*)0; }
virtual NURBSControlVertex* to_nurbscontrolvertex() { throw ConversionError (this, _T("NURBSControlVertex")); return (NURBSControlVertex*)0; }
virtual NURBSCurve* to_nurbscurve() { throw ConversionError (this, _T("NURBSCurve")); return (NURBSCurve*)0; }
virtual NURBSCVCurve* to_nurbscvcurve() { throw ConversionError (this, _T("NURBSCVCurve")); return (NURBSCVCurve*)0; }
virtual NURBSSurface* to_nurbssurface() { throw ConversionError (this, _T("NURBSSurface")); return (NURBSSurface*)0; }
virtual NURBSTexturePoint* to_nurbstexturepoint() { throw ConversionError (this, _T("NURBSTexturePoint")); return (NURBSTexturePoint*)0; }
virtual NURBSSet* to_nurbsset() { throw ConversionError (this, _T("NURBSSet")); return (NURBSSet*)0; }
virtual ReferenceTarget* to_reftarg() { ABSTRACT_CONVERTER(ReferenceTarget*, MaxObject); }
virtual Mesh* to_mesh() { ABSTRACT_CONVERTER(Mesh*, Mesh); }
virtual Thunk* to_thunk() { ABSTRACT_CONVERTER(Thunk*, &-reference); }
virtual void to_fpvalue(FPValue& v) { throw ConversionError (this, _T("FPValue")); }
// MXSAgni specific -- START --
virtual Box2& to_box2() { throw ConversionError (this, _T("Box2")); return s_error_box2; }
// MXSAgni specific -- END --
virtual NURBSTextureSurface* to_nurbstexturesurface() { throw ConversionError (this, _T("NURBSTextureSurface")); return (NURBSTextureSurface*)0; }
virtual NURBSDisplay* to_nurbsdisplay() { throw ConversionError (this, _T("NURBSDisplay")); return (NURBSDisplay*)0; }
virtual TessApprox* to_tessapprox() { throw ConversionError (this, _T("TessApprox")); return (TessApprox*)0; }
virtual Value* widen_to(Value* arg, Value** arg_list) { ABSTRACT_WIDENER(arg); }
virtual BOOL comparable(Value* arg) { return (tag == arg->tag); }
virtual BOOL is_const() { return FALSE; }
ScripterExport virtual Value* get_property(Value** arg_list, int count);
ScripterExport virtual Value* set_property(Value** arg_list, int count);
ScripterExport Value* _get_property(Value* prop);
ScripterExport virtual Value* _set_property(Value* prop, Value* val);
virtual Value* get_container_property(Value* prop, Value* cur_prop) { throw AccessorError (cur_prop, prop); return NULL; }
// Win64 Cleanup: Shuler
virtual Value* set_container_property(Value* prop, Value* val, Value* cur_prop) { throw AccessorError (cur_prop, prop); return NULL;}
// Win64 Cleanup: Shuler
#ifdef USE_PROPERTY_PATH_THUNKS
virtual Value* get_property_path(Value** arg_list, int count);
virtual Value* set_property_path(Value** arg_list, int count);
#endif
// polymorphic default type predicates - abstracted over by is_x(v) macros as needed
virtual BOOL _is_collection() { return FALSE; }
virtual BOOL _is_charstream() { return FALSE; }
virtual BOOL _is_rolloutcontrol() { return FALSE; }
virtual BOOL _is_rolloutthunk() { return FALSE; }
virtual BOOL _is_function() { return FALSE; }
virtual BOOL _is_selection() { return FALSE; }
virtual BOOL _is_thunk() { return FALSE; }
virtual BOOL _is_indirect_thunk() { return FALSE; }
// yield selection set iterator if you can
virtual SelectionIterator* selection_iterator() { throw RuntimeError (_T("Operation requires a selection (Array or BitArray)")); return NULL; }
// scene persistence functions
ScripterExport virtual IOResult Save(ISave* isave);
// the Load fn is a static method on loadbale classes, see SceneIO.cpp & .h and each loadable class
// called during MAX exit to have all MAXScript-side refs dropped (main implementation in MAXWrapper)
virtual void drop_MAX_refs() { }
// access ID'd FPInterface if supported
virtual BaseInterface* GetInterface(Interface_ID id) { return NULL; }
// stack allocation routines
ScripterExport Value* make_heap_permanent();
ScripterExport Value* make_heap_static() { Value* v = make_heap_permanent(); v->flags |= GC_STATIC; return v; }
ScripterExport Value* get_heap_ptr() { if (!has_heap_copy()) return migrate_to_heap(); return is_on_stack() ? get_stack_heap_ptr() : this; }
ScripterExport Value* get_stack_heap_ptr() { return (Value*)next; }
ScripterExport Value* migrate_to_heap();
ScripterExport Value* get_live_ptr() { return is_on_stack() && has_heap_copy() ? get_stack_heap_ptr() : this; }
};
inline Value* heap_ptr(Value* v) { return v ? v->get_heap_ptr() : NULL; } // ensure v is in heap, migrate if not, return heap pointer
inline Value* live_ptr(Value* v) { return v->get_live_ptr(); } // get live pointer, if on stack & migrated, heap copy is live
/* ---------- the base class for all metaclasses ---------- */
class MetaClassClass;
extern MetaClassClass value_metaclass; // the metaclass class
class ValueMetaClass : public Value
{
public:
TCHAR* name;
UserProp* user_props; // additional, user defined property accessors
short uprop_count;
UserGeneric* user_gens; // " " " generic fns
short ugen_count;
Tab<FPInterfaceDesc*> prop_interfaces; // static interfaces who methods appear as properties on instances of the class
ValueMetaClass() { }
ScripterExport ValueMetaClass(TCHAR* iname);
ScripterExport BOOL is_kind_of(ValueMetaClass* c);
# define is_valueclass(o) ((o)->tag == (ValueMetaClass*)&value_metaclass)
ScripterExport void sprin1(CharStream* s);
ScripterExport void export_to_scripter();
ScripterExport void add_user_prop(TCHAR* prop, value_cf getter, value_cf setter);
ScripterExport void add_user_generic(TCHAR* name, value_cf fn);
ScripterExport UserGeneric* find_user_gen(Value* name);
ScripterExport UserProp* find_user_prop(Value* prop);
// static property interfaces
ScripterExport void add_prop_interface(FPInterfaceDesc* fpd) { prop_interfaces.Append(1, &fpd); }
ScripterExport int num_prop_interfaces() { return prop_interfaces.Count(); }
ScripterExport FPInterfaceDesc* get_prop_interface(int i) { return prop_interfaces[i]; }
/* #include "defimpfn.h"
// subclass & instance virtual array accessors
def_prop_getter(subclasses);
def_prop_getter(instances);
*/
};
#define classof_methods(_cls, _super) \
Value* classOf_vf(Value** arg_list, int count) \
{ \
check_arg_count(classOf, 1, count + 1); \
return &_cls##_class; \
} \
Value* superClassOf_vf(Value** arg_list, int count) \
{ \
check_arg_count(superClassOf, 1, count + 1); \
return &_super##_class; \
} \
Value* isKindOf_vf(Value** arg_list, int count) \
{ \
check_arg_count(isKindOf, 2, count + 1); \
return (arg_list[0] == &_cls##_class) ? \
&true_value : \
_super::isKindOf_vf(arg_list, count); \
} \
BOOL is_kind_of(ValueMetaClass* c) \
{ \
return (c == &_cls##_class) ? 1 \
: _super::is_kind_of(c); \
}
#define visible_class(_cls) \
class _cls##Class : public ValueMetaClass \
{ \
public: \
_cls##Class(TCHAR* name) : ValueMetaClass (name) { } \
void collect() { delete this; } \
}; \
extern ScripterExport _cls##Class _cls##_class;
#define visible_class_s(_cls, _super) \
class _cls##Class : public ValueMetaClass \
{ \
public: \
_cls##Class(TCHAR* name) : ValueMetaClass (name) { } \
void collect() { delete this; } \
Value* classOf_vf(Value** arg_list, int count) \
{ \
check_arg_count(classOf, 1, count + 1); \
return &_super##_class; \
} \
Value* superClassOf_vf(Value** arg_list, int count) \
{ \
return _super##_class.classOf_vf(NULL, 0); \
} \
}; \
extern ScripterExport _cls##Class _cls##_class;
#define applyable_class(_cls) \
class _cls##Class : public ValueMetaClass \
{ \
public: \
_cls##Class(TCHAR* name) : ValueMetaClass (name) { }\
void collect() { delete this; } \
ScripterExport Value* apply(Value** arglist, int count, CallContext* cc=NULL); \
}; \
extern ScripterExport _cls##Class _cls##_class;
#define applyable_class_s(_cls, _super) \
class _cls##Class : public ValueMetaClass \
{ \
public: \
_cls##Class(TCHAR* name) : ValueMetaClass (name) { }\
Value* classOf_vf(Value** arg_list, int count) \
{ \
check_arg_count(classOf, 1, count + 1); \
return &_super##_class; \
} \
Value* superClassOf_vf(Value** arg_list, int count) \
{ \
return _super##_class.classOf_vf(NULL, 0); \
} \
void collect() { delete this; } \
ScripterExport Value* apply(Value** arglist, int count, CallContext* cc=NULL); \
}; \
extern ScripterExport _cls##Class _cls##_class;
#define visible_class_instance(_cls, _name) \
ScripterExport _cls##Class _cls##_class (_T(_name));
#define class_tag(_cls) &_cls##_class
#define INTERNAL_CLASS_TAG ((ValueMetaClass*)0L)
#define INTERNAL_INDEX_THUNK_TAG ((ValueMetaClass*)1L)
#define INTERNAL_PROP_THUNK_TAG ((ValueMetaClass*)2L)
#define INTERNAL_LOCAL_THUNK_TAG ((ValueMetaClass*)3L)
#define INTERNAL_FREE_THUNK_TAG ((ValueMetaClass*)4L)
#define INTERNAL_RO_LOCAL_THUNK_TAG ((ValueMetaClass*)5L)
#define INTERNAL_CODE_TAG ((ValueMetaClass*)6L)
#define INTERNAL_SOURCEWRAPPER_TAG ((ValueMetaClass*)7L)
#define INTERNAL_PIPE_TAG ((ValueMetaClass*)8L)
#define INTERNAL_TOOL_LOCAL_THUNK_TAG ((ValueMetaClass*)9L)
#define INTERNAL_GLOBAL_THUNK_TAG ((ValueMetaClass*)10L)
#define INTERNAL_CONST_GLOBAL_THUNK_TAG ((ValueMetaClass*)11L)
#define INTERNAL_SYS_GLOBAL_THUNK_TAG ((ValueMetaClass*)12L)
#define INTERNAL_PLUGIN_LOCAL_THUNK_TAG ((ValueMetaClass*)13L)
#define INTERNAL_PLUGIN_PARAM_THUNK_TAG ((ValueMetaClass*)14L)
#define INTERNAL_RCMENU_LOCAL_THUNK_TAG ((ValueMetaClass*)15L)
#define INTERNAL_STRUCT_MEM_THUNK_TAG ((ValueMetaClass*)16L)
#define INTERNAL_MSPLUGIN_TAG ((ValueMetaClass*)17L)
#define INTERNAL_STRUCT_TAG ((ValueMetaClass*)18L)
#define INTERNAL_MAKER_TAG ((ValueMetaClass*)19L)
#define INTERNAL_CODEBLOCK_LOCAL_TAG ((ValueMetaClass*)20L)
#define INTERNAL_CODEBLOCK_TAG ((ValueMetaClass*)21L)
#define INTERNAL_THUNK_REF_TAG ((ValueMetaClass*)22L)
#define INTERNAL_TAGS ((ValueMetaClass*)100L) // must be higher than all internal tags
visible_class (Value)
/* ---------- the distinguished value subclasses ---------- */
visible_class (Boolean)
class Boolean;
class ValueLoader;
extern ScripterExport Boolean true_value;
extern ScripterExport Boolean false_value;
class Boolean : public Value
{
public:
Boolean() { tag = &Boolean_class; }
classof_methods (Boolean, Value);
void collect() { delete this; }
void sprin1(CharStream* s);
# define is_bool(o) ((o)->tag == &Boolean_class)
Value* not_vf(Value**arg_list, int count);
BOOL to_bool() { return this == &true_value; }
void to_fpvalue(FPValue& v) { v.i = (this == &true_value) ? 1 : 0; v.type = (ParamType2)TYPE_BOOL; }
// scene I/O
IOResult Save(ISave* isave);
static Value* Load(ILoad* iload, USHORT chunkID, ValueLoader* vload);
};
/* ----- */
visible_class (Undefined)
class Undefined : public Value
{
public:
Undefined() { tag = &Undefined_class; }
classof_methods (Undefined, Value);
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
Value* copy_vf(Value** arg_list, int count) { return this; }
// scene I/O
IOResult Save(ISave* isave);
static Value* Load(ILoad* iload, USHORT chunkID, ValueLoader* vload);
Mtl* to_mtl() { return NULL; } // undefined is a NULL material
};
extern ScripterExport Undefined undefined;
extern ScripterExport Undefined dontCollect;
/* ----- */
visible_class (Ok)
class Ok : public Value
{
public:
Ok() { tag = &Ok_class; }
classof_methods (Ok, Value);
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
// scene I/O
IOResult Save(ISave* isave);
static Value* Load(ILoad* iload, USHORT chunkID, ValueLoader* vload);
};
extern ScripterExport Ok ok;
/* ----- */
visible_class (Empty)
class Empty : public Value
{
public:
Empty() { tag = &Empty_class; }
classof_methods (Empty, Value);
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
};
extern ScripterExport Empty empty;
/* ----- */
visible_class (Unsupplied)
class Unsupplied : public Value
{
public:
Unsupplied() { tag = &Unsupplied_class; }
classof_methods (Unsupplied, Value);
void collect() { delete this; }
ScripterExport void sprin1(CharStream* s);
// scene I/O
IOResult Save(ISave* isave);
static Value* Load(ILoad* iload, USHORT chunkID, ValueLoader* vload);
};
extern ScripterExport Unsupplied unsupplied;
/* ---------- subclass and instance virtual arrays ----------
visible_class (SubclassArray)
class SubclassArray : Value
{
public:
ValueMetaClass* theClass; // whose subclasses we represent
SubclassArray(ValueMetaClass* cls);
classof_methods (SubclassArray, Value);
BOOL _is_collection() { return 1; }
void collect() { delete this; }
void sprin1(CharStream* s) { s->printf(_T("<Subclasses of %s>"), theClass->name); }
// operations
Value* map(node_map& m);
Value* get_vf(Value** arg_list, int count);
// built-in property accessors
def_property ( count );
};
visible_class (InstanceArray)
class InstanceArray : Value
{
public:
ValueMetaClass* theClass; // whose instances we represent
InstanceArray(ValueMetaClass* cls);
classof_methods (InstanceArray, Value);
BOOL _is_collection() { return 1; }
void collect() { delete this; }
void sprin1(CharStream* s) { s->printf(_T("<Instances of %s>"), theClass->name); }
// operations
Value* map(node_map& m);
Value* get_vf(Value** arg_list, int count);
// built-in property accessors
def_property ( count );
};
*/
#endif
@@ -0,0 +1,46 @@
/*
* WireCtrl.h - interface to parameter-wiring controllers
*
* John Wainwright
* Copyright © Autodesk, Inc. 1999
*/
#ifndef _H_WIRETCTRL
#define _H_WIRETCTRL
#define FLOAT_WIRE_CONTROL_CNAME _T("Float Wire") //GetString(IDS_RB_WIREFLOAT)
#define FLOAT_WIRE_CONTROL_CLASS_ID Class_ID(0x498702e7, 0x71f11549)
#define POSITION_WIRE_CONTROL_CNAME _T("Position Wire") //GetString(IDS_RB_WIREPOSITION)
#define POSITION_WIRE_CONTROL_CLASS_ID Class_ID(0x5065767c, 0x683a42a6)
#define POINT3_WIRE_CONTROL_CNAME _T("Point3 Wire") //GetString(IDS_RB_WIREPOINT3)
#define POINT3_WIRE_CONTROL_CLASS_ID Class_ID(0x4697286a, 0x2f7f05cf)
#define ROTATION_WIRE_CONTROL_CNAME _T("Rotation Wire") //GetString(IDS_RB_WIREROTATION)
#define ROTATION_WIRE_CONTROL_CLASS_ID Class_ID(0x31381913, 0x3a904167)
#define SCALE_WIRE_CONTROL_CNAME _T("Scale Wire") //GetString(IDS_RB_WIRESCALE)
#define SCALE_WIRE_CONTROL_CLASS_ID Class_ID(0x7c8f3a2b, 0x1e954d92)
typedef short ParamID;
class IBaseWireControl : public StdControl {
public:
// number of wires, wire param access
virtual int get_num_wires()=0; // how many wires out of this controller (number of dependent params)
virtual Animatable* get_wire_anim(int i)=0; // get ith dependent parameter animatable
virtual int get_wire_subnum(int i)=0; // get ith dependent parameter subanim num in the animatable
// transfer expression script
virtual TCHAR* get_expr_text(int i)=0;
virtual void set_expr_text(int i, TCHAR* text)=0;
// animation sub-controller
virtual void set_slave_animation(Control* c)=0;
virtual Control* get_animation()=0;
virtual bool is_master()=0;
virtual bool is_slave()=0;
};
#endif
@@ -0,0 +1,18 @@
/*
* array_protocol.h - def_generics for Array protocol
*
* see def_abstract_generics.h for more info.
*
*
* Copyright © John Wainwright 1996
*
*/
def_generic (get, "get");
def_generic (put, "put");
def_visible_generic(append, "append");
def_visible_generic(deleteItem, "deleteItem");
def_visible_generic(findItem, "findItem");
def_visible_generic(join, "join");
def_visible_generic(sort, "sort");
@@ -0,0 +1,12 @@
/*
* atmspro.h - def_generics for the operations on MAX atmosphere objects
*
* Copyright © John Wainwright 1996
*
*/
/* gizmo operations */
def_visible_generic ( getGizmo, "getGizmo");
def_visible_generic ( deleteGizmo, "deleteGizmo");
def_visible_generic ( appendGizmo, "appendGizmo");
@@ -0,0 +1,3 @@
// Protocols for biped export classes
def_visible_generic(SetNonUniformScale, "SetNonUniformScale");
@@ -0,0 +1,342 @@
/*
* built_in_properties.h - known core property defs for MAXScript
*
* Copyright © John Wainwright 1996
*
*/
// MUST BE maintained in alpha order for parser lookup table use
// sort path props as though concatenated with '.', nested props as though
// prefixed with '*.'
def_nested_prop ( angle )
def_nested_prop ( axis )
def_nested_prop ( b )
def_nested_prop ( blue )
def_nested_prop ( controller )
def_nested_prop ( g )
def_nested_prop ( green )
def_nested_prop ( isAnimated )
def_nested_prop ( keys )
def_nested_prop ( r )
def_nested_prop ( red )
def_nested_prop_alias ( track, controller )
def_nested_prop ( x )
def_nested_prop ( x_rotation )
def_nested_prop ( y )
def_nested_prop ( y_rotation )
def_nested_prop ( z )
def_nested_prop ( z_rotation )
def_property ( a )
def_property ( alpha )
def_property ( angle )
def_property ( autoParam )
def_property ( autoUpdate )
def_property ( axis )
def_property ( axisTM )
def_property ( b )
def_property ( bias )
def_property ( blue )
def_property ( bottom )
def_property ( boxDisp )
def_property ( categories )
def_property ( category )
def_property ( center )
def_property ( children )
def_property ( classes )
def_property ( classID )
def_property ( closedInU )
def_property ( closedInV )
def_property ( clp )
def_property ( config )
def_property ( constantVelocity )
def_property ( continuity)
def_property ( controller )
def_property ( controllers )
def_property ( count )
def_property ( creatable )
def_property ( cubic )
def_property ( curvatureAngle )
def_property ( curvatureDistance )
def_property ( curveCVs )
def_property ( curves )
def_property ( curveStartPoint )
def_property ( curveStartPoint1 )
def_property ( curveStartPoint2 )
def_property ( degradeOnMove )
def_property ( dir )
def_property ( disabled )
def_property ( displacementMapping )
def_property ( display )
def_property ( displayCurveCVLattices )
def_property ( displayCurves )
def_property ( displayDependents )
def_property ( displayLattices )
def_property ( displayShadedLattice )
def_property ( displaySurfaces )
def_property ( displaySurfCVLattices )
def_property ( displayTrimming )
def_property ( distance )
def_property ( easeFrom )
def_property ( easeTo)
def_property ( edge )
def_property ( edge1 )
def_property ( edge2 )
def_property ( edges )
def_property ( effectsChannel )
def_property ( end )
def_property ( endsOverlap )
def_property ( extrudeVector )
def_property ( faces )
def_property ( fileName )
def_property ( flip1 )
def_property ( flip2 )
def_property ( flipNormals )
def_property ( flipTrim )
def_property ( flipTrim1 )
def_property ( flipTrim2 )
def_property ( frame )
def_property ( freeHandle )
def_property ( g )
def_property ( generateUVs1 )
def_property ( generateUVs2 )
def_property ( green )
def_property ( h )
def_property ( hidden )
def_property ( hue )
def_property ( ignoreAnimation )
def_property ( ignoreCameras )
def_property ( ignoreHelpers )
def_property ( ignoreLights )
def_property ( ignoreShapes )
def_property ( imports )
def_property ( index )
def_property ( inTangent )
def_property ( inTangentLength )
def_property ( inTangentType )
def_property ( isAnimated )
def_property ( isClosed )
def_property ( isEmpty )
def_property ( isoULines )
def_property ( isoVLines )
def_property ( keys )
def_property ( left )
def_property ( length1 )
def_property ( length2 )
def_property ( mat )
def_property_alias ( material, mat )
def_property ( matID )
def_property ( max )
def_property_alias ( maximum, max )
def_property ( merge )
def_property ( mesh )
def_property ( meshApproxType )
def_property ( meshUSteps )
def_property ( meshVSteps )
def_property ( min )
def_property_alias ( minimum, min )
def_property ( modifiers )
def_property ( name )
def_property ( normal )
def_property ( normalized )
def_property ( numberSet )
def_property ( numChannels )
def_property ( numcpvverts )
def_property ( numCurves )
def_property ( numCVs )
def_property ( numfaces )
def_property ( numGizmos )
def_property ( numKnots )
def_property_alias ( nummaterials, numsubs )
def_property ( numObjects )
def_property ( numPoints )
def_property ( numrevs )
def_property ( numsplines )
def_property ( numsubs )
def_property ( numTrimPoints )
def_property ( numtverts )
def_property ( numUCurves )
def_property ( numUCVs )
def_property ( numUKnots )
def_property ( numUPoints )
def_property ( numVCurves )
def_property ( numVCVs )
def_property ( numverts )
def_property ( numVKnots )
def_property ( numVPoints )
def_property ( nurbsID )
def_property ( nurbsSet )
def_property ( object )
def_property ( objectoffsetpos )
def_property ( objectoffsetrot )
def_property ( objectoffsetscale )
def_property ( objecttransform )
def_property ( offset )
def_property ( optimize )
def_property ( order )
def_property ( outTangent )
def_property ( outTangentLength )
def_property ( outTangentType )
def_property ( parallel )
def_property ( parameter )
def_property ( parameterRangeMax )
def_property ( parameterRangeMin )
def_property ( parent )
def_property ( parent1 )
def_property ( parent1ID )
def_property ( parent2 )
def_property ( parent2ID )
def_property ( parentID )
def_property ( pivot )
def_2_prop_path ( pivot, x )
def_2_prop_path ( pivot, y )
def_2_prop_path ( pivot, z )
def_property ( points )
def_property ( pos )
def_2_prop_path ( pos, controller )
def_2_prop_path ( pos, isAnimated )
def_2_prop_path ( pos, keys )
def_2_prop_path_alias ( pos, track, pos, controller )
def_2_prop_path ( pos, x )
def_2_prop_path ( pos, y )
def_2_prop_path ( pos, z )
def_property_alias ( position, pos )
def_2_prop_path_alias ( position, controller, pos, controller )
def_2_prop_path_alias ( position, isAnimated, pos, isAnimated )
def_2_prop_path_alias ( position, keys, pos, keys )
def_2_prop_path_alias ( position, track, pos, controller )
def_2_prop_path_alias ( position, x, pos, x)
def_2_prop_path_alias ( position, y, pos, y )
def_2_prop_path_alias ( position, z, pos, z )
def_property ( pVec )
def_property ( r )
def_property ( radius )
def_property ( rail )
def_property ( rail1 )
def_property ( rail1ID )
def_property ( rail2 )
def_property ( rail2ID )
def_property ( railID )
def_property ( red )
def_property ( renderable )
def_property ( renderApproximation )
def_property ( renderConfig )
def_property ( renderCurvatureAngle )
def_property ( renderCurvatureDistance )
def_property ( renderIsoULines )
def_property ( renderIsoVLines )
def_property ( renderMeshApproxType )
def_property ( renderMeshUSteps )
def_property ( renderMeshVSteps )
def_property ( renderSpacialEdge )
def_property ( renderViewDependent )
def_property ( right )
def_property ( rigid )
def_property ( rotation )
def_2_prop_path ( rotation, angle )
def_2_prop_path ( rotation, axis )
def_2_prop_path ( rotation, controller )
def_2_prop_path ( rotation, isAnimated )
def_2_prop_path ( rotation, keys )
def_2_prop_path_alias ( rotation, track, rotation, controller )
def_2_prop_path ( rotation, x_rotation )
def_2_prop_path ( rotation, y_rotation )
def_2_prop_path ( rotation, z_rotation )
def_property ( row1 )
def_property ( row2 )
def_property ( row3 )
def_property ( row4 )
def_property ( s )
def_property ( saturation )
def_property ( scale )
def_2_prop_path ( scale, axis )
def_2_prop_path ( scale, controller )
def_2_prop_path ( scale, isAnimated )
def_2_prop_path ( scale, keys )
def_2_prop_path_alias ( scale, track, scale, controller )
def_2_prop_path ( scale, x )
def_2_prop_path ( scale, y )
def_2_prop_path ( scale, z )
def_property ( seed )
def_property ( selected )
def_property ( selectedCurveCVs )
def_property ( selectedCurves )
def_property ( selectedEdges )
def_property ( selectedFaces )
def_property ( selectedImports )
def_property ( selectedPoints )
def_property ( selectedSurfaces )
def_property ( selectedSurfCVs )
def_property ( selectedVertices )
def_property_alias ( selectedVerts, selectedVertices )
def_property ( selSetNames )
def_property ( spacialEdge )
def_property ( splitMesh )
def_property ( start )
def_property ( steps )
def_property ( subdivisionDisplacement )
def_property ( superclassID )
def_property ( surfaces )
def_property ( surfCVs )
def_property ( sweep )
def_property ( target )
def_property ( tension )
def_property ( tension1 )
def_property ( tension2 )
def_property ( textureSurface1 )
def_property ( textureSurface2 )
def_property ( ticks )
def_property ( time )
def_property ( top )
def_property_alias ( track, controller )
def_property ( transform )
def_property ( translation )
def_property ( tree )
def_property ( trim )
def_property ( trim1 )
def_property ( trim2 )
def_property ( trimCurve )
def_property ( trimCurve1 )
def_property ( trimCurve2 )
def_property ( type )
def_property ( uEdgesOverlap )
def_property ( uOrder )
def_property ( uParam )
def_property ( uParameterRangeMax )
def_property ( uParameterRangeMin )
def_property ( uTangent )
def_property ( v )
def_property ( value)
def_property ( vEdgesOverlap )
def_property ( vertices)
def_property_alias ( verts, vertices )
def_property ( viewApproximation )
def_property ( viewConfig )
def_property ( viewCurvatureAngle )
def_property ( viewCurvatureDistance )
def_property ( viewDependent )
def_property ( viewIsoULines )
def_property ( viewIsoVLines )
def_property ( viewMeshApproxType )
def_property ( viewMeshUSteps )
def_property ( viewMeshVSteps )
def_property ( viewSpacialEdge )
def_property ( viewViewDependent )
def_property ( vOrder )
def_property ( vParam )
def_property ( vParameterRangeMax )
def_property ( vParameterRangeMin )
def_property ( vTangent )
def_property ( w )
def_property ( weight )
def_property ( x )
def_property ( x_locked )
def_property ( x_rotation )
def_property ( y )
def_property ( y_locked )
def_property ( y_rotation )
def_property ( z )
def_property ( z_locked )
def_property ( z_rotation )
@@ -0,0 +1,40 @@
/*
* bitmap_protocol.h - protocol for MAX bitmaps
*
* Copyright © John Wainwright 1996
*
*/
// BitMap
def_visible_primitive( openBitMap, "openBitMap" );
def_visible_primitive( selectBitMap, "selectBitMap" );
def_visible_generic ( display, "display" );
def_visible_generic ( unDisplay, "unDisplay" );
def_visible_generic ( save, "save" );
use_generic ( close, "close" );
def_visible_generic ( gotoFrame, "gotoFrame" );
def_visible_generic ( getTracker, "getTracker" );
def_visible_generic ( deleteTracker, "deleteTracker" );
// def_visible_generic ( perspectiveMatch, "perspectiveMatch" );
use_generic ( copy, "copy" );
def_visible_generic ( zoom, "zoom" );
def_visible_generic ( crop, "crop" );
def_visible_generic ( setAsBackground, "setAsBackground" );
def_visible_generic ( getPixels, "getPixels" );
def_visible_generic ( setPixels, "setPixels" );
def_visible_generic ( getIndexedPixels, "getIndexedPixels" );
def_visible_generic ( setIndexedPixels, "setIndexedPixels" );
def_visible_generic ( getChannel, "getChannel" );
def_visible_generic ( getChannelAsMask, "getChannelAsMask" );
// BitMapWIndow
// MotionTracker
def_visible_generic ( resample, "resample");
def_visible_generic ( reset, "reset");
def_visible_generic ( clearCacheEntry, "clearCacheEntry");
def_visible_generic ( setCacheEntry, "setCacheEntry");
@@ -0,0 +1,13 @@
// Protocol for BigMatrix class
use_generic( get, "get");
use_generic( put, "put");
use_generic( identity, "identity"); //Should actually be mapped_generic
use_generic( plus, "+");
def_visible_generic( invert, "invert");
def_visible_generic( transpose, "transpose");
def_visible_generic( clear, "clear");
def_visible_generic( setSize, "setSize");

Some files were not shown because too many files have changed in this diff Show More