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