Repository navigation
Levels: histogram editor with range handles - #37
Open
RafaelMendes1407 wants to merge 2 commits into
Open
RafaelMendes1407 wants to merge 2 commits into
RafaelMendes1407 wants to merge 2 commits into
Conversation
Selecting a Levels node now shows a visual editor above its sliders: a histogram of the node's input (256 bins; red, green and blue overlaid for a color input; scaled to the tallest bin between pure black and white) with the clipped ranges shaded and the levels transfer curve on top, draggable input low/mid/high handles under it and output low/high handles under a black-to-white bar. Fixes in how Levels is edited: Level in mid is relative to the input range, and its handle now sits where it acts and moves with the range; the input low and high handles cannot cross. Parameters bound to inputs or driven by functions keep their handles locked. Every drag is a graph.node.param command, one undo step per handle. levels_fn no longer propagates NaN. Tests cover the histogram, the handle constraints and the remap math; the snapshots UI test renders the editor. Documented in docs/levels-editor.md. Clean-room implementation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Move the Levels screenshot's ATTRIBUTION row, the README mention, the architecture note and the snapshot scene to places #36 does not touch, so the two pull requests merge in either order without conflicts. No change in behavior; the snapshot scene now runs last. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
|
Moved this PR's edits to ATTRIBUTION.md, README.md, docs/architecture.md and the snapshot test away from the lines #36 changes. Both PRs now merge into 🤖 Generated with Claude Code |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Selecting a Levels node now shows a visual editor above its sliders in the properties panel: a histogram of the node's input with the levels transfer curve on top, plus draggable handles for every parameter. It also fixes two long-standing problems with editing Levels. Clean-room implementation, independent of #36.
Documentation:
docs/levels-editor.md.What the editor shows
Fixes
in low + in mid × (in high − in low), moves with the range, and stays strictly inside it.levels_fnno longer passes a NaN on (from an input or a hostile parameter); it is treated as 0.graph.node.paramstill accept any values.Behavior
graph.node.param, so a drag is one undo step per handle, and agents and scripts use the same command.Changes
crates/ui-egui/src/levels_editor.rs(new):histogram,values,mid_position,drag_value(the handle constraints).crates/ui-egui/src/properties.rs: shows the editor forlevelsnodes.crates/nodes/src/atomic.rs: the NaN guard inlevels_fn, plus unit tests.crates/ui-egui/tests/snapshot.rs: alevels-editorscene.docs/levels-editor.md.architecture.md,target-app-parity.mdand the README status.ATTRIBUTION.mdrow. It is an offscreen render of MaterialCraft's own procedural content.Tests
levels_editor::tests:atomic::levels_tests:snapshotsUI test renders the screenshot above, checked visually.Checks
cargo fmt --allcargo test --releasefor nodes, engine (includingpanic_hunt) and ui-eguicargo xtask layerscargo clippy --workspace --all-targets -- -D warningsis clean for this change. On Rust 1.99 it still fails onmainbecause of the newclippy::chunks_exact_to_as_chunkslint incrates/nodes/src/filters_extra.rsandtext.rs, which this PR does not touch.cargo xtask wasm: not run locally because thewasm32-unknown-unknowntarget is not installed; left to CI. The new code has no platform-specific parts.Still open: per-channel levels (RGBA separately) and an optional output histogram.
🤖 Generated with Claude Code