kfbximplementationutils.h File Reference

#include <fbxfilesdk/fbxfilesdk_def.h>
#include <fbxfilesdk/kfbxplugins/kfbximplementation.h>
#include <fbxfilesdk/kfbxplugins/kfbxbindingoperator.h>
#include <fbxfilesdk/kfbxplugins/kfbxoperatorentryview.h>
#include <fbxfilesdk/kfbxplugins/kfbxpropertyentryview.h>
#include <fbxfilesdk/fbxfilesdk_nsbegin.h>
#include <fbxfilesdk/fbxfilesdk_nsend.h>

Go to the source code of this file.

Functions

KFBX_DLL KFbxImplementation const *  GetImplementation (KFbxObject const *pObject, char const *pImplementationTarget)
  Get KFbxImplementation from KFbxObject.
template<typename T >
bool  GetBoundPropertyValue (KFbxBindingTable const *pBindingTable, char const *pEntryName, KFbxImplementation const *pImplementation, KFbxObject const *pBoundObject, T &pValue)
  Get bound property value from KFbxBindingTable.

Detailed Description

Definition in file kfbximplementationutils.h.


Function Documentation

KFBX_DLL KFbxImplementation const* GetImplementation ( KFbxObject const *  pObject,
char const *  pImplementationTarget 
)

Get KFbxImplementation from KFbxObject.

Parameters:
pObject KFbxObject to get KFbxImplementation.
pImplementationTarget Name of the implementation property to get.
Returns:
KFbxImplementation Pointer to KFbxImplementation.
Examples:
ImportScene/DisplayMaterial.cxx.
bool GetBoundPropertyValue ( KFbxBindingTable const *  pBindingTable,
char const *  pEntryName,
KFbxImplementation const *  pImplementation,
KFbxObject const *  pBoundObject,
T &  pValue 
)

Get bound property value from KFbxBindingTable.

Parameters:
pBindingTable KFbxBindingTable to get bound property value.
pEntryName Name of the Entry type to get.
pImplementation KFbxImplementation of the bound property value to get if the Entry type is KFbxOperatorEntryView::sEntryType.
pBoundObject KFbxObject of the bound property value to get if the Entry type is KFbxPropertyEntryView::sEntryType.
pValue Pointer to bound property value from KFbxBindingTable.
Returns:
Whether get bound property value success or not.

Definition at line 41 of file kfbximplementationutils.h.

{
    if ((NULL != pImplementation) && (NULL != pBindingTable) && (NULL != pBoundObject) && (NULL != pEntryName))
    {
        KFbxBindingTableEntry const* lEntry = pBindingTable->GetEntryForDestination(pEntryName);

        if (NULL != lEntry)
        {
            if (strcmp(lEntry->GetEntryType(true), KFbxPropertyEntryView::sEntryType) == 0)
            {
                char const* lPropName = lEntry->GetSource();
                KFbxProperty lProp = pBoundObject->FindPropertyHierarchical(lPropName);
                if (lProp.IsValid())
                {
                    KFbxGet(lProp, pValue);
                    return true;
                }
            }
            else if (strcmp(lEntry->GetEntryType(true), KFbxOperatorEntryView::sEntryType) == 0)
            {
                char const* lOperatorName = lEntry->GetSource();
                KFbxBindingOperator const* lOp = pImplementation->GetOperatorByTargetName(lOperatorName);
                if (lOp)
                {
                    return lOp->Evaluate(pBoundObject, &pValue);
                }
            }
        }
    }

    return false;
}