Home Website Youtube GitHub

Copy skin weights from poly to NURBS (mGear 4.0.9, Maya 2022)

Hello, forum. Since migrating to Maya 2022 (from 2020), I haven’t been able to copy skin weights from a poly object to a NURBS surface. I have the component tag options disabled, but the transferred weights are nowhere near what they should be.

Is this a known issue? Any workarounds that you all know of? Thanks in advance.

1 Like

Copy weights how, specifically?

I would like to know about that too. I tried using mGear copy skin weights, normal maya copy weights and sometimes it doesn’t copy at all, sometimes some influence weights don’t match at all. I ended up painting NURBS weights with paint tool.

And sometimes when I say that okay, it copied close enough and I export weights. Then when I reimport them, they come as completely different on NURBS

Ok yeah I can reproduce this. mGear skinCopy() seems to have some new problems in Maya 2022. The code hasn’t changed.

It is a very long-standing issue/bug for several years in Maya that you can’t use Maya’s “Skin Copy Weights” from a poly transform to a Nurbs transform. It worked many many years ago.

The workaround is that you have to copy directly to the Nurbs CVs. You can do this now and it will work. (Python makes this kind of multi-component transfer a lot easier than trying to select in viewport.)

For example in Pymel, here I just add .cv to the target, if it’s a Nurbs object:

import pymel.core as pm

# Select TARGETS first, and SOURCE last.
source = pm.selected()[-1]
targets = pm.selected()[0:-1]

for target in targets:
    shapeType = pm.nodeType(target.getShape())
    if shapeType in ["nurbsSurface", "nurbsCurve"]:
        pm.copySkinWeights(source, target.cv, noMirror=True, surfaceAssociation='closestPoint', ia=['oneToOne','name'])
        pm.copySkinWeights(source, target, noMirror=True, surfaceAssociation='closestPoint', ia=['oneToOne','name'])

mGear’s skinCopy() didn’t have this problem. But now it acts exactly the same. But only in Maya 2022. It still works fine in Maya 2020.

But in Maya 2020 (and 2019, 2018, all the way back to 2016 or 2015 or more) Maya’s Copy Skin Weights is still broken, if you transfer to a Nurbs transform.

I’m not sure if it’s possible to find a combination of *args that would work properly. Or if the skinCopy() function will need to check for Nurbs surfaces, and copy to the CVs directly. I’m not 100% sure why mGear’s function was working correctly before. Ultimately, it’s just using pm.copySkinWeights() too.

This is something completely different, and doesn’t sound right, unless you have another issue going on. You might be getting some errors when you export or import, so please check your script editor output. If you want help with this separate issue, can you please show us your skinCluster settings from the attribute editor?

Hi Chris. It looks like you found the issues further down, but just in case, here’s an an example use case:

If I’ve skinned a polygon object, but want to transfer those weights to a NURBS surface, such as a ribbon, I’ll select the NURBS object, followed by the poly object, and click on mGear > Skin and Weights > Copy Skin. This used to work fine in older versions of Maya, but in Maya 2022, it will create a skinCluster on the NURBS surface, but fail to copy the weights properly.

1 Like

Thanks for working that out – I will try this script the next time that I need to transfer.

Yep got it now thanks. When you post a bug, please share those steps at the beginning. Your original post didn’t specify if you were using Maya’s (known problems, not an mGear bug) or mGear’s (new problems, yes a bug) function.

I am sure that I didn’t see any errors back then and now I can’t find the file where I had this issue. But if I happen to have that again in the future, I will post it here with all the information I got. Thanks!

1 Like

I will research this. I guess is the same issue as the skin eport

1 Like

I’m not sure it’s quite the same. The core/skin export (or import, not sure which (or both) is causing the problem) is OpenMaya getting or setting weights, as far as I can tell.

The copy problem is just basic pm.copySkinWeights() and it can be solved by copying to CVs, when it is nurbs.

hmm… that Reddit thread is a bunch of downvoted answers, and it’s about the opposite (nurbs-to-polys). Not sure that is a good resource for this question.

But you’re right about sometimes doing operations in older versions of Maya :slight_smile:

1 Like