Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

copySkinWeights erred on repeated usage of "influenceAssociation" in Python...BUG?

copySkinWeights erred on repeated usage of "influenceAssociation" in Python...BUG?

mcw0
Advisor Advisor
594 Views
2 Replies
Message 1 of 3

copySkinWeights erred on repeated usage of "influenceAssociation" in Python...BUG?

mcw0
Advisor
Advisor

cmds.copySkinWeights(ss=skin1, ds=skin2, mirrorMode="YZ", surfaceAssociation="closestPoint", influenceAssociation="oneToOne", influenceAssociation="closestJoint", normalize=True)

# Error: keyword argument repeated: influenceAssociation
# # File "<maya console>", line 5
# # SyntaxError: keyword argument repeated: influenceAssociation

PS. Maya2023.3

0 Likes
Accepted solutions (1)
595 Views
2 Replies
Replies (2)
Message 2 of 3

FirespriteNate
Advocate
Advocate
Accepted solution

That's not a bug, Python syntax doesn't allow the repeated use of a function argument.

Several MEL commands allow you to specify multiple "items" into the same flag/arg, for example on a curve you can specify multiple points:

 

curve -degree 1 -point 0 0 0 -point 1 0 0;

 

but this is completely invalid in Python, so they got around it by compiling multiple entries into a single tuple value:

 

cmds.curve(degree=1, point=((0,0,0),(1,0,0)))

 

I've never used the copySkinWeights command, but I assume the same logic is present, so you would just need to do something like:

 

cmds.copySkinWeights(ss=skin1, ds=skin2, mirrorMode="YZ", surfaceAssociation="closestPoint", influenceAssociation=("oneToOne", "closestJoint"), normalize=True)

 

 

 

Message 3 of 3

mcw0
Advisor
Advisor

Thank you!

0 Likes