FBX SDK Reference Guide: kfcurveglobal.h Source File
00001 #ifndef FBXFILESDK_COMPONENTS_KFCURVE_KFCURVEGLOBAL_H
00002 #define FBXFILESDK_COMPONENTS_KFCURVE_KFCURVEGLOBAL_H
00003 
00004 /**************************************************************************************
00005 
00006  Copyright © 1999 - 2006 Autodesk, Inc. and/or its licensors.
00007  All Rights Reserved.
00008 
00009  The coded instructions, statements, computer programs, and/or related material
00010  (collectively the "Data") in these files contain unpublished information
00011  proprietary to Autodesk, Inc. and/or its licensors, which is protected by
00012  Canada and United States of America federal copyright law and by international
00013  treaties.
00014 
00015  The Data may not be disclosed or distributed to third parties, in whole or in
00016  part, without the prior written consent of Autodesk, Inc. ("Autodesk").
00017 
00018  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00019  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
00020  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR ARISING
00021  BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES OF TITLE,
00022  NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR USE.
00023  WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT WARRANT THAT THE OPERATION
00024  OF THE DATA WILL BE UNINTERRUPTED OR ERROR FREE.
00025 
00026  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
00027  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR EXPENSES
00028  OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE DAMAGES OR OTHER
00029  SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS OF PROFITS, REVENUE
00030  OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR DAMAGES OF ANY KIND),
00031  HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF LIABILITY, WHETHER DERIVED
00032  FROM CONTRACT, TORT (INCLUDING, BUT NOT LIMITED TO, NEGLIGENCE), OR OTHERWISE,
00033  ARISING OUT OF OR RELATING TO THE DATA OR ITS USE OR ANY OTHER PERFORMANCE,
00034  WHETHER OR NOT AUTODESK HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS
00035  OR DAMAGE.
00036 
00037 **************************************************************************************/
00038    
00039 #include <fbxfilesdk/components/kfcurve/kfcurve_h.h>
00040 
00041 #include <fbxfilesdk/components/kbaselib/kaydara.h>
00042 
00043 #include <fbxfilesdk/components/kbaselib/klib/karrayul.h>
00044 #include <fbxfilesdk/components/kbaselib/klib/ktime.h>
00045 
00046 #include <fbxfilesdk/components/kfcurve/kfcurve_forward.h>
00047 
00048 #include <fbxfilesdk/components/kfcurve/kfcurve.h>
00049 
00050 
00051 
00052 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00053     KFBX_FORWARD_HI(KFCurve);
00054     KFBX_FORWARD_HI(KFCurveNode);
00055 
00056     #define KFCURVE_INTEPOLATION_INFINITE 1000
00057     #define KFCURVE_OVERSHOOT_INTERPOLATION 500.0 
00058 
00059     /************************************************************************
00060     * KSmartPlotOptions
00061     ************************************************************************/
00062     KFBX_FORWARD(KSmartPlotOptions)
00063 
00064     class KFBX_DLL KSmartPlotOptions
00065     {
00066 
00067     public: 
00068 
00069         // Enable the SmartPlot
00070         bool    mUseSmartPlot;
00071 
00072         // Enable the Break Tangent post plot operation (these settings will also be used by the fidelity check)
00073         bool    mUseBreakTangent;
00074         double  mBreakTangentThreshold;
00075         KTime   mEpsilonTime;
00076 
00077         // Enable the Increase Fidelity post plot operation
00078         bool    mUseIncreaseFidelity;
00079         double  mFidelityTolerance;
00080         bool    mFidelityUseBreakTangent;
00081         int     mFidelitySegmentCount;
00082         bool    mFidelitySyncAddedKeys;
00083 
00084         // Use the reference curve as the result instead of the smart plot curve. Used for debug. Is also the most exact plot we can have in MB.
00085         bool    mShowReferenceCurve;
00086 
00087         // Constructor. All values will be set to default.
00088         KSmartPlotOptions();
00089     };
00090 
00091     /************************************************************************
00092     * KMergeLayerOptions
00093     ************************************************************************/
00094     KFBX_FORWARD(KMergeLayerOptions)
00095 
00096     class KFBX_DLL KMergeLayerOptions
00097     {
00098 
00099     public: 
00100 
00101         // Start and Stop time. Merge in this interval.
00102         KTime mStart;
00103         KTime mStop;
00104         
00105         // Plot period. Used only when not smart plotting.
00106         KTime mPlotPeriod;
00107 
00108         // Smart Merge options
00109         KSmartPlotOptions mSmartPlotOptions;
00110 
00111         // Constructor. All values will be set to default.
00112         KMergeLayerOptions();
00113     };
00114 
00115     // TimeWarp Utility
00116 
00118     KFBX_DLL void KFCurve_SetTWSet (KSet* pSet);
00119 
00121     KFBX_DLL HKFCurveNode KFCurve_FindTWFromNickNumber (int pNickNumber);
00122 
00124     KFBX_DLL bool KFCurve_FindNickNumberFromTW (int& pNickNumber, HKFCurveNode pTWNode);
00125 
00126     // ControlCurve Utility
00127 
00140     enum 
00141     {   
00142     //  eKFCURVE_PLOT_SourceCurvesKeep                  = 1<<0 ,
00143         eKFCURVE_PLOT_SourceCurvesDestroy               = 1<<1 ,
00144         eKFCURVE_PLOT_SourceCurvesZeroDuringPlotTime    = 1<<2 ,
00145         eKFCURVE_PLOT_DestinationCurveMergeWithResult   = 1<<3 ,
00146         eKFCURVE_PLOT_DestinationCurveReplaceByResult   = 1<<4 ,
00147         eKFCURVE_PLOT_ForCache                          = 1<<5 ,
00148     };
00149     KFBX_DLL void KFCurve_PlotInLayers 
00150     (   
00151         HKFCurveNode pParentNode, 
00152         KArrayTemplate<int> *pSourceLayers, // if pointer is NULL, all layers are considered
00153         int pDestLayer,
00154         kUInt pOptions, 
00155         KTime pStart, 
00156         KTime pStop, 
00157         KTime pPlotPeriod,
00158         HKFCurveNode pDestinationNode,
00159         HKFCurveNode pTotalNode,    // If this node is set, function calculates layer to 
00160         bool pUseTimeWarp,
00161         HKSmartPlotOptions pSmartPlotOptions = NULL
00162     );
00163 
00164     /******************************************************************/
00165     //
00166     //  Helpers
00167     //
00168     /******************************************************************/
00169 
00170     // Vectorial conversions tools
00171 
00179     KFBX_DLL bool AxisAlignmentInEulerAngle(double pAB[3], double pA[3], double pB[3], double pAngles[3]);
00180 
00181     // bob 23-05-2001 - old call found in kmodelutility are forwarded to those one
00182     KFBX_DLL KTime  KFCURVE_GetPlotPeriod();
00183     KFBX_DLL void   KFCURVE_SetPlotPeriod(KTime pPlotPeriod);
00184 
00185     //
00186     //  For plotting to be on frame or free... i.e. start at the beginning of the take or on frame.
00187     //
00188     KFBX_DLL bool   KFCURVE_GetPlotOnFrame();
00189     KFBX_DLL void   KFCURVE_SetPlotOnFrame( bool pPlotOnFrame );
00190 
00191     //
00192     // bob 23-05-2001 - the rotation correction filter that should be applied after a plot
00193     //
00194     enum { KFCurveApplyNone = 0, KFCurveApplyGimbleKiller, KFCurveApplyUnroll };
00195 
00196     KFBX_DLL int        KFCURVE_GetRotationFilterToApply();
00197     KFBX_DLL void   KFCURVE_SetRotationFilterToApply(int pRotationFilterToApply);
00198     KFBX_DLL void   KFCURVE_ApplyRotationFilter( HKFCurveNode pCurveNode, KTime pStart  = KTIME_MINUS_INFINITE, KTime pStop = KTIME_INFINITE );
00199 
00200     KFBX_DLL double KFCURVE_GetRotationFilterUnrollQuality();
00201     KFBX_DLL void   KFCURVE_SetRotationFilterUnrollQuality( double pQuality );
00202 
00203     KFBX_DLL bool   KFCURVE_GetRotationFilterUnrollTestForPath();
00204     KFBX_DLL void   KFCURVE_SetRotationFilterUnrollTestForPath( bool pTestForPath );
00205 
00206     KFBX_DLL double KFCURVE_GetButterworthFilterInternalRate();
00207     KFBX_DLL void   KFCURVE_SetButterworthFilterInternalRate( double pButterworthFilterInternalRate );
00208 
00209     //
00210     // the constant key reducer to be applied on Plot
00211     //
00212     KFBX_DLL bool   KFCURVE_GetUseConstantKeyReducer();
00213     KFBX_DLL void   KFCURVE_SetUseConstantKeyReducer( bool pUseConstantKeyReducer );
00214 
00215     //
00216     // keep at least one key after applying the filter (else, there will only be a candidate on the curve)
00217     //
00218     KFBX_DLL bool   KFCURVE_GetConstantKeyReducerKeepOneKey();
00219     KFBX_DLL void   KFCURVE_SetConstantKeyReducerKeepOneKey( bool pConstantKeyReducerKeepOneKey );
00220 
00221     //
00222     // the constant key reducer to be applied on Device record
00223     //
00224     KFBX_DLL bool   KFCURVE_GetUseConstantKeyReducerOnDevices();
00225     KFBX_DLL void   KFCURVE_SetUseConstantKeyReducerOnDevices( bool pUseConstantKeyReducerOnDevices );
00226 
00227     //
00228     KFBX_DLL double KFCURVE_GetUseConstantKeyReducerTranslationThreshold();
00229     KFBX_DLL void   KFCURVE_SetUseConstantKeyReducerTranslationThreshold( double pConstantKeyReducerTranslationThreshold );
00230 
00231     //
00232     KFBX_DLL double KFCURVE_GetUseConstantKeyReducerRotationThreshold();
00233     KFBX_DLL void   KFCURVE_SetUseConstantKeyReducerRotationThreshold( double pConstantKeyReducerRotationThreshold );
00234 
00235     //
00236     KFBX_DLL double KFCURVE_GetUseConstantKeyReducerScalingThreshold();
00237     KFBX_DLL void   KFCURVE_SetUseConstantKeyReducerScalingThreshold( double pConstantKeyReducerScalingThreshold );
00238 
00239     //
00240     KFBX_DLL double KFCURVE_GetUseConstantKeyReducerDefaultThreshold();
00241     KFBX_DLL void   KFCURVE_SetUseConstantKeyReducerDefaultThreshold( double pConstantKeyReducerDefaultThreshold );
00242 
00243     //
00244     // tell if we should "Plot Translation On Root Only" or not (Antoine 2003-05-02)
00245     //
00246     KFBX_DLL bool   KFCURVE_GetPlotTranslationOnRootOnly();
00247     KFBX_DLL void   KFCURVE_SetPlotTranslationOnRootOnly( bool pPlotTranslationOnRootOnly );
00248 
00249     //
00250     KFBX_DLL bool KFCURVE_GetPreciseTimeDiscontinuities();
00251     KFBX_DLL void KFCURVE_SetPreciseTimeDiscontinuities( bool pPreciseTimeDiscontinuities );
00252 
00253     //
00254     KFBX_DLL bool KFCURVE_GetTCB4051EvalMode();
00255     KFBX_DLL void KFCURVE_SetTCB4051EvalMode( bool pTCB4051EvalMode );
00256 
00257     // Functions to convert bezier tan to the new automatic parametrisation
00258     KFBX_DLL void KFCURVE_ComputeAutoFromBezier(double &pLeftParam, double &pRightParam, double &pLeftTan,   double &pRightTan,   double &pToLeftKey, double &pToRightKey);
00259     KFBX_DLL void KFCURVE_ComputeBezierFromAuto(double &pLeftTan,   double &pRightTan,   double &pLeftParam, double &pRightParam, double &pToLeftKey, double &pToRightKey);
00260 
00261     KFBX_DLL void KFCURVE_ComputeLeftAutoFromBezier(double &pLeftParam, double &pLeftTan,   double &pToLeftKey, double &pToRightKey);
00262     KFBX_DLL void KFCURVE_ComputeLeftBezierFromAuto(double &pLeftTan,   double &pLeftParam, double &pToLeftKey, double &pToRightKey);
00263 
00264     KFBX_DLL void KFCURVE_ComputeRightAutoFromBezier(double &pRightParam, double &pRightTan,   double &pToLeftKey, double &pToRightKey);
00265     KFBX_DLL void KFCURVE_ComputeRightBezierFromAuto(double &pRightTan,   double &pRightParam, double &pToLeftKey, double &pToRightKey);
00266 
00267     KFBX_DLL void KFCURVE_ComputeAutoFromBezierForKey(double &pLeftParam, double &pRightParam, double &pLeftTan,   double &pRightTan,   HKFCurve pCurve, int pIndex);
00268     KFBX_DLL void KFCURVE_ComputeBezierFromAutoForKey(double &pLeftTan,   double &pRightTan  , double &pLeftParam, double &pRightParam, HKFCurve pCurve, int pIndex);
00269 
00270     KFBX_DLL void KFCURVE_ComputeLeftAutoFromBezierForKey(double &pLeftParam, double &pLeftTan,   HKFCurve pCurve, int pIndex);
00271     KFBX_DLL void KFCURVE_ComputeLeftBezierFromAutoForKey(double &pLeftTan,   double &pLeftParam, HKFCurve pCurve, int pIndex);
00272 
00273     KFBX_DLL void KFCURVE_ComputeRightAutoFromBezierForKey(double &pRightParam, double &pRightTan,   HKFCurve pCurve, int pIndex);
00274     KFBX_DLL void KFCURVE_ComputeRightBezierFromAutoForKey(double &pRightTan  , double &pRightParam, HKFCurve pCurve, int pIndex);
00275 
00276     KFBX_DLL void KFCURVE_ComputeToLeftAndToRight(double &pToLeft, double &pToRight, HKFCurve pCurve , int pIndex);
00277 
00284     KFBX_DLL void KFCURVE_BreakTangents( HKFCurveNode pFCurveNode, HKFCurveNode pReferenceFCurveNode, KTime pEpsilonTime, double pTangentThreshold );
00285 
00286 KFBX_DLL void KFCURVE_ComputeTCBFromBezierForKey( double &pT, double &pC ,double &pB , double pLTan, double pRTan, HKFCurve pCurve, int pIndex );
00287 
00300     KFBX_DLL void KFCURVE_IncreaseFidelity( HKFCurveNode pFCurveNode, HKFCurveNode pReferenceFCurveNode, double pFidelityThreshold, int pSegmentCount, bool pBreakTangents, KTime pEpsilonTime, double pTangentThreshold, bool pSyncAddedKeys = false, KArrayTemplate<HKFCurve>* pSyncWithFCurves = NULL, KArrayTemplate<HKFCurve>* pSyncWithReferenceFCurves = NULL );
00301 
00302 
00309     KFBX_DLL bool KFCURVE_IsAllSameInterpolation( HKFCurveNode pFCurveNode, kFCurveInterpolation pInterpolation, bool pAllLayer);
00310 
00318     KFBX_DLL void KFCURVE_ConstantCurveMerge(HKFCurveNode pDstNode,HKFCurveNode pSrcNode, KTime pStart, KTime pStop);
00319 
00320 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00321 
00322 #endif // FBXFILESDK_COMPONENTS_KFCURVE_KFCURVEGLOBAL_H
00323