mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-19 02:48:12 +08:00
Remove the whole document-legacy crate (#1524)
Remove the whole document-legacy crate Closes #1520
This commit is contained in:
@@ -2,13 +2,12 @@ use crate::consts::FILE_SAVE_SUFFIX;
|
||||
use crate::messages::frontend::utility_types::FrontendImageData;
|
||||
use crate::messages::frontend::utility_types::{ExportBounds, FileType};
|
||||
use crate::messages::portfolio::document::node_graph::wrap_network_in_scope;
|
||||
use crate::messages::portfolio::document::utility_types::document_metadata::LayerNodeIdentifier;
|
||||
use crate::messages::portfolio::document::utility_types::layer_panel::LayerClassification;
|
||||
use crate::messages::portfolio::document::utility_types::misc::{LayerMetadata, LayerPanelEntry};
|
||||
use crate::messages::portfolio::document::utility_types::misc::LayerPanelEntry;
|
||||
use crate::messages::portfolio::document::utility_types::LayerId;
|
||||
use crate::messages::prelude::*;
|
||||
|
||||
use document_legacy::document::Document as DocumentLegacy;
|
||||
use document_legacy::document::LayerId;
|
||||
use document_legacy::document_metadata::LayerNodeIdentifier;
|
||||
use graph_craft::document::value::TaggedValue;
|
||||
use graph_craft::document::{generate_uuid, DocumentNodeImplementation, NodeId, NodeNetwork};
|
||||
use graph_craft::graphene_compiler::Compiler;
|
||||
@@ -493,7 +492,7 @@ impl NodeGraphExecutor {
|
||||
|
||||
let render_config = RenderConfig {
|
||||
viewport: Footprint {
|
||||
transform: document.document_legacy.metadata.document_to_viewport,
|
||||
transform: document.metadata.document_to_viewport,
|
||||
resolution: viewport_resolution,
|
||||
..Default::default()
|
||||
},
|
||||
@@ -581,7 +580,14 @@ impl NodeGraphExecutor {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn poll_node_graph_evaluation(&mut self, document: &mut DocumentLegacy, collapsed_folders: &mut Vec<LayerNodeIdentifier>, responses: &mut VecDeque<Message>) -> Result<(), String> {
|
||||
pub fn poll_node_graph_evaluation(&mut self, document: &mut DocumentMessageHandler, responses: &mut VecDeque<Message>) -> Result<(), String> {
|
||||
let DocumentMessageHandler {
|
||||
network: document_network,
|
||||
metadata: document_metadata,
|
||||
collapsed,
|
||||
..
|
||||
} = document;
|
||||
|
||||
let results = self.receiver.try_iter().collect::<Vec<_>>();
|
||||
for response in results {
|
||||
match response {
|
||||
@@ -602,34 +608,32 @@ impl NodeGraphExecutor {
|
||||
}
|
||||
|
||||
for (&node_id, svg) in &new_thumbnails {
|
||||
if !document.document_network.nodes.contains_key(&node_id) {
|
||||
if !document_network.nodes.contains_key(&node_id) {
|
||||
warn!("Missing node");
|
||||
continue;
|
||||
}
|
||||
let layer = LayerNodeIdentifier::new(node_id, &document.document_network);
|
||||
let layer = LayerNodeIdentifier::new(node_id, document_network);
|
||||
responses.add(FrontendMessage::UpdateDocumentLayerDetails {
|
||||
data: LayerPanelEntry {
|
||||
name: document.document_network.nodes.get(&node_id).map(|node| node.alias.clone()).unwrap_or_default(),
|
||||
name: document_network.nodes.get(&node_id).map(|node| node.alias.clone()).unwrap_or_default(),
|
||||
tooltip: if cfg!(debug_assertions) { format!("Layer ID: {node_id}") } else { "".into() },
|
||||
layer_classification: if document.metadata.is_artboard(layer) {
|
||||
layer_classification: if document_metadata.is_artboard(layer) {
|
||||
LayerClassification::Artboard
|
||||
} else if document.metadata.is_folder(layer) {
|
||||
} else if document_metadata.is_folder(layer) {
|
||||
LayerClassification::Folder
|
||||
} else {
|
||||
LayerClassification::Layer
|
||||
},
|
||||
layer_metadata: LayerMetadata {
|
||||
expanded: layer.has_children(&document.metadata) && !collapsed_folders.contains(&layer),
|
||||
selected: document.metadata.selected_layers_contains(layer),
|
||||
},
|
||||
expanded: layer.has_children(document_metadata) && !collapsed.contains(&layer),
|
||||
selected: document_metadata.selected_layers_contains(layer),
|
||||
path: vec![node_id],
|
||||
thumbnail: svg.to_string(),
|
||||
},
|
||||
});
|
||||
}
|
||||
self.thumbnails = new_thumbnails;
|
||||
document.metadata.update_transforms(new_upstream_transforms);
|
||||
document.metadata.update_click_targets(new_click_targets);
|
||||
document_metadata.update_transforms(new_upstream_transforms);
|
||||
document_metadata.update_click_targets(new_click_targets);
|
||||
responses.extend(updates);
|
||||
self.process_node_graph_output(node_graph_output, execution_context.layer_path.clone(), transform, responses)?;
|
||||
responses.add(DocumentMessage::RenderDocument);
|
||||
|
||||
Reference in New Issue
Block a user