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

KFbxLibrary Class Reference

Search for all occurrences

Detailed Description

This library class represents libraries that store sub-libraries and shading objects.

Shading objects are objects of class KFbxTexture, KFbxSurfaceMaterial, and KFbxLight.

Definition at line 33 of file kfbxlibrary.h.

#include <kfbxlibrary.h>

Inheritance diagram for KFbxLibrary:
Inheritance graph
[legend]

List of all members.

Public Member Functions

KFbxLibrary GetParentLibrary (void) const
  Returns a pointer to the parent library if one exists.
void  SystemLibrary (bool pSystemLibrary)
  Sets whether not this library is a system library.
bool  IsSystemLibrary () const
  Returns whether or not this library is a system library.
void  LocalizationBaseNamePrefix (const char *pPrefix)
  The prefix must not include the dash and language code, nor can it contain the extension.
KString  LocalizationBaseNamePrefix () const
  Retrieves the localization prefix.
bool  AddSubLibrary (KFbxLibrary *pSubLibrary)
  Adds a sub-library.
bool  RemoveSubLibrary (KFbxLibrary *pSubLibrary)
  Removes a sub-library.
int  GetSubLibraryCount (void) const
  Returns the total number of sub-libraries.
KFbxLibrary GetSubLibrary (int pIndex) const
  Returns the sub-library at the specified index.
KFbxObject CloneAsset (KFbxObject *pToClone, KFbxObject *pOptionalDestinationContainer=NULL) const
  Clones the specified asset.
bool  ImportAssets (KFbxLibrary *pSrcLibrary)
  Transfers ownership from the source library to this library for any assets passing through the filter.
bool  ImportAssets (KFbxLibrary *pSrcLibrary, const KFbxCriteria &pAssetFilter)
  Transfers ownership from the source library to this library for any assets passing through the filter.
template<class T >
T *  InstantiateMember (T const *pFBX_TYPE, const KFbxObjectFilter &pFilter, bool pRecurse=true, KFbxObject *pOptContainer=NULL)
  Returns a new instance of a library member.
KFbxLocalizationManager &  GetLocalizationManager () const
  Returns the localization manager for the library.
virtual const char *  Localize (const char *pID, const char *pDefault=NULL) const
  Localization helper function.
bool  AddShadingObject (KFbxObject *pShadingObject)
  Adds a shading object.
bool  RemoveShadingObject (KFbxObject *pShadingObject)
  Removes a shading object.
int  GetShadingObjectCount (void) const
  Returns the total number of shading objects.
KFbxObject GetShadingObject (int pIndex) const
  Returns the shading object at the specified index.
int  GetShadingObjectCount (const KFbxImplementationFilter &pCriteria) const
  Returns the number of shading objects according to their implementations.
KFbxObject GetShadingObject (int pIndex, const KFbxImplementationFilter &pCriteria) const
  Returns a handle on the shading object at the specified index that corresponds to the given filtering parameters.

Static Public Member Functions

static KFbxCriteria  GetAssetCriteriaFilter ()
  Returns a criteria filter which you can use to filter objects when iterating items in the library.
static KFbxCriteria  GetAssetDependentsFilter ()
  Returns a filter which you should use when you clone / export objects.

Protected Member Functions

  KFbxLibrary (KFbxSdkManager &pManager, char const *pName)
virtual void  Destruct (bool pRecursive, bool pDependents)
virtual void  Construct (const KFbxLibrary *pFrom)

Protected Attributes

KFbxLocalizationManager *  mLocalizationManager

Constructor & Destructor Documentation

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

Member Function Documentation

KFbxLibrary* GetParentLibrary ( void  ) const

Returns a pointer to the parent library if one exists.

Reimplemented from KFbxObject.

void SystemLibrary ( bool  pSystemLibrary )

Sets whether not this library is a system library.

Parameters:
pSystemLibrary A flag which indicates whether or not this library is a system library.
bool IsSystemLibrary ( ) const

Returns whether or not this library is a system library.

void LocalizationBaseNamePrefix ( const char *  pPrefix )

The prefix must not include the dash and language code, nor can it contain the extension.

But if you want, it can contain a folder or sub-folder, such as: locales/mydocloc. This is resolved using the XRef Manager, with priority given to the library's ".fbm" folder, if one exists.

Parameters:
pPrefix New prefix to be set.
KString LocalizationBaseNamePrefix ( ) const

Retrieves the localization prefix.

bool AddSubLibrary ( KFbxLibrary pSubLibrary )

Adds a sub-library.

Parameters:
pSubLibrary The sub-library to be added.
Returns:
True if adding the sub-library is successful, returns false if not.
bool RemoveSubLibrary ( KFbxLibrary pSubLibrary )

Removes a sub-library.

Parameters:
pSubLibrary The sub-library to be removed.
Returns:
True if the sub-library is removed, false if not.
int GetSubLibraryCount ( void  ) const

Returns the total number of sub-libraries.

KFbxLibrary* GetSubLibrary ( int  pIndex ) const

Returns the sub-library at the specified index.

Parameters:
pIndex The sub-library index.
KFbxObject* CloneAsset ( KFbxObject pToClone,
KFbxObject pOptionalDestinationContainer = NULL 
) const

Clones the specified asset.

Parameters:
pToClone The asset to be cloned.
pOptionalDestinationContainer The container for the asset copy.
Remarks:
The asset and all its dependents are cloned.
static KFbxCriteria GetAssetCriteriaFilter ( ) [static]

Returns a criteria filter which you can use to filter objects when iterating items in the library.

Only real 'assets' are returned, rather than FBX support objects. This currently includes lights, environments, materials and textures (maps). This is typically used to IMPORT from a library.

static KFbxCriteria GetAssetDependentsFilter ( ) [static]

Returns a filter which you should use when you clone / export objects.

This filters out objects that should remain in the asset library.

Use this to EXPORT from a library (or CLONE from a library).

bool ImportAssets ( KFbxLibrary pSrcLibrary )

Transfers ownership from the source library to this library for any assets passing through the filter.

It is assumed that name conflicts and other details have been resolved beforehand.

External asset files required by the assets are copied (not moved). It's up to the owner of the source library to clean up the files if the files are not on a read-only transport. If this document hasn't been committed yet, the assets will not be copied.

Returns true if no filtered assets were skipped. If no assets pass through the filter, it returns true, because nothing has been skipped.

This may leave the source library in an invalid state. For example, the source library would be in an invalid state if you had decided to transfer texture objects to the library, but materials were kept in the source library.

To safeguard against this, the transfer disconnects objects, and thus materials are left without textures.

When you transfer an object, all its dependents come with it. If you move a material, it takes the associated textures as well. Although if you moved a texture, the material would not be transferred with it.

Parameters:
pSrcLibrary The source library to be imported.
Returns:
True if no filtered assets are skipped.
bool ImportAssets ( KFbxLibrary pSrcLibrary,
const KFbxCriteria pAssetFilter 
)

Transfers ownership from the source library to this library for any assets passing through the filter.

It is assumed that name conflicts and other details have been resolved beforehand.

External asset files required by the assets are copied (not moved). It's up to the owner of the source library to clean up the files if the files are not on a read-only transport. If this document hasn't been committed yet, the assets will not be copied.

Returns true if no filtered assets were skipped. If no assets pass through the filter, it returns true, because nothing has been skipped.

This may leave the source library in an invalid state. For example, the source library would be in an invalid state if you had decided to transfer texture objects to the library, but materials were kept in the source library.

To safeguard against this, the transfer disconnects objects, and thus materials are left without textures.

When you transfer an object, all its dependents come with it. If you move a material, it takes the associated textures as well. Although if you moved a texture, the material would not be transferred with it.

Parameters:
pSrcLibrary The source library to be imported.
pAssetFilter The asset filter.
Returns:
True if no filtered assets are skipped.
T * InstantiateMember ( T const *  pFBX_TYPE,
const KFbxObjectFilter pFilter,
bool  pRecurse = true,
KFbxObject pOptContainer = NULL 
)

Returns a new instance of a library member.

This instantiates the first object found that matches the filter.

Parameters:
pFBX_TYPE The type of member
pFilter A user specified filter
pRecurse A flag that indicates whether to check sub-libraries
pOptContainer Optional container for the cloned asset
Returns:
A new instance of the member. Note that the new member is not included with this library.

Definition at line 259 of file kfbxlibrary.h.

    {
        // first check all materials in the library.
        int i = 0;
        for( i = 0; i < GetMemberCount( FBX_TYPE(T) ); ++i )
        {
            T* lObject = GetMember( FBX_TYPE(T), i );
            if( pFilter.Match(lObject) )
                return KFbxCast<T>(CloneAsset(lObject,pOptContainer));
        }

        if( pRecurse )
        {
            // then check all materials in each sub-library.
            for( i = 0; i < GetMemberCount( FBX_TYPE(KFbxLibrary) ); ++i )
            {
                KFbxLibrary* lLibrary = GetMember( FBX_TYPE(KFbxLibrary), i );
                T* lClonedObject = lLibrary->InstantiateMember( pFBX_TYPE, pFilter, pRecurse, pOptContainer );
                if( lClonedObject )
                    return lClonedObject;
            }
        }

        return NULL;
    }
KFbxLocalizationManager& GetLocalizationManager ( ) const

Returns the localization manager for the library.

virtual const char* Localize ( const char *  pID,
const char *  pDefault = NULL 
) const [virtual]

Localization helper function.

Calls the FBX SDK manager implementation. Sub-classes that manage their own localization can over-ride this function.

Parameters:
pID The identifier for the text to localize.
pDefault The default text. Uses pID if NULL.
Returns:
The potentially localized text. May return the parameter passed in.

Reimplemented from KFbxObject.

bool AddShadingObject ( KFbxObject pShadingObject )

Adds a shading object.

Parameters:
pShadingObject The shading object to be added.
bool RemoveShadingObject ( KFbxObject pShadingObject )

Removes a shading object.

Parameters:
pShadingObject The shading object to be removed.
int GetShadingObjectCount ( void  ) const

Returns the total number of shading objects.

KFbxObject* GetShadingObject ( int  pIndex ) const

Returns the shading object at the specified index.

Parameters:
pIndex Shading object index.
Returns:
The shading object located at the specified index.
int GetShadingObjectCount ( const KFbxImplementationFilter pCriteria ) const

Returns the number of shading objects according to their implementations.

Parameters:
pCriteria Filtering criteria that identifies what kind of implementations to consider.
Returns:
The number of shading objects corresponding to the filtering parameters
KFbxObject* GetShadingObject ( int  pIndex,
const KFbxImplementationFilter pCriteria 
) const

Returns a handle on the shading object at the specified index that corresponds to the given filtering parameters.

Parameters:
pIndex Shading object index.
pCriteria Filtering criteria that identifies what kind of implementations to consider.
Returns:
A handle on the shading object at the specified index that corresponds to the given filtering parameters.
virtual void Destruct ( bool  pRecursive,
bool  pDependents 
) [protected, virtual]
virtual void Construct ( const KFbxLibrary pFrom ) [protected, virtual]

Member Data Documentation

KFbxLocalizationManager* mLocalizationManager [mutable, protected]

Definition at line 254 of file kfbxlibrary.h.


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

KFbxLibrary KFbxLibrary KFbxLibrary KFbxLibrary KFbxLibrary KFbxLibrary KFbxLibrary KFbxLibrary KFbxLibrary KFbxLibrary
KFbxLibrary KFbxLibrary KFbxLibrary KFbxLibrary KFbxLibrary KFbxLibrary KFbxLibrary KFbxLibrary KFbxLibrary KFbxLibrary