Add Layer and Artboard node definitions and underlying data structures (#1204)

* Add basic node defenitions

* Code review

* change widget code

* Artboard node changes

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
0HyperCube
2023-05-09 21:57:22 +01:00
committed by Keavon Chambers
parent 7e1b452757
commit 4e0c673a35
12 changed files with 295 additions and 36 deletions

View File

@@ -286,7 +286,7 @@ impl NodeGraphExecutor {
self.last_output_type.insert(layer_path.clone(), Some(concrete!(VectorData)));
responses.add(Operation::SetLayerTransform { path: layer_path.clone(), transform });
responses.add(Operation::SetVectorData { path: layer_path, vector_data });
} else {
} else if core::any::TypeId::of::<ImageFrame<Color>>() == DynAny::type_id(boxed_node_graph_output.as_ref()) {
// Attempt to downcast to an image frame
let ImageFrame { image, transform } = dyn_any::downcast(boxed_node_graph_output).map(|image_frame| *image_frame)?;
self.last_output_type.insert(layer_path.clone(), Some(concrete!(ImageFrame<Color>)));
@@ -316,6 +316,14 @@ impl NodeGraphExecutor {
}];
responses.add(FrontendMessage::UpdateImageData { document_id, image_data });
}
} else if core::any::TypeId::of::<graphene_core::Artboard>() == DynAny::type_id(boxed_node_graph_output.as_ref()) {
let artboard: graphene_core::Artboard = dyn_any::downcast(boxed_node_graph_output).map(|artboard| *artboard)?;
info!("{artboard:#?}");
return Err(format!("Artboard (see console)"));
} else if core::any::TypeId::of::<graphene_core::GraphicGroup>() == DynAny::type_id(boxed_node_graph_output.as_ref()) {
let graphic_group: graphene_core::GraphicGroup = dyn_any::downcast(boxed_node_graph_output).map(|graphic| *graphic)?;
info!("{graphic_group:#?}");
return Err(format!("Graphic group (see console)"));
}
Ok(())