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

Synopsis

hasMetadata [-asList] [-channelName string] [-channelType string] [-endIndex string] [-ignoreDefault] [-index string] [-indexType string] [-memberName string] [-scene] [-startIndex string] [-streamName string]

hasMetadata is NOT undoable, NOT queryable, and NOT editable.

This command is used to query for the presence of metadata elements on a node, components, or scene. The command works at all levels of metadata presence, from the existence of any metadata at all on a node or scene right down to the presence of metadata values set on a particular metadata Stream index. Filter Flags

Operation Flags

Return value

string[]List of indexes in the filtered list which contain metadata
boolean[]List of answers to whether the specified item(s) have metadata

Keywords

metadata, component, stream, channel, association

Related

addMetadata, applyMetadata, dataStructure, editMetadata, getMetadata

Flags

asList, channelName, channelType, endIndex, ignoreDefault, index, indexType, memberName, scene, startIndex, streamName
Long name (short name) Argument types Properties
-asList(-al) create
Use this flag when you want to return string values indicating where the metadata lives rather than boolean values. See the command description for more details on what this flag will return.
-ignoreDefault(-id) create
Use this flag when you want to skip over any metadata that has only default values. i.e. the metadata may exist but it hasn't had a new value set yet (non-zero for numerics, non-empty strings, etc.) See the command description for more details on how this flag filters the search.
-memberName(-mn) string create
Name of the Structure member being checked. The names of the members are set up in the Structure definition, either through the description passed in through the "dataStructure" command or via the API used to create that Structure. As the assignment of metadata is on a per-structure basis this flag only needs to be specified when querying for non-default values. If you query for non-default values and omit this flag then it checks that any of the members have a non-default value.
-channelName(-cn) string createquery
Filter the metadata selection to only recognize metadata belonging to the specified named Channel (e.g. "vertex"). This flag is ignored if the components on the selection list are being used to specify the metadata of interest.

In query mode, this flag can accept a value.

-channelType(-cht) string createquery
Obsolete - use the 'channelName' flag instead.

In query mode, this flag can accept a value.

-endIndex(-eix) string create

The metadata is stored in a Stream, which is an indexed list. If you have mesh components selected then the metadata indices are implicit in the list of selected components. If you select only the node or scene then this flag may be used in conjunction with the startIndex flag to specify a range of indices from which to retrieve the metadata. It is an error to have the value of startIndex be greater than that of endIndex.

See also the index flag for an alternate way to specify multiple indices. This flag can only be used on index types that support a range (e.g. integer values - it makes no sense to request a range between two strings)

In query mode, this flag can accept a value.

-index(-idx) string createquerymultiuse

In the typical case metadata is indexed using a simple integer value. Certain types of data may use other index types. e.g. a "vertexFace" component will use a "pair" index type, which is two integer values; one for the face ID of the component and the second for the vertex ID.

The index flag takes a string, formatted in the way the specified indexType requires. All uses of the index flag have the same indexType. If the type was not specified it is assumed to be a simple integer value.

In query mode, this flag can accept a value.

-indexType(-idt) string createquery
Name of the index type the new Channel should be using. If not specified this defaults to a simple integer index. Of the native types only a mesh "vertexFace" channel is different, using a "pair" index type.

In query mode, this flag can accept a value.

-scene(-scn) createquery
Use this flag when you want to add metadata to the scene as a whole rather than to any individual nodes. If you use this flag and have nodes selected the nodes will be ignored and a warning will be displayed.
-startIndex(-six) string create

The metadata is stored in a Stream, which is an indexed list. If you have mesh components selected then the metadata indices are implicit in the list of selected components. If you select only the node or scene then this flag may be used in conjunction with the endIndex flag to specify a range of indices from which to retrieve the metadata. It is an error to have the value of startIndex be greater than that of endIndex.

See also the index flag for an alternate way to specify multiple indices. This flag can only be used on index types that support a range (e.g. integer values - it makes no sense to request a range between two strings)

In query mode, this flag can accept a value.

-streamName(-stn) string createquery
Name of the metadata Stream. Depending on context it could be the name of a Stream to be created, or the name of the Stream to pass through the filter.

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 be used more than once in a command.

MEL examples

polyPlane -n smcPlane -ch off;
// Result: smcPlane //

// Create structures
dataStructure -format "raw" -asString "name=idStructure:int32=ID";
// Result: idStructure //
dataStructure -format "raw" -asString "name=keyValueStructure:string=value";
// Result: keyValueStructure //

// Apply structures to plane
select -r smcPlaneShape;
addMetadata -structure "idStructure" -streamName "idStream" -channelName "vertex";
addMetadata -structure "keyValueStructure" -streamName "keyValueStream" -channelName "key" -indexType "string";

// Apply the metadata values to three of the components by selection
select -r smcPlaneShape.vtx[8:10];
editMetadata -streamName "idStream" -memberName "ID" -value 7;
// Result: 3 //

// Verify existence of the three newly set metadata values at the node level
select -r smcPlaneShape;
hasMetadata;
// Result: 1 //

// Verify existence of the three newly set metadata values at the Channel level
hasMetadata -channelName "vertex";
// Result: 1 //
hasMetadata -channelName "edge";
// Result: 0 //

// Verify existence of the three newly set metadata values at the Stream level
hasMetadata -channelName "vertex" -streamName "idStream";
// Result: 1 //
hasMetadata -channelName "edge" -streamName "someOtherStream";
// Result: 0 //

// Verify existence of the three newly set metadata values at the Index level
hasMetadata -channelName "vertex" -streamName "idStream" -index "8" -index "9";
// Result: 1 1 //
hasMetadata -channelName "vertex" -streamName "idStream" -index "8" -index "9999";
// Result: 1 0 //

// Verify existence of default metadata values at the Index level. Since the
// index range was established to be 0-17 by assignment and the Stream
// defaults to returning default values for unassigned indices the lower index
// values "0" and "1" do have metadata (as default values) but the higher one
// "9999" in the above example does not.
hasMetadata -channelName "vertex" -streamName "idStream" -index "0" -index "1";
// Result: 1 1 //

// Verify non-existence of non-default metadata values at the Index level
hasMetadata -ignoreDefault -channelName "edge" -streamName "idStream" -memberName "ID" -index "0" -index "1";
// Result: 0 0 //

// Get the list of Index values with assigned metadata on the object
select -r smcPlaneShape.vtx[8:20];
hasMetadata -channelName "vertex" -streamName "idStream" -asList;
// Result: 8 9 10 //

// Set metadata values using the complex index type "string"
editMetadata -streamName "keyValueStream" -memberName "value" -stringValue "Starry Night" -indexType "string" -index "Title";
editMetadata -streamName "keyValueStream" -memberName "value" -stringValue "Vincent Van Gogh" -indexType "string" -index "Artist";

// Verify existence of the complex index data
hasMetadata -streamName "keyValueStream" -memberName "value" -channelName "key" -index "Title" -index "Artist" -indexType "string" -asList;
// Result: "Artist" "Title" //