Skip to content

Updates to Web Viewer to allow values outside of 'uisoftmin' and 'uisoftmax'#2930

Open
paytonGilbertson wants to merge 9 commits into
AcademySoftwareFoundation:mainfrom
paytonGilbertson:dev_color4_hsv
Open

Updates to Web Viewer to allow values outside of 'uisoftmin' and 'uisoftmax'#2930
paytonGilbertson wants to merge 9 commits into
AcademySoftwareFoundation:mainfrom
paytonGilbertson:dev_color4_hsv

Conversation

@paytonGilbertson

Copy link
Copy Markdown
Contributor

(#1817) Allow for users to manually input values outside of the soft min and soft max in the web viewer

Changes made in

  • viewer.js

paytonGilbertson and others added 5 commits May 14, 2026 11:37
`mx_rgbtohsv` and `xm_hsvtorgb` had hardcoded output alpha set to `1.0`. The alpha channel should forward the preexisting alpha value `_in.a` unchanged.
Signed-off-by: Payton Gilbertson <pgilbertson@ilm.com>
@jstone-lucasfilm

Copy link
Copy Markdown
Member

This looks very promising, thanks @paytonGilbertson!

As it turns out, we introduced a subtle bug in the MaterialX Web Viewer yesterday, and I've written up a proposed fix at #2931.

Since your work depends on the correct functioning of the Web Viewer, I'd like to review and merge the fix above before reviewing your improvement, so that your work can be tested in the full context of the working viewer.

@kwokcb kwokcb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to keep track of a soft and hard min/max as if there is a soft min/max but no hard min/max it will compute a different step size with this change.

@jstone-lucasfilm

Copy link
Copy Markdown
Member

@paytonGilbertson In addition to Bernard's review note above, which sounds logical to me, I'll just mention that #2931 has now been merged to main, and you can merge from main to your PR if you'd like to test with the full range of material examples.

if (nodeDefInput.hasAttribute('uistep'))
step = nodeDefInput.getAttribute('uistep').split(',').map(Number);
}
for (let i = 0; i < 4; ++i)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for being nit-picky + lack of clarity and in the previous comment. Step is computed based on both hard / soft min / max. So to preserve previous logic soft min / max still needs to be stored somewhere and used here. Maybe just keep a stepMinValue and stepMaxValue ?

@jstone-lucasfilm

Copy link
Copy Markdown
Member

Thanks for diving into this issue, @paytonGilbertson, as well as to @kwokcb for the great feedback.

Taking a step back to the original goals of #1817, we're hoping to allow users to type values beyond the soft range in the Property Editor, not to widen the range of the slider itself. In MaterialX terms, uisoftmin and uisoftmax are meant to describe the range of UI sliders, while uimin and uimax are the hard limits the application should enforce. So the ideal behavior is:

  • Slider range and step: continue to drive these using the soft min/max (with the existing fallback to hard min/max when not present).
  • Typed input: clamp only to the hard min/max, and allow unbounded entry when no hard limit is defined.

The subtlety is that lil-gui's folder.add(obj, 'value', min, max, step) uses a single min/max pair for both the slider geometry and the input clamp. So the cleanest path forward is:

  1. Restore the soft min/max logic for minValue/maxValue/step (this also fixes the common case of inputs that define soft limits but no hard limits).
  2. Read the hard uimin / uimax into separate variables (defaulting to negative/positive infinity when absent).
  3. After creating each controller, adjust only the controller's input clamp to the hard range, leaving the slider geometry untouched.

Does that sound like a reasonable approach to you both?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants