mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-08-04 05:18:19 +00:00
Fix the Into nodes, which were broken but unused except in GPU nodes (#2480)
* Prototype document network level into node insertion * Fix generic type resolution * Cleanup * Remove network nesting
This commit is contained in:
parent
92132919d1
commit
41288d7642
8 changed files with 100 additions and 47 deletions
|
@ -292,7 +292,7 @@ impl<'a> ModifyInputsContext<'a> {
|
|||
// If inserting a path node, insert a flatten vector elements if the type is a graphic group.
|
||||
// TODO: Allow the path node to operate on Graphic Group data by utilizing the reference for each vector data in a group.
|
||||
if node_definition.identifier == "Path" {
|
||||
let layer_input_type = self.network_interface.input_type(&InputConnector::node(output_layer.to_node(), 1), &[]).0.nested_type();
|
||||
let layer_input_type = self.network_interface.input_type(&InputConnector::node(output_layer.to_node(), 1), &[]).0.nested_type().clone();
|
||||
if layer_input_type == concrete!(GraphicGroupTable) {
|
||||
let Some(flatten_vector_elements_definition) = resolve_document_node_type("Flatten Vector Elements") else {
|
||||
log::error!("Flatten Vector Elements does not exist in ModifyInputsContext::existing_node_id");
|
||||
|
|
|
@ -2,8 +2,8 @@ use super::node_properties;
|
|||
use super::utility_types::FrontendNodeType;
|
||||
use crate::messages::layout::utility_types::widget_prelude::*;
|
||||
use crate::messages::portfolio::document::utility_types::network_interface::{
|
||||
DocumentNodeMetadata, DocumentNodePersistentMetadata, NodeNetworkInterface, NodeNetworkMetadata, NodeNetworkPersistentMetadata, NodeTemplate, NodeTypePersistentMetadata, NumberInputSettings,
|
||||
PropertiesRow, Vec2InputSettings, WidgetOverride,
|
||||
DocumentNodeMetadata, DocumentNodePersistentMetadata, NodeNetworkInterface, NodeNetworkMetadata, NodeNetworkPersistentMetadata, NodePersistentMetadata, NodePosition, NodeTemplate,
|
||||
NodeTypePersistentMetadata, NumberInputSettings, PropertiesRow, Vec2InputSettings, WidgetOverride,
|
||||
};
|
||||
use crate::messages::portfolio::utility_types::PersistentData;
|
||||
use crate::messages::prelude::Message;
|
||||
|
@ -2663,6 +2663,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
|
|||
let node_registry = graphene_core::registry::NODE_REGISTRY.lock().unwrap();
|
||||
'outer: for (id, metadata) in graphene_core::registry::NODE_METADATA.lock().unwrap().iter() {
|
||||
use graphene_core::registry::*;
|
||||
let id = id.clone();
|
||||
|
||||
for node in custom.iter() {
|
||||
let DocumentNodeDefinition {
|
||||
|
@ -2673,7 +2674,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
|
|||
..
|
||||
} = node;
|
||||
match implementation {
|
||||
DocumentNodeImplementation::ProtoNode(ProtoNodeIdentifier { name }) if name == id => continue 'outer,
|
||||
DocumentNodeImplementation::ProtoNode(ProtoNodeIdentifier { name }) if name == &id => continue 'outer,
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
@ -2685,12 +2686,12 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
|
|||
description,
|
||||
properties,
|
||||
} = metadata;
|
||||
let Some(implementations) = &node_registry.get(id) else { continue };
|
||||
let Some(implementations) = &node_registry.get(&id) else { continue };
|
||||
let valid_inputs: HashSet<_> = implementations.iter().map(|(_, node_io)| node_io.call_argument.clone()).collect();
|
||||
let first_node_io = implementations.first().map(|(_, node_io)| node_io).unwrap_or(const { &NodeIOTypes::empty() });
|
||||
let mut input_type = &first_node_io.call_argument;
|
||||
if valid_inputs.len() > 1 {
|
||||
input_type = &const { generic!(T) };
|
||||
input_type = &const { generic!(D) };
|
||||
}
|
||||
let output_type = &first_node_io.return_value;
|
||||
|
||||
|
@ -2740,6 +2741,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
|
|||
output_names: vec![output_type.to_string()],
|
||||
has_primary_output: true,
|
||||
locked: false,
|
||||
|
||||
..Default::default()
|
||||
},
|
||||
},
|
||||
|
|
|
@ -654,7 +654,7 @@ impl NodeNetworkInterface {
|
|||
let input_type = self.input_type(&InputConnector::node(*node_id, iterator_index), network_path).0;
|
||||
// Value inputs are stored as concrete, so they are compared to the nested type. Node inputs are stored as fn, so they are compared to the entire type.
|
||||
// For example a node input of (Footprint) -> VectorData would not be compatible with () -> VectorData
|
||||
node_io.inputs[iterator_index].clone().nested_type() == input_type || node_io.inputs[iterator_index] == input_type
|
||||
node_io.inputs[iterator_index].clone().nested_type() == &input_type || node_io.inputs[iterator_index] == input_type
|
||||
});
|
||||
if valid_implementation { node_io.inputs.get(*input_index).cloned() } else { None }
|
||||
})
|
||||
|
|
|
@ -420,7 +420,7 @@ impl<'a> NodeGraphLayer<'a> {
|
|||
|
||||
/// Check if a layer is a raster layer
|
||||
pub fn is_raster_layer(layer: LayerNodeIdentifier, network_interface: &mut NodeNetworkInterface) -> bool {
|
||||
let layer_input_type = network_interface.input_type(&InputConnector::node(layer.to_node(), 1), &[]).0.nested_type();
|
||||
let layer_input_type = network_interface.input_type(&InputConnector::node(layer.to_node(), 1), &[]).0.nested_type().clone();
|
||||
if layer_input_type == concrete!(graphene_core::raster::image::ImageFrameTable<graphene_core::Color>)
|
||||
|| layer_input_type == concrete!(graphene_core::application_io::TextureFrameTable)
|
||||
|| layer_input_type == concrete!(graphene_std::RasterFrame)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue