added everything

This commit is contained in:
Metario
2017-04-17 06:17:10 -06:00
commit 9c6ff74f19
6121 changed files with 1625704 additions and 0 deletions

View File

@ -0,0 +1,218 @@
#define ANALYZER_INTERFACE Interface_ID(0x14bf34cc, 0x519c0633)
#define FIXER_INTERFACE Interface_ID(0xfcd6b18, 0x6e714e23)
#define FILTER_INTERFACE Interface_ID(0x36ca302f, 0x23d147a6)
#define WORKBENCH_INTERFACE Interface_ID(0x78aa2c29, 0x19a55d39)
class IWorkBench : public FPStaticInterface
{
public:
//these function not only affect workbench but all functions
//outside workbench also!
DECLARE_DESCRIPTOR(IWorkBench);
virtual void Open(); //pops up in viewprt
virtual void ToggleShowX();
virtual BOOL GetShowX();
virtual void ToggleShowY();
virtual BOOL GetShowY();
virtual void ToggleShowZ();
virtual BOOL GetShowZ();
virtual void ToggleLayerEdit();
virtual BOOL GetLayerEdit();
virtual void ToggleDrawDuringMove();
virtual BOOL GetDrawDuringMove();
virtual void ToggleLimit180();
virtual BOOL GetLimit180();
virtual void ShowQuatCurve();
virtual void ShowPosCurve();
virtual void ShowAngSpeedCurve();
virtual void ShowAngAccelCurve();
virtual void ShowAngJerkCurve();
virtual void ShowPosSpeedCurve();
virtual void ShowPosAccelCurve();
virtual void ShowPosJerkCurve();
virtual void PosCurveToWorld();
virtual void PosCurveToBipRoot();
virtual void PosCurveToThisNode(INode *node);
typedef enum {toggleShowX=0,getShowX,toggleShowY,getShowY,toggleShowZ,getShowZ,
toggleLayerEdit,getLayerEdit,toggleDrawDuringMove,getDrawDuringMove,
toggleLimit180,getLimit180,
showQuatCurve,showPosCurve,showAngSpeedCurve,showAngAccelCurve,showAngJerkCurve,
showPosSpeedCurve,showPosAccelCurve,showPosJerkCurve,posCurveToWorld, posCurveToBipRoot,
posCurveToThisNode,open} WorkBenchFunctions;
BEGIN_FUNCTION_MAP
VFN_0(toggleShowX,ToggleShowX);
FN_0(getShowX,TYPE_BOOL,GetShowX);
VFN_0(toggleShowY,ToggleShowY);
FN_0(getShowY,TYPE_BOOL,GetShowY);
VFN_0(toggleShowZ,ToggleShowZ);
FN_0(getShowZ,TYPE_BOOL,GetShowZ);
VFN_0(toggleLayerEdit,ToggleLayerEdit);
FN_0(getLayerEdit,TYPE_BOOL,GetLayerEdit);
VFN_0(toggleDrawDuringMove,ToggleDrawDuringMove);
FN_0(getDrawDuringMove,TYPE_BOOL,GetDrawDuringMove);
VFN_0(toggleLimit180,ToggleLimit180);
FN_0(getLimit180,TYPE_BOOL,GetLimit180);
VFN_0(showQuatCurve,ShowQuatCurve);
VFN_0(showPosCurve,ShowPosCurve);
VFN_0(showAngSpeedCurve,ShowAngSpeedCurve);
VFN_0(showAngAccelCurve,ShowAngAccelCurve);
VFN_0(showAngJerkCurve,ShowAngJerkCurve);
VFN_0(showPosSpeedCurve,ShowPosSpeedCurve);
VFN_0(showPosAccelCurve,ShowPosAccelCurve);
VFN_0(showPosJerkCurve,ShowPosJerkCurve);
VFN_0(posCurveToWorld,PosCurveToWorld);
VFN_0(posCurveToBipRoot,PosCurveToBipRoot);
VFN_1(posCurveToThisNode,PosCurveToThisNode,TYPE_INODE);
VFN_0(open,Open);
END_FUNCTION_MAP
};
class IAnalyzer : public FPStaticInterface
{
public:
DECLARE_DESCRIPTOR(IAnalyzer);
//note for the analysis functions if angular type is TRUE then the passed in parent node value isn't used.
//Otherwise if it's FALSE(it's a position analysis) then the parent node is used to calculate the cooridinate space
// of the resulting calculation.
virtual void DoNoiseDetectorAnalysis(Tab<INode *>&nodesToAnalyze,Interval range,float deviation,BOOL angular,int noiseType,INode *pNode);
virtual void DoSpikeDetectorAnalysis(Tab<INode *>&nodesToAnalyze,Interval range,float deviation);
virtual void DoKneeWobbleAnalysis(Tab<INode *>&nodesToAnalyze,Interval range,float frameThreshold,float fluctuationThreshold);
virtual void DoKneeExtensionAnalysis(Tab<INode *>&nodesToAnalyze,Interval range,float kneeAngle);
virtual Tab<TimeValue > GetResults(INode *node);
virtual void LoadAnalysisFile(char *filename);
virtual void SaveAnalysisFile(Tab<INode *> &nodes,char *filename);
virtual void ClearAnalysisResults();
typedef enum {doNoiseDetectorAnalysis=0,doSpikeDetectorAnalysis,getResults,
loadAnalysisFile,saveAnalysisFile,clearAnalysisResults,
doKneeWobbleAnalysis,doKneeExtensionAnalysis} AnalyzeFunctions;
BEGIN_FUNCTION_MAP
VFN_6(doNoiseDetectorAnalysis, DoNoiseDetectorAnalysis,TYPE_INODE_TAB_BR,TYPE_INTERVAL,TYPE_FLOAT,TYPE_BOOL,TYPE_INT,TYPE_INODE);
VFN_3(doSpikeDetectorAnalysis, DoSpikeDetectorAnalysis,TYPE_INODE_TAB_BR,TYPE_INTERVAL,TYPE_FLOAT);
FN_1(getResults,TYPE_TIMEVALUE_TAB_BV,GetResults,TYPE_INODE);
VFN_1(loadAnalysisFile,LoadAnalysisFile,TYPE_STRING);
VFN_2(saveAnalysisFile,SaveAnalysisFile,TYPE_INODE_TAB_BR,TYPE_STRING);
VFN_0(clearAnalysisResults,ClearAnalysisResults);
VFN_4(doKneeWobbleAnalysis, DoKneeWobbleAnalysis,TYPE_INODE_TAB_BR,TYPE_INTERVAL,TYPE_FLOAT,TYPE_FLOAT);
VFN_3(doKneeExtensionAnalysis, DoKneeExtensionAnalysis,TYPE_INODE_TAB_BR,TYPE_INTERVAL,TYPE_FLOAT);
END_FUNCTION_MAP
};
class IFixer : public FPStaticInterface
{
public:
DECLARE_DESCRIPTOR(IFixer);
virtual void DoAngSmoothing(Tab<INode *>&nodes,int width, float damping);
virtual void DoAngBlurring(Tab<INode *>&nodes,int width, float damping);
virtual void DoAdvAngSmoothing(Tab<INode *>&nodes,int width, float damping);
virtual void DoPosSmoothing(Tab<INode *>&nodes,int width, float damping);
virtual void DoPosBlurring(Tab<INode *>&nodes,int width, float damping);
virtual void DoRemoveKeys(Tab<INode *>&nodes,int intervalWidth,BOOL deleteKeys);
virtual void DoKneeWobbleFix(Tab<INode *>&nodes,float frameThreshold,float fluctuationThreshold);
virtual void DoKneeExtensionFix(Tab<INode *>&nodes,float kneeAngle);
typedef enum {
doAngSmoothing = 0, doAngBlurring, doAdvAngSmoothing,doPosSmoothing,
doPosBlurring,doRemoveKeys,doKneeWobbleFix,doKneeExtensionFix
} FilterFunctions;
BEGIN_FUNCTION_MAP
VFN_3(doAngSmoothing, DoAngSmoothing,TYPE_INODE_TAB_BR,TYPE_INT,TYPE_FLOAT);
VFN_3(doAngBlurring, DoAngBlurring,TYPE_INODE_TAB_BR,TYPE_INT,TYPE_FLOAT);
VFN_3(doAdvAngSmoothing, DoAdvAngSmoothing,TYPE_INODE_TAB_BR,TYPE_INT,TYPE_FLOAT);
VFN_3(doPosSmoothing, DoPosSmoothing,TYPE_INODE_TAB_BR,TYPE_INT,TYPE_FLOAT);
VFN_3(doPosBlurring, DoPosBlurring,TYPE_INODE_TAB_BR,TYPE_INT,TYPE_FLOAT);
VFN_3(doRemoveKeys, DoRemoveKeys,TYPE_INODE_TAB_BR,TYPE_INT,TYPE_BOOL);
VFN_3(doKneeWobbleFix, DoKneeWobbleFix,TYPE_INODE_TAB_BR,TYPE_FLOAT,TYPE_FLOAT);
VFN_2(doKneeExtensionFix, DoKneeExtensionFix,TYPE_INODE_TAB_BR,TYPE_FLOAT);
END_FUNCTION_MAP
};
class IFilter : public FPStaticInterface
{
public:
DECLARE_DESCRIPTOR(IFilter);
virtual void DoAngSmoothing(Tab<INode *>&nodes,int width, float damping,Interval range);
virtual void DoAngBlurring(Tab<INode *>&nodes,int width, float damping,Interval range);
virtual void DoAngBoosting(Tab<INode *>&nodes,int width, float damping,Interval range);
virtual void DoAdvAngSmoothing(Tab<INode *>&nodes,int width, float damping,Interval range);
virtual void DoPosSmoothing(Tab<INode *>&nodes,int width, float damping,Interval range);
virtual void DoPosBlurring(Tab<INode *>&nodes,int width, float damping,Interval range);
virtual void DoPosBoosting(Tab<INode *>&nodes,int width, float damping,Interval range);
virtual void DoKeyReduction(Tab<INode *>&nodes,float tolerance,int keySpacing, float COMTolerance,
float COMKeySpacing,Interval range);
virtual void DoKeyPerFrame(Tab<INode *>&nodes);
virtual void EnablePosSubAnim(Tab<INode *> &nodes,BOOL enable);
virtual void EnableRotSubAnim(Tab<INode *> &nodes,BOOL enable);
virtual void EnableScaleSubAnim(Tab<INode *> &nodes,BOOL enable);
virtual void CollapsePosSubAnim(Tab<INode *> &nodes,BOOL perFrame, BOOL deleteSubAnim);
virtual void CollapseRotSubAnim(Tab<INode *> &nodes, BOOL perFrame,BOOL deleteSubAnim);
virtual void CreatePosSubAnim(Tab<INode *> &nodes,Control *toClone,BOOL checkIfOneExists);
virtual void CreateRotSubAnim(Tab<INode *> &nodes,Control *toClone,BOOL checkIfOneExists);
virtual void CreateScaleSubAnim(Tab<INode *> &nodes,Control *toClone,BOOL checkIfOneExists);
virtual void DoKneeWobbleFilter(Tab<INode *>&nodes,float frameThreshold,float fluctuationThreshold,Interval range);
virtual void DoKneeExtensionFilter(Tab<INode *>&nodes,float kneeAngle,Interval range);
typedef enum {
doAngSmoothing = 0, doAngBlurring,doAngBoosting,doAdvAngSmoothing,doPosSmoothing,
doPosBlurring,doPosBoosting,doKeyReduction,doKeyPerFrame,
enablePosSubAnim,enableRotSubAnim,enableScaleSubAnim,
collapsePosSubAnim,collapseRotSubAnim,createPosSubAnim,createRotSubAnim,
createScaleSubAnim,doKneeWobbleFilter,doKneeExtensionFilter
} FilterFunctions;
BEGIN_FUNCTION_MAP
VFN_4(doAngSmoothing, DoAngSmoothing,TYPE_INODE_TAB_BR,TYPE_INT,TYPE_FLOAT,TYPE_INTERVAL);
VFN_4(doAngBlurring, DoAngBlurring,TYPE_INODE_TAB_BR,TYPE_INT,TYPE_FLOAT,TYPE_INTERVAL);
VFN_4(doAngBoosting, DoAngBoosting,TYPE_INODE_TAB_BR,TYPE_INT,TYPE_FLOAT,TYPE_INTERVAL);
VFN_4(doAdvAngSmoothing, DoAdvAngSmoothing,TYPE_INODE_TAB_BR,TYPE_INT,TYPE_FLOAT,TYPE_INTERVAL);
VFN_4(doPosSmoothing, DoPosSmoothing,TYPE_INODE_TAB_BR,TYPE_INT,TYPE_FLOAT,TYPE_INTERVAL);
VFN_4(doPosBlurring, DoPosBlurring,TYPE_INODE_TAB_BR,TYPE_INT,TYPE_FLOAT,TYPE_INTERVAL);
VFN_4(doPosBoosting, DoPosBoosting,TYPE_INODE_TAB_BR,TYPE_INT,TYPE_FLOAT,TYPE_INTERVAL);
VFN_6(doKeyReduction, DoKeyReduction,TYPE_INODE_TAB_BR,TYPE_FLOAT,TYPE_INT,TYPE_FLOAT,TYPE_INT,TYPE_INTERVAL);
VFN_1(doKeyPerFrame, DoKeyPerFrame,TYPE_INODE_TAB_BR);
VFN_2(enablePosSubAnim, EnablePosSubAnim,TYPE_INODE_TAB_BR,TYPE_BOOL);
VFN_2(enableRotSubAnim, EnableRotSubAnim,TYPE_INODE_TAB_BR,TYPE_BOOL);
VFN_2(enableScaleSubAnim, EnableScaleSubAnim,TYPE_INODE_TAB_BR,TYPE_BOOL);
VFN_3(collapsePosSubAnim, CollapsePosSubAnim,TYPE_INODE_TAB_BR,TYPE_BOOL,TYPE_BOOL);
VFN_3(collapseRotSubAnim, CollapseRotSubAnim,TYPE_INODE_TAB_BR,TYPE_BOOL,TYPE_BOOL);
VFN_3(createPosSubAnim, CreatePosSubAnim,TYPE_INODE_TAB_BR,TYPE_CONTROL,TYPE_BOOL);
VFN_3(createRotSubAnim, CreateRotSubAnim,TYPE_INODE_TAB_BR,TYPE_CONTROL,TYPE_BOOL);
VFN_3(createScaleSubAnim, CreateScaleSubAnim,TYPE_INODE_TAB_BR,TYPE_CONTROL,TYPE_BOOL);
VFN_4(doKneeWobbleFilter, DoKneeWobbleFilter,TYPE_INODE_TAB_BR,TYPE_FLOAT,TYPE_FLOAT,TYPE_INTERVAL);
VFN_3(doKneeExtensionFilter, DoKneeExtensionFilter,TYPE_INODE_TAB_BR,TYPE_FLOAT,TYPE_INTERVAL);
END_FUNCTION_MAP
};

120
lib/maxsdk70/include/CS/BIPEXP.H Executable file
View File

@ -0,0 +1,120 @@
/******************************************************************************
*<
FILE: bipexp.h
DESCRIPTION: Export Interface Functionality for BIped
CREATED BY: Susan Amkraut with a lot of help from John Chadwick
HISTORY: created June 2, 1998
*> Copyright (c) Unreal Pictures, Inc. 1997, 1998 All Rights Reserved.
*******************************************************************************/
#ifndef BIPEXP_H
#define BIPEXP_H
#ifdef BLD_BIPED
#define BIPExport __declspec( dllexport )
#else
#define BIPExport __declspec( dllimport )
#endif
#include "max.h"
// This is the interface ID for a Biped Controller Interface
#define I_BIPINTERFACE 0x00100101
// These are subanim numbers for the center of mass (root) controller
#define VERTICAL_SUBANIM 0
#define HORIZONTAL_SUBANIM 1
#define ROTATION_SUBANIM 2
// These are the Class ID defines for Biped Controllers.
#ifndef BLD_BIPED
// this is the class for all biped controllers except the root and the footsteps
#define BIPSLAVE_CONTROL_CLASS_ID Class_ID(0x9154,0)
// this is the class for the center of mass, biped root controller ("Bip01")
#define BIPBODY_CONTROL_CLASS_ID Class_ID(0x9156,0)
// this is the class for the biped footstep controller ("Bip01 Footsteps")
#define FOOTPRINT_CLASS_ID Class_ID(0x3011,0)
#endif
// Using the Biped Export Interface
//
// 1. Find the Biped Controller you wish to export from (see the sample code).
//
// 2. Given a Biped controller c, get the Biped Export Interface:
// IBipedExport *BipIface = (BipedExport *)c->GetInterface(I_BIPINTERFACE);
//
// At the moment this interface only allows you to remove the non uniform scale.
// This allows you to export cleaner transform information from a biped.
// In the future, more virtual functions will be added, and you'll be able
// to get more information about the biped via this interface.
// Sample Code
//
// // Get a biped node - in this case the root
// INode *node = ip->GetINodeByName("Bip01");
//
// if (node)
// {
// // Get the node's transform control
// Control *c = node->GetTMController();
//
// // You can test whether or not this is a biped controller with the following pseudo code:
// if ((c->ClassID() == BIPSLAVE_CONTROL_CLASS_ID) ||
// (c->ClassID() == BIPBODY_CONTROL_CLASS_ID)
// (c->ClassID() == FOOTPRINT_CLASS_ID))
// {
//
// // Get the Biped Export Interface from the controller
// IBipedExport *BipIface = (IBipedExport *) c->GetInterface(I_BIPINTERFACE);
//
// // Remove the non uniform scale
// BipIface->RemoveNonUniformScale(1);
// // Begin or End figure mode
// BipIface->BeginFigureMode(1);
// BipIface->EndFigureMode(1);
// }
// }
// BipedExport: This class can be returned by calling the method GetInterface() from a Biped controller
// Given controller *c points to a Biped controller, then:
// IBipedExport *BipIface = (IBipedExport *) (c->GetInterface(I_BIPINTERFACE));
// will return the interface for this Biped Controller, else returns NULL.
class IBipedExport
{
public:
BIPExport virtual ~IBipedExport() {}
// For the BipedExport you got from the center of mass (root) controller, send in:
// VERTICAL_SUBANIM, HORIZONTAL_SUBANIM, and ROTATION_SUBANIM
// to get information for those tracks.
// For other BipedExports this method is irrelevant.
// The SetSubAnim method is actually included for future releases,
// when more methods will be added to the IBipedExport class.
// Then you could call these methods for the three center of mass subanims.
// It is not presently useful.
BIPExport virtual void SetSubAnim (int i) {};
// call this from any IBipedExport instance to remove or restore non uniform scaling
BIPExport virtual void RemoveNonUniformScale(BOOL onOFF) {};
// call these to begin and end figure mode
BIPExport virtual void BeginFigureMode(int redraw) {};
BIPExport virtual void EndFigureMode(int redraw) {};
};
#endif

View File

@ -0,0 +1,652 @@
/*********************************************************************
*<
FILE: bipedapi.h
DESCRIPTION: These are functions that are exported in biped.dlc
CREATED BY: Ravi Karra
HISTORY: Created 21 June 1999
Modified July 2002 by Michael Zyracki
*> Copyright (c) 2002 All Rights Reserved.
**********************************************************************/
#ifndef __BIPEDAPI__
#define __BIPEDAPI__
#include "BipExp.h"
// Interfaces -work similarly to the biped export interface
#define I_BIPMASTER 0x9165
#define I_BIPFOOTSTEP 0x9166
#define GetBipMasterInterface(anim) ((IBipMaster*)(anim)->GetInterface(I_BIPMASTER))
#define GetBipFSInterface(anim) ((IBipFootStep*)(anim)->GetInterface(I_BIPFOOTSTEP))
// Biped modes
#define BMODE_FIGURE (1<<0)
#define BMODE_FOOTSTEP (1<<1)
#define BMODE_MOTIONFLOW (1<<2)
#define BMODE_BUFFER (1<<3)
#define BMODE_BENDLINKS (1<<4)
#define BMODE_RUBBERBAND (1<<5)
#define BMODE_SCALESTRIDE (1<<6)
#define BMODE_INPLACE (1<<7)
#define BMODE_INPLACE_X (1<<8)
#define BMODE_INPLACE_Y (1<<9)
#define BMODE_MIXER (1<<10)
#define BMODE_MOVEALL (1<<11)
#define BMODE_ALL (BMODE_FIGURE|BMODE_FOOTSTEP|BMODE_MOTIONFLOW| \
BMODE_BUFFER|BMODE_BENDLINKS|BMODE_RUBBERBAND| \
BMODE_SCALESTRIDE|BMODE_INPLACE|BMODE_MIXER|BMODE_MOVEALL)
// Display settings
#define BDISP_BONES (1<<0)
#define BDISP_OBJECTS (1<<1)
#define BDISP_FOOTSTEPS (1<<2)
#define BDISP_FOOTSTEPNUM (1<<3)
#define BDISP_TRAJ (1<<4)
// Biped Gait Flags
#define WALKGAIT 1
#define RUNGAIT 2
#define JUMPGAIT 3
//Copy/Paste types
#define COPY_POSTURE 0
#define COPY_POSE 1
#define COPY_TRACK 2
// Body types
#define BTYPE_SKELETON 0
#define BTYPE_MALE 1
#define BTYPE_FEMALE 2
#define BTYPE_CLASSIC 3
#define NUMPIVOTS 27 // Max number of pivot points that can exiss for an object
class IBipMaster;
class IMoFlow;
class IMixer;
class MocapManager;
class MixerManager;
class MultFprintParams;
// Create a new biped with the given options
BIPExport IBipMaster* CreateNewBiped(float height, float angle, const Point3& wpos,
BOOL arms=TRUE, BOOL triPelvis=TRUE, int nnecklinks=1, int nspinelinks=4,
int nleglinks=3, int ntaillinks=0, int npony1links=0, int npony2links=0,
int numfingers=5, int nfinglinks=3, int numtoes=5, int ntoelinks=3, float ankleAttach=0.2,
BOOL prop1exists = FALSE,BOOL prop2exists = FALSE, BOOL prop3exists = FALSE,
int forearmTwistLinks = 0);
// The ticks per frame used by the biped (Currently same as GetTicksPerFrame()).
BIPExport int BipGetTicksPerFrame();
#define MB_FSJUMP 0
#define MB_FFMODE 1
#define MB_RCNTFIG 2
bool GetMsgBoxStatus(int which);
void SetMsgBoxStatus(int which, bool hide);
// Global object that contains the Mocap Interface
extern BIPExport MocapManager TheMocapManager;
// Global object that contains the Mixer Interface
extern BIPExport MixerManager TheMixerManager;
//structs for loading and saving subanim controllers in .bip files. post cs4.2 change
//Note that the type is pos = 0, rot = 1, scale = 2
struct SaveSubAnimInfo
{
INode *node;
int type;
};
struct LoadSubAnimInfo
{
TCHAR name[256];
int type;
};
// Interface into the biped master controller
class IBipMaster {
public:
// Track selection, only work when the UI is showing up in command panel. The #defines are in tracks.h
virtual void SetTrackSelection(int track)=0;
virtual int GetTrackSelection()=0;
// File I/O methods
//These functions pop-up the dialog for file selection.
virtual void SaveBipFileDlg() = 0;
virtual void LoadBipFileDlg() = 0;
virtual int SaveFigfile (TCHAR *fname)=0;
virtual int SaveStpfile (TCHAR *fname)=0;
//These functions don't pop-up a dialog for I/O
virtual int SaveBipfile(TCHAR *fname, BOOL SaveListCntrls,BOOL SaveMaxObjects,Tab<SaveSubAnimInfo> *selectedControlers =NULL,
Tab<INode *> *selectedNodes = NULL) = 0;
virtual int SaveBipfileSegment(TCHAR *filenamebuf,int StartSeg,int EndSeg,int SegKeyPerFrame,
BOOL SaveListCntrls, BOOL SaveMaxObjects,Tab<SaveSubAnimInfo> *selectedControlers =NULL,
Tab<INode *> *selectedNodes = NULL) = 0;
virtual int LoadFigfile (TCHAR *fname, BOOL redraw = false, BOOL msgs = false)=0;
virtual int LoadBipStpfile(TCHAR *fname, BOOL redraw, BOOL msgs, BOOL MatchFile = false, BOOL ZeroHgt = false, BOOL loadMaxObjects = false,
BOOL promptForDuplicates = false, BOOL retargetHeight = false, BOOL retargetLimbSizes = false,
BOOL scaleIKObjectSize = false, BOOL loadSubAnimControllers = false,Tab<TCHAR *> *selectedNodes = NULL,
Tab<LoadSubAnimInfo> *selectedControllers = NULL) =0;
virtual int LoadMocapfile (TCHAR *fname, BOOL redraw = false, BOOL msgs = false, BOOL prompt = false)=0;
// General+Modes
virtual BOOL IsCreating()=0; //will return TRUE if creating
virtual void BeginModes(DWORD modes, int redraw=TRUE)=0;
virtual void EndModes(DWORD modes, int redraw=TRUE)=0;
virtual DWORD GetActiveModes()=0;
virtual BOOL CanSwitchMode(DWORD mode)=0; //returns TRUE if we can switch to that mode from our current mode
virtual void ConvertToFreeForm(bool keyPerFrame=false)=0;
virtual void ConvertToFootSteps(bool keyPerFrame=false, bool flattenToZ=true)=0;
// Display properties
virtual DWORD GetDisplaySettings()=0;
virtual void SetDisplaySettings(DWORD disp)=0;
virtual BOOL DoDisplayPrefDlg(HWND hParent)=0;
// Body types
virtual int GetBodyType() =0;
virtual void SetBodyType(int bodytype) =0;
// Anim properties
virtual int GetDynamicsType()=0;
virtual void SetDynamicsType(int dyn)=0;
virtual float GetGravAccel()=0;
virtual void SetGravAccel(float grav)=0;
virtual TCHAR* GetRootName()=0;
virtual void SetRootName(TCHAR *rootname, bool incAll=true)=0;
virtual BOOL GetAdaptLocks(int id)=0;
virtual void SetAdaptLocks(int id, BOOL onOff)=0;
virtual BOOL GetSeparateTracks(int id)=0;
virtual void SeparateTracks(int id, BOOL separate)=0;
virtual void SetBodySpaceNeckRotation(BOOL val)=0;
virtual BOOL GetBodySpaceNeckRotation()=0;
// Structure properties
virtual BOOL GetHasArms()=0;
virtual void SetHasArms(BOOL arms)=0;
virtual int GetNumLinks(int keytrack)=0;
virtual void SetNumLinks(int keytrack, int n)=0;
virtual int GetNumFingers()=0;
virtual void SetNumFingers(int n)=0;
virtual int GetNumToes()=0;
virtual void SetNumToes(int n)=0;
virtual float GetAnkleAttach()=0;
virtual void SetAnkleAttach(float aa)=0;
virtual float GetHeight()=0;
virtual void SetHeight(float h, BOOL KeepFeetOnGround = TRUE)=0;
virtual BOOL GetTrianglePelvis()=0;
virtual void SetTrianglePelvis(BOOL tri)=0;
virtual BOOL GetProp1Exists()=0;
virtual void SetProp1Exists(BOOL prop)=0;
virtual BOOL GetProp2Exists()=0;
virtual void SetProp2Exists(BOOL prop)=0;
virtual BOOL GetProp3Exists()=0;
virtual void SetProp3Exists(BOOL prop)=0;
// mocap params
virtual BOOL ConvertFromBuffer()=0;
virtual BOOL PasteFromBuffer()=0;
virtual BOOL GetDispBuffer()=0;
virtual void SetDispBuffer(BOOL onOff)=0;
virtual BOOL GetDispBufferTraj()=0;
virtual void SetDispBufferTraj(BOOL onOff)=0;
virtual BOOL GetTalentFigMode()=0;
virtual void SetTalentFigMode(BOOL onOff)=0;
virtual void AdjustTalentPose()=0;
virtual void SaveTalentFigFile(TCHAR *fname)=0;
virtual void SaveTalentPoseFile(TCHAR *fname)=0;
// footstep creation/operations
virtual BOOL GetFSAppendState()=0;
virtual void SetFSAppendState(BOOL onOff)=0;
virtual BOOL GetFSInsertState()=0;
virtual void SetFSInsertState(BOOL onOff)=0;
virtual int GetGaitMode()=0;
virtual void SetGaitMode(int mode)=0;
virtual int GetGroundDur()=0;
virtual void SetGroundDur(int val)=0;
virtual int GetAirDur()=0;
virtual void SetAirDur(int val)=0;
virtual void DoMultipleFSDlg()=0;
virtual int AddFootprint(Point3 pos, float dir, Matrix3 mtx, int appendFS)=0;
virtual void AddFootprints(MultFprintParams *Params)=0;
virtual void NewFprintKeys()=0;
virtual void BendFootprints(float angle)=0;
virtual void ScaleFootprints(float scale)=0;
// motion flow interface
virtual IMoFlow* GetMoFlow()=0;
virtual void UnifyMotion()=0;
virtual TCHAR* GetClipAtTime(TimeValue t)=0; //returns the current clip
// mixer interface
virtual IMixer* GetMixer()=0;
// IK objects
//this set's the ik object for the current selected body part
virtual void SetAttachNode(INode *node)=0;
virtual INode* GetAttachNode()=0;
//head target
virtual void SetHeadTarget(INode *node)=0;
virtual INode * GetHeadTarget() =0;
// Anim,controls,nodes....
virtual bool IsNodeDeleted()=0; //test to see if the interface's node has been deleted.
virtual Interval GetCurrentRange()=0;
virtual int GetMaxNodes()=0;
virtual int GetMaxLinks()=0;
virtual INode* GetNode(int id, int link=0)=0;
virtual BOOL GetIdLink(INode *node, int &id, int &link)=0;
virtual Control * GetHorizontalControl()=0;
virtual Control * GetVerticalControl()=0;
virtual Control * GetTurnControl()=0;
//get set keys and transforms. (in world space)
virtual void SetBipedKey(TimeValue t,INode *node = NULL, BOOL setHor = TRUE, BOOL setVer = TRUE,BOOL setTurn = TRUE)=0;
virtual void SetPlantedKey(TimeValue t,INode *node = NULL)=0;
virtual void SetSlidingKey(TimeValue t,INode *node = NULL)=0;
virtual void SetFreeKey(TimeValue t,INode *node = NULL)=0;
virtual ScaleValue GetBipedScale(TimeValue t, INode *node)=0;
virtual Point3 GetBipedPos(TimeValue t, INode *node)=0;
virtual Quat GetBipedRot(TimeValue t, INode *node,BOOL local = FALSE)=0;
//note that this set's a relative scale!
virtual void SetBipedScale(BOOL relative,const ScaleValue &scale, TimeValue t, INode *node)=0;
virtual void SetBipedPos(const Point3 &p, TimeValue t, INode *node,BOOL setKey =TRUE)=0;
virtual void SetBipedRot(const Quat &q, TimeValue t, INode *node,BOOL setKey = TRUE)=0;
virtual void SetMultipleKeys()=0;
virtual void DoSetMultipleKeysDlg()=0;
//reset's the limb ik pivots. useful when using subanim scale and there's some wierdness like sub-frame popping.
virtual void ResetAllLimbKeys() = 0;
//collapse the move all mode down
virtual void CollapseMoveAllMode(BOOL msg) =0;
//Biped Internal structures get/sets. These functions deal with internal biped structures and hierarchy.
virtual INode* GetRotParentNode(int id,int link)=0; //the parent node where the rotation is inherited from
virtual INode* GetPosParentNode(int id,int link)=0; //the parent node where the position is inherited from
virtual Quat GetParentNodeRot(TimeValue t,int id,int link)=0; //rotation value of the parent
virtual Point3 GetParentNodePos(TimeValue t,int id,int link)=0; //position value of the parent.
virtual void GetClavicleVals(TimeValue t, int id, float &val1,float &val2)=0; //this is valid for KEY_RARM & KEY_LARM or
virtual void GetHingeVal(TimeValue t,int id, float &val)=0; //this is valid for KEY_RARM & KEY_LARM & KEY_RLEG & KEY_LLEG. it get's the elbow/knee angle
virtual void GetHorseAnkleVal(TimeValue, int id, float &val)=0; //this is valid only if you have a horse leg and KEY_RLEG and KEY_LLEG
virtual void GetPelvisVal(TimeValue t, float &val) =0; //get's the pelvis angle
virtual void GetFingerVal(TimeValue t,int id,int link, float &val) = 0;//get the finger rotation value for the finger segements with 1 DOF
virtual BOOL GetIKActive(TimeValue t,int id) = 0;//Fuction to see if a biped limb is effect by ik at a particular time
// Layers.
virtual int NumLayers()=0;
virtual void CreateLayer(int index, TCHAR* name)=0;
virtual void DeleteLayer(int index)=0;
virtual bool CollapseAtLayer(int index)=0; //only works if all layers under this layer are active, returns true if successul
virtual bool GetLayerActive(int index)=0;
virtual void SetLayerActive(int index, bool onOff)=0;
virtual TCHAR* GetLayerName(int index)=0;
virtual void SetLayerName(int index, TCHAR* name)=0;
virtual int GetCurrentLayer()=0;
virtual void SetCurrentLayer(int index)=0;
virtual void UpdateLayers()=0; // need to call this after changes made to layers
virtual void SetSnapKey(TimeValue t,INode *node = NULL)=0;
//layer display info
virtual int GetVisibleBefore()=0;
virtual void SetVisibleBefore(int val)=0;
virtual int GetVisibleAfter()=0;
virtual void SetVisibleAfter(int val)=0;
virtual bool GetKeyHighlight()=0;
virtual void SetKeyHighlight(bool onOff)=0;
// preferred clips for use with biped crowd.
virtual void ClearPreferredClips()=0;
virtual bool AddPreferredClip(TCHAR *clipname, int prob = 100)=0;
virtual bool DeletePreferredClip(TCHAR *clipname)=0;
virtual int IsPreferredClip(TCHAR *clipname)=0;
virtual TCHAR* GetCurrentClip()=0;
virtual int NumPreferredClips()=0;
virtual TCHAR* GetPreferredClip(int i)=0;
virtual int GetPreferredClipProbability(int i)=0;
//Biped Subanims
virtual bool GetEnableSubAnims()=0;
virtual void SetEnableSubAnims(bool onOff)=0;
virtual bool GetManipSubAnims()=0;
virtual void SetManipSubAnims(bool onOff)=0;
//Trackbar stuff //this is post CS4.2
virtual bool GetShowAllTracksInTV()=0;
virtual void SetShowAllTracksInTV(bool onOff)=0;
//doesn't workvirtual bool GetShowSubanimInTrackBar()=0;
//virtual void SetShowSubanimInTrackBar(bool onOff)=0;
virtual bool GetShowBipedInTrackBar()=0;
virtual void SetShowBipedInTrackBar(bool onOff)=0;
virtual void Mirror() =0;
virtual void ClearAllAnimation() =0;
virtual void ClearSelectedAnimation() =0;
//These functions will clone the 'controlToClone' control and put it in each appropiate BipedSubAnim::List,
//and make that control the active control. If 'checkIfOneExists' is TRUE it will first check to see
//if a controller of the same type already exists in the subanim list, in which case it will just
//set that one as active,and not clone a new one.
virtual void CreatePosSubAnims(Control *controlToClone, BOOL checkIfOneExists)=0;
virtual void CreateRotSubAnims(Control *controlToClone, BOOL checkIfOneExists)=0;
virtual void CreateScaleSubAnims(Control *controlToClone, BOOL checkIfOneExists)=0;
//these functions Set a key for the appropiate active controller in the list controller for the
//specified node. If 'absolute' is true the value used to set the key is the total combined value
//of the underlying biped value plus the subanim value. Thus the subanim value will be calculating
//by subtracting out the biped value. If 'absolute' is false the value is the exact subanim key value
//that will be set. Due to the limitation in defining a global 'biped scale', the scale type of this
//function has no absolute parameter and always just sets the key with the specified value
virtual void SetPosSubAnim(const Point3 &p, TimeValue t, INode *node,BOOL absolute)=0;
virtual void SetRotSubAnim(const Quat &q, TimeValue t, INode *node,BOOL absolute) = 0;
virtual void SetScaleSubAnim(const ScaleValue &s, TimeValue t, INode *node) = 0;
//these function calls collapse the specified subAnims..
virtual void CollapseAllPosSubAnims(BOOL perFrame,BOOL keep) = 0;
virtual void CollapseAllRotSubAnims(BOOL perFrame,BOOL keep) = 0;
virtual void CollapseRotSubAnims(BOOL perFrame,BOOL keep,INode *node) = 0;
virtual void CollapsePosSubAnims(BOOL perFrame,BOOL keep,INode *node) = 0;
//Copy/Paste exposure
virtual char * CopyPosture(int copyType,BOOL copyHor,BOOL copyVer,BOOL copyTurn) = 0;
virtual BOOL PastePosture(int copyType,int opposite,char *name) = 0;
virtual void DeleteAllCopies(int copyType, BOOL holdIt = true) = 0;
virtual int NumCopies(int copyType) = 0;
virtual void DeleteCopy(int copyType,char *name) = 0;
virtual TCHAR *GetCopyName(int copyType,int which) = 0;
virtual void SetCopyName(int copyType,int oldIndex, char *newName) = 0;
virtual BOOL SaveCopyPasteFile(char *fname) = 0;
virtual BOOL LoadCopyPasteFile(char *fname) = 0;
};
//Interface to the biped footstep
class IBipFootStep
{
public:
virtual void SetFreeFormMode(BOOL mode)=0;
virtual BOOL GetFreeFormMode()=0;
virtual void SetDispNumType(int type)=0;
virtual int GetDispNumType()=0;
virtual void SetDispAirDur(BOOL onOff)=0;
virtual BOOL GetDispAirDur()=0;
virtual void SetDispNoSupport(BOOL onOff)=0;
virtual BOOL GetDispNoSupport()=0;
virtual void UpdateEditTrackUI()=0;
virtual void UpdateFootSteps(TimeValue t){}
};
// defines for mocap key reduction settings
#define KRS_ALL 0
#define KRS_HORZ 1
#define KRS_VERT 2
#define KRS_ROT 3
#define KRS_PLV 4
#define KRS_SPN 5
#define KRS_NCK 6
#define KRS_LARM 7
#define KRS_RARM 8
#define KRS_LLEG 9
#define KRS_RLEG 10
#define KRS_TAIL 11
// defines for mocap GetLimbOrientation/SetLimbOrientation
#define LIMB_KNEE 0
#define LIMB_ELBOW 1
#define LIMB_FOOT 2
#define LIMB_HAND 3
#define ANGLE_ALIGN 0
#define POINT_ALIGN 1
#define AUTO_ALIGN 2
//The mocap manager class.
class MocapManager {
public:
// import dialog properties
BIPExport TCHAR* GetTalentFigStrucFile();
BIPExport void SetTalentFigStrucFile(const TCHAR *fname);
BIPExport BOOL GetUseTalentFigStrucFile() const;
BIPExport void SetUseTalentFigStrucFile(BOOL onOff);
BIPExport TCHAR* GetTalentPoseAdjFile() const;
BIPExport void SetTalentPoseAdjFile(const TCHAR *fname);
BIPExport BOOL GetUseTalentPoseAdjFile() const;
BIPExport void SetUseTalentPoseAdjFile(BOOL onOff);
BIPExport int GetFSExtractionMode() const;
BIPExport void SetFSExtractionMode(int mode);
BIPExport int GetFSConversionMode() const;
BIPExport void SetFSConversionMode(int mode);
// 0 - x, 1 - y, 2 - z
BIPExport int GetUpVector() const;
BIPExport void SetUpVector(int axis);
BIPExport float GetScaleFactor() const;
BIPExport void SetScaleFactor(float val);
BIPExport float GetFSExtractionTol() const;
BIPExport void SetFSExtractionTol(float val);
BIPExport float GetFSSlidingDist() const;
BIPExport void SetFSSlidingDist(float val);
BIPExport float GetFSSlidingAngle() const;
BIPExport void SetFSSlidingAngle(float val);
BIPExport float GetFSVerticalTol() const;
BIPExport void SetFSVerticalTol(float val);
BIPExport float GetFSZLevel() const;
BIPExport void SetFSZLevel(float val);
BIPExport BOOL GetFSUseVerticalTol() const;
BIPExport void SetFSUseVerticalTol(BOOL val);
BIPExport BOOL GetFSUseFlatten() const;
BIPExport void SetFSUseFlatten(BOOL val);
BIPExport int GetStartFrame() const;
BIPExport void SetStartFrame(int val);
BIPExport int GetEndFrame() const;
BIPExport void SetEndFrame(int val);
BIPExport BOOL GetUseLoopFrame() const;
BIPExport void SetUseLoopFrame(BOOL val);
BIPExport int GetLoopFrameCount() const;
BIPExport void SetLoopFrameCount(int val);
BIPExport float GetKeyReductionTol(int part) const;
BIPExport void SetKeyReductionTol(int part, float val);
BIPExport int GetKeyReductionSpacing(int part) const;
BIPExport void SetKeyReductionSpacing(int part, float val);
BIPExport BOOL GetKeyReductionFilter(int part) const;
BIPExport void SetKeyReductionFilter(int part, BOOL onOff);
BIPExport int GetLimbOrientation(int limb) const;
BIPExport void SetLimbOrientation(int limb, int val);
BIPExport int LoadMocapParameters(const TCHAR *fname);
BIPExport int SaveMocapParameters(const TCHAR *fname);
// marker name dialog
BIPExport TCHAR* GetMarkerNameFile() const;
BIPExport bool LoadMarkerNameFile(const TCHAR *fname);
BIPExport BOOL GetUseMarkerNameFile() const;
BIPExport void SetUseMarkerNameFile(BOOL onOff);
BIPExport TCHAR* GetJointNameFile() const;
BIPExport bool LoadJointNameFile(const TCHAR *fname);
BIPExport BOOL GetUseJointNameFile() const;
BIPExport void SetUseJointNameFile(BOOL onOff);
BIPExport int BatchConvert(TCHAR* inDir, TCHAR* outDir, TCHAR* ext);
BIPExport BOOL GetDispKnownMarkers() const;
BIPExport void SetDispKnownMarkers(BOOL onOff);
BIPExport int GetDispKnownMarkersType() const; // 0 - Sel objects, 1 - all
BIPExport void SetDispKnownMarkersType(int type); // 0 - Sel objects, 1 - all
BIPExport BOOL GetDispUnKnownMarkers() const;
BIPExport void SetDispUnKnownMarkers(BOOL onOff);
BIPExport BOOL GetDispPropMarkers() const;
BIPExport void SetDispPropMarkers(BOOL onOff);
};
//The mixer manager class.
class MixerManager {
public:
BIPExport BOOL GetSnapFrames();
BIPExport void SetSnapFrames(BOOL onOff);
BIPExport BOOL GetShowTgRangebars();
BIPExport void SetShowTgRangebars(BOOL onOff);
BIPExport BOOL GetShowWgtCurves();
BIPExport void SetShowWgtCurves(BOOL onOff);
BIPExport BOOL GetShowTimeWarps();
BIPExport void SetShowTimeWarps(BOOL onOff);
BIPExport BOOL GetShowClipBounds();
BIPExport void SetShowClipBounds(BOOL onOff);
BIPExport BOOL GetShowGlobal();
BIPExport void SetShowGlobal(BOOL onOff);
BIPExport BOOL GetShowClipNames();
BIPExport void SetShowClipNames(BOOL onOff);
BIPExport BOOL GetShowClipScale();
BIPExport void SetShowClipScale(BOOL onOff);
BIPExport BOOL GetShowTransStart();
BIPExport void SetShowTransStart(BOOL onOff);
BIPExport BOOL GetShowTransEnd();
BIPExport void SetShowTransEnd(BOOL onOff);
BIPExport BOOL GetShowBalance();
BIPExport void SetShowBalance(BOOL onOff);
BIPExport BOOL GetSnapToClips();
BIPExport void SetSnapToClips(BOOL onOff);
BIPExport BOOL GetLockTransitions();
BIPExport void SetLockTransitions(BOOL onOff);
BIPExport void SetAnimationRange();
BIPExport void ZoomExtents();
BIPExport void UpdateDisplay();
BIPExport void AddBipedToMixerDisplay(IBipMaster *mc);
BIPExport void RemoveBipedFromMixerDisplay(IBipMaster *mc);
BIPExport void ShowMixer();
BIPExport void HideMixer();
};
// Base Biped Key. For pelvis, spine, neck, tail, pony1, pony2 keys
class IBipedKey : public IKey {
public:
float tens, cont, bias, easeIn, easeOut;
int type;
};
// Biped COM Vertical Key
class IBipedVertKey : public IBipedKey {
public:
float z, dynBlend, ballTens;
};
// Biped COM Horizontal Key
class IBipedHorzKey : public IBipedKey {
public:
float x, y, balFac;
};
// Biped COM Turn Key
class IBipedTurnKey : public IBipedKey {
public:
Quat q;
};
// Biped Body Key for the Arm and Leg Keys. contains ik blend and pivot point info.
// IK spaces
#define BODYSPACE 0
#define WORLDSPACE 1 // Currently not valid
#define OBJECTSPACE 2
class IBipedBodyKey : public IBipedKey {
public:
float ik_blend,
ik_ankle_ten;
int ik_space,
ik_joined_pivot,
ik_pivot_index,
ik_num_pivots;
Point3 ik_pivot_pts[NUMPIVOTS];
};
// Biped Head Key
class IBipedHeadKey : public IBipedKey {
public :
float head_blend;
};
// Biped Prop Key
#define WORLD_PROP 0
#define BODY_PROP 1
#define RHAND_PROP 2
#define LHAND_PROP 3
class IBipedPropKey : public IBipedKey {
public:
int pos_space;
int rot_space;
};
//Biped FootStep Key
#define FS_LSEL (1<<0)
#define FS_RSEL (1<<1)
#define FS_LFT 1
#define FS_RGT 0
class IBipedFSKey : public IKey {
public:
DWORD edgeSel;
BOOL active;
Matrix3 mat;
int side; // LFT, RGT
TimeValue duration;
};
// Multiple footstep params. One will be created to store each gait's paramters (walk, run, jump)
class MultFprintParams {
public:
int numnewfprints;
float aswid;
float pswid;
float aslen;
float pslen;
float ashgt;
int cycle;
float aslen2;
float pslen2;
float ashgt2;
int cycle2;
int AutoTiming;
int InterpTiming;
int Alternate;
int MultiInsertInTime;
MultFprintParams(int gait) {init(gait);}
BIPExport void init(int gait);
};
// returns multiple footsteps parameters for different types of gaits (walk, run, jump)
BIPExport MultFprintParams* GetMultFprintParams(int gait);
// Start Left/Start Right radio buttons in "Create Mutliple Footsteps Dialog"
BIPExport int GetFSAddSide();
BIPExport void SetFSAddSide(int side);
#endif // __BIPEDAPI__

395
lib/maxsdk70/include/CS/IMixer.h Executable file
View File

@ -0,0 +1,395 @@
/**********************************************************************
*<
FILE: IMixer.h
DESCRIPTION: Mixer classes
CREATED BY: Susan Amkraut
HISTORY: created summer 2000
*> Copyright (c) 2000, All Rights Reserved.
**********************************************************************/
/**********************************************************************
UPDATING THE MIXER:
Many of the mixer functions cause changes to the raw mix .
If you call a function or functions which would change the raw mix,
then in order to see biped perform the updated raw mix, you must call:
IMixer::InvalidateRawMix();
If you call a function which changes the arrangement of clips in a
transition track, then to update the display and computation of that
track, you may have to call:
IMXtrack::ComputeTransClips();
It's possible this may have been called for you, depending on what you did.
But if you encounter any incomplete updates, call this.
Most of the mixer SDK works the same way as the mixer user interface.
There are a few exceptions. The user interface does not allow the user to overlap clips.
But some SDK functions make it possible to overlap clips. This is not advisable.
All mixer SDK functions take into account the snap to frames variable
as well as the lock transitions variable, both settable in the SDK.
They do not, however, take into account the snap to clips variable,
both for technical reasons and because this is more of a user interface feature.
************************************************************************/
#ifndef __IMIXER__
#define __IMIXER__
#include "BipExp.h"
#include "keytrack.h"
// track types
#define TRANSTRACK 1
#define LAYERTRACK 2
// transition track levels
#define TOP_ROW 1
#define BOT_ROW 2
// transition focus types
#ifndef FOCUS_AUTO // these are in imoflow.h as well
#define FOCUS_AUTO 0
#define FOCUS_COM 1
#define FOCUS_LFOOT 2
#define FOCUS_RFOOT 3
#define FOCUS_BFEET 4
#endif
// load options
#define RE_SOURCE_CLIP_ONLY 1
#define RE_SOURCE_INSTANCES 2
#define RE_SOURCE_FILEGROUP 3
// Animation Fit Options
#define FIT_ANIM_TO_CLIP 1
#define FIT_CLIP_TO_ANIM 2
#define TRIM_ANIM_TO_CLIP 3
// forward definition
class IMixer;
class IMXclip
{
public:
//**************** timing ***********************
// The original bounds are the time boundaries of the file loaded into the clip.
// These bounds never change unless a new file is loaded into the clip.
virtual void GetOriginalBounds(int *orgstart, int *orgend)=0;
//
// The trimmed bounds are the trimmed boundaries of the clip.
// They are the same as or a subregion of the original bounds.
// These values do not change when you scale a clip.
// These boundaries are visible in the mixer when you are in trim mode.
virtual void GetTrimBounds(int *trimstart, int *trimend)=0;
// This also trims the weight curve and time warp appropriately
// trimstart and trimend must be within the original bounds
virtual void SetClipTrim(int trimstart, int trimend)=0;
//
// The global bounds indicate where the trimmed bounds of the clip are mapped globally.
// The clip's scale is defined by the relationship between the trimmed interval (trimend - trimstart)
// and the global interval (globend - globstart). If those intervals are equal, the clip's scale is 1.
virtual void GetGlobalBounds(int *globstart, int *globend)=0;
// globstart must be less than globend.
// If not, these return false and do nothing. Otherwise these return true.
// Setting these is like pulling one edge of the clip. It actually scales the clip.
// This also scales the weight curve, time warp, and the in/out points appropriately
virtual BOOL SetClipGlobalStart(int globstart)=0;
virtual BOOL SetClipGlobalEnd(int globend)=0;
//
virtual void MoveClip(int timeInc)=0;
//
// These also scale the weight curve, time warp, and the in/out points appropriately
virtual void ScaleClip(float scale)=0;
virtual void SetClipScale(float scale)=0;
//**************** timing conversion ***********************
// The following functions are useful for converting between various time spaces described below:
//
// local: a time between trimstart and trimend, inclusive
//
// scaled local: a time between 0 and the length of the scaled clip, which can be found this way:
// GetGlobalBounds(&g1,&g2); int length = g2 - g1;
//
// global: a global time value
//
virtual float GetClipScale()=0;
virtual int LocalToScaledLocal(int t)=0;
virtual int ScaledLocalToLocal(int t)=0;
virtual int LocalToGlobal(int t)=0;
virtual int GlobalToLocal(int t)=0;
virtual int GlobalToScaledLocal(int t)=0;
virtual int ScaledLocalToGlobal(int t)=0;
virtual int GlobalInpoint()=0;
virtual int GlobalOutpoint()=0;
//**************** transitions ***********************
// Transition information is stored in each clip, whether it is currently a valid clip in a transition track or not.
// A clip stores mostly information for the transition from itself to the next clip.
// It also stores some information for the transition from the previous clip to itself.
//
// Inpoints and outpoints are stored and set in the clip's scaled local time.
//
// Preserve Height is stored inside each track, not inside individual clips.
//
// The best way to manipulate transition values in a transition track is to loop through the clips
// in sequential transition order by using the following IMXtrack functions described in IMXtrack:
// ComputeTransClips()
// NumTransClips()
// GetTransClip(int index)
//
// The inpoint must be greater than the outpoint.
// The inpoint must be less than the scaled local trimmed end.
// If you try to set the inpoint out of bounds, it will not be set and the function will return false.
// Otherwise, the inpoint will be set and the function will return true.
virtual int GetNextTransitionInpoint()=0;
virtual BOOL SetNextTransitionInpoint(int inpt)=0;
//
virtual float GetNextTransitionAngle()=0;
virtual void SetNextTransitionAngle(float angle)=0;
//
// When setting the focus, if the value sent in is acceptable (FOCUS_AUTO, FOCUS_COM, FOCUS_LFOOT, FOCUS_RFOOT)
// then the focus will be set, and the function will return true.
// Otherwise, the focus will not be set, and the function will return false.
virtual int GetNextTransitionFocus()=0; // returns one of the following: FOCUS_AUTO, FOCUS_COM, FOCUS_LFOOT, FOCUS_RFOOT, FOCUS_BFEET
virtual BOOL SetNextTransitionFocus(int focus)=0;
//
virtual BOOL IsNextTransitionRolling()=0;
virtual void SetNextTransitionRolling()=0;
virtual void SetNextTransitionFixed()=0;
//
// Each ease value, and the sum of the ease values, must be between 0.0 and 1.0, inclusive.
// If not, the set function will not set the values and it will return false.
virtual void GetNextTransitionEase(float *easeIn, float *easeOut)=0;
virtual BOOL SetNextTransitionEase(float easeIn, float easeOut)=0;
//
// Inpoints and outpoints are stored and set in the clip's scaled local time.
// The outpoint must be less than the inpoint.
// The outpoint must be greater than the scaled local trimmed start.
// If you try to set an outpoint out of bounds, it will not be set and the function will return false.
// Otherwise, the outpoint will be set and the function will return true.
virtual int GetPrevTransitionOutpoint()=0;
virtual BOOL SetPrevTransitionOutpoint(int outpt)=0;
//
virtual BOOL IsPrevTransitionRolling()=0;
virtual void SetPrevTransitionRolling()=0;
virtual void SetPrevTransitionFixed()=0;
//***************** clip animation file **************************
// Do not change the returned string.
// Copy the string into another string if you need to manipulate it.
virtual TCHAR *GetFilename()=0;
// LoadOption must be one of the following: RE_SOURCE_CLIP_ONLY, RE_SOURCE_INSTANCES, RE_SOURCE_FILEGROUP
// RE_SOURCE_CLIP_ONLY: the file will be loaded into just this single clip
// RE_SOURCE_INSTANCES: the file will be loaded into this clip and all instances of this clip
// RE_SOURCE_FILEGROUP: the file will be loaded into this clip and all instances and adaptations of this clip
virtual BOOL LoadFile(int LoadOption, TCHAR *fname, BOOL ZeroFootHgt)=0;
//***************** weight curve **************************
// The weight curve for a clip is only relevant if the clip is in a layer track
// All time values are in the clip's scaled local time (see note above about the meaning of scaled local time)
virtual int NumWeights()=0;
virtual float GetWeight(int i)=0; // returns weight at index i, if i is out of bounds, returns 0.0
virtual int GetWeightTime(int i)=0; // returns time at index i, if i is out of bounds, returns 0
virtual BOOL DeleteWeight(int i)=0; // returns false if i is out of bounds
virtual BOOL SetWeight(int i, float w)=0; // returns false if i is out of bounds, or weight is not between 0.0 and 1.0
virtual BOOL SetWeightTime(int i, int t)=0; // returns false if i is out of bounds or time is not inbetween prevoius and next time
// If t is at a key in the weight curve, this returns the weight at that key.
// Otherwise, it returns the interpolated weight at time t.
// If there are no weights, this returns 1.0.
virtual float GetWeightAtTime(int t)=0;
// If there is a key at time t on the weight curve, this will reset the weight at that key.
// If not, this will create a new key at time t with weight w.
// Be sure that t is within the scaled local bounds of the clip.
virtual int SetWeightAtTime(int t, float w)=0;
//***************** time warp **************************
// All time values are in the clip's scaled local time (see note above about the meaning of scaled local time)
virtual BOOL IsTimeWarpActive()=0;
virtual BOOL ActivateTimeWarp()=0;
virtual BOOL DeactivateTimeWarp()=0;
// Removes all existing time warps, activates time warp,
// and initializes with one warp at the begining and one at the end of the clip
virtual BOOL InitializeTimeWarp()=0;
virtual int NumTimeWarps()=0;
virtual TimeValue GetTwOrgTime(int i)=0; // returns original time at index i, if i is out of bounds, returns 0
virtual TimeValue GetTwWarpTime(int i)=0;// returns warped time at index i, if i is out of bounds, returns 0
virtual TimeValue GetOrgTimeAtWarpedTime(TimeValue t)=0; // returns what original time has been warped to this time
// if t is out of bounds of the warped time, returns 0
virtual TimeValue GetWarpedTimeAtOrgTime(TimeValue t)=0; // returns what this original time has been warped to
// if t is out of bounds of the original time, returns 0
virtual BOOL DeleteTw(int i)=0; // returns false if i is out of bounds
virtual BOOL SetTwOrgTime(int i, TimeValue t)=0;// returns false if i is out of bounds or t is not inbetween
// the two original times of the warp indices surrounding i
virtual BOOL SetTwWarpTime(int i, TimeValue t)=0;// returns false if i is out of bounds or t is not inbetween
// the two warped times of the warp indices surrounding i
// if t is at an existing warp key's original time value, or t is out of bounds of the clip's scaled local bounds,
// then this returns false. Otherwise it sets a new time warp key, computing the warped time for this key such
// that the flow is continuous
virtual BOOL InsertWarpAtOrgTime(TimeValue t)=0;
};
class IMXtrack
{
public:
virtual int NumClips(int row)=0;
virtual IMXclip *GetClip(int index, int row = BOT_ROW)=0; // For layer tracks, row should always be BOT_ROW
virtual int GetTrackType()=0; // returns LAYERTRACK or TRANSTRACK
virtual void SetTrackType(int toType)=0; // must be set to LAYERTRACK or TRANSTRACK
virtual BOOL GetMute()=0;
virtual BOOL SetMute(BOOL val)=0;
virtual BOOL GetSolo()=0;
virtual BOOL SetSolo(BOOL val)=0;
virtual void GetInterval(Interval& iv)=0; // gets the total time interval of the track, including all clips
virtual void Clear()=0;
// The specified bip file will be loaded into the new clip, and the reservoir, using the ZeroFootHeight parameter.
// For layer tracks, the start of the new clip will be appended interval time from the end of the last clip in the track.
// The interval variable must be >= 0.
// For transition tracks, the interval parameter is ignored. The start of the new clip will be at
// the inpoint of the last clip in the track, and it will be on the opposite row of the last clip.
// It will start later if it collides with another clip. For both layer and transition tracks,
// if there are no clips in the track, the new clip will start at frame 0. This returns false if
// the specified file could not be loaded. Otherwise, it returns true.
virtual BOOL AppendClip(TCHAR *fname, BOOL ZeroFootHeight = true, int interval = 5)=0;
/******************** transition track functions (not for layer tracks) **************************/
// If any of these functions are called for layer tracks, they will return false and do nothing.
// The track must be a transition track.
//
virtual BOOL IsHeightPreservedDuringTransitions()=0;
virtual BOOL SetTransPreserveHeight(BOOL val)=0;
// PreferredTransLength and the search ranges must be positive values. They are in frames.
// If they are negative values, the optimization will not be performed and the function will return false.
// Otherwise, the function will return true/false describing whether or not it was successful.
// If optimization requires clips to be trimmed to avoid visual overlap, then they will be trimmed.
virtual BOOL OptimizeTransitions(int PreferredTransLength, BOOL SearchEntireClip, int SearchRangeBefore, int SearchRangeAfter)=0;
// See notes above.
// The ClipIndex is an index into the tracks's trans clips.
// If the ClipIndex is out of range of the trans clips, the optimization will not be performed and the function will return false.
virtual BOOL OptimizeClipsNextTransition(int PreferredTransLength, BOOL SearchEntireClip, int SearchRangeBefore, int SearchRangeAfter, int ClipIndex)=0;
// The following three functions provide a way of looping through the clips in a transition track in
// sequential order, based on how they transition from one to another, regardless of what row they are in.
// A greyed out clip will not be included in the transclips, since it is not part of the series of transitions.
// If you change ANYTHING in a transition track (clip timiing, transition timing or parameters),
// then you must call ComputeTransClips before looping through the trans clips
virtual void ComputeTransClips()=0;
virtual int NumTransClips()=0;
virtual IMXclip *GetTransClip(int index)=0;
//***************** weight curve **************************
// The weight curve for a track is only relevant if the track is a transition track
virtual int NumWeights()=0;
virtual float GetWeight(int i)=0; // returns weight at index i, if i is out of bounds, returns 0.0
virtual int GetWeightTime(int i)=0; // returns time at index i, if i is out of bounds, returns 0
virtual BOOL DeleteWeight(int i)=0; // returns false if i is out of bounds
virtual BOOL SetWeight(int i, float w)=0; // returns false if i is out of bound, or weight is not between 0.0 and 1.0
virtual BOOL SetWeightTime(int i, int t)=0; // returns false if i is out of bounds or time is not inbetween prevoius and next time
// If t is at a key in the weight curve, this returns the weight at that key.
// Otherwise, it returns the interpolated weight at time t.
// If there are no weights, this returns 1.0.
virtual float GetWeightAtTime(int t)=0;
// If there is a key at time t on the weight curve, this will reset the weight at that key.
// If not, this will create a new key at time t with weight w.
// If this weight curve belongs to a clip, you need to make sure that t is within the
// scaled local bounds of the clip. (see note below about the meaning of scaled local)
virtual int SetWeightAtTime(int t, float w)=0;
};
class IMXtrackgroup
{
public:
virtual int NumTracks()=0;
virtual IMXtrack *GetTrack(int index)=0;
virtual TCHAR *GetName()=0;
virtual BOOL SetName(TCHAR *str)=0;
// the index for the following two filter functions must be one of the follwing track id's defined in track.h:
// KEY_LARM, KEY_RARM, KEY_LHAND, KEY_RHAND, KEY_LLEG, KEY_RLEG, KEY_LFOOT, KEY_RFOOT, KEY_SPINE, KEY_TAIL, KEY_HEAD,
// KEY_PELVIS, KEY_VERTICAL, KEY_HORIZONTAL, KEY_TURN, KEY_NECK, KEY_PONY1, KEY_PONY2, KEY_PROP1, KEY_PROP2, KEY_PROP3,
virtual BOOL GetFilter(int index)=0;
virtual BOOL SetFilter(int index, int val)=0;
virtual void Clear()=0; // removes all clips from the trackgroup
virtual BOOL InsertTrack(int index, int tracktype)=0;
// gets the total time interval of the trackgroup, including all tracks
virtual BOOL DeleteTrack(int index)=0;
virtual void GetInterval(Interval& iv)=0;
};
class IMixer
{
public:
//**************** trackgroups ***********************
virtual int NumTrackgroups()=0;
virtual IMXtrackgroup *GetTrackgroup(int index)=0;
virtual BOOL InsertTrackgroup(int index)=0;
virtual BOOL DeleteTrackgroup(int index)=0;
//**************** mixer ***********************
virtual float GetBalancePropagation()=0; // between 0.0 and 1.0
virtual BOOL SetBalancePropagation(float val)=0;
virtual float GetBalanceLateralRatio()=0; // between 0.0 and 1.0
virtual BOOL SetBalanceLateralRatio(float val)=0;
virtual BOOL GetBalanceMute()=0;
virtual BOOL SetBalanceMute(BOOL val)=0;
virtual BOOL IsPerformingMixdown()=0; // if this returns false, the biped is performing a raw mix
virtual void InvalidateRawMix()=0;
virtual void EffectRawMix()=0;
virtual void EffectMixdown()=0;
// ContinuityRange between 0 and 100, MaxKneeAngle between 0.0 and 180.0
virtual BOOL Mixdown(BOOL KeyPerFrame, BOOL EnforceIkConstraints, int ContinuityRange, BOOL FilterHyperExtLegs, float MaxKneeAngle)=0;
virtual void CopyClipSourceToBiped(IMXclip *iCP)=0;
virtual void CopyMixdownToBiped()=0; // This will only work if a mixdown exists
virtual BOOL LoadMixFile(TCHAR *fname, BOOL redraw)=0;
virtual BOOL SaveMixFile(TCHAR *fname)=0;
// gets the total time interval of the mixer, including all trackgroups and tracks
virtual void GetInterval(Interval& iv)=0;
virtual BOOL ExistingMixdown()=0;
// clear all clips, tracks, and trackgroups - the mixer will be empty
virtual void ClearMixer()=0;
// This group of functions actually applies not to the individual mixer,
// but to the mixer dialog and display. Many of these just get and set
// display preferences.
virtual BOOL GetSnapFrames()=0;
virtual void SetSnapFrames(BOOL onOff)=0;
virtual BOOL GetShowTgRangebars()=0;
virtual void SetShowTgRangebars(BOOL onOff)=0;
virtual BOOL GetShowWgtCurves()=0;
virtual void SetShowWgtCurves(BOOL onOff)=0;
virtual BOOL GetShowTimeWarps()=0;
virtual void SetShowTimeWarps(BOOL onOff)=0;
virtual BOOL GetShowClipBounds()=0;
virtual void SetShowClipBounds(BOOL onOff)=0;
virtual BOOL GetShowGlobal()=0;
virtual void SetShowGlobal(BOOL onOff)=0;
virtual BOOL GetShowClipNames()=0;
virtual void SetShowClipNames(BOOL onOff)=0;
virtual BOOL GetShowClipScale()=0;
virtual void SetShowClipScale(BOOL onOff)=0;
virtual BOOL GetShowTransStart()=0;
virtual void SetShowTransStart(BOOL onOff)=0;
virtual BOOL GetShowTransEnd()=0;
virtual void SetShowTransEnd(BOOL onOff)=0;
virtual BOOL GetShowBalance()=0;
virtual void SetShowBalance(BOOL onOff)=0;
virtual BOOL GetSnapToClips()=0;
virtual void SetSnapToClips(BOOL onOff)=0;
virtual BOOL GetLockTransitions()=0;
virtual void SetLockTransitions(BOOL onOff)=0;
virtual void SetAnimationRange()=0;
virtual void ZoomExtents()=0;
virtual void UpdateDisplay()=0;
virtual void AddToDisplay()=0; // adds this mixer to the mixer dialog
virtual void RemoveFromDisplay()=0; // removes this mixer from the mixer dialog
virtual void ShowMixer()=0; // shows the mixer dialog
virtual void HideMixer()=0; // hides the mixer dialog
};
#endif // __IMIXER__

449
lib/maxsdk70/include/CS/IMoFlow.h Executable file
View File

@ -0,0 +1,449 @@
/*********************************************************************
*<
FILE: bipedapi.h
DESCRIPTION: Biped motion flow interface classes
CREATED BY: Ravi Karra, Michael Zyracki
HISTORY: Created 18 October 1999
*> Copyright (c) 1999-2003 All Rights Reserved.
**********************************************************************/
#ifndef __IMOFLOW__
#define __IMOFLOW__
#include "BipExp.h"
#include "keytrack.h"
/*
Using the Motion Flow classes.
1. You need to make sure you are linking with the biped.lib import library. This is only currently necessary
for linking with these motion flow clases. If you are just using the interface in BipedApi.h,there is no
need to link with this import library.
2. Get the IMoFlow Interface from a corresponding BipMaster.
3. The general MotionFlow class hierarcy.
A. Each Motion Flow consists of a collection of Snippets(stored animation clips) and Scripts(instances
of the Snippets strung together.).
B. Each Snippet Contains an animation (a .bip file), and a collection of Transistions.
C. Each Transistion specifies an one way motion blend from one snippet to another.
D. Each Script in the IMoFlow is a set of animations(snippets), which are contains a list of ScriptItem's.
E. Each ScriptItem contains a pointer back to the Snippet it instances.
NOTE that there is a close correspondence between these SDK classes and functions and the CS motion
flow maxscript implementation, so that may be used as reference for this SDK also.
NOTE That these classes contain internal biped classes. These classes are the actually ones used
internally, they aren't interfaces.
Example of creating a motion flow.
IBipMaster *bipMaster = GetCurrentBipMaster(); //see
POINT graphLocation;
char str[32];
//begin motion flow mode.
bipMaster->BeginModes(BMODE_MOTIONFLOW);
//get the motion flow
IMoFlow *moFlow = bipMaster->GetMoFlow();
//create a walk snippet
sprintf(str,"c:\\Sumo\\walk.bip"); //the file for the snippert
graphLocation.x = 20;
graphLocation.y = 10;
Snippet *walk = moFlow->NewSnippet(str, graphLocation,true,true);
//create a run snippet
sprintf(str,"c:\\Sumo\\run.bip"); //the file for the snippert
graphLocation.x = 50;
graphLocation.y = 10;
Snippet *run = moFlow->NewSnippet(str, graphLocation,true,true);
//create an optimized transistion between the 2 snippets.
walk->AddTransition(run,TRUE);
run->AddTransition(walk,TRUE);
//call this global function to make sure all graphs and moflows are updated.
UpdateMotionFlowGraph();
//create a script and set it to be active
sprintf(str,"SDK Script");
moFlow->AddScript(str,true);
//get the script
Script *script = moFlow->GetActiveScript();
//set the start pos and direction
Point3 startPos(0,0,0);
script->SetStartPos(startPos);
script->SetStartRot(0); //set a 0 heading degree
//create the snipped
script->AddSnippet(run);
moFlow->CurscriptToActiveLinks(); //set the transistions in the script
script->AddSnippet(walk);
moFlow->CurscriptToActiveLinks(); //set the transistions in the script
script->AddSnippet(run);
moFlow->CurscriptToActiveLinks(); //set the transistions in the script
//now compute the animation.
moFlow->ComputeAnimation(TRUE);
//end the motion flow mode
//unify the motion(convert the motion to free form)
bipMaster->UnifyMotion()
bipMaster->EndModes(BMODE_MOTIONFLOW);
return;
*/
// Forward Declarations--note that there are certain classes here (class BipMaster, class animal, etc..)
// which are internal classes.
class Snippet;
class MoFlow;
//Internal classes
class BipMaster;
class Transition;
class MFL_IOProcessor;
class animal;
class Layer;
class path_properties;
class crowd_script;
//string length defines
#define MAXNAME 280
#define MAXSCRIPTNAME 64
#define MAXTRANNOTE 256
// transition focus types
#define FOCUS_AUTO 0
#define FOCUS_COM 1
#define FOCUS_LFOOT 2
#define FOCUS_RFOOT 3
#define FOCUS_BFEET 4
//The Transistion Info. Each transistion contains an array of traninfos.
class TranInfo {
public:
//data
int start1,start2,length; //source and dest start, and length
int rolling1,rolling2,randpct;
int transFocus;
float angle,easein,easeout,cost;
float flow_angle;
path_properties prop;
TCHAR note[MAXTRANNOTE];
BIPExport TranInfo();
BIPExport TranInfo& operator=(const TranInfo& TI);
BIPExport int operator==(const TranInfo& TI);
//internal I/O functions
void Output(MFL_IOProcessor *IOProc);
void Input(MFL_IOProcessor *IOProc);
inline int GetSourceStart() const { return start1; }
inline void SetSourceStart(int s) { start1 = s; }
inline int GetDestStart() const { return start2; }
inline void SetDestStart(int s) { start2 = s; }
inline int GetSourceState() const { return rolling1; }
inline void SetSourceState(int s) { rolling1 = s; }
inline int GetDestState() const { return rolling2; }
inline void SetDestState(int s) { rolling2 = s; }
inline int GetLength() const { return length; }
inline void SetLength(int l) { length = l; }
inline float GetAngle() const { return angle; }
inline void SetAngle(float a) { angle = a; }
inline int GetRandPercent() const { return randpct; }
inline void SetRandPercent(float r) { randpct = r; }
inline float GetCost() const { return cost; }
inline void SetCost(float c) { cost = c; }
inline float GetEaseIn() const { return easein; }
inline void SetEaseIn(float in) { easein = in; }
inline float GetEaseOut() const { return easeout; }
inline void SetEaseOut(float out) { easeout = out; }
inline int GetTransFocus() const { return transFocus; }
inline void SetTransFocus(int t) { transFocus = t; }
inline const TCHAR* GetNote() const { return note; }
inline void SetNote(const TCHAR* n) { _tcscpy(note, n); }
};
class Transition {
public:
Snippet *from;
Snippet *to;
int active;
int selected;
int start1,start2,length;
int rolling1,rolling2;
float easein,easeout;
float angle;
float flow_angle;
int transFocus;
path_properties prop;
int randpct;
float cost;
int index;
int nTransInfo;
int maxTransInfo;
TranInfo *TranList;
TCHAR note[MAXTRANNOTE];
HWND hwnd;
BIPExport Transition();
BIPExport ~Transition();
BIPExport Transition& operator=(const Transition& T);
BIPExport void SetTranListSize(int NUM);
BIPExport void InfoToTransition(int i);
BIPExport void TransitionToInfo(int i);
BIPExport int NewTranInfo(); // returns the index of the inserted item
BIPExport void ShiftTranInfo(int TIindex, int storecurrent);
BIPExport void DeleteTranInfo(int TIindex);
void Output(MFL_IOProcessor *IOProc);
void Input(MFL_IOProcessor *IOProc);
inline int GetRandPercent() const { return randpct; }
inline void SetRandPercent(float r) { randpct = r; }
inline float GetCost() const { return cost; }
inline void SetCost(float c) { cost = c; }
inline int GetTranListSize() const { return nTransInfo; }
inline Snippet* GetFromSnippet() const { return from; }
inline void SetFromSnippet(Snippet* s) { from = s; }
inline Snippet* GetToSnippet() const { return to; }
inline void SetToSnippet(Snippet* s){ to = s; }
inline BOOL GetActive() const { return active; }
inline void SetActive(BOOL act) { active = act; }
inline BOOL GetSelected() const { return selected; }
inline void SetSelected(BOOL sel) { selected = sel; }
inline TranInfo GetTranInfo(int TIindex) const
{ assert (TIindex < nTransInfo); return TranList[TIindex]; }
inline void SetTranInfo(int TIindex, TranInfo ti) {
assert (TIindex < nTransInfo);
TranList[TIindex] = ti;
if (index == TIindex ) InfoToTransition(index);
}
BIPExport void UpdateUI(bool redraw=false);
};
class Script;
class Snippet {
public:
int visited; //used for depth first tranversal
float distance_to_stop;
float distance_to_loop;
int start;
int end;
TCHAR sname[MAXNAME];
TCHAR fname[MAXNAME];
int posx;
int posy;
int width;
int nTrans;
int curtime; // set anytime you compute A for a particular frame (necessary for looping)
int active;
int validload; // currently loaded file, although possibly inactive, is still valid (or not)
BOOL randstart; // can this snippet start a random traversal script
int randstartpct; // percentage of time this snippet starts a random traversal script
Transition *Transitions;
HWND hwnd;
int orgposx; // for interaction - post-fido
int orgposy; // for interaction - post-fido
public:
Snippet *next;
animal *A;
BIPExport Snippet();
BIPExport ~Snippet();
BIPExport void ClearActiveTransitions();
BIPExport void ClearSelectedTransitions();
BIPExport int ActivateTransitionTo(Snippet *toSN);
BIPExport Transition *GetTransitionTo(Snippet *toSN);
BIPExport int GetTransitionIndex(Transition *theTR);
BIPExport float AddTransition(Snippet *child, int optimize); // returns the floating point cost
BIPExport float ComputeTransitionPoints(Transition *nTR, Snippet *Src , Snippet *Dest, int preference, int optimize);
BIPExport float ComputeOptimalTransitionPoints(BOOL SearchAll,int PrefTranLen,int SearchBefore, int SearchAfter, Transition *nTR, Snippet *Src , Snippet *Dst);
BIPExport void RecomputeTransitions();// recompute existing transitions from this new snippet
BIPExport int DeleteTransitionsTo(Snippet *child);
BIPExport int DeleteTransition(int index);
BIPExport void DeleteSelectedTransitions(MoFlow *MF);
BIPExport int IsChild(Snippet *Child);
void Paint(HDC hdc, int selected, int startnode, int editnode, int transhow);
void PaintTransitions(HDC hdc, BOOL transhow);
void ComputeWidth(HDC hdc, BOOL transhow);
int Inside(POINT &mp, float *dist);
BIPExport void UpdateUI();
BIPExport Snippet& operator=(const Snippet& SN);
Transition* TranHitTest(POINT &mp);
void TranRegionSelect(POINT &min, POINT &max, int set, int active);
void Output(MFL_IOProcessor *IOProc);
void Input(MFL_IOProcessor *IOProc);
BIPExport int LoadFile(bool UpdateTheUI = true, int ErrorType = 3); // 3 => shows errors in dialog box
Snippet *GetNextRandScriptSnippet(int *transindex);
///MG added for new MF based forward simulatiom
Snippet * NextRealTime(BipMaster *mc, Script *scr, animal *A, int frame, path_properties *desired_properties, int global_frame, int global_last_clip_start, int currentScript_index, int *transindex, int *found);
inline int GetStart() const { return start; }
inline void SetStart(int s) { start = s; }
inline int GetEnd() const { return end; }
inline void SetEnd(int e) { end = e; }
inline const TCHAR* GetClipName() const { return sname; }
inline void SetClipName(const TCHAR* n) { _tcscpy(sname, n); }
inline const TCHAR* GetFileName() const { return fname; }
inline void SetFileName(const TCHAR* n) { _tcscpy(fname, n); }
inline virtual IPoint2 GetPosition() const { return IPoint2(posx, posy); }
inline virtual void SetPosition(IPoint2 p){ posx = p.x; posy = p.y; }
inline BOOL GetActive() const { return active; }
inline void SetActive(BOOL act) { active = act; }
inline BOOL GetRandStart() const { return randstart; }
inline void SetRandStart(BOOL rs) { randstart = rs; }
inline BOOL GetRandStartPercent() const { return randstartpct; }
inline void SetRandStartPercent(int rsp){ randstartpct = rsp; }
inline int NumTransitions() { return nTrans; }
inline Transition* GetTransition(int Tindex) const
{ assert (Tindex < nTrans); return &Transitions[Tindex]; }
inline void SetTransition(int Tindex, Transition* ti)
{ assert (Tindex < nTrans); Transitions[Tindex] = *ti; }
};
class ScriptItem {
public:
Snippet *snip;
int transindex;
vector flow_pos;
vector2D flow_pivot;
float flow_yaw;
int glob_snipstart;
TCHAR *tempSnipName; // for global moflow i/o
//MG added for CS4
int foothold_frame[2];
int footlift_frame[2];
inline Snippet* GetSnippet() { return snip; }
inline void SetSnippet(Snippet* s) { snip = s; }
inline int GetTransIndex() const { return transindex; }
inline void SetTransIndex(int i) { transindex = i; }
inline vector GetFlowPos() const { return flow_pos; }
inline void SetFlowPos(vector p) { flow_pos = p; }
inline vector2D GetFlowPivot() const { return flow_pivot; }
inline void SetFlowPivot(vector2D p){ flow_pivot = p; }
inline float GetFlowYaw() const { return flow_yaw; }
inline void SetFlowYaw(float y) { flow_yaw = y; }
inline int GetSnipStart() const { return glob_snipstart; }
inline void SetSnipStart(int s) { glob_snipstart = s; }
BIPExport ScriptItem();
BIPExport ScriptItem& operator=(const ScriptItem& SI);
};
class Script {
public:
TCHAR name[MAXSCRIPTNAME];
Point3 startpos;
float startrot;
int startframe;
int nitems;
int maxitems;
ScriptItem *items;
int nlayers;
Layer *layers;
Layer *EditLayer;
Script *next;
BIPExport Script();
BIPExport ~Script();
BIPExport Script& operator=(const Script& P);
BIPExport int AddSnippet(Snippet *SN);
BIPExport int InsertSnippet(int index, Snippet *SN);
BIPExport int DeleteSnippet(int index);
BIPExport int Get_Backtrackframe(); //mg
BIPExport int GetScriptItemIndex(ScriptItem *SI);
BIPExport int InsertScriptItem(int index, ScriptItem *SI);
BIPExport int GetLastTransitionIndex(); //MG m28
Transition *GetLastTransition(); //S43
inline int NumScriptItems() { return nitems; }
inline ScriptItem* GetScriptItem(int ind)
{ assert (ind < nitems); return &items[ind]; }
BIPExport int IncludesSnippet(Snippet *SN);
BIPExport int IncludesTransition(Transition *TR);
void Output(MFL_IOProcessor *IOProc);
void Input(MFL_IOProcessor *IOProc, MoFlow *MF);
inline int GetStartFrame() { return startframe; }
inline void SetStartFrame(int f) { startframe = f; }
BIPExport void Set_crowd_script(crowd_script *CS);
inline Point3 GetStartPos() { return startpos; }
inline void SetStartPos(Point3 p) { startpos = p;}
inline float GetStartRot() { return startrot; }
inline void SetStartRot(float r) { startrot = r;}
inline const TCHAR* GetName() const { return name; }
inline void SetName(const TCHAR* n) { _tcscpy(name, n); }
// The following functions are obsolete
inline int NumLayers() { return nlayers; }
inline Layer *GetEditLayer() { return EditLayer; }
BIPExport Layer *GetLayer(int index);
BIPExport int AddLayer(Script *SCR, TimeValue t);
BIPExport void DeleteLayer(Layer *delLY);
BIPExport void SortLayer(Layer *SORTLY);
BIPExport int GetLayerIndex(Layer *LYR);
BIPExport int InsertLayer(Layer *newLY);
BIPExport void CloneLayer(Layer *orgLY,TimeValue t);
BIPExport void DeleteAllLayers();
};
class IBipMaster;
class IMoFlow
{
public:
virtual int NumScripts() const=0;
virtual int NumSelected() const=0;
virtual Script* GetScript(int index)=0;
virtual Script* GetActiveScript()=0;
virtual void SetActiveScript(Script* scr)=0;
virtual int GetScriptIndex(Script *theSCR) const=0;
virtual int AddScript(TCHAR *newscriptname, bool activate=true)=0;
virtual void DeleteScript(Script *delSCR)=0;
virtual void DeleteScript(int ind)=0;
virtual void DeleteAllScripts()=0;
virtual int NumSnippets() const=0;
virtual const BitArray& GetSelected() const=0;
virtual void SetSelected(const BitArray& sel)=0;
virtual Snippet* GetSnip(int index)=0;
virtual Snippet* GetSnip(TCHAR *str)=0;
virtual int GetIndex(Snippet *theSN) const=0;
virtual int LoadSnippetFiles(bool UpdateTheUI = true, int ErrorType = 3, bool UpdateSNLengths=false)=0;
virtual int GetActiveStartFrame() const=0;
virtual int GetActiveEndFrame() const=0;
virtual int Save(TCHAR *fname)=0;
virtual int Load(TCHAR *fname, bool Append=false, bool UpdateTheUI = true, int ErrorType = 3)=0;
virtual IBipMaster* GetMaster()=0;
virtual void ComputeAnimation(int redraw, int globalsToo = FALSE)=0; //main function that computes the moflow
//NOTE if you add a snippet to the script this function must be called to make sure that
//the transistion are all active!
virtual void CurscriptToActiveLinks() = 0;
// Adds a new snippet(clip) to the motion flow network, if load==true it's immediately loaded(if not need to call LoadSnipetFiles,
//if redraw is true then the moflow graph is redraw
virtual Snippet* NewSnippet(TCHAR *fname, POINT &mp, bool load=false, bool redraw=false)=0;
virtual void DeleteSnip(Snippet *DelSnip)=0;
virtual void RedrawGraphWnd()=0; // update just motion flow editor
virtual void UpdateUI()=0; // updates the motionflow script dialog and motion flow editor
virtual void HoldTrack(int HoldAnimals, BOOL HoldScriptOffsetOnly = false)=0; // HoldAll, holds all biped limbs.use to hold the biped.
};
BIPExport void UpdateMotionFlowGraph(); // updates the motionflow graph should be called after mf functions
// that manipulate transistions
#endif // __IMOFLOW__

View File

@ -0,0 +1,200 @@
#ifndef KEYTRACK_H
#define KEYTRACK_H
#include "BipExp.h"
#include "Tracks.h"
#define BIPSLAVE_CONTROL_CLASS_ID Class_ID(0x9154,0)
// this is the class for the center of mass, biped root controller ("Bip01")
#define BIPBODY_CONTROL_CLASS_ID Class_ID(0x9156,0)
// this is the class for the biped footstep controller ("Bip01 Footsteps")
#define FOOTPRINT_CLASS_ID Class_ID(0x3011,0)
#define SKELOBJ_CLASS_ID Class_ID(0x9125, 0)
#define BIPED_CLASS_ID Class_ID(0x9155, 0)
class vector {public: float x,y,z,w;
vector(){x=0.0;y=0.0;z=0.0;w=1.0;}; //constructors
vector(float X, float Y, float Z) { x = X; y = Y; z = Z; w= 1.0; };
vector (float xx, float yy, float zz, float ww) : x(xx), y(yy), z(zz), w(ww) { }
vector(Point4 p) : x(p.x), y(p.y), z(p.z), w(p.w) { }
// Binary operators
inline vector operator-(const vector&) const;
inline vector operator+(const vector&) const;
};
inline vector vector::operator-(const vector& b) const {
return(vector(x-b.x,y-b.y,z-b.z));
}
inline vector vector::operator+(const vector& b) const {
return(vector(x+b.x,y+b.y,z+b.z));
}
inline vector operator*(float f, const vector& a) {
return(vector(a.x*f, a.y*f, a.z*f, a.w)); //MG was a.w*f
}
inline Point4 VtoP4(const vector& v) { return Point4(v.x, v.y, v.z, v.w); }
//typedef struct {float x,z;} vector2D;
//typedef Point4 vector;
typedef Point3 vector2D;
class path_property
{
public:
float val;
int time;
float distance;
path_property(){
val = 0.0;
time = 0;
distance = 0;
}
};
class path_properties
{
public:
float turn_angle;
float line_distance;
float path_distance;
float average_speed;
float speed_change;
vector direction;
path_property min_speed;
path_property max_speed;
path_property stop;
path_properties(){
turn_angle = 0.0;
line_distance = 0.0;
path_distance = 0.0;
average_speed = 0.0;
speed_change = 1.0;
min_speed.val = 1000000.0;
}
path_properties& operator=(const path_properties& T);
};
class fingPos
{
public:
float jnt[MAXFINGERLINKS];
float quat[4];
float Worldquat[4];
fingPos(){
quat[0] = 0.0;
quat[1] = 0.0;
quat[2] = 0.0;
quat[3] = 1.0;
Worldquat[0] = 0.0;
Worldquat[1] = 0.0;
Worldquat[2] = 0.0;
Worldquat[3] = 1.0;
jnt[0] = 0.0;
jnt[1] = 0.0;
jnt[2] = 0.0;
}
} ;
class handPos
{
public:
float yaw,pitch,roll;
float quat[4];
//NEW FOR TBC control
//float src_quat[4];
//float des_quat[4];
float inc_quat[4];
float Worldquat[4];
fingPos fingerPos[MAXFINGERS];
handPos()
{
yaw = 0.0;
pitch = 0.0;
roll = 0.0;
quat[0] = 0.0;
quat[1] = 0.0;
quat[2] = 0.0;
quat[3] = 1.0;
inc_quat[0] = 0.0;
inc_quat[1] = 0.0;
inc_quat[2] = 0.0;
inc_quat[3] = 1.0;
Worldquat[0] = 0.0;
Worldquat[1] = 0.0;
Worldquat[2] = 0.0;
Worldquat[3] = 1.0;
}
} ;
class limbPos
{
public:
float jnt[MAXLEGJNTS]; // was MAXLINKS
vector pos;
vector Worldpos;
vector Pathpos;
vector rot;
float knee_rotation;
int gaitState;
int state;
float quat[4];
float clav_jnt[2];
float ikblend;
float ikankleten;
int ikworld;
int ik_link_index;
int ik_toe_index;
int ik_heel_index;
int ik_use_toes;
int ik_joined_pivot;
vector ik_pivot_pnt;
vector ik_moved_pivot_pnt;
handPos hand_pos;
limbPos(){
jnt[0] = 0.0f;
jnt[1] = 0.0f;
jnt[2] = 0.0f;
jnt[3] = 0.0f;
knee_rotation = 0.0f;
gaitState = 0;
state = 0;
quat[0] = 0.0f;
quat[1] = 0.0f;
quat[2] = 0.0f;
quat[3] = 1.0f;
clav_jnt[0] = -0.12f;
clav_jnt[1] = 0.0f;
ikblend = 0.0f;
ikankleten = 0.0f;
ikworld = 0;
ik_link_index = 0;
ik_toe_index = 0;
ik_heel_index = 5;
ik_use_toes = false;
ik_joined_pivot = false;
};
};
#endif

View File

@ -0,0 +1,93 @@
/******************************************************************************
*<
FILE: ourexp.h
DESCRIPTION: Export Interface Functionality for Biped
This is used internally inside CS plugins
It is not for use by non-CS developers, since it contains all sorts of internal function calls
Other developers should use bipexp.h
CREATED BY: Susan Amkraut
HISTORY: created February 2001
*> Copyright (c) Unreal Pictures, Inc. 1997, 2001 All Rights Reserved.
*******************************************************************************/
#ifndef OUREXP_H
#define OUREXP_H
#include "bipexp.h" // included to avoid double definitions
// This is the interface ID for a Biped Controller Interface
#define I_OURINTERFACE 0x00100111
// IOurBipExport: This class can be returned by calling the method GetInterface() from a Biped controller
// Given controller *c points to a Biped controller, then:
// IOurBipExport *BipIface = (IOurBipExport *) (c->GetInterface(I_OURINTERFACE));
// will return the interface for this Biped Controller, else returns NULL.
class IOurBipExport
{
public:
BIPExport virtual ~IOurBipExport() {}
// For the BipedExport you got from the center of mass (root) controller, send in:
// VERTICAL_SUBANIM, HORIZONTAL_SUBANIM, and ROTATION_SUBANIM
// to get information for those tracks.
// For other BipedExports this method is irrelevant.
// The SetSubAnim method is actually included for future releases,
// when more methods will be added to the IOurBipExport class.
// Then you could call these methods for the three center of mass subanims.
// It is not presently useful.
BIPExport virtual void SetSubAnim (int i) {};
// call this from any IOurBipExport instance to remove or restore non uniform scaling
BIPExport virtual void RemoveNonUniformScale(BOOL onOFF) {};
// call these to begin and end figure mode
BIPExport virtual void BeginFigureMode(int redraw) {};
BIPExport virtual void EndFigureMode(int redraw) {};
BIPExport virtual ScaleValue GetBipedScale(TimeValue t, INode *node){ return ScaleValue(); }
BIPExport virtual Point3 GetBipedPosition(TimeValue t, INode *node){ return Point3(); }
BIPExport virtual Quat GetBipedRotation(TimeValue t, INode *node){ return Quat(); }
BIPExport virtual void SetBipedScale(const ScaleValue &scale, TimeValue t, INode *node){}
BIPExport virtual void SetBipedPosition(const Point3 &p, TimeValue t, INode *node){}
BIPExport virtual void SetBipedRotation(const Quat &q, TimeValue t, INode *node, int global_reference){}
BIPExport virtual void ScaleBiped(const float scale) {};
BIPExport virtual float GetHeight() {return 1.0;}
BIPExport virtual void GetVelocity(int frame, Point3 *vel) {};
BIPExport virtual void GetProjectedVel(int frame, Point3 *vel) {};
BIPExport virtual void SendDesiredProperties(int frame, Point3 *pos, Point3 *vel, Point3 *goal, int goal_exists, int stop_needed, int stop_time, float stop_distance, float speed_change){};
BIPExport virtual void GetRedirectedVel(int frame, Point3 *desiredVel, Point3 *vel, Point3 *biped_skel_dir, int after_avoid_pass_flag, int avoid_needed) {};
BIPExport virtual void SetAfterAvoidVel(int frame, Point3 *vel, Point3 *bip_vel_before_avoid, Point3 *bip_vel_after_avoid){};
BIPExport virtual void EndFlow(int end_frame){};
BIPExport virtual void InitializeFlow( Point3 *pos, Point3 *vel, float *max_speed, int start_frame, int use_random_start){};
//BIPExport virtual void InitiateBackTrack(int start_frame, int last_frame){};
BIPExport virtual void FinishBacktrack(){};
BIPExport virtual void StartBacktrack(){};
BIPExport virtual void FinishRetrace(){};
BIPExport virtual void StartRetrace(){};
BIPExport virtual void ClearPathsAhead(){};
//BIPExport virtual void SendBackTrackingState(int backtrack){};
BIPExport virtual void GetBackTrackingFrame( int *backtrack_frame, int last_frame){};
//BIPExport virtual void NumPossibleTransitions(int *num_transitions){};
//BIPExport virtual void NumBlockedTransitions(int *num_transitions){};
BIPExport virtual void GetPosition(int frame, Point3 *pos) {};
BIPExport virtual void SetFlowHeight(int frame, float height) {};
BIPExport virtual BOOL IsReadyForCrowdComputation(int starttype) {return FALSE;};
BIPExport virtual void SetStartFrame(int startframe) {};
BIPExport virtual void InitializeMoflowAnalysis() {};
BIPExport virtual void SetDetourAngle(float angle) {};
// make authorization available in one place to all dlls
BIPExport virtual int BipAuthorize(HWND hwndParent) {return FALSE;};
BIPExport virtual int BipIsAuthorized() {return FALSE;};
BIPExport virtual void BipAuthorizedFromOutside() {};
};
#endif

482
lib/maxsdk70/include/CS/Phyexp.h Executable file
View File

@ -0,0 +1,482 @@
/******************************************************************************
*<
FILE: PhyExp.h
DESCRIPTION: Export Interface Functionality for Physique
CREATED BY: John Chadwick with a lot of help from Jurie Horneman
HISTORY: created July 10, 1997, modified for Version 2.0 March 5, 1998
*> Copyright (c) Unreal Pictures, Inc. 1997, 1998 All Rights Reserved.
*******************************************************************************/
// This header file is included in CS3.2.
// Plugins compiled with this header are incompatible with CS3.0, CS3.01, CS3.1, and CS3.1.1
#ifndef PHYEXP_H
#define PHYEXP_H
#ifdef BLD_PHYSIQUE
#define PHYExport __declspec( dllexport )
#else
#define PHYExport __declspec( dllimport )
#endif
#include "max.h"
#include "modstack.h"
// this is the interface ID for a Physique Modifier Interface
#define I_PHYINTERFACE 0x00100100
#define I_PHYEXPORT 0x00100100
#define I_PHYIMPORT 0x00100101
//return values for GetInitNodeTM
#define MATRIX_RETURNED 0
#define NODE_NOT_FOUND 1
#define NO_MATRIX_SAVED 2
#define INVALID_MOD_POINTER 3
// version control
#define CURRENT_VERSION 313
// these are the Class ID defines for Physique Modifier:
// Physique Class_ID = ClassID(PHYSIQUE_CLASS_ID_A, PHYSIQUE_CLASS_ID_B);
#define PHYSIQUE_CLASS_ID_A 0x00100
#define PHYSIQUE_CLASS_ID_B 0x00000
#define RIGID_TYPE 1
#define DEFORMABLE_TYPE 2
#define BLENDED_TYPE 4
#define FLOATING_TYPE 8
#define RIGID_NON_BLENDED_TYPE (RIGID_TYPE)
#define DEFORMABLE_NON_BLENDED_TYPE (DEFORMABLE_TYPE)
#define RIGID_BLENDED_TYPE (RIGID_TYPE | BLENDED_TYPE)
#define DEFORMABLE_BLENDED_TYPE (DEFORMABLE_TYPE | BLENDED_TYPE)
// NOTE: for Character Studio 2.1 Deformable Offset Vertices and Vertex Assignment
// Import has been added. These classes and descriptions follow the standard Rigid
// Export functionality at the end of this file.
// Using the Physique Export Interface:
//
// 1. Find the Physique Modifier you which to export rigid vertex assignments from.
// (there is a comment at the bottom of this file giving an example of this)
//
// 2. Given Physique Modifier Modifier *phyMod get the Physique Export Interface:
// IPhysiqueExport *phyExport = (IPhysqiueExport *)phyMod->GetInterface(I_PHYINTERFACE);
//
// 3. For a given Object's INode get this ModContext Interface from the Physique Export Interface:
// IPhyContextExport *contextExport = (IPhyContextExport *)phyExport->GetContextInterface(INode* nodePtr);
//
// 4. For each vertex of the Object get the Vertex Interface from the ModContext Export Interface:
// IPhyVertexExport *vtxExport = (IPhyVertexExport *)contextExport->GetVertexInterface(int i);
// NOTE: only Rigid Vertices are currently supported: (see ConvertToRigid(TRUE) to make all vertices rigid)
// IPhyRigidVertex *rigidExport = (IPhyRigidVertex *)contextExport->GetVertexInterface(int i);
//
// 5. Get the INode for each Rigid Vertex Interface:
// INode *nodePtr = rigidExport->GetNode();
//
// 6. Get the Point3 Offset Vector in INode coordinates for each Rigid Vertex Interface:
// Point3 offsetVector = rigidExport->GetOffsetVector();
// IPhyVertexExport: this is the base class for Vertex Export Interface
// NOTE: currently only RIGID_TYPE vertices are supported (IPhyRigidVertex)
// When a vertex is not assigned Rigid in Physique, the VertexInterface will be NULL
// Unless you call IPhyContextExport->ConvertToRigid(TRUE) (see IPhyContextExport below)
// With ConvertToRigid(TRUE) you will always get a IPhyRigidVertex
// from IPhyContextExport->GetVertexInterface(i)
class IPhyFloatingVertex;
class IPhyVertexExport
{
public:
PHYExport virtual ~IPhyVertexExport() {}
// NOTE: currently only type RIGID_TYPE | RIGID_BLENDED_TYPE are supported
PHYExport virtual int GetVertexType() = 0;
PHYExport virtual int Execute(int cmd, ULONG arg1=0, ULONG arg2=0, ULONG arg3=0) = 0;
};
class IPhyRigidVertex : public IPhyVertexExport
{
public:
PHYExport virtual ~IPhyRigidVertex() {}
// GetNode() will return the INode pointer of the link of the given VertexInterface
PHYExport virtual INode *GetNode() = 0;
// GetOffsetVector() will return the coordinates of the vertex
// in the local coordinates of associated INode pointer from GetNode
// this is NOT THE SAME as the .vph file coordinates. (It is simpler)
// the world coordinates of the vertex have been transformed by the Inverse of the INode pointer.
PHYExport virtual Point3 GetOffsetVector() = 0;
PHYExport virtual int Execute(int cmd, ULONG arg1=0, ULONG arg2=0, ULONG arg3=0) = 0;
};
class IPhyBlendedRigidVertex : public IPhyVertexExport
{
public:
PHYExport virtual ~IPhyBlendedRigidVertex() {}
// GetNumberNodes() returns the number of nodes assigned to the given VertexInterface
PHYExport virtual int GetNumberNodes() = 0;
// GetNode(i) will return the i'th INode pointer of the link of the given VertexInterface
PHYExport virtual INode *GetNode(int i) = 0;
// GetOffsetVector(i) will return the coordinates of the vertex
// in the local coordinates of associated i'th INode pointer from GetNode(i)
// this is NOT THE SAME as the .vph file coordinates. (It is simpler)
// the world coordinates of the vertex have been transformed by the Inverse of the INode pointer.
PHYExport virtual Point3 GetOffsetVector(int i) = 0;
// GetWeight(i) will return the weight of the vertex associated with the i'th Node
// pointer from GetNode(i)
PHYExport virtual float GetWeight(int i) = 0;
PHYExport virtual int Execute(int cmd, ULONG arg1=0, ULONG arg2=0, ULONG arg3=0) = 0;
};
// IPhyContextExport: This class can be returned by :
// passing the INode pointer of an Object with the given Physique Modifier's IPhysiqueExport::GetContextInterface(node)
// If this Node does contain the Physique Modifier associated with this interface an interface to this object's
// interface is returned (several object's may share the same physique modifier), else returns NULL.
class IPhyContextExport
{
public:
PHYExport virtual ~IPhyContextExport() {}
// this returns the number of vertices for the given modContext's Object
PHYExport virtual int GetNumberVertices() = 0;
// If ConvertToRigid is set to TRUE, all GetVertexInterface calls will be IPhyRigidVertex OR IPhyBlendedRigidVertex.
// Vertices which are not Rigid in Physique will be converted to Rigid for the VertexInterface.
// When ConvertToRigid is set to FALSE, GetVertexInterface for non-Rigid vertices currently returns NULL.
// By default, if you do not call ConvertToRigid, it is set to FALSE.
PHYExport virtual void ConvertToRigid(BOOL flag = TRUE) = 0;
// If AllowBlending is set to FALSE then GetVertexInterface will return a non-blended subclass.
// Currently the only valid VertexInterface subclasses are IPhyRigidVertex, and IPhyBlendedRigidVertex.
// When AllowBlending is FALSE, either IPhyRigidVertex or NULL will be returned.
// If ConvertToRigid is TRUE and AllowBlending is FALSE, all vertices will return
// IPhyRigidVertex. By default AllowBlending is set to TRUE.
PHYExport virtual void AllowBlending(BOOL flag = TRUE) = 0;
// GetVertexInterface return's a VertexInterface (IPhyVertexExport *) for the i'th vertex.
// If ConvertToRigid has been set to TRUE, then all VertexInterfaces will return IPhyRigidVertex OR IPhyBlendedRigidVertex.
// When ConvertToRigid has been set to FALSE, non-Rigid vertices will return NULL (CURRENTLY).
PHYExport virtual IPhyVertexExport *GetVertexInterface(int i) = 0;
// You must call ReleaseVertexInterface to delete the VertexInterface when finished with it.
PHYExport virtual void ReleaseVertexInterface(IPhyVertexExport *vertexExport) = 0;
PHYExport virtual int Execute(int cmd, ULONG arg1=0, ULONG arg2=0, ULONG arg3=0) = 0;
PHYExport virtual IPhyFloatingVertex *GetFloatingVertexInterface(int i) = 0;
};
// IPhysiqueExport: This class can be returned by calling the method GetInterface() for a Physique Modifier
// given Modifier *mod points to a Physique Modifier, then:
// IPhysiqueExport *phyInterface = (IPhysiqueExport *)( mod->GetInterface(I_PHYINTERFACE) );
// will return the interface for this Physique Modifier, else returns NULL.
class IPhysiqueExport
{
public:
PHYExport virtual ~IPhysiqueExport() {}
//GetContextInterface will return a pointer to IPhyContextExport Interface for a given INode.
// Ff the given INode does not contain the Physique Modifier of this IPhysique Export then NULL is returned.
PHYExport virtual IPhyContextExport *GetContextInterface(INode* nodePtr) = 0;
// You must call ReleaseContextInterface to delete the COntextInterface when finished with it.
PHYExport virtual void ReleaseContextInterface(IPhyContextExport *contextExport) = 0;
PHYExport virtual int GetInitNodeTM(INode *node, Matrix3 &initNodeTM) = 0;
PHYExport virtual int Execute(int cmd, ULONG arg1=0, ULONG arg2=0, ULONG arg3=0) = 0;
PHYExport virtual int Version(void) = 0;
PHYExport virtual void SetInitialPose(bool set) = 0;
};
// example code to find if a given node contains a Physique Modifier
// DerivedObjectPtr requires you include "modstack.h" from the MAX SDK
/*
Modifier* FindPhysiqueModifier (INode* nodePtr)
{
Object* ObjectPtr = nodePtr->GetObjectRef();
if (!ObjectPtr ) return NULL;
while (ObjectPtr->SuperClassID() == GEN_DERIVOB_CLASS_ID && ObjectPtr)
{
// Yes -> Cast.
IDerivedObject* DerivedObjectPtr = (IDerivedObject *)(ObjectPtr);
// Iterate over all entries of the modifier stack.
int ModStackIndex = 0;
while (ModStackIndex < DerivedObjectPtr->NumModifiers())
{
// Get current modifier.
Modifier* ModifierPtr = DerivedObjectPtr->GetModifier(ModStackIndex);
// Is this Physique ?
if (ModifierPtr->ClassID() == Class_ID(PHYSIQUE_CLASS_ID_A, PHYSIQUE_CLASS_ID_B))
{
// is this the correct Physique Modifier based on index?
SkinMod *phyMod = (SkinMod *)ModifierPtr;
if (phyMod == mod)
{
ModContext *mc = DerivedObjectPtr->GetModContext(ModStackIndex);
}
}
ModStackIndex++;
}
ObjectPtr = DerivedObjectPtr->GetObjRef();
}
// Not found.
return NULL;
}
*/
// Deformable Vertex Export via Offset Vectors
//
// Character Studio 2.1 allows users to export Deformable Vertices
// as time frame offsets from a rigid node offset
// The Rigid Offset Vector is identical to the Rigid Vertex Offset Vector.
// This represents the vertex in local coordinates from the attached node.
// Note that since the deformable offset is relative to a single node,
// Blending between links is handled internal to Physique in determining
// this offset, so that the export is a single offset for a given time
// for a single Node.
// Basically, you export a deformable offset from a single node, while
// Physique uses blending between several deformable links to determine
// this offset.
// NOTE: while the Rigid Vertex and Rigid Blended Vertex Export require
// a one time export for replicating the deformabion internal to the game engine,
// the Deformable Offset Vertex Export requires the export of DeformVertexOffset(t)
// at several (or every) frame.
class IPhyDeformableOffsetVertex : public IPhyVertexExport
{
public:
PHYExport virtual ~IPhyDeformableOffsetVertex() {}
// GetNode() will return the INode pointer of the link of the given VertexInterface
PHYExport virtual INode *GetNode() = 0;
// GetOffsetVector() will return the coordinates of the undeformed vertex
// in the local coordinates of associated INode pointer from GetNode().
// This is IDENTICAL to the Rigid Non Blended OffsetVector.
// It represents the Vertex in the local coordinates of the node via GetNode().
PHYExport virtual Point3 GetOffsetVector() = 0;
// GetDeformOffsetVector(t) will return the coorinates of the deformed vertex
// in the local coordinates of the associated INode pointer from GetNode().
// Game Developers wishing to store relative offsets can subtract the
// Deformable Offsets for given frames from the Base Offset Vector.
PHYExport virtual Point3 GetDeformOffsetVector(TimeValue t) = 0;
PHYExport virtual int Execute(int cmd, ULONG arg1=0, ULONG arg2=0, ULONG arg3=0) = 0;
};
// Import Interface Functionality for Physique
//
// Character Studio 2.1 allows users to programatically set the Rigid
// Vertex Assignments (with or without Blending) via Import Interface
// IPhyVertexImport: this is the base class for Vertex Export Interface
// NOTE: currently only RIGID_TYPE vertices are supported (IPhyRigidVertex)
// When a vertex is not assigned Rigid in Physique, the VertexInterface will be NULL
// Unless you call IPhyContextExport->ConvertToRigid(TRUE) (see IPhyContextExport below)
// With ConvertToRigid(TRUE) you will always get a IPhyRigidVertex
// from IPhyContextExport->GetVertexInterface(i)
class IPhyVertexImport
{
public:
PHYExport virtual ~IPhyVertexImport() {}
// NOTE: currently only type RIGID_TYPE | RIGID_BLENDED_TYPE are supported
PHYExport virtual int GetVertexType() = 0;
// You can lock (TRUE) or unlock (FALSE) vertex assignments
// To avoid changes to manual vertex assignments locking prevents
// these vertices from being reinitialized by Physique.
PHYExport virtual void LockVertex(BOOL lock) = 0;
PHYExport virtual int Execute(int cmd, ULONG arg1=0, ULONG arg2=0, ULONG arg3=0) = 0;
};
class IPhyRigidVertexImport : public IPhyVertexImport
{
public:
PHYExport virtual ~IPhyRigidVertexImport() {}
// SetNode() will define the INode pointer of the link of the given Rigid Vertex Interface
// If this INode is a valid Physique Link SetNode returns TRUE, and this vertex is
// now assigned Rigid (NonBlended) to this INode.
// If this INode is not a valid Physique Link, then SetNode returns FALSE,
// and no change to the vertex assignment occurs.
PHYExport virtual BOOL SetNode(INode *nodePtr) = 0;
PHYExport virtual int Execute(int cmd, ULONG arg1=0, ULONG arg2=0, ULONG arg3=0) = 0;
};
class IPhyBlendedRigidVertexImport : public IPhyVertexImport
{
public:
PHYExport virtual ~IPhyBlendedRigidVertexImport() {}
// SetWeightedNode will assign the given vertex to the nodePtr with the weight specified.
// When init = TRUE, this will remove all existing asignments and define this nodePtr
// as the first and only nodePtr assigned to the given vertex. When init = FALSE this
// nodePtr and weight are appeneded to the current assignments.
// Always set init = TRUE for the first nodePtr and weight for a given vertex
// and init = FALSE for all additional 2nd thru Nth nodeptr and weights.
// SetWeightedNode returns the number of Nodes assigned to the given Vertex
// when set successfully, or when the given nodePtr is not a valid Physique Link
// SetWeightedNode returns 0.
PHYExport virtual int SetWeightedNode(INode *nodePtr, float weight, BOOL init = FALSE) = 0;
PHYExport virtual int Execute(int cmd, ULONG arg1=0, ULONG arg2=0, ULONG arg3=0) = 0;
};
class IPhyContextImport
{
public:
PHYExport virtual ~IPhyContextImport() {}
// this returns the number of vertices for the given modContext's Object
PHYExport virtual int GetNumberVertices() = 0;
// SetVertexInterface return's a VertexInterface (IPhyVertexImport *) for the i'th vertex.
// type = RIGID_NON_BLENDED_TYPE | RIGID_BLENDED_TYPE are currently supported.
// Any other value for type will return NULL.
PHYExport virtual IPhyVertexImport *SetVertexInterface(int i, int type) = 0;
// You must call ReleaseVertexInterface to delete the VertexInterface when finished with it.
PHYExport virtual void ReleaseVertexInterface(IPhyVertexImport *vertexImport) = 0;
PHYExport virtual int Execute(int cmd, ULONG arg1=0, ULONG arg2=0, ULONG arg3=0) = 0;
};
class IPhysiqueImport
{
public:
PHYExport virtual ~IPhysiqueImport() {}
//GetContextInterface will return a pointer to IPhyContextImport Interface for a given INode.
// if the given INode does not contain the Physique Modifier of this IPhysique Import then NULL is returned.
PHYExport virtual IPhyContextImport *GetContextInterface(INode* nodePtr) = 0;
// You must call ReleaseContextInterface to delete the ContextInterface when finished with it.
PHYExport virtual void ReleaseContextInterface(IPhyContextImport *contextImport) = 0;
// You call AttachRootNode to define the root node of the Physique Modifier
// This will create default vertex assignments.
// You MUST call AttachRootNode prior to any Imported Vertex Assignments
// This method is designed specifically for developers wanting to
// define Physique fully via import. Predictable results should only be
// expected when this call is followed by a series of Vertex Import calls
// for every ModContext and Vertex of the Modifier.
// If the attach is successful it returns TRUE, otherwise it returns FALSE.
// TimeValue t specifies the initial skeleton pose, the position of the
// skeleton relative to the Object Geometry.
PHYExport virtual BOOL AttachRootNode(INode *nodePtr, TimeValue t) = 0;
PHYExport virtual BOOL InitializePhysique(INode *nodePtr, TimeValue t) = 0;
PHYExport virtual int Execute(int cmd, ULONG arg1=0, ULONG arg2=0, ULONG arg3=0) = 0;
};
class IPhyFloatingVertex : public IPhyVertexExport
{
public:
PHYExport virtual ~IPhyFloatingVertex() {}
PHYExport virtual int GetNumberNodes() = 0;
PHYExport virtual INode *GetNode(int i) = 0;
PHYExport virtual float GetWeight(int i, float &totalweight) = 0;
PHYExport virtual Point3 GetOffsetVector(int i) = 0;
PHYExport virtual int Execute(int cmd, ULONG arg1=0, ULONG arg2=0, ULONG arg3=0) = 0;
// GetNumberNodes() returns the number of nodes (bones) assigned to the given Vertex
// GetNode(i) will return the INode pointer of the ith node assigned to
//this Vertex
// GetOffsetVector(i) will return the coordinates of the vertex
// in the local coordinates of associated i'th INode pointer from GetNode(i)
// this is NOT THE SAME as the .vph file coordinates. (It is simpler)
// the world coordinates of the vertex have been transformed by the Inverse of the INode pointer.
// GetWeight(i) will return the normalized weight of the vertex associated with the i'th Node
// pointer from GetNode(i)
};
#endif

View File

@ -0,0 +1,69 @@
#ifndef __TRACKS_H
#define __TRACKS_H
// The Biped Tracks
#define KEY_NOTHING -1
#define KEY_LARM 0
#define KEY_RARM 1
#define KEY_LHAND 2
#define KEY_RHAND 3
#define KEY_LLEG 4
#define KEY_RLEG 5
#define KEY_LFOOT 6
#define KEY_RFOOT 7
#define KEY_SPINE 8
#define KEY_TAIL 9
#define KEY_HEAD 10
#define KEY_PELVIS 11
#define KEY_VERTICAL 12
#define KEY_HORIZONTAL 13
#define KEY_TURN 14
#define KEY_FOOTPRINTS 15
#define KEY_NECK 16
#define KEY_PONY1 17
#define KEY_PONY2 18
#define KEY_PROP1 19
#define KEY_PROP2 20
#define KEY_PROP3 21
#define KEY_LFARM 22
#define KEY_RFARM 23
#define NKEYTRACKS 24
// RK: 10/12/99 defines for adapt locks
#define ADAPT_LOCKHOR 0
#define ADAPT_LOCKVER 1
#define ADAPT_LOCKTURN 2
#define ADAPT_LOCKLLEG 3
#define ADAPT_LOCKRLEG 4
#define ADAPT_LOCKFFRM 5
#define ADAPT_LOCKTIME 6
#define NUB_START NKEYTRACKS
#define NUB_RHAND (NKEYTRACKS+0)
#define NUB_LHAND (NKEYTRACKS+1)
#define NUB_LFOOT (NKEYTRACKS+2)
#define NUB_RFOOT (NKEYTRACKS+3)
#define NUB_TAIL (NKEYTRACKS+4)
#define NUB_HEAD (NKEYTRACKS+5)
#define NUB_PONY1 (NKEYTRACKS+6)
#define NUB_PONY2 (NKEYTRACKS+7)
#define NNUBTRACKS 8
// Track Selection used in IBipMaster::GetTrackSelection.. SetTrackSelection.
//bodytracks
#define NO_TRACK 0
#define HOR_TRACK 1
#define VER_TRACK 2
#define ROT_TRACK 3
#define HORVER_TRACK 4
#define MAXFINGERS 5
#define MAXFINGERLINKS 3
#define MAXLEGJNTS 4
#endif

82
lib/maxsdk70/include/CS/bhvr.h Executable file
View File

@ -0,0 +1,82 @@
//*********************************************************************
// Crowd / Unreal Pictures / bhvr.h
// Copyright (c) 1999, All Rights Reserved.
//*********************************************************************
#ifndef BHVR_H
#define BHVR_H
#include "max.h"
#include "iparamm2.h"
#define MAXBHVRNAME 256
// values to set the flag in Perform
#define BHVR_SETS_FORCE 0x00000001
#define BHVR_SETS_GOAL 0x00000002
#define BHVR_SETS_SPEED 0x00000004
#define BEHAVIOR_SUPER_CLASS_ID REF_TARGET_CLASS_ID
// data that is returned by the Perform function
struct PerformOut
{
Point3 frc;
Point3 goal;
float speedwt;
float speedAtGoalwt;
};
// data that is passed in by the Constraint function
struct ConstraintInOut
{
Point3 vel;
float speed;
Point3 pos;
Point3 desGoal;
};
// All behaviors must inherit from this base class
class BaseBehavior: public ReferenceTarget {
public:
typedef enum {FORCE=0,CONSTRAINT,ORIENTATION} BEHAVIOR_TYPE;
BaseBehavior() {}
SClass_ID SuperClassID() { return BEHAVIOR_SUPER_CLASS_ID; }
virtual void SetName(TCHAR *newname) {}
virtual TCHAR *GetName() {return NULL;}
virtual int Perform(INode *node, TimeValue t, int numsubsamples, BOOL DisplayHelpers, float BhvrWeight,
PerformOut &out) {return FALSE;}
virtual int CanConvertToMaxScript() {return FALSE;}
virtual void InitBeforeSim(int FirstFrame, INode *n, int SimStart, int AssignIndex) {}
// These provide an option to display an apparatus along with the behavior
// at all times - not just during solve. The behavior can offer an option
// to turn this on and off. Keep in mind this apparatus will be displayed
// as part of the crowd object, and so may enlarge the damaged rectangle significantly...
virtual int Display(TimeValue t, ViewExp *vpt) {return 0;}
virtual void GetWorldBoundBox(TimeValue t, ViewExp *vpt, Box3& box ) {}
virtual void BehaviorStarted(TimeValue t, INode *node){}; //called only from cog control(currently) whenever a behavior gets restarted.
virtual void SetUpDelegates(INodeTab& participants){}; //called at beginning of simulation.
virtual void InitAtThisTime(TimeValue t){} //called at beginning of each simulation frame
virtual BEHAVIOR_TYPE BehaviorType() {return FORCE;}
virtual IsWeightable()
{if (BehaviorType() == BaseBehavior::CONSTRAINT) return FALSE;
if (BehaviorType() == BaseBehavior::ORIENTATION) return FALSE;
return TRUE;}
//FOR CONSTRAINTS.
virtual int Constraint(INode *node, TimeValue t, int numsubsamples, BOOL DesGoalExists,BOOL DisplayHelpers,
BOOL finalSet,ConstraintInOut &inOut) {return FALSE;}
//FOR ORIENTATIONS
virtual int Orient(const Point3 &vel,INode *node, TimeValue t,Quat &quat) {return FALSE;}
};
#endif

View File

@ -0,0 +1,96 @@
/******************************************************************************
*<
FILE: delegexp.h
DESCRIPTION: Export Interface Functionality for Crowd Delegate
CREATED BY: Susan Amkraut
HISTORY: created December, 1999
*> Copyright (c) Unreal Pictures, Inc. 1999 All Rights Reserved.
*******************************************************************************/
#ifndef DELEGEXP_H
#define DELEGEXP_H
#ifdef BLD_DELEG
#define DELEGexport __declspec( dllexport )
#else
#define DELEGexport __declspec( dllimport )
#endif
#include "max.h"
// This is the interface ID for a Delegate Interface
#define I_DELEGINTERFACE 0x00100101
// This is the Class ID for Vector Field Objects.
#ifndef BLD_DELEG
#define DELEG_CLASSID Class_ID(0x40c07baa, 0x245c7fe6)
#define CROWD_CLASS_ID Class_ID(0x60144302, 0x43455584) // to avoid selecting a crowd
#endif
// Sample Code, starting with an INode(node)
//
// Object *o = node->GetObjectRef();
// if ((o->ClassID() == DELEG_CLASS_ID)
// {
//
// // Get the Delegate Export Interface from the node
// IDelegate *Iface = (IDelegate *) o->GetInterface(I_DELEGINTERFACE);
//
// // Get the delegate's average speed at time t
// float AverageSpeed = Iface->GetAverageSpeed(t);
// }
//
// // Release the interface. NOTE that this function is currently inactive under MAX.
// //o->ReleaseInterface(I_DELEGINTERFACE,Iface);
// }
// IDelegate: This class can be returned by calling the method GetInterface() from a Delegate node
class IDelegate
{
public:
DELEGexport virtual ~IDelegate() {}
DELEGexport virtual BOOL IsComputing() {return FALSE;}
DELEGexport virtual BOOL IsConstrainedInZ() {return FALSE;}
DELEGexport virtual Point3 GetCurrentPosition() {return Point3(0.0,0.0,0.0);}
DELEGexport virtual Point3 GetCurrentVelocity() {return Point3(0.0,0.0,0.0);}
DELEGexport virtual Point3 GetPreviousVelocity() {return Point3(0.0,0.0,0.0);}
DELEGexport virtual float GetCurrentSpeed() {return 1.0;}
DELEGexport virtual float GetAverageSpeed(TimeValue t) {return 1.0;}
DELEGexport virtual float GetMaxAccel(TimeValue t){return 1.0;}
DELEGexport virtual float GetMaxHeadingVel(TimeValue t) {return 1.0;}
DELEGexport virtual float GetMaxHeadingAccel(TimeValue t){return 1.0;}
DELEGexport virtual float GetMaxPitchVel(TimeValue t) {return 1.0;}
DELEGexport virtual float GetMaxPitchAccel(TimeValue t){return 1.0;}
DELEGexport virtual float GetMaxIncline(TimeValue t){return 1.0;}
DELEGexport virtual float GetMaxDecline(TimeValue t){return 1.0;}
DELEGexport virtual Point3 GetSimStartVelocity(INode *n, TimeValue StartTime) {return Point3(0.0,0.0,0.0);}
DELEGexport virtual int GetIndex() {return 0;}
DELEGexport virtual BOOL OkToDisplayMyForces() {return 1;}
DELEGexport virtual BOOL OkToDisplayMyVelocity() {return 1;}
DELEGexport virtual BOOL OkToDisplayMyCogStates() {return 1;}
DELEGexport virtual void LineDisplay(Point3& pt1, Point3& pt2, Color clr, BOOL scale) {}
DELEGexport virtual void BboxDisplay(Point3& pt1, Point3& pt2, Color clr) {}
DELEGexport virtual void SphereDisplay(Point3& pt1, float radius, Color clr) {}
DELEGexport virtual void TextDisplay(Point3& pt1, Color clr, TCHAR *str) {}
DELEGexport virtual BOOL IsAssignmentActive(int AssignIndex, TimeValue t) {return TRUE;}
DELEGexport virtual void ClearBacktracking() {}
DELEGexport virtual BOOL NeedsBacktracking() {return FALSE;}
DELEGexport virtual void SetBacktracking(int frame) {}
DELEGexport virtual int GetRandId() {return 0;}
DELEGexport virtual Matrix3 GetTM(INode *node,TimeValue t){return Matrix3();}
DELEGexport virtual BOOL ComputingBiped() {return FALSE;}
DELEGexport virtual BOOL ReactToMe() {return FALSE;}
};
#endif