Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes

KFbxBindingOperator Class Reference

Search for all occurrences

Detailed Description

This object represents a binding operation on a KFbxObject or KFbxProperty.

For example, KFbxBindingOperator can be used to bind a light object to a parameter of shader via KFbxNodeDirectionBOF or KFbxNodePositionBOF.

  // create entry
  KFbxBindingTableEntry& lEntry = lTable->AddNewEntry();
  
  //Create NodePosition binding operator function
  KFbxOperatorEntryView lSrc(&lEntry, true, true);
  lSrc.SetOperatorName( "NodePositionConvert");
  KFbxBindingOperator* lOp = pImpl.AddNewBindingOperator( "NodePositionConvert", KFbxNodePositionBOF::FunctionName);
  
  //Add property entry to operator to remember the property's name
  KFbxBindingTableEntry& lEntryPropParam = lOp->AddNewEntry();
  KFbxPropertyEntryView lPropSrc(&lEntryPropParam, true, true);
  lPropSrc.SetProperty(lProp.GetHierarchicalName());
  lEntryPropParam.SetDestination( KFbxNodePositionBOF::FunctionName );
  
  // set dst to the shader parameter
  KFbxSemanticEntryView lDst( &lEntry, false, true );
  lDst.SetSemantic( lProp.GetName() );
See also:
KFbxOperatorEntryView, KFbxBindingTableEntry, KFbxPropertyEntryView

Definition at line 75 of file kfbxbindingoperator.h.

#include <kfbxbindingoperator.h>

Inheritance diagram for KFbxBindingOperator:
Inheritance graph
[legend]

List of all members.

Classes

class   Function
  It represents a binding relationship between current object and the target. More...
class   FunctionCreator
  The concrete factory class for binding function. More...
class   FunctionCreatorBase
  The abstract factory class for binding function. More...
class   FunctionRegistry
  This utility class is used for fast accessing the binding function creators by name. More...

Public Member Functions

template<class FBXTYPE >
bool  Evaluate (KFbxObject const *pObject, FBXTYPE *pResult) const
  Run the operator on the given object.
template<class FBXTYPE >
bool  ReverseEvaluation (KFbxObject const *pObject, FBXTYPE *pInOut, bool setObj=false, int index=0) const
  Run the 'inverse' operator on the given object, assigning the result directly to the object.
template<class FBXTYPE >
bool  EvaluateEntry (KFbxObject const *pObject, char const *pEntryDestinationName, FBXTYPE *pResult) const
  Evaluate the value of an operator parameter.
bool  EvaluateEntry (KFbxObject const *pObject, char const *pEntryDestinationName, EFbxType *pResultType, void **pResult) const
bool  GetEntryProperty (KFbxObject const *pObject, char const *pEntryDestinationName, KFbxProperty &pProp) const

Static Public Member Functions

static void  RegisterFunctions ()
static void  UnregisterFunctions ()

Public Attributes

KFbxTypedProperty< fbxString FunctionName
KFbxTypedProperty< fbxString TargetName

Static Public Attributes

static const char *  sFunctionName
static const char *  sTargetName
static const char *  sDefaultFunctionName
static const char *  sDefaultTargetName

Protected Member Functions

  KFbxBindingOperator (KFbxSdkManager &pManager, char const *pName)
virtual void  Destruct (bool pRecursive, bool pDependents)
virtual bool  ConstructProperties (bool pForceSet)
void  InstantiateFunction ()
bool  Evaluate (KFbxObject const *pObject, EFbxType *pResultType, void **pResult) const
  Run the operator on the given object.
bool  ReverseEvaluate (KFbxObject const *pTarget, void const *pIn, void **pOut, EFbxType *pOutType, bool setObj, int index) const
  Apply the 'reverse' operator.
void  FreeEvaluationResult (EFbxType pResultType, void *pResult) const
  Free a buffer allocated by Evaluate().

Protected Attributes

Function mFunction

Constructor & Destructor Documentation

KFbxBindingOperator ( KFbxSdkManager pManager,
char const *  pName 
) [protected]

Member Function Documentation

bool Evaluate ( KFbxObject const *  pObject,
FBXTYPE *  pResult 
) const [inline]

Run the operator on the given object.

Parameters:
pObject The object that will be evaluated.
pResult A pointer to a buffer to hold the result.
Returns:
true on success, false otherwise.

Definition at line 86 of file kfbxbindingoperator.h.

    {
        EFbxType lResultType;
        void* lResult = NULL;

        bool lSuccess = Evaluate(pObject, &lResultType, &lResult);

        if (lSuccess)
        {
            fbxCopy(*pResult, lResult, lResultType);
        }

        FreeEvaluationResult(lResultType, lResult);

        return lSuccess;
    }
bool ReverseEvaluation ( KFbxObject const *  pObject,
FBXTYPE *  pInOut,
bool  setObj = false,
int  index = 0 
) const [inline]

Run the 'inverse' operator on the given object, assigning the result directly to the object.

Parameters:
pObject The object that will be evaluated.
pInOut Type of value being reversed.
setObj Control to set the property (default only queries).
index Used only in KFbxMultiplyDistBOF ('1' get's realWorldScale).
Returns:
true on success, false otherwise.

Definition at line 112 of file kfbxbindingoperator.h.

    {

        void const* lIn = pInOut;
        void* lOut = NULL;
        EFbxType lOutType;

        bool lSuccess = ReverseEvaluate(pObject, lIn, &lOut, &lOutType, setObj, index);

        if (lSuccess)
        {
            fbxCopy(*pInOut, lOut, lOutType);
        }

        FreeEvaluationResult(lOutType, lOut);

        return lSuccess;
    }
bool EvaluateEntry ( KFbxObject const *  pObject,
char const *  pEntryDestinationName,
FBXTYPE *  pResult 
) const [inline]

Evaluate the value of an operator parameter.

Parameters:
pObject The object that will be evaluated.
pEntryDestinationName The name of the parameter.
pResult A pointer to the result.
Returns:
true on success, false otherwise.

Definition at line 139 of file kfbxbindingoperator.h.

    {
        EFbxType lResultType;
        void* lResult = NULL;

        bool lSuccess = EvaluateEntry(pObject, pEntryDestinationName, &lResultType, &lResult);

        if (lSuccess)
        {
            fbxCopy(*pResult, lResult, lResultType);
        }

        FreeEvaluationResult(lResultType, lResult);

        return lSuccess;
    }
static void RegisterFunctions ( ) [static]
static void UnregisterFunctions ( ) [static]
bool EvaluateEntry ( KFbxObject const *  pObject,
char const *  pEntryDestinationName,
EFbxType pResultType,
void **  pResult 
) const
bool GetEntryProperty ( KFbxObject const *  pObject,
char const *  pEntryDestinationName,
KFbxProperty pProp 
) const
virtual void Destruct ( bool  pRecursive,
bool  pDependents 
) [protected, virtual]
virtual bool ConstructProperties ( bool  pForceSet ) [protected, virtual]
void InstantiateFunction ( ) [protected]
bool Evaluate ( KFbxObject const *  pObject,
EFbxType pResultType,
void **  pResult 
) const [protected]

Run the operator on the given object.

Parameters:
pObject The object that will be evaluated.
pResultType Will be filled by the type of the result.
pResult Will be filled by a pointer to a buffer that hold the result. The caller must call FreeEvaluationResult() when its done with this pointer.
Returns:
true on success, false otherwise.
bool ReverseEvaluate ( KFbxObject const *  pTarget,
void const *  pIn,
void **  pOut,
EFbxType pOutType,
bool  setObj,
int  index 
) const [protected]

Apply the 'reverse' operator.

void FreeEvaluationResult ( EFbxType  pResultType,
void *  pResult 
) const [protected]

Free a buffer allocated by Evaluate().

Parameters:
pResult Type The type of data held by pResult.
pResult The pointer to free.

Member Data Documentation

const char* sFunctionName [static]
const char* sTargetName [static]
const char* sDefaultFunctionName [static]
const char* sDefaultTargetName [static]
Function* mFunction [protected]

The documentation for this class was generated from the following file:

KFbxBindingOperator KFbxBindingOperator KFbxBindingOperator KFbxBindingOperator KFbxBindingOperator KFbxBindingOperator KFbxBindingOperator KFbxBindingOperator KFbxBindingOperator KFbxBindingOperator
KFbxBindingOperator KFbxBindingOperator KFbxBindingOperator KFbxBindingOperator KFbxBindingOperator KFbxBindingOperator KFbxBindingOperator KFbxBindingOperator KFbxBindingOperator KFbxBindingOperator