pymel.core.modeling.dataStructure

dataStructure(*args, **kwargs)

Takes in a description of the structure and creates it, adding it to the list of available data structures. The structure definition can either be supplied in the asStringflag or exist in a file that is referenced by the asFileflag. If the removeflag is specified with a nameflag then the data structure will be removed. This is to keep all structure operations in a single command rather than create separate commands to create, remove, and query the data structures. When you use the removeAllflag then every existing metadata structure is removed. Use with care! Note that removed structures may still be in use in metadata Streams after removal, they are just no longer available for the creation of new Streams. Both the creation modes and the remove mode are undoable. Creation of an exact duplicate of an existing structure (including name) will succeed silently without actually creating a new structure. Attempting to create a new non-duplicate structure with the same name as an existing structure will fail as there is no way to disambiguate two structures with the same name. Querying modes are defined to show information both on the created structures and the structure serialization formats that have been registered. The serialization formats preserve the structure information as text (e.g. raw, XML, JSON). Since the rawstructure type is built in it will be assumed when none are specified. General query with no flags will return the list of names of all currently existing structures. Querying the formatflag will return the list of all registered structure serialization formats. Querying with the formatsupplied before the queryflag will show the detailed description of that particular structure serialization format. Querying the asStringflag with a structure name and serialization format supplied before the queryflag will return a string representing the named data structure in the serialization format specified by the formatflag. Even if the format is the same as the one that created the structure the query return string may not be identical since the queried value is formatted in a standard way - original formatting is not preserved. Querying the asFileflag with a structure name supplied before the queryflag will return the original file from which the structure was generated. If the structure was created using the asStringflag or through the API then an empty string will be returned. Querying the nameflag returns the list of all structures created so far.

Flags:
Long name (short name) Argument Types Properties
asFile (af) unicode ../../../_images/create.gif ../../../_images/query.gif
 

Specify a file that contains the serialized data which describes the structure. The format of the data is specified by the ‘format’ flag.Flag can appear in Create mode of commandFlag can have multiple arguments, passed either as a tuple or a list.

asString (asString) unicode ../../../_images/create.gif ../../../_images/query.gif
 
Specify the string containing the serialized data which describes the structure. The format of the data is specified by the ‘format’ flag.
format (fmt) unicode ../../../_images/create.gif ../../../_images/query.gif
 

Format of data to expect in the structure description. “raw” is supported natively and will be assumed if the format type is omitted. Others are available via plug-in. You can query the available formats by using this flag in query mode. In query mode, this flag can accept a value.

name (n) unicode ../../../_images/query.gif
 
Query mode only. Name of the data structure to be queried, or set to list the available names. In query mode, this flag can accept a value.
remove (rem) bool ../../../_images/create.gif
 
Remove the named data structure. It’s an error if it doesn’t exist.
removeAll (ral) bool ../../../_images/create.gif
 
Remove all metadata structures. This flag can not be used in conjunction with any other flags.

Derived from mel command maya.cmds.dataStructure

Example:

import pymel.core as pm

import maya.cmds as cmds
pm.dataStructure( query=True, format=True )
# Result: [u'raw'] #
pm.dataStructure( format='raw', asString='name=NameAndID:string=name:int32=ID' )
# Result: u'NameAndID' #
# Note that this file doesn't exist, it's just an example of how to read
# from the file after you've created it. The file contents should look
# like this:
#               name=FileBasedStructure
#               string=fileInformation
pm.dataStructure( asFile='someFile.raw' )
pm.dataStructure( query=True )
['NameAndID', 'FileBasedStructure']
pm.dataStructure( name='NameAndID', format='raw', query=True, asString=True )
'name=NameAndID:string=name:int32=ID'
pm.dataStructure( remove=True, name='NameAndID' )
'NameAndID'
pm.dataStructure( query=True )
['FileBasedStructure']
pm.dataStructure( removeAll=True )
['FileBasedStructure']

Previous topic

pymel.core.modeling.cylinder

Next topic

pymel.core.modeling.detachCurve

Core

Core Modules

Other Modules

This Page