fbxsdk/scene/shading/fbximplementationutils.h Source File
 
 
 
fbxsdk/scene/shading/fbximplementationutils.h
Go to the documentation of this file.
00001 /****************************************************************************************
00002  
00003    Copyright (C) 2013 Autodesk, Inc.
00004    All rights reserved.
00005  
00006    Use of this software is subject to the terms of the Autodesk license agreement
00007    provided at the time of installation or download, or which otherwise accompanies
00008    this software in either electronic or hard copy form.
00009  
00010 ****************************************************************************************/
00011 
00013 #ifndef _FBXSDK_SCENE_SHADING_IMPLEMENTATION_UTILS_H_
00014 #define _FBXSDK_SCENE_SHADING_IMPLEMENTATION_UTILS_H_
00015 
00016 #include <fbxsdk/fbxsdk_def.h>
00017 
00018 #include <fbxsdk/scene/shading/fbximplementation.h>
00019 #include <fbxsdk/scene/shading/fbxbindingoperator.h>
00020 #include <fbxsdk/scene/shading/fbxoperatorentryview.h>
00021 #include <fbxsdk/scene/shading/fbxpropertyentryview.h>
00022 
00023 #include <fbxsdk/fbxsdk_nsbegin.h>
00024 
00030 FBXSDK_DLL const FbxImplementation* GetImplementation( const FbxObject* pObject, const char* pImplementationTarget );
00031 
00040 template <typename T> bool GetBoundPropertyValue(const FbxBindingTable* pBindingTable,
00041                                                  const char* pEntryName, 
00042                                                  const FbxImplementation* pImplementation,
00043                                                  const FbxObject* pBoundObject,
00044                                                  T& pValue)
00045 {
00046     if ((NULL != pImplementation) && (NULL != pBindingTable) && (NULL != pBoundObject) && (NULL != pEntryName))
00047     {
00048         const FbxBindingTableEntry* lEntry = pBindingTable->GetEntryForDestination(pEntryName);
00049 
00050         if (NULL != lEntry)
00051         {
00052             if (strcmp(lEntry->GetEntryType(true), FbxPropertyEntryView::sEntryType) == 0)
00053             {
00054                 const char* lPropName = lEntry->GetSource();
00055                 FbxProperty lProp = pBoundObject->FindPropertyHierarchical(lPropName);
00056                 if (lProp.IsValid())
00057                 {
00058                                         pValue = lProp.Get<T>();
00059                     return true;
00060                 }
00061             }
00062             else if (strcmp(lEntry->GetEntryType(true), FbxOperatorEntryView::sEntryType) == 0)
00063             {
00064                 const char* lOperatorName = lEntry->GetSource();
00065                 const FbxBindingOperator* lOp = pImplementation->GetOperatorByTargetName(lOperatorName);
00066                 if (lOp)
00067                 {
00068                     return lOp->Evaluate(pBoundObject, &pValue);
00069                 }
00070             }
00071         }
00072     }
00073 
00074     return false;
00075 }
00076 
00077 #include <fbxsdk/fbxsdk_nsend.h>
00078 
00079 #endif /* _FBXSDK_SCENE_SHADING_IMPLEMENTATION_UTILS_H_ */