Clean up imports and warnings in Rust code

This commit is contained in:
Keavon Chambers
2023-01-13 12:45:14 -08:00
parent b030a1860b
commit bf1a3e3daf
15 changed files with 204 additions and 191 deletions
@@ -1,8 +1,10 @@
use crate::messages::input_mapper::utility_types::misc::ActionKeys;
use crate::messages::layout::utility_types::layout_widget::WidgetCallback;
use crate::messages::{input_mapper::utility_types::misc::ActionKeys, portfolio::document::node_graph::FrontendGraphDataType};
use crate::messages::portfolio::document::node_graph::FrontendGraphDataType;
use graphite_proc_macros::WidgetBuilder;
use derivative::*;
use graphite_proc_macros::WidgetBuilder;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Derivative, Serialize, Deserialize, WidgetBuilder)]
@@ -1,7 +1,9 @@
use crate::messages::input_mapper::utility_types::misc::ActionKeys;
use crate::messages::layout::utility_types::layout_widget::WidgetCallback;
use document_legacy::{color::Color, layers::layer_info::LayerDataTypeDiscriminant, LayerId};
use document_legacy::color::Color;
use document_legacy::layers::layer_info::LayerDataTypeDiscriminant;
use document_legacy::LayerId;
use graphite_proc_macros::WidgetBuilder;
use derivative::*;
@@ -62,23 +62,23 @@ fn start_widgets(document_node: &DocumentNode, node_id: NodeId, index: usize, na
widgets
}
fn text_widget(document_node: &DocumentNode, node_id: NodeId, index: usize, name: &str, blank_assist: bool) -> Vec<WidgetHolder> {
let mut widgets = start_widgets(document_node, node_id, index, name, FrontendGraphDataType::Text, blank_assist);
// fn text_widget(document_node: &DocumentNode, node_id: NodeId, index: usize, name: &str, blank_assist: bool) -> Vec<WidgetHolder> {
// let mut widgets = start_widgets(document_node, node_id, index, name, FrontendGraphDataType::Text, blank_assist);
if let NodeInput::Value {
tagged_value: TaggedValue::String(x),
exposed: false,
} = &document_node.inputs[index]
{
widgets.extend_from_slice(&[
WidgetHolder::unrelated_separator(),
TextInput::new(x.clone())
.on_update(update_value(|x: &TextInput| TaggedValue::String(x.value.clone()), node_id, index))
.widget_holder(),
])
}
widgets
}
// if let NodeInput::Value {
// tagged_value: TaggedValue::String(x),
// exposed: false,
// } = &document_node.inputs[index]
// {
// widgets.extend_from_slice(&[
// WidgetHolder::unrelated_separator(),
// TextInput::new(x.clone())
// .on_update(update_value(|x: &TextInput| TaggedValue::String(x.value.clone()), node_id, index))
// .widget_holder(),
// ])
// }
// widgets
// }
fn text_area_widget(document_node: &DocumentNode, node_id: NodeId, index: usize, name: &str, blank_assist: bool) -> Vec<WidgetHolder> {
let mut widgets = start_widgets(document_node, node_id, index, name, FrontendGraphDataType::Text, blank_assist);
@@ -139,6 +139,7 @@ impl Fsm for NodeGraphToolFsmState {
responses.push_back(DocumentMessage::DeselectAllLayers.into());
use graph_craft::{document::*, generic, proto::*};
let network = NodeNetwork {
inputs: vec![0],
output: 1,