Skip to content

Commit

Permalink
Resize dialogs (FileDialog, EditorFileDialog, Reparent, SceneTreeDial…
Browse files Browse the repository at this point in the history
…og and resource depency dialogs).
  • Loading branch information
stijn-h committed Jul 14, 2020
1 parent 2921827 commit 526e060
Show file tree
Hide file tree
Showing 45 changed files with 92 additions and 85 deletions.
4 changes: 2 additions & 2 deletions editor/animation_track_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4370,7 +4370,7 @@ void AnimationTrackEditor::_add_track(int p_type) {
return;
}
adding_track_type = p_type;
pick_track->popup_centered_ratio();
pick_track->popup_scenetree_dialog();
}

void AnimationTrackEditor::_new_track_property_selected(String p_name) {
Expand Down Expand Up @@ -5731,7 +5731,7 @@ AnimationTrackEditor::AnimationTrackEditor() {

pick_track = memnew(SceneTreeDialog);
add_child(pick_track);
pick_track->set_title(TTR("Pick the node that will be animated:"));
pick_track->set_title(TTR("Pick a node to animate:"));
pick_track->connect("selected", callable_mp(this, &AnimationTrackEditor::_new_track_node_selected));
prop_selector = memnew(PropertySelector);
add_child(prop_selector);
Expand Down
2 changes: 1 addition & 1 deletion editor/debugger/editor_debugger_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ void EditorDebuggerTree::_item_menu_id_pressed(int p_option) {
file_dialog->add_filter("*." + extensions[i] + " ; " + extensions[i].to_upper());
}

file_dialog->popup_centered_ratio();
file_dialog->popup_file_dialog();
} break;
case ITEM_MENU_COPY_NODE_PATH: {
String text = get_selected_path();
Expand Down
4 changes: 2 additions & 2 deletions editor/debugger/script_editor_debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ void ScriptEditorDebugger::_video_mem_export() {
file_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
file_dialog->clear_filters();
file_dialog_purpose = SAVE_VRAM_CSV;
file_dialog->popup_centered_ratio();
file_dialog->popup_file_dialog();
}

Size2 ScriptEditorDebugger::get_minimum_size() const {
Expand Down Expand Up @@ -944,7 +944,7 @@ void ScriptEditorDebugger::_export_csv() {
file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
file_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
file_dialog_purpose = SAVE_MONITORS_CSV;
file_dialog->popup_centered_ratio();
file_dialog->popup_file_dialog();
}

String ScriptEditorDebugger::get_var_value(const String &p_var) const {
Expand Down
8 changes: 4 additions & 4 deletions editor/dependency_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void DependencyEditor::_load_pressed(Object *p_item, int p_cell, int p_button) {
for (List<String>::Element *E = ext.front(); E; E = E->next()) {
search->add_filter("*" + E->get());
}
search->popup_centered_ratio(0.65); // So it doesn't completely cover the dialog below it.
search->popup_file_dialog();
}

void DependencyEditor::_fix_and_find(EditorFileSystemDirectory *efsd, Map<String, Map<String, String>> &candidates) {
Expand Down Expand Up @@ -205,7 +205,7 @@ void DependencyEditor::edit(const String &p_path) {
set_title(TTR("Dependencies For:") + " " + p_path.get_file());

_update_list();
popup_centered_ratio(0.7); // So it doesn't completely cover the dialog below it.
popup_centered_ratio(0.4);

if (EditorNode::get_singleton()->is_scene_open(p_path)) {
EditorNode::get_singleton()->show_warning(vformat(TTR("Scene '%s' is currently being edited.\nChanges will only take effect when reloaded."), p_path.get_file()));
Expand Down Expand Up @@ -323,7 +323,7 @@ void DependencyEditorOwners::show(const String &p_path) {
editing = p_path;
owners->clear();
_fill_owners(EditorFileSystem::get_singleton()->get_filesystem());
popup_centered_ratio();
popup_centered_ratio(0.3);

set_title(TTR("Owners Of:") + " " + p_path.get_file());
}
Expand Down Expand Up @@ -714,7 +714,7 @@ void OrphanResourcesDialog::refresh() {

void OrphanResourcesDialog::show() {
refresh();
popup_centered_ratio();
popup_centered_ratio(0.4);
}

void OrphanResourcesDialog::_find_to_delete(TreeItem *p_item, List<String> &paths) {
Expand Down
6 changes: 3 additions & 3 deletions editor/editor_audio_buses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1176,23 +1176,23 @@ void EditorAudioBuses::_save_as_layout() {
file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
file_dialog->set_title(TTR("Save Audio Bus Layout As..."));
file_dialog->set_current_path(edited_path);
file_dialog->popup_centered_ratio();
file_dialog->popup_file_dialog();
new_layout = false;
}

void EditorAudioBuses::_new_layout() {
file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
file_dialog->set_title(TTR("Location for New Layout..."));
file_dialog->set_current_path(edited_path);
file_dialog->popup_centered_ratio();
file_dialog->popup_file_dialog();
new_layout = true;
}

void EditorAudioBuses::_load_layout() {
file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
file_dialog->set_title(TTR("Open Audio Bus Layout"));
file_dialog->set_current_path(edited_path);
file_dialog->popup_centered_ratio();
file_dialog->popup_file_dialog();
new_layout = false;
}

Expand Down
2 changes: 1 addition & 1 deletion editor/editor_autoload_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -919,5 +919,5 @@ void EditorAutoloadSettings::_set_autoload_add_path(const String &p_text) {
}

void EditorAutoloadSettings::_browse_autoload_add_path() {
file_dialog->popup_centered_ratio();
file_dialog->popup_file_dialog();
}
4 changes: 2 additions & 2 deletions editor/editor_feature_profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,10 +403,10 @@ void EditorFeatureProfileManager::_profile_action(int p_action) {
_emit_current_profile_changed();
} break;
case PROFILE_IMPORT: {
import_profiles->popup_centered_ratio();
import_profiles->popup_file_dialog();
} break;
case PROFILE_EXPORT: {
export_profile->popup_centered_ratio();
export_profile->popup_file_dialog();
export_profile->set_current_file(_get_selected_profile() + ".profile");
} break;
case PROFILE_NEW: {
Expand Down
4 changes: 4 additions & 0 deletions editor/editor_file_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ EditorFileDialog::GetIconFunc EditorFileDialog::get_large_icon_func = nullptr;
EditorFileDialog::RegisterFunc EditorFileDialog::register_func = nullptr;
EditorFileDialog::RegisterFunc EditorFileDialog::unregister_func = nullptr;

void EditorFileDialog::popup_file_dialog() {
popup_centered_clamped(Size2(1050, 700) * EDSCALE, 0.8);
}

VBoxContainer *EditorFileDialog::get_vbox() {
return vbox;
}
Expand Down
1 change: 1 addition & 0 deletions editor/editor_file_dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ class EditorFileDialog : public ConfirmationDialog {
static void _bind_methods();
//bind helpers
public:
void popup_file_dialog();
void clear_filters();
void add_filter(const String &p_filter);

Expand Down
12 changes: 6 additions & 6 deletions editor/editor_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -994,8 +994,8 @@ void EditorNode::save_resource_as(const Ref<Resource> &p_resource, const String
}
file->set_current_path(existing);
}
file->popup_centered_ratio();
file->set_title(TTR("Save Resource As..."));
file->popup_file_dialog();
}

void EditorNode::_menu_option(int p_option) {
Expand Down Expand Up @@ -2182,7 +2182,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
file->set_current_path(scene->get_filename());
};
file->set_title(p_option == FILE_OPEN_SCENE ? TTR("Open Scene") : TTR("Open Base Scene"));
file->popup_centered_ratio();
file->popup_file_dialog();

} break;
case FILE_QUICK_OPEN: {
Expand Down Expand Up @@ -2318,7 +2318,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
}
file->set_current_path(existing);
}
file->popup_centered_ratio();
file->popup_file_dialog();
file->set_title(TTR("Save Scene As..."));

} break;
Expand Down Expand Up @@ -2357,7 +2357,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
file_export_lib->add_filter("*." + E->get());
}

file_export_lib->popup_centered_ratio();
file_export_lib->popup_file_dialog();
file_export_lib->set_title(TTR("Export Mesh Library"));

} break;
Expand All @@ -2376,7 +2376,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
file_export_lib->add_filter("*." + E->get());
}

file_export_lib->popup_centered_ratio();
file_export_lib->popup_file_dialog();
file_export_lib->set_title(TTR("Export Tile Set"));

} break;
Expand Down Expand Up @@ -2642,7 +2642,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
file->set_current_path(scene->get_filename());
};
file->set_title(TTR("Pick a Main Scene"));
file->popup_centered_ratio();
file->popup_file_dialog();

} break;
case HELP_SEARCH: {
Expand Down
10 changes: 5 additions & 5 deletions editor/editor_properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ void EditorPropertyPath::_path_pressed() {
dialog->set_current_path(full_path);
}

dialog->popup_centered_ratio();
dialog->popup_file_dialog();
}

void EditorPropertyPath::update_property() {
Expand Down Expand Up @@ -2207,7 +2207,7 @@ void EditorPropertyNodePath::_node_assign() {
add_child(scene_tree);
scene_tree->connect("selected", callable_mp(this, &EditorPropertyNodePath::_node_selected));
}
scene_tree->popup_centered_ratio();
scene_tree->popup_scenetree_dialog();
}

void EditorPropertyNodePath::_node_clear() {
Expand Down Expand Up @@ -2343,7 +2343,7 @@ void EditorPropertyResource::_file_selected(const String &p_path) {
}

void EditorPropertyResource::_menu_option(int p_which) {
// scene_tree->popup_centered_ratio();
//scene_tree->popup_scenetree_dialog();
switch (p_which) {
case OBJ_MENU_LOAD: {
if (!file) {
Expand All @@ -2369,7 +2369,7 @@ void EditorPropertyResource::_menu_option(int p_which) {
file->add_filter("*." + E->get() + " ; " + E->get().to_upper());
}

file->popup_centered_ratio();
file->popup_file_dialog();
} break;

case OBJ_MENU_EDIT: {
Expand Down Expand Up @@ -2507,7 +2507,7 @@ void EditorPropertyResource::_menu_option(int p_which) {
scene_tree->connect("selected", callable_mp(this, &EditorPropertyResource::_viewport_selected));
scene_tree->set_title(TTR("Pick a Viewport"));
}
scene_tree->popup_centered_ratio();
scene_tree->popup_scenetree_dialog();

return;
}
Expand Down
2 changes: 1 addition & 1 deletion editor/editor_sub_scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void EditorSubScene::_path_changed(const String &p_path) {
}

void EditorSubScene::_path_browse() {
file_dialog->popup_centered_ratio();
file_dialog->popup_file_dialog();
}

void EditorSubScene::_notification(int p_what) {
Expand Down
2 changes: 1 addition & 1 deletion editor/export_template_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ void ExportTemplateManager::popup_manager() {
}

void ExportTemplateManager::ok_pressed() {
template_open->popup_centered_ratio();
template_open->popup_file_dialog();
}

void ExportTemplateManager::_http_download_mirror_completed(int p_status, int p_code, const PackedStringArray &headers, const PackedByteArray &p_data) {
Expand Down
2 changes: 1 addition & 1 deletion editor/find_in_files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ void FindInFilesDialog::_notification(int p_what) {
}

void FindInFilesDialog::_on_folder_button_pressed() {
_folder_dialog->popup_centered_ratio();
_folder_dialog->popup_file_dialog();
}

void FindInFilesDialog::custom_action(const String &p_action) {
Expand Down
2 changes: 1 addition & 1 deletion editor/inspector_dock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ void InspectorDock::_load_resource(const String &p_type) {
load_resource_dialog->add_filter("*." + extensions[i] + " ; " + extensions[i].to_upper());
}

load_resource_dialog->popup_centered_ratio();
load_resource_dialog->popup_file_dialog();
}

void InspectorDock::_resource_file_selected(String p_file) {
Expand Down
10 changes: 5 additions & 5 deletions editor/localization_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void LocalizationEditor::_translation_add(const String &p_path) {
}

void LocalizationEditor::_translation_file_open() {
translation_file_open->popup_centered_ratio();
translation_file_open->popup_file_dialog();
}

void LocalizationEditor::_translation_delete(Object *p_item, int p_column, int p_button) {
Expand All @@ -108,7 +108,7 @@ void LocalizationEditor::_translation_delete(Object *p_item, int p_column, int p
}

void LocalizationEditor::_translation_res_file_open() {
translation_res_file_open_dialog->popup_centered_ratio();
translation_res_file_open_dialog->popup_file_dialog();
}

void LocalizationEditor::_translation_res_add(const String &p_path) {
Expand Down Expand Up @@ -137,7 +137,7 @@ void LocalizationEditor::_translation_res_add(const String &p_path) {
}

void LocalizationEditor::_translation_res_option_file_open() {
translation_res_option_file_open_dialog->popup_centered_ratio();
translation_res_option_file_open_dialog->popup_file_dialog();
}

void LocalizationEditor::_translation_res_option_add(const String &p_path) {
Expand Down Expand Up @@ -406,11 +406,11 @@ void LocalizationEditor::_pot_delete(Object *p_item, int p_column, int p_button)
}

void LocalizationEditor::_pot_file_open() {
pot_file_open_dialog->popup_centered_ratio();
pot_file_open_dialog->popup_file_dialog();
}

void LocalizationEditor::_pot_generate_open() {
pot_generate_dialog->popup_centered_ratio();
pot_generate_dialog->popup_file_dialog();
}

void LocalizationEditor::_pot_generate(const String &p_file) {
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/animation_blend_space_1d_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ void AnimationNodeBlendSpace1DEditor::_add_menu_type(int p_index) {
for (List<String>::Element *E = filters.front(); E; E = E->next()) {
open_file->add_filter("*." + E->get());
}
open_file->popup_centered_ratio();
open_file->popup_file_dialog();
return;
} else if (p_index == MENU_LOAD_FILE_CONFIRM) {
node = file_loaded;
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/animation_blend_space_2d_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ void AnimationNodeBlendSpace2DEditor::_add_menu_type(int p_index) {
for (List<String>::Element *E = filters.front(); E; E = E->next()) {
open_file->add_filter("*." + E->get());
}
open_file->popup_centered_ratio();
open_file->popup_file_dialog();
return;
} else if (p_index == MENU_LOAD_FILE_CONFIRM) {
node = file_loaded;
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/animation_blend_tree_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ void AnimationNodeBlendTreeEditor::_add_node(int p_idx) {
for (List<String>::Element *E = filters.front(); E; E = E->next()) {
open_file->add_filter("*." + E->get());
}
open_file->popup_centered_ratio();
open_file->popup_file_dialog();
return;
} else if (p_idx == MENU_LOAD_FILE_CONFIRM) {
anode = file_loaded;
Expand Down
4 changes: 2 additions & 2 deletions editor/plugins/animation_player_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ void AnimationPlayerEditor::_animation_load() {
file->add_filter("*." + E->get() + " ; " + E->get().to_upper());
}

file->popup_centered_ratio();
file->popup_file_dialog();
current_option = RESOURCE_LOAD;
}

Expand Down Expand Up @@ -399,8 +399,8 @@ void AnimationPlayerEditor::_animation_save_as(const Ref<Resource> &p_resource)
}
}
file->set_current_path(path);
file->popup_centered_ratio();
file->set_title(TTR("Save Resource As..."));
file->popup_file_dialog();
current_option = RESOURCE_SAVE;
}

Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/animation_state_machine_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ void AnimationNodeStateMachineEditor::_add_menu_type(int p_index) {
for (List<String>::Element *E = filters.front(); E; E = E->next()) {
open_file->add_filter("*." + E->get());
}
open_file->popup_centered_ratio();
open_file->popup_file_dialog();
return;
} else if (p_index == MENU_LOAD_FILE_CONFIRM) {
node = file_loaded;
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/asset_library_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1260,7 +1260,7 @@ void EditorAssetLibrary::_asset_file_selected(const String &p_file) {
}

void EditorAssetLibrary::_asset_open() {
asset_open->popup_centered_ratio();
asset_open->popup_file_dialog();
}

void EditorAssetLibrary::_manage_plugins() {
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/baked_lightmap_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void BakedLightmapEditorPlugin::_bake_select_file(const String &p_file) {
scene_path = scene_path.get_basename() + ".lmbake";

file_dialog->set_current_path(scene_path);
file_dialog->popup_centered_ratio();
file_dialog->popup_file_dialog();

} break;
case BakedLightmap::BAKE_ERROR_NO_MESHES:
Expand Down
Loading

0 comments on commit 526e060

Please sign in to comment.