diff --git a/editor/scene/3d/path_3d_editor_plugin.cpp b/editor/scene/3d/path_3d_editor_plugin.cpp index d5f71243c9..865ee95d3f 100644 --- a/editor/scene/3d/path_3d_editor_plugin.cpp +++ b/editor/scene/3d/path_3d_editor_plugin.cpp @@ -579,7 +579,6 @@ Path3DGizmo::Path3DGizmo(Path3D *p_path) { // Connecting to a signal once, rather than plaguing the implementation with calls to `Node3DEditor::update_transform_gizmo`. path->connect("curve_changed", callable_mp(this, &Path3DGizmo::_update_transform_gizmo)); - path->connect("curve_changed", callable_mp(Path3DEditorPlugin::singleton, &Path3DEditorPlugin::_update_toolbar)); path->connect("debug_color_changed", callable_mp(this, &Path3DGizmo::redraw)); Path3DEditorPlugin::singleton->curve_edit->connect(SceneStringName(pressed), callable_mp(this, &Path3DGizmo::redraw)); @@ -780,7 +779,16 @@ void Path3DEditorPlugin::update_handles() { } void Path3DEditorPlugin::edit(Object *p_object) { + if (path) { + path->disconnect("curve_changed", callable_mp(this, &Path3DEditorPlugin::_update_toolbar)); + } + path = Object::cast_to(p_object); + + if (path) { + path->connect("curve_changed", callable_mp(this, &Path3DEditorPlugin::_update_toolbar)); + } + _update_toolbar(); update_overlays(); }