Skip to content

Proposal for dynamically generated node pins #56

@tristanpoland

Description

@tristanpoland

Proposal for dynamically generated node pins

Thanks for the help @ThePywon!

/// Execute different branches based on string value.
///
/// This node matches the input string against several predefined options and executes
/// the corresponding branch for the first match. If the input does not match any option,
/// the default branch is executed.
///
/// # Inputs
/// - `value`: The string value to match against the options
///
/// # Execution Outputs
/// - `Option1`: Executes if value matches "option1"
/// - `Option2`: Executes if value matches "option2"
/// - `Option3`: Executes if value matches "option3"
/// - `Default`: Executes if no match is found
///
/// # Example
/// If `value` is "option2", the node will execute the code connected to `Option2`.
/// If `value` is "unknown", the node will execute the code connected to `Default`.
///
/// # Notes
/// You can customize the option strings and add more branches as needed.
/// # Switch on String
/// Routes execution based on a string value.
/// Matches the string against predefined options or executes the default branch.
#[blueprint(type: NodeTypes::control_flow, category: "Flow", color: "#BD10E0")]
pub fn switch_on_string(value: String) {
    match value.as_str() {
        array!({
            param!("Match Name", inner_value, String);
            inner_value => exec_output!(inner_value),
        }),
        _ => exec_output!("Default"),
    }
}

Reference material:

This would allow similar functionality to the dynamically pinned nodes in Unreal Engine but allowing for more complexity.

Image

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions