mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-21 07:18:11 +08:00
Add more math nodes (#1378)
* Adds Max, Min and Equal Nodes * Add LogToConsoleNode Logs the data given as the input to the browser console and returns it as the output
This commit is contained in:
+45
@@ -1745,6 +1745,42 @@ fn static_nodes() -> Vec<DocumentNodeType> {
|
||||
properties: node_properties::exponent_properties,
|
||||
..Default::default()
|
||||
},
|
||||
DocumentNodeType {
|
||||
name: "Max",
|
||||
category: "Math",
|
||||
identifier: NodeImplementation::proto("graphene_core::ops::MaxParameterNode<_>"),
|
||||
inputs: vec![
|
||||
DocumentInputType::value("First", TaggedValue::F32(0.), true),
|
||||
DocumentInputType::value("Second", TaggedValue::F32(0.), true),
|
||||
],
|
||||
outputs: vec![DocumentOutputType::new("Output", FrontendGraphDataType::Number)],
|
||||
properties: node_properties::max_properties,
|
||||
..Default::default()
|
||||
},
|
||||
DocumentNodeType {
|
||||
name: "Min",
|
||||
category: "Math",
|
||||
identifier: NodeImplementation::proto("graphene_core::ops::MinParameterNode<_>"),
|
||||
inputs: vec![
|
||||
DocumentInputType::value("First", TaggedValue::F32(0.), true),
|
||||
DocumentInputType::value("Second", TaggedValue::F32(0.), true),
|
||||
],
|
||||
outputs: vec![DocumentOutputType::new("Output", FrontendGraphDataType::Number)],
|
||||
properties: node_properties::min_properties,
|
||||
..Default::default()
|
||||
},
|
||||
DocumentNodeType {
|
||||
name: "Equality",
|
||||
category: "Math",
|
||||
identifier: NodeImplementation::proto("graphene_core::ops::EqParameterNode<_>"),
|
||||
inputs: vec![
|
||||
DocumentInputType::value("First", TaggedValue::F32(0.), true),
|
||||
DocumentInputType::value("Second", TaggedValue::F32(0.), true),
|
||||
],
|
||||
outputs: vec![DocumentOutputType::new("Output", FrontendGraphDataType::Number)],
|
||||
properties: node_properties::eq_properties,
|
||||
..Default::default()
|
||||
},
|
||||
DocumentNodeType {
|
||||
name: "Modulo",
|
||||
category: "Math",
|
||||
@@ -1757,6 +1793,15 @@ fn static_nodes() -> Vec<DocumentNodeType> {
|
||||
properties: node_properties::modulo_properties,
|
||||
..Default::default()
|
||||
},
|
||||
DocumentNodeType {
|
||||
name: "Log to Console",
|
||||
category: "Logic",
|
||||
identifier: NodeImplementation::proto("graphene_core::logic::LogToConsoleNode"),
|
||||
inputs: vec![DocumentInputType::value("First", TaggedValue::String("Not Connected to a value yet".into()), true)],
|
||||
outputs: vec![DocumentOutputType::new("Output", FrontendGraphDataType::General)],
|
||||
properties: node_properties::no_properties,
|
||||
..Default::default()
|
||||
},
|
||||
(*IMAGINATE_NODE).clone(),
|
||||
DocumentNodeType {
|
||||
name: "Unit Circle Generator",
|
||||
|
||||
+27
@@ -1022,6 +1022,33 @@ pub fn exponent_properties(document_node: &DocumentNode, node_id: NodeId, _conte
|
||||
vec![operand("Power", 1)]
|
||||
}
|
||||
|
||||
pub fn max_properties(document_node: &DocumentNode, node_id: NodeId, _context: &mut NodePropertiesContext) -> Vec<LayoutGroup> {
|
||||
let operand = |name: &str, index| {
|
||||
let widgets = number_widget(document_node, node_id, index, name, NumberInput::default(), true);
|
||||
|
||||
LayoutGroup::Row { widgets }
|
||||
};
|
||||
vec![operand("Maximum", 1)]
|
||||
}
|
||||
|
||||
pub fn min_properties(document_node: &DocumentNode, node_id: NodeId, _context: &mut NodePropertiesContext) -> Vec<LayoutGroup> {
|
||||
let operand = |name: &str, index| {
|
||||
let widgets = number_widget(document_node, node_id, index, name, NumberInput::default(), true);
|
||||
|
||||
LayoutGroup::Row { widgets }
|
||||
};
|
||||
vec![operand("Minimum", 1)]
|
||||
}
|
||||
|
||||
pub fn eq_properties(document_node: &DocumentNode, node_id: NodeId, _context: &mut NodePropertiesContext) -> Vec<LayoutGroup> {
|
||||
let operand = |name: &str, index| {
|
||||
let widgets = number_widget(document_node, node_id, index, name, NumberInput::default(), true);
|
||||
|
||||
LayoutGroup::Row { widgets }
|
||||
};
|
||||
vec![operand("Equality", 1)]
|
||||
}
|
||||
|
||||
pub fn modulo_properties(document_node: &DocumentNode, node_id: NodeId, _context: &mut NodePropertiesContext) -> Vec<LayoutGroup> {
|
||||
let operand = |name: &str, index| {
|
||||
let widgets = number_widget(document_node, node_id, index, name, NumberInput::default(), true);
|
||||
|
||||
Reference in New Issue
Block a user