Skip to content

Commit 6e1896b

Browse files
committed
Simplify layer node further
1 parent 4dc2253 commit 6e1896b

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
@@ -239,28 +239,21 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
239239
node_template: NodeTemplate {
240240
document_node: DocumentNode {
241241
implementation: DocumentNodeImplementation::Network(NodeNetwork {
242-
exports: vec![NodeInput::node(NodeId(2), 0)],
242+
exports: vec![NodeInput::node(NodeId(1), 0)],
243243
nodes: [
244-
// Primary (bottom) input type coercion
245-
DocumentNode {
246-
inputs: vec![NodeInput::network(generic!(T), 0)],
247-
implementation: DocumentNodeImplementation::proto("graphene_core::graphic_element::ToGroupNode"),
248-
manual_composition: Some(generic!(T)),
249-
..Default::default()
250-
},
251244
// The monitor node is used to display a thumbnail in the UI
252245
DocumentNode {
253-
inputs: vec![NodeInput::network(generic!(T), 1)],
246+
inputs: vec![NodeInput::network(concrete!(GraphicElement), 1)],
254247
implementation: DocumentNodeImplementation::proto("graphene_core::memo::MonitorNode"),
255-
manual_composition: Some(generic!(T)),
248+
manual_composition: Some(concrete!(Context)),
256249
skip_deduplication: true,
257250
..Default::default()
258251
},
259252
DocumentNode {
260253
manual_composition: Some(generic!(T)),
261254
inputs: vec![
255+
NodeInput::network(concrete!(GraphicGroupTable), 0),
262256
NodeInput::node(NodeId(0), 0),
263-
NodeInput::node(NodeId(1), 0),
264257
NodeInput::Reflection(graph_craft::document::DocumentNodeMetadata::DocumentNodePath),
265258
],
266259
implementation: DocumentNodeImplementation::proto("graphene_core::graphic_element::LayerNode"),
@@ -286,22 +279,6 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
286279
network_metadata: Some(NodeNetworkMetadata {
287280
persistent_metadata: NodeNetworkPersistentMetadata {
288281
node_metadata: [
289-
DocumentNodeMetadata {
290-
persistent_metadata: DocumentNodePersistentMetadata {
291-
display_name: "To Element".to_string(),
292-
node_type_metadata: NodeTypePersistentMetadata::node(IVec2::new(-14, -1)),
293-
..Default::default()
294-
},
295-
..Default::default()
296-
},
297-
DocumentNodeMetadata {
298-
persistent_metadata: DocumentNodePersistentMetadata {
299-
display_name: "To Group".to_string(),
300-
node_type_metadata: NodeTypePersistentMetadata::node(IVec2::new(-14, -3)),
301-
..Default::default()
302-
},
303-
..Default::default()
304-
},
305282
DocumentNodeMetadata {
306283
persistent_metadata: DocumentNodePersistentMetadata {
307284
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)