Skip to content

Commit dff8ac5

Browse files
authored
Remove code for the deprecated and unused Curve type (#4127)
* Remove the unused Curve type * Fix frontend
1 parent 0834bff commit dff8ac5

10 files changed

Lines changed: 47 additions & 91 deletions

File tree

editor/src/messages/layout/layout_message_handler.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -204,21 +204,6 @@ impl LayoutMessageHandler {
204204

205205
responses.add(callback_message);
206206
}
207-
Widget::CurveInput(curve_input) => {
208-
let callback_message = match action {
209-
WidgetValueAction::Commit => (curve_input.on_commit.callback)(&()),
210-
WidgetValueAction::Update => {
211-
let Some(curve) = serde_json::from_value(value).ok() else {
212-
error!("CurveInput event data could not be deserialized");
213-
return;
214-
};
215-
curve_input.value = curve;
216-
(curve_input.on_update.callback)(curve_input)
217-
}
218-
};
219-
220-
responses.add(callback_message);
221-
}
222207
Widget::DropdownInput(dropdown_input) => {
223208
let callback_message = match action {
224209
WidgetValueAction::Commit => {

editor/src/messages/layout/utility_types/layout_widget.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,6 @@ impl LayoutGroup {
428428
let val = match &mut *widget.widget {
429429
Widget::CheckboxInput(x) => &mut x.tooltip_description,
430430
Widget::ColorInput(x) => &mut x.tooltip_description,
431-
Widget::CurveInput(x) => &mut x.tooltip_description,
432431
Widget::DropdownInput(x) => &mut x.tooltip_description,
433432
Widget::IconButton(x) => &mut x.tooltip_description,
434433
Widget::IconLabel(x) => &mut x.tooltip_description,
@@ -769,7 +768,6 @@ pub enum Widget {
769768
ColorComparisonInput(ColorComparisonInput),
770769
ColorInput(ColorInput),
771770
ColorPresetsInput(ColorPresetsInput),
772-
CurveInput(CurveInput),
773771
DropdownInput(DropdownInput),
774772
IconButton(IconButton),
775773
IconLabel(IconLabel),
@@ -838,7 +836,6 @@ impl DiffUpdate {
838836
Widget::ShortcutLabel(widget) => widget.shortcut.as_mut(),
839837
Widget::IconLabel(_)
840838
| Widget::ImageLabel(_)
841-
| Widget::CurveInput(_)
842839
| Widget::NodeCatalog(_)
843840
| Widget::ReferencePointInput(_)
844841
| Widget::RadioInput(_)

editor/src/messages/layout/utility_types/widgets/input_widgets.rs

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use crate::messages::layout::utility_types::widget_prelude::*;
44
use crate::messages::portfolio::document::node_graph::document_node_definitions::DefinitionIdentifier;
55
use derivative::*;
66
use graphene_std::Color;
7-
use graphene_std::raster::curve::Curve;
87
use graphene_std::transform::ReferencePoint;
98
use graphene_std::vector::style::{FillChoice, GradientStops};
109
use graphite_proc_macros::WidgetBuilder;
@@ -420,30 +419,30 @@ pub struct TextInput {
420419
pub on_commit: WidgetCallback<()>,
421420
}
422421

423-
#[cfg_attr(feature = "wasm", derive(tsify::Tsify))]
424-
#[derive(Clone, serde::Serialize, serde::Deserialize, Derivative, WidgetBuilder)]
425-
#[derivative(Debug, PartialEq, Default)]
426-
pub struct CurveInput {
427-
// Content
428-
#[widget_builder(constructor)]
429-
pub value: Curve,
430-
431-
// Tooltips
432-
#[serde(rename = "tooltipLabel")]
433-
pub tooltip_label: String,
434-
#[serde(rename = "tooltipDescription")]
435-
pub tooltip_description: String,
436-
#[serde(rename = "tooltipShortcut")]
437-
pub tooltip_shortcut: Option<ActionShortcut>,
438-
439-
// Callbacks
440-
#[serde(skip)]
441-
#[derivative(Debug = "ignore", PartialEq = "ignore")]
442-
pub on_update: WidgetCallback<CurveInput>,
443-
#[serde(skip)]
444-
#[derivative(Debug = "ignore", PartialEq = "ignore")]
445-
pub on_commit: WidgetCallback<()>,
446-
}
422+
// #[cfg_attr(feature = "wasm", derive(tsify::Tsify))]
423+
// #[derive(Clone, serde::Serialize, serde::Deserialize, Derivative, WidgetBuilder)]
424+
// #[derivative(Debug, PartialEq, Default)]
425+
// pub struct CurveInput {
426+
// // Content
427+
// #[widget_builder(constructor)]
428+
// pub value: Curve,
429+
430+
// // Tooltips
431+
// #[serde(rename = "tooltipLabel")]
432+
// pub tooltip_label: String,
433+
// #[serde(rename = "tooltipDescription")]
434+
// pub tooltip_description: String,
435+
// #[serde(rename = "tooltipShortcut")]
436+
// pub tooltip_shortcut: Option<ActionShortcut>,
437+
438+
// // Callbacks
439+
// #[serde(skip)]
440+
// #[derivative(Debug = "ignore", PartialEq = "ignore")]
441+
// pub on_update: WidgetCallback<CurveInput>,
442+
// #[serde(skip)]
443+
// #[derivative(Debug = "ignore", PartialEq = "ignore")]
444+
// pub on_commit: WidgetCallback<()>,
445+
// }
447446

448447
#[cfg_attr(feature = "wasm", derive(tsify::Tsify))]
449448
#[derive(Clone, Default, Derivative, serde::Serialize, serde::Deserialize, WidgetBuilder)]

editor/src/messages/portfolio/document/node_graph/node_properties.rs

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ use graphene_std::ATTR_TRANSFORM;
1919
use graphene_std::NodeInputDecleration;
2020
use graphene_std::animation::RealTimeMode;
2121
use graphene_std::extract_xy::XY;
22-
use graphene_std::raster::curve::Curve;
2322
use graphene_std::raster::{
2423
BlendMode, CellularDistanceFunction, CellularReturnType, Color, DomainWarpType, FractalType, LuminanceCalculation, NoiseType, RedGreenBlue, RedGreenBlueAlpha, RelativeAbsolute,
2524
SelectiveColorChoice,
@@ -223,7 +222,6 @@ pub(crate) fn property_from_type(
223222
// STRUCT TYPES
224223
// ============
225224
Some(x) if x == TypeId::of::<Font>() => font_widget(default_info),
226-
Some(x) if x == TypeId::of::<Curve>() => curve_widget(default_info),
227225
Some(x) if x == TypeId::of::<Footprint>() => footprint_widget(default_info, &mut extra_widgets),
228226
Some(x) if x == TypeId::of::<Box<VectorModification>>() => vector_modification_widget(default_info).into(),
229227
Some(x) if x == TypeId::of::<Image<Color>>() => image_data_widget(default_info).into(),
@@ -1198,27 +1196,27 @@ pub fn font_widget(parameter_widgets_info: ParameterWidgetsInfo) -> LayoutGroup
11981196
font_widgets.into_iter().chain(style_widgets.unwrap_or_default()).collect::<Vec<_>>().into()
11991197
}
12001198

1201-
pub fn curve_widget(parameter_widgets_info: ParameterWidgetsInfo) -> LayoutGroup {
1202-
let ParameterWidgetsInfo { document_node, node_id, index, .. } = parameter_widgets_info;
1203-
1204-
let mut widgets = start_widgets(parameter_widgets_info);
1205-
1206-
let Some(document_node) = document_node else { return LayoutGroup::default() };
1207-
let Some(input) = document_node.inputs.get(index) else {
1208-
log::warn!("A widget failed to be built because its node's input index is invalid.");
1209-
return LayoutGroup::row(vec![]);
1210-
};
1211-
if let Some(TaggedValue::Curve(curve)) = &input.as_non_exposed_value() {
1212-
widgets.extend_from_slice(&[
1213-
Separator::new(SeparatorStyle::Unrelated).widget_instance(),
1214-
CurveInput::new(curve.clone())
1215-
.on_update(update_value(|x: &CurveInput| TaggedValue::Curve(x.value.clone()), node_id, index))
1216-
.on_commit(commit_value)
1217-
.widget_instance(),
1218-
])
1219-
}
1220-
LayoutGroup::row(widgets)
1221-
}
1199+
// pub fn curve_widget(parameter_widgets_info: ParameterWidgetsInfo) -> LayoutGroup {
1200+
// let ParameterWidgetsInfo { document_node, node_id, index, .. } = parameter_widgets_info;
1201+
1202+
// let mut widgets = start_widgets(parameter_widgets_info);
1203+
1204+
// let Some(document_node) = document_node else { return LayoutGroup::default() };
1205+
// let Some(input) = document_node.inputs.get(index) else {
1206+
// log::warn!("A widget failed to be built because its node's input index is invalid.");
1207+
// return LayoutGroup::row(vec![]);
1208+
// };
1209+
// if let Some(TaggedValue::Curve(curve)) = &input.as_non_exposed_value() {
1210+
// widgets.extend_from_slice(&[
1211+
// Separator::new(SeparatorStyle::Unrelated).widget_instance(),
1212+
// CurveInput::new(curve.clone())
1213+
// .on_update(update_value(|x: &CurveInput| TaggedValue::Curve(x.value.clone()), node_id, index))
1214+
// .on_commit(commit_value)
1215+
// .widget_instance(),
1216+
// ])
1217+
// }
1218+
// LayoutGroup::row(widgets)
1219+
// }
12221220

12231221
pub fn get_document_node<'a>(node_id: NodeId, context: &'a NodePropertiesContext<'a>) -> Result<&'a DocumentNode, String> {
12241222
let network = context

editor/src/messages/portfolio/document_migration.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -520,10 +520,6 @@ const NODE_REPLACEMENTS: &[NodeReplacement<'static>] = &[
520520
node: graphene_std::raster_nodes::adjustments::gamma_correction::IDENTIFIER,
521521
aliases: &["graphene_raster_nodes::adjustments::GammaCorrectionNode", "graphene_core::raster::adjustments::GammaCorrectionNode"],
522522
},
523-
NodeReplacement {
524-
node: graphene_std::raster_nodes::generate_curves::generate_curves::IDENTIFIER,
525-
aliases: &["graphene_raster_nodes::generate_curves::GenerateCurvesNode", "graphene_core::raster::adjustments::GenerateCurvesNode"],
526-
},
527523
NodeReplacement {
528524
node: graphene_std::raster_nodes::gradient_map::gradient_map::IDENTIFIER,
529525
aliases: &[

frontend/src/components/widgets/WidgetSpan.svelte

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import ColorComparisonInput from "/src/components/widgets/inputs/ColorComparisonInput.svelte";
1212
import ColorInput from "/src/components/widgets/inputs/ColorInput.svelte";
1313
import ColorPresetsInput from "/src/components/widgets/inputs/ColorPresetsInput.svelte";
14-
import CurveInput from "/src/components/widgets/inputs/CurveInput.svelte";
1514
import DropdownInput from "/src/components/widgets/inputs/DropdownInput.svelte";
1615
import NumberInput from "/src/components/widgets/inputs/NumberInput.svelte";
1716
import RadioInput from "/src/components/widgets/inputs/RadioInput.svelte";
@@ -153,16 +152,6 @@
153152
},
154153
}),
155154
},
156-
CurveInput: {
157-
// TODO: CurvesInput is currently unused
158-
component: CurveInput,
159-
getProps: (props, index) => ({
160-
...props,
161-
$$events: {
162-
value: (e: CustomEvent) => widgetValueCommitAndUpdate(index, e.detail, false),
163-
},
164-
}),
165-
},
166155
DropdownInput: {
167156
component: DropdownInput,
168157
getProps: (props, index) => ({

frontend/src/components/widgets/inputs/CurveInput.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<script lang="ts">
1+
<!-- <script lang="ts">
22
import { createEventDispatcher } from "svelte";
33
import LayoutRow from "/src/components/layout/LayoutRow.svelte";
44
import type { Curve, CurveManipulatorGroup, ActionShortcut } from "/wrapper/pkg/graphite_wasm_wrapper";
@@ -256,4 +256,4 @@
256256
pointer-events: none;
257257
}
258258
}
259-
</style>
259+
</style> -->

node-graph/graph-craft/src/document/value.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use graphic_types::raster_types::{CPU, Image, Raster};
1414
use graphic_types::vector_types::vector::style::{Fill, Gradient, GradientStops, Stroke};
1515
use graphic_types::vector_types::vector::{self, ReferencePoint};
1616
use graphic_types::{Artboard, Graphic, Vector};
17-
use raster_nodes::curve::Curve;
1817
use rendering::RenderMetadata;
1918
use std::fmt::Display;
2019
use std::hash::Hash;
@@ -212,7 +211,6 @@ tagged_value! {
212211
Font(Font),
213212
DocumentNode(DocumentNode),
214213
ContextFeatures(ContextFeatures),
215-
Curve(Curve),
216214
Footprint(Footprint),
217215
VectorModification(Box<VectorModification>),
218216
ImageData(Image<Color>),

node-graph/interpreted-executor/src/node_registry.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ fn node_registry() -> HashMap<ProtoNodeIdentifier, HashMap<NodeIOTypes, NodeCons
158158
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => graphene_std::text::Font]),
159159
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => Table<BrushStroke>]),
160160
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => DocumentNode]),
161-
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => graphene_std::raster::curve::Curve]),
162161
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => graphene_std::transform::Footprint]),
163162
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => graphene_std::blending::BlendMode]),
164163
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => graphene_std::raster::adjustments::LuminanceCalculation]),
@@ -246,7 +245,6 @@ fn node_registry() -> HashMap<ProtoNodeIdentifier, HashMap<NodeIOTypes, NodeCons
246245
async_node!(graphene_core::memo::MemoizeNode<_, _>, input: Context, fn_params: [Context => Table<BrushStroke>]),
247246
async_node!(graphene_core::memo::MemoizeNode<_, _>, input: Context, fn_params: [Context => DocumentNode]),
248247
async_node!(graphene_core::memo::MemoizeNode<_, _>, input: Context, fn_params: [Context => graphene_std::ContextFeatures]),
249-
async_node!(graphene_core::memo::MemoizeNode<_, _>, input: Context, fn_params: [Context => graphene_std::raster::curve::Curve]),
250248
async_node!(graphene_core::memo::MemoizeNode<_, _>, input: Context, fn_params: [Context => graphene_std::transform::Footprint]),
251249
async_node!(graphene_core::memo::MemoizeNode<_, _>, input: Context, fn_params: [Context => Box<graphene_std::vector::VectorModification>]),
252250
async_node!(graphene_core::memo::MemoizeNode<_, _>, input: Context, fn_params: [Context => graphene_std::vector::style::Fill]),

node-graph/nodes/raster/src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,11 @@ pub mod fullscreen_vertex;
1010
#[cfg(feature = "shader-nodes")]
1111
pub use raster_nodes_shaders::WGSL_SHADER;
1212

13-
#[cfg(feature = "std")]
14-
pub mod curve;
1513
#[cfg(feature = "std")]
1614
pub mod dehaze;
1715
#[cfg(feature = "std")]
1816
pub mod filter;
1917
#[cfg(feature = "std")]
20-
pub mod generate_curves;
21-
#[cfg(feature = "std")]
2218
pub mod gradient_map;
2319
#[cfg(feature = "std")]
2420
pub mod image_color_palette;

0 commit comments

Comments
 (0)