OSL mx_geompropvalue_filename never returns the geomprop value

Open Beginner friendly
#3,003 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
85/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active

Research direction

Open libraries/stdlib/genosl/mx_geompropvalue_filename.osl and inspect the getattribute condition in mx_geompropvalue_filename. Verify the success and failure paths, then correct the condition so the geomprop filename replaces the default only when the attribute is found; done means the found value is returned and the default remains otherwise.

Written by the indexing model from the issue text.

Description

https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/libraries/stdlib/genosl/mx_geompropvalue_filename.osl

I'm no OSL expoert, but it appears as though the found geomprop is only assigned when it is not found, i.e. it's never assigned:

void mx_geompropvalue_filename(string geomprop, textureresource defaultVal, output textureresource out)
{
    // Initialize to the default
    out = defaultVal;

    // Replace the filename component from the geomprop
    string defaultFilename = defaultVal.filename;
    if (getattribute(geomprop, defaultFilename) == 0)   // <--- this should be == 1 I think?
        out.filename = defaultFilename;
}
Dominant language
C++
Stars
2.3k
Forks
464
Avg merge
4d 13h
Merged PRs (30d)
13

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from AcademySoftwareFoundation/MaterialX

All issues in AcademySoftwareFoundation/MaterialX

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.