mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-08-02 20:42:16 +00:00
New nodes: Logical boolean operations (OR, AND, XOR, NOT) (#1399)
* Add Boolean Operations Nodes Adds OR AND XOR and NOT operators * Fix operand naming Inputs to the 'Min' 'Max' 'Equality' and boolean operations nodes were previously named 'First' and 'Second' and are now called 'Operand A' and 'Operand B' * Rename Equality to Equals --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
parent
48fdaddc37
commit
3419e739af
5 changed files with 98 additions and 10 deletions
|
@ -7,3 +7,37 @@ fn log_to_console<T: core::fmt::Debug>(value: T) -> T {
|
|||
debug!("{:#?}", value);
|
||||
value
|
||||
}
|
||||
|
||||
pub struct LogicOrNode<Second> {
|
||||
second: Second,
|
||||
}
|
||||
|
||||
#[node_macro::node_fn(LogicOrNode)]
|
||||
fn logic_or(first: bool, second: bool) -> bool {
|
||||
first || second
|
||||
}
|
||||
|
||||
pub struct LogicAndNode<Second> {
|
||||
second: Second,
|
||||
}
|
||||
|
||||
#[node_macro::node_fn(LogicAndNode)]
|
||||
fn logic_and(first: bool, second: bool) -> bool {
|
||||
first && second
|
||||
}
|
||||
|
||||
pub struct LogicXorNode<Second> {
|
||||
second: Second,
|
||||
}
|
||||
|
||||
#[node_macro::node_fn(LogicXorNode)]
|
||||
fn logic_xor(first: bool, second: bool) -> bool {
|
||||
first ^ second
|
||||
}
|
||||
|
||||
pub struct LogicNotNode;
|
||||
|
||||
#[node_macro::node_fn(LogicNotNode)]
|
||||
fn logic_not(first: bool) -> bool {
|
||||
!first
|
||||
}
|
||||
|
|
|
@ -183,7 +183,7 @@ fn max<T: core::cmp::PartialOrd>(first: T, second: T) -> T {
|
|||
}
|
||||
}
|
||||
|
||||
// Equality
|
||||
// Equals
|
||||
pub struct EqParameterNode<Second> {
|
||||
second: Second,
|
||||
}
|
||||
|
|
|
@ -260,6 +260,10 @@ fn node_registry() -> HashMap<NodeIdentifier, HashMap<NodeIOTypes, NodeConstruct
|
|||
register_node!(graphene_core::logic::LogToConsoleNode, input: DVec2, params: []),
|
||||
register_node!(graphene_core::logic::LogToConsoleNode, input: VectorData, params: []),
|
||||
register_node!(graphene_core::logic::LogToConsoleNode, input: DAffine2, params: []),
|
||||
register_node!(graphene_core::logic::LogicOrNode<_>, input: bool, params: [bool]),
|
||||
register_node!(graphene_core::logic::LogicAndNode<_>, input: bool, params: [bool]),
|
||||
register_node!(graphene_core::logic::LogicXorNode<_>, input: bool, params: [bool]),
|
||||
register_node!(graphene_core::logic::LogicNotNode, input: bool, params: []),
|
||||
async_node!(graphene_core::ops::IntoNode<_, ImageFrame<SRGBA8>>, input: ImageFrame<Color>, output: ImageFrame<SRGBA8>, params: []),
|
||||
async_node!(graphene_core::ops::IntoNode<_, ImageFrame<Color>>, input: ImageFrame<SRGBA8>, output: ImageFrame<Color>, params: []),
|
||||
#[cfg(feature = "gpu")]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue