Change Table<Color> node inputs to Color where only one value is used so GPU nodes work (#3096)

* graster-nodes: change `Table<Color>` params to `Color` where only one value is used

* Re-add support for Color and Option<Color>

* Add warning when a default value isn't parsed

---------

Co-authored-by: hypercube <0hypercube@gmail.com>
This commit is contained in:
Firestar99
2025-08-28 15:16:56 +02:00
committed by GitHub
parent 9987112cc9
commit 95ef8a5343
8 changed files with 46 additions and 23 deletions

View File

@@ -1,3 +1,6 @@
#[macro_use]
extern crate log;
use graph_craft::document::value::*;
use graph_craft::document::*;
use graph_craft::proto::RegistryValueSource;
@@ -150,7 +153,14 @@ pub fn node_inputs(fields: &[registry::FieldMetadata], first_node_io: &NodeIOTyp
match field.value_source {
RegistryValueSource::None => {}
RegistryValueSource::Default(data) => return NodeInput::value(TaggedValue::from_primitive_string(data, ty).unwrap_or(TaggedValue::None), exposed),
RegistryValueSource::Default(data) => {
if let Some(custom_default) = TaggedValue::from_primitive_string(data, ty) {
return NodeInput::value(custom_default, exposed);
} else {
// It is incredibly useful to get a warning when the default type cannot be parsed rather than defaulting to `()`.
warn!("Failed to parse default value for type {ty:?} with data {data}");
}
}
RegistryValueSource::Scope(data) => return NodeInput::scope(Cow::Borrowed(data)),
};