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

KFbxIOSettings Class Reference

This reference page is linked to from the following overview topics: Your First FBX SDK Program, Importing and Exporting a Scene, I/O Settings, Importing a Scene, Exporting a Scene, FBX Properties, Connections, List of Python FBX classes.


Search for all occurrences

Detailed Description

KFbxIOSettings is a collection of properties, arranged as a tree, that can be used by FBX file readers and writers to represent import and export options.

It is primarily used by FBX importers (KFbxImporter) and FBX exporter (KFbxExporter) when reading or writing data from or to a disk. The FBX plugins of some Autodesk products expose a UI representing the content of those options to let users see and choose options when an import or export operation is about to be done. The tree of options is extensible.

Options can be saved or loaded from an XML file using the functions: ReadXMLFile(), WriteXMLFile(), WriteXmlPropToFile(). This functionality can be useful for plugins that use preset files.

An instance of KFbxIOSettings must be created to be used before an import/export operation. When a new KFbxIOSettings instance is created, all options are created with default values. The new instance of KFbxIOSettings can be passed to the KFbxSdkManager, this way that instance will be used by all import/export operations.

Ex: to set an instance of KFbxIOSettings to the KFbxSdkManager

 // First create a new instance of KFbxIOSettings
 KFbxIOSettings * ios = KFbxIOSettings::Create((KFbxSdkManager *) mKFbxSdkManager, IOSROOT);
 // then set the KFbxSdkManager
 mKFbxSdkManager->SetIOSettings(ios);

It's also possible for a developer to create another instance of KFbxIOSettings, set particular options and use it for import/export operation.

Ex: to set an instance of KFbxIOSettings to a KFbxImporter/KFbxExporter

 mKFbxImporter->SetIOSettings(ios); / mKFbxExporter->SetIOSettings(ios);

A schematic view of the KFbxIOSettings tree :

  
                                         OPTION_GROUP_ROOT (IOSROOT)
                                         |
                                         |
                     ________________________________________
                     |                                      |     
                     -OPTION_GROUP_EXPORT (IOSN_EXPORT)     -OPTION_GROUP_IMPORT (IOSN_IMPORT)
                          |                                      |
                          -OPTION_GROUP_A                        -OPTION_GROUP_A
                          |     |                                |     |
                          |     -OPTION_A                        |     -OPTION_A
                          |     -OPTION_B                        |     -OPTION_B
                          |                                      |
                          -OPTION_GROUP_B                        -OPTION_GROUP_B
                          |     |                                |     |
                          |     -OPTION_GROUP_A                  |     -OPTION_GROUP_A
                          |     |     |                          |     |     |
                          |     |     -OPTION_A                  |     |     -OPTION_A
                          |     |     -OPTION_B                  |     |     -OPTION_B
                          |     |                                |     |
                          |     -OPTION_GROUP_B                  |     -OPTION_GROUP_B
                          |           |                          |           |
                          |           -OPTION_A                  |           -OPTION_A
                          |           -OPTION_B                  |           -OPTION_B 
                          |                                      |
                          -OPTION_GROUP_C                        -OPTION_GROUP_C
                                |                                      |
                                -OPTION_A                              -OPTION_A
  
  

Any group of options can contain sub options, or group of sub options. To access an option value, we must pass the full path to the Get/Set functions Ex:

 ios->GetBoolProp("Import|IncludeGrp|Animation", true); // the root node name is not required

All options path are defined in the file kfbxiosettingspath.h to ease the access of any options. Then "Import|IncludeGrp|Animation" == IMP_ANIMATION since IMP_ANIMATION is defined in kfbxiosettingspath.h All options defined path start with "IMP_" for import branch or "EXP_" for export branch.

We strongly encourage to use the defined path in kfbxiosettingspath.h, this way if the parent group of an option is changed the change occur only in kfbxiosettingspath.h not in the code elsewhere.

Ex: to get the boolean import "Animation" option

 bool anim = ios->GetBoolProp(IMP_ANIMATION, true); // will return true if not found, since we pass true as second param

Ex: to set the boolean import "Animation" option to false

 ios->SetBoolProp(IMP_ANIMATION, false);

Ex: to create a new option group under the "Import" branch

 // get the parent "Import" property
 KFbxProperty import_Group = ios->GetProperty( IOSN_IMPORT ); // IOSN_IMPORT is defined as "Import" in kfbxiosettingspath.h
 if(import_Group.IsValid()) // check if we have found the IOSN_IMPORT parent option
 {
     // add a new group of options "myOptionGroup"
        KFbxProperty myOptionGrp = ios->AddPropertyGroup(import_Group, "myOptionGroup", DTString, "My Option Group UI Label");
 }

Ex: to create a new boolean option under the "myOptionGroup"

 KFbxProperty myOptionGrp = ios->GetProperty( "Import|myOptionGroup" ); // can also use IOSN_IMPORT|"myOptionGroup"
 if(myOptionGrp.IsValid()) // check if we have found the "myOptionGroup"
 {
     bool defaultValue = true;
        KFbxProperty myOption = ios->AddProperty(myOptionGrp, "myOptionName", DTBool, "My Option UI label" , &defaultValue, eBOOL1);
 }

Ex: to set some flags to myOption

 KFbxProperty myOption = ios->GetProperty( "Import|myOptionGroup|myOptionName" );
 if(myOption.IsValid())
 {
        myOPtion.ModifyFlag(KFbxProperty::eUI_HIDDEN, true);   // to make that option not visible to the UI
        myOPtion.ModifyFlag(KFbxProperty::eNOT_SAVABLE, true); // to avoid the read/save of that option in XML file
 }
Examples:

Common/Common.cxx, ExportDocument/main.cxx, MyOwnWriterReader/MyOwnWriterReader.cxx, MyOwnWriterReader/MyOwnWriterReader.h, UIExamples/Common/ImportExport.cxx, UIExamples/CubeCreator/SDK_Utility.cxx, and UIExamples/SceneTreeView/SDK_Utility.cxx.

Definition at line 291 of file kfbxiosettings.h.

#include <kfbxiosettings.h>

Inheritance diagram for KFbxIOSettings:
Inheritance graph
[legend]

List of all members.

Public Types

enum   ELoadMode { eCREATE, eMERGE, eEXCLUSIVE_MERGE }
enum   EQuaternionMode { eAS_QUATERNION, eAS_EULER, eRESAMPLE }
enum   EObjectDerivation { eBY_LAYER, eBY_ENTITY, eBY_BLOCK }
enum   ESysUnits {
  kUNITS_USER, kUNITS_INCHES, kUNITS_FEET, kUNITS_YARDS,
  kUNITS_MILES, kUNITS_MILLIMETERS, kUNITS_CENTIMETERS, kUNITS_METERS,
  kUNITS_KILOMETERS
}
enum   ESysFrameRate {
  kFRAMERATE_USER, kFRAMERATE_HOURS, kFRAMERATE_MINUTES, kFRAMERATE_SECONDS,
  kFRAMERATE_MILLISECONDS, kFRAMERATE_GAMES_15, kFRAMERATE_FILM_24, kFRAMERATE_PAL_25,
  kFRAMERATE_NTSC_30, kFRAMERATE_SHOWSCAN_48, kFRAMERATE_PALFIELD_50, kFRAMERATE_NTSCFIELD_60
}
enum   EEnveloppeSystem { eSKIN_MODIFIER, ePHYSIQUE, eBONESPRO, eENVELOPPE_SYSTEM_COUNT }
enum   EGeometryType {
  eTRIANGLE, eSIMPLIFIED_POLY, ePOLY, eNURB,
  ePATCH, eGEOMETRY_TYPE_COUNT
}
enum   EIKType { eNONE, eFBIK, eHUMANIK }

Public Member Functions

virtual void  Destruct (bool pRecursive, bool pDependents)
  Destruct a property and optionally the children properties.
KFbxProperty  AddPropertyGroup (char const *pName, KFbxDataType const &pDataType=KFbxDataType(), char const *pLabel="")
  Add a property group under the root prop to be a direct child of IOSROOT.
KFbxProperty  AddPropertyGroup (KFbxProperty const &pParentProperty, char const *pName, KFbxDataType const &pDataType=KFbxDataType(), char const *pLabel="", bool pVisible=true, bool pSavable=true, bool pEnabled=true)
  Add a property group under another parent property.
KFbxProperty  AddProperty (KFbxProperty const &pParentProperty, char const *pName, KFbxDataType const &pDataType=KFbxDataType(), char const *pLabel="", void const *pValue=NULL, EFbxType pValueType=eUNIDENTIFIED, bool pVisible=true, bool pSavable=true, bool pEnabled=true)
  Add a property under another parent property with a value to set.
KFbxProperty  AddPropertyMinMax (KFbxProperty const &pParentProperty, char const *pName, KFbxDataType const &pDataType=KFbxDataType(), char const *pLabel="", void const *pValue=NULL, double const *pMinValue=NULL, double const *pMaxValue=NULL, EFbxType pValueType=eUNIDENTIFIED, bool pVisible=true, bool pSavable=true, bool pEnabled=true)
  Add a property under another parent property with a value to set and a min max values.
KFbxProperty  GetProperty (char const *pName) const
  Get a property using the full path in the tree ex: "Export|IncludeGrp|Animation".
KFbxProperty  GetProperty (KFbxProperty const &pParentProperty, char const *pName) const
  Get a property using a short path found under the parent property.
bool  GetBoolProp (char const *pName, bool pDefValue) const
  Get a bool property value using the full path.
void  SetBoolProp (char const *pName, bool pValue)
  set a bool property value using the full path
double  GetDoubleProp (char const *pName, double pDefValue) const
  Get a double property value using the full path.
void  SetDoubleProp (char const *pName, double pValue)
  Set a double property using the full path.
int  GetIntProp (char const *pName, int pDefValue) const
  Get a int property value using the full path.
void  SetIntProp (char const *pName, int pValue)
  Set a int property value using the full path.
KTime  GetKTimeProp (char const *pName, KTime pDefValue) const
  Get a KTime property value using the full path.
void  SetKTimeProp (char const *pName, KTime pValue)
  Set a KTime property value using the full path.
bool  SetFlag (char const *pName, FbxPropertyFlags::eFbxPropertyFlags propFlag, bool pValue)
  Set a specific flag value on a property using the full path.
KString  GetStringProp (char const *pName, KString pDefValue) const
  Get a KString property value using the full path.
void  SetStringProp (char const *pName, KString pValue)
  Set a KString property value using the full path.
PropInfo GetPropInfo (KFbxProperty &pProp)
KString  GetLanguageLabel (KFbxProperty &pProp)
void  SetLanguageLabel (KFbxProperty &pProp, KString &pLabel)
FBXUILANGUAGE  Get_Max_Runtime_Language (KString regLocation)
void  SetPropVisible (KFbxProperty &pProp, bool pWithChildren, bool pVisible)
virtual bool  ConstructProperties (bool pForceSet)
bool  ReadXmlPropFromMyDocument (KString &subDir, KString &filename)
bool  WriteXmlPropToMyDocument (KString &subDir, KString &filename, KString &propPath)
Enum Properties

An enum property is a list of KString and integer pairs.

A current index value is available to get the selected pair of KString+integer

Ex: Content of an enum property

    0 -> (14, "Bird")
    1 -> (17, "Horse")
    2 -> (93, "Cat")
    3 -> (45, "Dog")

If current index is 2: the current int value is 93, and the current KString value is "Cat"

KString  GetEnumProp (char const *pName, KString pDefValue) const
  Get the KString at current index of an enum property using the full path.
int  GetEnumProp (char const *pName, int pDefValue) const
  Get the integer at current index of an enum property using the full path.
int  GetEnumIndex (char const *pName, KString pValue) const
  Get the index of a KString from the enum property using the full path.
void  SetEnumProp (char const *pName, KString pValue)
  Set the current index using an existing KString of an enum property using the full path.
void  SetEnumProp (char const *pName, int pValue)
  Set the current index of an enum property using the full path.
void  RemoveEnumPropValue (char const *pName, KString pValue)
  Remove a pair of KString+integer from an enum property.
void  EmptyEnumProp (char const *pName)
  Empty all the KString+integer pair of the enum property.
bool  IsEnumExist (KFbxProperty &pProp, KString &enumString) const
  Check if a KString is present in the enum property.
int  GetEnumIndex (KFbxProperty &pProp, KString &enumString, bool pNoCase=false) const
  Get the enum index of a KString.
XML Serialization Functions
virtual bool  ReadXMLFile (KString &path)
  Load the settings values from an XML file.
virtual bool  WriteXMLFile (KString &path)
  Write the settings values to an XML file.
bool  WriteXmlPropToFile (KString &pFullPath, KString &propPath)
  Write the settings values to an XML file.

Static Public Member Functions

static KString  GetUserMyDocumentDir ()
static const char *  GetFileMergeDescription (int pIndex)

Public Attributes

FBXUILANGUAGE  UILanguage
KsoInfo  impInfo
KsoInfo  expInfo

Protected Member Functions

  KFbxIOSettings (KFbxSdkManager &pManager, char const *pName)

Member Enumeration Documentation

enum ELoadMode
Enumerator:
eCREATE 

Add to scene(duplicate the ones with the same name)

eMERGE 

Add to scene and update animation.

eEXCLUSIVE_MERGE 

Update animation.

Definition at line 613 of file kfbxiosettings.h.

enum ESysUnits
enum EIKType

Constructor & Destructor Documentation

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

Member Function Documentation

virtual void Destruct ( bool  pRecursive,
bool  pDependents 
) [virtual]

Destruct a property and optionally the children properties.

Parameters:
pRecursive
pDependents

Reimplemented from KFbxObject.

KFbxProperty AddPropertyGroup ( char const *  pName,
KFbxDataType const &  pDataType = KFbxDataType(),
char const *  pLabel = "" 
)

Add a property group under the root prop to be a direct child of IOSROOT.

Parameters:
pName
pDataType
pLabel
Returns:
a new KFbxProperty created
KFbxProperty AddPropertyGroup ( KFbxProperty const &  pParentProperty,
char const *  pName,
KFbxDataType const &  pDataType = KFbxDataType(),
char const *  pLabel = "",
bool  pVisible = true,
bool  pSavable = true,
bool  pEnabled = true 
)

Add a property group under another parent property.

Parameters:
pParentProperty
pName
pDataType
pLabel (optional, used by the UI as widget label)
pVisible (used by the UI to show or not that property)
pSavable (to enable a read & write to an XML file)
pEnabled (used by the widget UI to show enabled or disabled)
Returns:
a new KFbxProperty created
KFbxProperty AddProperty ( KFbxProperty const &  pParentProperty,
char const *  pName,
KFbxDataType const &  pDataType = KFbxDataType(),
char const *  pLabel = "",
void const *  pValue = NULL,
EFbxType  pValueType = eUNIDENTIFIED,
bool  pVisible = true,
bool  pSavable = true,
bool  pEnabled = true 
)

Add a property under another parent property with a value to set.

Parameters:
pParentProperty
pName
pDataType
pLabel (optional, used by the UI as widget label)
pValue
pValueType
pVisible (used by the UI to show or not that property)
pSavable (to enable a read & write to an XML file)
pEnabled (used by the widget UI to show enabled or disabled)
Returns:
a new KFbxProperty created
KFbxProperty AddPropertyMinMax ( KFbxProperty const &  pParentProperty,
char const *  pName,
KFbxDataType const &  pDataType = KFbxDataType(),
char const *  pLabel = "",
void const *  pValue = NULL,
double const *  pMinValue = NULL,
double const *  pMaxValue = NULL,
EFbxType  pValueType = eUNIDENTIFIED,
bool  pVisible = true,
bool  pSavable = true,
bool  pEnabled = true 
)

Add a property under another parent property with a value to set and a min max values.

Parameters:
pParentProperty
pName
pDataType
pLabel (optional, used by the UI as widget label)
pValue
pMinValue
pMaxValue
pValueType
pVisible (used by the UI to show or not that property)
pSavable (to enable a read & write to an XML file)
pEnabled (used by the widget UI to show enabled or disabled)
Returns:
a new KFbxProperty created
Remarks:
Normally used with numeric properties Ex: integer, float, double, etc.
KFbxProperty GetProperty ( char const *  pName ) const

Get a property using the full path in the tree ex: "Export|IncludeGrp|Animation".

Parameters:
pName
Returns:
a KFbxProperty found
Remarks:
We strongly encourage to use the defined path in kfbxiosettingspath.h ex: EXP_ANIMATION == "Export|IncludeGrp|Animation"
KFbxProperty GetProperty ( KFbxProperty const &  pParentProperty,
char const *  pName 
) const

Get a property using a short path found under the parent property.

Parameters:
pParentProperty
pName
Returns:
a KFbxProperty found
Remarks:
This is a faster way to access a property when the parent is known
bool GetBoolProp ( char const *  pName,
bool  pDefValue 
) const

Get a bool property value using the full path.

Parameters:
pName
pDefValue Value returned if the property is not found
Returns:
true or false
void SetBoolProp ( char const *  pName,
bool  pValue 
)

set a bool property value using the full path

Parameters:
pName
pValue
double GetDoubleProp ( char const *  pName,
double  pDefValue 
) const

Get a double property value using the full path.

Parameters:
pName
pDefValue Value returned if the property is not found
Returns:
a double
void SetDoubleProp ( char const *  pName,
double  pValue 
)

Set a double property using the full path.

Parameters:
pName
pValue
int GetIntProp ( char const *  pName,
int  pDefValue 
) const

Get a int property value using the full path.

Parameters:
pName
pDefValue Value returned if the property is not found
Returns:
a int
void SetIntProp ( char const *  pName,
int  pValue 
)

Set a int property value using the full path.

Parameters:
pName
pValue
KTime GetKTimeProp ( char const *  pName,
KTime  pDefValue 
) const

Get a KTime property value using the full path.

Parameters:
pName
pDefValue Value returned if the property is not found
void SetKTimeProp ( char const *  pName,
KTime  pValue 
)

Set a KTime property value using the full path.

Parameters:
pName
pValue
Returns:
a KTime
KString GetEnumProp ( char const *  pName,
KString  pDefValue 
) const

Get the KString at current index of an enum property using the full path.

Parameters:
pName
pDefValue Value returned if the property is not found
Returns:
a KString
int GetEnumProp ( char const *  pName,
int  pDefValue 
) const

Get the integer at current index of an enum property using the full path.

Parameters:
pName
pDefValue Value returned if the property is not found
Returns:
a int
int GetEnumIndex ( char const *  pName,
KString  pValue 
) const

Get the index of a KString from the enum property using the full path.

Parameters:
pName
pValue Return -1 if the KString is not found
Returns:
a int
void SetEnumProp ( char const *  pName,
KString  pValue 
)

Set the current index using an existing KString of an enum property using the full path.

Parameters:
pName
pValue
Remarks:
The current index will not change if the KString is not found
void SetEnumProp ( char const *  pName,
int  pValue 
)

Set the current index of an enum property using the full path.

Parameters:
pName
pValue
Remarks:
The current index will not change if the pValue is out of bound
void RemoveEnumPropValue ( char const *  pName,
KString  pValue 
)

Remove a pair of KString+integer from an enum property.

Parameters:
pName
pValue The KString to find
Remarks:
The first KString found from 0 index will be removed only even if the same KString exist in other index, if the current index was on the KString found the current index will be set to 0
void EmptyEnumProp ( char const *  pName )

Empty all the KString+integer pair of the enum property.

Parameters:
pName
bool IsEnumExist ( KFbxProperty pProp,
KString enumString 
) const

Check if a KString is present in the enum property.

Parameters:
&pProp a ref to an enum prop
&enumString ref to a KString to find
Returns:
true if found, false otherwise.
int GetEnumIndex ( KFbxProperty pProp,
KString enumString,
bool  pNoCase = false 
) const

Get the enum index of a KString.

Parameters:
&pProp a ref to an enum prop
&enumString ref to string to find
pNoCase To match case sensitive or not
Returns:
the index found or -1 if not found
bool SetFlag ( char const *  pName,
FbxPropertyFlags::eFbxPropertyFlags  propFlag,
bool  pValue 
)

Set a specific flag value on a property using the full path.

Parameters:
pName
propFlag
pValue
Returns:
Always true
KString GetStringProp ( char const *  pName,
KString  pDefValue 
) const

Get a KString property value using the full path.

Parameters:
pName
pDefValue Value returned if the property is not found
Returns:
The KString value
void SetStringProp ( char const *  pName,
KString  pValue 
)

Set a KString property value using the full path.

Parameters:
pName
pValue
virtual bool ReadXMLFile ( KString path ) [virtual]

Load the settings values from an XML file.

Parameters:
path The path of the XML file.
Returns:
True on success, false otherwise.
virtual bool WriteXMLFile ( KString path ) [virtual]

Write the settings values to an XML file.

Parameters:
path The path of the XML file.
Returns:
True on success, false otherwise.
Remarks:
The flag of the property must be eNOT_SAVABLE == false
bool WriteXmlPropToFile ( KString pFullPath,
KString propPath 
)

Write the settings values to an XML file.

Parameters:
pFullPath The path of the XML file.
propPath a prop Path
Returns:
True on success, false otherwise.
Remarks:
To save only a branch of the settings ex: Import branch only
PropInfo* GetPropInfo ( KFbxProperty pProp )
KString GetLanguageLabel ( KFbxProperty pProp )
void SetLanguageLabel ( KFbxProperty pProp,
KString pLabel 
)
FBXUILANGUAGE Get_Max_Runtime_Language ( KString  regLocation )
static KString GetUserMyDocumentDir ( ) [static]
void SetPropVisible ( KFbxProperty pProp,
bool  pWithChildren,
bool  pVisible 
)
virtual bool ConstructProperties ( bool  pForceSet ) [virtual]
bool ReadXmlPropFromMyDocument ( KString subDir,
KString filename 
)
bool WriteXmlPropToMyDocument ( KString subDir,
KString filename,
KString propPath 
)
static const char* GetFileMergeDescription ( int  pIndex ) [static]

Member Data Documentation

Definition at line 592 of file kfbxiosettings.h.

Definition at line 597 of file kfbxiosettings.h.

Definition at line 598 of file kfbxiosettings.h.


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

KFbxIOSettings KFbxIOSettings KFbxIOSettings KFbxIOSettings KFbxIOSettings KFbxIOSettings KFbxIOSettings KFbxIOSettings KFbxIOSettings KFbxIOSettings
KFbxIOSettings KFbxIOSettings KFbxIOSettings KFbxIOSettings KFbxIOSettings KFbxIOSettings KFbxIOSettings KFbxIOSettings KFbxIOSettings KFbxIOSettings