diff --git a/editor/src/messages/portfolio/document/node_graph/document_node_definitions.rs b/editor/src/messages/portfolio/document/node_graph/document_node_definitions.rs index 9ac3c5b08c..4a49d9ef0d 100644 --- a/editor/src/messages/portfolio/document/node_graph/document_node_definitions.rs +++ b/editor/src/messages/portfolio/document/node_graph/document_node_definitions.rs @@ -2495,17 +2495,17 @@ fn static_nodes() -> Vec { let NodeMetadata { display_name, category, fields } = metadata; let Some(implementations) = &node_registry.get(&id) else { continue }; - let valid_inputs: HashSet<_> = implementations.iter().map(|(_, node_io)| node_io.input.clone()).collect(); + 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.input; + let mut input_type = &first_node_io.call_argument; if valid_inputs.len() > 1 { input_type = &const { generic!(T) }; } - let output_type = &first_node_io.output; + let output_type = &first_node_io.return_value; let inputs = fields .iter() - .zip(first_node_io.parameters.iter()) + .zip(first_node_io.inputs.iter()) .enumerate() .map(|(index, (field, ty))| { let exposed = if index == 0 { *ty != fn_type!(()) } else { field.exposed }; @@ -2526,7 +2526,7 @@ fn static_nodes() -> Vec { let properties = match properties_overrides.get(id.as_str()) { Some(properties_function) => *properties_function, None => { - let field_types: Vec<_> = fields.iter().zip(first_node_io.parameters.iter()).map(|(field, ty)| (field.clone(), ty.clone())).collect(); + let field_types: Vec<_> = fields.iter().zip(first_node_io.inputs.iter()).map(|(field, ty)| (field.clone(), ty.clone())).collect(); let properties = move |document_node: &DocumentNode, node_id: NodeId, context: &mut NodePropertiesContext| { let rows: Vec<_> = field_types .iter() diff --git a/editor/src/messages/portfolio/document/utility_types/network_interface.rs b/editor/src/messages/portfolio/document/utility_types/network_interface.rs index e6a2013541..bff8a67d51 100644 --- a/editor/src/messages/portfolio/document/utility_types/network_interface.rs +++ b/editor/src/messages/portfolio/document/utility_types/network_interface.rs @@ -511,7 +511,7 @@ impl NodeNetworkInterface { } } DocumentNodeImplementation::ProtoNode(_) => { - // If a node has manual composition, then offset the input index by 1 since the proto node also includes the type of the parameter passed through manual composition. + // If a node has manual composition, then offset the input index by 1 since the proto node also includes the type of the input passed through manual composition. let manual_composition_offset = if node.manual_composition.is_some() { 1 } else { 0 }; self.resolved_types .types @@ -552,7 +552,7 @@ impl NodeNetworkInterface { let skip_footprint = if node.manual_composition.is_some() { 1 } else { 0 }; - let Some(input_type) = std::iter::once(node_types.input.clone()).chain(node_types.parameters.clone()).nth(input_index + skip_footprint) else { + let Some(input_type) = std::iter::once(node_types.call_argument.clone()).chain(node_types.inputs.clone()).nth(input_index + skip_footprint) else { log::error!("Could not get type"); return (concrete!(()), TypeSource::Error("could not get the protonode's input")); }; @@ -678,7 +678,7 @@ impl NodeNetworkInterface { let node_id_path = &[network_path, &[*node_id]].concat(); let primary_output_type = self.resolved_types.types.get(node_id_path).map(|ty| (ty.output.clone(), TypeSource::Compiled)).or_else(|| { let node_types = random_protonode_implementation(protonode)?; - Some((node_types.output.clone(), TypeSource::RandomProtonodeImplementation)) + Some((node_types.return_value.clone(), TypeSource::RandomProtonodeImplementation)) }); output_types.push(primary_output_type); diff --git a/editor/src/messages/tool/common_functionality/graph_modification_utils.rs b/editor/src/messages/tool/common_functionality/graph_modification_utils.rs index 9121f31677..6ec5f05074 100644 --- a/editor/src/messages/tool/common_functionality/graph_modification_utils.rs +++ b/editor/src/messages/tool/common_functionality/graph_modification_utils.rs @@ -105,7 +105,7 @@ pub fn get_blend_mode(layer: LayerNodeIdentifier, network_interface: &NodeNetwor /// Get the current opacity of a layer from the closest Opacity node. /// This may differ from the actual opacity contained within the data type reaching this layer, because that actual opacity may be: /// - Multiplied with additional opacity nodes earlier in the chain -/// - Set by an Opacity node with an exposed parameter value driven by another node +/// - Set by an Opacity node with an exposed input value driven by another node /// - Already factored into the pixel alpha channel of an image /// - The default value of 100% if no Opacity node is present, but this function returns None in that case /// diff --git a/editor/src/messages/tool/tool_messages/brush_tool.rs b/editor/src/messages/tool/tool_messages/brush_tool.rs index 5b8d733f46..fffe3e280a 100644 --- a/editor/src/messages/tool/tool_messages/brush_tool.rs +++ b/editor/src/messages/tool/tool_messages/brush_tool.rs @@ -330,7 +330,7 @@ impl Fsm for BrushToolFsmState { let layer_document_scale = document.metadata().transform_to_document(parent) * tool_data.transform; - // TODO: Also scale it based on the input image ('Background' parameter). + // TODO: Also scale it based on the input image ('Background' input). // TODO: Resizing the input image results in a different brush size from the chosen diameter. let layer_scale = 0.0001_f64 // Safety against division by zero .max((layer_document_scale.matrix2 * glam::DVec2::X).length()) diff --git a/frontend/src/components/views/Graph.svelte b/frontend/src/components/views/Graph.svelte index 9e026d5e59..e40c23b4e7 100644 --- a/frontend/src/components/views/Graph.svelte +++ b/frontend/src/components/views/Graph.svelte @@ -280,20 +280,20 @@ editor.handle.createNode(nodeType, $nodeGraph.contextMenuInformation.contextMenuCoordinates.x, $nodeGraph.contextMenuInformation.contextMenuCoordinates.y); } - function nodeBorderMask(nodeWidth: number, primaryInputExists: boolean, parameters: number, primaryOutputExists: boolean, exposedOutputs: number): string { - const nodeHeight = Math.max(1 + parameters, 1 + exposedOutputs) * 24; + function nodeBorderMask(nodeWidth: number, primaryInputExists: boolean, exposedSecondaryInputs: number, primaryOutputExists: boolean, exposedSecondaryOutputs: number): string { + const nodeHeight = Math.max(1 + exposedSecondaryInputs, 1 + exposedSecondaryOutputs) * 24; const boxes: { x: number; y: number; width: number; height: number }[] = []; // Primary input if (primaryInputExists) boxes.push({ x: -8, y: 4, width: 16, height: 16 }); - // Parameter inputs - for (let i = 0; i < parameters; i++) boxes.push({ x: -8, y: 4 + (i + 1) * 24, width: 16, height: 16 }); + // Secondary inputs + for (let i = 0; i < exposedSecondaryInputs; i++) boxes.push({ x: -8, y: 4 + (i + 1) * 24, width: 16, height: 16 }); // Primary output if (primaryOutputExists) boxes.push({ x: nodeWidth - 8, y: 4, width: 16, height: 16 }); // Exposed outputs - for (let i = 0; i < exposedOutputs; i++) boxes.push({ x: nodeWidth - 8, y: 4 + (i + 1) * 24, width: 16, height: 16 }); + for (let i = 0; i < exposedSecondaryOutputs; i++) boxes.push({ x: nodeWidth - 8, y: 4 + (i + 1) * 24, width: 16, height: 16 }); return borderMask(boxes, nodeWidth, nodeHeight); } @@ -704,17 +704,17 @@ {node.errors} {/if} -
+
{node.displayName}
- + {#if exposedInputsOutputs.length > 0} -
- {#each exposedInputsOutputs as parameter, index} -
- {parameter.name} +
+ {#each exposedInputsOutputs as secondary, index} +
+ {secondary.name}
{/each}
@@ -740,20 +740,20 @@ {/if} {/if} - {#each node.exposedInputs as parameter, index} + {#each node.exposedInputs as secondary, index} {#if index < node.exposedInputs.length} - {`${dataTypeTooltip(parameter)}\n${inputConnectedToText(parameter)}`} - {#if parameter.connectedTo !== undefined} + {`${dataTypeTooltip(secondary)}\n${inputConnectedToText(secondary)}`} + {#if secondary.connectedTo !== undefined} {:else} @@ -783,19 +783,19 @@ {/if} {/if} - {#each node.exposedOutputs as parameter, outputIndex} + {#each node.exposedOutputs as secondary, outputIndex} - {`${dataTypeTooltip(parameter)}\n${outputConnectedToText(parameter)}`} - {#if parameter.connectedTo !== undefined} + {`${dataTypeTooltip(secondary)}\n${outputConnectedToText(secondary)}`} + {#if secondary.connectedTo !== undefined} {:else} @@ -1300,7 +1300,7 @@ } } - .parameters { + .secondary { background: rgba(var(--color-f-white-rgb), 0.1); &.in-selected-network { @@ -1332,7 +1332,7 @@ border-radius: 2px 2px 0 0; background: rgba(var(--color-f-white-rgb), 0.05); - &.no-parameter-section { + &.no-secondary-section { border-radius: 2px; } @@ -1347,13 +1347,13 @@ } } - .parameters { + .secondary { display: flex; flex-direction: column; width: 100%; position: relative; - .parameter { + .secondary-row { position: relative; display: flex; align-items: center; diff --git a/node-graph/README.md b/node-graph/README.md index a3e6c79ace..0e7e381e1b 100644 --- a/node-graph/README.md +++ b/node-graph/README.md @@ -98,7 +98,7 @@ The `graphene_core::value::CopiedNode` is a node that, when evaluated, copies `1 ## Creating a new node -Instead of manually implementing the `Node` trait with complex generics, one can use the `node` macro, which can be applied to a function like `opacity`. This will generate the struct, implementation, node_registry entry, doucment node definition and properties panel entries: +Instead of manually implementing the `Node` trait with complex generics, one can use the `node` macro, which can be applied to a function like `opacity`. This will generate the struct, implementation, node_registry entry, document node definition and properties panel entries: ```rs #[node_macro::node(category("Raster: Adjustments"))] @@ -115,10 +115,10 @@ The macro invocation can be extended with additional attributes. The currently s ## Executing a document `NodeNetwork` When the document graph is executed, the following steps occur: -- The `NodeNetwork` is flattened using `NodeNetwork::flatten`. This involves removing any `DocumentNodeImplementation::Network` - which allow for nested document node networks (not currently exposed in the UI). Instead, all of the inner nodes are moved into a single node graph. -- The `NodeNetwork` is converted into a proto-graph, which separates out the primary input from the secondary inputs. The secondary inputs are stored as a list of node ids in the `ConstructionArgs` struct in the `ProtoNode`. Converting a document graph into a proto graph is done with `NodeNetwork::into_proto_networks`. +- The `NodeNetwork` is flattened using `NodeNetwork::flatten`. This involves removing any `DocumentNodeImplementation::Network` - which allow for nested document node networks. Instead, all of the inner nodes are moved into a single node graph. +- The `NodeNetwork` is converted into a proto-graph. Each node's inputs are stored as a list of node IDs in the `ConstructionArgs` struct in the `ProtoNode`. Converting a document graph into a proto graph is done with `NodeNetwork::into_proto_networks`. - The newly created `ProtoNode`s are then converted into the corresponding constructor functions using the mapping defined in `node-graph/interpreted-executor/src/node_registry.rs`. This is done by `BorrowTree::push_node`. -- The constructor functions are run with the `ConstructionArgs` enum. Constructors generally evaluate the result of these secondary inputs e.g. if you have a `Pi` node that is used as the second input to an `Add` node, the `Add` node's constructor will evaluate the `Pi` node. This is visible if you place a log statement in the `Pi` node's implementation. +- The constructor functions are run with the `ConstructionArgs` enum. Constructors generally evaluate the result of these inputs, e.g. if you have a `Pi` node that is used as the second input to an `Add` node, the `Add` node's constructor will evaluate the `Pi` node. This is visible if you place a log statement in the `Pi` node's implementation. - The resolved functions are stored in a `BorrowTree`, which allows previous proto-nodes to be referenced as inputs by later nodes. The `BorrowTree` ensures nodes can't be removed while being referenced by other nodes. The definition for the constructor of a node that applies the opacity transformation to each pixel of an image: @@ -141,7 +141,7 @@ The definition for the constructor of a node that applies the opacity transforma any.into_type_erased() }) }, - // Defines the input, output, and parameters (where each parameter is a function taking in some input and returning another input). + // Defines the call argument, return value, and inputs. NodeIOTypes::new(concrete!(Image), concrete!(Image), vec![fn_type!((), f64))]), ), ``` diff --git a/node-graph/gcore/src/lib.rs b/node-graph/gcore/src/lib.rs index 21a6c2ada3..2ed92debf2 100644 --- a/node-graph/gcore/src/lib.rs +++ b/node-graph/gcore/src/lib.rs @@ -96,24 +96,24 @@ where core::any::type_name::() } #[cfg(feature = "alloc")] - fn to_node_io(&self, parameters: Vec) -> NodeIOTypes { + fn to_node_io(&self, inputs: Vec) -> NodeIOTypes { NodeIOTypes { - input: concrete!(

-Next, that is fed into the Circular Repeat node which has several *parameters* you can modify and get different output data based on your choices, like in these examples: +Next, that is fed into the Circular Repeat node which has several parameters you can modify and get different output data based on your choices, like in these examples: