00001
00004 #ifndef FBXFILESDK_KFBXPLUGINS_KFBXBINDINGOPERATOR_H
00005 #define FBXFILESDK_KFBXPLUGINS_KFBXBINDINGOPERATOR_H
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 #include <fbxfilesdk/fbxfilesdk_def.h>
00042
00043 #include <fbxfilesdk/kfbxplugins/kfbxbindingtablebase.h>
00044
00045 #include <fbxfilesdk/components/kbaselib/klib/kmap.h>
00046 #include <fbxfilesdk/components/kbaselib/klib/kstring.h>
00047
00048 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00049
00075 class KFBX_DLL KFbxBindingOperator : public KFbxBindingTableBase
00076 {
00077 KFBXOBJECT_DECLARE(KFbxBindingOperator,KFbxBindingTableBase);
00078
00079 public:
00085 template <class FBXTYPE>
00086 bool Evaluate(KFbxObject const* pObject, FBXTYPE* pResult) const
00087 {
00088 EFbxType lResultType;
00089 void* lResult = NULL;
00090
00091 bool lSuccess = Evaluate(pObject, &lResultType, &lResult);
00092
00093 if (lSuccess)
00094 {
00095 fbxCopy(*pResult, lResult, lResultType);
00096 }
00097
00098 FreeEvaluationResult(lResultType, lResult);
00099
00100 return lSuccess;
00101 }
00102
00111 template <class FBXTYPE>
00112 bool ReverseEvaluation(KFbxObject const* pObject, FBXTYPE * pInOut,
00113 bool setObj=false, int index=0) const
00114 {
00115
00116 void const* lIn = pInOut;
00117 void* lOut = NULL;
00118 EFbxType lOutType;
00119
00120 bool lSuccess = ReverseEvaluate(pObject, lIn, &lOut, &lOutType, setObj, index);
00121
00122 if (lSuccess)
00123 {
00124 fbxCopy(*pInOut, lOut, lOutType);
00125 }
00126
00127 FreeEvaluationResult(lOutType, lOut);
00128
00129 return lSuccess;
00130 }
00131
00138 template <class FBXTYPE>
00139 bool EvaluateEntry(KFbxObject const* pObject, char const* pEntryDestinationName, FBXTYPE* pResult) const
00140 {
00141 EFbxType lResultType;
00142 void* lResult = NULL;
00143
00144 bool lSuccess = EvaluateEntry(pObject, pEntryDestinationName, &lResultType, &lResult);
00145
00146 if (lSuccess)
00147 {
00148 fbxCopy(*pResult, lResult, lResultType);
00149 }
00150
00151 FreeEvaluationResult(lResultType, lResult);
00152
00153 return lSuccess;
00154 }
00155
00156
00157 KFbxTypedProperty<fbxString> FunctionName;
00158 KFbxTypedProperty<fbxString> TargetName;
00159
00161
00163
00164
00165 static const char* sFunctionName;
00166 static const char* sTargetName;
00167
00168
00169 static const char* sDefaultFunctionName;
00170 static const char* sDefaultTargetName;
00171
00172
00174
00176
00180 static void RegisterFunctions();
00181
00185 static void UnregisterFunctions();
00186
00187
00192 class KFBX_DLL Function
00193 {
00194 public:
00195 virtual ~Function() {}
00196 virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const = 0;
00197 virtual bool ReverseEvaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pTarget, void const* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const = 0;
00198 };
00199
00203 class KFBX_DLL FunctionCreatorBase
00204 {
00205 public:
00206 virtual ~FunctionCreatorBase() {}
00207 virtual char const* GetFunctionName() const = 0;
00208 virtual Function* CreateFunction() const = 0;
00209 };
00210
00214 template <class FUNCTION>
00215 class FunctionCreator : public FunctionCreatorBase
00216 {
00217 public:
00218 virtual char const* GetFunctionName() const
00219 {
00220 return FUNCTION::FunctionName;
00221 }
00222
00223 virtual Function* CreateFunction() const
00224 {
00225 return FbxSdkNew< FUNCTION >();
00226 }
00227 };
00228
00232 class KFBX_DLL FunctionRegistry
00233 {
00234 public:
00235 static void RegisterFunctionCreator(FunctionCreatorBase const& pCreator)
00236 {
00237 sRegistry.Insert(pCreator.GetFunctionName(), &pCreator);
00238 }
00239
00240 static void UnregisterFunctionCreator(FunctionCreatorBase const& pCreator)
00241 {
00242 sRegistry.Remove(pCreator.GetFunctionName());
00243 }
00244
00245 static FunctionCreatorBase const* FindCreator(char const* pName)
00246 {
00247 RegistryType::RecordType* lRecord = sRegistry.Find(pName);
00248
00249 if (lRecord)
00250 {
00251 return lRecord->GetValue();
00252 }
00253 else
00254 {
00255 return NULL;
00256 }
00257 }
00258
00259 private:
00260 typedef KMap<char const*, FunctionCreatorBase const*, KCharCompare> RegistryType;
00261 static RegistryType sRegistry;
00262 };
00263
00264
00266
00267
00268
00269
00270
00271
00273 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00274 bool EvaluateEntry(KFbxObject const* pObject, char const* pEntryDestinationName, EFbxType* pResultType, void** pResult) const;
00275
00276
00277 bool GetEntryProperty(KFbxObject const* pObject, char const* pEntryDestinationName, KFbxProperty & pProp) const;
00278
00279 protected:
00280
00281 KFbxBindingOperator(KFbxSdkManager& pManager, char const* pName);
00282 virtual void Destruct(bool pRecursive, bool pDependents);
00283
00284 virtual bool ConstructProperties(bool pForceSet);
00285
00286 void InstantiateFunction();
00287
00295 bool Evaluate(KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00296
00299
00300 bool ReverseEvaluate(KFbxObject const* pTarget, void const* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
00301
00306 void FreeEvaluationResult(EFbxType pResultType, void* pResult) const;
00307
00308 Function* mFunction;
00309
00310 #endif //DOXYGEN_SHOULD_SKIP_THIS
00311 };
00312
00313
00316 class KFbxAssignBOF : public KFbxBindingOperator::Function
00317 {
00318 public:
00319 static char const* FunctionName;
00320
00327 virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00328 virtual bool ReverseEvaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pTarget, void const* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
00329
00331
00332
00333
00334
00335
00336
00338 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00339 KFbxAssignBOF();
00340 virtual ~KFbxAssignBOF();
00341
00342
00343 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00344 };
00345
00346
00350 class KFbxConditionalBOF : public KFbxBindingOperator::Function
00351 {
00352 public:
00353 static char const* FunctionName;
00354
00368 virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00369 virtual bool ReverseEvaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pTarget, void const* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
00370
00372
00373
00374
00375
00376
00377
00379 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00380 KFbxConditionalBOF();
00381 virtual ~KFbxConditionalBOF();
00382
00383
00384 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00385 };
00386
00387
00391 class KFbxSwitchBOF : public KFbxBindingOperator::Function
00392 {
00393 public:
00394 static char const* FunctionName;
00395
00409 virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00410 virtual bool ReverseEvaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pTarget, void const* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
00411
00413
00414
00415
00416
00417
00418
00420 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00421 KFbxSwitchBOF();
00422 virtual ~KFbxSwitchBOF();
00423
00424
00425 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00426 };
00427
00428
00429 class KFbxTRSToMatrixBOF : public KFbxBindingOperator::Function
00430 {
00431 public:
00432 static char const* FunctionName;
00433
00443 virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00444 virtual bool ReverseEvaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pTarget, void const* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
00445
00447
00448
00449
00450
00451
00452
00454 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00455 KFbxTRSToMatrixBOF();
00456 virtual ~KFbxTRSToMatrixBOF();
00457
00458
00459 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00460 };
00461
00462
00463 class KFbxAddBOF : public KFbxBindingOperator::Function
00464 {
00465 public:
00466 static char const* FunctionName;
00467
00477 virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00478 virtual bool ReverseEvaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pTarget, void const* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
00479
00481
00482
00483
00484
00485
00486
00488 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00489 KFbxAddBOF();
00490 virtual ~KFbxAddBOF();
00491
00492
00493 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00494 };
00495
00496
00497 class KFbxSubstractBOF : public KFbxBindingOperator::Function
00498 {
00499 public:
00500 static char const* FunctionName;
00501
00511 virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00512 virtual bool ReverseEvaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pTarget, void const* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
00513
00515
00516
00517
00518
00519
00520
00522 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00523 KFbxSubstractBOF();
00524 virtual ~KFbxSubstractBOF();
00525
00526
00527 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00528 };
00529
00530
00531 class KFbxMultiplyBOF : public KFbxBindingOperator::Function
00532 {
00533 public:
00534 static char const* FunctionName;
00535
00545 virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00546 virtual bool ReverseEvaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pTarget, void const* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
00547
00549
00550
00551
00552
00553
00554
00556 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00557 KFbxMultiplyBOF();
00558 virtual ~KFbxMultiplyBOF();
00559
00560
00561 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00562 };
00563
00564
00565 class KFbxMultiplyDistBOF : public KFbxBindingOperator::Function
00566 {
00567 public:
00568 static char const* FunctionName;
00569
00579 virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00580 virtual bool ReverseEvaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pTarget, void const* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
00581
00583
00584
00585
00586
00587
00588
00590 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00591 KFbxMultiplyDistBOF();
00592 virtual ~KFbxMultiplyDistBOF();
00593
00594
00595 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00596 };
00597
00598 class KFbxOneOverXBOF : public KFbxBindingOperator::Function
00599 {
00600 public:
00601 static char const* FunctionName;
00602
00612 virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00613 virtual bool ReverseEvaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pTarget, void const* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
00614
00616
00617
00618
00619
00620
00621
00623 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00624 KFbxOneOverXBOF();
00625 virtual ~KFbxOneOverXBOF();
00626
00627
00628 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00629 };
00630
00631 class KFbxPowerBOF : public KFbxBindingOperator::Function
00632 {
00633 public:
00634 static char const* FunctionName;
00635
00645 virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00646 virtual bool ReverseEvaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pTarget, void const* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
00647
00649
00650
00651
00652
00653
00654
00656 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00657 KFbxPowerBOF();
00658 virtual ~KFbxPowerBOF();
00659
00660
00661 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00662 };
00663
00664 class KFbxDegreeToRadian : public KFbxBindingOperator::Function
00665 {
00666 public:
00667 static char const* FunctionName;
00668
00678 virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00679 virtual bool ReverseEvaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pTarget, void const* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
00680
00682
00683
00684
00685
00686
00687
00689 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00690 KFbxDegreeToRadian();
00691 virtual ~KFbxDegreeToRadian();
00692
00693
00694 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00695 };
00696
00697
00698 class KFbxVectorDegreeToVectorRadian : public KFbxBindingOperator::Function
00699 {
00700 public:
00701 static char const* FunctionName;
00702
00712 virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00713 virtual bool ReverseEvaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pTarget, void const* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
00714
00716
00717
00718
00719
00720
00721
00723 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00724 KFbxVectorDegreeToVectorRadian();
00725 virtual ~KFbxVectorDegreeToVectorRadian();
00726
00727
00728 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00729 };
00730
00731
00732
00733 class KFbxSphericalToCartesianBOF : public KFbxBindingOperator::Function
00734 {
00735 public:
00736 static char const* FunctionName;
00737
00747 virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00748 virtual bool ReverseEvaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pTarget, void const* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
00749
00751
00752
00753
00754
00755
00756
00758 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00759 KFbxSphericalToCartesianBOF();
00760 virtual ~KFbxSphericalToCartesianBOF();
00761
00762
00763 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00764 };
00765
00766
00767
00768 class KFbxIsYup : public KFbxBindingOperator::Function
00769 {
00770 public:
00771 static char const* FunctionName;
00772
00782 virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00783 virtual bool ReverseEvaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pTarget, void const* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
00784
00786
00787
00788
00789
00790
00791
00793 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00794 KFbxIsYup();
00795 virtual ~KFbxIsYup();
00796
00797
00798 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00799 };
00800
00801
00802
00806 class KFbxSymbolIDBOF : public KFbxBindingOperator::Function
00807 {
00808 public:
00809 static char const* FunctionName;
00810
00819 virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00820 virtual bool ReverseEvaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pTarget, void const* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
00821
00823
00824
00825
00826
00827
00828
00830 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00831 KFbxSymbolIDBOF();
00832 virtual ~KFbxSymbolIDBOF();
00833
00834
00835 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00836 };
00837
00838
00842 class KFbxSpotDistributionChooserBOF : public KFbxBindingOperator::Function
00843 {
00844 public:
00845 static char const* FunctionName;
00846
00856 virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00857 virtual bool ReverseEvaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pTarget, void const* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
00858
00860
00861
00862
00863
00864
00865
00867 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00868 KFbxSpotDistributionChooserBOF();
00869 virtual ~KFbxSpotDistributionChooserBOF();
00870
00871
00872 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00873 };
00874
00875
00879 class KFbxNodePositionBOF : public KFbxBindingOperator::Function
00880 {
00881 public:
00882 static char const* FunctionName;
00883
00893 virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00894 virtual bool ReverseEvaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pTarget, void const* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
00895
00897
00898
00899
00900
00901
00902
00904 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00905 KFbxNodePositionBOF();
00906 virtual ~KFbxNodePositionBOF();
00907
00908 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00909 };
00910
00911
00915 class KFbxNodeDirectionBOF : public KFbxBindingOperator::Function
00916 {
00917 public:
00918 static char const* FunctionName;
00919
00929 virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00930 virtual bool ReverseEvaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pTarget, void const* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
00931
00933
00934
00935
00936
00937
00938
00940 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00941 KFbxNodeDirectionBOF();
00942 virtual ~KFbxNodeDirectionBOF();
00943
00944 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00945 };
00946
00947 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00948
00949 #endif // FBXFILESDK_KFBXPLUGINS_KFBXBINDINGOPERATOR_H
00950