ジャンプ先: 概要. 戻り値. キーワード. 関連. フラグ. Python 例.
addMetadata([channelType=string], [indexType=string], [streamName=string], [structure=string])
注: オブジェクトの名前と引数を表す文字列は、カンマで区切る必要があります。これはシノプシスに示されていません。
addMetadata は、取り消し可能、照会可能、および 編集不可能 です。
1 つまたは複数の選択したオブジェクトに対するメタデータ ストラクチャのアタッチメントを定義します。これにより、後で editMetadata コマンドを使用して設定するプレースホルダと空のメタデータ ストリームが作成されます。これは、ノードにおける addAttr コマンド(アトリビュートが追加されるが、データは実際に設定されない)と同様の概念です。
メタデータ ストラクチャを割り当てるときは、次のフラグを指定する必要があります。channelType はメタデータのチャネル タイプ(「頂点」など)、streamName は作成するメタデータ ストリームの名前、structure はメタデータの内容を定義するストラクチャ タイプの名前です。indexType フラグはオプションです。このフラグを指定しない場合、インデックスは標準の数値と推測されます。
メタデータの情報は、さまざまなレベルで照会できます。照会可能なすべての引数の一覧については以下の表を参照してください。それぞれの場合において、非照会引数のいずれかを指定すると、照会中に調べるメタデータの一覧がフィルタされます。すべての照会で、照会する単一のオブジェクトを選択する必要があります。
たとえば、他の引数を指定せずに channelType フラグを照会すると、メタデータを含む選択されたオブジェクトのすべてのチャネル タイプの一覧が返されます。indexType フラグを指定して channelType フラグを照会すると、その特定のタイプのインデックスを使用するメタデータ ストリームを含むチャネル タイプのみ返されます。
フラグの組み合わせ:
ChannelType IndexType StreamName Structure Create Can Query 0 0 0 0 X ChannelType, StreamName, Structure 0 0 0 1 X ChannelType, StreamName, IndexType 0 0 1 0 X ChannelType, Structure, IndexType 0 0 1 1 X ChannelType, IndexType 0 1 0 0 X ChannelType, StreamName, Structure 0 1 0 1 X ChannelType, StreamName 0 1 1 0 X ChannelType, Structure 0 1 1 1 X ChannelType 1 0 0 0 X StreamName, Structure, IndexType 1 0 0 1 X StreamName, IndexType 1 0 1 0 X Structure, IndexType 1 0 1 1 (a) IndexType 1 1 0 0 X StreamName, Structure 1 1 0 1 X StreamName 1 1 1 0 X Structure 1 1 1 1 (b) X (a) 既定のインデックス タイプの空のメタデータ ストリームを割り当てる (b) 指定したインデックス タイプの空のメタデータ ストリームを割り当てる
string[] | 新しいストリームが正常に追加されたノードの一覧(作成モード) |
string[] | channelType フラグを照会する場合のオブジェクトに関するメタデータを含むチャネル タイプの一覧 |
string[] | streamName フラグを照会する場合のオブジェクト上のストリーム名の一覧 |
string[] | structure フラグを照会する場合にオブジェクトのメタデータ ストリームで使用されるストラクチャの一覧 |
string[] | indexType フラグを照会する場合にオブジェクトで使用されるインデックス タイプの一覧 |
照会モードでは、戻り値のタイプは照会されたフラグに基づきます。
ロング ネーム(ショート ネーム) | 引数タイプ | プロパティ | ||
---|---|---|---|---|
channelType(cht)
|
string
|
![]() ![]() |
||
|
||||
indexType(idt)
|
string
|
![]() ![]() |
||
|
||||
streamName(stn)
|
string
|
![]() ![]() |
||
|
||||
structure(str)
|
string
|
![]() ![]() |
||
|
![]() |
![]() |
![]() |
![]() |
import maya.cmds as cmds import maya.cmds as cmds cmds.polyPlane( name='p', ch=False ) cmds.select( 'pShape', replace=True ) cmds.dataStructure( format='raw', asString='name=IdStruct:int32=ID' ) cmds.dataStructure( format='raw', asString='name=OffStruct:float=Offset' ) cmds.dataStructure( format='raw', asString='name=OrgStruct:float[3]=Origin Point' ) # Add three metadata streams cmds.addMetadata( streamName='IdStream', channelType='vertex', structure='IdStruct' ) cmds.addMetadata( streamName='OffStream', channelType='vertex', structure='OffStruct' ) cmds.addMetadata( streamName='OrgStream', channelType='edge', structure='OrgStruct' ) cmds.addMetadata( streamName='VFStream', channelType='vertexFace', indexType='pair', structure='OrgStruct' ) # Query for the list of all channel types possessing metadata cmds.addMetadata( query=True, channelType=True ) # Return: ['edge', 'vertex', 'vertexFace'] # # Query for the structure assigned to a specific stream cmds.addMetadata( channelType='vertex', streamName='OffStream', query=True, structure=True ) # Return: 'OffStruct' # # Query for the list of all streams on a specific channel type cmds.addMetadata( channelType='vertex', query=True, streamName=True ) # Return: ['IdStream', 'OffStream'] # # Query for the list of all streams cmds.addMetadata( query=True, streamName=True ) # Return: ['IdStream', 'OffStream', 'OrgStream', 'VFStream'] # # You can combine queries to answer more general questions about the # metadata on an object. For example suppose you wanted to know the # index type used by all Streams on the 'vertex' Channel. # First extract the list of Streams on the Channel streams = cmds.addMetadata( channelType='vertex', query=True, streamName=True ) # Loop through each Stream, querying the IndexType only for that Stream for stream in streams: indexType = cmds.addMetadata( channelType='vertex', streamName=stream, query=True, indexType=True )[0] print 'Index type on %s is %s' % (stream, indexType)