Update #[min/max] node macro attributes to #[soft/hard]_[min/max] and make them clamp their input data (#2464)

* Fix min and max macro not enforcing limits when data flows

* Use trait based clamping

* Remove min/max from testing

* cargo fmt

* Resolve into min, and hard_min

* cargo fmt

* fix traits

* cargo fmt

* fix tests

* rename as soft_x

* Add validation code

* Clean up (not compiling because of DVec2 clamping)

* Avoid needing to add trait bounds to node definitions

* Code review

---------

Co-authored-by: Dennis Kobert <dennis@kobert.dev>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
mTvare
2025-04-30 23:52:27 -07:00
committed by GitHub
co-authored by Dennis Kobert Keavon Chambers
parent 2fc4896d01
commit 9303953cf8
13 changed files with 259 additions and 46 deletions
+2 -1
View File
@@ -1399,7 +1399,7 @@ async fn posterize<T: Adjust<Color>>(
)]
mut input: T,
#[default(4)]
#[min(2.)]
#[hard_min(2.)]
levels: u32,
) -> T {
input.adjust(|color| {
@@ -1435,6 +1435,7 @@ async fn exposure<T: Adjust<Color>>(
offset: f64,
#[default(1.)]
#[range((0.01, 10.))]
#[hard_min(0.0001)]
gamma_correction: f64,
) -> T {
input.adjust(|color| {