Skip to content

Commit

Permalink
fix control affichage
Browse files Browse the repository at this point in the history
  • Loading branch information
wiiznokes committed Dec 4, 2023
1 parent dffdb6f commit d6c6ea8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .config/settings.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
unit = "Celsius"
update_delay = 2500
current_config = "test.toml"
current_config = "lin.toml"
4 changes: 4 additions & 0 deletions data/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -456,4 +456,8 @@ impl NodeType {
NodeType::Graph(..) | NodeType::Flat(..) | NodeType::Linear(..) | NodeType::Target(..)
)
}

pub fn is_control(&self) -> bool {
matches!(self, NodeType::Control(..))
}
}
9 changes: 7 additions & 2 deletions data/src/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ impl Update {
node.value = Some(value);
}
Err(e) => {
node.value.take();
error!("{:?}", e);
}
}
Expand Down Expand Up @@ -201,7 +202,9 @@ impl Update {
updated.insert(node.id);

if !node.node_type.is_valid() {
node.value = None;
if !node.node_type.is_control() {
node.value = None;
}
return Ok(None);
}
input_ids = node.inputs.iter().map(|i| i.0).collect();
Expand All @@ -214,7 +217,9 @@ impl Update {
None => {
return match nodes.get_mut(node_id) {
Some(node) => {
node.value = None;
if !node.node_type.is_control() {
node.value = None;
}
Ok(None)
}
None => Err(UpdateError::NodeNotFound),
Expand Down

0 comments on commit d6c6ea8

Please sign in to comment.