FBX C++ API Reference
FbxXRefManager Class Reference

#include <fbxxref.h>

Class Description

This class manages external references to files.

Definition at line 30 of file fbxxref.h.

Public Member Functions

 FbxXRefManager ()
 Default constructor. More...
 
virtual ~FbxXRefManager ()
 Destructor. More...
 
bool GetFirstMatchingUrl (const char *pPrefix, const char *pOptExt, const FbxDocument *pDoc, FbxString &pResolvedPath) const
 Looks for the first file that matches a specified "pattern", which is built as: More...
 

Predefined Project Types

static const char * sTemporaryFileProject
 This project represents an URL for storing temporary files. More...
 
static const char * sConfigurationProject
 This project represents an URL for configuration files. More...
 
static const char * sLocalizationProject
 This project represents an URL for storing localization files (that is not part of the asset library). More...
 
static const char * sEmbeddedFileProject
 This project is used for creating the ".fbm" folders that are used for storing embedded resources in FBX files. More...
 

XRef URL properties

bool GetResolvedUrl (FbxProperty const &pProperty, int pIndex, FbxString &pResolvedPath) const
 Tries to resolve the URL stored in the property at the given index. More...
 
bool GetResolvedUrl (const char *pUrl, FbxDocument *pDoc, FbxString &pResolvedPath) const
 Tries to resolve the specified URL. More...
 
static int GetUrlCount (FbxProperty const &pProperty)
 Returns the number of URLs that are stored in a property. More...
 
static int GetUrlCount (FbxString const &pUrl)
 Returns the number of URLs that are stored in a string. More...
 
static bool IsRelativeUrl (FbxProperty const &pProperty, int pIndex)
 Checks whether the URL at the given index stored in the property is relative or not. More...
 
static FbxString GetUrl (FbxProperty const &pProperty, int pIndex)
 Returns the URL stored in the property at the given index. More...
 

XRef Resolve URL and Projects

bool AddXRefProject (const char *pName, const char *pUrl)
 Adds an XRef Project. More...
 
bool AddXRefProject (const char *pName, const char *pExtension, const char *pUrl)
 Adds an XRef Project. More...
 
bool AddXRefProject (FbxDocument *pDoc)
 Adds an XRef project based on the document's EmbeddedUrl property if set, if EmbeddedUrl is not set, based on its current URL property. More...
 
bool RemoveXRefProject (const char *pName)
 Removes an XRef Projects. More...
 
bool RemoveAllXRefProjects ()
 Removes all XRef Projects. More...
 
int GetXRefProjectCount () const
 Returns the number of XRef Projects. More...
 
const char * GetXRefProjectName (int pIndex) const
 Returns the name of the XRef project at the specified index. More...
 
const char * GetXRefProjectUrl (const char *pName)
 Returns the base URL for the given project. More...
 
const char * GetXRefProjectUrl (const char *pName) const
 Returns the base URL for the given project. More...
 
const char * GetXRefProjectUrl (int pIndex) const
 Returns the base URL for the given project. More...
 
bool HasXRefProject (const char *pName)
 Checks if a project with the given name is defined in this manager. More...
 
bool GetResolvedUrl (const char *pUrl, FbxString &pResolvePath) const
 Tries to resolve an relative URL. More...
 

Constructor & Destructor Documentation

◆ FbxXRefManager()

Default constructor.

◆ ~FbxXRefManager()

virtual ~FbxXRefManager ( )
virtual

Destructor.

Member Function Documentation

◆ GetUrlCount() [1/2]

static int GetUrlCount ( FbxProperty const &  pProperty)
static

Returns the number of URLs that are stored in a property.

Parameters
pPropertyThe property.
Returns
The URL count.

◆ GetUrlCount() [2/2]

static int GetUrlCount ( FbxString const &  pUrl)
static

Returns the number of URLs that are stored in a string.

Parameters
pUrlThe string.
Returns
The URL count.

◆ IsRelativeUrl()

static bool IsRelativeUrl ( FbxProperty const &  pProperty,
int  pIndex 
)
static

Checks whether the URL at the given index stored in the property is relative or not.

Parameters
pPropertyThe property.
pIndexThe URL index.
Returns
True if the URL is relative, false if the URL is not relative.

◆ GetUrl()

static FbxString GetUrl ( FbxProperty const &  pProperty,
int  pIndex 
)
static

Returns the URL stored in the property at the given index.

Parameters
pPropertyThe property.
pIndexThe URL index.
Returns
The URL

◆ GetResolvedUrl() [1/3]

bool GetResolvedUrl ( FbxProperty const &  pProperty,
int  pIndex,
FbxString pResolvedPath 
) const

Tries to resolve the URL stored in the property at the given index.

Parameters
pPropertyThe property.
pIndexThe URL index.
pResolvedPathFilled with the resolved path.
Returns
True if the URL is resolved, return false if the URL is not resolved.

◆ GetResolvedUrl() [2/3]

bool GetResolvedUrl ( const char *  pUrl,
FbxDocument pDoc,
FbxString pResolvedPath 
) const

Tries to resolve the specified URL.

Parameters
pUrlThe specified URL.
pDocThe document whose ".fbm" folder is used to resolve the URL.
pResolvedPathFilled with the resolved path.
Returns
True if the URL is resolved, return false if the URL is not resolved.

◆ GetFirstMatchingUrl()

bool GetFirstMatchingUrl ( const char *  pPrefix,
const char *  pOptExt,
const FbxDocument pDoc,
FbxString pResolvedPath 
) const

Looks for the first file that matches a specified "pattern", which is built as:

if pOptExt is given: prefix*.ext If pOptExt is NULL: prefix* if pOptExt is "" or ".": prefix*.

Returns the URL of the first matching files. This function cannot be used to resolve folders, only files.

If a document is given, we start by looking at the document's ".fbm" folder.

Parameters
pPrefixThe prefix of the pattern.
pOptExtThe extension of the pattern.
pDocThe given document.
pResolvedPathFilled with the first matching URL.
Returns
True if one matching file is found, returns false if no matching file is found.

◆ AddXRefProject() [1/3]

bool AddXRefProject ( const char *  pName,
const char *  pUrl 
)

Adds an XRef Project.

Note:Only one URL is associated with a project. Calling this on an existing project replaces the project's existing URL.

Parameters
pNameThe name of the project
pUrlThe URL to be associated with the project.
Returns
True if the project is added successfully, false if no project is added.

◆ AddXRefProject() [2/3]

bool AddXRefProject ( const char *  pName,
const char *  pExtension,
const char *  pUrl 
)

Adds an XRef Project.

Note:Only one URL is associated with a project. Calling this on an existing project replaces the project's existing URL.

Parameters
pNameThe name of the project
pExtensionThe extension of the project.
pUrlThe URL to be associated with the project.
Returns
True if the project is added successfully, returns false if no project is added.

◆ AddXRefProject() [3/3]

bool AddXRefProject ( FbxDocument pDoc)

Adds an XRef project based on the document's EmbeddedUrl property if set, if EmbeddedUrl is not set, based on its current URL property.

Parameters
pDocThe document used to name the project and to specify the URL.
Returns
True if the project is added successfully, returns false if no project is added.
Remarks
The project name is set as the document name and the URL is set as EmbeddedUrl or URL of the document.

◆ RemoveXRefProject()

bool RemoveXRefProject ( const char *  pName)

Removes an XRef Projects.

Parameters
pNameThe name of the project to be removed.
Returns
True if the project is removed successfully, returns false if the project with the name does not exist.

◆ RemoveAllXRefProjects()

bool RemoveAllXRefProjects ( )

Removes all XRef Projects.

Returns
True always.

◆ GetXRefProjectCount()

int GetXRefProjectCount ( ) const

Returns the number of XRef Projects.

Returns
The number of XRef Projects.

◆ GetXRefProjectName()

const char* GetXRefProjectName ( int  pIndex) const

Returns the name of the XRef project at the specified index.

Parameters
pIndexThe XRef project index.
Returns
The XRef project name.

◆ GetXRefProjectUrl() [1/3]

const char* GetXRefProjectUrl ( const char *  pName)

Returns the base URL for the given project.

Parameters
pNameThe name of the given project
Returns
The base URL of the project or returns NULL if the project with the name is not found.

◆ GetXRefProjectUrl() [2/3]

const char* GetXRefProjectUrl ( const char *  pName) const

Returns the base URL for the given project.

Parameters
pNameThe name of the given project
Returns
The base URL of the project or returns NULL if the project with the name is not found.

◆ GetXRefProjectUrl() [3/3]

const char* GetXRefProjectUrl ( int  pIndex) const

Returns the base URL for the given project.

Parameters
pIndexThe index of the project.
Returns
The base URL of the project or NULL if the index is out of bounds.

◆ HasXRefProject()

bool HasXRefProject ( const char *  pName)
inline

Checks if a project with the given name is defined in this manager.

Parameters
pNameThe name of the project.
Returns
True if the project is defined in this manager, returns false if it isn't defined in this manager.

Definition at line 209 of file fbxxref.h.

209 { return GetXRefProjectUrl(pName) != NULL; }
#define NULL
Definition: fbxarch.h:210
const char * GetXRefProjectUrl(const char *pName)
Returns the base URL for the given project.

◆ GetResolvedUrl() [3/3]

bool GetResolvedUrl ( const char *  pUrl,
FbxString pResolvePath 
) const

Tries to resolve an relative URL.

Parameters
pUrlThe relative URL to be resolved.
pResolvePathFilled with the resolved path.
Returns
True if the URL is resolved, returns false if the URL is not resolved.

Member Data Documentation

◆ sTemporaryFileProject

const char* sTemporaryFileProject
static

This project represents an URL for storing temporary files.

Definition at line 45 of file fbxxref.h.

◆ sConfigurationProject

const char* sConfigurationProject
static

This project represents an URL for configuration files.

Definition at line 48 of file fbxxref.h.

◆ sLocalizationProject

const char* sLocalizationProject
static

This project represents an URL for storing localization files (that is not part of the asset library).

Definition at line 51 of file fbxxref.h.

◆ sEmbeddedFileProject

const char* sEmbeddedFileProject
static

This project is used for creating the ".fbm" folders that are used for storing embedded resources in FBX files.

When not set, or if the folder is not writable, the ".fbm" folder is created alongside the FBX file.

If we cannot write in that folder, we look at the sTemporaryFileProject location. If no folder is set in the sTemporaryFileProject location, or it is not writable, the operating system's Temp folder becomes the location.

Definition at line 63 of file fbxxref.h.


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