Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slider Widget for Float Plugs #5415

Open
jedypod opened this issue Aug 7, 2023 · 2 comments
Open

Slider Widget for Float Plugs #5415

jedypod opened this issue Aug 7, 2023 · 2 comments

Comments

@jedypod
Copy link

jedypod commented Aug 7, 2023

Summary

I would like to propose adding a slider widget for float plugs. This would add another way for users to interact with float controllers which would be more intuitive and better suited for many use-cases. I see that you have a collection of UI Quality of Life tickets going, so I thought it might be a good time to chirp up about this one.

User story

In Gaffer, float plugs have only a limited set of widgets, or ways that the plug is presented to the user. The most commonly used one is "Default" which shows only the numeric entry.

gaffer-floatPlug_widgets2.mp4

There are a couple of very nice UI features which make this very functional and efficient in many cases: the ability to Ctrl or Ctrl+Shift drag on the number to change the value, and the ability to use the keyboard up and down arrows with one of the numbers selected to change the value.

Coming from other software, one thing that I've been missing when building tools in Gaffer is the ability to have a slider ui element to interact with float controllers. Sliders are intuitive for many use-cases because they have a built-in range. Often when presenting controls to a user it is advantageous to present to the user a default range that the control is meant to be operated within. Two simple examples out of many I can think of:

  1. A "mix" control for dissolving the output of a node back to the input. The valid range for this controller is 0-1. With the current UI options, there is no easy way to present this range to the user. It is very easy to accidentally set the mix value to -1 or 5, which would yield broken results. And accurately adjusting the value within the proper range is tricky for the user.
  2. A "rotation" control, where the the controller range should be between 0 and 360 degrees. With the current UI options, it's difficult to adjust this: With a Ctrl+Drag, the control doesn't move enough, with Ctrl+Shift+Drag it's very easy to accidentally rotate 1000 degrees. Of course one could use the up/down arrows with numbers selected, but it is fiddly.
gaffer-floatPlug_ui_not_ideal2.mp4

I think with another widget option for float plugs both of the above use-cases would be much more intuitive and easy to understand for users.

Side-Note: I believe there might be a way to lock the valid range of a FloatPlug through the python API, but I was not able to figure out how to do this in the UI, and I wasn't even able to figure out how to do it creating plugs through the python API... It might be useful to expose this control as an option in the UI editor as well, even if my idea for slider widgets gets shot down.

In Gaffer there are a couple of places where there are already the slider UI interaction paradigm: as "sub-plugs" on color plugs, and on the spline editor.

gaffer-floatPlug_slider_ui2.mp4

In the design for the float slider, (assuming we get that far), it would be great to have options for adding tick marks (kindof like what exists in the spline plug editor), as well as for distribution of values over the range. For example it might be useful to have a linear 0-1 slider for the mix example above, and it might be useful to have a log range for other types of adjustments.

In summary: I don't think that adding a slider widget for float plugs is strictly necessary. I don't think there's anything we can't do without access to this UI option. However I do think that having it would significantly improve our options for building intuitive tools for users.

Thanks for considering it!

@johnhaddon
Copy link
Member

Hi Jed!

I have to confess to being a bit slider-averse as a general rule, because I think they use too much screen real estate to be deployed everywhere. I can't argue that in your mix case, they wouldn't be a nice way of interacting, or that they wouldn't also give a pleasing visual reading-at-a-glance compared to a numeric field. But there are loads of numeric fields in Gaffer that might benefit similarly, many of them packed into vectors presented three-in-a-row, or into horizontal toolbars, and sliders don't play well there spacewise. That's why I added the virtual sliders in the first place - they can be used anywhere without using any additional real estate.

I think it's worth noting that the virtual sliders could be improved considerably if we had the same information we'd require to do non-virtual sliders - a range and linear/exponential options. So I would hate to add sliders but leave virtual sliders unimproved, and I'd like to think that improved virtual sliders might even go a long way to reducing the need for non-virtual ones. I think there's quite a bit of scope here - it might be really nice if engaging the virtual slider popped up a floating slider widget to give better visual feedback for instance. This would fit pretty well with a development philosophy of having as minimal a number of features as possible, but having them each be as widely applicable as possible.

All that said, it would be absurd for me to argue that we don't have room for a slider in a bunch of cases :

image

So I do think it'd be reasonable to add sliders as long as its done in conjunction with big improvements to virtual sliders so that widgets without the real-estate available don't become impoverished second-class citizens. Maybe the virtual slider should literally be a pop-up non-virtual slider even?

When it comes to specifying a range, there would be two ways of doing it. NumericPlugs already have a hard min/max constraint which is specified at creation time and is impossible to break even via the API. Allowing that to be specified in the UI Editor would be a useful feature in its own right anyway, but needs a bit of thought because currently min/max can't be changed after plug construction - issue #739 covers this, and should be tackled in its own right. But specifically for sliders it might also be useful to have soft min/max that define a useful range without precluding out-of-range values. We'd probably do that with metadata, and it wouldn't be worth doing without putting the work into improved sliders, be they virtual or non-virtual.

@jedypod
Copy link
Author

jedypod commented Aug 9, 2023

Hey John! Thanks for the reply.

I do think that there's a place for both a graphical slider and numeric field widgets for float plugs, depending on the usage. I am definitely not proposing that we replace all numeric fields with a graphical slider.. I agree with you that would be a total mess for those cases like vector plugs.

I agree it would be great to add hard/soft range limit and control over the value range (linear/log/some function) to float plugs from the UI editor. The virtual slider behavior would definitely benefit from this. From my two examples above, I think it would be a big improvement to be able to hard-limit the range from 0-1 for the mix slider, and setting the a soft range of 0-360 for the rotation might make the ctrl+drag behavior more intuitive if the same drag amount moved the values quicker.

Options for both hard and soft range limits would be good I think. Another example I can think of: For an exposure tool, you might want the default range to be -4 to +4 stops since this is the most common range you might need to adjust within. But there may be those certain shots where you need to expose down 6 stops. With a soft range limit, this would still be possible.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants