FBX C++ API Reference
fbximplementationutils.h
Go to the documentation of this file.
1 /****************************************************************************************
2 
3  Copyright (C) 2015 Autodesk, Inc.
4  All rights reserved.
5 
6  Use of this software is subject to the terms of the Autodesk license agreement
7  provided at the time of installation or download, or which otherwise accompanies
8  this software in either electronic or hard copy form.
9 
10 ****************************************************************************************/
11 
13 #ifndef _FBXSDK_SCENE_SHADING_IMPLEMENTATION_UTILS_H_
14 #define _FBXSDK_SCENE_SHADING_IMPLEMENTATION_UTILS_H_
15 
16 #include <fbxsdk/fbxsdk_def.h>
17 
22 
23 #include <fbxsdk/fbxsdk_nsbegin.h>
24 
30 FBXSDK_DLL const FbxImplementation* GetImplementation( const FbxObject* pObject, const char* pImplementationTarget );
31 
40 template <typename T> bool GetBoundPropertyValue(const FbxBindingTable* pBindingTable,
41  const char* pEntryName,
42  const FbxImplementation* pImplementation,
43  const FbxObject* pBoundObject,
44  T& pValue)
45 {
46  if ((NULL != pImplementation) && (NULL != pBindingTable) && (NULL != pBoundObject) && (NULL != pEntryName))
47  {
48  const FbxBindingTableEntry* lEntry = pBindingTable->GetEntryForDestination(pEntryName);
49 
50  if (NULL != lEntry)
51  {
52  if (strcmp(lEntry->GetEntryType(true), FbxPropertyEntryView::sEntryType) == 0)
53  {
54  const char* lPropName = lEntry->GetSource();
55  FbxProperty lProp = pBoundObject->FindPropertyHierarchical(lPropName);
56  if (lProp.IsValid())
57  {
58  pValue = lProp.Get<T>();
59  return true;
60  }
61  }
62  else if (strcmp(lEntry->GetEntryType(true), FbxOperatorEntryView::sEntryType) == 0)
63  {
64  const char* lOperatorName = lEntry->GetSource();
65  const FbxBindingOperator* lOp = pImplementation->GetOperatorByTargetName(lOperatorName);
66  if (lOp)
67  {
68  return lOp->Evaluate(pBoundObject, &pValue);
69  }
70  }
71  }
72  }
73 
74  return false;
75 }
76 
77 #include <fbxsdk/fbxsdk_nsend.h>
78 
79 #endif /* _FBXSDK_SCENE_SHADING_IMPLEMENTATION_UTILS_H_ */
FBX SDK environment definition.
FbxProperty FindPropertyHierarchical(const char *pName, bool pCaseSensitive=true) const
Searches a property by full name.
Definition: fbxobject.h:688
const FbxBindingOperator * GetOperatorByTargetName(const char *pTargetName) const
Returns the binding operator that has the given name.
#define NULL
Definition: fbxarch.h:210
A binding table entry stores a binding between a source and a destination.
bool Evaluate(const FbxObject *pObject, FBXTYPE *pResult) const
Run the operator on the given object.
bool GetBoundPropertyValue(const FbxBindingTable *pBindingTable, const char *pEntryName, const FbxImplementation *pImplementation, const FbxObject *pBoundObject, T &pValue)
Get bound property value from FbxBindingTable.
This object represents the shading node implementation.
const FbxBindingTableEntry * GetEntryForDestination(const char *pDestName) const
Retrieve the table entry for the given destination value.
The base class of most FBX objects.
Definition: fbxobject.h:157
const char * GetEntryType(bool pAsSource) const
Get the source type or destination type.
static const char * sEntryType
Name of the entry type used in the binding entry.
const FbxImplementation * GetImplementation(const FbxObject *pObject, const char *pImplementationTarget)
Get FbxImplementation from FbxObject.
T Get() const
Gets the value of the property.
Definition: fbxproperty.h:289
Class to hold user properties.
Definition: fbxproperty.h:37
A binding table represents a collection of bindings from source types such as FbxObject, or FbxLayerElements to corresponding destinations, usually a third party shader parameters.
This object represents a binding operation on a FbxObject or FbxProperty.
#define FBXSDK_DLL
Definition: fbxarch.h:173
bool IsValid() const
Judges the property&#39;s validity.
static const char * sEntryType
Name of the entry type used in the binding entry.
const char * GetSource() const
Retrieve the source.