Implement download/copy ImageFrame layer output (#1194)

* Implement download/copy ImageFrame layer output

* Add note about black transparency when copying

* Introspect node graph output type to conditionally disable the download button

---------

Co-authored-by: Dennis Kobert <dennis@kobert.dev>
This commit is contained in:
Keavon Chambers
2023-05-03 02:09:07 -07:00
committed by GitHub
parent 83b382c50e
commit 7c115b3b26
17 changed files with 197 additions and 52 deletions

View File

@@ -449,7 +449,7 @@ impl Layer {
/// Get a mutable reference to the NodeNetwork
/// This operation will fail if the [Layer type](Layer::data) is not `LayerDataType::Layer`.
pub fn as_node_graph_mut(&mut self) -> Result<&mut graph_craft::document::NodeNetwork, DocumentError> {
pub fn as_layer_network_mut(&mut self) -> Result<&mut graph_craft::document::NodeNetwork, DocumentError> {
match &mut self.data {
LayerDataType::Layer(layer) => Ok(&mut layer.network),
_ => Err(DocumentError::NotNodeGraph),
@@ -458,14 +458,14 @@ impl Layer {
/// Get a reference to the NodeNetwork
/// This operation will fail if the [Layer type](Layer::data) is not `LayerDataType::Layer`.
pub fn as_node_graph(&self) -> Result<&graph_craft::document::NodeNetwork, DocumentError> {
pub fn as_layer_network(&self) -> Result<&graph_craft::document::NodeNetwork, DocumentError> {
match &self.data {
LayerDataType::Layer(layer) => Ok(&layer.network),
_ => Err(DocumentError::NotNodeGraph),
}
}
pub fn as_graph_frame(&self) -> Result<&LayerLayer, DocumentError> {
pub fn as_layer(&self) -> Result<&LayerLayer, DocumentError> {
match &self.data {
LayerDataType::Layer(layer) => Ok(layer),
_ => Err(DocumentError::NotNodeGraph),