You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-08 12:40:44 +00:00
Refactor and fix issues in Editor Dock Manager
Extract Dock Context Menu.
This commit is contained in:
@@ -6047,19 +6047,13 @@ void EditorNode::_resource_loaded(Ref<Resource> p_resource, const String &p_path
|
||||
|
||||
void EditorNode::_feature_profile_changed() {
|
||||
Ref<EditorFeatureProfile> profile = feature_profile_manager->get_current_profile();
|
||||
// FIXME: Close all floating docks to avoid crash.
|
||||
editor_dock_manager->close_all_floating_docks();
|
||||
TabContainer *import_tabs = cast_to<TabContainer>(ImportDock::get_singleton()->get_parent());
|
||||
TabContainer *node_tabs = cast_to<TabContainer>(NodeDock::get_singleton()->get_parent());
|
||||
TabContainer *fs_tabs = cast_to<TabContainer>(FileSystemDock::get_singleton()->get_parent());
|
||||
TabContainer *history_tabs = cast_to<TabContainer>(history_dock->get_parent());
|
||||
if (profile.is_valid()) {
|
||||
node_tabs->set_tab_hidden(node_tabs->get_tab_idx_from_control(NodeDock::get_singleton()), profile->is_feature_disabled(EditorFeatureProfile::FEATURE_NODE_DOCK));
|
||||
editor_dock_manager->set_dock_enabled(NodeDock::get_singleton(), !profile->is_feature_disabled(EditorFeatureProfile::FEATURE_NODE_DOCK));
|
||||
// The Import dock is useless without the FileSystem dock. Ensure the configuration is valid.
|
||||
bool fs_dock_disabled = profile->is_feature_disabled(EditorFeatureProfile::FEATURE_FILESYSTEM_DOCK);
|
||||
fs_tabs->set_tab_hidden(fs_tabs->get_tab_idx_from_control(FileSystemDock::get_singleton()), fs_dock_disabled);
|
||||
import_tabs->set_tab_hidden(import_tabs->get_tab_idx_from_control(ImportDock::get_singleton()), fs_dock_disabled || profile->is_feature_disabled(EditorFeatureProfile::FEATURE_IMPORT_DOCK));
|
||||
history_tabs->set_tab_hidden(history_tabs->get_tab_idx_from_control(history_dock), profile->is_feature_disabled(EditorFeatureProfile::FEATURE_HISTORY_DOCK));
|
||||
editor_dock_manager->set_dock_enabled(FileSystemDock::get_singleton(), !fs_dock_disabled);
|
||||
editor_dock_manager->set_dock_enabled(ImportDock::get_singleton(), !fs_dock_disabled && !profile->is_feature_disabled(EditorFeatureProfile::FEATURE_IMPORT_DOCK));
|
||||
editor_dock_manager->set_dock_enabled(history_dock, !profile->is_feature_disabled(EditorFeatureProfile::FEATURE_HISTORY_DOCK));
|
||||
|
||||
main_editor_buttons[EDITOR_3D]->set_visible(!profile->is_feature_disabled(EditorFeatureProfile::FEATURE_3D));
|
||||
main_editor_buttons[EDITOR_SCRIPT]->set_visible(!profile->is_feature_disabled(EditorFeatureProfile::FEATURE_SCRIPT));
|
||||
@@ -6072,18 +6066,16 @@ void EditorNode::_feature_profile_changed() {
|
||||
editor_select(EDITOR_2D);
|
||||
}
|
||||
} else {
|
||||
import_tabs->set_tab_hidden(import_tabs->get_tab_idx_from_control(ImportDock::get_singleton()), false);
|
||||
node_tabs->set_tab_hidden(node_tabs->get_tab_idx_from_control(NodeDock::get_singleton()), false);
|
||||
fs_tabs->set_tab_hidden(fs_tabs->get_tab_idx_from_control(FileSystemDock::get_singleton()), false);
|
||||
history_tabs->set_tab_hidden(history_tabs->get_tab_idx_from_control(history_dock), false);
|
||||
editor_dock_manager->set_dock_enabled(ImportDock::get_singleton(), true);
|
||||
editor_dock_manager->set_dock_enabled(NodeDock::get_singleton(), true);
|
||||
editor_dock_manager->set_dock_enabled(FileSystemDock::get_singleton(), true);
|
||||
editor_dock_manager->set_dock_enabled(history_dock, true);
|
||||
main_editor_buttons[EDITOR_3D]->set_visible(true);
|
||||
main_editor_buttons[EDITOR_SCRIPT]->set_visible(true);
|
||||
if (AssetLibraryEditorPlugin::is_available()) {
|
||||
main_editor_buttons[EDITOR_ASSETLIB]->set_visible(true);
|
||||
}
|
||||
}
|
||||
|
||||
editor_dock_manager->update_dock_slots_visibility();
|
||||
}
|
||||
|
||||
void EditorNode::_bind_methods() {
|
||||
@@ -6542,7 +6534,6 @@ EditorNode::EditorNode() {
|
||||
right_r_vsplit->add_child(dock_slot[EditorDockManager::DOCK_SLOT_RIGHT_BR]);
|
||||
|
||||
editor_dock_manager = memnew(EditorDockManager);
|
||||
editor_dock_manager->connect("layout_changed", callable_mp(this, &EditorNode::_save_editor_layout));
|
||||
|
||||
// Save the splits for easier access.
|
||||
editor_dock_manager->add_vsplit(left_l_vsplit);
|
||||
|
||||
Reference in New Issue
Block a user