Improve naming of several proto nodes

This commit is contained in:
Keavon Chambers 2023-12-08 14:50:01 -08:00
parent 747dae3bb6
commit d082b15abb
24 changed files with 288 additions and 303 deletions

View file

@ -536,7 +536,7 @@ def migrate(name, new_name):
"has_primary_output": True, "has_primary_output": True,
"implementation": { "implementation": {
"Unresolved": { "Unresolved": {
"name": "graphene_core::ops::IdNode" "name": "graphene_core::ops::IdentityNode"
} }
}, },
"metadata": { "metadata": {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -64,7 +64,7 @@ impl Default for Document {
DocumentNode { DocumentNode {
name: "EditorApi".to_string(), name: "EditorApi".to_string(),
inputs: vec![NodeInput::Network(concrete!(WasmEditorApi))], inputs: vec![NodeInput::Network(concrete!(WasmEditorApi))],
implementation: DocumentNodeImplementation::Unresolved(NodeIdentifier::new("graphene_core::ops::IdNode")), implementation: DocumentNodeImplementation::Unresolved(NodeIdentifier::new("graphene_core::ops::IdentityNode")),
..Default::default() ..Default::default()
}, },
DocumentNode { DocumentNode {

File diff suppressed because one or more lines are too long

View file

@ -83,7 +83,7 @@ pub enum NodeImplementation {
impl Default for NodeImplementation { impl Default for NodeImplementation {
fn default() -> Self { fn default() -> Self {
Self::ProtoNode(NodeIdentifier::new("graphene_core::ops::IdNode")) Self::ProtoNode(NodeIdentifier::new("graphene_core::ops::IdentityNode"))
} }
} }
@ -146,7 +146,7 @@ fn static_nodes() -> Vec<DocumentNodeBlueprint> {
DocumentNodeBlueprint { DocumentNodeBlueprint {
name: "Boolean", name: "Boolean",
category: "Inputs", category: "Inputs",
identifier: NodeImplementation::proto("graphene_core::ops::IdNode"), identifier: NodeImplementation::proto("graphene_core::ops::IdentityNode"),
inputs: vec![DocumentInputType::value("Bool", TaggedValue::Bool(true), false)], inputs: vec![DocumentInputType::value("Bool", TaggedValue::Bool(true), false)],
outputs: vec![DocumentOutputType::new("Out", FrontendGraphDataType::Boolean)], outputs: vec![DocumentOutputType::new("Out", FrontendGraphDataType::Boolean)],
properties: node_properties::boolean_properties, properties: node_properties::boolean_properties,
@ -155,7 +155,7 @@ fn static_nodes() -> Vec<DocumentNodeBlueprint> {
DocumentNodeBlueprint { DocumentNodeBlueprint {
name: "Number", name: "Number",
category: "Inputs", category: "Inputs",
identifier: NodeImplementation::proto("graphene_core::ops::IdNode"), identifier: NodeImplementation::proto("graphene_core::ops::IdentityNode"),
inputs: vec![DocumentInputType::value("Number", TaggedValue::F32(0.), false)], inputs: vec![DocumentInputType::value("Number", TaggedValue::F32(0.), false)],
outputs: vec![DocumentOutputType::new("Out", FrontendGraphDataType::Number)], outputs: vec![DocumentOutputType::new("Out", FrontendGraphDataType::Number)],
properties: node_properties::number_properties, properties: node_properties::number_properties,
@ -164,7 +164,7 @@ fn static_nodes() -> Vec<DocumentNodeBlueprint> {
DocumentNodeBlueprint { DocumentNodeBlueprint {
name: "Color", name: "Color",
category: "Inputs", category: "Inputs",
identifier: NodeImplementation::proto("graphene_core::ops::IdNode"), identifier: NodeImplementation::proto("graphene_core::ops::IdentityNode"),
inputs: vec![DocumentInputType::value("Color", TaggedValue::OptionalColor(None), false)], inputs: vec![DocumentInputType::value("Color", TaggedValue::OptionalColor(None), false)],
outputs: vec![DocumentOutputType::new("Out", FrontendGraphDataType::Color)], outputs: vec![DocumentOutputType::new("Out", FrontendGraphDataType::Color)],
properties: node_properties::color_properties, properties: node_properties::color_properties,
@ -173,7 +173,7 @@ fn static_nodes() -> Vec<DocumentNodeBlueprint> {
DocumentNodeBlueprint { DocumentNodeBlueprint {
name: "Identity", name: "Identity",
category: "Structural", category: "Structural",
identifier: NodeImplementation::proto("graphene_core::ops::IdNode"), identifier: NodeImplementation::proto("graphene_core::ops::IdentityNode"),
inputs: vec![DocumentInputType { inputs: vec![DocumentInputType {
name: "In", name: "In",
data_type: FrontendGraphDataType::General, data_type: FrontendGraphDataType::General,
@ -186,7 +186,7 @@ fn static_nodes() -> Vec<DocumentNodeBlueprint> {
DocumentNodeBlueprint { DocumentNodeBlueprint {
name: "Monitor", name: "Monitor",
category: "Structural", category: "Structural",
identifier: NodeImplementation::proto("graphene_core::ops::IdNode"), identifier: NodeImplementation::proto("graphene_core::ops::IdentityNode"),
inputs: vec![DocumentInputType { inputs: vec![DocumentInputType {
name: "In", name: "In",
data_type: FrontendGraphDataType::General, data_type: FrontendGraphDataType::General,
@ -504,7 +504,7 @@ fn static_nodes() -> Vec<DocumentNodeBlueprint> {
DocumentNode { DocumentNode {
name: "EditorApi".to_string(), name: "EditorApi".to_string(),
inputs: vec![NodeInput::Network(concrete!(WasmEditorApi))], inputs: vec![NodeInput::Network(concrete!(WasmEditorApi))],
implementation: DocumentNodeImplementation::Unresolved(NodeIdentifier::new("graphene_core::ops::IdNode")), implementation: DocumentNodeImplementation::Unresolved(NodeIdentifier::new("graphene_core::ops::IdentityNode")),
..Default::default() ..Default::default()
}, },
DocumentNode { DocumentNode {
@ -731,7 +731,7 @@ fn static_nodes() -> Vec<DocumentNodeBlueprint> {
DocumentNodeBlueprint { DocumentNodeBlueprint {
name: "Color Channel", name: "Color Channel",
category: "Image Adjustments", category: "Image Adjustments",
identifier: NodeImplementation::proto("graphene_core::ops::IdNode"), identifier: NodeImplementation::proto("graphene_core::ops::IdentityNode"),
inputs: vec![DocumentInputType::value("Channel", TaggedValue::RedGreenBlue(RedGreenBlue::Red), false)], inputs: vec![DocumentInputType::value("Channel", TaggedValue::RedGreenBlue(RedGreenBlue::Red), false)],
outputs: vec![DocumentOutputType::new("Out", FrontendGraphDataType::General)], outputs: vec![DocumentOutputType::new("Out", FrontendGraphDataType::General)],
properties: node_properties::color_channel_properties, properties: node_properties::color_channel_properties,
@ -740,7 +740,7 @@ fn static_nodes() -> Vec<DocumentNodeBlueprint> {
DocumentNodeBlueprint { DocumentNodeBlueprint {
name: "Blend Mode Value", name: "Blend Mode Value",
category: "Inputs", category: "Inputs",
identifier: NodeImplementation::proto("graphene_core::ops::IdNode"), identifier: NodeImplementation::proto("graphene_core::ops::IdentityNode"),
inputs: vec![DocumentInputType::value("Blend Mode", TaggedValue::BlendMode(BlendMode::Normal), false)], inputs: vec![DocumentInputType::value("Blend Mode", TaggedValue::BlendMode(BlendMode::Normal), false)],
outputs: vec![DocumentOutputType::new("Out", FrontendGraphDataType::General)], outputs: vec![DocumentOutputType::new("Out", FrontendGraphDataType::General)],
properties: node_properties::blend_mode_value_properties, properties: node_properties::blend_mode_value_properties,
@ -799,7 +799,7 @@ fn static_nodes() -> Vec<DocumentNodeBlueprint> {
DocumentNode { DocumentNode {
name: "Identity".to_string(), name: "Identity".to_string(),
inputs: vec![NodeInput::Network(concrete!(ImageFrame<Color>))], inputs: vec![NodeInput::Network(concrete!(ImageFrame<Color>))],
implementation: DocumentNodeImplementation::Unresolved(NodeIdentifier::new("graphene_core::ops::IdNode")), implementation: DocumentNodeImplementation::Unresolved(NodeIdentifier::new("graphene_core::ops::IdentityNode")),
..Default::default() ..Default::default()
}, },
DocumentNode { DocumentNode {
@ -883,7 +883,7 @@ fn static_nodes() -> Vec<DocumentNodeBlueprint> {
DocumentNodeBlueprint { DocumentNodeBlueprint {
name: "Image", name: "Image",
category: "Ignore", category: "Ignore",
identifier: NodeImplementation::proto("graphene_core::ops::IdNode"), identifier: NodeImplementation::proto("graphene_core::ops::IdentityNode"),
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("A bitmap image embedded in this node"), properties: |_document_node, _node_id, _context| node_properties::string_properties("A bitmap image embedded in this node"),
@ -1742,7 +1742,7 @@ fn static_nodes() -> Vec<DocumentNodeBlueprint> {
DocumentNodeBlueprint { DocumentNodeBlueprint {
name: "Add", name: "Add",
category: "Math", category: "Math",
identifier: NodeImplementation::proto("graphene_core::ops::AddParameterNode<_>"), identifier: NodeImplementation::proto("graphene_core::ops::AddNode<_>"),
inputs: vec![ inputs: vec![
DocumentInputType::value("Primary", TaggedValue::F32(0.), true), DocumentInputType::value("Primary", TaggedValue::F32(0.), true),
DocumentInputType::value("Addend", TaggedValue::F32(0.), false), DocumentInputType::value("Addend", TaggedValue::F32(0.), false),
@ -1754,7 +1754,7 @@ fn static_nodes() -> Vec<DocumentNodeBlueprint> {
DocumentNodeBlueprint { DocumentNodeBlueprint {
name: "Subtract", name: "Subtract",
category: "Math", category: "Math",
identifier: NodeImplementation::proto("graphene_core::ops::AddParameterNode<_>"), identifier: NodeImplementation::proto("graphene_core::ops::AddNode<_>"),
inputs: vec![ inputs: vec![
DocumentInputType::value("Primary", TaggedValue::F32(0.), true), DocumentInputType::value("Primary", TaggedValue::F32(0.), true),
DocumentInputType::value("Subtrahend", TaggedValue::F32(0.), false), DocumentInputType::value("Subtrahend", TaggedValue::F32(0.), false),
@ -1766,7 +1766,7 @@ fn static_nodes() -> Vec<DocumentNodeBlueprint> {
DocumentNodeBlueprint { DocumentNodeBlueprint {
name: "Divide", name: "Divide",
category: "Math", category: "Math",
identifier: NodeImplementation::proto("graphene_core::ops::DivideParameterNode<_>"), identifier: NodeImplementation::proto("graphene_core::ops::DivideNode<_>"),
inputs: vec![ inputs: vec![
DocumentInputType::value("Primary", TaggedValue::F32(0.), true), DocumentInputType::value("Primary", TaggedValue::F32(0.), true),
DocumentInputType::value("Divisor", TaggedValue::F32(0.), false), DocumentInputType::value("Divisor", TaggedValue::F32(0.), false),
@ -1778,7 +1778,7 @@ fn static_nodes() -> Vec<DocumentNodeBlueprint> {
DocumentNodeBlueprint { DocumentNodeBlueprint {
name: "Multiply", name: "Multiply",
category: "Math", category: "Math",
identifier: NodeImplementation::proto("graphene_core::ops::MultiplyParameterNode<_>"), identifier: NodeImplementation::proto("graphene_core::ops::MultiplyNode<_>"),
inputs: vec![ inputs: vec![
DocumentInputType::value("Primary", TaggedValue::F32(0.), true), DocumentInputType::value("Primary", TaggedValue::F32(0.), true),
DocumentInputType::value("Multiplicand", TaggedValue::F32(0.), false), DocumentInputType::value("Multiplicand", TaggedValue::F32(0.), false),
@ -1790,7 +1790,7 @@ fn static_nodes() -> Vec<DocumentNodeBlueprint> {
DocumentNodeBlueprint { DocumentNodeBlueprint {
name: "Exponent", name: "Exponent",
category: "Math", category: "Math",
identifier: NodeImplementation::proto("graphene_core::ops::ExponentParameterNode<_>"), identifier: NodeImplementation::proto("graphene_core::ops::ExponentNode<_>"),
inputs: vec![ inputs: vec![
DocumentInputType::value("Primary", TaggedValue::F32(0.), true), DocumentInputType::value("Primary", TaggedValue::F32(0.), true),
DocumentInputType::value("Power", TaggedValue::F32(0.), false), DocumentInputType::value("Power", TaggedValue::F32(0.), false),
@ -1811,7 +1811,7 @@ fn static_nodes() -> Vec<DocumentNodeBlueprint> {
DocumentNodeBlueprint { DocumentNodeBlueprint {
name: "Ceil", name: "Ceil",
category: "Math", category: "Math",
identifier: NodeImplementation::proto("graphene_core::ops::CeilNode"), identifier: NodeImplementation::proto("graphene_core::ops::CeilingNode"),
inputs: vec![DocumentInputType::value("Primary", TaggedValue::F32(0.), true)], inputs: vec![DocumentInputType::value("Primary", TaggedValue::F32(0.), true)],
outputs: vec![DocumentOutputType::new("Output", FrontendGraphDataType::Number)], outputs: vec![DocumentOutputType::new("Output", FrontendGraphDataType::Number)],
properties: node_properties::node_no_properties, properties: node_properties::node_no_properties,
@ -1829,7 +1829,7 @@ fn static_nodes() -> Vec<DocumentNodeBlueprint> {
DocumentNodeBlueprint { DocumentNodeBlueprint {
name: "Absolute Value", name: "Absolute Value",
category: "Math", category: "Math",
identifier: NodeImplementation::proto("graphene_core::ops::AbsoluteNode"), identifier: NodeImplementation::proto("graphene_core::ops::AbsoluteValue"),
inputs: vec![DocumentInputType::value("Primary", TaggedValue::F32(0.), true)], inputs: vec![DocumentInputType::value("Primary", TaggedValue::F32(0.), true)],
outputs: vec![DocumentOutputType::new("Output", FrontendGraphDataType::Number)], outputs: vec![DocumentOutputType::new("Output", FrontendGraphDataType::Number)],
properties: node_properties::node_no_properties, properties: node_properties::node_no_properties,
@ -1838,7 +1838,7 @@ fn static_nodes() -> Vec<DocumentNodeBlueprint> {
DocumentNodeBlueprint { DocumentNodeBlueprint {
name: "Logarithm", name: "Logarithm",
category: "Math", category: "Math",
identifier: NodeImplementation::proto("graphene_core::ops::LogParameterNode<_>"), identifier: NodeImplementation::proto("graphene_core::ops::LogarithmNode<_>"),
inputs: vec![ inputs: vec![
DocumentInputType::value("Primary", TaggedValue::F32(0.), true), DocumentInputType::value("Primary", TaggedValue::F32(0.), true),
DocumentInputType::value("Base", TaggedValue::F32(0.), true), DocumentInputType::value("Base", TaggedValue::F32(0.), true),
@ -1850,7 +1850,7 @@ fn static_nodes() -> Vec<DocumentNodeBlueprint> {
DocumentNodeBlueprint { DocumentNodeBlueprint {
name: "Natural Logarithm", name: "Natural Logarithm",
category: "Math", category: "Math",
identifier: NodeImplementation::proto("graphene_core::ops::NaturalLogNode"), identifier: NodeImplementation::proto("graphene_core::ops::NaturalLogarithmNode"),
inputs: vec![DocumentInputType::value("Primary", TaggedValue::F32(0.), true)], inputs: vec![DocumentInputType::value("Primary", TaggedValue::F32(0.), true)],
outputs: vec![DocumentOutputType::new("Output", FrontendGraphDataType::Number)], outputs: vec![DocumentOutputType::new("Output", FrontendGraphDataType::Number)],
properties: node_properties::node_no_properties, properties: node_properties::node_no_properties,
@ -1886,7 +1886,7 @@ fn static_nodes() -> Vec<DocumentNodeBlueprint> {
DocumentNodeBlueprint { DocumentNodeBlueprint {
name: "Max", name: "Max",
category: "Math", category: "Math",
identifier: NodeImplementation::proto("graphene_core::ops::MaxParameterNode<_>"), identifier: NodeImplementation::proto("graphene_core::ops::MaximumNode<_>"),
inputs: vec![ inputs: vec![
DocumentInputType::value("Operand A", TaggedValue::F32(0.), true), DocumentInputType::value("Operand A", TaggedValue::F32(0.), true),
DocumentInputType::value("Operand B", TaggedValue::F32(0.), true), DocumentInputType::value("Operand B", TaggedValue::F32(0.), true),
@ -1898,7 +1898,7 @@ fn static_nodes() -> Vec<DocumentNodeBlueprint> {
DocumentNodeBlueprint { DocumentNodeBlueprint {
name: "Min", name: "Min",
category: "Math", category: "Math",
identifier: NodeImplementation::proto("graphene_core::ops::MinParameterNode<_>"), identifier: NodeImplementation::proto("graphene_core::ops::MinimumNode<_>"),
inputs: vec![ inputs: vec![
DocumentInputType::value("Operand A", TaggedValue::F32(0.), true), DocumentInputType::value("Operand A", TaggedValue::F32(0.), true),
DocumentInputType::value("Operand B", TaggedValue::F32(0.), true), DocumentInputType::value("Operand B", TaggedValue::F32(0.), true),
@ -1910,7 +1910,7 @@ fn static_nodes() -> Vec<DocumentNodeBlueprint> {
DocumentNodeBlueprint { DocumentNodeBlueprint {
name: "Equals", name: "Equals",
category: "Math", category: "Math",
identifier: NodeImplementation::proto("graphene_core::ops::EqParameterNode<_>"), identifier: NodeImplementation::proto("graphene_core::ops::EqualsNode<_>"),
inputs: vec![ inputs: vec![
DocumentInputType::value("Operand A", TaggedValue::F32(0.), true), DocumentInputType::value("Operand A", TaggedValue::F32(0.), true),
DocumentInputType::value("Operand B", TaggedValue::F32(0.), true), DocumentInputType::value("Operand B", TaggedValue::F32(0.), true),
@ -1922,7 +1922,7 @@ fn static_nodes() -> Vec<DocumentNodeBlueprint> {
DocumentNodeBlueprint { DocumentNodeBlueprint {
name: "Modulo", name: "Modulo",
category: "Math", category: "Math",
identifier: NodeImplementation::proto("graphene_core::ops::ModuloParameterNode<_>"), identifier: NodeImplementation::proto("graphene_core::ops::ModuloNode<_>"),
inputs: vec![ inputs: vec![
DocumentInputType::value("Primary", TaggedValue::F32(0.), true), DocumentInputType::value("Primary", TaggedValue::F32(0.), true),
DocumentInputType::value("Modulus", TaggedValue::F32(0.), false), DocumentInputType::value("Modulus", TaggedValue::F32(0.), false),

View file

@ -6,27 +6,27 @@ use num_traits::Pow;
#[cfg(target_arch = "spirv")] #[cfg(target_arch = "spirv")]
use spirv_std::num_traits::float::Float; use spirv_std::num_traits::float::Float;
// Add // Add Pair
// TODO: Delete this redundant (two-argument version of the) add node. It's only used in tests.
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub struct AddNode; pub struct AddPairNode;
impl<'i, L: Add<R, Output = O> + 'i, R: 'i, O: 'i> Node<'i, (L, R)> for AddPairNode {
impl<'i, L: Add<R, Output = O> + 'i, R: 'i, O: 'i> Node<'i, (L, R)> for AddNode {
type Output = <L as Add<R>>::Output; type Output = <L as Add<R>>::Output;
fn eval(&'i self, input: (L, R)) -> Self::Output { fn eval(&'i self, input: (L, R)) -> Self::Output {
input.0 + input.1 input.0 + input.1
} }
} }
impl AddPairNode {
impl AddNode {
pub const fn new() -> Self { pub const fn new() -> Self {
Self Self
} }
} }
pub struct AddParameterNode<Second> {
// Add
pub struct AddNode<Second> {
second: Second, second: Second,
} }
#[node_macro::node_fn(AddNode)]
#[node_macro::node_fn(AddParameterNode)]
fn add_parameter<U, T>(first: U, second: T) -> <U as Add<T>>::Output fn add_parameter<U, T>(first: U, second: T) -> <U as Add<T>>::Output
where where
U: Add<T>, U: Add<T>,
@ -35,11 +35,10 @@ where
} }
// Subtract // Subtract
pub struct SubtractParameterNode<Second> { pub struct SubtractNode<Second> {
second: Second, second: Second,
} }
#[node_macro::node_fn(SubtractNode)]
#[node_macro::node_fn(SubtractParameterNode)]
fn sub<U, T>(first: U, second: T) -> <U as Sub<T>>::Output fn sub<U, T>(first: U, second: T) -> <U as Sub<T>>::Output
where where
U: Sub<T>, U: Sub<T>,
@ -48,11 +47,10 @@ where
} }
// Divide // Divide
pub struct DivideParameterNode<Second> { pub struct DivideNode<Second> {
second: Second, second: Second,
} }
#[node_macro::node_fn(DivideNode)]
#[node_macro::node_fn(DivideParameterNode)]
fn div<U, T>(first: U, second: T) -> <U as Div<T>>::Output fn div<U, T>(first: U, second: T) -> <U as Div<T>>::Output
where where
U: Div<T>, U: Div<T>,
@ -61,11 +59,10 @@ where
} }
// Multiply // Multiply
pub struct MultiplyParameterNode<Second> { pub struct MultiplyNode<Second> {
second: Second, second: Second,
} }
#[node_macro::node_fn(MultiplyNode)]
#[node_macro::node_fn(MultiplyParameterNode)]
fn mul<U, T>(first: U, second: T) -> <U as Mul<T>>::Output fn mul<U, T>(first: U, second: T) -> <U as Mul<T>>::Output
where where
U: Mul<T>, U: Mul<T>,
@ -74,11 +71,10 @@ where
} }
// Exponent // Exponent
pub struct ExponentParameterNode<Second> { pub struct ExponentNode<Second> {
second: Second, second: Second,
} }
#[node_macro::node_fn(ExponentNode)]
#[node_macro::node_fn(ExponentParameterNode)]
fn exp<U, T>(first: U, second: T) -> <U as Pow<T>>::Output fn exp<U, T>(first: U, second: T) -> <U as Pow<T>>::Output
where where
U: Pow<T>, U: Pow<T>,
@ -88,84 +84,74 @@ where
// Floor // Floor
pub struct FloorNode; pub struct FloorNode;
#[node_macro::node_fn(FloorNode)] #[node_macro::node_fn(FloorNode)]
fn floor(input: f32) -> f32 { fn floor(input: f32) -> f32 {
input.floor() input.floor()
} }
// Ceil // Ceil
pub struct CeilNode; pub struct CeilingNode;
#[node_macro::node_fn(CeilingNode)]
#[node_macro::node_fn(CeilNode)]
fn ceil(input: f32) -> f32 { fn ceil(input: f32) -> f32 {
input.ceil() input.ceil()
} }
// Round // Round
pub struct RoundNode; pub struct RoundNode;
#[node_macro::node_fn(RoundNode)] #[node_macro::node_fn(RoundNode)]
fn round(input: f32) -> f32 { fn round(input: f32) -> f32 {
input.round() input.round()
} }
// Absolute Value // Absolute Value
pub struct AbsoluteNode; pub struct AbsoluteValue;
#[node_macro::node_fn(AbsoluteValue)]
#[node_macro::node_fn(AbsoluteNode)]
fn abs(input: f32) -> f32 { fn abs(input: f32) -> f32 {
input.abs() input.abs()
} }
// Log // Log
pub struct LogParameterNode<Second> { pub struct LogarithmNode<Second> {
second: Second, second: Second,
} }
#[node_macro::node_fn(LogarithmNode)]
#[node_macro::node_fn(LogParameterNode)]
fn ln<U: num_traits::float::Float>(first: U, second: U) -> U { fn ln<U: num_traits::float::Float>(first: U, second: U) -> U {
first.log(second) first.log(second)
} }
// Natural Log // Natural Log
pub struct NaturalLogNode; pub struct NaturalLogarithmNode;
#[node_macro::node_fn(NaturalLogarithmNode)]
#[node_macro::node_fn(NaturalLogNode)]
fn ln(input: f32) -> f32 { fn ln(input: f32) -> f32 {
input.ln() input.ln()
} }
// Sine // Sine
pub struct SineNode; pub struct SineNode;
#[node_macro::node_fn(SineNode)] #[node_macro::node_fn(SineNode)]
fn ln(input: f32) -> f32 { fn ln(input: f32) -> f32 {
input.sin() input.sin()
} }
// Cos // Cosine
pub struct CosineNode; pub struct CosineNode;
#[node_macro::node_fn(CosineNode)] #[node_macro::node_fn(CosineNode)]
fn ln(input: f32) -> f32 { fn ln(input: f32) -> f32 {
input.cos() input.cos()
} }
// Tan // Tangent
pub struct TangentNode; pub struct TangentNode;
#[node_macro::node_fn(TangentNode)] #[node_macro::node_fn(TangentNode)]
fn ln(input: f32) -> f32 { fn ln(input: f32) -> f32 {
input.tan() input.tan()
} }
// Minimum // Min
pub struct MinParameterNode<Second> { pub struct MinimumNode<Second> {
second: Second, second: Second,
} }
#[node_macro::node_fn(MinimumNode)]
#[node_macro::node_fn(MinParameterNode)]
fn min<T: core::cmp::PartialOrd>(first: T, second: T) -> T { fn min<T: core::cmp::PartialOrd>(first: T, second: T) -> T {
match first < second { match first < second {
true => first, true => first,
@ -173,12 +159,11 @@ fn min<T: core::cmp::PartialOrd>(first: T, second: T) -> T {
} }
} }
// Maximum // Maxi
pub struct MaxParameterNode<Second> { pub struct MaximumNode<Second> {
second: Second, second: Second,
} }
#[node_macro::node_fn(MaximumNode)]
#[node_macro::node_fn(MaxParameterNode)]
fn max<T: core::cmp::PartialOrd>(first: T, second: T) -> T { fn max<T: core::cmp::PartialOrd>(first: T, second: T) -> T {
match first > second { match first > second {
true => first, true => first,
@ -187,21 +172,19 @@ fn max<T: core::cmp::PartialOrd>(first: T, second: T) -> T {
} }
// Equals // Equals
pub struct EqParameterNode<Second> { pub struct EqualsNode<Second> {
second: Second, second: Second,
} }
#[node_macro::node_fn(EqualsNode)]
#[node_macro::node_fn(EqParameterNode)]
fn eq<T: core::cmp::PartialEq>(first: T, second: T) -> bool { fn eq<T: core::cmp::PartialEq>(first: T, second: T) -> bool {
first == second first == second
} }
// Modulo // Modulo
pub struct ModuloParameterNode<Second> { pub struct ModuloNode<Second> {
second: Second, second: Second,
} }
#[node_macro::node_fn(ModuloNode)]
#[node_macro::node_fn(ModuloParameterNode)]
fn modulo<U, T>(first: U, second: T) -> <U as Rem<T>>::Output fn modulo<U, T>(first: U, second: T) -> <U as Rem<T>>::Output
where where
U: Rem<T>, U: Rem<T>,
@ -209,15 +192,16 @@ where
first % second first % second
} }
// Size Of
#[cfg(feature = "std")] #[cfg(feature = "std")]
struct SizeOfNode {} struct SizeOfNode;
#[cfg(feature = "std")] #[cfg(feature = "std")]
#[node_macro::node_fn(SizeOfNode)] #[node_macro::node_fn(SizeOfNode)]
fn flat_map(ty: crate::Type) -> Option<usize> { fn flat_map(ty: crate::Type) -> Option<usize> {
ty.size() ty.size()
} }
// Some
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub struct SomeNode; pub struct SomeNode;
#[node_macro::node_fn(SomeNode)] #[node_macro::node_fn(SomeNode)]
@ -225,6 +209,7 @@ fn some<T>(input: T) -> Option<T> {
Some(input) Some(input)
} }
// Clone
#[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, 'n: 'i, O: Clone + 'i> Node<'i, &'n O> for CloneNode<O> { impl<'i, 'n: 'i, O: Clone + 'i> Node<'i, &'n O> for CloneNode<O> {
@ -239,82 +224,87 @@ impl<O> CloneNode<O> {
} }
} }
// First of Pair
/// Return the first element of a 2-tuple
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub struct FstNode; pub struct FirstOfPairNode;
impl<'i, L: 'i, R: 'i> Node<'i, (L, R)> for FstNode { impl<'i, L: 'i, R: 'i> Node<'i, (L, R)> for FirstOfPairNode {
type Output = L; type Output = L;
fn eval(&'i self, input: (L, R)) -> Self::Output { fn eval(&'i self, input: (L, R)) -> Self::Output {
input.0 input.0
} }
} }
impl FstNode { impl FirstOfPairNode {
pub fn new() -> Self { pub fn new() -> Self {
Self Self
} }
} }
/// Destructures a Tuple of two values and returns the first one // Second of Pair
/// Return the second element of a 2-tuple
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub struct SndNode; pub struct SecondOfPairNode;
impl<'i, L: 'i, R: 'i> Node<'i, (L, R)> for SndNode { impl<'i, L: 'i, R: 'i> Node<'i, (L, R)> for SecondOfPairNode {
type Output = R; type Output = R;
fn eval(&'i self, input: (L, R)) -> Self::Output { fn eval(&'i self, input: (L, R)) -> Self::Output {
input.1 input.1
} }
} }
impl SndNode { impl SecondOfPairNode {
pub fn new() -> Self { pub fn new() -> Self {
Self Self
} }
} }
/// Destructures a Tuple of two values and returns them in reverse order // Swap Pair
/// Return a new 2-tuple with the elements reversed
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub struct SwapNode; pub struct SwapPairNode;
impl<'i, L: 'i, R: 'i> Node<'i, (L, R)> for SwapNode { impl<'i, L: 'i, R: 'i> Node<'i, (L, R)> for SwapPairNode {
type Output = (R, L); type Output = (R, L);
fn eval(&'i self, input: (L, R)) -> Self::Output { fn eval(&'i self, input: (L, R)) -> Self::Output {
(input.1, input.0) (input.1, input.0)
} }
} }
impl SwapNode { impl SwapPairNode {
pub fn new() -> Self { pub fn new() -> Self {
Self Self
} }
} }
/// Return a tuple with two instances of the input argument // Make Pair
/// Return a 2-tuple with two duplicates of the input argument
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub struct DupNode; pub struct MakePairNode;
impl<'i, O: Clone + 'i> Node<'i, O> for DupNode { impl<'i, O: Clone + 'i> Node<'i, O> for MakePairNode {
type Output = (O, O); type Output = (O, O);
fn eval(&'i self, input: O) -> Self::Output { fn eval(&'i self, input: O) -> Self::Output {
(input.clone(), input) (input.clone(), input)
} }
} }
impl DupNode { impl MakePairNode {
pub fn new() -> Self { pub fn new() -> Self {
Self Self
} }
} }
/// Return the Input Argument // Identity
/// Return the input argument unchanged
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub struct IdNode; pub struct IdentityNode;
impl<'i, O: 'i> Node<'i, O> for IdNode { impl<'i, O: 'i> Node<'i, O> for IdentityNode {
type Output = O; type Output = O;
fn eval(&'i self, input: O) -> Self::Output { fn eval(&'i self, input: O) -> Self::Output {
input input
} }
} }
impl IdentityNode {
impl IdNode {
pub fn new() -> Self { pub fn new() -> Self {
Self Self
} }
} }
/// Ascribe the node types // Type
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub struct TypeNode<N: for<'a> Node<'a, I>, I, O>(pub N, pub PhantomData<(I, O)>); pub struct TypeNode<N: for<'a> Node<'a, I>, I, O>(pub N, pub PhantomData<(I, O)>);
impl<'i, N, I: 'i, O: 'i> Node<'i, I> for TypeNode<N, I, O> impl<'i, N, I: 'i, O: 'i> Node<'i, I> for TypeNode<N, I, O>
@ -326,13 +316,11 @@ where
self.0.eval(input) self.0.eval(input)
} }
} }
impl<'i, N: for<'a> Node<'a, I>, I: 'i> TypeNode<N, I, <N as Node<'i, I>>::Output> { impl<'i, N: for<'a> Node<'a, I>, I: 'i> TypeNode<N, I, <N as Node<'i, I>>::Output> {
pub fn new(node: N) -> Self { pub fn new(node: N) -> Self {
Self(node, PhantomData) Self(node, PhantomData)
} }
} }
impl<'i, N: for<'a> Node<'a, I> + Clone, I: 'i> Clone for TypeNode<N, I, <N as Node<'i, I>>::Output> { impl<'i, N: for<'a> Node<'a, I> + Clone, I: 'i> Clone for TypeNode<N, I, <N as Node<'i, I>>::Output> {
fn clone(&self) -> Self { fn clone(&self) -> Self {
Self(self.0.clone(), self.1) Self(self.0.clone(), self.1)
@ -340,13 +328,12 @@ impl<'i, N: for<'a> Node<'a, I> + Clone, I: 'i> Clone for TypeNode<N, I, <N as N
} }
impl<'i, N: for<'a> Node<'a, I> + Copy, I: 'i> Copy for TypeNode<N, I, <N as Node<'i, I>>::Output> {} impl<'i, N: for<'a> Node<'a, I> + Copy, I: 'i> Copy for TypeNode<N, I, <N as Node<'i, I>>::Output> {}
/// input.map(|x| self.0.eval(x)) // Map Result
pub struct MapResultNode<I, E, Mn> { pub struct MapResultNode<I, E, Mn> {
node: Mn, node: Mn,
_i: PhantomData<I>, _i: PhantomData<I>,
_e: PhantomData<E>, _e: PhantomData<E>,
} }
#[node_macro::node_fn(MapResultNode<_I, _E>)] #[node_macro::node_fn(MapResultNode<_I, _E>)]
fn flat_map<_I, _E, N>(input: Result<_I, _E>, node: &'input N) -> Result<<N as Node<'input, _I>>::Output, _E> fn flat_map<_I, _E, N>(input: Result<_I, _E>, node: &'input N) -> Result<<N as Node<'input, _I>>::Output, _E>
where where
@ -354,13 +341,14 @@ where
{ {
input.map(|x| node.eval(x)) input.map(|x| node.eval(x))
} }
// Flat Map Result
pub struct FlatMapResultNode<I, O, E, Mn> { pub struct FlatMapResultNode<I, O, E, Mn> {
node: Mn, node: Mn,
_i: PhantomData<I>, _i: PhantomData<I>,
_o: PhantomData<O>, _o: PhantomData<O>,
_e: PhantomData<E>, _e: PhantomData<E>,
} }
#[node_macro::node_fn(FlatMapResultNode<_I, _O, _E>)] #[node_macro::node_fn(FlatMapResultNode<_I, _O, _E>)]
fn flat_map<_I, _O, _E, N>(input: Result<_I, _E>, node: &'input N) -> Result<_O, _E> fn flat_map<_I, _O, _E, N>(input: Result<_I, _E>, node: &'input N) -> Result<_O, _E>
where where
@ -373,6 +361,7 @@ where
} }
} }
// Into
pub struct IntoNode<I, O> { pub struct IntoNode<I, O> {
_i: PhantomData<I>, _i: PhantomData<I>,
_o: PhantomData<O>, _o: PhantomData<O>,
@ -392,14 +381,14 @@ mod test {
use crate::{generic::*, structural::*, value::*}; use crate::{generic::*, structural::*, value::*};
#[test] #[test]
pub fn dup_node() { pub fn duplicate_node() {
let value = ValueNode(4u32); let value = ValueNode(4u32);
let dup = ComposeNode::new(value, DupNode::new()); let pair = ComposeNode::new(value, MakePairNode::new());
assert_eq!(dup.eval(()), (&4, &4)); assert_eq!(pair.eval(()), (&4, &4));
} }
#[test] #[test]
pub fn id_node() { pub fn identity_node() {
let value = ValueNode(4u32).then(IdNode::new()); let value = ValueNode(4u32).then(IdentityNode::new());
assert_eq!(value.eval(()), &4); assert_eq!(value.eval(()), &4);
} }
#[test] #[test]
@ -412,19 +401,19 @@ mod test {
assert_eq!(type_erased.eval(()), 4); assert_eq!(type_erased.eval(()), 4);
} }
#[test] #[test]
pub fn fst_node() { pub fn first_node() {
let fst = ValueNode((4u32, "a")).then(CloneNode::new()).then(FstNode::new()); let first_of_pair = ValueNode((4u32, "a")).then(CloneNode::new()).then(FirstOfPairNode::new());
assert_eq!(fst.eval(()), 4); assert_eq!(first_of_pair.eval(()), 4);
} }
#[test] #[test]
pub fn snd_node() { pub fn second_node() {
let fst = ValueNode((4u32, "a")).then(CloneNode::new()).then(SndNode::new()); let second_of_pair = ValueNode((4u32, "a")).then(CloneNode::new()).then(SecondOfPairNode::new());
assert_eq!(fst.eval(()), "a"); assert_eq!(second_of_pair.eval(()), "a");
} }
#[test] #[test]
pub fn object_safe() { pub fn object_safe() {
let fst = ValueNode((4u32, "a")).then(CloneNode::new()).then(SndNode::new()); let second_of_pair = ValueNode((4u32, "a")).then(CloneNode::new()).then(SecondOfPairNode::new());
let foo = &fst as &dyn Node<(), Output = &str>; let foo = &second_of_pair as &dyn Node<(), Output = &str>;
assert_eq!(foo.eval(()), "a"); assert_eq!(foo.eval(()), "a");
} }
#[test] #[test]
@ -455,7 +444,7 @@ mod test {
let cons_a = ConsNode::new(a); let cons_a = ConsNode::new(a);
let tuple = b.then(cons_a); let tuple = b.then(cons_a);
let sum = tuple.then(AddNode::new()); let sum = tuple.then(AddPairNode::new());
assert_eq!(sum.eval(()), 48); assert_eq!(sum.eval(()), 48);
} }

View file

@ -486,13 +486,13 @@ impl<'a, P: Copy> Iterator for ImageWindowIterator<'a, P> {
} }
#[derive(Debug)] #[derive(Debug)]
pub struct MapSndNode<First, Second, MapFn> { pub struct MapSecondNode<First, Second, MapFn> {
map_fn: MapFn, map_fn: MapFn,
_first: PhantomData<First>, _first: PhantomData<First>,
_second: PhantomData<Second>, _second: PhantomData<Second>,
} }
#[node_macro::node_fn(MapSndNode< _First, _Second>)] #[node_macro::node_fn(MapSecondNode< _First, _Second>)]
fn map_snd_node<MapFn, _First, _Second>(input: (_First, _Second), map_fn: &'input MapFn) -> (_First, <MapFn as Node<'input, _Second>>::Output) fn map_snd_node<MapFn, _First, _Second>(input: (_First, _Second), map_fn: &'input MapFn) -> (_First, <MapFn as Node<'input, _Second>>::Output)
where where
MapFn: for<'any_input> Node<'any_input, _Second>, MapFn: for<'any_input> Node<'any_input, _Second>,
@ -658,49 +658,47 @@ mod test {
} }
// TODO: I can't be bothered to fix this test rn // TODO: I can't be bothered to fix this test rn
/* // #[test]
#[test] // fn blur_node() {
fn blur_node() { // use alloc::vec;
use alloc::vec; // let radius = ValueNode::new(1u32).then(CloneNode::new());
let radius = ValueNode::new(1u32).then(CloneNode::new()); // let sigma = ValueNode::new(3f64).then(CloneNode::new());
let sigma = ValueNode::new(3f64).then(CloneNode::new()); // let radius = ValueNode::new(1u32).then(CloneNode::new());
let radius = ValueNode::new(1u32).then(CloneNode::new()); // let image = ValueNode::<_>::new(Image {
let image = ValueNode::<_>::new(Image { // width: 5,
width: 5, // height: 5,
height: 5, // data: vec![Color::from_rgbf32_unchecked(1., 0., 0.); 25],
data: vec![Color::from_rgbf32_unchecked(1., 0., 0.); 25], // });
}); // let image = image.then(ImageRefNode::new());
let image = image.then(ImageRefNode::new()); // let window = WindowNode::new(radius, image);
let window = WindowNode::new(radius, image); // let window: TypeNode<_, u32, ImageWindowIterator<'_>> = TypeNode::new(window);
let window: TypeNode<_, u32, ImageWindowIterator<'_>> = TypeNode::new(window); // let distance = ValueNode::new(DistanceNode::new());
let distance = ValueNode::new(DistanceNode::new()); // let pos_to_dist = MapSecondNode::new(distance);
let pos_to_dist = MapSndNode::new(distance); // let type_erased = &window as &dyn for<'a> Node<'a, u32, Output = ImageWindowIterator<'a>>;
let type_erased = &window as &dyn for<'a> Node<'a, u32, Output = ImageWindowIterator<'a>>; // type_erased.eval(0);
type_erased.eval(0); // let map_pos_to_dist = MapNode::new(ValueNode::new(pos_to_dist));
let map_pos_to_dist = MapNode::new(ValueNode::new(pos_to_dist));
let type_erased = &map_pos_to_dist as &dyn for<'a> Node<'a, u32, Output = ImageWindowIterator<'a>>; // let type_erased = &map_pos_to_dist as &dyn for<'a> Node<'a, u32, Output = ImageWindowIterator<'a>>;
type_erased.eval(0); // type_erased.eval(0);
let distance = window.then(map_pos_to_dist); // let distance = window.then(map_pos_to_dist);
let map_gaussian = MapSndNode::new(ValueNode(GaussianNode::new(sigma))); // let map_gaussian = MapSecondNode::new(ValueNode(GaussianNode::new(sigma)));
let map_gaussian: TypeNode<_, (_, f32), (_, f32)> = TypeNode::new(map_gaussian); // let map_gaussian: TypeNode<_, (_, f32), (_, f32)> = TypeNode::new(map_gaussian);
let map_gaussian = ValueNode(map_gaussian); // let map_gaussian = ValueNode(map_gaussian);
let map_gaussian: TypeNode<_, (), &_> = TypeNode::new(map_gaussian); // let map_gaussian: TypeNode<_, (), &_> = TypeNode::new(map_gaussian);
let map_distances = MapNode::new(map_gaussian); // let map_distances = MapNode::new(map_gaussian);
let map_distances: TypeNode<_, _, MapFnIterator<'_, '_, _, _>> = TypeNode::new(map_distances); // let map_distances: TypeNode<_, _, MapFnIterator<'_, '_, _, _>> = TypeNode::new(map_distances);
let gaussian_iter = distance.then(map_distances); // let gaussian_iter = distance.then(map_distances);
let avg = gaussian_iter.then(WeightedAvgNode::new()); // let avg = gaussian_iter.then(WeightedAvgNode::new());
let avg: TypeNode<_, u32, Color> = TypeNode::new(avg); // let avg: TypeNode<_, u32, Color> = TypeNode::new(avg);
let blur_iter = MapNode::new(ValueNode::new(avg)); // let blur_iter = MapNode::new(ValueNode::new(avg));
let blur = image.then(ImageIndexIterNode).then(blur_iter); // let blur = image.then(ImageIndexIterNode).then(blur_iter);
let blur: TypeNode<_, (), MapFnIterator<_, _>> = TypeNode::new(blur); // let blur: TypeNode<_, (), MapFnIterator<_, _>> = TypeNode::new(blur);
let collect = CollectNode::new(); // let collect = CollectNode::new();
let vec = collect.eval(0..10); // let vec = collect.eval(0..10);
assert_eq!(vec.len(), 10); // assert_eq!(vec.len(), 10);
let _ = blur.eval(()); // let _ = blur.eval(());
let vec = blur.then(collect); // let vec = blur.then(collect);
let _image = vec.eval(()); // let _image = vec.eval(());
} // }
*/
} }

View file

@ -175,14 +175,14 @@ impl<'input, S0: 'input, O: 'static> ApplyNode<O, S0> {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use crate::{ops::IdNode, value::ValueNode}; use crate::{ops::IdentityNode, value::ValueNode};
use super::*; use super::*;
#[test] #[test]
fn compose() { fn compose() {
let value = ValueNode::new(4u32); let value = ValueNode::new(4u32);
let compose = value.then(IdNode::new()); let compose = value.then(IdentityNode::new());
assert_eq!(compose.eval(()), &4u32); assert_eq!(compose.eval(()), &4u32);
let type_erased = &compose as &dyn for<'i> Node<'i, (), Output = &'i u32>; let type_erased = &compose as &dyn for<'i> Node<'i, (), Output = &'i u32>;
assert_eq!(type_erased.eval(()), &4u32); assert_eq!(type_erased.eval(()), &4u32);
@ -193,7 +193,7 @@ mod test {
let value = ValueNode::new(5); let value = ValueNode::new(5);
assert_eq!(value.eval(()), &5); assert_eq!(value.eval(()), &5);
let id = IdNode::new(); let id = IdentityNode::new();
let compose = ComposeNode::new(&value, &id); let compose = ComposeNode::new(&value, &id);

View file

@ -373,7 +373,7 @@ pub enum DocumentNodeImplementation {
impl Default for DocumentNodeImplementation { impl Default for DocumentNodeImplementation {
fn default() -> Self { fn default() -> Self {
Self::Unresolved(NodeIdentifier::new("graphene_core::ops::IdNode")) Self::Unresolved(NodeIdentifier::new("graphene_core::ops::IdentityNode"))
} }
} }
@ -468,7 +468,7 @@ impl NodeNetwork {
DocumentNode { DocumentNode {
name: "Input Frame".into(), name: "Input Frame".into(),
manual_composition: Some(concrete!(u32)), manual_composition: Some(concrete!(u32)),
implementation: DocumentNodeImplementation::Unresolved("graphene_core::ops::IdNode".into()), implementation: DocumentNodeImplementation::Unresolved("graphene_core::ops::IdentityNode".into()),
metadata: DocumentNodeMetadata { position: (8, 4).into() }, metadata: DocumentNodeMetadata { position: (8, 4).into() },
..Default::default() ..Default::default()
}, },
@ -506,7 +506,7 @@ impl NodeNetwork {
let node = DocumentNode { let node = DocumentNode {
name: "Output".into(), name: "Output".into(),
inputs: vec![], inputs: vec![],
implementation: DocumentNodeImplementation::Unresolved("graphene_core::ops::IdNode".into()), implementation: DocumentNodeImplementation::Unresolved("graphene_core::ops::IdentityNode".into()),
..Default::default() ..Default::default()
}; };
self.push_node(node) self.push_node(node)
@ -821,8 +821,8 @@ impl NodeNetwork {
return; return;
}; };
if node.implementation != DocumentNodeImplementation::Unresolved("graphene_core::ops::IdNode".into()) && self.disabled.contains(&id) { if node.implementation != DocumentNodeImplementation::Unresolved("graphene_core::ops::IdentityNode".into()) && self.disabled.contains(&id) {
node.implementation = DocumentNodeImplementation::Unresolved("graphene_core::ops::IdNode".into()); node.implementation = DocumentNodeImplementation::Unresolved("graphene_core::ops::IdentityNode".into());
if node.is_layer() { if node.is_layer() {
// Connect layer node to the graphic group below // Connect layer node to the graphic group below
node.inputs.drain(..1); node.inputs.drain(..1);
@ -941,7 +941,7 @@ impl NodeNetwork {
fn remove_id_node(&mut self, id: NodeId) -> Result<(), String> { fn remove_id_node(&mut self, id: NodeId) -> Result<(), String> {
let node = self.nodes.get(&id).ok_or_else(|| format!("Node with id {id} does not exist"))?.clone(); let node = self.nodes.get(&id).ok_or_else(|| format!("Node with id {id} does not exist"))?.clone();
if let DocumentNodeImplementation::Unresolved(ident) = &node.implementation { if let DocumentNodeImplementation::Unresolved(ident) = &node.implementation {
if ident.name == "graphene_core::ops::IdNode" { if ident.name == "graphene_core::ops::IdentityNode" {
assert_eq!(node.inputs.len(), 1, "Id node has more than one input"); assert_eq!(node.inputs.len(), 1, "Id node has more than one input");
if let NodeInput::Node { node_id, output_index, .. } = node.inputs[0] { if let NodeInput::Node { node_id, output_index, .. } = node.inputs[0] {
let input_node_id = node_id; let input_node_id = node_id;
@ -977,13 +977,13 @@ impl NodeNetwork {
Ok(()) Ok(())
} }
/// Strips out any [`graphene_core::ops::IdNode`]s that are unnecessary. /// Strips out any [`graphene_core::ops::IdentityNode`]s that are unnecessary.
pub fn remove_redundant_id_nodes(&mut self) { pub fn remove_redundant_id_nodes(&mut self) {
let id_nodes = self let id_nodes = self
.nodes .nodes
.iter() .iter()
.filter(|(_, node)| { .filter(|(_, node)| {
matches!(&node.implementation, DocumentNodeImplementation::Unresolved(ident) if ident == &NodeIdentifier::new("graphene_core::ops::IdNode")) matches!(&node.implementation, DocumentNodeImplementation::Unresolved(ident) if ident == &NodeIdentifier::new("graphene_core::ops::IdentityNode"))
&& node.inputs.len() == 1 && node.inputs.len() == 1
&& matches!(node.inputs[0], NodeInput::Node { .. }) && matches!(node.inputs[0], NodeInput::Node { .. })
}) })
@ -1141,7 +1141,7 @@ mod test {
DocumentNode { DocumentNode {
name: "Add".into(), name: "Add".into(),
inputs: vec![NodeInput::node(0, 0)], inputs: vec![NodeInput::node(0, 0)],
implementation: DocumentNodeImplementation::Unresolved("graphene_core::ops::AddNode".into()), implementation: DocumentNodeImplementation::Unresolved("graphene_core::ops::AddPairNode".into()),
..Default::default() ..Default::default()
}, },
), ),
@ -1174,7 +1174,7 @@ mod test {
DocumentNode { DocumentNode {
name: "Add".into(), name: "Add".into(),
inputs: vec![NodeInput::node(1, 0)], inputs: vec![NodeInput::node(1, 0)],
implementation: DocumentNodeImplementation::Unresolved("graphene_core::ops::AddNode".into()), implementation: DocumentNodeImplementation::Unresolved("graphene_core::ops::AddPairNode".into()),
..Default::default() ..Default::default()
}, },
), ),
@ -1191,7 +1191,7 @@ mod test {
let id_node = DocumentNode { let id_node = DocumentNode {
name: "Id".into(), name: "Id".into(),
inputs: vec![], inputs: vec![],
implementation: DocumentNodeImplementation::Unresolved("graphene_core::ops::IdNode".into()), implementation: DocumentNodeImplementation::Unresolved("graphene_core::ops::IdentityNode".into()),
..Default::default() ..Default::default()
}; };
// TODO: Extend test cases to test nested network // TODO: Extend test cases to test nested network
@ -1291,7 +1291,7 @@ mod test {
( (
11, 11,
ProtoNode { ProtoNode {
identifier: "graphene_core::ops::AddNode".into(), identifier: "graphene_core::ops::AddPairNode".into(),
input: ProtoNodeInput::Node(10, false), input: ProtoNodeInput::Node(10, false),
construction_args: ConstructionArgs::Nodes(vec![]), construction_args: ConstructionArgs::Nodes(vec![]),
document_node_path: vec![1, 1], document_node_path: vec![1, 1],
@ -1344,7 +1344,7 @@ mod test {
DocumentNode { DocumentNode {
name: "Add".into(), name: "Add".into(),
inputs: vec![NodeInput::node(10, 0)], inputs: vec![NodeInput::node(10, 0)],
implementation: DocumentNodeImplementation::Unresolved("graphene_core::ops::AddNode".into()), implementation: DocumentNodeImplementation::Unresolved("graphene_core::ops::AddPairNode".into()),
path: Some(vec![1, 1]), path: Some(vec![1, 1]),
..Default::default() ..Default::default()
}, },
@ -1366,7 +1366,7 @@ mod test {
DocumentNode { DocumentNode {
name: "Identity 1".into(), name: "Identity 1".into(),
inputs: vec![NodeInput::Network(concrete!(u32))], inputs: vec![NodeInput::Network(concrete!(u32))],
implementation: DocumentNodeImplementation::Unresolved(NodeIdentifier::new("graphene_core::ops::IdNode")), implementation: DocumentNodeImplementation::Unresolved(NodeIdentifier::new("graphene_core::ops::IdentityNode")),
..Default::default() ..Default::default()
}, },
), ),
@ -1375,7 +1375,7 @@ mod test {
DocumentNode { DocumentNode {
name: "Identity 2".into(), name: "Identity 2".into(),
inputs: vec![NodeInput::Network(concrete!(u32))], inputs: vec![NodeInput::Network(concrete!(u32))],
implementation: DocumentNodeImplementation::Unresolved(NodeIdentifier::new("graphene_core::ops::IdNode")), implementation: DocumentNodeImplementation::Unresolved(NodeIdentifier::new("graphene_core::ops::IdentityNode")),
..Default::default() ..Default::default()
}, },
), ),
@ -1405,7 +1405,7 @@ mod test {
DocumentNode { DocumentNode {
name: "Result".into(), name: "Result".into(),
inputs: vec![result_node_input], inputs: vec![result_node_input],
implementation: DocumentNodeImplementation::Unresolved(NodeIdentifier::new("graphene_core::ops::IdNode")), implementation: DocumentNodeImplementation::Unresolved(NodeIdentifier::new("graphene_core::ops::IdentityNode")),
..Default::default() ..Default::default()
}, },
), ),

View file

@ -214,7 +214,7 @@ pub struct ProtoNode {
impl Default for ProtoNode { impl Default for ProtoNode {
fn default() -> Self { fn default() -> Self {
Self { Self {
identifier: NodeIdentifier::new("graphene_core::ops::IdNode"), identifier: NodeIdentifier::new("graphene_core::ops::IdentityNode"),
construction_args: ConstructionArgs::Value(value::TaggedValue::U32(0)), construction_args: ConstructionArgs::Value(value::TaggedValue::U32(0)),
input: ProtoNodeInput::None, input: ProtoNodeInput::None,
document_node_path: vec![], document_node_path: vec![],

View file

@ -77,7 +77,7 @@
], ],
"implementation": { "implementation": {
"Unresolved": { "Unresolved": {
"name": "graphene_core::ops::IdNode" "name": "graphene_core::ops::IdentityNode"
} }
}, },
"metadata": { "metadata": {
@ -482,7 +482,7 @@
], ],
"implementation": { "implementation": {
"Unresolved": { "Unresolved": {
"name": "graphene_core::ops::IdNode" "name": "graphene_core::ops::IdentityNode"
} }
}, },
"metadata": { "metadata": {
@ -1067,7 +1067,7 @@
], ],
"implementation": { "implementation": {
"Unresolved": { "Unresolved": {
"name": "graphene_core::ops::IdNode" "name": "graphene_core::ops::IdentityNode"
} }
}, },
"metadata": { "metadata": {
@ -1298,7 +1298,7 @@
], ],
"implementation": { "implementation": {
"Unresolved": { "Unresolved": {
"name": "graphene_core::ops::IdNode" "name": "graphene_core::ops::IdentityNode"
} }
}, },
"metadata": { "metadata": {

View file

@ -77,7 +77,7 @@
], ],
"implementation": { "implementation": {
"Unresolved": { "Unresolved": {
"name": "graphene_core::ops::IdNode" "name": "graphene_core::ops::IdentityNode"
} }
}, },
"metadata": { "metadata": {
@ -482,7 +482,7 @@
], ],
"implementation": { "implementation": {
"Unresolved": { "Unresolved": {
"name": "graphene_core::ops::IdNode" "name": "graphene_core::ops::IdentityNode"
} }
}, },
"metadata": { "metadata": {
@ -1067,7 +1067,7 @@
], ],
"implementation": { "implementation": {
"Unresolved": { "Unresolved": {
"name": "graphene_core::ops::IdNode" "name": "graphene_core::ops::IdentityNode"
} }
}, },
"metadata": { "metadata": {
@ -1298,7 +1298,7 @@
], ],
"implementation": { "implementation": {
"Unresolved": { "Unresolved": {
"name": "graphene_core::ops::IdNode" "name": "graphene_core::ops::IdentityNode"
} }
}, },
"metadata": { "metadata": {

View file

@ -77,7 +77,7 @@
], ],
"implementation": { "implementation": {
"Unresolved": { "Unresolved": {
"name": "graphene_core::ops::IdNode" "name": "graphene_core::ops::IdentityNode"
} }
}, },
"metadata": { "metadata": {
@ -482,7 +482,7 @@
], ],
"implementation": { "implementation": {
"Unresolved": { "Unresolved": {
"name": "graphene_core::ops::IdNode" "name": "graphene_core::ops::IdentityNode"
} }
}, },
"metadata": { "metadata": {
@ -1067,7 +1067,7 @@
], ],
"implementation": { "implementation": {
"Unresolved": { "Unresolved": {
"name": "graphene_core::ops::IdNode" "name": "graphene_core::ops::IdentityNode"
} }
}, },
"metadata": { "metadata": {
@ -1298,7 +1298,7 @@
], ],
"implementation": { "implementation": {
"Unresolved": { "Unresolved": {
"name": "graphene_core::ops::IdNode" "name": "graphene_core::ops::IdentityNode"
} }
}, },
"metadata": { "metadata": {

View file

@ -77,7 +77,7 @@
], ],
"implementation": { "implementation": {
"Unresolved": { "Unresolved": {
"name": "graphene_core::ops::IdNode" "name": "graphene_core::ops::IdentityNode"
} }
}, },
"metadata": { "metadata": {
@ -482,7 +482,7 @@
], ],
"implementation": { "implementation": {
"Unresolved": { "Unresolved": {
"name": "graphene_core::ops::IdNode" "name": "graphene_core::ops::IdentityNode"
} }
}, },
"metadata": { "metadata": {
@ -1067,7 +1067,7 @@
], ],
"implementation": { "implementation": {
"Unresolved": { "Unresolved": {
"name": "graphene_core::ops::IdNode" "name": "graphene_core::ops::IdentityNode"
} }
}, },
"metadata": { "metadata": {
@ -1298,7 +1298,7 @@
], ],
"implementation": { "implementation": {
"Unresolved": { "Unresolved": {
"name": "graphene_core::ops::IdNode" "name": "graphene_core::ops::IdentityNode"
} }
}, },
"metadata": { "metadata": {

View file

@ -77,7 +77,7 @@
], ],
"implementation": { "implementation": {
"Unresolved": { "Unresolved": {
"name": "graphene_core::ops::IdNode" "name": "graphene_core::ops::IdentityNode"
} }
}, },
"metadata": { "metadata": {
@ -482,7 +482,7 @@
], ],
"implementation": { "implementation": {
"Unresolved": { "Unresolved": {
"name": "graphene_core::ops::IdNode" "name": "graphene_core::ops::IdentityNode"
} }
}, },
"metadata": { "metadata": {
@ -1067,7 +1067,7 @@
], ],
"implementation": { "implementation": {
"Unresolved": { "Unresolved": {
"name": "graphene_core::ops::IdNode" "name": "graphene_core::ops::IdentityNode"
} }
}, },
"metadata": { "metadata": {
@ -1298,7 +1298,7 @@
], ],
"implementation": { "implementation": {
"Unresolved": { "Unresolved": {
"name": "graphene_core::ops::IdNode" "name": "graphene_core::ops::IdentityNode"
} }
}, },
"metadata": { "metadata": {

View file

@ -77,7 +77,7 @@
], ],
"implementation": { "implementation": {
"Unresolved": { "Unresolved": {
"name": "graphene_core::ops::IdNode" "name": "graphene_core::ops::IdentityNode"
} }
}, },
"metadata": { "metadata": {
@ -482,7 +482,7 @@
], ],
"implementation": { "implementation": {
"Unresolved": { "Unresolved": {
"name": "graphene_core::ops::IdNode" "name": "graphene_core::ops::IdentityNode"
} }
}, },
"metadata": { "metadata": {
@ -1067,7 +1067,7 @@
], ],
"implementation": { "implementation": {
"Unresolved": { "Unresolved": {
"name": "graphene_core::ops::IdNode" "name": "graphene_core::ops::IdentityNode"
} }
}, },
"metadata": { "metadata": {
@ -1298,7 +1298,7 @@
], ],
"implementation": { "implementation": {
"Unresolved": { "Unresolved": {
"name": "graphene_core::ops::IdNode" "name": "graphene_core::ops::IdentityNode"
} }
}, },
"metadata": { "metadata": {

View file

@ -265,14 +265,14 @@ impl<I, O> PanicNode<I, O> {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::*; use super::*;
use graphene_core::{ops::AddNode, ops::IdNode}; use graphene_core::{ops::AddPairNode, ops::IdentityNode};
#[test] #[test]
#[should_panic] #[should_panic]
pub fn dyn_input_invalid_eval_panic() { pub fn dyn_input_invalid_eval_panic() {
//let add = DynAnyNode::new(AddNode::new()).into_type_erased(); //let add = DynAnyNode::new(AddPairNode::new()).into_type_erased();
//add.eval(Box::new(&("32", 32u32))); //add.eval(Box::new(&("32", 32u32)));
let dyn_any = DynAnyNode::<(u32, u32), u32, _>::new(FutureWrapperNode { node: AddNode::new() }); let dyn_any = DynAnyNode::<(u32, u32), u32, _>::new(FutureWrapperNode { node: AddPairNode::new() });
let type_erased = Box::new(dyn_any) as TypeErasedBox; let type_erased = Box::new(dyn_any) as TypeErasedBox;
let _ref_type_erased = type_erased.as_ref(); let _ref_type_erased = type_erased.as_ref();
//let type_erased = Box::pin(dyn_any) as TypeErasedBox<'_>; //let type_erased = Box::pin(dyn_any) as TypeErasedBox<'_>;
@ -281,12 +281,12 @@ mod test {
#[test] #[test]
pub fn dyn_input_compose() { pub fn dyn_input_compose() {
//let add = DynAnyNode::new(AddNode::new()).into_type_erased(); //let add = DynAnyNode::new(AddPairNode::new()).into_type_erased();
//add.eval(Box::new(&("32", 32u32))); //add.eval(Box::new(&("32", 32u32)));
let dyn_any = DynAnyNode::<(u32, u32), u32, _>::new(FutureWrapperNode { node: AddNode::new() }); let dyn_any = DynAnyNode::<(u32, u32), u32, _>::new(FutureWrapperNode { node: AddPairNode::new() });
let type_erased = Box::new(dyn_any) as TypeErasedBox<'_>; let type_erased = Box::new(dyn_any) as TypeErasedBox<'_>;
type_erased.eval(Box::new((4u32, 2u32))); type_erased.eval(Box::new((4u32, 2u32)));
let id_node = FutureWrapperNode::new(IdNode::new()); let id_node = FutureWrapperNode::new(IdentityNode::new());
let any_id = DynAnyNode::<u32, u32, _>::new(id_node); let any_id = DynAnyNode::<u32, u32, _>::new(id_node);
let type_erased_id = Box::new(any_id) as TypeErasedBox; let type_erased_id = Box::new(any_id) as TypeErasedBox;
let type_erased = ComposeTypeErased::new(NodeContainer::new(type_erased), NodeContainer::new(type_erased_id)); let type_erased = ComposeTypeErased::new(NodeContainer::new(type_erased), NodeContainer::new(type_erased_id));
@ -296,13 +296,11 @@ mod test {
} }
// TODO: Fix this test // TODO: Fix this test
/* // #[test]
#[test] // pub fn dyn_input_storage_composition() {
pub fn dyn_input_storage_composition() { // // todo readd test
// todo readd test // let node = <graphene_core::ops::IdentityNode>::new();
let node = <graphene_core::ops::IdNode>::new(); // let any: DynAnyNode<Any<'_>, Any<'_>, _> = DynAnyNode::new(ValueNode::new(node));
let any: DynAnyNode<Any<'_>, Any<'_>, _> = DynAnyNode::new(ValueNode::new(node)); // any.into_type_erased();
any.into_type_erased(); // }
}
*/
} }

View file

@ -399,7 +399,7 @@ mod test {
use crate::raster::*; use crate::raster::*;
#[allow(unused_imports)] #[allow(unused_imports)]
use graphene_core::ops::{AddNode, CloneNode}; use graphene_core::ops::{AddPairNode, CloneNode};
use graphene_core::raster::*; use graphene_core::raster::*;
use graphene_core::structural::Then; use graphene_core::structural::Then;
use graphene_core::transform::{Transform, TransformMut}; use graphene_core::transform::{Transform, TransformMut};
@ -423,7 +423,7 @@ mod test {
#[test] #[test]
fn test_reduce() { fn test_reduce() {
let reduce_node = ReduceNode::new(ClonedNode::new(0u32), ValueNode::new(AddNode)); let reduce_node = ReduceNode::new(ClonedNode::new(0u32), ValueNode::new(AddPairNode));
let sum = reduce_node.eval(vec![1, 2, 3, 4, 5].into_iter()); let sum = reduce_node.eval(vec![1, 2, 3, 4, 5].into_iter());
assert_eq!(sum, 15); assert_eq!(sum, 15);
} }

View file

@ -182,13 +182,13 @@ async fn create_compute_pass_descriptor<T: Clone + Pixel + StaticTypeSized>(
DocumentNode { DocumentNode {
name: "Quantization".into(), name: "Quantization".into(),
inputs: vec![NodeInput::Network(concrete!(quantization::Quantization))], inputs: vec![NodeInput::Network(concrete!(quantization::Quantization))],
implementation: DocumentNodeImplementation::Unresolved("graphene_core::ops::IdNode".into()), implementation: DocumentNodeImplementation::Unresolved("graphene_core::ops::IdentityNode".into()),
..Default::default() ..Default::default()
}, },
DocumentNode { DocumentNode {
name: "Width".into(), name: "Width".into(),
inputs: vec![NodeInput::Network(concrete!(u32))], inputs: vec![NodeInput::Network(concrete!(u32))],
implementation: DocumentNodeImplementation::Unresolved("graphene_core::ops::IdNode".into()), implementation: DocumentNodeImplementation::Unresolved("graphene_core::ops::IdentityNode".into()),
..Default::default() ..Default::default()
}, },
/*DocumentNode { /*DocumentNode {

View file

@ -33,7 +33,7 @@ mod tests {
DocumentNode { DocumentNode {
name: "Add".into(), name: "Add".into(),
inputs: vec![NodeInput::node(0, 0)], inputs: vec![NodeInput::node(0, 0)],
implementation: DocumentNodeImplementation::Unresolved(NodeIdentifier::new("graphene_core::ops::AddNode")), implementation: DocumentNodeImplementation::Unresolved(NodeIdentifier::new("graphene_core::ops::AddPairNode")),
..Default::default() ..Default::default()
}, },
), ),
@ -95,7 +95,7 @@ mod tests {
DocumentNode { DocumentNode {
name: "id".into(), name: "id".into(),
inputs: vec![NodeInput::Network(concrete!(u32))], inputs: vec![NodeInput::Network(concrete!(u32))],
implementation: DocumentNodeImplementation::Unresolved(NodeIdentifier::new("graphene_core::ops::IdNode")), implementation: DocumentNodeImplementation::Unresolved(NodeIdentifier::new("graphene_core::ops::IdentityNode")),
..Default::default() ..Default::default()
}, },
), ),
@ -105,7 +105,7 @@ mod tests {
DocumentNode { DocumentNode {
name: "Add".into(), name: "Add".into(),
inputs: vec![NodeInput::node(0, 0), NodeInput::node(0, 0)], inputs: vec![NodeInput::node(0, 0), NodeInput::node(0, 0)],
implementation: DocumentNodeImplementation::Unresolved(NodeIdentifier::new("graphene_core::ops::AddParameterNode<_>")), implementation: DocumentNodeImplementation::Unresolved(NodeIdentifier::new("graphene_core::ops::AddNode<_>")),
..Default::default() ..Default::default()
}, },
), ),

View file

@ -1,6 +1,6 @@
use graph_craft::imaginate_input::{ImaginateController, ImaginateMaskStartingFill, ImaginateSamplingMethod}; use graph_craft::imaginate_input::{ImaginateController, ImaginateMaskStartingFill, ImaginateSamplingMethod};
use graph_craft::proto::{NodeConstructor, TypeErasedBox}; use graph_craft::proto::{NodeConstructor, TypeErasedBox};
use graphene_core::ops::IdNode; use graphene_core::ops::IdentityNode;
use graphene_core::quantization::{PackedPixel, QuantizationChannels}; use graphene_core::quantization::{PackedPixel, QuantizationChannels};
use graphene_core::raster::brush_cache::BrushCache; use graphene_core::raster::brush_cache::BrushCache;
@ -180,10 +180,10 @@ macro_rules! raster_node {
//TODO: turn into hashmap //TODO: turn into hashmap
fn node_registry() -> HashMap<NodeIdentifier, HashMap<NodeIOTypes, NodeConstructor>> { fn node_registry() -> HashMap<NodeIdentifier, HashMap<NodeIOTypes, NodeConstructor>> {
let node_types: Vec<Vec<(NodeIdentifier, NodeConstructor, NodeIOTypes)>> = vec![ let node_types: Vec<Vec<(NodeIdentifier, NodeConstructor, NodeIOTypes)>> = vec![
//register_node!(graphene_core::ops::IdNode, input: Any<'_>, params: []), //register_node!(graphene_core::ops::IdentityNode, input: Any<'_>, params: []),
vec![( vec![(
NodeIdentifier::new("graphene_core::ops::IdNode"), NodeIdentifier::new("graphene_core::ops::IdentityNode"),
|_| Box::pin(async move { FutureWrapperNode::new(IdNode::new()).into_type_erased() }), |_| Box::pin(async move { FutureWrapperNode::new(IdentityNode::new()).into_type_erased() }),
NodeIOTypes::new(generic!(I), generic!(I), vec![]), NodeIOTypes::new(generic!(I), generic!(I), vec![]),
)], )],
// TODO: create macro to impl for all types // TODO: create macro to impl for all types
@ -191,72 +191,72 @@ 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::structural::ConsNode<_, _>, input: &u32, params: [u32]), register_node!(graphene_core::structural::ConsNode<_, _>, input: &u32, params: [u32]),
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::AddPairNode, input: (u32, u32), params: []),
register_node!(graphene_core::ops::AddNode, input: (u32, &u32), params: []), register_node!(graphene_core::ops::AddPairNode, input: (u32, &u32), params: []),
register_node!(graphene_core::ops::CloneNode<_>, input: &ImageFrame<Color>, params: []), register_node!(graphene_core::ops::CloneNode<_>, input: &ImageFrame<Color>, params: []),
register_node!(graphene_core::ops::CloneNode<_>, input: &WasmEditorApi, params: []), register_node!(graphene_core::ops::CloneNode<_>, input: &WasmEditorApi, params: []),
register_node!(graphene_core::ops::AddParameterNode<_>, input: u32, params: [u32]), register_node!(graphene_core::ops::AddNode<_>, input: u32, params: [u32]),
register_node!(graphene_core::ops::AddParameterNode<_>, input: &u32, params: [u32]), register_node!(graphene_core::ops::AddNode<_>, input: &u32, params: [u32]),
register_node!(graphene_core::ops::AddParameterNode<_>, input: u32, params: [&u32]), register_node!(graphene_core::ops::AddNode<_>, input: u32, params: [&u32]),
register_node!(graphene_core::ops::AddParameterNode<_>, input: &u32, params: [&u32]), register_node!(graphene_core::ops::AddNode<_>, input: &u32, params: [&u32]),
register_node!(graphene_core::ops::AddParameterNode<_>, input: f32, params: [f32]), register_node!(graphene_core::ops::AddNode<_>, input: f32, params: [f32]),
register_node!(graphene_core::ops::AddParameterNode<_>, input: &f32, params: [f32]), register_node!(graphene_core::ops::AddNode<_>, input: &f32, params: [f32]),
register_node!(graphene_core::ops::AddParameterNode<_>, input: f32, params: [&f32]), register_node!(graphene_core::ops::AddNode<_>, input: f32, params: [&f32]),
register_node!(graphene_core::ops::AddParameterNode<_>, input: &f32, params: [&f32]), register_node!(graphene_core::ops::AddNode<_>, input: &f32, params: [&f32]),
register_node!(graphene_core::ops::SubtractParameterNode<_>, input: u32, params: [u32]), register_node!(graphene_core::ops::SubtractNode<_>, input: u32, params: [u32]),
register_node!(graphene_core::ops::SubtractParameterNode<_>, input: &u32, params: [u32]), register_node!(graphene_core::ops::SubtractNode<_>, input: &u32, params: [u32]),
register_node!(graphene_core::ops::SubtractParameterNode<_>, input: u32, params: [&u32]), register_node!(graphene_core::ops::SubtractNode<_>, input: u32, params: [&u32]),
register_node!(graphene_core::ops::SubtractParameterNode<_>, input: &u32, params: [&u32]), register_node!(graphene_core::ops::SubtractNode<_>, input: &u32, params: [&u32]),
register_node!(graphene_core::ops::SubtractParameterNode<_>, input: f32, params: [f32]), register_node!(graphene_core::ops::SubtractNode<_>, input: f32, params: [f32]),
register_node!(graphene_core::ops::SubtractParameterNode<_>, input: &f32, params: [f32]), register_node!(graphene_core::ops::SubtractNode<_>, input: &f32, params: [f32]),
register_node!(graphene_core::ops::SubtractParameterNode<_>, input: f32, params: [&f32]), register_node!(graphene_core::ops::SubtractNode<_>, input: f32, params: [&f32]),
register_node!(graphene_core::ops::SubtractParameterNode<_>, input: &f32, params: [&f32]), register_node!(graphene_core::ops::SubtractNode<_>, input: &f32, params: [&f32]),
register_node!(graphene_core::ops::DivideParameterNode<_>, input: u32, params: [u32]), register_node!(graphene_core::ops::DivideNode<_>, input: u32, params: [u32]),
register_node!(graphene_core::ops::DivideParameterNode<_>, input: &u32, params: [u32]), register_node!(graphene_core::ops::DivideNode<_>, input: &u32, params: [u32]),
register_node!(graphene_core::ops::DivideParameterNode<_>, input: u32, params: [&u32]), register_node!(graphene_core::ops::DivideNode<_>, input: u32, params: [&u32]),
register_node!(graphene_core::ops::DivideParameterNode<_>, input: &u32, params: [&u32]), register_node!(graphene_core::ops::DivideNode<_>, input: &u32, params: [&u32]),
register_node!(graphene_core::ops::DivideParameterNode<_>, input: f32, params: [f32]), register_node!(graphene_core::ops::DivideNode<_>, input: f32, params: [f32]),
register_node!(graphene_core::ops::DivideParameterNode<_>, input: &f32, params: [f32]), register_node!(graphene_core::ops::DivideNode<_>, input: &f32, params: [f32]),
register_node!(graphene_core::ops::DivideParameterNode<_>, input: f32, params: [&f32]), register_node!(graphene_core::ops::DivideNode<_>, input: f32, params: [&f32]),
register_node!(graphene_core::ops::DivideParameterNode<_>, input: &f32, params: [&f32]), register_node!(graphene_core::ops::DivideNode<_>, input: &f32, params: [&f32]),
register_node!(graphene_core::ops::MultiplyParameterNode<_>, input: u32, params: [u32]), register_node!(graphene_core::ops::MultiplyNode<_>, input: u32, params: [u32]),
register_node!(graphene_core::ops::MultiplyParameterNode<_>, input: &u32, params: [u32]), register_node!(graphene_core::ops::MultiplyNode<_>, input: &u32, params: [u32]),
register_node!(graphene_core::ops::MultiplyParameterNode<_>, input: u32, params: [&u32]), register_node!(graphene_core::ops::MultiplyNode<_>, input: u32, params: [&u32]),
register_node!(graphene_core::ops::MultiplyParameterNode<_>, input: &u32, params: [&u32]), register_node!(graphene_core::ops::MultiplyNode<_>, input: &u32, params: [&u32]),
register_node!(graphene_core::ops::MultiplyParameterNode<_>, input: f32, params: [f32]), register_node!(graphene_core::ops::MultiplyNode<_>, input: f32, params: [f32]),
register_node!(graphene_core::ops::MultiplyParameterNode<_>, input: &f32, params: [f32]), register_node!(graphene_core::ops::MultiplyNode<_>, input: &f32, params: [f32]),
register_node!(graphene_core::ops::MultiplyParameterNode<_>, input: f32, params: [&f32]), register_node!(graphene_core::ops::MultiplyNode<_>, input: f32, params: [&f32]),
register_node!(graphene_core::ops::MultiplyParameterNode<_>, input: &f32, params: [&f32]), register_node!(graphene_core::ops::MultiplyNode<_>, input: &f32, params: [&f32]),
register_node!(graphene_core::ops::ExponentParameterNode<_>, input: u32, params: [u32]), register_node!(graphene_core::ops::ExponentNode<_>, input: u32, params: [u32]),
register_node!(graphene_core::ops::ExponentParameterNode<_>, input: &u32, params: [u32]), register_node!(graphene_core::ops::ExponentNode<_>, input: &u32, params: [u32]),
register_node!(graphene_core::ops::ExponentParameterNode<_>, input: u32, params: [&u32]), register_node!(graphene_core::ops::ExponentNode<_>, input: u32, params: [&u32]),
register_node!(graphene_core::ops::ExponentParameterNode<_>, input: &u32, params: [&u32]), register_node!(graphene_core::ops::ExponentNode<_>, input: &u32, params: [&u32]),
register_node!(graphene_core::ops::ExponentParameterNode<_>, input: f32, params: [f32]), register_node!(graphene_core::ops::ExponentNode<_>, input: f32, params: [f32]),
register_node!(graphene_core::ops::ExponentParameterNode<_>, input: &f32, params: [f32]), register_node!(graphene_core::ops::ExponentNode<_>, input: &f32, params: [f32]),
register_node!(graphene_core::ops::ExponentParameterNode<_>, input: f32, params: [&f32]), register_node!(graphene_core::ops::ExponentNode<_>, input: f32, params: [&f32]),
register_node!(graphene_core::ops::FloorNode, input: f32, params: []), register_node!(graphene_core::ops::FloorNode, input: f32, params: []),
register_node!(graphene_core::ops::CeilNode, input: f32, params: []), register_node!(graphene_core::ops::CeilingNode, input: f32, params: []),
register_node!(graphene_core::ops::RoundNode, input: f32, params: []), register_node!(graphene_core::ops::RoundNode, input: f32, params: []),
register_node!(graphene_core::ops::AbsoluteNode, input: f32, params: []), register_node!(graphene_core::ops::AbsoluteValue, input: f32, params: []),
register_node!(graphene_core::ops::LogParameterNode<_>, input: f32, params: [f32]), register_node!(graphene_core::ops::LogarithmNode<_>, input: f32, params: [f32]),
register_node!(graphene_core::ops::NaturalLogNode, input: f32, params: []), register_node!(graphene_core::ops::NaturalLogarithmNode, input: f32, params: []),
register_node!(graphene_core::ops::SineNode, input: f32, params: []), register_node!(graphene_core::ops::SineNode, input: f32, params: []),
register_node!(graphene_core::ops::CosineNode, input: f32, params: []), register_node!(graphene_core::ops::CosineNode, input: f32, params: []),
register_node!(graphene_core::ops::TangentNode, input: f32, params: []), register_node!(graphene_core::ops::TangentNode, input: f32, params: []),
register_node!(graphene_core::ops::MaxParameterNode<_>, input: u32, params: [u32]), register_node!(graphene_core::ops::MaximumNode<_>, input: u32, params: [u32]),
register_node!(graphene_core::ops::MaxParameterNode<_>, input: f32, params: [f32]), register_node!(graphene_core::ops::MaximumNode<_>, input: f32, params: [f32]),
register_node!(graphene_core::ops::MinParameterNode<_>, input: u32, params: [u32]), register_node!(graphene_core::ops::MinimumNode<_>, input: u32, params: [u32]),
register_node!(graphene_core::ops::MinParameterNode<_>, input: f32, params: [f32]), register_node!(graphene_core::ops::MinimumNode<_>, input: f32, params: [f32]),
register_node!(graphene_core::ops::EqParameterNode<_>, input: u32, params: [u32]), register_node!(graphene_core::ops::EqualsNode<_>, input: u32, params: [u32]),
register_node!(graphene_core::ops::EqParameterNode<_>, input: f32, params: [f32]), register_node!(graphene_core::ops::EqualsNode<_>, input: f32, params: [f32]),
register_node!(graphene_core::ops::ModuloParameterNode<_>, input: u32, params: [u32]), register_node!(graphene_core::ops::ModuloNode<_>, input: u32, params: [u32]),
register_node!(graphene_core::ops::ModuloParameterNode<_>, input: &u32, params: [u32]), register_node!(graphene_core::ops::ModuloNode<_>, input: &u32, params: [u32]),
register_node!(graphene_core::ops::ModuloParameterNode<_>, input: u32, params: [&u32]), register_node!(graphene_core::ops::ModuloNode<_>, input: u32, params: [&u32]),
register_node!(graphene_core::ops::ModuloParameterNode<_>, input: &u32, params: [&u32]), register_node!(graphene_core::ops::ModuloNode<_>, input: &u32, params: [&u32]),
register_node!(graphene_core::ops::ModuloParameterNode<_>, input: f32, params: [f32]), register_node!(graphene_core::ops::ModuloNode<_>, input: f32, params: [f32]),
register_node!(graphene_core::ops::ModuloParameterNode<_>, input: &f32, params: [f32]), register_node!(graphene_core::ops::ModuloNode<_>, input: &f32, params: [f32]),
register_node!(graphene_core::ops::ModuloParameterNode<_>, input: f32, params: [&f32]), register_node!(graphene_core::ops::ModuloNode<_>, input: f32, params: [&f32]),
register_node!(graphene_core::ops::ModuloParameterNode<_>, input: &f32, params: [&f32]), register_node!(graphene_core::ops::ModuloNode<_>, input: &f32, params: [&f32]),
register_node!(graphene_core::ops::SomeNode, input: WasmEditorApi, params: []), register_node!(graphene_core::ops::SomeNode, input: WasmEditorApi, params: []),
register_node!(graphene_core::logic::LogToConsoleNode, input: bool, params: []), register_node!(graphene_core::logic::LogToConsoleNode, input: bool, params: []),
register_node!(graphene_core::logic::LogToConsoleNode, input: f32, params: []), register_node!(graphene_core::logic::LogToConsoleNode, input: f32, params: []),

View file

@ -127,7 +127,7 @@ fn create_buffer<T: Pod + Send + Sync>(data: Vec<T>, alloc: &StandardMemoryAlloc
// ( // (
// 1, // 1,
// ProtoNode { // ProtoNode {
// identifier: NodeIdentifier::new("graphene_core::ops::IdNode", &[generic!("u32")]), // identifier: NodeIdentifier::new("graphene_core::ops::IdentityNode", &[generic!("u32")]),
// input: ProtoNodeInput::Node(11), // input: ProtoNodeInput::Node(11),
// construction_args: ConstructionArgs::Nodes(vec![]), // construction_args: ConstructionArgs::Nodes(vec![]),
// }, // },
@ -143,7 +143,7 @@ fn create_buffer<T: Pod + Send + Sync>(data: Vec<T>, alloc: &StandardMemoryAlloc
// ( // (
// 11, // 11,
// ProtoNode { // ProtoNode {
// identifier: NodeIdentifier::new("graphene_core::ops::AddNode", &[generic!("u32"), generic!("u32")]), // identifier: NodeIdentifier::new("graphene_core::ops::AddPairNode", &[generic!("u32"), generic!("u32")]),
// input: ProtoNodeInput::Node(10), // input: ProtoNodeInput::Node(10),
// construction_args: ConstructionArgs::Nodes(vec![]), // construction_args: ConstructionArgs::Nodes(vec![]),
// }, // },

View file

@ -209,7 +209,7 @@ async fn execute_shader<I: Pod + Send + Sync, O: Pod + Send + Sync>(device: Arc<
// ( // (
// 1, // 1,
// ProtoNode { // ProtoNode {
// identifier: NodeIdentifier::new("graphene_core::ops::IdNode", &[generic!("u32")]), // identifier: NodeIdentifier::new("graphene_core::ops::IdentityNode", &[generic!("u32")]),
// input: ProtoNodeInput::Node(11), // input: ProtoNodeInput::Node(11),
// construction_args: ConstructionArgs::Nodes(vec![]), // construction_args: ConstructionArgs::Nodes(vec![]),
// }, // },
@ -225,7 +225,7 @@ async fn execute_shader<I: Pod + Send + Sync, O: Pod + Send + Sync>(device: Arc<
// ( // (
// 11, // 11,
// ProtoNode { // ProtoNode {
// identifier: NodeIdentifier::new("graphene_core::ops::AddNode", &[generic!("u32"), generic!("u32")]), // identifier: NodeIdentifier::new("graphene_core::ops::AddPairNode", &[generic!("u32"), generic!("u32")]),
// input: ProtoNodeInput::Node(10), // input: ProtoNodeInput::Node(10),
// construction_args: ConstructionArgs::Nodes(vec![]), // construction_args: ConstructionArgs::Nodes(vec![]),
// }, // },