-
I wanted to create a node that would add values entered from the UI to the Node's input. So I added and tried to implement the ui with However, I could not change the How can i achieve my goal? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi! @kkngsm The way the application works is by delaying side effects. In functions such as To implement this, you need to create a custom response type that you can return from Then, you can apply those side effects once you have mutable access. In the example, this happens here: /~https://github.com/kkngsm/egui_node_graph/blob/7ed0179666949f66eaa35ee0ce53bb77d590a027/egui_node_graph_example/src/app.rs#L381-L393 |
Beta Was this translation helpful? Give feedback.
Hi! @kkngsm
The way the application works is by delaying side effects. In functions such as
bottom_ui
you should not modify the graph, because it's immutably borrowed. Instead, you add a response to the return value of your function with the necessary information to perform this side effect later on, when you have exclusive access to the graph.To implement this, you need to create a custom response type that you can return from
bottom_ui
. To do this, you would need to add a new enum variant toMyResponse
. For your particular use case, you probably want to create some sort ofAddScalarProperty { id: NodeId }
response variant (maybe you need to include additional data in it).Then, you can…