2 Simple class to hold common information used by the JSON attribute pattern 
    3 reader and writer.  To use, make sure that pyJsonAttrPatternInfo.py is in 
    4 your Python path then do the following: 
    6 from pyJsonAttrPatternInfo import PyJsonAttrPatternInfo as JsonKeys 
    8 flagKeyword = JsonKeys.kKeyFlags 
   12 import maya.api.OpenMaya 
as omAPI
 
   15 def jsonDebug(dbgString):
 
   17     Print out some debugging messages if the flag is turned on. 
   18     Lazily I'm making the location to turn it on be right here as well. 
   22         print 'JSON: %s' % dbgString
 
   27 class PyJsonAttrPatternInfo():
 
   28     kPluginPatternFactoryName = 
'json' 
   31     kKeyAcceptedTypes           = 
'acceptedTypes' 
   32     kKeyAcceptedNumericTypes    = 
'acceptedNumericTypes' 
   33     kKeyAcceptedPluginTypes     = 
'acceptedPluginTypes' 
   34     kKeyAttrType        = 
'attributeType' 
   37     kKeyNiceName        = 
'niceName' 
   38     kKeyShortName       = 
'shortName' 
   39     kKeyCategories      = 
'categories' 
   40     kKeyEnumNames       = 
'enumNames' 
   41     kKeyDefault         = 
'defaultValue' 
   42     kKeyDisconnect      = 
'disconnectBehavior' 
   43     kKeyChildren        = 
'children' 
   46     kKeySoftMin         = 
'softMin' 
   47     kKeySoftMax         = 
'softMax' 
   55     kNumericTypes = { 
'bool'    : omAPI.MFnNumericData.kBoolean,
 
   56                       'byte'    : omAPI.MFnNumericData.kByte,
 
   57                       'char'    : omAPI.MFnNumericData.kChar,
 
   58                       'short'   : omAPI.MFnNumericData.kShort,
 
   59                       'short2'  : omAPI.MFnNumericData.k2Short,
 
   60                       'short3'  : omAPI.MFnNumericData.k3Short,
 
   61                       'long'    : omAPI.MFnNumericData.kLong,
 
   62                       'int'     : omAPI.MFnNumericData.kInt,
 
   63                       'long2'   : omAPI.MFnNumericData.k2Long,
 
   64                       'int2'    : omAPI.MFnNumericData.k2Int,
 
   65                       'long3'   : omAPI.MFnNumericData.k3Long,
 
   66                       'int3'    : omAPI.MFnNumericData.k3Int,
 
   67                       'float'   : omAPI.MFnNumericData.kFloat,
 
   68                       'float2'  : omAPI.MFnNumericData.k2Float,
 
   69                       'float3'  : omAPI.MFnNumericData.k3Float,
 
   70                       'double'  : omAPI.MFnNumericData.kDouble,
 
   71                       'double2' : omAPI.MFnNumericData.k2Double,
 
   72                       'double3' : omAPI.MFnNumericData.k3Double,
 
   73                       'double4' : omAPI.MFnNumericData.k4Double,
 
   74                       'addr'    : omAPI.MFnNumericData.kAddr,
 
   75                       'angle'   : omAPI.MFnUnitAttribute.kAngle,
 
   76                       'distance': omAPI.MFnUnitAttribute.kDistance,
 
   77                       'time'    : omAPI.MFnUnitAttribute.kTime }
 
   81     kTypeCompound = 
'compound' 
   83     kTypeString = 
'string' 
   85     kTypeMatrix = [
'floatMatrix', 
'doubleMatrix']
 
   86     kTypeMatrixTypes = { kTypeMatrix[0] : omAPI.MFnMatrixAttribute.kFloat,
 
   87                          kTypeMatrix[1] : omAPI.MFnMatrixAttribute.kDouble }
 
   88     kTypeLightData = 
'lightData' 
   89     kTypeMessage = 
'message' 
   91     kGenericTypes = { 
'numeric'         : omAPI.MFnData.kNumeric,
 
   92                       'pluginGeometry'  : omAPI.MFnData.kPluginGeometry,
 
   93                       'string'          : omAPI.MFnData.kString,
 
   94                       'matrix'          : omAPI.MFnData.kMatrix,
 
   95                       'stringArray'     : omAPI.MFnData.kStringArray,
 
   96                       'doubleArray'     : omAPI.MFnData.kDoubleArray,
 
   97                       'intArray'        : omAPI.MFnData.kIntArray,
 
   98                       'pointArray'      : omAPI.MFnData.kPointArray,
 
   99                       'vectorArray'     : omAPI.MFnData.kVectorArray,
 
  100                       'componentList'   : omAPI.MFnData.kComponentList,
 
  101                       'mesh'            : omAPI.MFnData.kMesh,
 
  102                       'lattice'         : omAPI.MFnData.kLattice,
 
  103                       'nurbsCurve'      : omAPI.MFnData.kNurbsCurve,
 
  104                       'nurbsSurface'    : omAPI.MFnData.kNurbsSurface,
 
  105                       'sphere'          : omAPI.MFnData.kSphere,
 
  106                       'dynArrayAttrs'   : omAPI.MFnData.kDynArrayAttrs,
 
  107                       'dynSweptGeometry': omAPI.MFnData.kDynSweptGeometry,
 
  108                       'subdSurface'     : omAPI.MFnData.kSubdSurface,
 
  109                       'nObject'         : omAPI.MFnData.kNObject,
 
  110                       'nId'             : omAPI.MFnData.kNId }
 
  115     kFlagFunctions = { 
'readable'               : 
'readable',
 
  116                        'writable'               : 
'writable',
 
  117                        'canconnectassrc'        : 
'readable',
 
  118                        'canconnectasdst'        : 
'writable',
 
  119                        'connectable'            : 
'connectable',
 
  120                        'storable'               : 
'storable',
 
  123                        'indexmatters'           : 
'indexMatters',
 
  124                        'keyable'                : 
'keyable',
 
  125                        'channelbox'             : 
'channelBox',
 
  127                        'usedascolor'            : 
'usedAsColor',
 
  128                        'indeterminant'          : 
'indeterminant',
 
  129                        'rendersource'           : 
'renderSource',
 
  130                        'worldspace'             : 
'worldSpace',
 
  131                        'affectsworldspace'      : 
'affectsWorldSpace',
 
  132                        'usedasfilename'         : 
'usedAsFilename',
 
  133                        'affectsappearance'      : 
'affectsAppearance',
 
  134                        'usesarraydatabuilder'   : 
'usesArrayDataBuilder',
 
  135                        'internal'               : 
'internal' }
 
  140     kDisconnectBehaviors = { 
'delete'  : omAPI.MFnAttribute.kDelete,
 
  141                              'reset'   : omAPI.MFnAttribute.kReset,
 
  142                              'nothing' : omAPI.MFnAttribute.kNothing }