Skip to content

Commit 8545df8

Browse files
committed
Fix f32 frontend data types
1 parent e5768c9 commit 8545df8

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

editor/src/messages/portfolio/document/node_graph/utility_types.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ impl FrontendGraphDataType {
2323
match TaggedValue::from_type_or_none(input) {
2424
TaggedValue::U32(_)
2525
| TaggedValue::U64(_)
26+
| TaggedValue::F32(_)
2627
| TaggedValue::F64(_)
2728
| TaggedValue::DVec2(_)
2829
| TaggedValue::F64Array4(_)

node-graph/graph-craft/src/document/value.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ impl TaggedValue {
260260
TaggedValue::String(x) => format!("\"{x}\""),
261261
TaggedValue::U32(x) => x.to_string() + "_u32",
262262
TaggedValue::U64(x) => x.to_string() + "_u64",
263+
TaggedValue::F32(x) => x.to_string() + "_f32",
263264
TaggedValue::F64(x) => x.to_string() + "_f64",
264265
TaggedValue::Bool(x) => x.to_string(),
265266
TaggedValue::BlendMode(x) => "BlendMode::".to_string() + &x.to_string(),
@@ -351,6 +352,7 @@ impl TaggedValue {
351352
x if x == TypeId::of::<()>() => TaggedValue::None,
352353
x if x == TypeId::of::<String>() => TaggedValue::String(string.into()),
353354
x if x == TypeId::of::<f64>() => FromStr::from_str(string).map(TaggedValue::F64).ok()?,
355+
x if x == TypeId::of::<f32>() => FromStr::from_str(string).map(TaggedValue::F32).ok()?,
354356
x if x == TypeId::of::<u64>() => FromStr::from_str(string).map(TaggedValue::U64).ok()?,
355357
x if x == TypeId::of::<u32>() => FromStr::from_str(string).map(TaggedValue::U32).ok()?,
356358
x if x == TypeId::of::<DVec2>() => to_dvec2(string).map(TaggedValue::DVec2)?,
@@ -381,6 +383,7 @@ impl Display for TaggedValue {
381383
TaggedValue::String(x) => f.write_str(x),
382384
TaggedValue::U32(x) => f.write_fmt(format_args!("{x}")),
383385
TaggedValue::U64(x) => f.write_fmt(format_args!("{x}")),
386+
TaggedValue::F32(x) => f.write_fmt(format_args!("{x}")),
384387
TaggedValue::F64(x) => f.write_fmt(format_args!("{x}")),
385388
TaggedValue::Bool(x) => f.write_fmt(format_args!("{x}")),
386389
_ => panic!("Cannot convert to string"),

0 commit comments

Comments
 (0)