mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-17 07:18:04 +08:00
WIP: Refactor TypeSource
This commit is contained in:
@@ -334,6 +334,15 @@ impl Type {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn into_nested_type(self) -> Type {
|
||||
match self {
|
||||
Self::Generic(_) => self,
|
||||
Self::Concrete(_) => self,
|
||||
Self::Fn(_, output) => output.into_nested_type(),
|
||||
Self::Future(output) => output.into_nested_type(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn replace_nested(&mut self, f: impl Fn(&Type) -> Option<Type>) -> Option<Type> {
|
||||
if let Some(replacement) = f(self) {
|
||||
return Some(std::mem::replace(self, replacement));
|
||||
|
||||
@@ -209,6 +209,14 @@ pub enum DocumentNodeMetadata {
|
||||
DocumentNodePath,
|
||||
}
|
||||
|
||||
impl DocumentNodeMetadata {
|
||||
pub fn ty(&self) -> Type {
|
||||
match self {
|
||||
DocumentNodeMetadata::DocumentNodePath => concrete!(Vec<NodeId>),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl NodeInput {
|
||||
pub const fn node(node_id: NodeId, output_index: usize) -> Self {
|
||||
Self::Node { node_id, output_index }
|
||||
|
||||
@@ -33,17 +33,6 @@ impl Default for DynamicExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Clone, Debug, Default, serde::Serialize, serde::Deserialize)]
|
||||
pub struct NodeTypes {
|
||||
pub inputs: Vec<Type>,
|
||||
pub output: Type,
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Clone, Debug, Default, serde::Serialize, serde::Deserialize)]
|
||||
pub struct ResolvedDocumentNodeTypes {
|
||||
pub types: HashMap<Vec<NodeId>, NodeTypes>,
|
||||
}
|
||||
|
||||
type Path = Box<[NodeId]>;
|
||||
|
||||
#[derive(PartialEq, Clone, Debug, Default, serde::Serialize, serde::Deserialize)]
|
||||
|
||||
@@ -44,6 +44,7 @@ pub fn wrap_network_in_scope(mut network: NodeNetwork, editor_api: Arc<WasmEdito
|
||||
..Default::default()
|
||||
},
|
||||
// TODO: Add conversion step
|
||||
// Keep this in sync with the protonode id in valid_input_types for the document network export
|
||||
DocumentNode {
|
||||
call_argument: concrete!(graphene_std::application_io::RenderConfig),
|
||||
inputs: vec![
|
||||
|
||||
Reference in New Issue
Block a user