Footprint widget

This commit is contained in:
Adam
2025-07-26 14:55:40 -07:00
parent 84b3c90dc8
commit a2a6b3e12f
4 changed files with 62 additions and 42 deletions
@@ -122,7 +122,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
properties: Some("value_properties"),
},
DocumentNodeDefinition {
identifier: "Number Value",
identifier: "Real Number Value",
category: "Value",
node_template: NodeTemplate {
document_node: DocumentNode {
@@ -140,6 +140,25 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
description: Cow::Borrowed("Constructs a number which can be set to any real number"),
properties: Some("value_properties"),
},
DocumentNodeDefinition {
identifier: "Whole Number Value",
category: "Value",
node_template: NodeTemplate {
document_node: DocumentNode {
implementation: DocumentNodeImplementation::ProtoNode(ops::identity::IDENTIFIER),
manual_composition: Some(generic!(T)),
inputs: vec![NodeInput::value(TaggedValue::U32(0), false)],
..Default::default()
},
persistent_node_metadata: DocumentNodePersistentMetadata {
input_metadata: vec![("Value", "").into()],
output_names: vec!["Out".to_string()],
..Default::default()
},
},
description: Cow::Borrowed("Constructs a positive integer value."),
properties: Some("value_properties"),
},
DocumentNodeDefinition {
identifier: "Percentage Value",
category: "Value",
@@ -159,25 +178,6 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
description: Cow::Borrowed("Constructs a decimal value between 0 and 1."),
properties: Some("value_properties"),
},
DocumentNodeDefinition {
identifier: "Number Value",
category: "Value",
node_template: NodeTemplate {
document_node: DocumentNode {
implementation: DocumentNodeImplementation::ProtoNode(ops::identity::IDENTIFIER),
manual_composition: Some(generic!(T)),
inputs: vec![NodeInput::value(TaggedValue::U32(0), false)],
..Default::default()
},
persistent_node_metadata: DocumentNodePersistentMetadata {
input_metadata: vec![("Value", "").into()],
output_names: vec!["Out".to_string()],
..Default::default()
},
},
description: Cow::Borrowed("Constructs a positive integer value."),
properties: Some("value_properties"),
},
DocumentNodeDefinition {
identifier: "Bool Value",
category: "Value",
@@ -235,6 +235,25 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
description: Cow::Borrowed("Constructs a string value which can be set to any plain text."),
properties: Some("value_properties"),
},
DocumentNodeDefinition {
identifier: "Footprint Value",
category: "Value",
node_template: NodeTemplate {
document_node: DocumentNode {
implementation: DocumentNodeImplementation::ProtoNode(ops::identity::IDENTIFIER),
manual_composition: Some(generic!(T)),
inputs: vec![NodeInput::value(TaggedValue::Footprint(Footprint::default()), false)],
..Default::default()
},
persistent_node_metadata: DocumentNodePersistentMetadata {
input_metadata: vec![("Value", "").into()],
output_names: vec!["Out".to_string()],
..Default::default()
},
},
description: Cow::Borrowed("Constructs a string value which can be set to any plain text."),
properties: Some("value_properties"),
},
DocumentNodeDefinition {
identifier: "Color Value",
category: "Value",
@@ -1967,21 +1967,25 @@ pub fn value_properties(node_id: NodeId, context: &mut NodePropertiesContext) ->
return Vec::new();
}
let LayoutGroup::Row { widgets: mut type_widgets } = type_widgets.remove(0) else {
log::error!("Could not get autogenerated widgets for value node");
return Vec::new();
};
for row in &mut type_widgets {
let LayoutGroup::Row { widgets: type_widgets_first_row } = row else {
log::error!("Could not get autogenerated widgets for value node");
continue;
};
if type_widgets.len() <= 2 {
log::error!("Could not generate type widgets for value node");
return Vec::new();
if type_widgets_first_row.len() <= 2 {
log::error!("Could not generate type widgets for value node");
continue;
}
//Remove the name and blank assist
type_widgets_first_row.remove(0);
type_widgets_first_row.remove(0);
}
//Remove the name and blank assist
type_widgets.remove(0);
type_widgets.remove(0);
vec![LayoutGroup::Row { widgets: select_value_widgets }, LayoutGroup::Row { widgets: type_widgets }]
let mut full_value_widgets = vec![LayoutGroup::Row { widgets: select_value_widgets }];
full_value_widgets.extend(type_widgets);
full_value_widgets
}
pub struct ParameterWidgetsInfo<'a> {