AcademySoftwareFoundation / AcademySoftwareFoundation/MaterialX
Setting an element's colorspace attribute to empty string has unexpected behavior
- Dominant language
- C++
- Stars
- 2.3k
- Forks
- 451
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 8
Description
This concerns MaterialXCore/Element.h:
Currently, when querying getActiveColorSpace, the code goes through the element's parents and calls hasColorSpace() on them.
An empty string set anywhere in the hierarchy is interpreted as having a color space and prevents further traversal.
This leads to the situation where getting the color space of an element with no color space and setting it back to the same element changes behavior.
There is also no removeColorSpace() method, so the only way to undo this is to call `removeAttribute(COLOR_SPACE_ATTRIBUTE);` directly.
Attaching a diff with a unit test that illustrates the issue.
[mx_element_test.patch](https://github.com/AcademySoftwareFoundation/MaterialX/files/15419509/mx_element_test.patch)
Contributor guide
Research direction
Start in MaterialXCore/Element.h by reading getActiveColorSpace() and the parent traversal that calls hasColorSpace(). Use the attached mx_element_test.patch to reproduce the empty-string case and verify the intended behavior, including how color-space state can be removed. Done means the regression test passes and an element can be restored to its prior color-space behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100