kfbxplug.h File Reference

#include <fbxfilesdk/fbxfilesdk_def.h>
#include <fbxfilesdk/kfbxevents/kfbxemitter.h>
#include <fbxfilesdk/fbxfilesdk_new.h>
#include <fbxfilesdk/fbxfilesdk_nsbegin.h>
#include <fbxfilesdk/fbxfilesdk_nsend.h>

Go to the source code of this file.

Classes

class   kFbxClassId
  Internal class used to differentiate objects during run-time. More...
class   KFbxPlug
  Top level class for any FBX object that requires ClassId functionality. More...

Defines

#define  KFBXPLUG_DECLARE(Class)
  Macro used to declare a new plug inherited class.
#define  KFBXPLUG_DECLARE_ABSTRACT(Class)
  Macro used to declare a new abstract plug inherited class.
#define  KFBXPLUG_IMPLEMENT(Class)
  Macro used to implement a new plug inherited class.
#define  KFBXPLUG_IMPLEMENT_ABSTRACT(Class)
  Macro used to implement a new abstract plug inherited class.
#define  FBX_TYPE(class)   ((class const*)0)
  Convert the class type parameter into a C class parameter for other function inputs.
#define  FBX_CLASSID(class)   (class::ClassId)
  Retrieve the ClassId of the class type parameter.

Typedefs

typedef KFbxPlug *(*  kFbxPlugConstructor )(KFbxSdkManager &pManager, const char *pName, const KFbxPlug *pFrom, const char *pFBXType, const char *pFBXSubType)
  The function pointer type for object constructor functions.

Functions

template<class T >
T *  KFbxCast (KFbxPlug *pPlug)
  Safe casting of FBX SDK objects into other FBX SDK class types.
template<class T >
T const *  KFbxCast (KFbxPlug const *pPlug)
  Safe const casting of FBX SDK objects into other FBX SDK class types.

Detailed Description

Definition in file kfbxplug.h.


Define Documentation

#define KFBXPLUG_DECLARE (   Class )
Value:
public:                                                                                         \
    KFBXNEW_DECLARE_FRIEND                                                                      \
    static kFbxClassId ClassId;                                                                 \
    static Class* Create(KFbxSdkManager *pManager, const char *pName);                          \
    static Class* SdkManagerCreate(KFbxSdkManager *pManager, const char *pName, Class* pFrom)   \
    {                                                                                           \
        Class* lClass = FbxSdkNew< Class >(*pManager, pName);                                   \
        lClass->Construct(pFrom);                                                               \
        return lClass;                                                                          \
    }                                                                                           \
    virtual kFbxClassId GetClassId() const { return ClassId; }                                  \
    friend class FBXFILESDK_NAMESPACE::KFbxSdkManager;                                          \

Macro used to declare a new plug inherited class.

Definition at line 219 of file kfbxplug.h.

#define KFBXPLUG_DECLARE_ABSTRACT (   Class )
Value:
public:                                                                                         \
    static kFbxClassId ClassId;                                                                 \
    static Class* Create(KFbxSdkManager *pManager, const char *pName);                          \
    static kFbxPlugConstructor SdkManagerCreate;                                                \
    virtual kFbxClassId GetClassId() const { return ClassId; }                                  \
    friend class FBXFILESDK_NAMESPACE::KFbxSdkManager;                                          \

Macro used to declare a new abstract plug inherited class.

Definition at line 234 of file kfbxplug.h.

#define KFBXPLUG_IMPLEMENT (   Class )
Value:
kFbxClassId Class::ClassId;                                                                 \
    Class* Class::Create(KFbxSdkManager* pManager, const char* pName)                           \
    {                                                                                           \
        Class* ClassPtr;                                                                        \
        ClassPtr = 0;                                                                           \
        return (Class*)pManager->CreateNewObjectFromClassId(Class::ClassId, pName);             \
    }                                                                                           \

Macro used to implement a new plug inherited class.

Definition at line 243 of file kfbxplug.h.

#define KFBXPLUG_IMPLEMENT_ABSTRACT (   Class )
Value:
kFbxClassId Class::ClassId;                                                                 \
    kFbxPlugConstructor Class::SdkManagerCreate = 0;                                            \
    Class* Class::Create(KFbxSdkManager *pManager, const char *pName)                           \
    {                                                                                           \
        Class* ClassPtr;                                                                        \
        ClassPtr = 0;                                                                           \
        return (Class*)pManager->CreateNewObjectFromClassId(Class::ClassId, pName);             \
    }                                                                                           \

Macro used to implement a new abstract plug inherited class.

Definition at line 253 of file kfbxplug.h.

#define FBX_TYPE (   class )    ((class const*)0)

Convert the class type parameter into a C class parameter for other function inputs.

Usage example:

 //Assuming MyCamera is a valid KFbxCamera object
 bool AreCamerasObject = MyCamera->Is(FBX_TYPE(KFbxObject)); //Should return true :)
Examples:
Animation/main.cxx, ExportDocument/main.cxx, ExportScene03/main.cxx, ImportScene/DisplayAnimation.cxx, ImportScene/DisplayGenericInfo.cxx, ImportScene/DisplayMaterial.cxx, SwitchBinding/main.cxx, ViewScene/main.cxx, and ViewScene/Texture.cxx.

Definition at line 362 of file kfbxplug.h.

#define FBX_CLASSID (   class )    (class::ClassId)

Retrieve the ClassId of the class type parameter.

Usage example:

 //Assuming MyLight is a valid KFbxLight object
 bool AreLightsObject = MyLight->Is(FBX_CLASSID(KFbxObject)); //Should return true :)
 
 //However, most people prefer this valid syntax...
 bool AreLightsObject = MyLight->Is(KFbxObject::ClassId); //Should return true :)

Definition at line 374 of file kfbxplug.h.


Typedef Documentation

typedef KFbxPlug*(* kFbxPlugConstructor)(KFbxSdkManager &pManager, const char *pName, const KFbxPlug *pFrom, const char *pFBXType, const char *pFBXSubType)

The function pointer type for object constructor functions.

Definition at line 55 of file kfbxplug.h.


Function Documentation

T* KFbxCast ( KFbxPlug pPlug ) [inline]

Safe casting of FBX SDK objects into other FBX SDK class types.

This cast will perform the complete test to make sure the object inherits from the requested class type. This is the equivalent of a dynamic_cast but much faster.

Parameters:
pPlug The object to try to cast into T type.
Returns:
A non-null pointer if the cast was successful.

Definition at line 382 of file kfbxplug.h.

{
    return pPlug && pPlug->Is(FBX_CLASSID(T)) ? (T *)pPlug : 0;
}
T const* KFbxCast ( KFbxPlug const *  pPlug ) [inline]

Safe const casting of FBX SDK objects into other FBX SDK class types.

This cast will perform the complete test to make sure the object inherits from the requested class type. This is the equivalent of a dynamic_cast but much faster.

Parameters:
pPlug The object to try to cast into T type.
Returns:
A non-null pointer if the cast was successful.

Definition at line 393 of file kfbxplug.h.

{
    return pPlug && pPlug->Is(FBX_CLASSID(T)) ? (T const*)pPlug : 0;
}