00001 
00003 #ifndef FBXFILESDK_KFBXPLUGINS_KFBXIMPLEMENTATIONUTILS_H 
00004 #define FBXFILESDK_KFBXPLUGINS_KFBXIMPLEMENTATIONUTILS_H
00005 
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/components/kbaselib/kaydaradef_h.h>
00042 #include <fbxfilesdk/kfbxplugins/kfbximplementation.h>
00043 #include <fbxfilesdk/kfbxplugins/kfbxbindingoperator.h>
00044 #include <fbxfilesdk/kfbxplugins/kfbxoperatorentryview.h>
00045 #include <fbxfilesdk/kfbxplugins/kfbxpropertyentryview.h>
00046 
00047 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00048 
00049 enum ImplementationTarget
00050 {
00051     eImplPreview,
00052     eImplMentalRay,
00053     eImplCGFX,
00054     eImplHLSL,
00055     eImplNone,
00056     eImplCount
00057 };
00058 
00059 
00065 KFBX_DLL KFbxImplementation const* GetImplementation( KFbxObject const* pObject, ImplementationTarget pImplementationTarget );
00066 
00067 
00068 template <typename T> bool GetBoundPropertyValue(KFbxBindingTable const* pBindingTable,
00069                                                  char const* pEntryName, 
00070                                                  KFbxImplementation const* pImplementation,
00071                                                  KFbxObject const* pBoundObject,
00072                                                  T& pValue)
00073 {
00074     if ((NULL != pImplementation) && (NULL != pBindingTable) && (NULL != pBoundObject) && (NULL != pEntryName))
00075     {
00076         KFbxBindingTableEntry const* lEntry = pBindingTable->GetEntryForDestination(pEntryName);
00077 
00078         if (NULL != lEntry)
00079         {
00080             if (strcmp(lEntry->GetEntryType(true), KFbxPropertyEntryView::sEntryType) == 0)
00081             {
00082                 char const* lPropName = lEntry->GetSource();
00083                 KFbxProperty lProp = pBoundObject->FindPropertyHierarchical(lPropName);
00084                 if (lProp.IsValid())
00085                 {
00086                     KFbxGet(lProp, pValue);
00087                     return true;
00088                 }
00089             }
00090             else if (strcmp(lEntry->GetEntryType(true), KFbxOperatorEntryView::sEntryType) == 0)
00091             {
00092                 char const* lOperatorName = lEntry->GetSource();
00093                 KFbxBindingOperator const* lOp = pImplementation->GetOperatorByTargetName(lOperatorName);
00094                 if (lOp)
00095                 {
00096                     return lOp->Evaluate(pBoundObject, &pValue);
00097                 }
00098             }
00099         }
00100     }
00101 
00102     return false;
00103 }
00104 
00105 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00106 
00107 #endif // FBXFILESDK_KFBXPLUGINS_KFBXIMPLEMENTATIONUTILS_H
00108