00001 /********************************************************************** 00002 *< 00003 FILE: IMixer.h 00004 00005 DESCRIPTION: Mixer classes 00006 00007 CREATED BY: Susan Amkraut 00008 00009 HISTORY: created summer 2000 00010 00011 *> Copyright (c) 2000, All Rights Reserved. 00012 **********************************************************************/ 00013 00014 /********************************************************************** 00015 UPDATING THE MIXER: 00016 00017 Many of the mixer functions cause changes to the raw mix . 00018 If you call a function or functions which would change the raw mix, 00019 then in order to see biped perform the updated raw mix, you must call: 00020 IMixer::InvalidateRawMix(); 00021 00022 If you call a function which changes the arrangement of clips in a 00023 transition track, then to update the display and computation of that 00024 track, you may have to call: 00025 IMXtrack::ComputeTransClips(); 00026 It's possible this may have been called for you, depending on what you did. 00027 But if you encounter any incomplete updates, call this. 00028 00029 Most of the mixer SDK works the same way as the mixer user interface. 00030 There are a few exceptions. The user interface does not allow the user to overlap clips. 00031 But some SDK functions make it possible to overlap clips. This is not advisable. 00032 All mixer SDK functions take into account the snap to frames variable 00033 as well as the lock transitions variable, both settable in the SDK. 00034 They do not, however, take into account the snap to clips variable, 00035 both for technical reasons and because this is more of a user interface feature. 00036 ************************************************************************/ 00037 00038 00039 #pragma once 00040 00041 #include "..\maxheap.h" 00042 #include "BipExp.h" 00043 #include "Tracks.h" 00044 #include "CSConstants.h" 00045 #include "..\assetmanagement\AssetUser.h" 00046 00047 // forward definition 00048 class IMixer; 00049 00050 class IMXclip: public MaxHeapOperators 00051 { 00052 public: 00053 virtual ~IMXclip() {;} 00054 //**************** timing *********************** 00055 // The original bounds are the time boundaries of the file loaded into the clip. 00056 // These bounds never change unless a new file is loaded into the clip. 00057 virtual void GetOriginalBounds(int *orgstart, int *orgend)=0; 00058 // 00059 // The trimmed bounds are the trimmed boundaries of the clip. 00060 // They are the same as or a subregion of the original bounds. 00061 // These values do not change when you scale a clip. 00062 // These boundaries are visible in the mixer when you are in trim mode. 00063 virtual void GetTrimBounds(int *trimstart, int *trimend)=0; 00064 // This also trims the weight curve and time warp appropriately 00065 // trimstart and trimend must be within the original bounds 00066 virtual void SetClipTrim(int trimstart, int trimend)=0; 00067 // 00068 // The global bounds indicate where the trimmed bounds of the clip are mapped globally. 00069 // The clip's scale is defined by the relationship between the trimmed interval (trimend - trimstart) 00070 // and the global interval (globend - globstart). If those intervals are equal, the clip's scale is 1. 00071 virtual void GetGlobalBounds(int *globstart, int *globend)=0; 00072 // globstart must be less than globend. 00073 // If not, these return false and do nothing. Otherwise these return true. 00074 // Setting these is like pulling one edge of the clip. It actually scales the clip. 00075 // This also scales the weight curve, time warp, and the in/out points appropriately 00076 virtual BOOL SetClipGlobalStart(int globstart)=0; 00077 virtual BOOL SetClipGlobalEnd(int globend)=0; 00078 // 00079 virtual void MoveClip(int timeInc)=0; 00080 // 00081 // These also scale the weight curve, time warp, and the in/out points appropriately 00082 virtual void ScaleClip(float scale)=0; 00083 virtual void SetClipScale(float scale)=0; 00084 00085 //**************** timing conversion *********************** 00086 // The following functions are useful for converting between various time spaces described below: 00087 // 00088 // local: a time between trimstart and trimend, inclusive 00089 // 00090 // scaled local: a time between 0 and the length of the scaled clip, which can be found this way: 00091 // GetGlobalBounds(&g1,&g2); int length = g2 - g1; 00092 // 00093 // global: a global time value 00094 // 00095 virtual float GetClipScale()=0; 00096 virtual int LocalToScaledLocal(int t)=0; 00097 virtual int ScaledLocalToLocal(int t)=0; 00098 virtual int LocalToGlobal(int t)=0; 00099 virtual int GlobalToLocal(int t)=0; 00100 virtual int GlobalToScaledLocal(int t)=0; 00101 virtual int ScaledLocalToGlobal(int t)=0; 00102 virtual int GlobalInpoint()=0; 00103 virtual int GlobalOutpoint()=0; 00104 00105 //**************** transitions *********************** 00106 // Transition information is stored in each clip, whether it is currently a valid clip in a transition track or not. 00107 // A clip stores mostly information for the transition from itself to the next clip. 00108 // It also stores some information for the transition from the previous clip to itself. 00109 // 00110 // Inpoints and outpoints are stored and set in the clip's scaled local time. 00111 // 00112 // Preserve Height is stored inside each track, not inside individual clips. 00113 // 00114 // The best way to manipulate transition values in a transition track is to loop through the clips 00115 // in sequential transition order by using the following IMXtrack functions described in IMXtrack: 00116 // ComputeTransClips() 00117 // NumTransClips() 00118 // GetTransClip(int index) 00119 // 00120 // The inpoint must be greater than the outpoint. 00121 // The inpoint must be less than the scaled local trimmed end. 00122 // If you try to set the inpoint out of bounds, it will not be set and the function will return false. 00123 // Otherwise, the inpoint will be set and the function will return true. 00124 virtual int GetNextTransitionInpoint()=0; 00125 virtual BOOL SetNextTransitionInpoint(int inpt)=0; 00126 // 00127 virtual float GetNextTransitionAngle()=0; 00128 virtual void SetNextTransitionAngle(float angle)=0; 00129 // 00130 // When setting the focus, if the value sent in is acceptable (FOCUS_AUTO, FOCUS_COM, FOCUS_LFOOT, FOCUS_RFOOT) 00131 // then the focus will be set, and the function will return true. 00132 // Otherwise, the focus will not be set, and the function will return false. 00133 virtual int GetNextTransitionFocus()=0; // returns one of the following: FOCUS_AUTO, FOCUS_COM, FOCUS_LFOOT, FOCUS_RFOOT, FOCUS_BFEET 00134 virtual BOOL SetNextTransitionFocus(int focus)=0; 00135 // 00136 virtual BOOL IsNextTransitionRolling()=0; 00137 virtual void SetNextTransitionRolling()=0; 00138 virtual void SetNextTransitionFixed()=0; 00139 // 00140 // Each ease value, and the sum of the ease values, must be between 0.0 and 1.0, inclusive. 00141 // If not, the set function will not set the values and it will return false. 00142 virtual void GetNextTransitionEase(float *easeIn, float *easeOut)=0; 00143 virtual BOOL SetNextTransitionEase(float easeIn, float easeOut)=0; 00144 // 00145 // Inpoints and outpoints are stored and set in the clip's scaled local time. 00146 // The outpoint must be less than the inpoint. 00147 // The outpoint must be greater than the scaled local trimmed start. 00148 // If you try to set an outpoint out of bounds, it will not be set and the function will return false. 00149 // Otherwise, the outpoint will be set and the function will return true. 00150 virtual int GetPrevTransitionOutpoint()=0; 00151 virtual BOOL SetPrevTransitionOutpoint(int outpt)=0; 00152 // 00153 virtual BOOL IsPrevTransitionRolling()=0; 00154 virtual void SetPrevTransitionRolling()=0; 00155 virtual void SetPrevTransitionFixed()=0; 00156 00157 //***************** clip animation file ************************** 00158 virtual const MaxSDK::AssetManagement::AssetUser & GetFile()=0; 00159 // LoadOption must be one of the following: RE_SOURCE_CLIP_ONLY, RE_SOURCE_INSTANCES, RE_SOURCE_FILEGROUP 00160 // RE_SOURCE_CLIP_ONLY: the file will be loaded into just this single clip 00161 // RE_SOURCE_INSTANCES: the file will be loaded into this clip and all instances of this clip 00162 // RE_SOURCE_FILEGROUP: the file will be loaded into this clip and all instances and adaptations of this clip 00163 virtual BOOL LoadFile(int LoadOption, const MCHAR *fname, BOOL ZeroFootHgt)=0; 00164 00165 //***************** weight curve ************************** 00166 // The weight curve for a clip is only relevant if the clip is in a layer track 00167 // All time values are in the clip's scaled local time (see note above about the meaning of scaled local time) 00168 virtual int NumWeights()=0; 00169 virtual float GetWeight(int i)=0; // returns weight at index i, if i is out of bounds, returns 0.0 00170 virtual int GetWeightTime(int i)=0; // returns time at index i, if i is out of bounds, returns 0 00171 virtual BOOL DeleteWeight(int i)=0; // returns false if i is out of bounds 00172 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 00173 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 00174 00175 // If t is at a key in the weight curve, this returns the weight at that key. 00176 // Otherwise, it returns the interpolated weight at time t. 00177 // If there are no weights, this returns 1.0. 00178 virtual float GetWeightAtTime(int t)=0; 00179 00180 // If there is a key at time t on the weight curve, this will reset the weight at that key. 00181 // If not, this will create a new key at time t with weight w. 00182 // Be sure that t is within the scaled local bounds of the clip. 00183 virtual int SetWeightAtTime(int t, float w)=0; 00184 00185 //***************** time warp ************************** 00186 // All time values are in the clip's scaled local time (see note above about the meaning of scaled local time) 00187 virtual BOOL IsTimeWarpActive()=0; 00188 virtual BOOL ActivateTimeWarp()=0; 00189 virtual BOOL DeactivateTimeWarp()=0; 00190 // Removes all existing time warps, activates time warp, 00191 // and initializes with one warp at the begining and one at the end of the clip 00192 virtual BOOL InitializeTimeWarp()=0; 00193 virtual int NumTimeWarps()=0; 00194 virtual TimeValue GetTwOrgTime(int i)=0; // returns original time at index i, if i is out of bounds, returns 0 00195 virtual TimeValue GetTwWarpTime(int i)=0;// returns warped time at index i, if i is out of bounds, returns 0 00196 virtual TimeValue GetOrgTimeAtWarpedTime(TimeValue t)=0; // returns what original time has been warped to this time 00197 // if t is out of bounds of the warped time, returns 0 00198 virtual TimeValue GetWarpedTimeAtOrgTime(TimeValue t)=0; // returns what this original time has been warped to 00199 // if t is out of bounds of the original time, returns 0 00200 virtual BOOL DeleteTw(int i)=0; // returns false if i is out of bounds 00201 virtual BOOL SetTwOrgTime(int i, TimeValue t)=0;// returns false if i is out of bounds or t is not inbetween 00202 // the two original times of the warp indices surrounding i 00203 virtual BOOL SetTwWarpTime(int i, TimeValue t)=0;// returns false if i is out of bounds or t is not inbetween 00204 // the two warped times of the warp indices surrounding i 00205 // 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, 00206 // then this returns false. Otherwise it sets a new time warp key, computing the warped time for this key such 00207 // that the flow is continuous 00208 virtual BOOL InsertWarpAtOrgTime(TimeValue t)=0; 00209 }; 00210 00211 class IMXtrack: public MaxHeapOperators 00212 { 00213 public: 00214 virtual ~IMXtrack() {;} 00215 virtual int NumClips(int row)=0; 00216 virtual IMXclip *GetClip(int index, int row = BOT_ROW)=0; // For layer tracks, row should always be BOT_ROW 00217 virtual int GetTrackType()=0; // returns LAYERTRACK or TRANSTRACK 00218 virtual void SetTrackType(int toType)=0; // must be set to LAYERTRACK or TRANSTRACK 00219 virtual BOOL GetMute()=0; 00220 virtual BOOL SetMute(BOOL val)=0; 00221 virtual BOOL GetSolo()=0; 00222 virtual BOOL SetSolo(BOOL val)=0; 00223 virtual void GetInterval(Interval& iv)=0; // gets the total time interval of the track, including all clips 00224 virtual void Clear()=0; 00225 // The specified bip file will be loaded into the new clip, and the reservoir, using the ZeroFootHeight parameter. 00226 // For layer tracks, the start of the new clip will be appended interval time from the end of the last clip in the track. 00227 // The interval variable must be >= 0. 00228 // For transition tracks, the interval parameter is ignored. The start of the new clip will be at 00229 // the inpoint of the last clip in the track, and it will be on the opposite row of the last clip. 00230 // It will start later if it collides with another clip. For both layer and transition tracks, 00231 // if there are no clips in the track, the new clip will start at frame 0. This returns false if 00232 // the specified file could not be loaded. Otherwise, it returns true. 00233 virtual BOOL AppendClip(const MCHAR *fname, BOOL ZeroFootHeight = true, int interval = 5)=0; 00234 00235 /******************** transition track functions (not for layer tracks) **************************/ 00236 // If any of these functions are called for layer tracks, they will return false and do nothing. 00237 // The track must be a transition track. 00238 // 00239 virtual BOOL IsHeightPreservedDuringTransitions()=0; 00240 virtual BOOL SetTransPreserveHeight(BOOL val)=0; 00241 // PreferredTransLength and the search ranges must be positive values. They are in frames. 00242 // If they are negative values, the optimization will not be performed and the function will return false. 00243 // Otherwise, the function will return true/false describing whether or not it was successful. 00244 // If optimization requires clips to be trimmed to avoid visual overlap, then they will be trimmed. 00245 virtual BOOL OptimizeTransitions(int PreferredTransLength, BOOL SearchEntireClip, int SearchRangeBefore, int SearchRangeAfter)=0; 00246 // See notes above. 00247 // The ClipIndex is an index into the tracks's trans clips. 00248 // If the ClipIndex is out of range of the trans clips, the optimization will not be performed and the function will return false. 00249 virtual BOOL OptimizeClipsNextTransition(int PreferredTransLength, BOOL SearchEntireClip, int SearchRangeBefore, int SearchRangeAfter, int ClipIndex)=0; 00250 00251 // The following three functions provide a way of looping through the clips in a transition track in 00252 // sequential order, based on how they transition from one to another, regardless of what row they are in. 00253 // A greyed out clip will not be included in the transclips, since it is not part of the series of transitions. 00254 // If you change ANYTHING in a transition track (clip timiing, transition timing or parameters), 00255 // then you must call ComputeTransClips before looping through the trans clips 00256 virtual void ComputeTransClips()=0; 00257 virtual int NumTransClips()=0; 00258 virtual IMXclip *GetTransClip(int index)=0; 00259 00260 //***************** weight curve ************************** 00261 // The weight curve for a track is only relevant if the track is a transition track 00262 virtual int NumWeights()=0; 00263 virtual float GetWeight(int i)=0; // returns weight at index i, if i is out of bounds, returns 0.0 00264 virtual int GetWeightTime(int i)=0; // returns time at index i, if i is out of bounds, returns 0 00265 virtual BOOL DeleteWeight(int i)=0; // returns false if i is out of bounds 00266 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 00267 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 00268 // If t is at a key in the weight curve, this returns the weight at that key. 00269 // Otherwise, it returns the interpolated weight at time t. 00270 // If there are no weights, this returns 1.0. 00271 virtual float GetWeightAtTime(int t)=0; 00272 00273 // If there is a key at time t on the weight curve, this will reset the weight at that key. 00274 // If not, this will create a new key at time t with weight w. 00275 // If this weight curve belongs to a clip, you need to make sure that t is within the 00276 // scaled local bounds of the clip. (see note below about the meaning of scaled local) 00277 virtual int SetWeightAtTime(int t, float w)=0; 00278 }; 00279 00280 class IMXtrackgroup: public MaxHeapOperators 00281 { 00282 public: 00283 virtual ~IMXtrackgroup() {;} 00284 virtual int NumTracks()=0; 00285 virtual IMXtrack *GetTrack(int index)=0; 00286 virtual const MCHAR *GetName()=0; 00287 virtual BOOL SetName(const MCHAR *str)=0; 00288 // the index for the following two filter functions must be one of the follwing track id's defined in track.h: 00289 // KEY_LARM, KEY_RARM, KEY_LHAND, KEY_RHAND, KEY_LLEG, KEY_RLEG, KEY_LFOOT, KEY_RFOOT, KEY_SPINE, KEY_TAIL, KEY_HEAD, 00290 // KEY_PELVIS, KEY_VERTICAL, KEY_HORIZONTAL, KEY_TURN, KEY_NECK, KEY_PONY1, KEY_PONY2, KEY_PROP1, KEY_PROP2, KEY_PROP3, 00291 virtual BOOL GetFilter(int index)=0; 00292 virtual BOOL SetFilter(int index, int val)=0; 00293 virtual void Clear()=0; // removes all clips from the trackgroup 00294 virtual BOOL InsertTrack(int index, int tracktype)=0; 00295 // gets the total time interval of the trackgroup, including all tracks 00296 virtual BOOL DeleteTrack(int index)=0; 00297 virtual void GetInterval(Interval& iv)=0; 00298 }; 00299 00300 class IMixer: public MaxHeapOperators 00301 { 00302 public: 00303 virtual ~IMixer() {;} 00304 //**************** trackgroups *********************** 00305 virtual int NumTrackgroups()=0; 00306 virtual IMXtrackgroup *GetTrackgroup(int index)=0; 00307 virtual BOOL InsertTrackgroup(int index)=0; 00308 virtual BOOL DeleteTrackgroup(int index)=0; 00309 00310 //**************** mixer *********************** 00311 virtual float GetBalancePropagation()=0; // between 0.0 and 1.0 00312 virtual BOOL SetBalancePropagation(float val)=0; 00313 virtual float GetBalanceLateralRatio()=0; // between 0.0 and 1.0 00314 virtual BOOL SetBalanceLateralRatio(float val)=0; 00315 virtual BOOL GetBalanceMute()=0; 00316 virtual BOOL SetBalanceMute(BOOL val)=0; 00317 virtual BOOL IsPerformingMixdown()=0; // if this returns false, the biped is performing a raw mix 00318 virtual void InvalidateRawMix()=0; 00319 virtual void EffectRawMix()=0; 00320 virtual void EffectMixdown()=0; 00321 // ContinuityRange between 0 and 100, MaxKneeAngle between 0.0 and 180.0 00322 virtual BOOL Mixdown(BOOL KeyPerFrame, BOOL EnforceIkConstraints, int ContinuityRange, BOOL FilterHyperExtLegs, float MaxKneeAngle)=0; 00323 virtual void CopyClipSourceToBiped(IMXclip *iCP)=0; 00324 virtual void CopyMixdownToBiped()=0; // This will only work if a mixdown exists 00325 virtual BOOL LoadMixFile(const MCHAR *fname, BOOL redraw)=0; 00326 virtual BOOL SaveMixFile(const MCHAR *fname)=0; 00327 // gets the total time interval of the mixer, including all trackgroups and tracks 00328 virtual void GetInterval(Interval& iv)=0; 00329 virtual BOOL ExistingMixdown()=0; 00330 // clear all clips, tracks, and trackgroups - the mixer will be empty 00331 virtual void ClearMixer()=0; 00332 00333 // This group of functions actually applies not to the individual mixer, 00334 // but to the mixer dialog and display. Many of these just get and set 00335 // display preferences. 00336 virtual BOOL GetSnapFrames()=0; 00337 virtual void SetSnapFrames(BOOL onOff)=0; 00338 virtual BOOL GetShowTgRangebars()=0; 00339 virtual void SetShowTgRangebars(BOOL onOff)=0; 00340 virtual BOOL GetShowWgtCurves()=0; 00341 virtual void SetShowWgtCurves(BOOL onOff)=0; 00342 virtual BOOL GetShowTimeWarps()=0; 00343 virtual void SetShowTimeWarps(BOOL onOff)=0; 00344 virtual BOOL GetShowClipBounds()=0; 00345 virtual void SetShowClipBounds(BOOL onOff)=0; 00346 virtual BOOL GetShowGlobal()=0; 00347 virtual void SetShowGlobal(BOOL onOff)=0; 00348 virtual BOOL GetShowClipNames()=0; 00349 virtual void SetShowClipNames(BOOL onOff)=0; 00350 virtual BOOL GetShowClipScale()=0; 00351 virtual void SetShowClipScale(BOOL onOff)=0; 00352 virtual BOOL GetShowTransStart()=0; 00353 virtual void SetShowTransStart(BOOL onOff)=0; 00354 virtual BOOL GetShowTransEnd()=0; 00355 virtual void SetShowTransEnd(BOOL onOff)=0; 00356 virtual BOOL GetShowBalance()=0; 00357 virtual void SetShowBalance(BOOL onOff)=0; 00358 virtual BOOL GetSnapToClips()=0; 00359 virtual void SetSnapToClips(BOOL onOff)=0; 00360 virtual BOOL GetLockTransitions()=0; 00361 virtual void SetLockTransitions(BOOL onOff)=0; 00362 virtual void SetAnimationRange()=0; 00363 virtual void ZoomExtents()=0; 00364 virtual void UpdateDisplay()=0; 00365 virtual void AddToDisplay()=0; // adds this mixer to the mixer dialog 00366 virtual void RemoveFromDisplay()=0; // removes this mixer from the mixer dialog 00367 virtual void ShowMixer()=0; // shows the mixer dialog 00368 virtual void HideMixer()=0; // hides the mixer dialog 00369 }; 00370 00371