kfbximplementationutils.h

Go to the documentation of this file.
00001 
00003 #ifndef FBXFILESDK_KFBXPLUGINS_KFBXIMPLEMENTATIONUTILS_H 
00004 #define FBXFILESDK_KFBXPLUGINS_KFBXIMPLEMENTATIONUTILS_H
00005 
00006 /**************************************************************************************
00007 
00008  Copyright (C) 2001 - 2009 Autodesk, Inc. and/or its licensors.
00009  All Rights Reserved.
00010 
00011  The coded instructions, statements, computer programs, and/or related material 
00012  (collectively the "Data") in these files contain unpublished information 
00013  proprietary to Autodesk, Inc. and/or its licensors, which is protected by 
00014  Canada and United States of America federal copyright law and by international 
00015  treaties. 
00016  
00017  The Data may not be disclosed or distributed to third parties, in whole or in
00018  part, without the prior written consent of Autodesk, Inc. ("Autodesk").
00019 
00020  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00021  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
00022  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR ARISING
00023  BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES OF TITLE, 
00024  NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR USE. 
00025  WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT WARRANT THAT THE OPERATION
00026  OF THE DATA WILL BE UNINTERRUPTED OR ERROR FREE. 
00027  
00028  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
00029  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR EXPENSES
00030  OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE DAMAGES OR OTHER
00031  SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS OF PROFITS, REVENUE
00032  OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR DAMAGES OF ANY KIND),
00033  HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF LIABILITY, WHETHER DERIVED
00034  FROM CONTRACT, TORT (INCLUDING, BUT NOT LIMITED TO, NEGLIGENCE), OR OTHERWISE,
00035  ARISING OUT OF OR RELATING TO THE DATA OR ITS USE OR ANY OTHER PERFORMANCE,
00036  WHETHER OR NOT AUTODESK HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS
00037  OR DAMAGE. 
00038 
00039 **************************************************************************************/
00040 #include <fbxfilesdk/fbxfilesdk_def.h>
00041 
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 
00054 KFBX_DLL KFbxImplementation const* GetImplementation( KFbxObject const* pObject, char const* pImplementationTarget );
00055 
00056 template <typename T> bool GetBoundPropertyValue(KFbxBindingTable const* pBindingTable,
00057                                                  char const* pEntryName, 
00058                                                  KFbxImplementation const* pImplementation,
00059                                                  KFbxObject const* pBoundObject,
00060                                                  T& pValue)
00061 {
00062     if ((NULL != pImplementation) && (NULL != pBindingTable) && (NULL != pBoundObject) && (NULL != pEntryName))
00063     {
00064         KFbxBindingTableEntry const* lEntry = pBindingTable->GetEntryForDestination(pEntryName);
00065 
00066         if (NULL != lEntry)
00067         {
00068             if (strcmp(lEntry->GetEntryType(true), KFbxPropertyEntryView::sEntryType) == 0)
00069             {
00070                 char const* lPropName = lEntry->GetSource();
00071                 KFbxProperty lProp = pBoundObject->FindPropertyHierarchical(lPropName);
00072                 if (lProp.IsValid())
00073                 {
00074                     KFbxGet(lProp, pValue);
00075                     return true;
00076                 }
00077             }
00078             else if (strcmp(lEntry->GetEntryType(true), KFbxOperatorEntryView::sEntryType) == 0)
00079             {
00080                 char const* lOperatorName = lEntry->GetSource();
00081                 KFbxBindingOperator const* lOp = pImplementation->GetOperatorByTargetName(lOperatorName);
00082                 if (lOp)
00083                 {
00084                     return lOp->Evaluate(pBoundObject, &pValue);
00085                 }
00086             }
00087         }
00088     }
00089 
00090     return false;
00091 }
00092 
00093 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00094 
00095 #endif // FBXFILESDK_KFBXPLUGINS_KFBXIMPLEMENTATIONUTILS_H
00096