Retire the 'Brightness/Contrast Classic' node with the 'Brightness/Contrast' classic toggle now shader compatible (#4538)

This commit is contained in:
Keavon Chambers
2026-09-15 18:29:55 -07:00
committed by GitHub
parent fac555ab3b
commit 6f06f030d6
5 changed files with 229 additions and 281 deletions

View File

@@ -1329,9 +1329,8 @@ pub(crate) fn brightness_contrast_properties(node_id: NodeId, context: &mut Node
let use_classic_value = get_document_node(node_id, context)
.ok()
.and_then(|document_node| document_node.input(UseClassicInput).and_then(|input| input.as_value()))
.and_then(|tagged| if let TaggedValue::Bool(value) = tagged { Some(*value) } else { None });
let includes_use_classic = use_classic_value.is_some();
let use_classic_value = use_classic_value.unwrap_or(false);
.and_then(|tagged| if let TaggedValue::Bool(value) = tagged { Some(*value) } else { None })
.unwrap_or(false);
let brightness_min = if use_classic_value { -100. } else { -150. };
let brightness_max = if use_classic_value { 100. } else { 150. };
@@ -1364,11 +1363,12 @@ pub(crate) fn brightness_contrast_properties(node_id: NodeId, context: &mut Node
NumberInput::default().mode_increment().unit("%").min(contrast_min).max(100.),
);
let mut layout = vec![brightness, contrast];
if includes_use_classic {
// TODO: When we no longer use this function in the temporary "Brightness/Contrast Classic" node, remove this conditional pushing and just always include this
let use_classic = bool_widget(ParameterWidgetsInfo::new(node_id, UseClassicInput, true, context), CheckboxInput::default());
layout.push(LayoutGroup::row(use_classic));
let use_classic = bool_widget(ParameterWidgetsInfo::new(node_id, UseClassicInput, true, context), CheckboxInput::default());
let mut layout = vec![brightness, contrast, LayoutGroup::row(use_classic)];
if use_classic_value {
let number_input = NumberInput::default().mode_increment().min(0.).max(255.);
layout.push(spectrum_slider_row(node_id, context, ClassicPivotInput, bw_track(), Color::WHITE, 0., 255., 127., number_input));
}
layout

View File

@@ -477,12 +477,10 @@ const NODE_REPLACEMENTS: &[NodeReplacement<'static>] = &[
aliases: &[
"graphene_raster_nodes::adjustments::BrightnessContrastNode",
"graphene_core::raster::adjustments::BrightnessContrastNode",
"graphene_raster_nodes::adjustments::brightness_contrast_classic",
"graphene_raster_nodes::adjustments::BrightnessContrastClassicNode",
],
},
NodeReplacement {
node: graphene_std::raster_nodes::adjustments::brightness_contrast_classic::IDENTIFIER,
aliases: &["graphene_raster_nodes::adjustments::BrightnessContrastClassicNode"],
},
NodeReplacement {
node: graphene_std::raster_nodes::adjustments::channel_mixer::IDENTIFIER,
aliases: &[
@@ -2207,6 +2205,31 @@ fn migrate_node(node_id: &NodeId, node: &DocumentNode, network_path: &[NodeId],
inputs_count = 3;
}
// The removed "Brightness/Contrast Classic" node had no Use Classic input, so its three inputs become the unified node with the toggle on
if reference == DefinitionIdentifier::ProtoNode(graphene_std::raster::brightness_contrast::IDENTIFIER) && inputs_count == 3 {
let mut node_template = resolve_document_node_type(&reference)?.default_node_template();
document.network_interface.replace_implementation(node_id, network_path, &mut node_template);
let old_inputs = document.network_interface.replace_inputs(node_id, network_path, &mut node_template)?;
for (index, input) in old_inputs.iter().take(3).enumerate() {
document.network_interface.set_input(&InputConnector::node_at_index(*node_id, index), input.clone(), network_path);
}
document
.network_interface
.set_input(&InputConnector::node_at_index(*node_id, 3), NodeInput::value(TaggedValue::Bool(true), false), network_path);
inputs_count = 4;
}
// Brightness/Contrast gained the classic algorithm's pivot, whose default of 127 matches what PSD adjustment layers store
if reference == DefinitionIdentifier::ProtoNode(graphene_std::raster::brightness_contrast::IDENTIFIER) && inputs_count == 4 {
let mut node_template = resolve_document_node_type(&reference)?.default_node_template();
document.network_interface.replace_implementation(node_id, network_path, &mut node_template);
let old_inputs = document.network_interface.replace_inputs(node_id, network_path, &mut node_template)?;
for (index, input) in old_inputs.iter().take(4).enumerate() {
document.network_interface.set_input(&InputConnector::node_at_index(*node_id, index), input.clone(), network_path);
}
inputs_count = 5;
}
// Levels' Midtones became the gamma value it encoded, and each channel gained its own record after the composite one
if reference == DefinitionIdentifier::ProtoNode(graphene_std::raster::levels::IDENTIFIER) && inputs_count == 6 {
let mut node_template = resolve_document_node_type(&reference)?.default_node_template();