Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check skin cluster weights #2971

Merged
merged 3 commits into from
Apr 18, 2023
Merged

Conversation

tryptik
Copy link

@tryptik tryptik commented Mar 24, 2023

If an artist uses polyReduce (or other node that changes the vertex count) after a skinCluster has been applied, the Usd exporter tries to compare the weights of the original vertex count with the assigned weights of the reduced vertex count. This results in an out-of-bounds access to the MDoubleArray that holds the weights.

This P/R checks for that condition and throws an exception if encountered (this occurs in a part of the plugin that is not using MStatus to signal success/failure/error).

Comment on lines 241 to 246
MString msg("Number of weights (");
msg += weights.length();
msg += ") exceeds number of influences * number of vertices (";
msg += numInfluences * numVertices;
msg += ") - skin binding will not be written";
MGlobal::displayError(msg);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to add to this message a way to fix the problem or a workaround for problem?

@tryptik tryptik force-pushed the check_skinCluster_weights branch from 98db0ca to df83033 Compare March 27, 2023 20:14
@tryptik
Copy link
Author

tryptik commented Mar 27, 2023

I've updated the error message, added code that checks to see if num_influences == 0 and I added a unittest (I wasn't sure if one was needed - I can remove it if it's not wanted).

@seando-adsk seando-adsk added the core Related to core library label Apr 7, 2023
@seando-adsk seando-adsk added the ready-for-merge Development process is finished, PR is ready for merge label Apr 18, 2023
@seando-adsk seando-adsk merged commit b009089 into Autodesk:dev Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Related to core library ready-for-merge Development process is finished, PR is ready for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants