mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-12-23 10:11:54 +00:00
Add node introspection API
Closes #1110 Test Plan: query the introspectNode Endpoint from js Reviewers: Pull Request: https://github.com/GraphiteEditor/Graphite/pull/1183
This commit is contained in:
parent
0af42ee6f9
commit
bea7cc8dd0
6 changed files with 48 additions and 5 deletions
|
|
@ -8,12 +8,12 @@ use graphene_core::text::Font;
|
|||
pub struct Dispatcher {
|
||||
message_queues: Vec<VecDeque<Message>>,
|
||||
pub responses: Vec<FrontendMessage>,
|
||||
message_handlers: DispatcherMessageHandlers,
|
||||
pub message_handlers: DispatcherMessageHandlers,
|
||||
}
|
||||
|
||||
#[remain::sorted]
|
||||
#[derive(Debug, Default)]
|
||||
struct DispatcherMessageHandlers {
|
||||
pub struct DispatcherMessageHandlers {
|
||||
broadcast_message_handler: BroadcastMessageHandler,
|
||||
debug_message_handler: DebugMessageHandler,
|
||||
dialog_message_handler: DialogMessageHandler,
|
||||
|
|
@ -21,7 +21,7 @@ struct DispatcherMessageHandlers {
|
|||
input_preprocessor_message_handler: InputPreprocessorMessageHandler,
|
||||
key_mapping_message_handler: KeyMappingMessageHandler,
|
||||
layout_message_handler: LayoutMessageHandler,
|
||||
portfolio_message_handler: PortfolioMessageHandler,
|
||||
pub portfolio_message_handler: PortfolioMessageHandler,
|
||||
preferences_message_handler: PreferencesMessageHandler,
|
||||
tool_message_handler: ToolMessageHandler,
|
||||
workspace_message_handler: WorkspaceMessageHandler,
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ use document_legacy::layers::layer_info::LayerDataType;
|
|||
use document_legacy::layers::style::RenderData;
|
||||
use document_legacy::Operation as DocumentOperation;
|
||||
use graph_craft::document::value::TaggedValue;
|
||||
use graph_craft::document::NodeInput;
|
||||
use graph_craft::document::{NodeId, NodeInput};
|
||||
use graphene_core::raster::Image;
|
||||
use graphene_core::text::Font;
|
||||
|
||||
|
|
@ -606,6 +606,10 @@ impl MessageHandler<PortfolioMessage, (&InputPreprocessorMessageHandler, &Prefer
|
|||
}
|
||||
|
||||
impl PortfolioMessageHandler {
|
||||
pub fn introspect_node(&self, node_path: &[NodeId]) -> Option<String> {
|
||||
self.executor.introspect_node(node_path)
|
||||
}
|
||||
|
||||
pub fn document(&self, document_id: u64) -> Option<&DocumentMessageHandler> {
|
||||
self.documents.get(&document_id)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,6 +51,10 @@ impl NodeGraphExecutor {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn introspect_node(&self, path: &[NodeId]) -> Option<String> {
|
||||
self.executor.introspect(path).flatten()
|
||||
}
|
||||
|
||||
/// Computes an input for a node in the graph
|
||||
pub fn compute_input<T: dyn_any::StaticType>(&mut self, old_network: &NodeNetwork, node_path: &[NodeId], mut input_index: usize, editor_api: Cow<EditorApi<'_>>) -> Result<T, String> {
|
||||
let mut network = old_network.clone();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue