Public Member Functions
Preferences Class Reference

## Detailed Description

The Preferences object can be used to manage preferences in Softimage.

Each preference is in a category which is represented by a node under the Preferences container in the Application. To identify a preference the category must be specified as `category.preference`. For example, `"scripting.language"`.

There are 2 kinds of preferences: native and custom. Native preferences come with Softimage and can be viewed with the File->Preferences dialog. By default, no preferences file is created until you change the value of a preference, thereby changing the location of preference to `user`. When Softimage starts it reads all .xsipref files located under the `/Data/Preferences` directory of the Factory, Workgroup and User locations (in that order), so if the value exists in both the factory and the user locations, the value in the user file will be used.

Note:
  Each time a user changes the value of a preference it is saved in the .xsipref under the user location.

For custom preferences, you can create new preferences in a .xsipref file and you can use them in scripting. All loaded preferences are listed on the Preferences property page. You can also create a new category with UI that appears under the Preferences node.

Since:
  4.0

Example:

            using namespace XSI;
            Application app;
            Preferences preferences = app.GetPreferences();

            CString languagepref ;
            preferences.GetPreferenceValue( L"scripting.language", languagepref );

            app.LogMessage( languagepref );

Example:

            using namespace XSI;
            Application app;
            Preferences preferences = app.GetPreferences();

            CRefArray l_array;
            l_array = prefMgr.GetCategories();

            for (int i=0; i< l_array.GetCount(); i++)
            {
                if ( l_array[i].GetName() == L"scripting")
                {

                }
            }

`#include <xsi_preferences.h>`

Inheritance diagram for Preferences:
[legend]

List of all members.

## Public Member Functions
| Preferences ()
| ~Preferences ()
| Preferences (const CRef &in_ref)
| Preferences (const Preferences &in_obj)
bool | IsA (siClassID in_ClassID) const
siClassID | GetClassID () const
Preferences & | operator= (const Preferences &in_obj)
Preferences & | operator= (const CRef &in_ref)
CRefArray | GetCategories () const
CStatus | GetPreferenceValue (const CString &in_sPrefName, CValue &out_value)
CStatus | SetPreferenceValue (const CString &in_sPrefName, const CValue &in_value)
CStatus | Import (const CString &in_sFile)
CStatus | Export (const CString &in_sFile, const CString &in_sCategories)
CStatus | RestoreDefault (const CString &in_sPrefName)

## Constructor & Destructor Documentation

Preferences | ( |  | ) |

Default constructor.

~Preferences | ( |  | ) |

Default destructor.

Preferences | ( | const CRef & | in_ref | ) |

Constructor.

Parameters:

  in_ref | constant reference object.

Preferences | ( | const Preferences & | in_obj | ) |

Copy constructor.

Parameters:

  in_obj | constant class object.

## Member Function Documentation

bool IsA | ( | siClassID | in_ClassID | ) | const `[virtual]`

Returns true if a given class type is compatible with this API class.

Parameters:

  in_ClassID | class type.

Returns:
  true if the class is compatible, false otherwise.

Reimplemented from SIObject.

siClassID GetClassID | ( |  | ) | const `[virtual]`

Returns the type of the API class.

Returns:
  The class type.

Reimplemented from SIObject.

Preferences& operator= | ( | const Preferences & | in_obj | ) |

Creates an object from another object. The newly created object is set to empty if the input object is not compatible.

Parameters:

  in_obj | constant class object.

Returns:
  The new Preferences object.

Preferences& operator= | ( | const CRef & | in_ref | ) |

Creates an object from a reference object. The newly created object is set to empty if the input reference object is not compatible.

Parameters:

  in_ref | constant class object.

Returns:
  The new Preferences object.

Reimplemented from SIObject.

CRefArray GetCategories | ( |  | ) | const

Returns the categories collection.

Returns:
  The categories array. This is a list of Property objects which hold a set of preferences.

Reimplemented from SIObject.

CStatus GetPreferenceValue | ( | const CString & | in_sPrefName,
|  | CValue & | out_value
| ) |  |

Returns the value of the specified preference.

Parameters:

  in_sPrefName | The name of the preference including the category: `category.preference` name

Return values:

  out_value | The value returned.

Returns:
  CStatus::OK success
  CStatus::Fail failure

CStatus SetPreferenceValue | ( | const CString & | in_sPrefName,
|  | const CValue & | in_value
| ) |  |

Sets the value of the specified preference.

Parameters:

  in_sPrefName | The name of the preference including the category: `category.preference` name
  in_value | The value to set

Returns:
  CStatus::OK success
  CStatus::Fail failure

CStatus Import | ( | const CString & | in_sFile | ) |

Imports a set of preferences into Softimage. All values are saved in the .xsipref under the user location. The file can contain preferences from any category. The file must be in the .xsipref file format.

Parameters:

  in_sFile | The file to import.

Returns:
  CStatus::OK success
  CStatus::Fail failure

CStatus Export | ( | const CString & | in_sFile,
|  | const CString & | in_sCategories
| ) |  |

Exports one or more categories of preferences into a .xsipref file.

Parameters:

  in_sFile | The file to export.
  in_sCategories | The categories to export

Returns:
  CStatus::OK success
  CStatus::Fail failure

CStatus RestoreDefault | ( | const CString & | in_sPrefName | ) |

The category or the preference to restore to the default value. It can also be a specific preference.

Parameters:

  in_sPrefName | The category or preference to restore.

Returns:
  CStatus::OK success
  CStatus::Fail failure

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

- xsi_preferences.h