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

Support duplicate blendshape target names #1179

Merged

Conversation

ysiewappl
Copy link
Contributor

@ysiewappl ysiewappl commented Feb 15, 2021

Hi:

This PR fixes some bugs introduced with the newly-added blendshape export functionality, related to exporting multiple targets across multiple meshes.

The following are of significance in this PR:

  • Previously, exporting multiple targets across multiple meshes resulted in some targets not having their animation written out at all.

  • Exporting targets that share the same name across multiple meshes is now supported; we now namespace each target name (while leaving the prim name untouched to act as a "nice" name) to ensure that there is no risk of collision.

  • We also now write out the default weights for blendshape targets, if they exist. This (unfortunately) only applies when animation export is enabled for now.

Please review and raise any concerns.

@ysiewappl ysiewappl force-pushed the support-duplicate-blendshape-target-names branch from 35907c8 to 8cd41ed Compare February 15, 2021 22:22
/// This is cached at the writeJob-level because the state needs to persist across instances of
/// the meshWriter->Write() function.
MAYAUSD_CORE_PUBLIC
MPlugArray mBlendShapesAnimWeightPlugs;

Choose a reason for hiding this comment

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

It's rather surprising to see translator-specific data in this generic context. What do others think? Should we make it easier to attach any blind data to the context instead of hardcoding something specific each time a translator needs it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes; I foresee a lot of future needs for this where a translator will need to retain state between invocations or similar, especially for certain types of Maya nodes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kxl-adsk Based on our discussion, I've gone ahead and made the change to move this into the meshWriter translator instead, along with updating the unit test as also discussed. Please let me know if there are other questions/concerns.

Choose a reason for hiding this comment

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

Sounds good. I re-requested the review from @williamkrick and dismissed the stale review since it was no longer applicable based on what we discussed. I also started a new PF.

@kxl-adsk kxl-adsk added the import-export Related to Import and/or Export label Feb 16, 2021
@kxl-adsk kxl-adsk requested review from ppt-adsk and removed request for mattyjams February 26, 2021 20:51
Copy link
Contributor

@HamedSabri-adsk HamedSabri-adsk left a comment

Choose a reason for hiding this comment

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

@ysiewappl I am trying to build this PR on my Windows machine and getting C2071 error:

maya-usd/lib/mayaUsd/fileio/writeJobContext.h(163): error C2071: 'pxrInternal_v0_21__pxrReserved__::UsdMayaWriteJobContext::mBlendShapesAnimWeightPlugs': illegal storage class

@ysiewappl
Copy link
Contributor Author

@ysiewappl I am trying to build this PR on my Windows machine and getting C2071 error:

maya-usd/lib/mayaUsd/fileio/writeJobContext.h(163): error C2071: 'pxrInternal_v0_21__pxrReserved__::UsdMayaWriteJobContext::mBlendShapesAnimWeightPlugs': illegal storage class

Hi @HamedSabri-adsk: That's...odd. For one, the code is just:

    MAYAUSD_CORE_PUBLIC
    MPlugArray mBlendShapesAnimWeightPlugs;

Which on w32 should just expand to __declspec(dllexport). Second...the code should exist on line 142, not 163. Did I miss something here that's causing these issues?

@HamedSabri-adsk
Copy link
Contributor

HamedSabri-adsk commented Mar 2, 2021

@ysiewappl I was able to build the PR by removing the "MAYAUSD_CORE_PUBLIC" before your public member variable.

I haven't had time to investigate why VS compiler is not happy. I also don't see anything that jumps up under "Selective Member Import/Export" criteria:

https://docs.microsoft.com/en-us/cpp/cpp/using-dllimport-and-dllexport-in-cpp-classes?view=msvc-160

@ysiewappl
Copy link
Contributor Author

ysiewappl commented Mar 2, 2021

@ysiewappl I was able to build the PR by removing the "MAYAUSD_CORE_PUBLIC" before your public member variable.

I haven't had time to investigate why VS compiler is not happy. I also don't see anything that jumps up under "Selective Member Import/Export" criteria:

https://docs.microsoft.com/en-us/cpp/cpp/using-dllimport-and-dllexport-in-cpp-classes?view=msvc-160

Ah, I think I know what the issue is; I haven't defined the specific symbol. Clang doesn't seem to treat this as an error, oddly enough; I think MSVC is making the right call on this one.

If you define a member as dllexport but do not include it in the class definition, a compiler error is generated. You must define the member in the class header.

There is no reason why this member needs to be made an exportable symbol, so I've gone ahead and removed that macro prefix (as of 01d62a7). Previously I had just added in there in keeping with the surrounding code.

@kxl-adsk kxl-adsk requested review from williamkrick and removed request for ppt-adsk March 11, 2021 10:40
@kxl-adsk kxl-adsk dismissed HamedSabri-adsk’s stale review March 11, 2021 10:41

Symbol was removed

@@ -75,12 +74,12 @@ class PxrUsdTranslators_MeshWriter : public UsdMayaPrimWriter
bool writeBlendShapeAnimation(const UsdTimeCode& usdTime);
bool writeAnimatedMeshExtents(const MObject& deformedMesh, const UsdTimeCode& usdTime);

/// Used to cache the animated blend shape weight plugs that need to be sampled per-frame.
Copy link
Contributor

Choose a reason for hiding this comment

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

We should add the explanation here of why this needs to be a static member.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This request has been accommodated for in 2ab03a5.

Copy link
Contributor

@williamkrick williamkrick 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 to me. Just a bit more explanation of why the static member is needed right where it is declared and I will approve it.

- adding more documentation

clang-format
@kxl-adsk kxl-adsk merged commit 1a14155 into Autodesk:dev Mar 12, 2021
@ysiewappl ysiewappl deleted the support-duplicate-blendshape-target-names branch March 12, 2021 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
import-export Related to Import and/or Export
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants