User Tools

Site Tools


DzFileIOPresetMgr

Class for managing File I/O preset settings.

More...

Inherits :

Methods

DAZ Script
BooleangetAllCurrentSettings ( String className, DzFileIOSettings settings )
BooleangetAllDefaults ( String className, DzFileIOSettings settings )
BooleangetAllSettings ( String presetName, String className, DzFileIOSettings settings )
ArraygetAvailableClasses ( String presetName )
ArraygetAvailablePresets ( String className )
voidgetCommonApplicationDefaults ( DzFileIOSettings settings )
BooleangetCommonDefaults ( String className, DzFileIOSettings settings )
BooleangetCommonSettings ( String presetName, String className, DzFileIOSettings settings )
BooleangetCurrentCommonSettings ( String className, DzFileIOSettings settings )
BooleangetCurrentSpecificSettings ( String className, DzFileIOSettings settings )
StringgetCustomPresetLabel ()
StringgetDepthAxisKey ()
StringgetInvertDepthAxisKey ()
StringgetInvertLateralAxisKey ()
StringgetInvertVerticalAxisKey ()
StringgetLateralAxisKey ()
NumbergetPresetID ( String presetName, String className=String )
StringgetPresetName ( Number id, String className=String )
StringgetScaleKey ()
BooleangetSpecificDefaults ( String className, DzFileIOSettings settings )
BooleangetSpecificSettings ( String presetName, String className, DzFileIOSettings settings )
ArraygetSystemPresets ( String className )
ArraygetUserPresets ( String className )
StringgetVerticalAxisKey ()
BooleanisSystemPreset ( String presetName )
BooleanisUserPreset ( String presetName )
BooleanpresetExists ( Number id, String className=String )
BooleanpresetExists ( String presetName, String className=String )
BooleanremoveUserPreset ( String presetName, String className )
BooleansaveUserPreset ( String presetName, String className, Boolean keepCommonSettings, DzFileIOSettings settings )

Signals

voidpresetAdded ( String presetName, String className )
voidpresetLoadFinished ()
voidpresetRemoved ( String presetName, String className )

Detailed Description

This class manages presets in the form of DzFileIOSettings objects for various importers, exporters, and other forms of File I/O.

There is only one instance of this manager in an application. This instance is created and owned by DzApp. Don't create an instance of this class, but rather request it from DzApp via DzApp::getFileIOPresetMgr().

File I/O presets are defined by a unique name. They have two types of settings: Specific Settings and Common Settings.

Specific Settings
Specific settings are tied to a class name. This class name is typically, but not always, the name of an importer or exporter, such as “DzObjImporter” or “DzObjExporter.” The key values for specific settings will vary based on the class.

Common Settings
Common settings for a preset are common to all class names. These include settings that define scale values and axis settings. Common keys can be accessed via the following methods: * getLateralAxisKey()

The scale value used by the presets is for importers. If you are working with an exporter then the scale value needs to be converted to 1/scale. As an example, if the scale value for a preset is 2.54 then the scale value for an exporter would be 1/2.54 = 0.3937

Methods


Boolean : getAllCurrentSettings( String className, DzFileIOSettings settings )

TODO: Add description.


Boolean : getAllDefaults( String className, DzFileIOSettings settings )

TODO: Add description.


Boolean : getAllSettings( String presetName, String className, DzFileIOSettings settings )

TODO: Add description.


Array : getAvailableClasses( String presetName )

Parameter(s):

  • presetName - The name of the preset to get available classes for.

Return Value:

  • the available classes (typically importers or exporters) of the given preset

Array : getAvailablePresets( String className )

Parameter(s):

  • className - The name of the class to get available presets for. This is typically, but not always, the name of an importer or exporter, such as “DzObjImporter.” If className is empty, returns all presets

Return Value:

  • the available presets for the given class name

void : getCommonApplicationDefaults( DzFileIOSettings settings )

TODO: Add description.


Boolean : getCommonDefaults( String className, DzFileIOSettings settings )

TODO: Add description.


Boolean : getCommonSettings( String presetName, String className, DzFileIOSettings settings )

Populates settings with the values for common to all presets named presetName

Parameter(s):

  • presetName - The name of the preset to get common settings for
  • settings - The settings object to populate with preset values

Return Value:

  • true if successful, false if presetName does not represent a valid preset

Boolean : getCurrentCommonSettings( String className, DzFileIOSettings settings )

TODO: Add description.


Boolean : getCurrentSpecificSettings( String className, DzFileIOSettings settings )

TODO: Add description.


String : getCustomPresetLabel()

Return Value:

  • The name of the custom preset

String : getDepthAxisKey()

Return Value:

  • The key for the depth axis common setting

String : getInvertDepthAxisKey()

Return Value:

  • The key for the invert depth axis common setting

String : getInvertLateralAxisKey()

Return Value:

  • The key for the invert lateral axis common setting

String : getInvertVerticalAxisKey()

Return Value:

  • The key for the invert vertical axis common setting

String : getLateralAxisKey()

Return Value:

  • The key for the lateral axis common setting

Number : getPresetID( String presetName, String className=String )

Parameter(s):

  • String - The name of the desired preset
  • className - The optional class name for the given preset. If not passed in or empty then the method will not take into account whether the preset has settings for the given class name.

Return Value:

  • the id of the preset with the given name, or an -1 if the preset does not exist. Will also return -1 even if the preset exists when className is not empty and the given preset does not have settings for that specific class.

String : getPresetName( Number id, String className=String )

Parameter(s):

  • id - The id of the desired preset
  • className - The optional class name for the given preset. If not passed in or empty then the method will not take into account whether the preset has settings for the given class name.

Return Value:

  • the name of the preset with the given id, or an empty string if the preset does not exist. Will also return an empty string even if the preset exists when className is not empty and the given preset does not have settings for that specific class.

String : getScaleKey()

Note:

  • The scale value for all presets is the value to use as an importer. If this value is going to be used as an exporter it needs to be converted. See the class description for an explanation

Return Value:

  • The key for the scale common setting

Boolean : getSpecificDefaults( String className, DzFileIOSettings settings )

TODO: Add description.


Boolean : getSpecificSettings( String presetName, String className, DzFileIOSettings settings )

TODO: Add description.


Array : getSystemPresets( String className )

Parameter(s):

  • className - The name of the class to get available presets for. This is typically, but not always, the name of an importer or exporter, such as “DzObjImporter.” If className is empty, returns all system presets

Return Value:

  • the available system-defined presets for the given class name

Array : getUserPresets( String className )

Parameter(s):

  • className - The name of the class to get available presets for. This is typically, but not always, the name of an importer or exporter, such as “DzObjImporter.” If className is empty, returns all user presets

Return Value:

  • the available user-defined presets for the given class name

String : getVerticalAxisKey()

Return Value:

  • The key for the vertical axis common setting

Boolean : isSystemPreset( String presetName )

Parameter(s):

  • presetName - The name of the preset to check

Return Value:

  • true if the preset is a system preset, false if it is a user preset or does not exist

Boolean : isUserPreset( String presetName )

Parameter(s):

  • presetName - The name of the preset to check

Return Value:

  • true if the preset is a user preset, false if it is a system preset or does not exist

Boolean : presetExists( Number id, String className=String )

Parameter(s):

  • id - The id of the preset to check
  • className - The optional class name for the given preset. If not passed in or empty then the check will not take into account whether the preset has settings for the given class name

Return Value:

  • true if the given preset exists, false otherwise

Boolean : presetExists( String presetName, String className=String )

Parameter(s):

  • presetName - The name of the preset to check
  • className - The optional class name for the given preset. If not passed in or empty then the check will not take into account whether the preset has settings for the given class name

Return Value:

  • true if the given preset exists, false otherwise

Boolean : removeUserPreset( String presetName, String className )

Attempts to remove the preset with the given preset name and class name.

Return Value:

  • true if successful, false if the preset could not be removed

Boolean : saveUserPreset( String presetName, String className, Boolean keepCommonSettings, DzFileIOSettings settings )

Attempts to save a user preset with the given preset name and class name

Parameter(s):

  • presetName - The name of the preset to save
  • className - The name of the class to save settings for presetName
  • keepCommonSettings - If a preset named presetName already exists, this settings determines what to do with common settings in the settings parameter. If true, the existing common settings will be kept and those in the settings will be ignored.
  • keepSpecificSettings - If a preset presetName and className already exists, this setting determines what to do with the specific settings. If true, the specific settings will remain unchanged.
  • settings - The settings to associate with the new preset

Return Value:

  • true if the preset was saved, false otherwise

Signals


void : presetAdded( String presetName, String className )

Signature:presetRemoved(const QString&, const QSring&)

Emitted when a preset is added

Parameter(s):

  • presetName - The name of the preset that was added
  • className - The name of the class that was added

void : presetLoadFinished()

Emitted when presets have been loaded from file and are ready to use


void : presetRemoved( String presetName, String className )

Signature:presetRemoved(const QString&, const QSring&)

Emitted when a preset is removed

Parameter(s):

  • presetName - The name of the preset that was removed
  • className - The name of the class that was removed