diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp index 4a44cea5bac..983ddcb52fd 100644 --- a/editor/plugins/skeleton_3d_editor_plugin.cpp +++ b/editor/plugins/skeleton_3d_editor_plugin.cpp @@ -712,7 +712,7 @@ void Skeleton3DEditor::create_editors() { add_child(file_dialog); // Create Top Menu Bar. - HBoxContainer *topmenu_bar = memnew(HBoxContainer); + topmenu_bar = memnew(HBoxContainer); ne->add_control_to_menu_panel(topmenu_bar); // Create Skeleton Option in Top Menu Bar. @@ -1095,25 +1095,8 @@ Skeleton3DEditor::~Skeleton3DEditor() { Node3DEditor *ne = Node3DEditor::get_singleton(); - if (animation_hb) { - ne->remove_control_from_menu_panel(animation_hb); - memdelete(animation_hb); - } - - if (separator) { - ne->remove_control_from_menu_panel(separator); - memdelete(separator); - } - - if (skeleton_options) { - ne->remove_control_from_menu_panel(skeleton_options); - memdelete(skeleton_options); - } - - if (edit_mode_button) { - ne->remove_control_from_menu_panel(edit_mode_button); - memdelete(edit_mode_button); - } + ne->remove_control_from_menu_panel(topmenu_bar); + memdelete(topmenu_bar); } bool EditorInspectorPluginSkeleton::can_handle(Object *p_object) { diff --git a/editor/plugins/skeleton_3d_editor_plugin.h b/editor/plugins/skeleton_3d_editor_plugin.h index 14158ac9a9a..3cc7c854929 100644 --- a/editor/plugins/skeleton_3d_editor_plugin.h +++ b/editor/plugins/skeleton_3d_editor_plugin.h @@ -120,7 +120,7 @@ class Skeleton3DEditor : public VBoxContainer { BoneTransformEditor *rest_editor = nullptr; BoneTransformEditor *pose_editor = nullptr; - VSeparator *separator = nullptr; + HBoxContainer *topmenu_bar = nullptr; MenuButton *skeleton_options = nullptr; Button *edit_mode_button = nullptr;