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

Fix ExportSkeleton USDZ scale #184

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

hybridherbst
Copy link
Contributor

@hybridherbst hybridherbst commented May 14, 2020

After adding scale in ExportContext bounds were now broken for animated meshes. I'm still not 100% sure about this, but at least the order of magnitude of the bounds is correct again (and exports look right in usdview which they don't without this PR).

Copy link
Contributor

@jcowles jcowles left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for the fix!

@@ -80,6 +80,8 @@ public static class SkeletonExporter {
// This is required because USD expects the extent to be a local bound for the SkelRoot.
var oldParent = objContext.gameObject.transform.parent;
objContext.gameObject.transform.SetParent(null, worldPositionStays: false);
var originalScale = objContext.gameObject.transform.localScale;
objContext.gameObject.transform.localScale *= 1 / exportContext.scale;
Copy link
Contributor

@jcowles jcowles Jul 3, 2020

Choose a reason for hiding this comment

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

I do believe this was intended to be captured by SetParent(null, ...) above, it's just that the scale wasn't captured.

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess my remaining question is if this should be 1/exportContext.scale or if it should just be 1.

Copy link
Contributor

@jcowles jcowles left a comment

Choose a reason for hiding this comment

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

After some local testing, this only seems right in some scenarios... I'm digging in a bit more to better understand what's going on between the bbox and geometry scales

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants