Go to: Synopsis. Return value. Keywords. Related. Flags. Python examples.

Synopsis

showMetadata([auto=boolean], [dataType=string], [interpolation=boolean], [isActivated=boolean], [listAllStreams=boolean], [listMembers=boolean], [listValidMethods=boolean], [listVisibleStreams=boolean], [member=string], [method=string], [off=boolean], [range=[float, float]], [rayScale=float], [stream=string])

Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.

showMetadata is undoable, queryable, and NOT editable.

This command is used to show metadata values which is in the specified channels "vertex", "edge", "face", and "vertexFace" in the viewport. You can view the data by three ways:

  1. "color": draw color on the components.
  2. "ray": draw a ray on the components.
  3. "string": draw 2d strings on the components.
For example, if the metadata of "shape.vtx[1]" is (1, 0, 0), you can turn on the visualization with all three modes. On "color" mode, you can see a red vertex which is on the position of "shape.vtx[1]". On "ray" mode, you can see a ray with the direction (1, 0, 0). On "string" mode, you can see strings "1 0 0" below the vertex in the viewport.

To use "color" or "ray" mode, you should make the member of the data structure with three or less items, such as float[3]. The three items are mapped to "RGB" as a color, or "XYZ" as a vector. The structure with two items works similarly. The only difference is that the third value will always be zero. However, if the structure has only one item, the value is mapped to all three variables. That means if the structure is "int" and its value is 1, the color will be white(1, 1, 1) and the vector will be (1, 1, 1).

You can get the current status of the flags on the query mode (using "-query"). But you can query only the status of one flag in a single command and you cannot set values on the query mode.

You can use the command on some specified objects, or run it with no arguments to make changes on all objects in the scene. The object must be a mesh shape. Components are not allowed as the command arguments.

Return value

stringresult of the operation or the queried status

In query mode, return type is based on queried flag.

Keywords

metadata, component, stream, channel, association

Related

addMetadata, applyMetadata, dataStructure, editMetadata, getMetadata, hasMetadata

Flags

auto, dataType, interpolation, isActivated, listAllStreams, listMembers, listValidMethods, listVisibleStreams, member, method, off, range, rayScale, stream
Long name (short name) Argument types Properties
auto(a) boolean createquery
Similar to the flag "-range", but uses the min/max value from the metadata in the same stream and member instead of the specified input value. In query mode, you can use the flag to query if "auto" is on.
dataType(dt) string createquery
In create mode, when used with the flags "stream" and "member", specify a member to show. If the flag "off" is used, specify the member to turn off. In query mode, when used with the flags "stream" and "member", query the visualization state of the specified member. Only one member of each shape can be visualized at a time.

In query mode, this flag can accept a value.

interpolation(i) boolean createquery
In create mode, enable/disable interpolation for "color" method. When interpolation is on, the components will be displayed in the interpolated color, which is computed by averaging their metadata values. In query mode, query the current state of interpolation flag of the selected objects.
isActivated(ia) boolean createquery
Used to check if the given stream is activated. If some shapes are selected, query their states. If no shape is selected, query the states of all shapes in the scene.
listAllStreams(las) boolean createquery
Used with object names to list all streams of the specified objects. no matter if they are visible in the viewport. Or you can use the flag individually to list all streams in the scene. Due to the fact that different objects may have the same stream name, the returned list will merge the duplicated stream names automatically.
listMembers(lm) boolean createquery
Used with the flag 'stream' to get the member list in the specified stream.
listValidMethods(lvm) boolean createquery
List the valid visual methods that can be set for the current stream and member. Some data type cannot be displayed by some methods. For example, if the data type is "string", it cannot be displayed by "color" or by "ray". In other words, only the method "string" will be returned when you list the methods.
listVisibleStreams(lvs) boolean createquery
Used with object names to list the name of the current visible streams of the specified object. Or you can use the flag with no object name to list all visible streams in the scene.
member(mb) string createquery
In create mode, when used with the flags "stream" and "dataType", specify a member to show. If the flag "off" is on, specify the member to turn off. In query mode, when used with the flags "stream" and "dataType", query the visualization state of the specified member. Only one member of each shape can be visualized at a time.

In query mode, this flag can accept a value.

method(m) string createquery
Determine the method of visualization: "color" convert metadata to a color value and draw the components with the color "ray" convert metadata to a vector and draw this vector line which starts from the center of the component "string" display the metadata through 2d string beside the component in the viewport The argument must be a string and must be one of the three words. The default method is "color". If the data type is string, you can only show it with "string" method. In query mode, you can use the flag with no arguments to query the method of a specified stream and member.
off() boolean createquery
In create mode, turn off the member which is specified by the flags "stream", "member" and "dataType".
range(r) [float, float] createquery
Specify the range of data to use. The value which is out of the range will be clamped to the min/max value. If the method of visualization is "color", the range will be mapped to the color. That means the min value will be displayed in black while the max value will be in white. In query mode, you can use the flag individually to query the current range.
rayScale(rs) float createquery
Specify the scale of the ray to display it with a proper length.
stream(s) string createquery
In create mode, when used with the flags "member" and "dataType", specify a member to show. If the flag "off" is used, specify the member to turn off. In query mode, when used with the flags "member" and "dataType", query the visualization state of the specified member. When used with the flag "listMembers", query the members in the specified stream. Only one member of each shape can be visualized at a time.

In query mode, this flag can accept a value.


Flag can appear in Create mode of command Flag can appear in Edit mode of command
Flag can appear in Query mode of command Flag can have multiple arguments, passed either as a tuple or a list.

Python examples

import maya.cmds as cmds

import maya.cmds as cmds
#Create a scene
cmds.file(force=True, new=True)
cmds.dataStructure(format="raw", asString="name=StructOne:int32=MemberOne")
cmds.polyPlane(constructionHistory=False, name="mesh")
#Add Metadata
cmds.addMetadata('meshShape', streamName="StreamOne", channelName="vertex", structure="StructOne")
cmds.editMetadata('meshShape.vtx[1]', streamName="StreamOne", channelName="vertex", memberName="MemberOne", value=1)
cmds.select(clear=True)
cmds.showMetadata('meshShape', member="MemberOne", dataType="int32", stream="StreamOne")
#Show metadata for which the member is "MemberOne" and the stream is "StreamOne"
cmds.showMetadata('meshShape', stream="StreamOne", member="MemberOne", dataType="int32", method="color")
#StreamOne will be visualized by Component Color method. The other two visualization methods are
#"string" and "ray". If "-method" flag is not defined, "color" will be used by default.
cmds.showMetadata(off=True)
#Deactivate all streams to turn off metadata visualization
cmds.showMetadata(stream="StreamOne", member="MemberOne", dataType="int32", method="color", interpolation=True)
#Enable interpolation on "color" mode. Interpolation must be used with "color" method
cmds.showMetadata(range=[0, 10], stream="StreamOne", member="MemberOne", dataType="int32")
#Show metadata between a specified range from 0 to 10. If the method is "color",
# the value 0 will be displayed in black, while the value 10 will be displayed
# in white. The value beyond the range will be clamped to 0 or 10.
cmds.showMetadata('meshShape', auto=True, stream="StreamOne", member="MemberOne", dataType="int32")
#Show metadata between the dynamic range, which is computed by the current min/max value
cmds.showMetadata(query=True, listAllStreams=True)
#Return all streams in the scene, no matter if they are activated
cmds.showMetadata('meshShape', query=True, listAllStreams=True)
#Return all streams of meshShape, no matter if they are activated
cmds.showMetadata(query=True, listVisibleStreams=True)
#Return the stream name(s) being visualized in the scene
cmds.showMetadata('meshShape', query=True, listVisibleStreams=True)
#Return the stream name being visualized that is attached to meshShape
cmds.showMetadata(query=True, stream="StreamOne", listMembers=True)
#Return the member names and types in the specified stream
#The names and types are returned in pair, such as "MemberOne int32 MemberTwo float"
cmds.showMetadata(query=True, stream="StreamOne", member="MemberOne", dataType="int32", method=True)
#Return the visualization method of the visualized StreamOne
cmds.showMetadata(query=True, stream="StreamOne", member="MemberOne", dataType="int32", listValidMethods=True)
#Return the valid visual methods of the activated stream that can be set
cmds.showMetadata(query=True, stream="StreamOne", member="MemberOne", dataType="int32", range=True)
#Return the current range of visible metadata
cmds.showMetadata(query=True, stream="StreamOne", member="MemberOne", dataType="int32", auto=True)
#Return the current state of the auto flag