mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-29 23:18:13 +08:00
Chain cache node and Clone to make them usable from the ui (#1032)
Chain cache node and Clone to make it a drop in replacement
This commit is contained in:
+34
-8
@@ -332,6 +332,40 @@ fn static_nodes() -> Vec<DocumentNodeType> {
|
|||||||
}],
|
}],
|
||||||
properties: node_properties::blur_image_properties,
|
properties: node_properties::blur_image_properties,
|
||||||
},
|
},
|
||||||
|
DocumentNodeType {
|
||||||
|
name: "Cache",
|
||||||
|
category: "Structural",
|
||||||
|
identifier: NodeImplementation::DocumentNode(NodeNetwork {
|
||||||
|
inputs: vec![0],
|
||||||
|
outputs: vec![NodeOutput::new(1, 0)],
|
||||||
|
nodes: vec![
|
||||||
|
(
|
||||||
|
0,
|
||||||
|
DocumentNode {
|
||||||
|
name: "CacheNode".to_string(),
|
||||||
|
inputs: vec![NodeInput::Network(concrete!(Image))],
|
||||||
|
implementation: DocumentNodeImplementation::Unresolved(NodeIdentifier::new("graphene_std::memo::CacheNode")),
|
||||||
|
metadata: Default::default(),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
(
|
||||||
|
1,
|
||||||
|
DocumentNode {
|
||||||
|
name: "CloneNode".to_string(),
|
||||||
|
inputs: vec![NodeInput::node(0, 0)],
|
||||||
|
implementation: DocumentNodeImplementation::Unresolved(NodeIdentifier::new("graphene_core::ops::CloneNode<_>")),
|
||||||
|
metadata: Default::default(),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
||||||
|
.into_iter()
|
||||||
|
.collect(),
|
||||||
|
..Default::default()
|
||||||
|
}),
|
||||||
|
inputs: vec![DocumentInputType::value("Image", TaggedValue::Image(Image::empty()), true)],
|
||||||
|
outputs: vec![DocumentOutputType::new("Image", FrontendGraphDataType::Raster)],
|
||||||
|
properties: node_properties::no_properties,
|
||||||
|
},
|
||||||
#[cfg(feature = "gpu")]
|
#[cfg(feature = "gpu")]
|
||||||
DocumentNodeType {
|
DocumentNodeType {
|
||||||
name: "GpuImage",
|
name: "GpuImage",
|
||||||
@@ -373,14 +407,6 @@ fn static_nodes() -> Vec<DocumentNodeType> {
|
|||||||
outputs: vec![DocumentOutputType::new("Image", FrontendGraphDataType::Raster)],
|
outputs: vec![DocumentOutputType::new("Image", FrontendGraphDataType::Raster)],
|
||||||
properties: node_properties::quantize_properties,
|
properties: node_properties::quantize_properties,
|
||||||
},
|
},
|
||||||
DocumentNodeType {
|
|
||||||
name: "Cache",
|
|
||||||
category: "Structural",
|
|
||||||
identifier: NodeImplementation::proto("graphene_std::memo::CacheNode"),
|
|
||||||
inputs: vec![DocumentInputType::value("Image", TaggedValue::Image(Image::empty()), true)],
|
|
||||||
outputs: vec![DocumentOutputType::new("Image", FrontendGraphDataType::Raster)],
|
|
||||||
properties: node_properties::no_properties,
|
|
||||||
},
|
|
||||||
DocumentNodeType {
|
DocumentNodeType {
|
||||||
name: "Invert RGB",
|
name: "Invert RGB",
|
||||||
category: "Image Adjustments",
|
category: "Image Adjustments",
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ pub mod dynamic {
|
|||||||
|
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
|
||||||
pub struct CloneNode<O>(PhantomData<O>);
|
pub struct CloneNode<O>(PhantomData<O>);
|
||||||
impl<'i, O: Clone + 'i> Node<'i, &'i O> for CloneNode<O> {
|
impl<'i, 'n: 'i, O: Clone + 'i> Node<'i, &'n O> for CloneNode<O> {
|
||||||
type Output = O;
|
type Output = O;
|
||||||
fn eval<'s: 'i>(&'s self, input: &'i O) -> Self::Output {
|
fn eval<'s: 'i>(&'s self, input: &'i O) -> Self::Output {
|
||||||
input.clone()
|
input.clone()
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ fn node_registry() -> HashMap<NodeIdentifier, HashMap<NodeIOTypes, NodeConstruct
|
|||||||
register_node!(graphene_core::structural::ConsNode<_, _>, input: &u32, params: [&u32]),
|
register_node!(graphene_core::structural::ConsNode<_, _>, input: &u32, params: [&u32]),
|
||||||
register_node!(graphene_core::ops::AddNode, input: (u32, u32), params: []),
|
register_node!(graphene_core::ops::AddNode, input: (u32, u32), params: []),
|
||||||
register_node!(graphene_core::ops::AddNode, input: (u32, &u32), params: []),
|
register_node!(graphene_core::ops::AddNode, input: (u32, &u32), params: []),
|
||||||
|
register_node!(graphene_core::ops::CloneNode<_>, input: &Image, params: []),
|
||||||
register_node!(graphene_core::ops::AddParameterNode<_>, input: u32, params: [u32]),
|
register_node!(graphene_core::ops::AddParameterNode<_>, input: u32, params: [u32]),
|
||||||
register_node!(graphene_core::ops::AddParameterNode<_>, input: &u32, params: [u32]),
|
register_node!(graphene_core::ops::AddParameterNode<_>, input: &u32, params: [u32]),
|
||||||
register_node!(graphene_core::ops::AddParameterNode<_>, input: u32, params: [&u32]),
|
register_node!(graphene_core::ops::AddParameterNode<_>, input: u32, params: [&u32]),
|
||||||
|
|||||||
Reference in New Issue
Block a user