Return the geomprop from mx_geompropvalue_filename - #3063
Chang-Jin-Lee wants to merge 1 commit into
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)
|
|
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. |
|
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 |
|
Correcting my own comment above before you spend review time on it: there is no render test in this PR, and the job count was wrong. The diff is one file, As the description says, I have no OSL renderer here, so the behaviour is argued from The CLA is still mine to clear and I have not finished it yet. |
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.