Adverti horiz upsell

ks_optVarToXML.mel 1.0.0 for Maya (maya script)

Save existing OptionVars from GUI to XML file.

License
Button download
574 Downloads

Compatibility

  • 8.x

Operating Systems

  • Windows

History

Created:07/01/2007
Last Modified:08/09/2008
File Size: 15.1 KB
Updated: Now displays user generated optVars in lists, possibility to delete optVars from GUI.

Ever wondered how to permanently store and share
preferences and data created by custom GUIs?
Save your existing OptionVars from you custom GUI to a XML-File.
Restore your OptionVars from a XML-File.

Example:
optionVar -iv test_it_singleInteger 10;

is saved as:

singleInteger
test
it
10


Uses sligthly modified version of xml_lib.mel by J. Adrian Herbez
Bugs and feature suggestions: info@lo-motion.de

Install:
Put ks_optVarToXML.mel and modifiedXml_lib.mel in you script directory.
Source ks_optVarToXML.mel and start the GUI by typing "ks_optVarToXML" in the script editor.

Usage:
Create OptionVars of any type.
As there is no way to savely determinate the type of
an existing OptionVar you have to stick to the following name convention:
VarPrefix_TypePrefix_VarName i.e. pre1_ia_mySliderValues

The first prefix can be anything followed by an underscore ("pre1_" in the above example).
The second prefix indicates the datatype of the OptionVar ("ia_" in the above example):
It is:
  • "st_" for string,
  • "it_" for integer,
  • "fl_" for float value,
  • "sa_" for string array,
  • "ia_" for interger array,
  • "fa_" for float array.

VarName can be anything you like ("mySliderValues_" in the above example).
Note that OptionVars not using this name convention are
ignored or cause errors when used with ks_optVarToXML.

To save OptionVars to XML-File:
Type the prefix or prefixes seperated by commas of OptionVars you want to save
in the textfield. Press the "saveOptionVarToFile" button to save the Xml-File.


To load OptionVars from XML-File:
Press the "Load/replace optVars with .xml" button and select the XML. file containig the optVar data.
This will delete the existing OptionVars and write the store ones to your userpref.mel.

If you choose "All in XML" it will replace all OptionVars starting with those prefixes in the XMlL file.
If you select "Those with prefixes given in text field"
only optionVars starting with a prefix or prefixes (separated by commas) given
in the text field will be replaced.



Please use the Bug System to report any bugs.
Please use the Feature Requests to give me ideas.
Please use the Support Forum if you have any questions or problems.
Please rate and review in the Review section.