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

Respect prim writer ShouldPruneChildren when shading mode is useRegistry #2385

Merged

Conversation

sshklifov
Copy link

Currently, there is no way to register a shader writer that handles all
connected plugs to the shader. For example, the writer might handle file
nodes connected to the shader, but useRegistry shading mode will invoke
FileTextureWriter unconditionally. It will write out a UsdUVTexture
shader, which useRegistry won't be able to connect to the shading network.

Currently, there is no way to register a shader writer that handles all
connected plugs to the shader. For example, the writer might handle file
nodes connected to the shader, but useRegistry shading mode will invoke
FileTextureWriter unconditionally. It will write out a UsdUVTexture
shader, which useRegistry won't be able to connect to the shading network.
@seando-adsk
Copy link
Collaborator

@sshklifov Thank you for the PR. In order to proceed we will need a signed CLA from you. Please see Contributing

@seando-adsk seando-adsk added the do-not-merge-yet Development is not finished, PR not ready for merge label May 27, 2022
@sshklifov
Copy link
Author

Hi @seando-adsk, sorry for the inconvenience. The CLA has been signed and sent to the appropriate destination.

@seando-adsk seando-adsk added core Related to core library and removed do-not-merge-yet Development is not finished, PR not ready for merge labels Jun 6, 2022
@seando-adsk
Copy link
Collaborator

@sshklifov No problem. We got the signed CLA and we can now proceed with your pull-request. I've assigned it to one of our devs for code review.

Copy link
Collaborator

@JGamache-autodesk JGamache-autodesk left a comment

Choose a reason for hiding this comment

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

The code itself is OK, but I suspect it will act more as a workaround than a fix.

It is perfectly OK to challenge returning ContextSupport::Fallback in PxrUsdTranslators_FileTextureWriter::CanExport() when not exporting to UsdPreviewSurface materials. I do not feel that this code is doing the right thing anymore if it forces you to add explicit pruning to fight against it.
Maybe adding a "no-fallback" flag when you register a new useRegistry conversion mode would be better?

@sshklifov
Copy link
Author

sshklifov commented Jun 7, 2022

Hi @JGamache-autodesk. Thanks for the feedback.

Removing ContextSupport::Fallback from PxrUsdTranslators_FileTextureWriter::CanExport() would solve the issue, yes. But I feel that would be a workaround as other prim writers are free to return ContextSupport::Fallback and the same problem will occur.

I am not sure what you mean by adding a "no-fallback" flag. Do you mean adding this flag as an argument to UsdMayaShadingModeRegistry::RegisterExportConversion? I think I prefer this solution, should I update the PR?

@JGamache-autodesk
Copy link
Collaborator

Hi @sshklifov, adding a no-fallback argument to RegisterExportConversion looks like the best solution. If you could update the PR that would be really nice. Thanks!

@sshklifov
Copy link
Author

Hi, sorry for the delay, I updated the PR. I do have a question regarding ABI though. These changes will require recompilation of plugins that link to mayaUsd (struct ConversionInfo size has changed). It is however possible to maintain ABI compatibility if ConversionInfo is not modified.

Which approach is desired? As someone who is developing a plugin that uses mayaUsd, I think that breaking the ABI in general is undesirable. In this particular instance, we will have to recompile anyway in order to see the new symbol with the noFallback flag.

Copy link
Collaborator

@JGamache-autodesk JGamache-autodesk 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. Thanks for the update!

I am not worried with new members at the end of a struct that has no virtual members. That is allowed according to the very thorough KDE binary compatibility guidelines. Changing the signatures of existing functions could be an issue though if we want to preserve binary compatibility.

I think our guidelines allow binary incompatible changes between released versions of MayaUSD so I don't think this will be an issue. I will let @seando-adsk confirm.

@seando-adsk
Copy link
Collaborator

There is no problem with binary breaking changes. That is the reason we are major version 0.

@seando-adsk
Copy link
Collaborator

@sshklifov I ran the preflight build for you and unfortunately it failed during the initial clang-format step. Please access the checks tab and you'll see the clang-format errors along with the fixes. Or if you have access to clang-format you can run it locally. Please see our coding guideslines for info about clang-format.

@sshklifov
Copy link
Author

I ran clang-format exact version 10.0.0. The diff seems to be matching the one in the checks tab.

@JGamache-autodesk JGamache-autodesk added the ready-for-merge Development process is finished, PR is ready for merge label Jun 22, 2022
@seando-adsk seando-adsk merged commit e6b996b into Autodesk:dev Jun 27, 2022
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.

5 participants