mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-30 22:38:11 +08:00
Comment out all remaining active Imaginate code
This commit is contained in:
@@ -71,13 +71,13 @@ pub enum DocumentMessage {
|
||||
GroupSelectedLayers {
|
||||
group_folder_type: GroupFolderType,
|
||||
},
|
||||
ImaginateGenerate {
|
||||
imaginate_node: Vec<NodeId>,
|
||||
},
|
||||
ImaginateRandom {
|
||||
imaginate_node: Vec<NodeId>,
|
||||
then_generate: bool,
|
||||
},
|
||||
// ImaginateGenerate {
|
||||
// imaginate_node: Vec<NodeId>,
|
||||
// },
|
||||
// ImaginateRandom {
|
||||
// imaginate_node: Vec<NodeId>,
|
||||
// then_generate: bool,
|
||||
// },
|
||||
MoveSelectedLayersTo {
|
||||
parent: LayerNodeIdentifier,
|
||||
insert_index: usize,
|
||||
|
||||
@@ -579,37 +579,37 @@ impl MessageHandler<DocumentMessage, DocumentMessageData<'_>> for DocumentMessag
|
||||
responses.add(NodeGraphMessage::SelectedNodesSet { nodes: new_folders });
|
||||
}
|
||||
}
|
||||
DocumentMessage::ImaginateGenerate { imaginate_node } => {
|
||||
let random_value = generate_uuid();
|
||||
responses.add(NodeGraphMessage::SetInputValue {
|
||||
node_id: *imaginate_node.last().unwrap(),
|
||||
// Needs to match the index of the seed parameter in `pub const IMAGINATE_NODE: DocumentNodeDefinition` in `document_node_type.rs`
|
||||
input_index: 17,
|
||||
value: graph_craft::document::value::TaggedValue::U64(random_value),
|
||||
});
|
||||
// DocumentMessage::ImaginateGenerate { imaginate_node } => {
|
||||
// let random_value = generate_uuid();
|
||||
// responses.add(NodeGraphMessage::SetInputValue {
|
||||
// node_id: *imaginate_node.last().unwrap(),
|
||||
// // Needs to match the index of the seed parameter in `pub const IMAGINATE_NODE: DocumentNodeDefinition` in `document_node_type.rs`
|
||||
// input_index: 17,
|
||||
// value: graph_craft::document::value::TaggedValue::U64(random_value),
|
||||
// });
|
||||
|
||||
responses.add(PortfolioMessage::SubmitGraphRender { document_id, ignore_hash: false });
|
||||
}
|
||||
DocumentMessage::ImaginateRandom { imaginate_node, then_generate } => {
|
||||
// Generate a random seed. We only want values between -2^53 and 2^53, because integer values
|
||||
// outside of this range can get rounded in f64
|
||||
let random_bits = generate_uuid();
|
||||
let random_value = ((random_bits >> 11) as f64).copysign(f64::from_bits(random_bits & (1 << 63)));
|
||||
// responses.add(PortfolioMessage::SubmitGraphRender { document_id, ignore_hash: false });
|
||||
// }
|
||||
// DocumentMessage::ImaginateRandom { imaginate_node, then_generate } => {
|
||||
// // Generate a random seed. We only want values between -2^53 and 2^53, because integer values
|
||||
// // outside of this range can get rounded in f64
|
||||
// let random_bits = generate_uuid();
|
||||
// let random_value = ((random_bits >> 11) as f64).copysign(f64::from_bits(random_bits & (1 << 63)));
|
||||
|
||||
responses.add(DocumentMessage::AddTransaction);
|
||||
// Set a random seed input
|
||||
responses.add(NodeGraphMessage::SetInputValue {
|
||||
node_id: *imaginate_node.last().unwrap(),
|
||||
// Needs to match the index of the seed parameter in `pub const IMAGINATE_NODE: DocumentNodeDefinition` in `document_node_type.rs`
|
||||
input_index: 3,
|
||||
value: graph_craft::document::value::TaggedValue::F64(random_value),
|
||||
});
|
||||
// responses.add(DocumentMessage::AddTransaction);
|
||||
// // Set a random seed input
|
||||
// responses.add(NodeGraphMessage::SetInputValue {
|
||||
// node_id: *imaginate_node.last().unwrap(),
|
||||
// // Needs to match the index of the seed parameter in `pub const IMAGINATE_NODE: DocumentNodeDefinition` in `document_node_type.rs`
|
||||
// input_index: 3,
|
||||
// value: graph_craft::document::value::TaggedValue::F64(random_value),
|
||||
// });
|
||||
|
||||
// Generate the image
|
||||
if then_generate {
|
||||
responses.add(DocumentMessage::ImaginateGenerate { imaginate_node });
|
||||
}
|
||||
}
|
||||
// // Generate the image
|
||||
// if then_generate {
|
||||
// responses.add(DocumentMessage::ImaginateGenerate { imaginate_node });
|
||||
// }
|
||||
// }
|
||||
DocumentMessage::MoveSelectedLayersTo { parent, insert_index } => {
|
||||
if !self.selection_network_path.is_empty() {
|
||||
log::error!("Moving selected layers is only supported for the Document Network");
|
||||
|
||||
@@ -13,7 +13,6 @@ use graph_craft::ProtoNodeIdentifier;
|
||||
use graph_craft::concrete;
|
||||
use graph_craft::document::value::*;
|
||||
use graph_craft::document::*;
|
||||
use graph_craft::imaginate_input::ImaginateSamplingMethod;
|
||||
use graphene_core::raster::brush_cache::BrushCache;
|
||||
use graphene_core::raster::image::ImageFrameTable;
|
||||
use graphene_core::raster::{Color, RedGreenBlue, RedGreenBlueAlpha};
|
||||
@@ -21,8 +20,6 @@ use graphene_core::text::{Font, TypesettingConfig};
|
||||
use graphene_core::transform::Footprint;
|
||||
use graphene_core::vector::VectorDataTable;
|
||||
use graphene_core::*;
|
||||
use graphene_std::wasm_application_io::WasmEditorApi;
|
||||
use once_cell::sync::Lazy;
|
||||
use std::collections::{HashMap, HashSet, VecDeque};
|
||||
#[cfg(feature = "gpu")]
|
||||
use wgpu_executor::{Bindgroup, CommandBuffer, PipelineLayout, ShaderHandle, ShaderInputFrame, WgpuShaderInput};
|
||||
@@ -2713,127 +2710,127 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
|
||||
custom
|
||||
}
|
||||
|
||||
pub static IMAGINATE_NODE: Lazy<DocumentNodeDefinition> = Lazy::new(|| DocumentNodeDefinition {
|
||||
identifier: "Imaginate",
|
||||
category: "Raster",
|
||||
node_template: NodeTemplate {
|
||||
document_node: DocumentNode {
|
||||
implementation: DocumentNodeImplementation::Network(NodeNetwork {
|
||||
exports: vec![NodeInput::node(NodeId(1), 0)],
|
||||
nodes: [
|
||||
DocumentNode {
|
||||
inputs: vec![NodeInput::network(concrete!(ImageFrameTable<Color>), 0)],
|
||||
implementation: DocumentNodeImplementation::proto("graphene_core::memo::MonitorNode"),
|
||||
manual_composition: Some(concrete!(Context)),
|
||||
skip_deduplication: true,
|
||||
..Default::default()
|
||||
},
|
||||
DocumentNode {
|
||||
inputs: vec![
|
||||
NodeInput::node(NodeId(0), 0),
|
||||
NodeInput::network(concrete!(&WasmEditorApi), 1),
|
||||
NodeInput::network(concrete!(ImaginateController), 2),
|
||||
NodeInput::network(concrete!(f64), 3),
|
||||
NodeInput::network(concrete!(Option<DVec2>), 4),
|
||||
NodeInput::network(concrete!(u32), 5),
|
||||
NodeInput::network(concrete!(ImaginateSamplingMethod), 6),
|
||||
NodeInput::network(concrete!(f64), 7),
|
||||
NodeInput::network(concrete!(String), 8),
|
||||
NodeInput::network(concrete!(String), 9),
|
||||
NodeInput::network(concrete!(bool), 10),
|
||||
NodeInput::network(concrete!(f64), 11),
|
||||
NodeInput::network(concrete!(bool), 12),
|
||||
NodeInput::network(concrete!(f64), 13),
|
||||
NodeInput::network(concrete!(ImaginateMaskStartingFill), 14),
|
||||
NodeInput::network(concrete!(bool), 15),
|
||||
NodeInput::network(concrete!(bool), 16),
|
||||
NodeInput::network(concrete!(u64), 17),
|
||||
],
|
||||
implementation: DocumentNodeImplementation::proto("graphene_std::raster::ImaginateNode"),
|
||||
..Default::default()
|
||||
},
|
||||
]
|
||||
.into_iter()
|
||||
.enumerate()
|
||||
.map(|(id, node)| (NodeId(id as u64), node))
|
||||
.collect(),
|
||||
..Default::default()
|
||||
}),
|
||||
inputs: vec![
|
||||
NodeInput::value(TaggedValue::ImageFrame(ImageFrameTable::one_empty_image()), true),
|
||||
NodeInput::scope("editor-api"),
|
||||
NodeInput::value(TaggedValue::ImaginateController(Default::default()), false),
|
||||
NodeInput::value(TaggedValue::F64(0.), false), // Remember to keep index used in `ImaginateRandom` updated with this entry's index
|
||||
NodeInput::value(TaggedValue::OptionalDVec2(None), false),
|
||||
NodeInput::value(TaggedValue::U32(30), false),
|
||||
NodeInput::value(TaggedValue::ImaginateSamplingMethod(ImaginateSamplingMethod::EulerA), false),
|
||||
NodeInput::value(TaggedValue::F64(7.5), false),
|
||||
NodeInput::value(TaggedValue::String(String::new()), false),
|
||||
NodeInput::value(TaggedValue::String(String::new()), false),
|
||||
NodeInput::value(TaggedValue::Bool(false), false),
|
||||
NodeInput::value(TaggedValue::F64(66.), false),
|
||||
NodeInput::value(TaggedValue::Bool(true), false),
|
||||
NodeInput::value(TaggedValue::F64(4.), false),
|
||||
NodeInput::value(TaggedValue::ImaginateMaskStartingFill(ImaginateMaskStartingFill::Fill), false),
|
||||
NodeInput::value(TaggedValue::Bool(false), false),
|
||||
NodeInput::value(TaggedValue::Bool(false), false),
|
||||
NodeInput::value(TaggedValue::U64(0), false),
|
||||
],
|
||||
..Default::default()
|
||||
},
|
||||
persistent_node_metadata: DocumentNodePersistentMetadata {
|
||||
network_metadata: Some(NodeNetworkMetadata {
|
||||
persistent_metadata: NodeNetworkPersistentMetadata {
|
||||
node_metadata: [
|
||||
DocumentNodeMetadata {
|
||||
persistent_metadata: DocumentNodePersistentMetadata {
|
||||
display_name: "Monitor".to_string(),
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
},
|
||||
DocumentNodeMetadata {
|
||||
persistent_metadata: DocumentNodePersistentMetadata {
|
||||
display_name: "Imaginate".to_string(),
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
},
|
||||
]
|
||||
.into_iter()
|
||||
.enumerate()
|
||||
.map(|(id, node)| (NodeId(id as u64), node))
|
||||
.collect(),
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
}),
|
||||
input_properties: vec![
|
||||
"Input Image".into(),
|
||||
"Editor Api".into(),
|
||||
"Controller".into(),
|
||||
"Seed".into(),
|
||||
"Resolution".into(),
|
||||
"Samples".into(),
|
||||
"Sampling Method".into(),
|
||||
"Prompt Guidance".into(),
|
||||
"Prompt".into(),
|
||||
"Negative Prompt".into(),
|
||||
"Adapt Input Image".into(),
|
||||
"Image Creativity".into(),
|
||||
"Inpaint".into(),
|
||||
"Mask Blur".into(),
|
||||
"Mask Starting Fill".into(),
|
||||
"Improve Faces".into(),
|
||||
"Tiling".into(),
|
||||
],
|
||||
output_names: vec!["Image".to_string()],
|
||||
..Default::default()
|
||||
},
|
||||
},
|
||||
description: Cow::Borrowed("TODO"),
|
||||
properties: None, // Some(&node_properties::imaginate_properties),
|
||||
});
|
||||
// pub static IMAGINATE_NODE: Lazy<DocumentNodeDefinition> = Lazy::new(|| DocumentNodeDefinition {
|
||||
// identifier: "Imaginate",
|
||||
// category: "Raster",
|
||||
// node_template: NodeTemplate {
|
||||
// document_node: DocumentNode {
|
||||
// implementation: DocumentNodeImplementation::Network(NodeNetwork {
|
||||
// exports: vec![NodeInput::node(NodeId(1), 0)],
|
||||
// nodes: [
|
||||
// DocumentNode {
|
||||
// inputs: vec![NodeInput::network(concrete!(ImageFrameTable<Color>), 0)],
|
||||
// implementation: DocumentNodeImplementation::proto("graphene_core::memo::MonitorNode"),
|
||||
// manual_composition: Some(concrete!(Context)),
|
||||
// skip_deduplication: true,
|
||||
// ..Default::default()
|
||||
// },
|
||||
// DocumentNode {
|
||||
// inputs: vec![
|
||||
// NodeInput::node(NodeId(0), 0),
|
||||
// NodeInput::network(concrete!(&WasmEditorApi), 1),
|
||||
// NodeInput::network(concrete!(ImaginateController), 2),
|
||||
// NodeInput::network(concrete!(f64), 3),
|
||||
// NodeInput::network(concrete!(Option<DVec2>), 4),
|
||||
// NodeInput::network(concrete!(u32), 5),
|
||||
// NodeInput::network(concrete!(ImaginateSamplingMethod), 6),
|
||||
// NodeInput::network(concrete!(f64), 7),
|
||||
// NodeInput::network(concrete!(String), 8),
|
||||
// NodeInput::network(concrete!(String), 9),
|
||||
// NodeInput::network(concrete!(bool), 10),
|
||||
// NodeInput::network(concrete!(f64), 11),
|
||||
// NodeInput::network(concrete!(bool), 12),
|
||||
// NodeInput::network(concrete!(f64), 13),
|
||||
// NodeInput::network(concrete!(ImaginateMaskStartingFill), 14),
|
||||
// NodeInput::network(concrete!(bool), 15),
|
||||
// NodeInput::network(concrete!(bool), 16),
|
||||
// NodeInput::network(concrete!(u64), 17),
|
||||
// ],
|
||||
// implementation: DocumentNodeImplementation::proto("graphene_std::raster::ImaginateNode"),
|
||||
// ..Default::default()
|
||||
// },
|
||||
// ]
|
||||
// .into_iter()
|
||||
// .enumerate()
|
||||
// .map(|(id, node)| (NodeId(id as u64), node))
|
||||
// .collect(),
|
||||
// ..Default::default()
|
||||
// }),
|
||||
// inputs: vec![
|
||||
// NodeInput::value(TaggedValue::ImageFrame(ImageFrameTable::one_empty_image()), true),
|
||||
// NodeInput::scope("editor-api"),
|
||||
// NodeInput::value(TaggedValue::ImaginateController(Default::default()), false),
|
||||
// NodeInput::value(TaggedValue::F64(0.), false), // Remember to keep index used in `ImaginateRandom` updated with this entry's index
|
||||
// NodeInput::value(TaggedValue::OptionalDVec2(None), false),
|
||||
// NodeInput::value(TaggedValue::U32(30), false),
|
||||
// NodeInput::value(TaggedValue::ImaginateSamplingMethod(ImaginateSamplingMethod::EulerA), false),
|
||||
// NodeInput::value(TaggedValue::F64(7.5), false),
|
||||
// NodeInput::value(TaggedValue::String(String::new()), false),
|
||||
// NodeInput::value(TaggedValue::String(String::new()), false),
|
||||
// NodeInput::value(TaggedValue::Bool(false), false),
|
||||
// NodeInput::value(TaggedValue::F64(66.), false),
|
||||
// NodeInput::value(TaggedValue::Bool(true), false),
|
||||
// NodeInput::value(TaggedValue::F64(4.), false),
|
||||
// NodeInput::value(TaggedValue::ImaginateMaskStartingFill(ImaginateMaskStartingFill::Fill), false),
|
||||
// NodeInput::value(TaggedValue::Bool(false), false),
|
||||
// NodeInput::value(TaggedValue::Bool(false), false),
|
||||
// NodeInput::value(TaggedValue::U64(0), false),
|
||||
// ],
|
||||
// ..Default::default()
|
||||
// },
|
||||
// persistent_node_metadata: DocumentNodePersistentMetadata {
|
||||
// network_metadata: Some(NodeNetworkMetadata {
|
||||
// persistent_metadata: NodeNetworkPersistentMetadata {
|
||||
// node_metadata: [
|
||||
// DocumentNodeMetadata {
|
||||
// persistent_metadata: DocumentNodePersistentMetadata {
|
||||
// display_name: "Monitor".to_string(),
|
||||
// ..Default::default()
|
||||
// },
|
||||
// ..Default::default()
|
||||
// },
|
||||
// DocumentNodeMetadata {
|
||||
// persistent_metadata: DocumentNodePersistentMetadata {
|
||||
// display_name: "Imaginate".to_string(),
|
||||
// ..Default::default()
|
||||
// },
|
||||
// ..Default::default()
|
||||
// },
|
||||
// ]
|
||||
// .into_iter()
|
||||
// .enumerate()
|
||||
// .map(|(id, node)| (NodeId(id as u64), node))
|
||||
// .collect(),
|
||||
// ..Default::default()
|
||||
// },
|
||||
// ..Default::default()
|
||||
// }),
|
||||
// input_properties: vec![
|
||||
// "Input Image".into(),
|
||||
// "Editor Api".into(),
|
||||
// "Controller".into(),
|
||||
// "Seed".into(),
|
||||
// "Resolution".into(),
|
||||
// "Samples".into(),
|
||||
// "Sampling Method".into(),
|
||||
// "Prompt Guidance".into(),
|
||||
// "Prompt".into(),
|
||||
// "Negative Prompt".into(),
|
||||
// "Adapt Input Image".into(),
|
||||
// "Image Creativity".into(),
|
||||
// "Inpaint".into(),
|
||||
// "Mask Blur".into(),
|
||||
// "Mask Starting Fill".into(),
|
||||
// "Improve Faces".into(),
|
||||
// "Tiling".into(),
|
||||
// ],
|
||||
// output_names: vec!["Image".to_string()],
|
||||
// ..Default::default()
|
||||
// },
|
||||
// },
|
||||
// description: Cow::Borrowed("TODO"),
|
||||
// properties: None, // Some(&node_properties::imaginate_properties),
|
||||
// });
|
||||
|
||||
type NodeProperties = HashMap<String, Box<dyn Fn(NodeId, &mut NodePropertiesContext) -> Vec<LayoutGroup> + Send + Sync>>;
|
||||
|
||||
|
||||
@@ -1354,7 +1354,7 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphHandlerData<'a>> for NodeGrap
|
||||
responses.add(PropertiesPanelMessage::Refresh);
|
||||
if (network_interface
|
||||
.reference(&node_id, selection_network_path)
|
||||
.is_none_or(|reference| *reference != Some("Imaginate".to_string()))
|
||||
.is_none_or(|reference| *reference != Some("Imaginate".to_string())) // TODO: Potentially remove the reference to Imaginate
|
||||
|| input_index == 0)
|
||||
&& network_interface.connected_to_output(&node_id, selection_network_path)
|
||||
{
|
||||
|
||||
@@ -10,7 +10,6 @@ use glam::{DAffine2, DVec2, IVec2, UVec2};
|
||||
use graph_craft::Type;
|
||||
use graph_craft::document::value::TaggedValue;
|
||||
use graph_craft::document::{DocumentNode, DocumentNodeImplementation, NodeId, NodeInput};
|
||||
use graph_craft::imaginate_input::{ImaginateMaskStartingFill, ImaginateSamplingMethod};
|
||||
use graphene_core::raster::curve::Curve;
|
||||
use graphene_core::raster::image::ImageFrameTable;
|
||||
use graphene_core::raster::{
|
||||
@@ -215,38 +214,38 @@ pub(crate) fn property_from_type(
|
||||
Some(x) if x == TypeId::of::<BooleanOperation>() => boolean_operation_radio_buttons(document_node, node_id, index, name, true),
|
||||
Some(x) if x == TypeId::of::<CentroidType>() => centroid_widget(document_node, node_id, index),
|
||||
Some(x) if x == TypeId::of::<LuminanceCalculation>() => luminance_calculation(document_node, node_id, index, name, true),
|
||||
Some(x) if x == TypeId::of::<ImaginateSamplingMethod>() => vec![
|
||||
DropdownInput::new(
|
||||
ImaginateSamplingMethod::list()
|
||||
.into_iter()
|
||||
.map(|method| {
|
||||
vec![MenuListEntry::new(format!("{:?}", method)).label(method.to_string()).on_update(update_value(
|
||||
move |_| TaggedValue::ImaginateSamplingMethod(method),
|
||||
node_id,
|
||||
index,
|
||||
))]
|
||||
})
|
||||
.collect(),
|
||||
)
|
||||
.widget_holder(),
|
||||
]
|
||||
.into(),
|
||||
Some(x) if x == TypeId::of::<ImaginateMaskStartingFill>() => vec![
|
||||
DropdownInput::new(
|
||||
ImaginateMaskStartingFill::list()
|
||||
.into_iter()
|
||||
.map(|fill| {
|
||||
vec![MenuListEntry::new(format!("{:?}", fill)).label(fill.to_string()).on_update(update_value(
|
||||
move |_| TaggedValue::ImaginateMaskStartingFill(fill),
|
||||
node_id,
|
||||
index,
|
||||
))]
|
||||
})
|
||||
.collect(),
|
||||
)
|
||||
.widget_holder(),
|
||||
]
|
||||
.into(),
|
||||
// Some(x) if x == TypeId::of::<ImaginateSamplingMethod>() => vec![
|
||||
// DropdownInput::new(
|
||||
// ImaginateSamplingMethod::list()
|
||||
// .into_iter()
|
||||
// .map(|method| {
|
||||
// vec![MenuListEntry::new(format!("{:?}", method)).label(method.to_string()).on_update(update_value(
|
||||
// move |_| TaggedValue::ImaginateSamplingMethod(method),
|
||||
// node_id,
|
||||
// index,
|
||||
// ))]
|
||||
// })
|
||||
// .collect(),
|
||||
// )
|
||||
// .widget_holder(),
|
||||
// ]
|
||||
// .into(),
|
||||
// Some(x) if x == TypeId::of::<ImaginateMaskStartingFill>() => vec![
|
||||
// DropdownInput::new(
|
||||
// ImaginateMaskStartingFill::list()
|
||||
// .into_iter()
|
||||
// .map(|fill| {
|
||||
// vec![MenuListEntry::new(format!("{:?}", fill)).label(fill.to_string()).on_update(update_value(
|
||||
// move |_| TaggedValue::ImaginateMaskStartingFill(fill),
|
||||
// node_id,
|
||||
// index,
|
||||
// ))]
|
||||
// })
|
||||
// .collect(),
|
||||
// )
|
||||
// .widget_holder(),
|
||||
// ]
|
||||
// .into(),
|
||||
_ => {
|
||||
let mut widgets = start_widgets(document_node, node_id, index, name, FrontendGraphDataType::General, true);
|
||||
widgets.extend_from_slice(&[
|
||||
|
||||
Reference in New Issue
Block a user