Rename the Downscale node to Downres

This commit is contained in:
Keavon Chambers 2023-04-09 15:22:22 -07:00
parent a58d51d685
commit ce76dbee6a
4 changed files with 16 additions and 17 deletions

View File

@ -600,14 +600,14 @@ impl MessageHandler<DocumentMessage, (u64, &InputPreprocessorMessageHandler, &Pe
warn!("Transform node should be in registry");
return;
};
let Some(downscale_node_type) = crate::messages::portfolio::document::node_graph::resolve_document_node_type("Downscale") else {
warn!("Downscale node should be in registry");
let Some(downres_node_type) = crate::messages::portfolio::document::node_graph::resolve_document_node_type("Downres") else {
warn!("Downres node should be in registry");
return;
};
let path = vec![generate_uuid()];
let [image_node_id, transform_node_id, downscale_node_id] = [100, 101, 102];
let mut network = crate::messages::portfolio::document::node_graph::new_image_network(32, downscale_node_id);
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, downres_node_id);
// Transform of parent folder
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()),
);
network.nodes.insert(
downscale_node_id,
downscale_node_type.to_document_node_default_inputs([Some(graph_craft::document::NodeInput::node(transform_node_id, 0))], next_pos()),
downres_node_id,
downres_node_type.to_document_node_default_inputs([Some(graph_craft::document::NodeInput::node(transform_node_id, 0))], next_pos()),
);
responses.push_back(

View File

@ -1,17 +1,16 @@
use super::{node_properties, FrontendGraphDataType, FrontendNodeType};
use crate::messages::layout::utility_types::layout_widget::LayoutGroup;
use crate::node_graph_executor::NodeGraphExecutor;
use once_cell::sync::Lazy;
use graph_craft::concrete;
use graph_craft::document::value::*;
use graph_craft::document::*;
use graph_craft::imaginate_input::ImaginateSamplingMethod;
use graph_craft::concrete;
use graph_craft::NodeIdentifier;
use graphene_core::raster::{BlendMode, Color, Image, ImageFrame, LuminanceCalculation};
use graphene_core::*;
use once_cell::sync::Lazy;
use std::collections::VecDeque;
#[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"),
},
DocumentNodeType {
name: "Downscale",
name: "Downres",
category: "Ignore",
identifier: NodeImplementation::DocumentNode(NodeNetwork {
inputs: vec![0],
outputs: vec![NodeOutput::new(2, 0)],
nodes: [
DocumentNode {
name: "Downscale".to_string(),
name: "Downres".to_string(),
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(),
},
DocumentNode {
@ -138,7 +137,7 @@ fn static_nodes() -> Vec<DocumentNodeType> {
}),
inputs: vec![DocumentInputType::value("Image", TaggedValue::ImageFrame(ImageFrame::empty()), false)],
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 {
// name: "Input Frame",

View File

@ -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)]
fn downscale(image_frame: ImageFrame) -> ImageFrame {
#[node_macro::node_fn(DownresNode)]
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_height = (image_frame.transform.transform_vector2((0., 1.).into()).length() as usize).min(image_frame.image.height as usize);

View File

@ -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::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]),
#[cfg(feature = "gpu")]
register_node!(graphene_std::executor::MapGpuSingleImageNode<_>, input: Image, params: [String]),