Skip to content

Commit ffa7f1a

Browse files
committed
Simplify layer node further
1 parent 99fd619 commit ffa7f1a

File tree

2 files changed

+13
-27
lines changed

2 files changed

+13
-27
lines changed

editor/src/messages/portfolio/document/node_graph/document_node_definitions.rs

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -237,28 +237,21 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
237237
node_template: NodeTemplate {
238238
document_node: DocumentNode {
239239
implementation: DocumentNodeImplementation::Network(NodeNetwork {
240-
exports: vec![NodeInput::node(NodeId(2), 0)],
240+
exports: vec![NodeInput::node(NodeId(1), 0)],
241241
nodes: [
242-
// Primary (bottom) input type coercion
243-
DocumentNode {
244-
inputs: vec![NodeInput::network(generic!(T), 0)],
245-
implementation: DocumentNodeImplementation::proto("graphene_core::graphic_element::ToGroupNode"),
246-
manual_composition: Some(generic!(T)),
247-
..Default::default()
248-
},
249242
// The monitor node is used to display a thumbnail in the UI
250243
DocumentNode {
251-
inputs: vec![NodeInput::network(generic!(T), 1)],
244+
inputs: vec![NodeInput::network(concrete!(GraphicElement), 1)],
252245
implementation: DocumentNodeImplementation::proto("graphene_core::memo::MonitorNode"),
253-
manual_composition: Some(generic!(T)),
246+
manual_composition: Some(concrete!(Context)),
254247
skip_deduplication: true,
255248
..Default::default()
256249
},
257250
DocumentNode {
258251
manual_composition: Some(generic!(T)),
259252
inputs: vec![
253+
NodeInput::network(concrete!(GraphicGroupTable), 0),
260254
NodeInput::node(NodeId(0), 0),
261-
NodeInput::node(NodeId(1), 0),
262255
NodeInput::Reflection(graph_craft::document::DocumentNodeMetadata::DocumentNodePath),
263256
],
264257
implementation: DocumentNodeImplementation::proto("graphene_core::graphic_element::LayerNode"),
@@ -284,22 +277,6 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
284277
network_metadata: Some(NodeNetworkMetadata {
285278
persistent_metadata: NodeNetworkPersistentMetadata {
286279
node_metadata: [
287-
DocumentNodeMetadata {
288-
persistent_metadata: DocumentNodePersistentMetadata {
289-
display_name: "To Element".to_string(),
290-
node_type_metadata: NodeTypePersistentMetadata::node(IVec2::new(-14, -1)),
291-
..Default::default()
292-
},
293-
..Default::default()
294-
},
295-
DocumentNodeMetadata {
296-
persistent_metadata: DocumentNodePersistentMetadata {
297-
display_name: "To Group".to_string(),
298-
node_type_metadata: NodeTypePersistentMetadata::node(IVec2::new(-14, -3)),
299-
..Default::default()
300-
},
301-
..Default::default()
302-
},
303280
DocumentNodeMetadata {
304281
persistent_metadata: DocumentNodePersistentMetadata {
305282
display_name: "Monitor".to_string(),

node-graph/preprocessor/src/lib.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ pub fn generate_node_substitutions() -> HashMap<String, DocumentNode> {
5050

5151
let into_node_registry = &interpreted_executor::node_registry::NODE_REGISTRY;
5252

53+
let mut generated_nodes = 0;
5354
let mut nodes: HashMap<_, _, _> = node_io_types
5455
.iter()
5556
.enumerate()
@@ -70,11 +71,13 @@ pub fn generate_node_substitutions() -> HashMap<String, DocumentNode> {
7071
let ident = ident.name.as_ref();
7172
ident == into_node_identifier.name.as_ref()
7273
}) {
74+
generated_nodes += 1;
7375
into_node_identifier
7476
} else if into_node_registry.iter().any(|(ident, _)| {
7577
let ident = ident.name.as_ref();
7678
ident == convert_node_identifier.name.as_ref()
7779
}) {
80+
generated_nodes += 1;
7881
convert_node_identifier
7982
} else {
8083
identity_node.clone()
@@ -98,6 +101,11 @@ pub fn generate_node_substitutions() -> HashMap<String, DocumentNode> {
98101
})
99102
.collect();
100103

104+
if generated_nodes == 0 {
105+
log::debug!("skipping {}", id);
106+
continue;
107+
}
108+
101109
let document_node = DocumentNode {
102110
inputs: network_inputs,
103111
manual_composition: Some(input_type.clone()),
@@ -127,6 +135,7 @@ pub fn generate_node_substitutions() -> HashMap<String, DocumentNode> {
127135

128136
custom.insert(id.clone(), node);
129137
}
138+
130139
custom
131140
}
132141

0 commit comments

Comments
 (0)