From 90ed02f161c988486193cf7088bb99cd3ecae86b Mon Sep 17 00:00:00 2001 From: Manuel Brea Carreras Date: Thu, 24 Oct 2024 19:08:14 +0100 Subject: [PATCH] Fix conflicting text edit ui element ids (#75) Fixes #74 by manually setting the root `Id` for the node creator UI. --- crates/bevy_animation_graph_editor/src/ui.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/crates/bevy_animation_graph_editor/src/ui.rs b/crates/bevy_animation_graph_editor/src/ui.rs index 5402005..0084359 100644 --- a/crates/bevy_animation_graph_editor/src/ui.rs +++ b/crates/bevy_animation_graph_editor/src/ui.rs @@ -1,3 +1,4 @@ +use std::hash::{Hash, Hasher}; use std::path::PathBuf; use crate::asset_saving::{SaveFsm, SaveGraph}; @@ -1060,7 +1061,15 @@ impl TabViewer<'_> { }; let mut env = InspectorUi::for_bevy(&type_registry, &mut cx); - env.ui_for_reflect(&mut selection.node_creation.node, ui); + let mut hasher = std::collections::hash_map::DefaultHasher::new(); + "Create node".hash(&mut hasher); + let node_creator_id = egui::Id::new(hasher.finish()); + env.ui_for_reflect_with_options( + &mut selection.node_creation.node, + ui, + node_creator_id, + &(), + ); let submit_response = ui.button("Create node"); if submit_response.clicked() && selection.graph_editor.is_some() {