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 KFbxObject* Clone(KFbxObject* pContainer, KFbxObject::ECloneType pCloneType) const;
00286
00287 void InstantiateFunction();
00288
00296 bool Evaluate(KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00297
00300
00301 bool ReverseEvaluate(KFbxObject const* pTarget, void const* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
00302
00307 void FreeEvaluationResult(EFbxType pResultType, void* pResult) const;
00308
00309 Function* mFunction;
00310
00311 #endif //DOXYGEN_SHOULD_SKIP_THIS
00312 };
00313
00314
00317 class KFbxAssignBOF : public KFbxBindingOperator::Function
00318 {
00319 public:
00320 static char const* FunctionName;
00321
00328 virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00329 virtual bool ReverseEvaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pTarget, void const* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
00330
00332
00333
00334
00335
00336
00337
00339 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00340 KFbxAssignBOF();
00341 virtual ~KFbxAssignBOF();
00342
00343
00344 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00345 };
00346
00347
00351 class KFbxConditionalBOF : public KFbxBindingOperator::Function
00352 {
00353 public:
00354 static char const* FunctionName;
00355
00369 virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00370 virtual bool ReverseEvaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pTarget, void const* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
00371
00373
00374
00375
00376
00377
00378
00380 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00381 KFbxConditionalBOF();
00382 virtual ~KFbxConditionalBOF();
00383
00384
00385 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00386 };
00387
00388
00392 class KFbxSwitchBOF : public KFbxBindingOperator::Function
00393 {
00394 public:
00395 static char const* FunctionName;
00396
00410 virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00411 virtual bool ReverseEvaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pTarget, void const* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
00412
00414
00415
00416
00417
00418
00419
00421 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00422 KFbxSwitchBOF();
00423 virtual ~KFbxSwitchBOF();
00424
00425
00426 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00427 };
00428
00429
00430 class KFbxTRSToMatrixBOF : public KFbxBindingOperator::Function
00431 {
00432 public:
00433 static char const* FunctionName;
00434
00444 virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00445 virtual bool ReverseEvaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pTarget, void const* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
00446
00448
00449
00450
00451
00452
00453
00455 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00456 KFbxTRSToMatrixBOF();
00457 virtual ~KFbxTRSToMatrixBOF();
00458
00459
00460 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00461 };
00462
00463
00464 class KFbxAddBOF : public KFbxBindingOperator::Function
00465 {
00466 public:
00467 static char const* FunctionName;
00468
00478 virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00479 virtual bool ReverseEvaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pTarget, void const* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
00480
00482
00483
00484
00485
00486
00487
00489 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00490 KFbxAddBOF();
00491 virtual ~KFbxAddBOF();
00492
00493
00494 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00495 };
00496
00497
00498 class KFbxSubstractBOF : public KFbxBindingOperator::Function
00499 {
00500 public:
00501 static char const* FunctionName;
00502
00512 virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00513 virtual bool ReverseEvaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pTarget, void const* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
00514
00516
00517
00518
00519
00520
00521
00523 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00524 KFbxSubstractBOF();
00525 virtual ~KFbxSubstractBOF();
00526
00527
00528 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00529 };
00530
00531
00532 class KFbxMultiplyBOF : public KFbxBindingOperator::Function
00533 {
00534 public:
00535 static char const* FunctionName;
00536
00546 virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00547 virtual bool ReverseEvaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pTarget, void const* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
00548
00550
00551
00552
00553
00554
00555
00557 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00558 KFbxMultiplyBOF();
00559 virtual ~KFbxMultiplyBOF();
00560
00561
00562 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00563 };
00564
00565
00566 class KFbxMultiplyDistBOF : public KFbxBindingOperator::Function
00567 {
00568 public:
00569 static char const* FunctionName;
00570
00580 virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00581 virtual bool ReverseEvaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pTarget, void const* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
00582
00584
00585
00586
00587
00588
00589
00591 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00592 KFbxMultiplyDistBOF();
00593 virtual ~KFbxMultiplyDistBOF();
00594
00595
00596 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00597 };
00598
00599 class KFbxOneOverXBOF : public KFbxBindingOperator::Function
00600 {
00601 public:
00602 static char const* FunctionName;
00603
00613 virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00614 virtual bool ReverseEvaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pTarget, void const* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
00615
00617
00618
00619
00620
00621
00622
00624 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00625 KFbxOneOverXBOF();
00626 virtual ~KFbxOneOverXBOF();
00627
00628
00629 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00630 };
00631
00632 class KFbxPowerBOF : public KFbxBindingOperator::Function
00633 {
00634 public:
00635 static char const* FunctionName;
00636
00646 virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00647 virtual bool ReverseEvaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pTarget, void const* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
00648
00650
00651
00652
00653
00654
00655
00657 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00658 KFbxPowerBOF();
00659 virtual ~KFbxPowerBOF();
00660
00661
00662 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00663 };
00664
00665 class KFbxDegreeToRadian : public KFbxBindingOperator::Function
00666 {
00667 public:
00668 static char const* FunctionName;
00669
00679 virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00680 virtual bool ReverseEvaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pTarget, void const* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
00681
00683
00684
00685
00686
00687
00688
00690 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00691 KFbxDegreeToRadian();
00692 virtual ~KFbxDegreeToRadian();
00693
00694
00695 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00696 };
00697
00698
00699 class KFbxVectorDegreeToVectorRadian : public KFbxBindingOperator::Function
00700 {
00701 public:
00702 static char const* FunctionName;
00703
00713 virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00714 virtual bool ReverseEvaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pTarget, void const* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
00715
00717
00718
00719
00720
00721
00722
00724 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00725 KFbxVectorDegreeToVectorRadian();
00726 virtual ~KFbxVectorDegreeToVectorRadian();
00727
00728
00729 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00730 };
00731
00732
00733
00734 class KFbxSphericalToCartesianBOF : public KFbxBindingOperator::Function
00735 {
00736 public:
00737 static char const* FunctionName;
00738
00748 virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00749 virtual bool ReverseEvaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pTarget, void const* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
00750
00752
00753
00754
00755
00756
00757
00759 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00760 KFbxSphericalToCartesianBOF();
00761 virtual ~KFbxSphericalToCartesianBOF();
00762
00763
00764 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00765 };
00766
00767
00768
00769 class KFbxIsYup : public KFbxBindingOperator::Function
00770 {
00771 public:
00772 static char const* FunctionName;
00773
00783 virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00784 virtual bool ReverseEvaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pTarget, void const* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
00785
00787
00788
00789
00790
00791
00792
00794 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00795 KFbxIsYup();
00796 virtual ~KFbxIsYup();
00797
00798
00799 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00800 };
00801
00802
00803
00807 class KFbxSymbolIDBOF : public KFbxBindingOperator::Function
00808 {
00809 public:
00810 static char const* FunctionName;
00811
00820 virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00821 virtual bool ReverseEvaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pTarget, void const* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
00822
00824
00825
00826
00827
00828
00829
00831 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00832 KFbxSymbolIDBOF();
00833 virtual ~KFbxSymbolIDBOF();
00834
00835
00836 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00837 };
00838
00839
00843 class KFbxSpotDistributionChooserBOF : public KFbxBindingOperator::Function
00844 {
00845 public:
00846 static char const* FunctionName;
00847
00857 virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00858 virtual bool ReverseEvaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pTarget, void const* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
00859
00861
00862
00863
00864
00865
00866
00868 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00869 KFbxSpotDistributionChooserBOF();
00870 virtual ~KFbxSpotDistributionChooserBOF();
00871
00872
00873 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00874 };
00875
00876
00880 class KFbxNodePositionBOF : public KFbxBindingOperator::Function
00881 {
00882 public:
00883 static char const* FunctionName;
00884
00894 virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00895 virtual bool ReverseEvaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pTarget, void const* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
00896
00898
00899
00900
00901
00902
00903
00905 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00906 KFbxNodePositionBOF();
00907 virtual ~KFbxNodePositionBOF();
00908
00909 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00910 };
00911
00912
00916 class KFbxNodeDirectionBOF : public KFbxBindingOperator::Function
00917 {
00918 public:
00919 static char const* FunctionName;
00920
00930 virtual bool Evaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pObject, EFbxType* pResultType, void** pResult) const;
00931 virtual bool ReverseEvaluate(KFbxBindingOperator const* pOperator, KFbxObject const* pTarget, void const* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const;
00932
00934
00935
00936
00937
00938
00939
00941 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00942 KFbxNodeDirectionBOF();
00943 virtual ~KFbxNodeDirectionBOF();
00944
00945 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00946 };
00947
00948 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00949
00950 #endif // FBXFILESDK_KFBXPLUGINS_KFBXBINDINGOPERATOR_H
00951