mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-08-04 05:18:19 +00:00
Enable Merge nodes to take vector data inputs from the bottom, not just left
Known bug: click targets aren't calculated for bottom input vector data.
This commit is contained in:
parent
ce96ae66f2
commit
244c8ad10a
3 changed files with 28 additions and 10 deletions
|
@ -197,9 +197,10 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
|
|||
category: "General",
|
||||
is_layer: true,
|
||||
implementation: DocumentNodeImplementation::Network(NodeNetwork {
|
||||
imports: vec![NodeId(2), NodeId(0)],
|
||||
exports: vec![NodeOutput::new(NodeId(2), 0)],
|
||||
imports: vec![NodeId(1), NodeId(0)],
|
||||
exports: vec![NodeOutput::new(NodeId(3), 0)],
|
||||
nodes: [
|
||||
// Secondary (left) input type coercion
|
||||
(
|
||||
NodeId(0),
|
||||
DocumentNode {
|
||||
|
@ -209,24 +210,30 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
|
|||
..Default::default()
|
||||
},
|
||||
),
|
||||
// The monitor node is used to display a thumbnail in the UI.
|
||||
// TODO: Check if thumbnail is reversed
|
||||
// Primary (bottom) input type coercion
|
||||
(
|
||||
NodeId(1),
|
||||
DocumentNode {
|
||||
name: "To Graphic Group".to_string(),
|
||||
inputs: vec![NodeInput::Network(generic!(T))],
|
||||
implementation: DocumentNodeImplementation::proto("graphene_core::ToGraphicGroupNode"),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
// The monitor node is used to display a thumbnail in the UI
|
||||
(
|
||||
NodeId(2),
|
||||
DocumentNode {
|
||||
inputs: vec![NodeInput::node(NodeId(0), 0)],
|
||||
..monitor_node()
|
||||
},
|
||||
),
|
||||
(
|
||||
NodeId(2),
|
||||
NodeId(3),
|
||||
DocumentNode {
|
||||
name: "ConstructLayer".to_string(),
|
||||
manual_composition: Some(concrete!(Footprint)),
|
||||
inputs: vec![
|
||||
NodeInput::node(NodeId(1), 0),
|
||||
NodeInput::Network(graphene_core::Type::Fn(Box::new(concrete!(Footprint)), Box::new(concrete!(graphene_core::GraphicGroup)))),
|
||||
],
|
||||
inputs: vec![NodeInput::node(NodeId(2), 0), NodeInput::node(NodeId(1), 0)],
|
||||
implementation: DocumentNodeImplementation::proto("graphene_core::ConstructLayerNode<_, _>"),
|
||||
..Default::default()
|
||||
},
|
||||
|
|
|
@ -158,6 +158,13 @@ fn to_graphic_element<Data: Into<GraphicElement>>(data: Data) -> GraphicElement
|
|||
data.into()
|
||||
}
|
||||
|
||||
pub struct ToGraphicGroupNode {}
|
||||
|
||||
#[node_fn(ToGraphicGroupNode)]
|
||||
fn to_graphic_group<Data: Into<GraphicGroup>>(data: Data) -> GraphicGroup {
|
||||
data.into()
|
||||
}
|
||||
|
||||
pub struct ConstructArtboardNode<Contents, Location, Dimensions, Background, Clip> {
|
||||
contents: Contents,
|
||||
location: Location,
|
||||
|
|
|
@ -796,8 +796,12 @@ fn node_registry() -> HashMap<ProtoNodeIdentifier, HashMap<NodeIOTypes, NodeCons
|
|||
register_node!(graphene_core::ToGraphicElementNode, input: ImageFrame<Color>, params: []),
|
||||
register_node!(graphene_core::ToGraphicElementNode, input: GraphicGroup, params: []),
|
||||
register_node!(graphene_core::ToGraphicElementNode, input: Artboard, params: []),
|
||||
register_node!(graphene_core::ToGraphicGroupNode, input: graphene_core::vector::VectorData, params: []),
|
||||
register_node!(graphene_core::ToGraphicGroupNode, input: ImageFrame<Color>, params: []),
|
||||
register_node!(graphene_core::ToGraphicGroupNode, input: GraphicGroup, params: []),
|
||||
register_node!(graphene_core::ToGraphicGroupNode, input: Artboard, params: []),
|
||||
async_node!(graphene_core::ConstructArtboardNode<_, _, _, _, _>, input: Footprint, output: Artboard, fn_params: [Footprint => GraphicGroup, () => glam::IVec2, () => glam::IVec2, () => Color, () => bool]),
|
||||
async_node!(graphene_core::AddArtboardNode<_, _>, input: Footprint, output: ArtboardGroup, fn_params: [Footprint => Artboard, Footprint => ArtboardGroup]),
|
||||
async_node!(graphene_core::AddArtboardNode<_, _>, input: Footprint, output: ArtboardGroup, fn_params: [Footprint => Artboard, Footprint => ArtboardGroup]),
|
||||
];
|
||||
let mut map: HashMap<ProtoNodeIdentifier, HashMap<NodeIOTypes, NodeConstructor>> = HashMap::new();
|
||||
for (id, c, types) in node_types.into_iter().flatten() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue