Skip to content

Commit c7488cf

Browse files
committed
Remove dead code for Imaginate
1 parent 1a4d7aa commit c7488cf

31 files changed

+12
-2018
lines changed

editor/src/application.rs

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -55,53 +55,3 @@ pub fn commit_info_localized(localized_commit_date: &str) -> String {
5555
localized_commit_date
5656
)
5757
}
58-
59-
// #[cfg(test)]
60-
// mod test {
61-
// use crate::messages::input_mapper::utility_types::input_mouse::ViewportBounds;
62-
// use crate::messages::prelude::*;
63-
64-
// // TODO: Fix and reenable
65-
// #[ignore]
66-
// #[test]
67-
// fn debug_ub() {
68-
// use super::Message;
69-
70-
// let mut editor = super::Editor::new();
71-
// let mut responses = Vec::new();
72-
73-
// let messages: Vec<Message> = vec![
74-
// Message::Init,
75-
// Message::Preferences(PreferencesMessage::Load {
76-
// preferences: r#"{ "imaginate_server_hostname": "http://localhost:7860/", "imaginate_refresh_frequency": 1, "zoom_with_scroll": false }"#.to_string(),
77-
// }),
78-
// PortfolioMessage::OpenDocumentFileWithId {
79-
// document_id: DocumentId(0),
80-
// document_name: "".into(),
81-
// document_is_auto_saved: true,
82-
// document_is_saved: true,
83-
// document_serialized_content: r#" [removed until test is reenabled] "#.into(),
84-
// to_front: false,
85-
// }
86-
// .into(),
87-
// InputPreprocessorMessage::BoundsOfViewports {
88-
// bounds_of_viewports: vec![ViewportBounds::from_slice(&[0., 0., 1920., 1080.])],
89-
// }
90-
// .into(),
91-
// ];
92-
93-
// use futures::executor::block_on;
94-
// for message in messages {
95-
// block_on(crate::node_graph_executor::run_node_graph());
96-
// let mut res = VecDeque::new();
97-
// editor.poll_node_graph_evaluation(&mut res).expect("poll_node_graph_evaluation failed");
98-
99-
// let res = editor.handle_message(message);
100-
// responses.push(res);
101-
// }
102-
// let responses = responses.pop().unwrap();
103-
// // let trigger_message = responses[responses.len() - 2].clone();
104-
105-
// println!("responses: {responses:#?}");
106-
// }
107-
// }

editor/src/messages/dialog/preferences_dialog/preferences_dialog_message_handler.rs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -204,27 +204,6 @@ impl PreferencesDialogMessageHandler {
204204
.widget_holder(),
205205
];
206206

207-
// TODO: Reenable when Imaginate is restored
208-
// let imaginate_server_hostname = vec![
209-
// TextLabel::new("Imaginate").min_width(60).italic(true).widget_holder(),
210-
// TextLabel::new("Server Hostname").table_align(true).widget_holder(),
211-
// TextInput::new(&preferences.imaginate_server_hostname)
212-
// .min_width(200)
213-
// .on_update(|text_input: &TextInput| PreferencesMessage::ImaginateServerHostname { hostname: text_input.value.clone() }.into())
214-
// .widget_holder(),
215-
// ];
216-
// let imaginate_refresh_frequency = vec![
217-
// TextLabel::new("").min_width(60).widget_holder(),
218-
// TextLabel::new("Refresh Frequency").table_align(true).widget_holder(),
219-
// NumberInput::new(Some(preferences.imaginate_refresh_frequency))
220-
// .unit(" seconds")
221-
// .min(0.)
222-
// .max((1_u64 << f64::MANTISSA_DIGITS) as f64)
223-
// .min_width(200)
224-
// .on_update(|number_input: &NumberInput| PreferencesMessage::ImaginateRefreshFrequency { seconds: number_input.value.unwrap() }.into())
225-
// .widget_holder(),
226-
// ];
227-
228207
Layout::WidgetLayout(WidgetLayout::new(vec![
229208
LayoutGroup::Row { widgets: navigation_header },
230209
LayoutGroup::Row { widgets: zoom_rate_label },
@@ -238,8 +217,6 @@ impl PreferencesDialogMessageHandler {
238217
LayoutGroup::Row { widgets: graph_wire_style },
239218
LayoutGroup::Row { widgets: use_vello },
240219
LayoutGroup::Row { widgets: vector_meshes },
241-
// LayoutGroup::Row { widgets: imaginate_server_hostname },
242-
// LayoutGroup::Row { widgets: imaginate_refresh_frequency },
243220
]))
244221
}
245222

editor/src/messages/input_mapper/input_mappings.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -206,13 +206,6 @@ pub fn input_mappings() -> Mapping {
206206
entry!(KeyDown(ArrowUp); action_dispatch=ShapeToolMessage::IncreaseSides),
207207
entry!(KeyDown(ArrowDown); action_dispatch=ShapeToolMessage::DecreaseSides),
208208
//
209-
// ImaginateToolMessage
210-
// entry!(KeyDown(MouseLeft); action_dispatch=ImaginateToolMessage::DragStart),
211-
// entry!(KeyUp(MouseLeft); action_dispatch=ImaginateToolMessage::DragStop),
212-
// entry!(KeyDown(MouseRight); action_dispatch=ImaginateToolMessage::Abort),
213-
// entry!(KeyDown(Escape); action_dispatch=ImaginateToolMessage::Abort),
214-
// entry!(PointerMove; refresh_keys=[Alt, Shift], action_dispatch=ImaginateToolMessage::Resize { center: Alt, lock_ratio: Shift }),
215-
//
216209
// PathToolMessage
217210
entry!(KeyDown(Delete); modifiers=[Accel], action_dispatch=PathToolMessage::DeleteAndBreakPath),
218211
entry!(KeyDown(Backspace); modifiers=[Accel], action_dispatch=PathToolMessage::DeleteAndBreakPath),

editor/src/messages/portfolio/document/document_message.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,6 @@ pub enum DocumentMessage {
7373
GroupSelectedLayers {
7474
group_folder_type: GroupFolderType,
7575
},
76-
// ImaginateGenerate {
77-
// imaginate_node: Vec<NodeId>,
78-
// },
79-
// ImaginateRandom {
80-
// imaginate_node: Vec<NodeId>,
81-
// then_generate: bool,
82-
// },
8376
MoveSelectedLayersTo {
8477
parent: LayerNodeIdentifier,
8578
insert_index: usize,

editor/src/messages/portfolio/document/document_message_handler.rs

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -613,37 +613,6 @@ impl MessageHandler<DocumentMessage, DocumentMessageData<'_>> for DocumentMessag
613613
responses.add(NodeGraphMessage::SelectedNodesSet { nodes: new_folders });
614614
}
615615
}
616-
// DocumentMessage::ImaginateGenerate { imaginate_node } => {
617-
// let random_value = generate_uuid();
618-
// responses.add(NodeGraphMessage::SetInputValue {
619-
// node_id: *imaginate_node.last().unwrap(),
620-
// // Needs to match the index of the seed parameter in `pub const IMAGINATE_NODE: DocumentNodeDefinition` in `document_node_type.rs`
621-
// input_index: 17,
622-
// value: graph_craft::document::value::TaggedValue::U64(random_value),
623-
// });
624-
625-
// responses.add(PortfolioMessage::SubmitGraphRender { document_id, ignore_hash: false });
626-
// }
627-
// DocumentMessage::ImaginateRandom { imaginate_node, then_generate } => {
628-
// // Generate a random seed. We only want values between -2^53 and 2^53, because integer values
629-
// // outside of this range can get rounded in f64
630-
// let random_bits = generate_uuid();
631-
// let random_value = ((random_bits >> 11) as f64).copysign(f64::from_bits(random_bits & (1 << 63)));
632-
633-
// responses.add(DocumentMessage::AddTransaction);
634-
// // Set a random seed input
635-
// responses.add(NodeGraphMessage::SetInputValue {
636-
// node_id: *imaginate_node.last().unwrap(),
637-
// // Needs to match the index of the seed parameter in `pub const IMAGINATE_NODE: DocumentNodeDefinition` in `document_node_type.rs`
638-
// input_index: 3,
639-
// value: graph_craft::document::value::TaggedValue::F64(random_value),
640-
// });
641-
642-
// // Generate the image
643-
// if then_generate {
644-
// responses.add(DocumentMessage::ImaginateGenerate { imaginate_node });
645-
// }
646-
// }
647616
DocumentMessage::MoveSelectedLayersTo { parent, insert_index } => {
648617
if !self.selection_network_path.is_empty() {
649618
log::error!("Moving selected layers is only supported for the Document Network");

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

Lines changed: 0 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,7 +1466,6 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
14661466
// description: Cow::Borrowed("TODO"),
14671467
// properties: None,
14681468
// },
1469-
// (*IMAGINATE_NODE).clone(),
14701469
DocumentNodeDefinition {
14711470
identifier: "Path",
14721471
category: "Vector",
@@ -2119,128 +2118,6 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
21192118
document_node_derive::post_process_nodes(custom)
21202119
}
21212120

2122-
// pub static IMAGINATE_NODE: Lazy<DocumentNodeDefinition> = Lazy::new(|| DocumentNodeDefinition {
2123-
// identifier: "Imaginate",
2124-
// category: "Raster",
2125-
// node_template: NodeTemplate {
2126-
// document_node: DocumentNode {
2127-
// implementation: DocumentNodeImplementation::Network(NodeNetwork {
2128-
// exports: vec![NodeInput::node(NodeId(1), 0)],
2129-
// nodes: [
2130-
// DocumentNode {
2131-
// inputs: vec![NodeInput::network(concrete!(RasterDataTable<CPU>), 0)],
2132-
// implementation: DocumentNodeImplementation::proto("graphene_core::memo::MonitorNode"),
2133-
// manual_composition: Some(concrete!(Context)),
2134-
// skip_deduplication: true,
2135-
// ..Default::default()
2136-
// },
2137-
// DocumentNode {
2138-
// inputs: vec![
2139-
// NodeInput::node(NodeId(0), 0),
2140-
// NodeInput::network(concrete!(&WasmEditorApi), 1),
2141-
// NodeInput::network(concrete!(ImaginateController), 2),
2142-
// NodeInput::network(concrete!(f64), 3),
2143-
// NodeInput::network(concrete!(Option<DVec2>), 4),
2144-
// NodeInput::network(concrete!(u32), 5),
2145-
// NodeInput::network(concrete!(ImaginateSamplingMethod), 6),
2146-
// NodeInput::network(concrete!(f64), 7),
2147-
// NodeInput::network(concrete!(String), 8),
2148-
// NodeInput::network(concrete!(String), 9),
2149-
// NodeInput::network(concrete!(bool), 10),
2150-
// NodeInput::network(concrete!(f64), 11),
2151-
// NodeInput::network(concrete!(bool), 12),
2152-
// NodeInput::network(concrete!(f64), 13),
2153-
// NodeInput::network(concrete!(ImaginateMaskStartingFill), 14),
2154-
// NodeInput::network(concrete!(bool), 15),
2155-
// NodeInput::network(concrete!(bool), 16),
2156-
// NodeInput::network(concrete!(u64), 17),
2157-
// ],
2158-
// implementation: DocumentNodeImplementation::proto("graphene_std::raster::ImaginateNode"),
2159-
// ..Default::default()
2160-
// },
2161-
// ]
2162-
// .into_iter()
2163-
// .enumerate()
2164-
// .map(|(id, node)| (NodeId(id as u64), node))
2165-
// .collect(),
2166-
// ..Default::default()
2167-
// }),
2168-
// inputs: vec![
2169-
// NodeInput::value(TaggedValue::RasterData(RasterDataTable::default()), true),
2170-
// NodeInput::scope("editor-api"),
2171-
// NodeInput::value(TaggedValue::ImaginateController(Default::default()), false),
2172-
// NodeInput::value(TaggedValue::F64(0.), false), // Remember to keep index used in `ImaginateRandom` updated with this entry's index
2173-
// NodeInput::value(TaggedValue::OptionalDVec2(None), false),
2174-
// NodeInput::value(TaggedValue::U32(30), false),
2175-
// NodeInput::value(TaggedValue::ImaginateSamplingMethod(ImaginateSamplingMethod::EulerA), false),
2176-
// NodeInput::value(TaggedValue::F64(7.5), false),
2177-
// NodeInput::value(TaggedValue::String(String::new()), false),
2178-
// NodeInput::value(TaggedValue::String(String::new()), false),
2179-
// NodeInput::value(TaggedValue::Bool(false), false),
2180-
// NodeInput::value(TaggedValue::F64(66.), false),
2181-
// NodeInput::value(TaggedValue::Bool(true), false),
2182-
// NodeInput::value(TaggedValue::F64(4.), false),
2183-
// NodeInput::value(TaggedValue::ImaginateMaskStartingFill(ImaginateMaskStartingFill::Fill), false),
2184-
// NodeInput::value(TaggedValue::Bool(false), false),
2185-
// NodeInput::value(TaggedValue::Bool(false), false),
2186-
// NodeInput::value(TaggedValue::U64(0), false),
2187-
// ],
2188-
// ..Default::default()
2189-
// },
2190-
// persistent_node_metadata: DocumentNodePersistentMetadata {
2191-
// network_metadata: Some(NodeNetworkMetadata {
2192-
// persistent_metadata: NodeNetworkPersistentMetadata {
2193-
// node_metadata: [
2194-
// DocumentNodeMetadata {
2195-
// persistent_metadata: DocumentNodePersistentMetadata {
2196-
// display_name: "Monitor".to_string(),
2197-
// ..Default::default()
2198-
// },
2199-
// ..Default::default()
2200-
// },
2201-
// DocumentNodeMetadata {
2202-
// persistent_metadata: DocumentNodePersistentMetadata {
2203-
// display_name: "Imaginate".to_string(),
2204-
// ..Default::default()
2205-
// },
2206-
// ..Default::default()
2207-
// },
2208-
// ]
2209-
// .into_iter()
2210-
// .enumerate()
2211-
// .map(|(id, node)| (NodeId(id as u64), node))
2212-
// .collect(),
2213-
// ..Default::default()
2214-
// },
2215-
// ..Default::default()
2216-
// }),
2217-
// input_properties: vec![
2218-
// "Input Image".into(),
2219-
// "Editor Api".into(),
2220-
// "Controller".into(),
2221-
// "Seed".into(),
2222-
// "Resolution".into(),
2223-
// "Samples".into(),
2224-
// "Sampling Method".into(),
2225-
// "Prompt Guidance".into(),
2226-
// "Prompt".into(),
2227-
// "Negative Prompt".into(),
2228-
// "Adapt Input Image".into(),
2229-
// "Image Creativity".into(),
2230-
// "Inpaint".into(),
2231-
// "Mask Blur".into(),
2232-
// "Mask Starting Fill".into(),
2233-
// "Improve Faces".into(),
2234-
// "Tiling".into(),
2235-
// ],
2236-
// output_names: vec!["Image".to_string()],
2237-
// ..Default::default()
2238-
// },
2239-
// },
2240-
// description: Cow::Borrowed("TODO"),
2241-
// properties: None, // Some(&node_properties::imaginate_properties),
2242-
// });
2243-
22442121
type NodeProperties = HashMap<String, Box<dyn Fn(NodeId, &mut NodePropertiesContext) -> Vec<LayoutGroup> + Send + Sync>>;
22452122

22462123
pub static NODE_OVERRIDES: once_cell::sync::Lazy<NodeProperties> = once_cell::sync::Lazy::new(static_node_properties);
@@ -2975,19 +2852,3 @@ impl DocumentNodeDefinition {
29752852
self.node_template_input_override(self.node_template.document_node.inputs.clone().into_iter().map(Some))
29762853
}
29772854
}
2978-
2979-
// Previously used by the Imaginate node, but usage was commented out since it did nothing.
2980-
// pub fn new_image_network(output_offset: i32, output_node_id: NodeId) -> NodeNetwork {
2981-
// let mut network = NodeNetwork { ..Default::default() };
2982-
// network.push_node_to_document_network(
2983-
// resolve_document_node_type("Input Frame")
2984-
// .expect("Input Frame node does not exist")
2985-
// .to_document_node_default_inputs([], DocumentNodeMetadata::position((8, 4))),
2986-
// );
2987-
// network.push_node_to_document_network(
2988-
// resolve_document_node_type("Output")
2989-
// .expect("Output node does not exist")
2990-
// .to_document_node([NodeInput::node(output_node_id, 0)], DocumentNodeMetadata::position((output_offset + 8, 4))),
2991-
// );
2992-
// network
2993-
// }

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,12 +1396,7 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphHandlerData<'a>> for NodeGrap
13961396
input,
13971397
});
13981398
responses.add(PropertiesPanelMessage::Refresh);
1399-
if (network_interface
1400-
.reference(&node_id, selection_network_path)
1401-
.is_none_or(|reference| *reference != Some("Imaginate".to_string())) // TODO: Potentially remove the reference to Imaginate
1402-
|| input_index == 0)
1403-
&& network_interface.connected_to_output(&node_id, selection_network_path)
1404-
{
1399+
if (network_interface.reference(&node_id, selection_network_path).is_none() || input_index == 0) && network_interface.connected_to_output(&node_id, selection_network_path) {
14051400
responses.add(NodeGraphMessage::RunDocumentGraph);
14061401
}
14071402
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy