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
|
|
@ -197,9 +197,10 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
|
||||||
category: "General",
|
category: "General",
|
||||||
is_layer: true,
|
is_layer: true,
|
||||||
implementation: DocumentNodeImplementation::Network(NodeNetwork {
|
implementation: DocumentNodeImplementation::Network(NodeNetwork {
|
||||||
imports: vec![NodeId(2), NodeId(0)],
|
imports: vec![NodeId(1), NodeId(0)],
|
||||||
exports: vec![NodeOutput::new(NodeId(2), 0)],
|
exports: vec![NodeOutput::new(NodeId(3), 0)],
|
||||||
nodes: [
|
nodes: [
|
||||||
|
// Secondary (left) input type coercion
|
||||||
(
|
(
|
||||||
NodeId(0),
|
NodeId(0),
|
||||||
DocumentNode {
|
DocumentNode {
|
||||||
|
|
@ -209,24 +210,30 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
// The monitor node is used to display a thumbnail in the UI.
|
// Primary (bottom) input type coercion
|
||||||
// TODO: Check if thumbnail is reversed
|
|
||||||
(
|
(
|
||||||
NodeId(1),
|
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 {
|
DocumentNode {
|
||||||
inputs: vec![NodeInput::node(NodeId(0), 0)],
|
inputs: vec![NodeInput::node(NodeId(0), 0)],
|
||||||
..monitor_node()
|
..monitor_node()
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
NodeId(2),
|
NodeId(3),
|
||||||
DocumentNode {
|
DocumentNode {
|
||||||
name: "ConstructLayer".to_string(),
|
name: "ConstructLayer".to_string(),
|
||||||
manual_composition: Some(concrete!(Footprint)),
|
manual_composition: Some(concrete!(Footprint)),
|
||||||
inputs: vec![
|
inputs: vec![NodeInput::node(NodeId(2), 0), NodeInput::node(NodeId(1), 0)],
|
||||||
NodeInput::node(NodeId(1), 0),
|
|
||||||
NodeInput::Network(graphene_core::Type::Fn(Box::new(concrete!(Footprint)), Box::new(concrete!(graphene_core::GraphicGroup)))),
|
|
||||||
],
|
|
||||||
implementation: DocumentNodeImplementation::proto("graphene_core::ConstructLayerNode<_, _>"),
|
implementation: DocumentNodeImplementation::proto("graphene_core::ConstructLayerNode<_, _>"),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -158,6 +158,13 @@ fn to_graphic_element<Data: Into<GraphicElement>>(data: Data) -> GraphicElement
|
||||||
data.into()
|
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> {
|
pub struct ConstructArtboardNode<Contents, Location, Dimensions, Background, Clip> {
|
||||||
contents: Contents,
|
contents: Contents,
|
||||||
location: Location,
|
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: ImageFrame<Color>, params: []),
|
||||||
register_node!(graphene_core::ToGraphicElementNode, input: GraphicGroup, params: []),
|
register_node!(graphene_core::ToGraphicElementNode, input: GraphicGroup, params: []),
|
||||||
register_node!(graphene_core::ToGraphicElementNode, input: Artboard, 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::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();
|
let mut map: HashMap<ProtoNodeIdentifier, HashMap<NodeIOTypes, NodeConstructor>> = HashMap::new();
|
||||||
for (id, c, types) in node_types.into_iter().flatten() {
|
for (id, c, types) in node_types.into_iter().flatten() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue