Rename the Downscale node to Downres
This commit is contained in:
parent
a58d51d685
commit
ce76dbee6a
|
|
@ -600,14 +600,14 @@ impl MessageHandler<DocumentMessage, (u64, &InputPreprocessorMessageHandler, &Pe
|
||||||
warn!("Transform node should be in registry");
|
warn!("Transform node should be in registry");
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
let Some(downscale_node_type) = crate::messages::portfolio::document::node_graph::resolve_document_node_type("Downscale") else {
|
let Some(downres_node_type) = crate::messages::portfolio::document::node_graph::resolve_document_node_type("Downres") else {
|
||||||
warn!("Downscale node should be in registry");
|
warn!("Downres node should be in registry");
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
let path = vec![generate_uuid()];
|
let path = vec![generate_uuid()];
|
||||||
let [image_node_id, transform_node_id, downscale_node_id] = [100, 101, 102];
|
let [image_node_id, transform_node_id, downres_node_id] = [100, 101, 102];
|
||||||
let mut network = crate::messages::portfolio::document::node_graph::new_image_network(32, downscale_node_id);
|
let mut network = crate::messages::portfolio::document::node_graph::new_image_network(32, downres_node_id);
|
||||||
|
|
||||||
// Transform of parent folder
|
// Transform of parent folder
|
||||||
let to_parent_folder = self.document_legacy.generate_transform_across_scope(&path[..path.len() - 1], None).unwrap_or_default();
|
let to_parent_folder = self.document_legacy.generate_transform_across_scope(&path[..path.len() - 1], None).unwrap_or_default();
|
||||||
|
|
@ -648,8 +648,8 @@ impl MessageHandler<DocumentMessage, (u64, &InputPreprocessorMessageHandler, &Pe
|
||||||
transform_node_type.to_document_node_default_inputs([Some(graph_craft::document::NodeInput::node(image_node_id, 0))], next_pos()),
|
transform_node_type.to_document_node_default_inputs([Some(graph_craft::document::NodeInput::node(image_node_id, 0))], next_pos()),
|
||||||
);
|
);
|
||||||
network.nodes.insert(
|
network.nodes.insert(
|
||||||
downscale_node_id,
|
downres_node_id,
|
||||||
downscale_node_type.to_document_node_default_inputs([Some(graph_craft::document::NodeInput::node(transform_node_id, 0))], next_pos()),
|
downres_node_type.to_document_node_default_inputs([Some(graph_craft::document::NodeInput::node(transform_node_id, 0))], next_pos()),
|
||||||
);
|
);
|
||||||
|
|
||||||
responses.push_back(
|
responses.push_back(
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,16 @@
|
||||||
use super::{node_properties, FrontendGraphDataType, FrontendNodeType};
|
use super::{node_properties, FrontendGraphDataType, FrontendNodeType};
|
||||||
use crate::messages::layout::utility_types::layout_widget::LayoutGroup;
|
use crate::messages::layout::utility_types::layout_widget::LayoutGroup;
|
||||||
use crate::node_graph_executor::NodeGraphExecutor;
|
use crate::node_graph_executor::NodeGraphExecutor;
|
||||||
use once_cell::sync::Lazy;
|
|
||||||
|
|
||||||
|
use graph_craft::concrete;
|
||||||
use graph_craft::document::value::*;
|
use graph_craft::document::value::*;
|
||||||
use graph_craft::document::*;
|
use graph_craft::document::*;
|
||||||
use graph_craft::imaginate_input::ImaginateSamplingMethod;
|
use graph_craft::imaginate_input::ImaginateSamplingMethod;
|
||||||
|
|
||||||
use graph_craft::concrete;
|
|
||||||
use graph_craft::NodeIdentifier;
|
use graph_craft::NodeIdentifier;
|
||||||
use graphene_core::raster::{BlendMode, Color, Image, ImageFrame, LuminanceCalculation};
|
use graphene_core::raster::{BlendMode, Color, Image, ImageFrame, LuminanceCalculation};
|
||||||
use graphene_core::*;
|
use graphene_core::*;
|
||||||
|
|
||||||
|
use once_cell::sync::Lazy;
|
||||||
use std::collections::VecDeque;
|
use std::collections::VecDeque;
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Hash)]
|
#[derive(Debug, Clone, PartialEq, Hash)]
|
||||||
|
|
@ -105,16 +104,16 @@ fn static_nodes() -> Vec<DocumentNodeType> {
|
||||||
properties: |_document_node, _node_id, _context| node_properties::string_properties("The identity node simply returns the input"),
|
properties: |_document_node, _node_id, _context| node_properties::string_properties("The identity node simply returns the input"),
|
||||||
},
|
},
|
||||||
DocumentNodeType {
|
DocumentNodeType {
|
||||||
name: "Downscale",
|
name: "Downres",
|
||||||
category: "Ignore",
|
category: "Ignore",
|
||||||
identifier: NodeImplementation::DocumentNode(NodeNetwork {
|
identifier: NodeImplementation::DocumentNode(NodeNetwork {
|
||||||
inputs: vec![0],
|
inputs: vec![0],
|
||||||
outputs: vec![NodeOutput::new(2, 0)],
|
outputs: vec![NodeOutput::new(2, 0)],
|
||||||
nodes: [
|
nodes: [
|
||||||
DocumentNode {
|
DocumentNode {
|
||||||
name: "Downscale".to_string(),
|
name: "Downres".to_string(),
|
||||||
inputs: vec![NodeInput::Network(concrete!(ImageFrame))],
|
inputs: vec![NodeInput::Network(concrete!(ImageFrame))],
|
||||||
implementation: DocumentNodeImplementation::Unresolved(NodeIdentifier::new("graphene_std::raster::DownscaleNode")),
|
implementation: DocumentNodeImplementation::Unresolved(NodeIdentifier::new("graphene_std::raster::DownresNode")),
|
||||||
metadata: Default::default(),
|
metadata: Default::default(),
|
||||||
},
|
},
|
||||||
DocumentNode {
|
DocumentNode {
|
||||||
|
|
@ -138,7 +137,7 @@ fn static_nodes() -> Vec<DocumentNodeType> {
|
||||||
}),
|
}),
|
||||||
inputs: vec![DocumentInputType::value("Image", TaggedValue::ImageFrame(ImageFrame::empty()), false)],
|
inputs: vec![DocumentInputType::value("Image", TaggedValue::ImageFrame(ImageFrame::empty()), false)],
|
||||||
outputs: vec![DocumentOutputType::new("Image", FrontendGraphDataType::Raster)],
|
outputs: vec![DocumentOutputType::new("Image", FrontendGraphDataType::Raster)],
|
||||||
properties: |_document_node, _node_id, _context| node_properties::string_properties("Downscale the image to a lower resolution"),
|
properties: |_document_node, _node_id, _context| node_properties::string_properties("Downres the image to a lower resolution"),
|
||||||
},
|
},
|
||||||
// DocumentNodeType {
|
// DocumentNodeType {
|
||||||
// name: "Input Frame",
|
// name: "Input Frame",
|
||||||
|
|
|
||||||
|
|
@ -90,10 +90,10 @@ pub fn export_image_node<'i, 's: 'i>() -> impl Node<'i, 's, (Image, &'i str), Ou
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
pub struct DownscaleNode;
|
pub struct DownresNode;
|
||||||
|
|
||||||
#[node_macro::node_fn(DownscaleNode)]
|
#[node_macro::node_fn(DownresNode)]
|
||||||
fn downscale(image_frame: ImageFrame) -> ImageFrame {
|
fn downres(image_frame: ImageFrame) -> ImageFrame {
|
||||||
let target_width = (image_frame.transform.transform_vector2((1., 0.).into()).length() as usize).min(image_frame.image.width as usize);
|
let target_width = (image_frame.transform.transform_vector2((1., 0.).into()).length() as usize).min(image_frame.image.width as usize);
|
||||||
let target_height = (image_frame.transform.transform_vector2((0., 1.).into()).length() as usize).min(image_frame.image.height as usize);
|
let target_height = (image_frame.transform.transform_vector2((0., 1.).into()).length() as usize).min(image_frame.image.height as usize);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@ fn node_registry() -> HashMap<NodeIdentifier, HashMap<NodeIOTypes, NodeConstruct
|
||||||
register_node!(graphene_core::ops::AddParameterNode<_>, input: f64, params: [&f64]),
|
register_node!(graphene_core::ops::AddParameterNode<_>, input: f64, params: [&f64]),
|
||||||
register_node!(graphene_core::ops::AddParameterNode<_>, input: &f64, params: [&f64]),
|
register_node!(graphene_core::ops::AddParameterNode<_>, input: &f64, params: [&f64]),
|
||||||
register_node!(graphene_core::ops::SomeNode, input: ImageFrame, params: []),
|
register_node!(graphene_core::ops::SomeNode, input: ImageFrame, params: []),
|
||||||
register_node!(graphene_std::raster::DownscaleNode, input: ImageFrame, params: []),
|
register_node!(graphene_std::raster::DownresNode, input: ImageFrame, params: []),
|
||||||
register_node!(graphene_std::raster::MaskImageNode<_>, input: ImageFrame, params: [ImageFrame]),
|
register_node!(graphene_std::raster::MaskImageNode<_>, input: ImageFrame, params: [ImageFrame]),
|
||||||
#[cfg(feature = "gpu")]
|
#[cfg(feature = "gpu")]
|
||||||
register_node!(graphene_std::executor::MapGpuSingleImageNode<_>, input: Image, params: [String]),
|
register_node!(graphene_std::executor::MapGpuSingleImageNode<_>, input: Image, params: [String]),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue