-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Autodesk: Fix issue where ResolveParameter doesn't support type conversion #2519
Autodesk: Fix issue where ResolveParameter doesn't support type conversion #2519
Conversation
Filed as internal issue #USD-8475 |
Hi Erika, Given the discussion on #2473, it seemed like we decided to drop this PR? Note that all of the sampler parameters are in the schema and Sdr as tokens, so accepting strings here would be deviating from the USD spec. Is there a reason you can't write these as tokens in the assets? If these are strings in the assets, I'd expect them to fail usd validation; though I don't know if we have coverage for this yet in fixbrokenschemas. Let me know if I'm missing something! Thanks, |
The problem is that with the current implementation, _ResolveParameter in material.cpp will not correctly resolve the token parameter. For example, the below code will always return empty sampler. I have tested the simpleShading sample in extras\usd\tutorials. The wrapS, wrapT, and wrapR sampler will all be empty after _ResolveParameter. Maybe I don't get the root cause of the problem, but resolve the parameter as a string will resolve the issue. |
/AzurePipelines run |
Pull request contains merge conflicts. |
Pierre: the script you linked never sets the sampler attributes. Have you modified the script at all? And what are you getting vs expecting from _ResolveParameter, exactly? Thanks! |
Sorry. It seems that the problem is "_ResolveParameter" will not return correct default value for a token property. For example, for the UsdUVTexture shader, there are default values for "wrapS" and "wrapT", which are saved in shaderDefs.usda. But current implementation can not read it: You can have a try with the simpleShading sample under extras\usd\tutorials. If you set a breakpoint at _ResolveParameter, you will find that it will not correctly get the default value. But if you call _ResolveParameter with the “string" parameter type, the default value can be correctly fetched. |
/AzurePipelines run |
Pull request contains merge conflicts. |
Ah! THank you for bearing with us, @PierreWang ! I think that means the correct fix is to change the call to |
Ok @spiffmon so your recommendation is here: @PierreWang, can you try that and let us know if it fixes your issue? It should make the rest of this PR unnecessary. If that works, please update the PR and we'll pull it in. Thanks! |
Great, this will resolve the problem. I will update this branch and use "GetDefaultValueAsSdfType" fix instead what I do now. |
…value for a token property.
/AzurePipelines run |
725f979
to
49237aa
Compare
PR updated with suggested change. |
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
Description of Change(s)
When resolving the parameter for wrapSampler, minSampler, and magSampler, if the value got is not a token, we try to get the value as a string, and construct the token from the string.
Related: Prior approach/discussion in #2473
Fixes Issue(s)