Maya Forum
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya topics.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Set component tag expression within the deformer node using python or mel?

Message 1 of 2
376 Views, 1 Reply

Set component tag expression within the deformer node using python or mel?

Suppose my session in Maya 2023 has "Use Component tags" ON, and I bind a sphere to a joint. When I go to my new skin cluster node's Attribute Editor > Input Attributes > Idx 0, in the Component Tag tab field, I can see the "* (All)" expression that automatically tags my whole mesh to that skin cluster, so it works.

But suppose I export and import my skin cluster node from another Maya file (without anything else connected to that node) and reconnect this node to my mesh. In that case, this Component tag expression becomes empty instead, and without anything there, my mesh can't deform because nothing is tagged for that mesh. 

I could set it manually via Attribute Editor, but I intend to do it automatically. That's my problem.

So I'm trying to find a way to at least set it to "*" via python or mel, but it has been hard to find a way.

I found a new attribute in my skin cluster that looks like I'm looking for:
but it doesn't accept "get" or "setAttr."

Even using API, it looks like there are additional tag methods only for MFnGeometryData. I'm not sure if it's possible to use this for deformers.

Ideally, I should be able to get this expression string and then set it later again, even in another node or after importing my node, as in the example above. And also do it for any other kinds of node other than skin cluster, @Anonymous. Any clue about how can I get this?

I appreciate it.


Labels (2)
Message 2 of 2

Okay, I did it.
Using the api getSetAttrCmds() I found the right way to set or get this attribute using python:


cmds.setAttr("mySkinClusterNode.input[0].componentTagExpression", "*", type="string")


Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report