How do you REMOVE a Metadata stream/channel on a node?

How do you REMOVE a Metadata stream/channel on a node?

FirespriteNate
Advocate Advocate
203 Views
1 Reply
Message 1 of 2

How do you REMOVE a Metadata stream/channel on a node?

FirespriteNate
Advocate
Advocate

I'm trying to add metadata to a curve node using dataStructure and addMetadata commands. It seems I can create the data okay, but I can't seem to figure out how to remove or delete a channel stream from a node that it has already been applied to. I can delete specific indexed entries using the editMetadata command, but the metadata stream and channel still exists on the node.

Here's an example:

# create a test poly plane
plane = cmds.polyPlane(w=1, h=1, sx=1, sy=1, ch=False)
shape = cmds.listRelatives(plane, shapes=True)[0]

# Create data structure
struct = cmds.dataStructure(format='raw', asString='name=MetaColor:float[3]=Color')
# Apply structure to plane vertices via a new stream
cmds.addMetadata(shape, structure=struct, streamName='NewStream', channelName='vertex')
# give it some color metadata
colorList = (1,.7,0),(1,0,0),(0,.3,1),(.5,1,0)
for n,color in enumerate(colorList):
    cmds.editMetadata(shape, streamName='NewStream', memberName='Color', channelName='vertex', index=n, value=color)
# display it (vp2.0 only):
cmds.showMetadata(shape, stream="NewStream", member="Color", dataType="float[3]", method="color")

 

Now how do I delete/remove NewStream from the polyPlane?

 

I can delete all four index values using the editMetadata command, but the stream still persists on the mesh, just empty. If I save the scene the empty stream persists in the ASCII scene data, and if I later delete the MetaColor data structure, the stream still persists and then throws several errors whenever the scene is opened.

 

I've checked the docs and there doesn't seem to be any mention of how to remove a named stream from a node. Anyone got any ideas?

0 Likes
204 Views
1 Reply
Reply (1)
Message 2 of 2

FirespriteNate
Advocate
Advocate

oh, I also forgot to mention, there seems to be a serious MEL code bug in 2022, 2023 and 2024 that prevents the Metadata Editor even opening.

// Error: file: C:/Program Files/Autodesk/Maya2024/scripts/others/editMetadataWindow.mel line 658: Cannot convert data of type string[] to type string.

someone at Autodesk might wanna fix that, the fix is:

line 658|	string $allShapes[] = `ls -shapes`;
0 Likes