FBX SDK Reference Guide: kfbxbindingoperator.h Source File
Go to the documentation of this file.
00001 
00004 #ifndef FBXFILESDK_KFBXPLUGINS_KFBXBINDINGOPERATOR_H
00005 #define FBXFILESDK_KFBXPLUGINS_KFBXBINDINGOPERATOR_H
00006 
00007 /**************************************************************************************
00008 
00009 Copyright © 2006 Autodesk, Inc. and/or its licensors.
00010 All Rights Reserved.
00011 
00012 The coded instructions, statements, computer programs, and/or related material
00013 (collectively the "Data") in these files contain unpublished information
00014 proprietary to Autodesk, Inc. and/or its licensors, which is protected by
00015 Canada and United States of America federal copyright law and by international
00016 treaties.
00017 
00018 The Data may not be disclosed or distributed to third parties, in whole or in
00019 part, without the prior written consent of Autodesk, Inc. ("Autodesk").
00020 
00021 THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00022 ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
00023 WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR ARISING
00024 BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES OF TITLE,
00025 NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR USE.
00026 WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT WARRANT THAT THE OPERATION
00027 OF THE DATA WILL BE UNINTERRUPTED OR ERROR FREE.
00028 
00029 IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
00030 OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR EXPENSES
00031 OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE DAMAGES OR OTHER
00032 SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS OF PROFITS, REVENUE
00033 OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR DAMAGES OF ANY KIND),
00034 HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF LIABILITY, WHETHER DERIVED
00035 FROM CONTRACT, TORT (INCLUDING, BUT NOT LIMITED TO, NEGLIGENCE), OR OTHERWISE,
00036 ARISING OUT OF OR RELATING TO THE DATA OR ITS USE OR ANY OTHER PERFORMANCE,
00037 WHETHER OR NOT AUTODESK HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS
00038 OR DAMAGE.
00039 
00040 **************************************************************************************/
00041 
00042 #include <fbxfilesdk/components/kbaselib/kaydaradef_h.h>
00043 #include <fbxfilesdk/components/kbaselib/kaydara.h>
00044 #include <fbxfilesdk/kfbxplugins/kfbxbindingtablebase.h>
00045 
00046 #include <fbxfilesdk/components/kbaselib/klib/kmap.h>
00047 #include <fbxfilesdk/components/kbaselib/klib/kstring.h>
00048 
00049 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00050 
00051 
00055 class KFBX_DLL KFbxBindingOperator : public KFbxBindingTableBase
00056 {
00057     KFBXOBJECT_DECLARE(KFbxBindingOperator,KFbxBindingTableBase);
00058 
00059 public:
00065     template <class FBXTYPE>
00066     bool Evaluate(KFbxObject const* pObject, FBXTYPE* pResult) const
00067     {
00068         EFbxType lResultType;
00069         void* lResult = NULL;
00070 
00071         bool lSuccess = Evaluate(pObject, &lResultType, &lResult);
00072 
00073         if (lSuccess)
00074         {
00075             fbxCopy(*pResult, lResult, lResultType);
00076         }
00077 
00078         FreeEvaluationResult(lResultType, lResult);
00079 
00080         return lSuccess;
00081     }
00082 
00089     template <class FBXTYPE>
00090     bool EvaluateEntry(KFbxObject const* pObject, char const* pEntryDestinationName, FBXTYPE* pResult) const
00091     {
00092         EFbxType lResultType;
00093         void* lResult = NULL;
00094 
00095         bool lSuccess = EvaluateEntry(pObject, pEntryDestinationName, &lResultType, &lResult);
00096 
00097         if (lSuccess)
00098         {
00099             fbxCopy(*pResult, lResult, lResultType);
00100         }
00101 
00102         FreeEvaluationResult(lResultType, lResult);
00103 
00104         return lSuccess;
00105     }
00106 
00107     KFbxBindingOperator& operator=(KFbxBindingOperator const& pTable);
00108 
00109     // Properties
00110     KFbxTypedProperty<fbxString> FunctionName;
00111     KFbxTypedProperty<fbxString> TargetName;
00112 
00114     // Static values
00116 
00117     // property names
00118     static const char* sFunctionName;
00119     static const char* sTargetName;
00120 
00121     // property default values
00122     static const char* sDefaultFunctionName;
00123     static const char* sDefaultTargetName;
00124 
00125 
00127     // Functions
00129 
00130     static void RegisterFunctions();
00131     static void UnregisterFunctions();
00132 
00133     class KFBX_DLL Function
00134     {
00135     public:
00136         virtual ~Function() {}
00137         virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const = 0;
00138     };
00139 
00140 
00141     class KFBX_DLL FunctionCreatorBase
00142     {
00143     public:
00144         virtual char const* GetFunctionName() const = 0;
00145         virtual Function* CreateFunction() const = 0;
00146     };
00147 
00148 
00149     template <class FUNCTION>
00150     class FunctionCreator : public FunctionCreatorBase
00151     {
00152     public:
00153         virtual char const* GetFunctionName() const
00154         {
00155             return FUNCTION::FunctionName;
00156         }
00157 
00158         virtual Function* CreateFunction() const
00159         {
00160             return new FUNCTION;
00161         }
00162     };
00163 
00164     class KFBX_DLL FunctionRegistry
00165     {
00166     public:
00167         static void RegisterFunctionCreator(FunctionCreatorBase const& pCreator)
00168         {
00169             sRegistry.Insert(pCreator.GetFunctionName(), &pCreator);
00170         }
00171 
00172         static void UnregisterFunctionCreator(FunctionCreatorBase const& pCreator)
00173         {
00174             sRegistry.Remove(pCreator.GetFunctionName());
00175         }
00176 
00177         static FunctionCreatorBase const* FindCreator(char const* pName)
00178         {
00179             RegistryType::RecordType* lRecord = sRegistry.Find(pName);
00180 
00181             if (lRecord)
00182             {
00183                 return lRecord->GetValue();
00184             }
00185             else
00186             {
00187                 return NULL;
00188             }
00189         }
00190 
00191     private:
00192         typedef KMap<char const*, FunctionCreatorBase const*, KCharCompare> RegistryType;
00193         static RegistryType sRegistry;
00194     };
00195 
00196 
00198     //
00199     //  WARNING!
00200     //
00201     //  Anything beyond these lines may not be documented accurately and is
00202     //  subject to change without notice.
00203     //
00205 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00206     bool EvaluateEntry(KFbxObject const* pObject, char const* pEntryDestinationName, EFbxType* pResultType, void** pResult) const;
00207 
00208 protected:
00209     // construction must be done through Create()
00210     KFbxBindingOperator(KFbxSdkManager& pManager, char const* pName);
00211     virtual ~KFbxBindingOperator();
00212 
00213     virtual bool ConstructProperties(bool pForceSet);
00214     KFbxObject* Clone(KFbxObject* pContainer, KFbxObject::ECloneType pCloneType) const;
00215 
00216     void InstantiateFunction();
00217 
00225     bool Evaluate(KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00226 
00231     void FreeEvaluationResult(EFbxType pResultType, void* pResult) const;
00232 
00233     Function* mFunction;
00234 
00235 #endif //DOXYGEN_SHOULD_SKIP_THIS
00236 };
00237 
00238 
00241 class KFbxAssignBOF : public KFbxBindingOperator::Function
00242 {
00243 public:
00244     static char const* FunctionName;
00245 
00252     virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00253 
00255     //
00256     //  WARNING!
00257     //
00258     //  Anything beyond these lines may not be documented accurately and is
00259     //  subject to change without notice.
00260     //
00262 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00263     KFbxAssignBOF();
00264     virtual ~KFbxAssignBOF();
00265 
00266 
00267 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00268 };
00269 
00270 
00274 class KFbxConditionalBOF : public KFbxBindingOperator::Function
00275 {
00276 public:
00277     static char const* FunctionName;
00278 
00292     virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00293 
00295     //
00296     //  WARNING!
00297     //
00298     //  Anything beyond these lines may not be documented accurately and is
00299     //  subject to change without notice.
00300     //
00302 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00303     KFbxConditionalBOF();
00304     virtual ~KFbxConditionalBOF();
00305 
00306 
00307 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00308 };
00309 
00310 
00314 class KFbxSwitchBOF : public KFbxBindingOperator::Function
00315 {
00316 public:
00317     static char const* FunctionName;
00318 
00332     virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00333 
00335     //
00336     //  WARNING!
00337     //
00338     //  Anything beyond these lines may not be documented accurately and is
00339     //  subject to change without notice.
00340     //
00342 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00343     KFbxSwitchBOF();
00344     virtual ~KFbxSwitchBOF();
00345 
00346 
00347 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00348 };
00349 
00350 
00351 class KFbxTRSToMatrixBOF : public KFbxBindingOperator::Function
00352 {
00353 public:
00354     static char const* FunctionName;
00355 
00364     virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00365 
00367     //
00368     //  WARNING!
00369     //
00370     //  Anything beyond these lines may not be documented accurately and is
00371     //  subject to change without notice.
00372     //
00374 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00375     KFbxTRSToMatrixBOF();
00376     virtual ~KFbxTRSToMatrixBOF();
00377 
00378 
00379 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00380 };
00381 
00382 
00383 class KFbxAddBOF : public KFbxBindingOperator::Function
00384 {
00385 public:
00386     static char const* FunctionName;
00387 
00396     virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00397 
00399     //
00400     //  WARNING!
00401     //
00402     //  Anything beyond these lines may not be documented accurately and is
00403     //  subject to change without notice.
00404     //
00406 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00407     KFbxAddBOF();
00408     virtual ~KFbxAddBOF();
00409 
00410 
00411 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00412 };
00413 
00414 
00415 class KFbxSubstractBOF : public KFbxBindingOperator::Function
00416 {
00417 public:
00418     static char const* FunctionName;
00419 
00428     virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00429 
00431     //
00432     //  WARNING!
00433     //
00434     //  Anything beyond these lines may not be documented accurately and is
00435     //  subject to change without notice.
00436     //
00438 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00439     KFbxSubstractBOF();
00440     virtual ~KFbxSubstractBOF();
00441 
00442 
00443 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00444 };
00445 
00446 
00447 class KFbxMultiplyBOF : public KFbxBindingOperator::Function
00448 {
00449 public:
00450     static char const* FunctionName;
00451 
00460     virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00461 
00463     //
00464     //  WARNING!
00465     //
00466     //  Anything beyond these lines may not be documented accurately and is
00467     //  subject to change without notice.
00468     //
00470 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00471     KFbxMultiplyBOF();
00472     virtual ~KFbxMultiplyBOF();
00473 
00474 
00475 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00476 };
00477 
00478 
00479 class KFbxMultiplyDistBOF : public KFbxBindingOperator::Function
00480 {
00481 public:
00482     static char const* FunctionName;
00483 
00492     virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00493 
00495     //
00496     //  WARNING!
00497     //
00498     //  Anything beyond these lines may not be documented accurately and is
00499     //  subject to change without notice.
00500     //
00502 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00503     KFbxMultiplyDistBOF();
00504     virtual ~KFbxMultiplyDistBOF();
00505 
00506 
00507 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00508 };
00509 
00510 class KFbxOneOverXBOF : public KFbxBindingOperator::Function
00511 {
00512 public:
00513     static char const* FunctionName;
00514 
00523     virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00524 
00526     //
00527     //  WARNING!
00528     //
00529     //  Anything beyond these lines may not be documented accurately and is
00530     //  subject to change without notice.
00531     //
00533 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00534     KFbxOneOverXBOF();
00535     virtual ~KFbxOneOverXBOF();
00536 
00537 
00538 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00539 };
00540 
00541 class KFbxPowerBOF : public KFbxBindingOperator::Function
00542 {
00543 public:
00544     static char const* FunctionName;
00545 
00554     virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00555 
00557     //
00558     //  WARNING!
00559     //
00560     //  Anything beyond these lines may not be documented accurately and is
00561     //  subject to change without notice.
00562     //
00564 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00565     KFbxPowerBOF();
00566     virtual ~KFbxPowerBOF();
00567 
00568 
00569 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00570 };
00571 
00572 class KFbxDegreeToRadian : public KFbxBindingOperator::Function
00573 {
00574 public:
00575     static char const* FunctionName;
00576 
00585     virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00586 
00588     //
00589     //  WARNING!
00590     //
00591     //  Anything beyond these lines may not be documented accurately and is
00592     //  subject to change without notice.
00593     //
00595 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00596     KFbxDegreeToRadian();
00597     virtual ~KFbxDegreeToRadian();
00598 
00599 
00600 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00601 };
00602 
00603 
00604 class KFbxVectorDegreeToVectorRadian : public KFbxBindingOperator::Function
00605 {
00606 public:
00607     static char const* FunctionName;
00608 
00617     virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00618 
00620     //
00621     //  WARNING!
00622     //
00623     //  Anything beyond these lines may not be documented accurately and is
00624     //  subject to change without notice.
00625     //
00627 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00628     KFbxVectorDegreeToVectorRadian();
00629     virtual ~KFbxVectorDegreeToVectorRadian();
00630 
00631 
00632 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00633 };
00634 
00635 
00636 
00637 class KFbxSphericalToCartesianBOF : public KFbxBindingOperator::Function
00638 {
00639 public:
00640     static char const* FunctionName;
00641 
00650     virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00651 
00653     //
00654     //  WARNING!
00655     //
00656     //  Anything beyond these lines may not be documented accurately and is
00657     //  subject to change without notice.
00658     //
00660 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00661     KFbxSphericalToCartesianBOF();
00662     virtual ~KFbxSphericalToCartesianBOF();
00663 
00664 
00665 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00666 };
00667 
00668 
00669 
00670 class KFbxIsYup : public KFbxBindingOperator::Function
00671 {
00672 public:
00673     static char const* FunctionName;
00674 
00683     virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00684 
00686     //
00687     //  WARNING!
00688     //
00689     //  Anything beyond these lines may not be documented accurately and is
00690     //  subject to change without notice.
00691     //
00693 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00694     KFbxIsYup();
00695     virtual ~KFbxIsYup();
00696 
00697 
00698 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00699 };
00700 
00701 
00702 
00703 
00704 class KFbxSymbolIDBOF : public KFbxBindingOperator::Function
00705 {
00706 public:
00707     static char const* FunctionName;
00708 
00717     virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00718 
00720     //
00721     //  WARNING!
00722     //
00723     //  Anything beyond these lines may not be documented accurately and is
00724     //  subject to change without notice.
00725     //
00727 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00728     KFbxSymbolIDBOF();
00729     virtual ~KFbxSymbolIDBOF();
00730 
00731 
00732 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00733 };
00734 
00735 
00736 
00737 class KFbxSpotDistributionChooserBOF : public KFbxBindingOperator::Function
00738 {
00739 public:
00740     static char const* FunctionName;
00741 
00750     virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00751 
00753     //
00754     //  WARNING!
00755     //
00756     //  Anything beyond these lines may not be documented accurately and is
00757     //  subject to change without notice.
00758     //
00760 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00761     KFbxSpotDistributionChooserBOF();
00762     virtual ~KFbxSpotDistributionChooserBOF();
00763 
00764 
00765 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00766 };
00767 
00768 
00769 
00770 class KFbxNodePositionBOF : public KFbxBindingOperator::Function
00771 {
00772 public:
00773     static char const* FunctionName;
00774 
00783     virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00784 
00786     //
00787     //  WARNING!
00788     //
00789     //  Anything beyond these lines may not be documented accurately and is
00790     //  subject to change without notice.
00791     //
00793 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00794     KFbxNodePositionBOF();
00795     virtual ~KFbxNodePositionBOF();
00796 
00797 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00798 };
00799 
00800 
00801 
00802 class KFbxNodeDirectionBOF : public KFbxBindingOperator::Function
00803 {
00804 public:
00805     static char const* FunctionName;
00806 
00815     virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00816 
00818     //
00819     //  WARNING!
00820     //
00821     //  Anything beyond these lines may not be documented accurately and is
00822     //  subject to change without notice.
00823     //
00825 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00826     KFbxNodeDirectionBOF();
00827     virtual ~KFbxNodeDirectionBOF();
00828 
00829 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00830 };
00831 
00832 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00833 
00834 #endif // FBXFILESDK_KFBXPLUGINS_KFBXBINDINGOPERATOR_H
00835