pymel.core.modeling.showMetadata

showMetadata(*args, **kwargs)

This command is used to show metadata values which is in the specified channels vertex, edge, face, and vertexFacein the viewport. You can view the data by three ways: color: draw color on the components. ray: draw a ray on the components. 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 colormode, you can see a red vertex which is on the position of shape.vtx[1]. On raymode, you can see a ray with the direction (1, 0, 0). On stringmode, you can see strings 1 0 0below the vertex in the viewport. To use coloror raymode, you should make the member of the data structure with three or less items, such as float[3]. The three items are mapped to RGBas a color, or XYZas 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 intand 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.

Flags:

Long Name / Short Name Argument Types Properties
auto / a bool ../../../_images/create.gif ../../../_images/query.gif
  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 autois on.
dataType / dt unicode ../../../_images/create.gif ../../../_images/query.gif
  In create mode, when used with the flags streamand member, specify a member to show. If the flag offis used, specify the member to turn off. In query mode, when used with the flags streamand 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 bool ../../../_images/create.gif ../../../_images/query.gif
  In create mode, enable/disable interpolation for colormethod. 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 bool ../../../_images/create.gif ../../../_images/query.gif
  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 bool ../../../_images/create.gif ../../../_images/query.gif
  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 bool ../../../_images/create.gif ../../../_images/query.gif
  Used with the flag ‘stream’ to get the member list in the specified stream.
listValidMethods / lvm bool ../../../_images/create.gif ../../../_images/query.gif
  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 coloror by ray. In other words, only the method stringwill be returned when you list the methods.
listVisibleStreams / lvs bool ../../../_images/create.gif ../../../_images/query.gif
  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 unicode ../../../_images/create.gif ../../../_images/query.gif
  In create mode, when used with the flags streamand dataType, specify a member to show. If the flag offis on, specify the member to turn off. In query mode, when used with the flags streamand 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 unicode ../../../_images/create.gif ../../../_images/query.gif
  Determine the method of visualization: colorconvert metadata to a color value and draw the components with the color rayconvert metadata to a vector and draw this vector line which starts from the center of the component stringdisplay 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 stringmethod. In query mode, you can use the flag with no arguments to query the method of a specified stream and member.
off / boolean In create mode, turn off the member which is specified by the flags ../../../_images/create.gif ../../../_images/query.gif
  stream, memberand dataType.
range / r float, float ../../../_images/create.gif ../../../_images/query.gif
  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 ../../../_images/create.gif ../../../_images/query.gif
  Specify the scale of the ray to display it with a proper length.
stream / s unicode ../../../_images/create.gif ../../../_images/query.gif
  In create mode, when used with the flags memberand dataType, specify a member to show. If the flag offis used, specify the member to turn off. In query mode, when used with the flags memberand 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 have multiple arguments, passed either as a tuple or a list.

Derived from mel command maya.cmds.showMetadata

Example:

::

import pymel.core as pm

import maya.cmds as cmds

#Create a scene pm.file(force=True, new=True) pm.dataStructure(format=”raw”, asString=”name=StructOne:int32=MemberOne”) pm.polyPlane(constructionHistory=False, name=”mesh”)

#Add Metadata pm.addMetadata(‘meshShape’, streamName=”StreamOne”, channelName=”vertex”, structure=”StructOne”) pm.editMetadata(‘meshShape.vtx[1]’, streamName=”StreamOne”, channelName=”vertex”, memberName=”MemberOne”, value=1) pm.select(clear=True)

pm.showMetadata(‘meshShape’, member=”MemberOne”, dataType=”int32”, stream=”StreamOne”) #Show metadata for which the member is “MemberOne” and the stream is “StreamOne”

pm.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.

pm.showMetadata(off=True) #Deactivate all streams to turn off metadata visualization

pm.showMetadata(stream=”StreamOne”, member=”MemberOne”, dataType=”int32”, method=”color”, interpolation=True) #Enable interpolation on “color” mode. Interpolation must be used with “color” method

pm.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.

pm.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

pm.showMetadata(query=True, listAllStreams=True) #Return all streams in the scene, no matter if they are activated

pm.showMetadata(‘meshShape’, query=True, listAllStreams=True) #Return all streams of meshShape, no matter if they are activated

pm.showMetadata(query=True, listVisibleStreams=True) #Return the stream name(s) being visualized in the scene

pm.showMetadata(‘meshShape’, query=True, listVisibleStreams=True) #Return the stream name being visualized that is attached to meshShape

pm.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”

pm.showMetadata(query=True, stream=”StreamOne”, member=”MemberOne”, dataType=”int32”, method=True) #Return the visualization method of the visualized StreamOne

pm.showMetadata(query=True, stream=”StreamOne”, member=”MemberOne”, dataType=”int32”, listValidMethods=True) #Return the valid visual methods of the activated stream that can be set

pm.showMetadata(query=True, stream=”StreamOne”, member=”MemberOne”, dataType=”int32”, range=True) #Return the current range of visible metadata

pm.showMetadata(query=True, stream=”StreamOne”, member=”MemberOne”, dataType=”int32”, auto=True) #Return the current state of the auto flag