cgmOptionVar


Description:
OptionVar are option variables that are stored locally to a computer and carry over between sessions of maya. They are stored per maya version so if you have some in 2011 and you open 2012, they won’t be there unless created in that maya version.

We use them for storing gui settings between maya sessions and as local buffers.

This class is to make optionVar’s in maya behave a little more like other instanced nodes or transforms.

Superclass : None

Subclass:  None

Arguments:

  • varName – (required) – name of an existing option var or a new name to be created. We tag all of our cgm option vars with cgmVar_whatever to make them easy to find in the list of maya optionVars.
  • varType – ‘string’,’int’, ‘float’ are expected answers. The class will infer type from a value flag if provided.
  • value – (string,float,int,list) – the information to be stored at call
  • defaultValue  (string,float,int,list) – information to only be stored if the object is created on call. We find this useful for declaring with gui’s in particular as resetting a gui is then just a matter of deleting it’s optionVars and reloading it

Properties:

  • value – (getValue,setValue,purge)
    • getValue – instance.value returns value
    • setValue – instance.value = string or 1 or 2.0 or [item1,item2] to set a value
    • purge – del instance.value deletes the optionVar
  • varType (getType,SetType)
    • getType – returns optionVar type
    • setType(varType) – change optionVar type

Functions:

  • clear() – clear an optionVar of data
  • append(value) – append a value
  • remove(value)  – removes a value
  • extend(valuesList) – extends a value list
  • toggle() – must be an int, if so, toggles value. Useful for check box connection
  • select() – select the items of a list if they exist
  • existCheck() – prunes non existing objects from the list. Useful for using an optionVar as a buffer

Examples:


 
Creative Commons License

Categories