-
Notifications
You must be signed in to change notification settings - Fork 68
Adds Slider and MinMaxSlider attributes #199
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
base: main
Are you sure you want to change the base?
Adds Slider and MinMaxSlider attributes #199
Conversation
Introduces DynamicRangeAttribute and MinMaxRangeAttribute for flexible range constraints in inspector fields. Adds corresponding drawers and sample usage, as well as a utility for drawing min-max sliders in the editor.
Error messages in DynamicRangeDrawer and MinMaxRangeDrawer now return only the specific resolver error instead of concatenated multi-type error strings. This makes error outputs more concise and focused.
Renamed MinMaxRangeAttribute to MinMaxSliderAttribute and DynamicRangeAttribute to inherit from a new SliderAttribute. Updated corresponding drawers and sample files to use the new naming. Refactored attribute implementations for consistency and simplified inheritance. Updated README and sample code to reflect these changes and improve clarity.
Hi. Thanks for your contribution! I found a few issues in PR:
|
Hi! Thank you very much for the detailed feedback, your observations were spot-on and I completely agree with the suggested changes. I will apply the fixes today. Before implementing the third point, I just wanted to ask a quick question to better align with your vision: Do you think it would be a good idea to allow optional automatic clamping, disabled by default?
Or, since this is a decorator, do you think it’s more appropriate to never modify the value directly and instead always rely on a validator/fix button approach? Thanks again! I'll wait for your opinion on this before finalizing the implementation |
Yes, the optional ability to enable automatic clamping (disabled by default) would be a great solution |
Introduces attribute validators for SliderAttribute and MinMaxSliderAttribute, refactors drawer logic to use shared helpers, and adds auto-clamp support. Removes DynamicRangeAttribute in favor of unified SliderAttribute usage. Updates sample scripts and improves type handling and error reporting for slider decorators.
Updated slider and dynamic range examples in README.md with new values and added clamped sliders.
This pull request introduces two new attributes,
Slider
orDynamicRange
andMinMaxSlider
, providing dynamic slider controls in the inspector. This contribution directly addresses a feature request from Discussion #65.Changes:
SliderAttribute
and its corresponding drawer class.MinMaxSliderAttribute
and its corresponding drawer class.Decorators_SliderSampleOrDynamicRangeSample
ScriptableObject to demonstrate usage.Decorators_MinMaxSliderSample
ScriptableObject to demonstrate usage.TriSamplesWindow
GetTypeNiceName(Type type)
to support more than one name:Slider/DynamicRange
separated bySampleOr
README.md
with examples and screenshots for both new attributes.Impact:
[Range]
attribute.Slider
/DynamicRange
provides a flexible single-value slider forint
andfloat
types.MinMaxSlider
provides an intuitive dual-handle slider forVector2
andVector2Int
types, perfect for defining ranges.Slider/DynamicRange
Note: [DynamicRange] is included as an alias for [Slider]. This is done for convention, making it easier for developers who may be accustomed to the DynamicRange name from other inspector libraries. Both attributes function identically.
MinMaxSlider
Testing:
int
,float
,double
,Vector2
, andVector2Int
fields.[GUIColor]
and[OnValueChanged]
.