Return the geomprop from mx_geompropvalue_filename - #3063
Open
Chang-Jin-Lee wants to merge 1 commit into
Open
Conversation
Fixes AcademySoftwareFoundation#3003. The OSL implementation never returned the fetched geomprop. getattribute writes into its destination on success and returns 0 only when the attribute is absent, so the assignment sat in the wrong branch: string defaultFilename = defaultVal.filename; if (getattribute(geomprop, defaultFilename) == 0) out.filename = defaultFilename; On success nothing copied defaultFilename into out. On failure the assignment was a no-op, because out = defaultVal on the line above had already done it. The ten sibling implementations in the same directory all test failure and install the default there, with the composite types copying the fetched value in an else branch. This follows that shape, and renames the local since it holds a fetched value rather than a default. Verified: full MaterialXTest suite passes, 26198 assertions across 84 test cases, including the five [genosl] cases. I have no OSL renderer available, so the runtime behaviour is argued from getattribute's documented contract and the sibling implementations rather than executed. Assisted-by: Claude (Anthropic)
|
Member
|
Thanks for this proposal, @Chang-Jin-Lee, and before we review it in detail, take a look at the instructions at #3063 (comment) for resolving the CLA authorization warnings. |
Author
|
Thanks — following the EasyCLA link now, so the authorization is on me rather than anything blocking on your side. I'll post here once the check flips. Everything else on the PR is green: all 37 build jobs pass, and the change is one line in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3003.
mx_geompropvalue_filenamenever returned the fetched geomprop.getattributewrites into its destination on success and returns 0 only when the attribute is absent, so the assignment sat in the wrong branch:On success nothing copied
defaultFilenameintoout. On failure the assignment was a no-op, becauseout = defaultValon the line above had already done it. Either wayout.filenamestayed at the default.The reporter suggested
== 1, which does work, since that first line covers the fallback. I went with the shape the ten sibling implementations inlibraries/stdlib/genosl/already use — every one tests failure and installs the default there, and the composite types copy the fetched value in anelse:The local is renamed too, since
defaultFilenameholding a fetched value is arguably what made this easy to miss.Testing
I should be straight about the limit of that: I have no OSL renderer available, so the runtime behaviour is not executed here. The case rests on
getattribute's documented contract and on matching ten siblings in the same directory. If you would rather see a render-side check before merging, say so and I will find a way to run one.