Working multiple window support, including editor
This commit is contained in:
parent
f51fdc6eef
commit
4758057f20
105 changed files with 1956 additions and 1742 deletions
|
@ -48,13 +48,13 @@ protected:
|
|||
public:
|
||||
enum {
|
||||
//make sure these are replicated in Node
|
||||
NOTIFICATION_OS_MEMORY_WARNING = 1009,
|
||||
NOTIFICATION_TRANSLATION_CHANGED = 1010,
|
||||
NOTIFICATION_WM_ABOUT = 1011,
|
||||
NOTIFICATION_CRASH = 1012,
|
||||
NOTIFICATION_OS_IME_UPDATE = 1013,
|
||||
NOTIFICATION_APP_RESUMED = 1014,
|
||||
NOTIFICATION_APP_PAUSED = 1015,
|
||||
NOTIFICATION_OS_MEMORY_WARNING = 2009,
|
||||
NOTIFICATION_TRANSLATION_CHANGED = 2010,
|
||||
NOTIFICATION_WM_ABOUT = 2011,
|
||||
NOTIFICATION_CRASH = 2012,
|
||||
NOTIFICATION_OS_IME_UPDATE = 2013,
|
||||
NOTIFICATION_APP_RESUMED = 2014,
|
||||
NOTIFICATION_APP_PAUSED = 2015,
|
||||
};
|
||||
|
||||
virtual void init();
|
||||
|
|
|
@ -3443,7 +3443,7 @@ void AnimationTrackEditor::_query_insert(const InsertData &p_id) {
|
|||
|
||||
if (insert_frame != Engine::get_singleton()->get_frames_drawn()) {
|
||||
//clear insert list for the frame if frame changed
|
||||
if (insert_confirm->is_visible_in_tree())
|
||||
if (insert_confirm->is_visible())
|
||||
return; //do nothing
|
||||
insert_data.clear();
|
||||
insert_query = false;
|
||||
|
@ -3496,7 +3496,7 @@ void AnimationTrackEditor::_query_insert(const InsertData &p_id) {
|
|||
|
||||
insert_confirm_bezier->set_visible(all_bezier);
|
||||
insert_confirm->get_ok()->set_text(TTR("Create"));
|
||||
insert_confirm->popup_centered_minsize();
|
||||
insert_confirm->popup_centered();
|
||||
insert_query = true;
|
||||
} else {
|
||||
call_deferred("_insert_delay");
|
||||
|
@ -5309,7 +5309,7 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
|
|||
it->set_metadata(0, md);
|
||||
}
|
||||
|
||||
track_copy_dialog->popup_centered_minsize(Size2(350, 500) * EDSCALE);
|
||||
track_copy_dialog->popup_centered(Size2(350, 500) * EDSCALE);
|
||||
} break;
|
||||
case EDIT_COPY_TRACKS_CONFIRM: {
|
||||
|
||||
|
@ -5578,7 +5578,7 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
|
|||
|
||||
} break;
|
||||
case EDIT_CLEAN_UP_ANIMATION: {
|
||||
cleanup_dialog->popup_centered_minsize(Size2(300, 0) * EDSCALE);
|
||||
cleanup_dialog->popup_centered(Size2(300, 0) * EDSCALE);
|
||||
|
||||
} break;
|
||||
case EDIT_CLEAN_UP_ANIMATION_CONFIRM: {
|
||||
|
|
|
@ -69,10 +69,10 @@ GotoLineDialog::GotoLineDialog() {
|
|||
set_title(TTR("Go to Line"));
|
||||
|
||||
VBoxContainer *vbc = memnew(VBoxContainer);
|
||||
vbc->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 8 * EDSCALE);
|
||||
vbc->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 8 * EDSCALE);
|
||||
vbc->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -8 * EDSCALE);
|
||||
vbc->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, -8 * EDSCALE);
|
||||
vbc->set_anchor_and_margin(MARGIN_LEFT, Control::ANCHOR_BEGIN, 8 * EDSCALE);
|
||||
vbc->set_anchor_and_margin(MARGIN_TOP, Control::ANCHOR_BEGIN, 8 * EDSCALE);
|
||||
vbc->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, -8 * EDSCALE);
|
||||
vbc->set_anchor_and_margin(MARGIN_BOTTOM, Control::ANCHOR_END, -8 * EDSCALE);
|
||||
add_child(vbc);
|
||||
|
||||
Label *l = memnew(Label);
|
||||
|
|
|
@ -115,7 +115,7 @@ void ConnectDialog::ok_pressed() {
|
|||
|
||||
if (dst_method->get_text() == "") {
|
||||
error->set_text(TTR("Method in target node must be specified."));
|
||||
error->popup_centered_minsize();
|
||||
error->popup_centered();
|
||||
return;
|
||||
}
|
||||
Node *target = tree->get_selected();
|
||||
|
@ -125,7 +125,7 @@ void ConnectDialog::ok_pressed() {
|
|||
if (target->get_script().is_null()) {
|
||||
if (!target->has_method(dst_method->get_text())) {
|
||||
error->set_text(TTR("Target method not found. Specify a valid method or attach a script to the target node."));
|
||||
error->popup_centered_minsize();
|
||||
error->popup_centered();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -341,7 +341,7 @@ void ConnectDialog::init(ConnectionData c, bool bEdit) {
|
|||
void ConnectDialog::popup_dialog(const String &p_for_signal) {
|
||||
|
||||
from_signal->set_text(p_for_signal);
|
||||
error_label->add_color_override("font_color", get_color("error_color", "Editor"));
|
||||
error_label->add_color_override("font_color", error_label->get_color("error_color", "Editor"));
|
||||
if (!advanced->is_pressed())
|
||||
error_label->set_visible(!_find_first_script(get_tree()->get_edited_scene_root(), get_tree()->get_edited_scene_root()));
|
||||
|
||||
|
@ -351,14 +351,14 @@ void ConnectDialog::popup_dialog(const String &p_for_signal) {
|
|||
void ConnectDialog::_advanced_pressed() {
|
||||
|
||||
if (advanced->is_pressed()) {
|
||||
set_custom_minimum_size(Size2(900, 500) * EDSCALE);
|
||||
set_min_size(Size2(900, 500) * EDSCALE);
|
||||
connect_to_label->set_text(TTR("Connect to Node:"));
|
||||
tree->set_connect_to_script_mode(false);
|
||||
|
||||
vbc_right->show();
|
||||
error_label->hide();
|
||||
} else {
|
||||
set_custom_minimum_size(Size2(600, 500) * EDSCALE);
|
||||
set_min_size(Size2(600, 500) * EDSCALE);
|
||||
set_size(Size2());
|
||||
connect_to_label->set_text(TTR("Connect to Script:"));
|
||||
tree->set_connect_to_script_mode(true);
|
||||
|
@ -369,23 +369,23 @@ void ConnectDialog::_advanced_pressed() {
|
|||
|
||||
_update_ok_enabled();
|
||||
|
||||
set_position((get_viewport_rect().size - get_custom_minimum_size()) / 2);
|
||||
popup_centered();
|
||||
}
|
||||
|
||||
ConnectDialog::ConnectDialog() {
|
||||
|
||||
set_custom_minimum_size(Size2(600, 500) * EDSCALE);
|
||||
set_min_size(Size2(600, 500) * EDSCALE);
|
||||
|
||||
VBoxContainer *vbc = memnew(VBoxContainer);
|
||||
add_child(vbc);
|
||||
|
||||
HBoxContainer *main_hb = memnew(HBoxContainer);
|
||||
vbc->add_child(main_hb);
|
||||
main_hb->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
main_hb->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
VBoxContainer *vbc_left = memnew(VBoxContainer);
|
||||
main_hb->add_child(vbc_left);
|
||||
vbc_left->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
vbc_left->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
from_signal = memnew(LineEdit);
|
||||
from_signal->set_editable(false);
|
||||
|
@ -407,13 +407,13 @@ ConnectDialog::ConnectDialog() {
|
|||
|
||||
vbc_right = memnew(VBoxContainer);
|
||||
main_hb->add_child(vbc_right);
|
||||
vbc_right->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
vbc_right->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
vbc_right->hide();
|
||||
|
||||
HBoxContainer *add_bind_hb = memnew(HBoxContainer);
|
||||
|
||||
type_list = memnew(OptionButton);
|
||||
type_list->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
type_list->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
add_bind_hb->add_child(type_list);
|
||||
type_list->add_item("bool", Variant::BOOL);
|
||||
type_list->add_item("int", Variant::INT);
|
||||
|
@ -451,7 +451,7 @@ ConnectDialog::ConnectDialog() {
|
|||
vbc_left->add_margin_child(TTR("Receiver Method:"), dstm_hb);
|
||||
|
||||
dst_method = memnew(LineEdit);
|
||||
dst_method->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
dst_method->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
dst_method->connect("text_entered", callable_mp(this, &ConnectDialog::_text_entered));
|
||||
dstm_hb->add_child(dst_method);
|
||||
|
||||
|
@ -477,8 +477,6 @@ ConnectDialog::ConnectDialog() {
|
|||
oneshot->set_tooltip(TTR("Disconnects the signal after its first emission."));
|
||||
vbc_right->add_child(oneshot);
|
||||
|
||||
set_as_toplevel(true);
|
||||
|
||||
cdbinds = memnew(ConnectDialogBinds);
|
||||
|
||||
error = memnew(AcceptDialog);
|
||||
|
@ -1072,7 +1070,7 @@ ConnectionsDock::ConnectionsDock(EditorNode *p_editor) {
|
|||
tree->set_select_mode(Tree::SELECT_ROW);
|
||||
tree->set_hide_root(true);
|
||||
vbc->add_child(tree);
|
||||
tree->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
tree->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
tree->set_allow_rmb_select(true);
|
||||
|
||||
connect_button = memnew(Button);
|
||||
|
@ -1083,11 +1081,9 @@ ConnectionsDock::ConnectionsDock(EditorNode *p_editor) {
|
|||
connect_button->connect("pressed", callable_mp(this, &ConnectionsDock::_connect_pressed));
|
||||
|
||||
connect_dialog = memnew(ConnectDialog);
|
||||
connect_dialog->set_as_toplevel(true);
|
||||
add_child(connect_dialog);
|
||||
|
||||
disconnect_all_dialog = memnew(ConfirmationDialog);
|
||||
disconnect_all_dialog->set_as_toplevel(true);
|
||||
add_child(disconnect_all_dialog);
|
||||
disconnect_all_dialog->connect("confirmed", callable_mp(this, &ConnectionsDock::_disconnect_all));
|
||||
disconnect_all_dialog->set_text(TTR("Are you sure you want to remove all connections from this signal?"));
|
||||
|
|
|
@ -193,7 +193,7 @@ void CreateDialog::add_type(const String &p_type, HashMap<String, TreeItem *> &p
|
|||
item->set_text(0, p_type + " (" + ScriptServer::get_global_class_path(p_type).get_file() + ")");
|
||||
}
|
||||
if (!can_instance) {
|
||||
item->set_custom_color(0, get_color("disabled_font_color", "Editor"));
|
||||
item->set_custom_color(0, search_options->get_color("disabled_font_color", "Editor"));
|
||||
item->set_selectable(0, false);
|
||||
} else if (!(*to_select && (*to_select)->get_text(0) == search_box->get_text())) {
|
||||
String search_term = search_box->get_text().to_lower();
|
||||
|
@ -310,8 +310,8 @@ void CreateDialog::_update_search() {
|
|||
EditorData &ed = EditorNode::get_editor_data();
|
||||
|
||||
root->set_text(0, base_type);
|
||||
if (has_icon(base_type, "EditorIcons")) {
|
||||
root->set_icon(0, get_icon(base_type, "EditorIcons"));
|
||||
if (search_options->has_icon(base_type, "EditorIcons")) {
|
||||
root->set_icon(0, search_options->get_icon(base_type, "EditorIcons"));
|
||||
}
|
||||
|
||||
TreeItem *to_select = search_box->get_text() == base_type ? root : NULL;
|
||||
|
@ -460,23 +460,22 @@ void CreateDialog::_notification(int p_what) {
|
|||
switch (p_what) {
|
||||
case NOTIFICATION_ENTER_TREE: {
|
||||
connect("confirmed", callable_mp(this, &CreateDialog::_confirmed));
|
||||
search_box->set_right_icon(get_icon("Search", "EditorIcons"));
|
||||
search_box->set_right_icon(search_options->get_icon("Search", "EditorIcons"));
|
||||
search_box->set_clear_button_enabled(true);
|
||||
favorite->set_icon(get_icon("Favorites", "EditorIcons"));
|
||||
favorite->set_icon(search_options->get_icon("Favorites", "EditorIcons"));
|
||||
} break;
|
||||
case NOTIFICATION_EXIT_TREE: {
|
||||
disconnect("confirmed", callable_mp(this, &CreateDialog::_confirmed));
|
||||
} break;
|
||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||
if (is_visible_in_tree()) {
|
||||
if (is_visible()) {
|
||||
search_box->call_deferred("grab_focus"); // still not visible
|
||||
search_box->select_all();
|
||||
} else {
|
||||
EditorSettings::get_singleton()->get_project_metadata("dialog_bounds", "create_new_node", Rect2(get_position(), get_size()));
|
||||
search_loaded_scripts.clear();
|
||||
}
|
||||
} break;
|
||||
case NOTIFICATION_POPUP_HIDE: {
|
||||
EditorSettings::get_singleton()->get_project_metadata("dialog_bounds", "create_new_node", get_rect());
|
||||
search_loaded_scripts.clear();
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -562,7 +561,7 @@ void CreateDialog::_item_selected() {
|
|||
}
|
||||
|
||||
void CreateDialog::_hide_requested() {
|
||||
_closed(); // From WindowDialog.
|
||||
_cancel_pressed(); // From AcceptDialog.
|
||||
}
|
||||
|
||||
void CreateDialog::_favorite_toggled() {
|
||||
|
@ -662,7 +661,7 @@ Variant CreateDialog::get_drag_data_fw(const Point2 &p_point, Control *p_from) {
|
|||
ToolButton *tb = memnew(ToolButton);
|
||||
tb->set_icon(ti->get_icon(0));
|
||||
tb->set_text(ti->get_text(0));
|
||||
set_drag_preview(tb);
|
||||
favorites->set_drag_preview(tb);
|
||||
|
||||
return d;
|
||||
}
|
||||
|
@ -743,8 +742,6 @@ CreateDialog::CreateDialog() {
|
|||
|
||||
is_replace_mode = false;
|
||||
|
||||
set_resizable(true);
|
||||
|
||||
HSplitContainer *hsc = memnew(HSplitContainer);
|
||||
add_child(hsc);
|
||||
|
||||
|
@ -754,7 +751,7 @@ CreateDialog::CreateDialog() {
|
|||
VBoxContainer *fav_vb = memnew(VBoxContainer);
|
||||
vsc->add_child(fav_vb);
|
||||
fav_vb->set_custom_minimum_size(Size2(150, 100) * EDSCALE);
|
||||
fav_vb->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
fav_vb->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
favorites = memnew(Tree);
|
||||
fav_vb->add_margin_child(TTR("Favorites:"), favorites, true);
|
||||
|
@ -763,13 +760,16 @@ CreateDialog::CreateDialog() {
|
|||
favorites->set_allow_reselect(true);
|
||||
favorites->connect("cell_selected", callable_mp(this, &CreateDialog::_favorite_selected));
|
||||
favorites->connect("item_activated", callable_mp(this, &CreateDialog::_favorite_activated));
|
||||
favorites->set_drag_forwarding(this);
|
||||
#ifndef _MSC_VER
|
||||
#warning cant forward drag data to a non control, must be fixed
|
||||
#endif
|
||||
//favorites->set_drag_forwarding(this);
|
||||
favorites->add_constant_override("draw_guides", 1);
|
||||
|
||||
VBoxContainer *rec_vb = memnew(VBoxContainer);
|
||||
vsc->add_child(rec_vb);
|
||||
rec_vb->set_custom_minimum_size(Size2(150, 100) * EDSCALE);
|
||||
rec_vb->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
rec_vb->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
recent = memnew(Tree);
|
||||
rec_vb->add_margin_child(TTR("Recent:"), recent, true);
|
||||
|
@ -783,10 +783,10 @@ CreateDialog::CreateDialog() {
|
|||
VBoxContainer *vbc = memnew(VBoxContainer);
|
||||
hsc->add_child(vbc);
|
||||
vbc->set_custom_minimum_size(Size2(300, 0) * EDSCALE);
|
||||
vbc->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
vbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
HBoxContainer *search_hb = memnew(HBoxContainer);
|
||||
search_box = memnew(LineEdit);
|
||||
search_box->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
search_hb->add_child(search_box);
|
||||
favorite = memnew(Button);
|
||||
favorite->set_flat(true);
|
||||
|
|
|
@ -230,7 +230,7 @@ void EditorDebuggerTree::_item_menu_id_pressed(int p_option) {
|
|||
case ITEM_MENU_SAVE_REMOTE_NODE: {
|
||||
|
||||
file_dialog->set_access(EditorFileDialog::ACCESS_RESOURCES);
|
||||
file_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE);
|
||||
file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
|
||||
|
||||
List<String> extensions;
|
||||
Ref<PackedScene> sd = memnew(PackedScene);
|
||||
|
|
|
@ -979,7 +979,7 @@ void ScriptEditorDebugger::_stack_dump_frame_selected() {
|
|||
|
||||
void ScriptEditorDebugger::_export_csv() {
|
||||
|
||||
file_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE);
|
||||
file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
|
||||
file_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
|
||||
file_dialog->popup_centered_ratio();
|
||||
}
|
||||
|
|
|
@ -174,7 +174,7 @@ void DependencyEditor::_update_list() {
|
|||
|
||||
TreeItem *root = tree->create_item();
|
||||
|
||||
Ref<Texture2D> folder = get_icon("folder", "FileDialog");
|
||||
Ref<Texture2D> folder = tree->get_icon("folder", "FileDialog");
|
||||
|
||||
bool broken = false;
|
||||
|
||||
|
@ -256,7 +256,7 @@ DependencyEditor::DependencyEditor() {
|
|||
vb->add_child(hbc);
|
||||
|
||||
MarginContainer *mc = memnew(MarginContainer);
|
||||
mc->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
mc->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
mc->add_child(tree);
|
||||
vb->add_child(mc);
|
||||
|
@ -264,7 +264,7 @@ DependencyEditor::DependencyEditor() {
|
|||
set_title(TTR("Dependency Editor"));
|
||||
search = memnew(EditorFileDialog);
|
||||
search->connect("file_selected", callable_mp(this, &DependencyEditor::_searched));
|
||||
search->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
search->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
search->set_title(TTR("Search Replacement Resource:"));
|
||||
add_child(search);
|
||||
}
|
||||
|
@ -422,17 +422,17 @@ void DependencyRemoveDialog::_build_removed_dependency_tree(const Vector<Removed
|
|||
if (!tree_items.has(rd.dependency_folder)) {
|
||||
TreeItem *folder_item = owners->create_item(owners->get_root());
|
||||
folder_item->set_text(0, rd.dependency_folder);
|
||||
folder_item->set_icon(0, get_icon("Folder", "EditorIcons"));
|
||||
folder_item->set_icon(0, owners->get_icon("Folder", "EditorIcons"));
|
||||
tree_items[rd.dependency_folder] = folder_item;
|
||||
}
|
||||
TreeItem *dependency_item = owners->create_item(tree_items[rd.dependency_folder]);
|
||||
dependency_item->set_text(0, rd.dependency);
|
||||
dependency_item->set_icon(0, get_icon("Warning", "EditorIcons"));
|
||||
dependency_item->set_icon(0, owners->get_icon("Warning", "EditorIcons"));
|
||||
tree_items[rd.dependency] = dependency_item;
|
||||
} else {
|
||||
TreeItem *dependency_item = owners->create_item(owners->get_root());
|
||||
dependency_item->set_text(0, rd.dependency);
|
||||
dependency_item->set_icon(0, get_icon("Warning", "EditorIcons"));
|
||||
dependency_item->set_icon(0, owners->get_icon("Warning", "EditorIcons"));
|
||||
tree_items[rd.dependency] = dependency_item;
|
||||
}
|
||||
}
|
||||
|
@ -580,7 +580,7 @@ DependencyRemoveDialog::DependencyRemoveDialog() {
|
|||
owners = memnew(Tree);
|
||||
owners->set_hide_root(true);
|
||||
vb->add_child(owners);
|
||||
owners->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
owners->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
}
|
||||
|
||||
//////////////
|
||||
|
@ -636,9 +636,9 @@ DependencyErrorDialog::DependencyErrorDialog() {
|
|||
files = memnew(Tree);
|
||||
files->set_hide_root(true);
|
||||
vb->add_margin_child(TTR("Load failed due to missing dependencies:"), files, true);
|
||||
files->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
files->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
set_custom_minimum_size(Size2(500, 220) * EDSCALE);
|
||||
set_min_size(Size2(500, 220) * EDSCALE);
|
||||
get_ok()->set_text(TTR("Open Anyway"));
|
||||
get_cancel()->set_text(TTR("Close"));
|
||||
|
||||
|
@ -662,7 +662,7 @@ void OrphanResourcesDialog::ok_pressed() {
|
|||
return;
|
||||
|
||||
delete_confirm->set_text(vformat(TTR("Permanently delete %d item(s)? (No undo!)"), paths.size()));
|
||||
delete_confirm->popup_centered_clamped(delete_confirm->get_minimum_size());
|
||||
delete_confirm->popup_centered();
|
||||
}
|
||||
|
||||
bool OrphanResourcesDialog::_fill_owners(EditorFileSystemDirectory *efsd, HashMap<String, int> &refs, TreeItem *p_parent) {
|
||||
|
@ -678,7 +678,7 @@ bool OrphanResourcesDialog::_fill_owners(EditorFileSystemDirectory *efsd, HashMa
|
|||
if (p_parent) {
|
||||
dir_item = files->create_item(p_parent);
|
||||
dir_item->set_text(0, efsd->get_subdir(i)->get_name());
|
||||
dir_item->set_icon(0, get_icon("folder", "FileDialog"));
|
||||
dir_item->set_icon(0, files->get_icon("folder", "FileDialog"));
|
||||
}
|
||||
bool children = _fill_owners(efsd->get_subdir(i), refs, dir_item);
|
||||
|
||||
|
@ -717,7 +717,7 @@ bool OrphanResourcesDialog::_fill_owners(EditorFileSystemDirectory *efsd, HashMa
|
|||
int ds = efsd->get_file_deps(i).size();
|
||||
ti->set_text(1, itos(ds));
|
||||
if (ds) {
|
||||
ti->add_button(1, get_icon("GuiVisibilityVisible", "EditorIcons"), -1, false, TTR("Show Dependencies"));
|
||||
ti->add_button(1, files->get_icon("GuiVisibilityVisible", "EditorIcons"), -1, false, TTR("Show Dependencies"));
|
||||
}
|
||||
ti->set_metadata(0, path);
|
||||
has_children = true;
|
||||
|
|
|
@ -37,20 +37,23 @@
|
|||
#include "core/version.h"
|
||||
#include "core/version_hash.gen.h"
|
||||
|
||||
void EditorAbout::_theme_changed() {
|
||||
|
||||
Control *base = EditorNode::get_singleton()->get_gui_base();
|
||||
Ref<Font> font = base->get_font("source", "EditorFonts");
|
||||
_tpl_text->add_font_override("normal_font", font);
|
||||
_tpl_text->add_constant_override("line_separation", 6 * EDSCALE);
|
||||
_license_text->add_font_override("normal_font", font);
|
||||
_license_text->add_constant_override("line_separation", 6 * EDSCALE);
|
||||
_logo->set_texture(base->get_icon("Logo", "EditorIcons"));
|
||||
}
|
||||
|
||||
void EditorAbout::_notification(int p_what) {
|
||||
|
||||
switch (p_what) {
|
||||
|
||||
case NOTIFICATION_ENTER_TREE:
|
||||
case NOTIFICATION_THEME_CHANGED: {
|
||||
|
||||
Control *base = EditorNode::get_singleton()->get_gui_base();
|
||||
Ref<Font> font = base->get_font("source", "EditorFonts");
|
||||
_tpl_text->add_font_override("normal_font", font);
|
||||
_tpl_text->add_constant_override("line_separation", 6 * EDSCALE);
|
||||
_license_text->add_font_override("normal_font", font);
|
||||
_license_text->add_constant_override("line_separation", 6 * EDSCALE);
|
||||
_logo->set_texture(base->get_icon("Logo", "EditorIcons"));
|
||||
case NOTIFICATION_ENTER_TREE: {
|
||||
_theme_changed();
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
@ -115,9 +118,9 @@ EditorAbout::EditorAbout() {
|
|||
|
||||
set_title(TTR("Thanks from the Godot community!"));
|
||||
set_hide_on_ok(true);
|
||||
set_resizable(true);
|
||||
|
||||
VBoxContainer *vbc = memnew(VBoxContainer);
|
||||
vbc->connect("theme_changed", callable_mp(this, &EditorAbout::_theme_changed));
|
||||
HBoxContainer *hbc = memnew(HBoxContainer);
|
||||
hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
hbc->set_alignment(BoxContainer::ALIGN_CENTER);
|
||||
|
|
|
@ -57,6 +57,8 @@ private:
|
|||
RichTextLabel *_tpl_text;
|
||||
TextureRect *_logo;
|
||||
|
||||
void _theme_changed();
|
||||
|
||||
protected:
|
||||
void _notification(int p_what);
|
||||
static void _bind_methods();
|
||||
|
|
|
@ -112,17 +112,17 @@ void EditorAssetInstaller::open(const String &p_path, int p_depth) {
|
|||
|
||||
Map<String, Ref<Texture2D>> extension_guess;
|
||||
{
|
||||
extension_guess["png"] = get_icon("ImageTexture", "EditorIcons");
|
||||
extension_guess["jpg"] = get_icon("ImageTexture", "EditorIcons");
|
||||
extension_guess["atlastex"] = get_icon("AtlasTexture", "EditorIcons");
|
||||
extension_guess["scn"] = get_icon("PackedScene", "EditorIcons");
|
||||
extension_guess["tscn"] = get_icon("PackedScene", "EditorIcons");
|
||||
extension_guess["shader"] = get_icon("Shader", "EditorIcons");
|
||||
extension_guess["gd"] = get_icon("GDScript", "EditorIcons");
|
||||
extension_guess["vs"] = get_icon("VisualScript", "EditorIcons");
|
||||
extension_guess["png"] = tree->get_icon("ImageTexture", "EditorIcons");
|
||||
extension_guess["jpg"] = tree->get_icon("ImageTexture", "EditorIcons");
|
||||
extension_guess["atlastex"] = tree->get_icon("AtlasTexture", "EditorIcons");
|
||||
extension_guess["scn"] = tree->get_icon("PackedScene", "EditorIcons");
|
||||
extension_guess["tscn"] = tree->get_icon("PackedScene", "EditorIcons");
|
||||
extension_guess["shader"] = tree->get_icon("Shader", "EditorIcons");
|
||||
extension_guess["gd"] = tree->get_icon("GDScript", "EditorIcons");
|
||||
extension_guess["vs"] = tree->get_icon("VisualScript", "EditorIcons");
|
||||
}
|
||||
|
||||
Ref<Texture2D> generic_extension = get_icon("Object", "EditorIcons");
|
||||
Ref<Texture2D> generic_extension = tree->get_icon("Object", "EditorIcons");
|
||||
|
||||
unzClose(pkg);
|
||||
|
||||
|
@ -131,7 +131,7 @@ void EditorAssetInstaller::open(const String &p_path, int p_depth) {
|
|||
TreeItem *root = tree->create_item();
|
||||
root->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
|
||||
root->set_checked(0, true);
|
||||
root->set_icon(0, get_icon("folder", "FileDialog"));
|
||||
root->set_icon(0, tree->get_icon("folder", "FileDialog"));
|
||||
root->set_text(0, "res://");
|
||||
root->set_editable(0, true);
|
||||
Map<String, TreeItem *> dir_map;
|
||||
|
@ -180,7 +180,7 @@ void EditorAssetInstaller::open(const String &p_path, int p_depth) {
|
|||
if (isdir) {
|
||||
dir_map[path] = ti;
|
||||
ti->set_text(0, path.get_file() + "/");
|
||||
ti->set_icon(0, get_icon("folder", "FileDialog"));
|
||||
ti->set_icon(0, tree->get_icon("folder", "FileDialog"));
|
||||
ti->set_metadata(0, String());
|
||||
} else {
|
||||
String file = path.get_file();
|
||||
|
@ -194,7 +194,7 @@ void EditorAssetInstaller::open(const String &p_path, int p_depth) {
|
|||
|
||||
String res_path = "res://" + path;
|
||||
if (FileAccess::exists(res_path)) {
|
||||
ti->set_custom_color(0, get_color("error_color", "Editor"));
|
||||
ti->set_custom_color(0, tree->get_color("error_color", "Editor"));
|
||||
ti->set_tooltip(0, vformat(TTR("%s (Already Exists)"), res_path));
|
||||
ti->set_checked(0, false);
|
||||
} else {
|
||||
|
|
|
@ -1204,7 +1204,7 @@ void EditorAudioBuses::_select_layout() {
|
|||
|
||||
void EditorAudioBuses::_save_as_layout() {
|
||||
|
||||
file_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE);
|
||||
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();
|
||||
|
@ -1213,7 +1213,7 @@ void EditorAudioBuses::_save_as_layout() {
|
|||
|
||||
void EditorAudioBuses::_new_layout() {
|
||||
|
||||
file_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE);
|
||||
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();
|
||||
|
@ -1222,7 +1222,7 @@ void EditorAudioBuses::_new_layout() {
|
|||
|
||||
void EditorAudioBuses::_load_layout() {
|
||||
|
||||
file_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
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();
|
||||
|
@ -1249,7 +1249,7 @@ void EditorAudioBuses::_load_default_layout() {
|
|||
|
||||
void EditorAudioBuses::_file_dialog_callback(const String &p_string) {
|
||||
|
||||
if (file_dialog->get_mode() == EditorFileDialog::MODE_OPEN_FILE) {
|
||||
if (file_dialog->get_file_mode() == EditorFileDialog::FILE_MODE_OPEN_FILE) {
|
||||
Ref<AudioBusLayout> state = ResourceLoader::load(p_string, "", true);
|
||||
if (state.is_null()) {
|
||||
EditorNode::get_singleton()->show_warning(TTR("Invalid file, not an audio bus layout."));
|
||||
|
@ -1263,7 +1263,7 @@ void EditorAudioBuses::_file_dialog_callback(const String &p_string) {
|
|||
EditorNode::get_singleton()->get_undo_redo()->clear_history();
|
||||
call_deferred("_select_layout");
|
||||
|
||||
} else if (file_dialog->get_mode() == EditorFileDialog::MODE_SAVE_FILE) {
|
||||
} else if (file_dialog->get_file_mode() == EditorFileDialog::FILE_MODE_SAVE_FILE) {
|
||||
|
||||
if (new_layout) {
|
||||
Ref<AudioBusLayout> empty_state;
|
||||
|
|
|
@ -825,7 +825,7 @@ EditorAutoloadSettings::EditorAutoloadSettings() {
|
|||
|
||||
autoload_add_path = memnew(EditorLineEditFileChooser);
|
||||
autoload_add_path->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
autoload_add_path->get_file_dialog()->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
autoload_add_path->get_file_dialog()->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
autoload_add_path->get_file_dialog()->connect("file_selected", callable_mp(this, &EditorAutoloadSettings::_autoload_file_callback));
|
||||
autoload_add_path->get_line_edit()->connect("text_changed", callable_mp(this, &EditorAutoloadSettings::_autoload_path_text_changed));
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ void EditorDirDialog::_update_dir(TreeItem *p_item, EditorFileSystemDirectory *p
|
|||
String path = p_dir->get_path();
|
||||
|
||||
p_item->set_metadata(0, p_dir->get_path());
|
||||
p_item->set_icon(0, get_icon("Folder", "EditorIcons"));
|
||||
p_item->set_icon(0, tree->get_icon("Folder", "EditorIcons"));
|
||||
|
||||
if (!p_item->get_parent()) {
|
||||
p_item->set_text(0, "res://");
|
||||
|
@ -69,7 +69,7 @@ void EditorDirDialog::_update_dir(TreeItem *p_item, EditorFileSystemDirectory *p
|
|||
|
||||
void EditorDirDialog::reload(const String &p_path) {
|
||||
|
||||
if (!is_visible_in_tree()) {
|
||||
if (!is_visible()) {
|
||||
must_reload = true;
|
||||
return;
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ void EditorDirDialog::_notification(int p_what) {
|
|||
}
|
||||
|
||||
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
|
||||
if (must_reload && is_visible_in_tree()) {
|
||||
if (must_reload && is_visible()) {
|
||||
reload();
|
||||
}
|
||||
}
|
||||
|
@ -142,11 +142,11 @@ void EditorDirDialog::_make_dir() {
|
|||
TreeItem *ti = tree->get_selected();
|
||||
if (!ti) {
|
||||
mkdirerr->set_text(TTR("Please select a base directory first."));
|
||||
mkdirerr->popup_centered_minsize();
|
||||
mkdirerr->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
makedialog->popup_centered_minsize(Size2(250, 80));
|
||||
makedialog->popup_centered(Size2(250, 80));
|
||||
makedirname->grab_focus();
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,7 @@ void EditorDirDialog::_make_dir_confirm() {
|
|||
Error err = d->make_dir(makedirname->get_text());
|
||||
|
||||
if (err != OK) {
|
||||
mkdirerr->popup_centered_minsize(Size2(250, 80) * EDSCALE);
|
||||
mkdirerr->popup_centered(Size2(250, 80) * EDSCALE);
|
||||
} else {
|
||||
opened_paths.insert(dir);
|
||||
//reload(dir.plus_file(makedirname->get_text()));
|
||||
|
|
|
@ -420,7 +420,7 @@ void EditorFeatureProfileManager::_profile_action(int p_action) {
|
|||
} break;
|
||||
case PROFILE_NEW: {
|
||||
|
||||
new_profile_dialog->popup_centered_minsize();
|
||||
new_profile_dialog->popup_centered();
|
||||
new_profile_name->clear();
|
||||
new_profile_name->grab_focus();
|
||||
} break;
|
||||
|
@ -430,7 +430,7 @@ void EditorFeatureProfileManager::_profile_action(int p_action) {
|
|||
ERR_FAIL_COND(selected == String());
|
||||
|
||||
erase_profile_dialog->set_text(vformat(TTR("Erase profile '%s'? (no undo)"), selected));
|
||||
erase_profile_dialog->popup_centered_minsize();
|
||||
erase_profile_dialog->popup_centered();
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
@ -485,7 +485,7 @@ void EditorFeatureProfileManager::_fill_classes_from(TreeItem *p_parent, const S
|
|||
bool disabled_editor = edited->is_class_editor_disabled(p_class);
|
||||
bool disabled_properties = edited->has_class_properties_disabled(p_class);
|
||||
if (disabled) {
|
||||
class_item->set_custom_color(0, get_color("disabled_font_color", "Editor"));
|
||||
class_item->set_custom_color(0, class_list->get_color("disabled_font_color", "Editor"));
|
||||
} else if (disabled_editor && disabled_properties) {
|
||||
text += " " + TTR("(Editor Disabled, Properties Disabled)");
|
||||
} else if (disabled_properties) {
|
||||
|
@ -805,7 +805,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() {
|
|||
current_profile_name = memnew(LineEdit);
|
||||
name_hbc->add_child(current_profile_name);
|
||||
current_profile_name->set_editable(false);
|
||||
current_profile_name->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
current_profile_name->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
profile_actions[PROFILE_CLEAR] = memnew(Button(TTR("Unset")));
|
||||
name_hbc->add_child(profile_actions[PROFILE_CLEAR]);
|
||||
profile_actions[PROFILE_CLEAR]->set_disabled(true);
|
||||
|
@ -815,7 +815,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() {
|
|||
|
||||
HBoxContainer *profiles_hbc = memnew(HBoxContainer);
|
||||
profile_list = memnew(OptionButton);
|
||||
profile_list->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
profile_list->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
profiles_hbc->add_child(profile_list);
|
||||
profile_list->connect("item_selected", callable_mp(this, &EditorFeatureProfileManager::_profile_selected));
|
||||
|
||||
|
@ -849,12 +849,12 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() {
|
|||
main_vbc->add_margin_child(TTR("Available Profiles:"), profiles_hbc);
|
||||
|
||||
h_split = memnew(HSplitContainer);
|
||||
h_split->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
h_split->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
main_vbc->add_child(h_split);
|
||||
|
||||
VBoxContainer *class_list_vbc = memnew(VBoxContainer);
|
||||
h_split->add_child(class_list_vbc);
|
||||
class_list_vbc->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
class_list_vbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
class_list = memnew(Tree);
|
||||
class_list_vbc->add_margin_child(TTR("Enabled Classes:"), class_list, true);
|
||||
|
@ -865,7 +865,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() {
|
|||
|
||||
VBoxContainer *property_list_vbc = memnew(VBoxContainer);
|
||||
h_split->add_child(property_list_vbc);
|
||||
property_list_vbc->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
property_list_vbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
property_list = memnew(Tree);
|
||||
property_list_vbc->add_margin_child(TTR("Class Options"), property_list, true);
|
||||
|
@ -891,7 +891,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() {
|
|||
|
||||
import_profiles = memnew(EditorFileDialog);
|
||||
add_child(import_profiles);
|
||||
import_profiles->set_mode(EditorFileDialog::MODE_OPEN_FILES);
|
||||
import_profiles->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILES);
|
||||
import_profiles->add_filter("*.profile; " + TTR("Godot Feature Profile"));
|
||||
import_profiles->connect("files_selected", callable_mp(this, &EditorFeatureProfileManager::_import_profiles));
|
||||
import_profiles->set_title(TTR("Import Profile(s)"));
|
||||
|
@ -899,7 +899,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() {
|
|||
|
||||
export_profile = memnew(EditorFileDialog);
|
||||
add_child(export_profile);
|
||||
export_profile->set_mode(EditorFileDialog::MODE_SAVE_FILE);
|
||||
export_profile->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
|
||||
export_profile->add_filter("*.profile; " + TTR("Godot Feature Profile"));
|
||||
export_profile->connect("file_selected", callable_mp(this, &EditorFeatureProfileManager::_export_profile));
|
||||
export_profile->set_title(TTR("Export Profile"));
|
||||
|
|
|
@ -59,17 +59,17 @@ void EditorFileDialog::_notification(int p_what) {
|
|||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
||||
|
||||
// update icons
|
||||
mode_thumbnails->set_icon(get_icon("FileThumbnail", "EditorIcons"));
|
||||
mode_list->set_icon(get_icon("FileList", "EditorIcons"));
|
||||
dir_prev->set_icon(get_icon("Back", "EditorIcons"));
|
||||
dir_next->set_icon(get_icon("Forward", "EditorIcons"));
|
||||
dir_up->set_icon(get_icon("ArrowUp", "EditorIcons"));
|
||||
refresh->set_icon(get_icon("Reload", "EditorIcons"));
|
||||
favorite->set_icon(get_icon("Favorites", "EditorIcons"));
|
||||
show_hidden->set_icon(get_icon("GuiVisibilityVisible", "EditorIcons"));
|
||||
mode_thumbnails->set_icon(item_list->get_icon("FileThumbnail", "EditorIcons"));
|
||||
mode_list->set_icon(item_list->get_icon("FileList", "EditorIcons"));
|
||||
dir_prev->set_icon(item_list->get_icon("Back", "EditorIcons"));
|
||||
dir_next->set_icon(item_list->get_icon("Forward", "EditorIcons"));
|
||||
dir_up->set_icon(item_list->get_icon("ArrowUp", "EditorIcons"));
|
||||
refresh->set_icon(item_list->get_icon("Reload", "EditorIcons"));
|
||||
favorite->set_icon(item_list->get_icon("Favorites", "EditorIcons"));
|
||||
show_hidden->set_icon(item_list->get_icon("GuiVisibilityVisible", "EditorIcons"));
|
||||
|
||||
fav_up->set_icon(get_icon("MoveUp", "EditorIcons"));
|
||||
fav_down->set_icon(get_icon("MoveDown", "EditorIcons"));
|
||||
fav_up->set_icon(item_list->get_icon("MoveUp", "EditorIcons"));
|
||||
fav_down->set_icon(item_list->get_icon("MoveDown", "EditorIcons"));
|
||||
|
||||
} else if (p_what == NOTIFICATION_PROCESS) {
|
||||
|
||||
|
@ -79,14 +79,11 @@ void EditorFileDialog::_notification(int p_what) {
|
|||
preview_wheel_index++;
|
||||
if (preview_wheel_index >= 8)
|
||||
preview_wheel_index = 0;
|
||||
Ref<Texture2D> frame = get_icon("Progress" + itos(preview_wheel_index + 1), "EditorIcons");
|
||||
Ref<Texture2D> frame = item_list->get_icon("Progress" + itos(preview_wheel_index + 1), "EditorIcons");
|
||||
preview->set_texture(frame);
|
||||
preview_wheel_timeout = 0.1;
|
||||
}
|
||||
}
|
||||
} else if (p_what == NOTIFICATION_POPUP_HIDE) {
|
||||
|
||||
set_process_unhandled_input(false);
|
||||
|
||||
} else if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
|
||||
|
||||
|
@ -96,18 +93,23 @@ void EditorFileDialog::_notification(int p_what) {
|
|||
set_display_mode((DisplayMode)EditorSettings::get_singleton()->get("filesystem/file_dialog/display_mode").operator int());
|
||||
|
||||
// update icons
|
||||
mode_thumbnails->set_icon(get_icon("FileThumbnail", "EditorIcons"));
|
||||
mode_list->set_icon(get_icon("FileList", "EditorIcons"));
|
||||
dir_prev->set_icon(get_icon("Back", "EditorIcons"));
|
||||
dir_next->set_icon(get_icon("Forward", "EditorIcons"));
|
||||
dir_up->set_icon(get_icon("ArrowUp", "EditorIcons"));
|
||||
refresh->set_icon(get_icon("Reload", "EditorIcons"));
|
||||
favorite->set_icon(get_icon("Favorites", "EditorIcons"));
|
||||
mode_thumbnails->set_icon(item_list->get_icon("FileThumbnail", "EditorIcons"));
|
||||
mode_list->set_icon(item_list->get_icon("FileList", "EditorIcons"));
|
||||
dir_prev->set_icon(item_list->get_icon("Back", "EditorIcons"));
|
||||
dir_next->set_icon(item_list->get_icon("Forward", "EditorIcons"));
|
||||
dir_up->set_icon(item_list->get_icon("ArrowUp", "EditorIcons"));
|
||||
refresh->set_icon(item_list->get_icon("Reload", "EditorIcons"));
|
||||
favorite->set_icon(item_list->get_icon("Favorites", "EditorIcons"));
|
||||
|
||||
fav_up->set_icon(get_icon("MoveUp", "EditorIcons"));
|
||||
fav_down->set_icon(get_icon("MoveDown", "EditorIcons"));
|
||||
fav_up->set_icon(item_list->get_icon("MoveUp", "EditorIcons"));
|
||||
fav_down->set_icon(item_list->get_icon("MoveDown", "EditorIcons"));
|
||||
// DO NOT CALL UPDATE FILE LIST HERE, ALL HUNDREDS OF HIDDEN DIALOGS WILL RESPOND, CALL INVALIDATE INSTEAD
|
||||
invalidate();
|
||||
} else if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
|
||||
|
||||
if (!is_visible()) {
|
||||
set_process_unhandled_input(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,7 +117,7 @@ void EditorFileDialog::_unhandled_input(const Ref<InputEvent> &p_event) {
|
|||
|
||||
Ref<InputEventKey> k = p_event;
|
||||
|
||||
if (k.is_valid() && is_window_modal_on_top()) {
|
||||
if (k.is_valid()) {
|
||||
|
||||
if (k->is_pressed()) {
|
||||
|
||||
|
@ -177,7 +179,7 @@ void EditorFileDialog::_unhandled_input(const Ref<InputEvent> &p_event) {
|
|||
}
|
||||
|
||||
if (handled) {
|
||||
accept_event();
|
||||
set_input_as_handled();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -209,15 +211,15 @@ void EditorFileDialog::update_dir() {
|
|||
get_ok()->set_disabled(_is_open_should_be_disabled());
|
||||
switch (mode) {
|
||||
|
||||
case MODE_OPEN_FILE:
|
||||
case MODE_OPEN_FILES:
|
||||
case FILE_MODE_OPEN_FILE:
|
||||
case FILE_MODE_OPEN_FILES:
|
||||
get_ok()->set_text(TTR("Open"));
|
||||
break;
|
||||
case MODE_OPEN_DIR:
|
||||
case FILE_MODE_OPEN_DIR:
|
||||
get_ok()->set_text(TTR("Select Current Folder"));
|
||||
break;
|
||||
case MODE_OPEN_ANY:
|
||||
case MODE_SAVE_FILE:
|
||||
case FILE_MODE_OPEN_ANY:
|
||||
case FILE_MODE_SAVE_FILE:
|
||||
// FIXME: Implement, or refactor to avoid duplication with set_mode
|
||||
break;
|
||||
}
|
||||
|
@ -252,23 +254,23 @@ void EditorFileDialog::_post_popup() {
|
|||
update_file_list();
|
||||
invalidated = false;
|
||||
}
|
||||
if (mode == MODE_SAVE_FILE)
|
||||
if (mode == FILE_MODE_SAVE_FILE)
|
||||
file->grab_focus();
|
||||
else
|
||||
item_list->grab_focus();
|
||||
|
||||
if (mode == MODE_OPEN_DIR) {
|
||||
if (mode == FILE_MODE_OPEN_DIR) {
|
||||
file_box->set_visible(false);
|
||||
} else {
|
||||
file_box->set_visible(true);
|
||||
}
|
||||
|
||||
if (is_visible_in_tree() && get_current_file() != "")
|
||||
if (is_visible() && get_current_file() != "")
|
||||
_request_single_thumbnail(get_current_dir().plus_file(get_current_file()));
|
||||
|
||||
if (is_visible_in_tree()) {
|
||||
Ref<Texture2D> folder = get_icon("folder", "FileDialog");
|
||||
const Color folder_color = get_color("folder_icon_modulate", "FileDialog");
|
||||
if (is_visible()) {
|
||||
Ref<Texture2D> folder = item_list->get_icon("folder", "FileDialog");
|
||||
const Color folder_color = item_list->get_color("folder_icon_modulate", "FileDialog");
|
||||
recent->clear();
|
||||
|
||||
bool res = access == ACCESS_RESOURCES;
|
||||
|
@ -347,7 +349,7 @@ void EditorFileDialog::_request_single_thumbnail(const String &p_path) {
|
|||
|
||||
void EditorFileDialog::_action_pressed() {
|
||||
|
||||
if (mode == MODE_OPEN_FILES) {
|
||||
if (mode == FILE_MODE_OPEN_FILES) {
|
||||
|
||||
String fbase = dir_access->get_current_dir();
|
||||
|
||||
|
@ -368,11 +370,11 @@ void EditorFileDialog::_action_pressed() {
|
|||
|
||||
String f = dir_access->get_current_dir().plus_file(file->get_text());
|
||||
|
||||
if ((mode == MODE_OPEN_ANY || mode == MODE_OPEN_FILE) && dir_access->file_exists(f)) {
|
||||
if ((mode == FILE_MODE_OPEN_ANY || mode == FILE_MODE_OPEN_FILE) && dir_access->file_exists(f)) {
|
||||
_save_to_recent();
|
||||
hide();
|
||||
emit_signal("file_selected", f);
|
||||
} else if (mode == MODE_OPEN_ANY || mode == MODE_OPEN_DIR) {
|
||||
} else if (mode == FILE_MODE_OPEN_ANY || mode == FILE_MODE_OPEN_DIR) {
|
||||
|
||||
String path = dir_access->get_current_dir();
|
||||
|
||||
|
@ -394,7 +396,7 @@ void EditorFileDialog::_action_pressed() {
|
|||
emit_signal("dir_selected", path);
|
||||
}
|
||||
|
||||
if (mode == MODE_SAVE_FILE) {
|
||||
if (mode == FILE_MODE_SAVE_FILE) {
|
||||
|
||||
bool valid = false;
|
||||
|
||||
|
@ -447,7 +449,7 @@ void EditorFileDialog::_action_pressed() {
|
|||
|
||||
if (!valid) {
|
||||
|
||||
exterr->popup_centered_minsize(Size2(250, 80) * EDSCALE);
|
||||
exterr->popup_centered(Size2(250, 80) * EDSCALE);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -482,7 +484,7 @@ void EditorFileDialog::_item_selected(int p_item) {
|
|||
|
||||
file->set_text(d["name"]);
|
||||
_request_single_thumbnail(get_current_dir().plus_file(get_current_file()));
|
||||
} else if (mode == MODE_OPEN_DIR) {
|
||||
} else if (mode == FILE_MODE_OPEN_DIR) {
|
||||
get_ok()->set_text(TTR("Select This Folder"));
|
||||
}
|
||||
|
||||
|
@ -513,19 +515,19 @@ void EditorFileDialog::_items_clear_selection() {
|
|||
// If nothing is selected, then block Open button.
|
||||
switch (mode) {
|
||||
|
||||
case MODE_OPEN_FILE:
|
||||
case MODE_OPEN_FILES:
|
||||
case FILE_MODE_OPEN_FILE:
|
||||
case FILE_MODE_OPEN_FILES:
|
||||
get_ok()->set_text(TTR("Open"));
|
||||
get_ok()->set_disabled(!item_list->is_anything_selected());
|
||||
break;
|
||||
|
||||
case MODE_OPEN_DIR:
|
||||
case FILE_MODE_OPEN_DIR:
|
||||
get_ok()->set_disabled(false);
|
||||
get_ok()->set_text(TTR("Select Current Folder"));
|
||||
break;
|
||||
|
||||
case MODE_OPEN_ANY:
|
||||
case MODE_SAVE_FILE:
|
||||
case FILE_MODE_OPEN_ANY:
|
||||
case FILE_MODE_SAVE_FILE:
|
||||
// FIXME: Implement, or refactor to avoid duplication with set_mode
|
||||
break;
|
||||
}
|
||||
|
@ -587,16 +589,16 @@ void EditorFileDialog::_item_list_item_rmb_selected(int p_item, const Vector2 &p
|
|||
}
|
||||
|
||||
if (single_item_selected) {
|
||||
item_menu->add_icon_item(get_icon("ActionCopy", "EditorIcons"), TTR("Copy Path"), ITEM_MENU_COPY_PATH);
|
||||
item_menu->add_icon_item(item_list->get_icon("ActionCopy", "EditorIcons"), TTR("Copy Path"), ITEM_MENU_COPY_PATH);
|
||||
}
|
||||
if (allow_delete) {
|
||||
item_menu->add_icon_item(get_icon("Remove", "EditorIcons"), TTR("Delete"), ITEM_MENU_DELETE, KEY_DELETE);
|
||||
item_menu->add_icon_item(item_list->get_icon("Remove", "EditorIcons"), TTR("Delete"), ITEM_MENU_DELETE, KEY_DELETE);
|
||||
}
|
||||
if (single_item_selected) {
|
||||
item_menu->add_separator();
|
||||
Dictionary item_meta = item_list->get_item_metadata(p_item);
|
||||
String item_text = item_meta["dir"] ? TTR("Open in File Manager") : TTR("Show in File Manager");
|
||||
item_menu->add_icon_item(get_icon("Filesystem", "EditorIcons"), item_text, ITEM_MENU_SHOW_IN_EXPLORER);
|
||||
item_menu->add_icon_item(item_list->get_icon("Filesystem", "EditorIcons"), item_text, ITEM_MENU_SHOW_IN_EXPLORER);
|
||||
}
|
||||
|
||||
if (item_menu->get_item_count() > 0) {
|
||||
|
@ -616,11 +618,11 @@ void EditorFileDialog::_item_list_rmb_clicked(const Vector2 &p_pos) {
|
|||
item_menu->set_size(Size2(1, 1));
|
||||
|
||||
if (can_create_dir) {
|
||||
item_menu->add_icon_item(get_icon("folder", "FileDialog"), TTR("New Folder..."), ITEM_MENU_NEW_FOLDER, KEY_MASK_CMD | KEY_N);
|
||||
item_menu->add_icon_item(item_list->get_icon("folder", "FileDialog"), TTR("New Folder..."), ITEM_MENU_NEW_FOLDER, KEY_MASK_CMD | KEY_N);
|
||||
}
|
||||
item_menu->add_icon_item(get_icon("Reload", "EditorIcons"), TTR("Refresh"), ITEM_MENU_REFRESH, KEY_F5);
|
||||
item_menu->add_icon_item(item_list->get_icon("Reload", "EditorIcons"), TTR("Refresh"), ITEM_MENU_REFRESH, KEY_F5);
|
||||
item_menu->add_separator();
|
||||
item_menu->add_icon_item(get_icon("Filesystem", "EditorIcons"), TTR("Open in File Manager"), ITEM_MENU_SHOW_IN_EXPLORER);
|
||||
item_menu->add_icon_item(item_list->get_icon("Filesystem", "EditorIcons"), TTR("Open in File Manager"), ITEM_MENU_SHOW_IN_EXPLORER);
|
||||
|
||||
item_menu->set_position(item_list->get_global_position() + p_pos);
|
||||
item_menu->popup();
|
||||
|
@ -668,18 +670,18 @@ void EditorFileDialog::_item_menu_id_pressed(int p_option) {
|
|||
|
||||
bool EditorFileDialog::_is_open_should_be_disabled() {
|
||||
|
||||
if (mode == MODE_OPEN_ANY || mode == MODE_SAVE_FILE)
|
||||
if (mode == FILE_MODE_OPEN_ANY || mode == FILE_MODE_SAVE_FILE)
|
||||
return false;
|
||||
|
||||
Vector<int> items = item_list->get_selected_items();
|
||||
if (items.size() == 0)
|
||||
return mode != MODE_OPEN_DIR; // In "Open folder" mode, having nothing selected picks the current folder.
|
||||
return mode != FILE_MODE_OPEN_DIR; // In "Open folder" mode, having nothing selected picks the current folder.
|
||||
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
|
||||
Dictionary d = item_list->get_item_metadata(items.get(i));
|
||||
|
||||
if (((mode == MODE_OPEN_FILE || mode == MODE_OPEN_FILES) && d["dir"]) || (mode == MODE_OPEN_DIR && !d["dir"]))
|
||||
if (((mode == FILE_MODE_OPEN_FILE || mode == FILE_MODE_OPEN_FILES) && d["dir"]) || (mode == FILE_MODE_OPEN_DIR && !d["dir"]))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -725,11 +727,11 @@ void EditorFileDialog::update_file_list() {
|
|||
item_list->set_fixed_icon_size(Size2(thumbnail_size, thumbnail_size));
|
||||
|
||||
if (thumbnail_size < 64) {
|
||||
folder_thumbnail = get_icon("FolderMediumThumb", "EditorIcons");
|
||||
file_thumbnail = get_icon("FileMediumThumb", "EditorIcons");
|
||||
folder_thumbnail = item_list->get_icon("FolderMediumThumb", "EditorIcons");
|
||||
file_thumbnail = item_list->get_icon("FileMediumThumb", "EditorIcons");
|
||||
} else {
|
||||
folder_thumbnail = get_icon("FolderBigThumb", "EditorIcons");
|
||||
file_thumbnail = get_icon("FileBigThumb", "EditorIcons");
|
||||
folder_thumbnail = item_list->get_icon("FolderBigThumb", "EditorIcons");
|
||||
file_thumbnail = item_list->get_icon("FileBigThumb", "EditorIcons");
|
||||
}
|
||||
|
||||
preview_vb->hide();
|
||||
|
@ -749,8 +751,8 @@ void EditorFileDialog::update_file_list() {
|
|||
|
||||
dir_access->list_dir_begin();
|
||||
|
||||
Ref<Texture2D> folder = get_icon("folder", "FileDialog");
|
||||
const Color folder_color = get_color("folder_icon_modulate", "FileDialog");
|
||||
Ref<Texture2D> folder = item_list->get_icon("folder", "FileDialog");
|
||||
const Color folder_color = item_list->get_color("folder_icon_modulate", "FileDialog");
|
||||
List<String> files;
|
||||
List<String> dirs;
|
||||
|
||||
|
@ -979,7 +981,7 @@ void EditorFileDialog::set_current_file(const String &p_file) {
|
|||
file->grab_focus();
|
||||
}
|
||||
|
||||
if (is_visible_in_tree())
|
||||
if (is_visible())
|
||||
_request_single_thumbnail(get_current_dir().plus_file(get_current_file()));
|
||||
}
|
||||
void EditorFileDialog::set_current_path(const String &p_path) {
|
||||
|
@ -999,39 +1001,39 @@ void EditorFileDialog::set_current_path(const String &p_path) {
|
|||
}
|
||||
}
|
||||
|
||||
void EditorFileDialog::set_mode(Mode p_mode) {
|
||||
void EditorFileDialog::set_file_mode(FileMode p_mode) {
|
||||
|
||||
mode = p_mode;
|
||||
switch (mode) {
|
||||
|
||||
case MODE_OPEN_FILE:
|
||||
case FILE_MODE_OPEN_FILE:
|
||||
get_ok()->set_text(TTR("Open"));
|
||||
set_title(TTR("Open a File"));
|
||||
can_create_dir = false;
|
||||
break;
|
||||
case MODE_OPEN_FILES:
|
||||
case FILE_MODE_OPEN_FILES:
|
||||
get_ok()->set_text(TTR("Open"));
|
||||
set_title(TTR("Open File(s)"));
|
||||
can_create_dir = false;
|
||||
break;
|
||||
case MODE_OPEN_DIR:
|
||||
case FILE_MODE_OPEN_DIR:
|
||||
get_ok()->set_text(TTR("Open"));
|
||||
set_title(TTR("Open a Directory"));
|
||||
can_create_dir = true;
|
||||
break;
|
||||
case MODE_OPEN_ANY:
|
||||
case FILE_MODE_OPEN_ANY:
|
||||
get_ok()->set_text(TTR("Open"));
|
||||
set_title(TTR("Open a File or Directory"));
|
||||
can_create_dir = true;
|
||||
break;
|
||||
case MODE_SAVE_FILE:
|
||||
case FILE_MODE_SAVE_FILE:
|
||||
get_ok()->set_text(TTR("Save"));
|
||||
set_title(TTR("Save a File"));
|
||||
can_create_dir = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (mode == MODE_OPEN_FILES) {
|
||||
if (mode == FILE_MODE_OPEN_FILES) {
|
||||
item_list->set_select_mode(ItemList::SELECT_MULTI);
|
||||
} else {
|
||||
item_list->set_select_mode(ItemList::SELECT_SINGLE);
|
||||
|
@ -1044,7 +1046,7 @@ void EditorFileDialog::set_mode(Mode p_mode) {
|
|||
}
|
||||
}
|
||||
|
||||
EditorFileDialog::Mode EditorFileDialog::get_mode() const {
|
||||
EditorFileDialog::FileMode EditorFileDialog::get_file_mode() const {
|
||||
|
||||
return mode;
|
||||
}
|
||||
|
@ -1078,7 +1080,7 @@ void EditorFileDialog::set_access(Access p_access) {
|
|||
|
||||
void EditorFileDialog::invalidate() {
|
||||
|
||||
if (is_visible_in_tree()) {
|
||||
if (is_visible()) {
|
||||
update_file_list();
|
||||
_update_favorites();
|
||||
invalidated = false;
|
||||
|
@ -1103,14 +1105,14 @@ void EditorFileDialog::_make_dir_confirm() {
|
|||
_push_history();
|
||||
EditorFileSystem::get_singleton()->scan_changes(); //we created a dir, so rescan changes
|
||||
} else {
|
||||
mkdirerr->popup_centered_minsize(Size2(250, 50) * EDSCALE);
|
||||
mkdirerr->popup_centered(Size2(250, 50) * EDSCALE);
|
||||
}
|
||||
makedirname->set_text(""); // reset label
|
||||
}
|
||||
|
||||
void EditorFileDialog::_make_dir() {
|
||||
|
||||
makedialog->popup_centered_minsize(Size2(250, 80) * EDSCALE);
|
||||
makedialog->popup_centered(Size2(250, 80) * EDSCALE);
|
||||
makedirname->grab_focus();
|
||||
}
|
||||
|
||||
|
@ -1225,8 +1227,8 @@ void EditorFileDialog::_update_favorites() {
|
|||
bool res = access == ACCESS_RESOURCES;
|
||||
|
||||
String current = get_current_dir();
|
||||
Ref<Texture2D> folder_icon = get_icon("Folder", "EditorIcons");
|
||||
const Color folder_color = get_color("folder_icon_modulate", "FileDialog");
|
||||
Ref<Texture2D> folder_icon = item_list->get_icon("Folder", "EditorIcons");
|
||||
const Color folder_color = item_list->get_color("folder_icon_modulate", "FileDialog");
|
||||
favorites->clear();
|
||||
|
||||
favorite->set_pressed(false);
|
||||
|
@ -1384,8 +1386,8 @@ void EditorFileDialog::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("set_current_dir", "dir"), &EditorFileDialog::set_current_dir);
|
||||
ClassDB::bind_method(D_METHOD("set_current_file", "file"), &EditorFileDialog::set_current_file);
|
||||
ClassDB::bind_method(D_METHOD("set_current_path", "path"), &EditorFileDialog::set_current_path);
|
||||
ClassDB::bind_method(D_METHOD("set_mode", "mode"), &EditorFileDialog::set_mode);
|
||||
ClassDB::bind_method(D_METHOD("get_mode"), &EditorFileDialog::get_mode);
|
||||
ClassDB::bind_method(D_METHOD("set_file_mode", "mode"), &EditorFileDialog::set_file_mode);
|
||||
ClassDB::bind_method(D_METHOD("get_file_mode"), &EditorFileDialog::get_file_mode);
|
||||
ClassDB::bind_method(D_METHOD("get_vbox"), &EditorFileDialog::get_vbox);
|
||||
ClassDB::bind_method(D_METHOD("set_access", "access"), &EditorFileDialog::set_access);
|
||||
ClassDB::bind_method(D_METHOD("get_access"), &EditorFileDialog::get_access);
|
||||
|
@ -1409,18 +1411,18 @@ void EditorFileDialog::_bind_methods() {
|
|||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "access", PROPERTY_HINT_ENUM, "Resources,User data,File system"), "set_access", "get_access");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "display_mode", PROPERTY_HINT_ENUM, "Thumbnails,List"), "set_display_mode", "get_display_mode");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Open one,Open many,Open folder,Open any,Save"), "set_mode", "get_mode");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "file_mode", PROPERTY_HINT_ENUM, "Open one,Open many,Open folder,Open any,Save"), "set_file_mode", "get_file_mode");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_dir", PROPERTY_HINT_DIR), "set_current_dir", "get_current_dir");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_file", PROPERTY_HINT_FILE, "*"), "set_current_file", "get_current_file");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_path"), "set_current_path", "get_current_path");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "show_hidden_files"), "set_show_hidden_files", "is_showing_hidden_files");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "disable_overwrite_warning"), "set_disable_overwrite_warning", "is_overwrite_warning_disabled");
|
||||
|
||||
BIND_ENUM_CONSTANT(MODE_OPEN_FILE);
|
||||
BIND_ENUM_CONSTANT(MODE_OPEN_FILES);
|
||||
BIND_ENUM_CONSTANT(MODE_OPEN_DIR);
|
||||
BIND_ENUM_CONSTANT(MODE_OPEN_ANY);
|
||||
BIND_ENUM_CONSTANT(MODE_SAVE_FILE);
|
||||
BIND_ENUM_CONSTANT(FILE_MODE_OPEN_FILE);
|
||||
BIND_ENUM_CONSTANT(FILE_MODE_OPEN_FILES);
|
||||
BIND_ENUM_CONSTANT(FILE_MODE_OPEN_DIR);
|
||||
BIND_ENUM_CONSTANT(FILE_MODE_OPEN_ANY);
|
||||
BIND_ENUM_CONSTANT(FILE_MODE_SAVE_FILE);
|
||||
|
||||
BIND_ENUM_CONSTANT(ACCESS_RESOURCES);
|
||||
BIND_ENUM_CONSTANT(ACCESS_USERDATA);
|
||||
|
@ -1484,8 +1486,6 @@ bool EditorFileDialog::is_overwrite_warning_disabled() const {
|
|||
|
||||
EditorFileDialog::EditorFileDialog() {
|
||||
|
||||
set_resizable(true);
|
||||
|
||||
show_hidden_files = default_show_hidden_files;
|
||||
display_mode = default_display_mode;
|
||||
local_history_pos = 0;
|
||||
|
@ -1493,7 +1493,7 @@ EditorFileDialog::EditorFileDialog() {
|
|||
VBoxContainer *vbc = memnew(VBoxContainer);
|
||||
add_child(vbc);
|
||||
|
||||
mode = MODE_SAVE_FILE;
|
||||
mode = FILE_MODE_SAVE_FILE;
|
||||
set_title(TTR("Save a File"));
|
||||
|
||||
ED_SHORTCUT("file_dialog/go_back", TTR("Go Back"), KEY_MASK_ALT | KEY_LEFT);
|
||||
|
@ -1533,7 +1533,7 @@ EditorFileDialog::EditorFileDialog() {
|
|||
|
||||
dir = memnew(LineEdit);
|
||||
pathhb->add_child(dir);
|
||||
dir->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
dir->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
refresh = memnew(ToolButton);
|
||||
refresh->set_tooltip(TTR("Refresh files."));
|
||||
|
@ -1589,7 +1589,7 @@ EditorFileDialog::EditorFileDialog() {
|
|||
|
||||
vbc->add_child(pathhb);
|
||||
vbc->add_child(list_hb);
|
||||
list_hb->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
list_hb->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
VSplitContainer *vsc = memnew(VSplitContainer);
|
||||
list_hb->add_child(vsc);
|
||||
|
@ -1597,7 +1597,7 @@ EditorFileDialog::EditorFileDialog() {
|
|||
VBoxContainer *fav_vb = memnew(VBoxContainer);
|
||||
vsc->add_child(fav_vb);
|
||||
fav_vb->set_custom_minimum_size(Size2(150, 100) * EDSCALE);
|
||||
fav_vb->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
fav_vb->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
HBoxContainer *fav_hb = memnew(HBoxContainer);
|
||||
fav_vb->add_child(fav_hb);
|
||||
fav_hb->add_child(memnew(Label(TTR("Favorites:"))));
|
||||
|
@ -1611,13 +1611,13 @@ EditorFileDialog::EditorFileDialog() {
|
|||
|
||||
favorites = memnew(ItemList);
|
||||
fav_vb->add_child(favorites);
|
||||
favorites->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
favorites->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
favorites->connect("item_selected", callable_mp(this, &EditorFileDialog::_favorite_selected));
|
||||
|
||||
VBoxContainer *rec_vb = memnew(VBoxContainer);
|
||||
vsc->add_child(rec_vb);
|
||||
rec_vb->set_custom_minimum_size(Size2(150, 100) * EDSCALE);
|
||||
rec_vb->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
rec_vb->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
recent = memnew(ItemList);
|
||||
recent->set_allow_reselect(true);
|
||||
rec_vb->add_margin_child(TTR("Recent:"), recent, true);
|
||||
|
@ -1628,18 +1628,18 @@ EditorFileDialog::EditorFileDialog() {
|
|||
item_vb->set_custom_minimum_size(Size2(320, 0) * EDSCALE);
|
||||
|
||||
HBoxContainer *preview_hb = memnew(HBoxContainer);
|
||||
preview_hb->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
preview_hb->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
item_vb->add_child(preview_hb);
|
||||
|
||||
VBoxContainer *list_vb = memnew(VBoxContainer);
|
||||
list_vb->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
list_vb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
list_vb->add_child(memnew(Label(TTR("Directories & Files:"))));
|
||||
preview_hb->add_child(list_vb);
|
||||
|
||||
// Item (files and folders) list with context menu.
|
||||
|
||||
item_list = memnew(ItemList);
|
||||
item_list->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
item_list->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
item_list->connect("item_rmb_selected", callable_mp(this, &EditorFileDialog::_item_list_item_rmb_selected));
|
||||
item_list->connect("rmb_clicked", callable_mp(this, &EditorFileDialog::_item_list_rmb_clicked));
|
||||
item_list->set_allow_rmb_select(true);
|
||||
|
@ -1663,14 +1663,14 @@ EditorFileDialog::EditorFileDialog() {
|
|||
file_box->add_child(memnew(Label(TTR("File:"))));
|
||||
file = memnew(LineEdit);
|
||||
file->set_stretch_ratio(4);
|
||||
file->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
file->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
file_box->add_child(file);
|
||||
filter = memnew(OptionButton);
|
||||
filter->set_stretch_ratio(3);
|
||||
filter->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
filter->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
filter->set_clip_text(true); // Too many extensions overflow it.
|
||||
file_box->add_child(filter);
|
||||
file_box->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
file_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
item_vb->add_child(file_box);
|
||||
|
||||
dir_access = DirAccess::create(DirAccess::ACCESS_RESOURCES);
|
||||
|
@ -1687,7 +1687,7 @@ EditorFileDialog::EditorFileDialog() {
|
|||
filter->connect("item_selected", callable_mp(this, &EditorFileDialog::_filter_selected));
|
||||
|
||||
confirm_save = memnew(ConfirmationDialog);
|
||||
confirm_save->set_as_toplevel(true);
|
||||
//confirm_save->set_as_toplevel(true);
|
||||
add_child(confirm_save);
|
||||
confirm_save->connect("confirmed", callable_mp(this, &EditorFileDialog::_save_confirm_pressed));
|
||||
|
||||
|
@ -1762,7 +1762,7 @@ EditorLineEditFileChooser::EditorLineEditFileChooser() {
|
|||
|
||||
line_edit = memnew(LineEdit);
|
||||
add_child(line_edit);
|
||||
line_edit->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
line_edit->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
button = memnew(Button);
|
||||
add_child(button);
|
||||
button->connect("pressed", callable_mp(this, &EditorLineEditFileChooser::_browse));
|
||||
|
|
|
@ -60,12 +60,12 @@ public:
|
|||
ACCESS_FILESYSTEM
|
||||
};
|
||||
|
||||
enum Mode {
|
||||
MODE_OPEN_FILE,
|
||||
MODE_OPEN_FILES,
|
||||
MODE_OPEN_DIR,
|
||||
MODE_OPEN_ANY,
|
||||
MODE_SAVE_FILE
|
||||
enum FileMode {
|
||||
FILE_MODE_OPEN_FILE,
|
||||
FILE_MODE_OPEN_FILES,
|
||||
FILE_MODE_OPEN_DIR,
|
||||
FILE_MODE_OPEN_ANY,
|
||||
FILE_MODE_SAVE_FILE
|
||||
};
|
||||
|
||||
typedef Ref<Texture2D> (*GetIconFunc)(const String &);
|
||||
|
@ -92,7 +92,7 @@ private:
|
|||
Access access;
|
||||
//Button *action;
|
||||
VBoxContainer *vbox;
|
||||
Mode mode;
|
||||
FileMode mode;
|
||||
bool can_create_dir;
|
||||
LineEdit *dir;
|
||||
|
||||
|
@ -221,8 +221,8 @@ public:
|
|||
void set_display_mode(DisplayMode p_mode);
|
||||
DisplayMode get_display_mode() const;
|
||||
|
||||
void set_mode(Mode p_mode);
|
||||
Mode get_mode() const;
|
||||
void set_file_mode(FileMode p_mode);
|
||||
FileMode get_file_mode() const;
|
||||
|
||||
VBoxContainer *get_vbox();
|
||||
LineEdit *get_line_edit() { return file; }
|
||||
|
@ -267,7 +267,7 @@ public:
|
|||
EditorLineEditFileChooser();
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST(EditorFileDialog::Mode);
|
||||
VARIANT_ENUM_CAST(EditorFileDialog::FileMode);
|
||||
VARIANT_ENUM_CAST(EditorFileDialog::Access);
|
||||
VARIANT_ENUM_CAST(EditorFileDialog::DisplayMode);
|
||||
|
||||
|
|
|
@ -37,13 +37,13 @@
|
|||
|
||||
void EditorHelpSearch::_update_icons() {
|
||||
|
||||
search_box->set_right_icon(get_icon("Search", "EditorIcons"));
|
||||
search_box->set_right_icon(results_tree->get_icon("Search", "EditorIcons"));
|
||||
search_box->set_clear_button_enabled(true);
|
||||
search_box->add_icon_override("right_icon", get_icon("Search", "EditorIcons"));
|
||||
case_sensitive_button->set_icon(get_icon("MatchCase", "EditorIcons"));
|
||||
hierarchy_button->set_icon(get_icon("ClassList", "EditorIcons"));
|
||||
search_box->add_icon_override("right_icon", results_tree->get_icon("Search", "EditorIcons"));
|
||||
case_sensitive_button->set_icon(results_tree->get_icon("MatchCase", "EditorIcons"));
|
||||
hierarchy_button->set_icon(results_tree->get_icon("ClassList", "EditorIcons"));
|
||||
|
||||
if (is_visible_in_tree())
|
||||
if (is_visible())
|
||||
_update_results();
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ void EditorHelpSearch::_update_results() {
|
|||
if (hierarchy_button->is_pressed())
|
||||
search_flags |= SEARCH_SHOW_HIERARCHY;
|
||||
|
||||
search = Ref<Runner>(memnew(Runner(this, results_tree, term, search_flags)));
|
||||
search = Ref<Runner>(memnew(Runner(results_tree, results_tree, term, search_flags)));
|
||||
set_process(true);
|
||||
}
|
||||
|
||||
|
@ -105,6 +105,13 @@ void EditorHelpSearch::_confirmed() {
|
|||
void EditorHelpSearch::_notification(int p_what) {
|
||||
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||
if (!is_visible()) {
|
||||
results_tree->call_deferred("clear"); // Wait for the Tree's mouse event propagation.
|
||||
get_ok()->set_disabled(true);
|
||||
EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "search_help", Rect2(get_position(), get_size()));
|
||||
}
|
||||
} break;
|
||||
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
||||
|
||||
_update_icons();
|
||||
|
@ -114,12 +121,7 @@ void EditorHelpSearch::_notification(int p_what) {
|
|||
connect("confirmed", callable_mp(this, &EditorHelpSearch::_confirmed));
|
||||
_update_icons();
|
||||
} break;
|
||||
case NOTIFICATION_POPUP_HIDE: {
|
||||
|
||||
results_tree->call_deferred("clear"); // Wait for the Tree's mouse event propagation.
|
||||
get_ok()->set_disabled(true);
|
||||
EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "search_help", get_rect());
|
||||
} break;
|
||||
case NOTIFICATION_PROCESS: {
|
||||
|
||||
// Update background search.
|
||||
|
@ -184,7 +186,7 @@ EditorHelpSearch::EditorHelpSearch() {
|
|||
old_search = false;
|
||||
|
||||
set_hide_on_ok(false);
|
||||
set_resizable(true);
|
||||
|
||||
set_title(TTR("Search Help"));
|
||||
|
||||
get_ok()->set_disabled(true);
|
||||
|
@ -200,7 +202,7 @@ EditorHelpSearch::EditorHelpSearch() {
|
|||
|
||||
search_box = memnew(LineEdit);
|
||||
search_box->set_custom_minimum_size(Size2(200, 0) * EDSCALE);
|
||||
search_box->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
search_box->connect("gui_input", callable_mp(this, &EditorHelpSearch::_search_box_gui_input));
|
||||
search_box->connect("text_changed", callable_mp(this, &EditorHelpSearch::_search_box_text_changed));
|
||||
register_text_enter(search_box);
|
||||
|
@ -210,7 +212,7 @@ EditorHelpSearch::EditorHelpSearch() {
|
|||
case_sensitive_button->set_tooltip(TTR("Case Sensitive"));
|
||||
case_sensitive_button->connect("pressed", callable_mp(this, &EditorHelpSearch::_update_results));
|
||||
case_sensitive_button->set_toggle_mode(true);
|
||||
case_sensitive_button->set_focus_mode(FOCUS_NONE);
|
||||
case_sensitive_button->set_focus_mode(Control::FOCUS_NONE);
|
||||
hbox->add_child(case_sensitive_button);
|
||||
|
||||
hierarchy_button = memnew(ToolButton);
|
||||
|
@ -218,7 +220,7 @@ EditorHelpSearch::EditorHelpSearch() {
|
|||
hierarchy_button->connect("pressed", callable_mp(this, &EditorHelpSearch::_update_results));
|
||||
hierarchy_button->set_toggle_mode(true);
|
||||
hierarchy_button->set_pressed(true);
|
||||
hierarchy_button->set_focus_mode(FOCUS_NONE);
|
||||
hierarchy_button->set_focus_mode(Control::FOCUS_NONE);
|
||||
hbox->add_child(hierarchy_button);
|
||||
|
||||
filter_combo = memnew(OptionButton);
|
||||
|
@ -237,7 +239,7 @@ EditorHelpSearch::EditorHelpSearch() {
|
|||
|
||||
// Create the results tree.
|
||||
results_tree = memnew(Tree);
|
||||
results_tree->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
results_tree->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
results_tree->set_columns(2);
|
||||
results_tree->set_column_title(0, TTR("Name"));
|
||||
results_tree->set_column_title(1, TTR("Member Type"));
|
||||
|
|
|
@ -52,12 +52,12 @@ void EditorLayoutsDialog::_line_gui_input(const Ref<InputEvent> &p_event) {
|
|||
if (get_hide_on_ok())
|
||||
hide();
|
||||
ok_pressed();
|
||||
accept_event();
|
||||
set_input_as_handled();
|
||||
} break;
|
||||
case KEY_ESCAPE: {
|
||||
|
||||
hide();
|
||||
accept_event();
|
||||
set_input_as_handled();
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
@ -110,15 +110,15 @@ EditorLayoutsDialog::EditorLayoutsDialog() {
|
|||
|
||||
makevb = memnew(VBoxContainer);
|
||||
add_child(makevb);
|
||||
makevb->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 5);
|
||||
makevb->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -5);
|
||||
makevb->set_anchor_and_margin(MARGIN_LEFT, Control::ANCHOR_BEGIN, 5);
|
||||
makevb->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, -5);
|
||||
|
||||
layout_names = memnew(ItemList);
|
||||
makevb->add_child(layout_names);
|
||||
layout_names->set_visible(true);
|
||||
layout_names->set_margin(MARGIN_TOP, 5);
|
||||
layout_names->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 5);
|
||||
layout_names->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -5);
|
||||
layout_names->set_anchor_and_margin(MARGIN_LEFT, Control::ANCHOR_BEGIN, 5);
|
||||
layout_names->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, -5);
|
||||
layout_names->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
layout_names->set_select_mode(ItemList::SELECT_MULTI);
|
||||
layout_names->set_allow_rmb_select(true);
|
||||
|
@ -126,8 +126,8 @@ EditorLayoutsDialog::EditorLayoutsDialog() {
|
|||
name = memnew(LineEdit);
|
||||
makevb->add_child(name);
|
||||
name->set_margin(MARGIN_TOP, 5);
|
||||
name->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 5);
|
||||
name->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -5);
|
||||
name->set_anchor_and_margin(MARGIN_LEFT, Control::ANCHOR_BEGIN, 5);
|
||||
name->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, -5);
|
||||
name->connect("gui_input", callable_mp(this, &EditorLayoutsDialog::_line_gui_input));
|
||||
name->connect("focus_entered", callable_mp(layout_names, &ItemList::unselect_all));
|
||||
}
|
||||
|
|
|
@ -828,7 +828,7 @@ void EditorNode::save_resource_as(const Ref<Resource> &p_resource, const String
|
|||
}
|
||||
}
|
||||
|
||||
file->set_mode(EditorFileDialog::MODE_SAVE_FILE);
|
||||
file->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
|
||||
saving_resource = p_resource;
|
||||
|
||||
current_option = RESOURCE_SAVE_AS;
|
||||
|
@ -1472,7 +1472,7 @@ void EditorNode::_dialog_action(String p_file) {
|
|||
|
||||
int scene_idx = (current_option == FILE_SAVE_SCENE || current_option == FILE_SAVE_AS_SCENE) ? -1 : tab_closing;
|
||||
|
||||
if (file->get_mode() == EditorFileDialog::MODE_SAVE_FILE) {
|
||||
if (file->get_file_mode() == EditorFileDialog::FILE_MODE_SAVE_FILE) {
|
||||
bool same_open_scene = false;
|
||||
for (int i = 0; i < editor_data.get_edited_scene_count(); i++) {
|
||||
if (editor_data.get_scene_path(i) == p_file && i != scene_idx)
|
||||
|
@ -1496,7 +1496,7 @@ void EditorNode::_dialog_action(String p_file) {
|
|||
} break;
|
||||
|
||||
case FILE_SAVE_AND_RUN: {
|
||||
if (file->get_mode() == EditorFileDialog::MODE_SAVE_FILE) {
|
||||
if (file->get_file_mode() == EditorFileDialog::FILE_MODE_SAVE_FILE) {
|
||||
|
||||
_save_default_environment();
|
||||
_save_scene_with_preview(p_file);
|
||||
|
@ -1626,7 +1626,7 @@ void EditorNode::_dialog_action(String p_file) {
|
|||
} break;
|
||||
default: { //save scene?
|
||||
|
||||
if (file->get_mode() == EditorFileDialog::MODE_SAVE_FILE) {
|
||||
if (file->get_file_mode() == EditorFileDialog::FILE_MODE_SAVE_FILE) {
|
||||
_save_scene_with_preview(p_file);
|
||||
}
|
||||
|
||||
|
@ -2091,7 +2091,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
|
|||
case FILE_NEW_INHERITED_SCENE:
|
||||
case FILE_OPEN_SCENE: {
|
||||
|
||||
file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
List<String> extensions;
|
||||
ResourceLoader::get_recognized_extensions_for_type("PackedScene", &extensions);
|
||||
file->clear_filters();
|
||||
|
@ -2164,7 +2164,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
|
|||
String scene_filename = editor_data.get_edited_scene_root(tab_closing)->get_filename();
|
||||
save_confirmation->get_ok()->set_text(TTR("Save & Close"));
|
||||
save_confirmation->set_text(vformat(TTR("Save changes to '%s' before closing?"), scene_filename != "" ? scene_filename : "unsaved scene"));
|
||||
save_confirmation->popup_centered_minsize();
|
||||
save_confirmation->popup_centered();
|
||||
break;
|
||||
}
|
||||
} else if (p_option == FILE_CLOSE) {
|
||||
|
@ -2218,7 +2218,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
|
|||
break;
|
||||
}
|
||||
|
||||
file->set_mode(EditorFileDialog::MODE_SAVE_FILE);
|
||||
file->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
|
||||
|
||||
List<String> extensions;
|
||||
Ref<PackedScene> sd = memnew(PackedScene);
|
||||
|
@ -2260,7 +2260,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
|
|||
confirmation->get_cancel()->set_text(TTR("No"));
|
||||
confirmation->get_ok()->set_text(TTR("Yes"));
|
||||
confirmation->set_text(TTR("This scene has never been saved. Save before running?"));
|
||||
confirmation->popup_centered_minsize();
|
||||
confirmation->popup_centered();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2332,7 +2332,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
|
|||
|
||||
confirmation->get_ok()->set_text(TTR("Open"));
|
||||
confirmation->set_text(TTR("Current scene not saved. Open anyway?"));
|
||||
confirmation->popup_centered_minsize();
|
||||
confirmation->popup_centered();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2390,7 +2390,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
|
|||
if (unsaved_cache && !p_confirmed) {
|
||||
confirmation->get_ok()->set_text(TTR("Revert"));
|
||||
confirmation->set_text(TTR("This action cannot be undone. Revert anyway?"));
|
||||
confirmation->popup_centered_minsize();
|
||||
confirmation->popup_centered();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2493,11 +2493,11 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
|
|||
export_template_manager->install_android_template();
|
||||
} else {
|
||||
if (DirAccess::exists("res://android/build")) {
|
||||
remove_android_build_template->popup_centered_minsize();
|
||||
remove_android_build_template->popup_centered();
|
||||
} else if (export_template_manager->can_install_android_template()) {
|
||||
install_android_build_template->popup_centered_minsize();
|
||||
install_android_build_template->popup_centered();
|
||||
} else {
|
||||
custom_build_manage_templates->popup_centered_minsize();
|
||||
custom_build_manage_templates->popup_centered();
|
||||
}
|
||||
}
|
||||
} break;
|
||||
|
@ -2519,7 +2519,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
|
|||
|
||||
confirmation->get_ok()->set_text(p_option == FILE_QUIT ? TTR("Quit") : TTR("Yes"));
|
||||
confirmation->set_text(p_option == FILE_QUIT ? TTR("Exit the editor?") : TTR("Open Project Manager?"));
|
||||
confirmation->popup_centered_minsize();
|
||||
confirmation->popup_centered();
|
||||
} else {
|
||||
_discard_changes();
|
||||
break;
|
||||
|
@ -2540,7 +2540,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
|
|||
|
||||
save_confirmation->get_ok()->set_text(TTR("Save & Quit"));
|
||||
save_confirmation->set_text((p_option == FILE_QUIT ? TTR("Save changes to the following scene(s) before quitting?") : TTR("Save changes the following scene(s) before opening Project Manager?")) + unsaved_scenes);
|
||||
save_confirmation->popup_centered_minsize();
|
||||
save_confirmation->popup_centered();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2607,7 +2607,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
|
|||
} break;
|
||||
case SETTINGS_PICK_MAIN_SCENE: {
|
||||
|
||||
file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
List<String> extensions;
|
||||
ResourceLoader::get_recognized_extensions_for_type("PackedScene", &extensions);
|
||||
file->clear_filters();
|
||||
|
@ -2640,7 +2640,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
|
|||
OS::get_singleton()->shell_open("https://godotengine.org/community");
|
||||
} break;
|
||||
case HELP_ABOUT: {
|
||||
about->popup_centered_minsize(Size2(780, 500) * EDSCALE);
|
||||
about->popup_centered(Size2(780, 500) * EDSCALE);
|
||||
} break;
|
||||
|
||||
case SET_VIDEO_DRIVER_SAVE_AND_RESTART: {
|
||||
|
@ -3275,7 +3275,7 @@ Error EditorNode::load_scene(const String &p_scene, bool p_ignore_broken_deps, b
|
|||
|
||||
if (!p_force_open_imported && FileAccess::exists(p_scene + ".import")) {
|
||||
open_imported->set_text(vformat(TTR("Scene '%s' was automatically imported, so it can't be modified.\nTo make changes to it, a new inherited scene can be created."), p_scene.get_file()));
|
||||
open_imported->popup_centered_minsize();
|
||||
open_imported->popup_centered();
|
||||
new_inherited_button->grab_focus();
|
||||
open_import_request = p_scene;
|
||||
return OK;
|
||||
|
@ -3928,7 +3928,7 @@ void EditorNode::show_accept(const String &p_text, const String &p_title) {
|
|||
current_option = -1;
|
||||
accept->get_ok()->set_text(p_title);
|
||||
accept->set_text(p_text);
|
||||
accept->popup_centered_minsize();
|
||||
accept->popup_centered();
|
||||
}
|
||||
|
||||
void EditorNode::show_warning(const String &p_text, const String &p_title) {
|
||||
|
@ -3936,7 +3936,7 @@ void EditorNode::show_warning(const String &p_text, const String &p_title) {
|
|||
if (warning->is_inside_tree()) {
|
||||
warning->set_text(p_text);
|
||||
warning->set_title(p_title);
|
||||
warning->popup_centered_minsize();
|
||||
warning->popup_centered();
|
||||
} else {
|
||||
WARN_PRINT(p_title + " " + p_text);
|
||||
}
|
||||
|
@ -3947,6 +3947,76 @@ void EditorNode::_copy_warning(const String &p_str) {
|
|||
DisplayServer::get_singleton()->clipboard_set(warning->get_text());
|
||||
}
|
||||
|
||||
void EditorNode::_dock_floating_close_request(Control *p_control) {
|
||||
Window *window = (Window *)p_control->get_parent();
|
||||
int window_slot = window->get_meta("dock_slot");
|
||||
|
||||
window->remove_child(p_control);
|
||||
dock_slot[window_slot]->add_child(p_control);
|
||||
|
||||
window->queue_delete();
|
||||
|
||||
_update_dock_containers();
|
||||
|
||||
floating_docks.erase(p_control);
|
||||
}
|
||||
|
||||
void EditorNode::_dock_make_float() {
|
||||
Control *dock = dock_slot[dock_popup_selected]->get_current_tab_control();
|
||||
ERR_FAIL_COND(!dock);
|
||||
|
||||
Size2 dock_size = dock->get_size(); //remember size
|
||||
Point2 dock_screen_pos = dock->get_global_position() + get_tree()->get_root()->get_position();
|
||||
|
||||
dock_slot[dock_popup_selected]->remove_child(dock);
|
||||
|
||||
Window *window = memnew(Window);
|
||||
window->set_title(dock->get_name());
|
||||
Panel *p = memnew(Panel);
|
||||
p->set_mode(Panel::MODE_FOREGROUND);
|
||||
p->set_anchors_and_margins_preset(Control::PRESET_WIDE);
|
||||
window->add_child(p);
|
||||
dock->set_anchors_and_margins_preset(Control::PRESET_WIDE);
|
||||
window->add_child(dock);
|
||||
window->set_wrap_controls(true);
|
||||
window->set_size(dock_size);
|
||||
window->set_position(dock_screen_pos);
|
||||
window->set_transient(true);
|
||||
window->connect("close_requested", callable_mp(this, &EditorNode::_dock_floating_close_request), varray(dock));
|
||||
window->set_meta("dock_slot", dock_popup_selected);
|
||||
gui_base->add_child(window);
|
||||
|
||||
dock_select_popup->hide();
|
||||
|
||||
_update_dock_containers();
|
||||
|
||||
floating_docks.push_back(dock);
|
||||
}
|
||||
|
||||
void EditorNode::_update_dock_containers() {
|
||||
|
||||
for (int i = 0; i < DOCK_SLOT_MAX; i++) {
|
||||
if (dock_slot[i]->get_tab_count() == 0 && dock_slot[i]->is_visible()) {
|
||||
dock_slot[i]->hide();
|
||||
}
|
||||
if (dock_slot[i]->get_tab_count() > 0 && !dock_slot[i]->is_visible()) {
|
||||
dock_slot[i]->show();
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < vsplits.size(); i++) {
|
||||
bool in_use = dock_slot[i * 2 + 0]->get_tab_count() || dock_slot[i * 2 + 1]->get_tab_count();
|
||||
if (in_use)
|
||||
vsplits[i]->show();
|
||||
else
|
||||
vsplits[i]->hide();
|
||||
}
|
||||
|
||||
if (right_l_vsplit->is_visible() || right_r_vsplit->is_visible())
|
||||
right_hsplit->show();
|
||||
else
|
||||
right_hsplit->hide();
|
||||
}
|
||||
|
||||
void EditorNode::_dock_select_input(const Ref<InputEvent> &p_input) {
|
||||
|
||||
Ref<InputEventMouse> me = p_input;
|
||||
|
@ -3992,18 +4062,7 @@ void EditorNode::_dock_select_input(const Ref<InputEvent> &p_input) {
|
|||
dock_slot[nrect]->show();
|
||||
dock_select->update();
|
||||
|
||||
for (int i = 0; i < vsplits.size(); i++) {
|
||||
bool in_use = dock_slot[i * 2 + 0]->get_tab_count() || dock_slot[i * 2 + 1]->get_tab_count();
|
||||
if (in_use)
|
||||
vsplits[i]->show();
|
||||
else
|
||||
vsplits[i]->hide();
|
||||
}
|
||||
|
||||
if (right_l_vsplit->is_visible() || right_r_vsplit->is_visible())
|
||||
right_hsplit->show();
|
||||
else
|
||||
right_hsplit->hide();
|
||||
_update_dock_containers();
|
||||
|
||||
_edit_current();
|
||||
_save_docks();
|
||||
|
@ -4460,7 +4519,7 @@ bool EditorNode::ensure_main_scene(bool p_from_native) {
|
|||
|
||||
current_option = -1;
|
||||
pick_main_scene->set_text(TTR("No main scene has ever been defined, select one?\nYou can change it later in \"Project Settings\" under the 'application' category."));
|
||||
pick_main_scene->popup_centered_minsize();
|
||||
pick_main_scene->popup_centered();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -4468,7 +4527,7 @@ bool EditorNode::ensure_main_scene(bool p_from_native) {
|
|||
|
||||
current_option = -1;
|
||||
pick_main_scene->set_text(vformat(TTR("Selected scene '%s' does not exist, select a valid one?\nYou can change it later in \"Project Settings\" under the 'application' category."), main_scene));
|
||||
pick_main_scene->popup_centered_minsize();
|
||||
pick_main_scene->popup_centered();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -4476,7 +4535,7 @@ bool EditorNode::ensure_main_scene(bool p_from_native) {
|
|||
|
||||
current_option = -1;
|
||||
pick_main_scene->set_text(vformat(TTR("Selected scene '%s' is not a scene file, select a valid one?\nYou can change it later in \"Project Settings\" under the 'application' category."), main_scene));
|
||||
pick_main_scene->popup_centered_minsize();
|
||||
pick_main_scene->popup_centered();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -4596,7 +4655,7 @@ void EditorNode::_scene_tab_closed(int p_tab, int option) {
|
|||
if (unsaved) {
|
||||
save_confirmation->get_ok()->set_text(TTR("Save & Close"));
|
||||
save_confirmation->set_text(vformat(TTR("Save changes to '%s' before closing?"), scene->get_filename() != "" ? scene->get_filename() : "unsaved scene"));
|
||||
save_confirmation->popup_centered_minsize();
|
||||
save_confirmation->popup_centered();
|
||||
} else {
|
||||
_discard_changes();
|
||||
}
|
||||
|
@ -5300,7 +5359,7 @@ void EditorNode::_video_driver_selected(int p_which) {
|
|||
}
|
||||
|
||||
video_driver_request = driver;
|
||||
video_restart_dialog->popup_centered_minsize();
|
||||
video_restart_dialog->popup_centered();
|
||||
video_driver->select(video_driver_current);
|
||||
_update_video_driver_color();
|
||||
}
|
||||
|
@ -5845,6 +5904,14 @@ EditorNode::EditorNode() {
|
|||
dock_select->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
dock_vb->add_child(dock_select);
|
||||
|
||||
dock_float = memnew(Button);
|
||||
dock_float->set_text("Make Floating");
|
||||
dock_float->set_focus_mode(Control::FOCUS_NONE);
|
||||
dock_float->set_h_size_flags(Control::SIZE_SHRINK_CENTER);
|
||||
dock_float->connect("pressed", callable_mp(this, &EditorNode::_dock_make_float));
|
||||
|
||||
dock_vb->add_child(dock_float);
|
||||
|
||||
dock_select_popup->set_as_minsize();
|
||||
dock_select_rect_over = -1;
|
||||
dock_popup_selected = -1;
|
||||
|
@ -6458,7 +6525,7 @@ EditorNode::EditorNode() {
|
|||
file_templates->set_title(TTR("Import Templates From ZIP File"));
|
||||
|
||||
gui_base->add_child(file_templates);
|
||||
file_templates->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
file_templates->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
file_templates->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
|
||||
file_templates->clear_filters();
|
||||
file_templates->add_filter("*.tpz ; " + TTR("Template Package"));
|
||||
|
@ -6469,7 +6536,7 @@ EditorNode::EditorNode() {
|
|||
|
||||
file_export_lib = memnew(EditorFileDialog);
|
||||
file_export_lib->set_title(TTR("Export Library"));
|
||||
file_export_lib->set_mode(EditorFileDialog::MODE_SAVE_FILE);
|
||||
file_export_lib->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
|
||||
file_export_lib->connect("file_selected", callable_mp(this, &EditorNode::_dialog_action));
|
||||
file_export_lib_merge = memnew(CheckBox);
|
||||
file_export_lib_merge->set_text(TTR("Merge With Existing"));
|
||||
|
@ -6480,7 +6547,7 @@ EditorNode::EditorNode() {
|
|||
file_script = memnew(EditorFileDialog);
|
||||
file_script->set_title(TTR("Open & Run a Script"));
|
||||
file_script->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
|
||||
file_script->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
file_script->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
List<String> sexts;
|
||||
ResourceLoader::get_recognized_extensions_for_type("Script", &sexts);
|
||||
for (List<String>::Element *E = sexts.front(); E; E = E->next()) {
|
||||
|
|
|
@ -350,11 +350,14 @@ private:
|
|||
Button *new_inherited_button;
|
||||
String open_import_request;
|
||||
|
||||
Vector<Control *> floating_docks;
|
||||
|
||||
TabContainer *dock_slot[DOCK_SLOT_MAX];
|
||||
Rect2 dock_select_rect[DOCK_SLOT_MAX];
|
||||
int dock_select_rect_over;
|
||||
PopupPanel *dock_select_popup;
|
||||
Control *dock_select;
|
||||
Button *dock_float;
|
||||
ToolButton *dock_tab_move_left;
|
||||
ToolButton *dock_tab_move_right;
|
||||
int dock_popup_selected;
|
||||
|
@ -562,6 +565,8 @@ private:
|
|||
|
||||
bool _find_scene_in_use(Node *p_node, const String &p_path) const;
|
||||
|
||||
void _update_dock_containers();
|
||||
|
||||
void _dock_select_input(const Ref<InputEvent> &p_input);
|
||||
void _dock_move_left();
|
||||
void _dock_move_right();
|
||||
|
@ -569,6 +574,8 @@ private:
|
|||
void _dock_pre_popup(int p_which);
|
||||
void _dock_split_dragged(int ofs);
|
||||
void _dock_popup_exit();
|
||||
void _dock_floating_close_request(Control *p_control);
|
||||
void _dock_make_float();
|
||||
void _scene_tab_changed(int p_tab);
|
||||
void _scene_tab_closed(int p_tab, int option = SCENE_TAB_CLOSE);
|
||||
void _scene_tab_hover(int p_tab);
|
||||
|
|
|
@ -240,10 +240,10 @@ void EditorPropertyPath::_path_pressed() {
|
|||
}
|
||||
|
||||
if (folder) {
|
||||
dialog->set_mode(EditorFileDialog::MODE_OPEN_DIR);
|
||||
dialog->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_DIR);
|
||||
dialog->set_current_dir(full_path);
|
||||
} else {
|
||||
dialog->set_mode(save_mode ? EditorFileDialog::MODE_SAVE_FILE : EditorFileDialog::MODE_OPEN_FILE);
|
||||
dialog->set_file_mode(save_mode ? EditorFileDialog::FILE_MODE_SAVE_FILE : EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
for (int i = 0; i < extensions.size(); i++) {
|
||||
String e = extensions[i].strip_edges();
|
||||
if (e != String()) {
|
||||
|
@ -2074,7 +2074,7 @@ void EditorPropertyResource::_menu_option(int p_which) {
|
|||
file->connect("file_selected", callable_mp(this, &EditorPropertyResource::_file_selected));
|
||||
add_child(file);
|
||||
}
|
||||
file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
String type = base_type;
|
||||
|
||||
List<String> extensions;
|
||||
|
|
|
@ -70,11 +70,11 @@ void EditorSubScene::_path_browse() {
|
|||
}
|
||||
|
||||
void EditorSubScene::_notification(int p_what) {
|
||||
|
||||
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
|
||||
|
||||
if (is_visible() && scene == NULL)
|
||||
if (is_visible() && scene == NULL) {
|
||||
_path_browse();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -240,7 +240,7 @@ EditorSubScene::EditorSubScene() {
|
|||
path = memnew(LineEdit);
|
||||
path->connect("text_entered", callable_mp(this, &EditorSubScene::_path_changed));
|
||||
hb->add_child(path);
|
||||
path->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
path->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
Button *b = memnew(Button);
|
||||
b->set_text(TTR("Browse"));
|
||||
hb->add_child(b);
|
||||
|
@ -248,7 +248,7 @@ EditorSubScene::EditorSubScene() {
|
|||
vb->add_margin_child(TTR("Scene Path:"), hb);
|
||||
|
||||
tree = memnew(Tree);
|
||||
tree->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
tree->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
vb->add_margin_child(TTR("Import From Node:"), tree, true);
|
||||
tree->set_select_mode(Tree::SELECT_MULTI);
|
||||
tree->connect("multi_selected", callable_mp(this, &EditorSubScene::_item_multi_selected));
|
||||
|
@ -266,7 +266,7 @@ EditorSubScene::EditorSubScene() {
|
|||
file_dialog->add_filter("*." + E->get());
|
||||
}
|
||||
|
||||
file_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
add_child(file_dialog);
|
||||
file_dialog->connect("file_selected", callable_mp(this, &EditorSubScene::_path_selected));
|
||||
}
|
||||
|
|
|
@ -910,14 +910,16 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
|
|||
style_window->set_border_color(tab_color);
|
||||
style_window->set_border_width(MARGIN_TOP, 24 * EDSCALE);
|
||||
style_window->set_expand_margin_size(MARGIN_TOP, 24 * EDSCALE);
|
||||
theme->set_stylebox("panel", "WindowDialog", style_window);
|
||||
theme->set_color("title_color", "WindowDialog", font_color);
|
||||
theme->set_icon("close", "WindowDialog", theme->get_icon("GuiClose", "EditorIcons"));
|
||||
theme->set_icon("close_highlight", "WindowDialog", theme->get_icon("GuiClose", "EditorIcons"));
|
||||
theme->set_constant("close_h_ofs", "WindowDialog", 22 * EDSCALE);
|
||||
theme->set_constant("close_v_ofs", "WindowDialog", 20 * EDSCALE);
|
||||
theme->set_constant("title_height", "WindowDialog", 24 * EDSCALE);
|
||||
theme->set_font("title_font", "WindowDialog", theme->get_font("title", "EditorFonts"));
|
||||
|
||||
theme->set_stylebox("panel", "AcceptDialog", style_default);
|
||||
theme->set_stylebox("panel_window", "AcceptDialog", style_window);
|
||||
theme->set_color("title_color", "AcceptDialog", font_color);
|
||||
theme->set_icon("close", "AcceptDialog", theme->get_icon("GuiClose", "EditorIcons"));
|
||||
theme->set_icon("close_highlight", "AcceptDialog", theme->get_icon("GuiClose", "EditorIcons"));
|
||||
theme->set_constant("close_h_ofs", "AcceptDialog", 22 * EDSCALE);
|
||||
theme->set_constant("close_v_ofs", "AcceptDialog", 20 * EDSCALE);
|
||||
theme->set_constant("title_height", "AcceptDialog", 24 * EDSCALE);
|
||||
theme->set_font("title_font", "AcceptDialog", theme->get_font("title", "EditorFonts"));
|
||||
|
||||
// complex window, for now only Editor settings and Project settings
|
||||
Ref<StyleBoxFlat> style_complex_window = style_window->duplicate();
|
||||
|
@ -978,6 +980,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
|
|||
|
||||
// Panel
|
||||
theme->set_stylebox("panel", "Panel", make_flat_stylebox(dark_color_1, 6, 4, 6, 4));
|
||||
theme->set_stylebox("panel_fg", "Panel", style_default);
|
||||
|
||||
// Label
|
||||
theme->set_stylebox("normal", "Label", style_empty);
|
||||
|
|
|
@ -82,11 +82,11 @@ void ExportTemplateManager::_update_template_list() {
|
|||
String(VERSION_STATUS) != String("rc");
|
||||
|
||||
Label *current = memnew(Label);
|
||||
current->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
current->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
current_hb->add_child(current);
|
||||
|
||||
if (templates.has(current_version)) {
|
||||
current->add_color_override("font_color", get_color("success_color", "Editor"));
|
||||
current->add_color_override("font_color", current->get_color("success_color", "Editor"));
|
||||
|
||||
// Only display a redownload button if it can be downloaded in the first place
|
||||
if (downloads_available) {
|
||||
|
@ -103,7 +103,7 @@ void ExportTemplateManager::_update_template_list() {
|
|||
uninstall->connect("pressed", callable_mp(this, &ExportTemplateManager::_uninstall_template), varray(current_version));
|
||||
|
||||
} else {
|
||||
current->add_color_override("font_color", get_color("error_color", "Editor"));
|
||||
current->add_color_override("font_color", current->get_color("error_color", "Editor"));
|
||||
Button *redownload = memnew(Button);
|
||||
redownload->set_text(TTR("Download"));
|
||||
|
||||
|
@ -121,13 +121,13 @@ void ExportTemplateManager::_update_template_list() {
|
|||
|
||||
HBoxContainer *hbc = memnew(HBoxContainer);
|
||||
Label *version = memnew(Label);
|
||||
version->set_modulate(get_color("disabled_font_color", "Editor"));
|
||||
version->set_modulate(current->get_color("disabled_font_color", "Editor"));
|
||||
String text = E->get();
|
||||
if (text == current_version) {
|
||||
text += " " + TTR("(Current)");
|
||||
}
|
||||
version->set_text(text);
|
||||
version->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
version->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
hbc->add_child(version);
|
||||
|
||||
Button *uninstall = memnew(Button);
|
||||
|
@ -145,7 +145,7 @@ void ExportTemplateManager::_download_template(const String &p_version) {
|
|||
while (template_list->get_child_count()) {
|
||||
memdelete(template_list->get_child(0));
|
||||
}
|
||||
template_downloader->popup_centered_minsize();
|
||||
template_downloader->popup_centered();
|
||||
template_list_state->set_text(TTR("Retrieving mirrors, please wait..."));
|
||||
template_download_progress->set_max(100);
|
||||
template_download_progress->set_value(0);
|
||||
|
@ -157,7 +157,7 @@ void ExportTemplateManager::_download_template(const String &p_version) {
|
|||
void ExportTemplateManager::_uninstall_template(const String &p_version) {
|
||||
|
||||
remove_confirm->set_text(vformat(TTR("Remove template version '%s'?"), p_version));
|
||||
remove_confirm->popup_centered_minsize();
|
||||
remove_confirm->popup_centered();
|
||||
to_remove = p_version;
|
||||
}
|
||||
|
||||
|
@ -342,7 +342,7 @@ bool ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_
|
|||
void ExportTemplateManager::popup_manager() {
|
||||
|
||||
_update_template_list();
|
||||
popup_centered_minsize(Size2(400, 400) * EDSCALE);
|
||||
popup_centered(Size2(400, 400) * EDSCALE);
|
||||
}
|
||||
|
||||
void ExportTemplateManager::ok_pressed() {
|
||||
|
@ -483,6 +483,11 @@ void ExportTemplateManager::_window_template_downloader_closed() {
|
|||
|
||||
void ExportTemplateManager::_notification(int p_what) {
|
||||
|
||||
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
|
||||
if (!is_visible()) {
|
||||
set_process(false);
|
||||
}
|
||||
}
|
||||
if (p_what == NOTIFICATION_PROCESS) {
|
||||
|
||||
update_countdown -= get_process_delta_time();
|
||||
|
@ -536,12 +541,6 @@ void ExportTemplateManager::_notification(int p_what) {
|
|||
set_process(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
|
||||
if (!is_visible_in_tree()) {
|
||||
set_process(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool ExportTemplateManager::can_install_android_template() {
|
||||
|
@ -674,7 +673,7 @@ ExportTemplateManager::ExportTemplateManager() {
|
|||
installed_scroll->add_child(installed_vb);
|
||||
installed_scroll->set_enable_v_scroll(true);
|
||||
installed_scroll->set_enable_h_scroll(false);
|
||||
installed_vb->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
installed_vb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
get_cancel()->set_text(TTR("Close"));
|
||||
get_ok()->set_text(TTR("Install From File"));
|
||||
|
@ -688,7 +687,7 @@ ExportTemplateManager::ExportTemplateManager() {
|
|||
template_open->set_title(TTR("Select Template File"));
|
||||
template_open->add_filter("*.tpz ; " + TTR("Godot Export Templates"));
|
||||
template_open->set_access(FileDialog::ACCESS_FILESYSTEM);
|
||||
template_open->set_mode(FileDialog::MODE_OPEN_FILE);
|
||||
template_open->set_file_mode(FileDialog::FILE_MODE_OPEN_FILE);
|
||||
template_open->connect("file_selected", callable_mp(this, &ExportTemplateManager::_install_from_file), varray(true));
|
||||
add_child(template_open);
|
||||
|
||||
|
@ -708,7 +707,7 @@ ExportTemplateManager::ExportTemplateManager() {
|
|||
template_downloader->get_ok()->set_text(TTR("Close"));
|
||||
template_downloader->set_exclusive(true);
|
||||
add_child(template_downloader);
|
||||
template_downloader->connect("popup_hide", callable_mp(this, &ExportTemplateManager::_window_template_downloader_closed));
|
||||
template_downloader->connect("cancelled", callable_mp(this, &ExportTemplateManager::_window_template_downloader_closed));
|
||||
|
||||
VBoxContainer *vbc = memnew(VBoxContainer);
|
||||
template_downloader->add_child(vbc);
|
||||
|
|
|
@ -1413,7 +1413,7 @@ void FileSystemDock::_move_operation_confirm(const String &p_to_path, bool p_ove
|
|||
bool can_move = _check_existing();
|
||||
if (!can_move) {
|
||||
// Ask to do something.
|
||||
overwrite_dialog->popup_centered_minsize();
|
||||
overwrite_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1677,7 +1677,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
|
|||
rename_dialog_text->set_text(name);
|
||||
rename_dialog_text->select(0, name.length());
|
||||
}
|
||||
rename_dialog->popup_centered_minsize(Size2(250, 80) * EDSCALE);
|
||||
rename_dialog->popup_centered(Size2(250, 80) * EDSCALE);
|
||||
rename_dialog_text->grab_focus();
|
||||
}
|
||||
}
|
||||
|
@ -1721,7 +1721,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
|
|||
duplicate_dialog_text->set_text(name);
|
||||
duplicate_dialog_text->select(0, name.length());
|
||||
}
|
||||
duplicate_dialog->popup_centered_minsize(Size2(250, 80) * EDSCALE);
|
||||
duplicate_dialog->popup_centered(Size2(250, 80) * EDSCALE);
|
||||
duplicate_dialog_text->grab_focus();
|
||||
}
|
||||
} break;
|
||||
|
@ -1743,14 +1743,14 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
|
|||
case FILE_NEW_FOLDER: {
|
||||
make_dir_dialog_text->set_text("new folder");
|
||||
make_dir_dialog_text->select_all();
|
||||
make_dir_dialog->popup_centered_minsize(Size2(250, 80) * EDSCALE);
|
||||
make_dir_dialog->popup_centered(Size2(250, 80) * EDSCALE);
|
||||
make_dir_dialog_text->grab_focus();
|
||||
} break;
|
||||
|
||||
case FILE_NEW_SCENE: {
|
||||
make_scene_dialog_text->set_text("new scene");
|
||||
make_scene_dialog_text->select_all();
|
||||
make_scene_dialog->popup_centered_minsize(Size2(250, 80) * EDSCALE);
|
||||
make_scene_dialog->popup_centered(Size2(250, 80) * EDSCALE);
|
||||
make_scene_dialog_text->grab_focus();
|
||||
} break;
|
||||
|
||||
|
|
|
@ -299,14 +299,14 @@ const char *FindInFilesDialog::SIGNAL_REPLACE_REQUESTED = "replace_requested";
|
|||
|
||||
FindInFilesDialog::FindInFilesDialog() {
|
||||
|
||||
set_custom_minimum_size(Size2(500 * EDSCALE, 0));
|
||||
set_min_size(Size2(500 * EDSCALE, 0));
|
||||
set_title(TTR("Find in Files"));
|
||||
|
||||
VBoxContainer *vbc = memnew(VBoxContainer);
|
||||
vbc->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 8 * EDSCALE);
|
||||
vbc->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 8 * EDSCALE);
|
||||
vbc->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -8 * EDSCALE);
|
||||
vbc->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, -8 * EDSCALE);
|
||||
vbc->set_anchor_and_margin(MARGIN_LEFT, Control::ANCHOR_BEGIN, 8 * EDSCALE);
|
||||
vbc->set_anchor_and_margin(MARGIN_TOP, Control::ANCHOR_BEGIN, 8 * EDSCALE);
|
||||
vbc->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, -8 * EDSCALE);
|
||||
vbc->set_anchor_and_margin(MARGIN_BOTTOM, Control::ANCHOR_END, -8 * EDSCALE);
|
||||
add_child(vbc);
|
||||
|
||||
GridContainer *gc = memnew(GridContainer);
|
||||
|
@ -318,7 +318,7 @@ FindInFilesDialog::FindInFilesDialog() {
|
|||
gc->add_child(find_label);
|
||||
|
||||
_search_text_line_edit = memnew(LineEdit);
|
||||
_search_text_line_edit->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
_search_text_line_edit->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
_search_text_line_edit->connect("text_changed", callable_mp(this, &FindInFilesDialog::_on_search_text_modified));
|
||||
_search_text_line_edit->connect("text_entered", callable_mp(this, &FindInFilesDialog::_on_search_text_entered));
|
||||
gc->add_child(_search_text_line_edit);
|
||||
|
@ -329,7 +329,7 @@ FindInFilesDialog::FindInFilesDialog() {
|
|||
gc->add_child(_replace_label);
|
||||
|
||||
_replace_text_line_edit = memnew(LineEdit);
|
||||
_replace_text_line_edit->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
_replace_text_line_edit->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
_replace_text_line_edit->connect("text_entered", callable_mp(this, &FindInFilesDialog::_on_replace_text_entered));
|
||||
_replace_text_line_edit->hide();
|
||||
gc->add_child(_replace_text_line_edit);
|
||||
|
@ -362,7 +362,7 @@ FindInFilesDialog::FindInFilesDialog() {
|
|||
hbc->add_child(prefix_label);
|
||||
|
||||
_folder_line_edit = memnew(LineEdit);
|
||||
_folder_line_edit->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
_folder_line_edit->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
hbc->add_child(_folder_line_edit);
|
||||
|
||||
Button *folder_button = memnew(Button);
|
||||
|
@ -371,7 +371,7 @@ FindInFilesDialog::FindInFilesDialog() {
|
|||
hbc->add_child(folder_button);
|
||||
|
||||
_folder_dialog = memnew(FileDialog);
|
||||
_folder_dialog->set_mode(FileDialog::MODE_OPEN_DIR);
|
||||
_folder_dialog->set_file_mode(FileDialog::FILE_MODE_OPEN_DIR);
|
||||
_folder_dialog->connect("dir_selected", callable_mp(this, &FindInFilesDialog::_on_folder_selected));
|
||||
add_child(_folder_dialog);
|
||||
|
||||
|
@ -464,6 +464,7 @@ Set<String> FindInFilesDialog::get_filter() const {
|
|||
|
||||
void FindInFilesDialog::_notification(int p_what) {
|
||||
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
|
||||
|
||||
if (is_visible()) {
|
||||
// Doesn't work more than once if not deferred...
|
||||
_search_text_line_edit->call_deferred("grab_focus");
|
||||
|
|
|
@ -120,10 +120,11 @@ public:
|
|||
Set<String> get_filter() const;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
void _notification(int p_what);
|
||||
|
||||
void _visibility_changed();
|
||||
void custom_action(const String &p_action);
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
void _on_folder_button_pressed();
|
||||
|
|
|
@ -94,7 +94,7 @@ void GroupDialog::_load_nodes(Node *p_current) {
|
|||
|
||||
if (!_can_edit(p_current, selected_group)) {
|
||||
node->set_selectable(0, false);
|
||||
node->set_custom_color(0, get_color("disabled_font_color", "Editor"));
|
||||
node->set_custom_color(0, groups->get_color("disabled_font_color", "Editor"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -204,7 +204,7 @@ void GroupDialog::_add_group(String p_name) {
|
|||
|
||||
TreeItem *new_group = groups->create_item(groups_root);
|
||||
new_group->set_text(0, name);
|
||||
new_group->add_button(0, get_icon("Remove", "EditorIcons"), 0);
|
||||
new_group->add_button(0, groups->get_icon("Remove", "EditorIcons"), 0);
|
||||
new_group->set_editable(0, true);
|
||||
new_group->select(0);
|
||||
groups->ensure_cursor_is_visible();
|
||||
|
@ -361,12 +361,12 @@ void GroupDialog::_delete_group_item(const String &p_name) {
|
|||
void GroupDialog::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_ENTER_TREE: {
|
||||
add_button->set_icon(get_icon("Forward", "EditorIcons"));
|
||||
remove_button->set_icon(get_icon("Back", "EditorIcons"));
|
||||
add_button->set_icon(groups->get_icon("Forward", "EditorIcons"));
|
||||
remove_button->set_icon(groups->get_icon("Back", "EditorIcons"));
|
||||
|
||||
add_filter->set_right_icon(get_icon("Search", "EditorIcons"));
|
||||
add_filter->set_right_icon(groups->get_icon("Search", "EditorIcons"));
|
||||
add_filter->set_clear_button_enabled(true);
|
||||
remove_filter->set_right_icon(get_icon("Search", "EditorIcons"));
|
||||
remove_filter->set_right_icon(groups->get_icon("Search", "EditorIcons"));
|
||||
remove_filter->set_clear_button_enabled(true);
|
||||
} break;
|
||||
}
|
||||
|
@ -399,21 +399,21 @@ void GroupDialog::_bind_methods() {
|
|||
}
|
||||
|
||||
GroupDialog::GroupDialog() {
|
||||
set_custom_minimum_size(Size2(600, 400) * EDSCALE);
|
||||
set_min_size(Size2(600, 400) * EDSCALE);
|
||||
|
||||
scene_tree = SceneTree::get_singleton();
|
||||
|
||||
VBoxContainer *vbc = memnew(VBoxContainer);
|
||||
add_child(vbc);
|
||||
vbc->set_anchors_and_margins_preset(PRESET_WIDE, PRESET_MODE_KEEP_SIZE, 8 * EDSCALE);
|
||||
vbc->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_KEEP_SIZE, 8 * EDSCALE);
|
||||
|
||||
HBoxContainer *hbc = memnew(HBoxContainer);
|
||||
vbc->add_child(hbc);
|
||||
hbc->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
hbc->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
VBoxContainer *vbc_left = memnew(VBoxContainer);
|
||||
hbc->add_child(vbc_left);
|
||||
vbc_left->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
vbc_left->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
Label *group_title = memnew(Label);
|
||||
group_title->set_text(TTR("Groups"));
|
||||
|
@ -425,7 +425,7 @@ GroupDialog::GroupDialog() {
|
|||
groups->set_select_mode(Tree::SELECT_SINGLE);
|
||||
groups->set_allow_reselect(true);
|
||||
groups->set_allow_rmb_select(true);
|
||||
groups->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
groups->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
groups->add_constant_override("draw_guides", 1);
|
||||
groups->connect("item_selected", callable_mp(this, &GroupDialog::_group_selected));
|
||||
groups->connect("button_pressed", callable_mp(this, &GroupDialog::_delete_group_pressed));
|
||||
|
@ -433,11 +433,11 @@ GroupDialog::GroupDialog() {
|
|||
|
||||
HBoxContainer *chbc = memnew(HBoxContainer);
|
||||
vbc_left->add_child(chbc);
|
||||
chbc->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
chbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
add_group_text = memnew(LineEdit);
|
||||
chbc->add_child(add_group_text);
|
||||
add_group_text->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
add_group_text->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
add_group_text->connect("text_entered", callable_mp(this, &GroupDialog::_add_group_pressed));
|
||||
|
||||
Button *add_group_button = memnew(Button);
|
||||
|
@ -447,7 +447,7 @@ GroupDialog::GroupDialog() {
|
|||
|
||||
VBoxContainer *vbc_add = memnew(VBoxContainer);
|
||||
hbc->add_child(vbc_add);
|
||||
vbc_add->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
vbc_add->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
Label *out_of_group_title = memnew(Label);
|
||||
out_of_group_title->set_text(TTR("Nodes Not in Group"));
|
||||
|
@ -458,7 +458,7 @@ GroupDialog::GroupDialog() {
|
|||
nodes_to_add->set_hide_root(true);
|
||||
nodes_to_add->set_hide_folding(true);
|
||||
nodes_to_add->set_select_mode(Tree::SELECT_MULTI);
|
||||
nodes_to_add->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
nodes_to_add->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
nodes_to_add->add_constant_override("draw_guides", 1);
|
||||
|
||||
HBoxContainer *add_filter_hbc = memnew(HBoxContainer);
|
||||
|
@ -466,15 +466,15 @@ GroupDialog::GroupDialog() {
|
|||
vbc_add->add_child(add_filter_hbc);
|
||||
|
||||
add_filter = memnew(LineEdit);
|
||||
add_filter->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
add_filter->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
add_filter->set_placeholder(TTR("Filter nodes"));
|
||||
add_filter_hbc->add_child(add_filter);
|
||||
add_filter->connect("text_changed", callable_mp(this, &GroupDialog::_add_filter_changed));
|
||||
|
||||
VBoxContainer *vbc_buttons = memnew(VBoxContainer);
|
||||
hbc->add_child(vbc_buttons);
|
||||
vbc_buttons->set_h_size_flags(SIZE_SHRINK_CENTER);
|
||||
vbc_buttons->set_v_size_flags(SIZE_SHRINK_CENTER);
|
||||
vbc_buttons->set_h_size_flags(Control::SIZE_SHRINK_CENTER);
|
||||
vbc_buttons->set_v_size_flags(Control::SIZE_SHRINK_CENTER);
|
||||
|
||||
add_button = memnew(ToolButton);
|
||||
add_button->set_text(TTR("Add"));
|
||||
|
@ -493,7 +493,7 @@ GroupDialog::GroupDialog() {
|
|||
|
||||
VBoxContainer *vbc_remove = memnew(VBoxContainer);
|
||||
hbc->add_child(vbc_remove);
|
||||
vbc_remove->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
vbc_remove->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
Label *in_group_title = memnew(Label);
|
||||
in_group_title->set_text(TTR("Nodes in Group"));
|
||||
|
@ -501,7 +501,7 @@ GroupDialog::GroupDialog() {
|
|||
|
||||
nodes_to_remove = memnew(Tree);
|
||||
vbc_remove->add_child(nodes_to_remove);
|
||||
nodes_to_remove->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
nodes_to_remove->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
nodes_to_remove->set_hide_root(true);
|
||||
nodes_to_remove->set_hide_folding(true);
|
||||
nodes_to_remove->set_select_mode(Tree::SELECT_MULTI);
|
||||
|
@ -512,7 +512,7 @@ GroupDialog::GroupDialog() {
|
|||
vbc_remove->add_child(remove_filter_hbc);
|
||||
|
||||
remove_filter = memnew(LineEdit);
|
||||
remove_filter->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
remove_filter->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
remove_filter->set_placeholder(TTR("Filter nodes"));
|
||||
remove_filter_hbc->add_child(remove_filter);
|
||||
remove_filter->connect("text_changed", callable_mp(this, &GroupDialog::_remove_filter_changed));
|
||||
|
@ -524,11 +524,9 @@ GroupDialog::GroupDialog() {
|
|||
group_empty->set_autowrap(true);
|
||||
group_empty->set_custom_minimum_size(Size2(100 * EDSCALE, 0));
|
||||
nodes_to_remove->add_child(group_empty);
|
||||
group_empty->set_anchors_and_margins_preset(PRESET_WIDE, PRESET_MODE_KEEP_SIZE, 8 * EDSCALE);
|
||||
group_empty->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_KEEP_SIZE, 8 * EDSCALE);
|
||||
|
||||
set_title(TTR("Group Editor"));
|
||||
set_as_toplevel(true);
|
||||
set_resizable(true);
|
||||
|
||||
error = memnew(ConfirmationDialog);
|
||||
add_child(error);
|
||||
|
@ -669,7 +667,7 @@ GroupsEditor::GroupsEditor() {
|
|||
VBoxContainer *vbc = this;
|
||||
|
||||
group_dialog = memnew(GroupDialog);
|
||||
group_dialog->set_as_toplevel(true);
|
||||
|
||||
add_child(group_dialog);
|
||||
group_dialog->connect("group_edited", callable_mp(this, &GroupsEditor::update_tree));
|
||||
|
||||
|
@ -682,7 +680,7 @@ GroupsEditor::GroupsEditor() {
|
|||
vbc->add_child(hbc);
|
||||
|
||||
group_name = memnew(LineEdit);
|
||||
group_name->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
group_name->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
hbc->add_child(group_name);
|
||||
group_name->connect("text_entered", callable_mp(this, &GroupsEditor::_add_group));
|
||||
|
||||
|
@ -693,7 +691,7 @@ GroupsEditor::GroupsEditor() {
|
|||
|
||||
tree = memnew(Tree);
|
||||
tree->set_hide_root(true);
|
||||
tree->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
tree->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
vbc->add_child(tree);
|
||||
tree->connect("button_pressed", callable_mp(this, &GroupsEditor::_remove_group));
|
||||
tree->add_constant_override("draw_guides", 1);
|
||||
|
|
|
@ -41,9 +41,9 @@
|
|||
#include "scene/gui/tool_button.h"
|
||||
#include "scene/gui/tree.h"
|
||||
|
||||
class GroupDialog : public WindowDialog {
|
||||
class GroupDialog : public AcceptDialog {
|
||||
|
||||
GDCLASS(GroupDialog, WindowDialog);
|
||||
GDCLASS(GroupDialog, AcceptDialog);
|
||||
|
||||
ConfirmationDialog *error;
|
||||
|
||||
|
|
|
@ -424,7 +424,7 @@ void ImportDock::_reimport_attempt() {
|
|||
|
||||
if (need_restart) {
|
||||
label_warning->set_visible(used_in_resources);
|
||||
reimport_confirm->popup_centered_minsize();
|
||||
reimport_confirm->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ void InspectorDock::_new_resource() {
|
|||
}
|
||||
|
||||
void InspectorDock::_load_resource(const String &p_type) {
|
||||
load_resource_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
load_resource_dialog->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
|
||||
List<String> extensions;
|
||||
ResourceLoader::get_recognized_extensions_for_type(p_type, &extensions);
|
||||
|
@ -317,7 +317,7 @@ void InspectorDock::_transform_keyed(Object *sp, const String &p_sub, const Tran
|
|||
}
|
||||
|
||||
void InspectorDock::_warning_pressed() {
|
||||
warning_dialog->popup_centered_minsize();
|
||||
warning_dialog->popup_centered();
|
||||
}
|
||||
|
||||
Container *InspectorDock::get_addon_area() {
|
||||
|
|
|
@ -131,14 +131,15 @@ void PluginConfigDialog::_on_required_text_changed(const String &) {
|
|||
|
||||
void PluginConfigDialog::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||
if (is_visible()) {
|
||||
name_edit->grab_focus();
|
||||
}
|
||||
} break;
|
||||
case NOTIFICATION_READY: {
|
||||
connect("confirmed", callable_mp(this, &PluginConfigDialog::_on_confirmed));
|
||||
get_cancel()->connect("pressed", callable_mp(this, &PluginConfigDialog::_on_cancelled));
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_POST_POPUP: {
|
||||
name_edit->grab_focus();
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -310,7 +310,7 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
|
|||
|
||||
if (mb.is_valid() && mb->get_button_index() == 1 && mb->is_pressed()) {
|
||||
create_resource->set_text(String("No polygon resource on this node.\nCreate and assign one?"));
|
||||
create_resource->popup_centered_minsize();
|
||||
create_resource->popup_centered();
|
||||
}
|
||||
return (mb.is_valid() && mb->get_button_index() == 1);
|
||||
}
|
||||
|
|
|
@ -735,7 +735,7 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() {
|
|||
open_file = memnew(EditorFileDialog);
|
||||
add_child(open_file);
|
||||
open_file->set_title(TTR("Open Animation Node"));
|
||||
open_file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
open_file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
open_file->connect("file_selected", callable_mp(this, &AnimationNodeBlendSpace1DEditor::_file_opened));
|
||||
undo_redo = EditorNode::get_undo_redo();
|
||||
|
||||
|
|
|
@ -1042,7 +1042,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() {
|
|||
open_file = memnew(EditorFileDialog);
|
||||
add_child(open_file);
|
||||
open_file->set_title(TTR("Open Animation Node"));
|
||||
open_file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
open_file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
open_file->connect("file_selected", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_file_opened));
|
||||
undo_redo = EditorNode::get_undo_redo();
|
||||
|
||||
|
|
|
@ -705,7 +705,7 @@ void AnimationNodeBlendTreeEditor::_edit_filters(const String &p_which) {
|
|||
if (!_update_filters(anode))
|
||||
return;
|
||||
|
||||
filter_dialog->popup_centered_minsize(Size2(500, 500) * EDSCALE);
|
||||
filter_dialog->popup_centered(Size2(500, 500) * EDSCALE);
|
||||
}
|
||||
|
||||
void AnimationNodeBlendTreeEditor::_removed_from_graph() {
|
||||
|
@ -975,7 +975,7 @@ AnimationNodeBlendTreeEditor::AnimationNodeBlendTreeEditor() {
|
|||
open_file = memnew(EditorFileDialog);
|
||||
add_child(open_file);
|
||||
open_file->set_title(TTR("Open Animation Node"));
|
||||
open_file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
open_file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
open_file->connect("file_selected", callable_mp(this, &AnimationNodeBlendTreeEditor::_file_opened));
|
||||
undo_redo = EditorNode::get_undo_redo();
|
||||
}
|
||||
|
|
|
@ -349,7 +349,7 @@ void AnimationPlayerEditor::_animation_rename() {
|
|||
}
|
||||
void AnimationPlayerEditor::_animation_load() {
|
||||
ERR_FAIL_COND(!player);
|
||||
file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
file->clear_filters();
|
||||
List<String> extensions;
|
||||
|
||||
|
@ -392,7 +392,7 @@ void AnimationPlayerEditor::_animation_save(const Ref<Resource> &p_resource) {
|
|||
|
||||
void AnimationPlayerEditor::_animation_save_as(const Ref<Resource> &p_resource) {
|
||||
|
||||
file->set_mode(EditorFileDialog::MODE_SAVE_FILE);
|
||||
file->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
|
||||
|
||||
List<String> extensions;
|
||||
ResourceSaver::get_recognized_extensions(p_resource, &extensions);
|
||||
|
@ -434,7 +434,7 @@ void AnimationPlayerEditor::_animation_remove() {
|
|||
return;
|
||||
|
||||
delete_dialog->set_text(TTR("Delete Animation?"));
|
||||
delete_dialog->popup_centered_minsize();
|
||||
delete_dialog->popup_centered();
|
||||
}
|
||||
|
||||
void AnimationPlayerEditor::_animation_remove_confirmed() {
|
||||
|
@ -501,7 +501,7 @@ void AnimationPlayerEditor::_animation_name_edited() {
|
|||
String new_name = name->get_text();
|
||||
if (new_name == "" || new_name.find(":") != -1 || new_name.find("/") != -1) {
|
||||
error_dialog->set_text(TTR("Invalid animation name!"));
|
||||
error_dialog->popup_centered_minsize();
|
||||
error_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -512,7 +512,7 @@ void AnimationPlayerEditor::_animation_name_edited() {
|
|||
|
||||
if (player->has_animation(new_name)) {
|
||||
error_dialog->set_text(TTR("Animation name already exists!"));
|
||||
error_dialog->popup_centered_minsize();
|
||||
error_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1058,7 +1058,7 @@ void AnimationPlayerEditor::_animation_player_changed(Object *p_pl) {
|
|||
if (player == p_pl && is_visible_in_tree()) {
|
||||
|
||||
_update_player();
|
||||
if (blend_editor.dialog->is_visible_in_tree())
|
||||
if (blend_editor.dialog->is_visible())
|
||||
_animation_blend(); // Update.
|
||||
}
|
||||
}
|
||||
|
@ -1152,7 +1152,7 @@ void AnimationPlayerEditor::_animation_tool_menu(int p_option) {
|
|||
|
||||
if (!animation->get_item_count()) {
|
||||
error_dialog->set_text(TTR("No animation to copy!"));
|
||||
error_dialog->popup_centered_minsize();
|
||||
error_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1165,7 +1165,7 @@ void AnimationPlayerEditor::_animation_tool_menu(int p_option) {
|
|||
Ref<Animation> anim2 = EditorSettings::get_singleton()->get_resource_clipboard();
|
||||
if (!anim2.is_valid()) {
|
||||
error_dialog->set_text(TTR("No animation resource on clipboard!"));
|
||||
error_dialog->popup_centered_minsize();
|
||||
error_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1195,7 +1195,7 @@ void AnimationPlayerEditor::_animation_tool_menu(int p_option) {
|
|||
|
||||
if (!animation->get_item_count()) {
|
||||
error_dialog->set_text(TTR("No animation to edit!"));
|
||||
error_dialog->popup_centered_minsize();
|
||||
error_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1367,7 +1367,7 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() {
|
|||
open_file = memnew(EditorFileDialog);
|
||||
add_child(open_file);
|
||||
open_file->set_title(TTR("Open Animation Node"));
|
||||
open_file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
open_file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
open_file->connect("file_selected", callable_mp(this, &AnimationNodeStateMachineEditor::_file_opened));
|
||||
undo_redo = EditorNode::get_undo_redo();
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ EditorAssetLibraryItem::EditorAssetLibraryItem() {
|
|||
VBoxContainer *vb = memnew(VBoxContainer);
|
||||
|
||||
hb->add_child(vb);
|
||||
vb->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
vb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
title = memnew(LinkButton);
|
||||
title->set_underline_mode(LinkButton::UNDERLINE_MODE_ON_HOVER);
|
||||
|
@ -137,7 +137,7 @@ EditorAssetLibraryItem::EditorAssetLibraryItem() {
|
|||
vb->add_child(price);
|
||||
|
||||
set_custom_minimum_size(Size2(250, 100) * EDSCALE);
|
||||
set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -156,7 +156,7 @@ void EditorAssetLibraryItemDescription::set_image(int p_type, int p_index, const
|
|||
for (int i = 0; i < preview_images.size(); i++) {
|
||||
if (preview_images[i].id == p_index) {
|
||||
if (preview_images[i].is_video) {
|
||||
Ref<Image> overlay = get_icon("PlayOverlay", "EditorIcons")->get_data();
|
||||
Ref<Image> overlay = previews->get_icon("PlayOverlay", "EditorIcons")->get_data();
|
||||
Ref<Image> thumbnail = p_image->get_data();
|
||||
thumbnail = thumbnail->duplicate();
|
||||
Point2 overlay_pos = Point2((thumbnail->get_width() - overlay->get_width()) / 2, (thumbnail->get_height() - overlay->get_height()) / 2);
|
||||
|
@ -172,7 +172,7 @@ void EditorAssetLibraryItemDescription::set_image(int p_type, int p_index, const
|
|||
|
||||
preview_images[i].button->set_icon(tex);
|
||||
// Make it clearer that clicking it will open an external link
|
||||
preview_images[i].button->set_default_cursor_shape(CURSOR_POINTING_HAND);
|
||||
preview_images[i].button->set_default_cursor_shape(Control::CURSOR_POINTING_HAND);
|
||||
} else {
|
||||
preview_images[i].button->set_icon(p_image);
|
||||
}
|
||||
|
@ -198,7 +198,7 @@ void EditorAssetLibraryItemDescription::set_image(int p_type, int p_index, const
|
|||
void EditorAssetLibraryItemDescription::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_ENTER_TREE: {
|
||||
previews_bg->add_style_override("panel", get_stylebox("normal", "TextEdit"));
|
||||
previews_bg->add_style_override("panel", previews->get_stylebox("normal", "TextEdit"));
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ void EditorAssetLibraryItemDescription::_preview_click(int p_id) {
|
|||
if (!preview_images[i].is_video) {
|
||||
if (preview_images[i].image.is_valid()) {
|
||||
preview->set_texture(preview_images[i].image);
|
||||
minimum_size_changed();
|
||||
child_controls_changed();
|
||||
}
|
||||
} else {
|
||||
_link_click(preview_images[i].video_link);
|
||||
|
@ -256,12 +256,12 @@ void EditorAssetLibraryItemDescription::add_preview(int p_id, bool p_video, cons
|
|||
preview.is_video = p_video;
|
||||
preview.button = memnew(Button);
|
||||
preview.button->set_flat(true);
|
||||
preview.button->set_icon(get_icon("ThumbnailWait", "EditorIcons"));
|
||||
preview.button->set_icon(previews->get_icon("ThumbnailWait", "EditorIcons"));
|
||||
preview.button->set_toggle_mode(true);
|
||||
preview.button->connect("pressed", callable_mp(this, &EditorAssetLibraryItemDescription::_preview_click), varray(p_id));
|
||||
preview_hb->add_child(preview.button);
|
||||
if (!p_video) {
|
||||
preview.image = get_icon("ThumbnailWait", "EditorIcons");
|
||||
preview.image = previews->get_icon("ThumbnailWait", "EditorIcons");
|
||||
}
|
||||
preview_images.push_back(preview);
|
||||
if (preview_images.size() == 1 && !p_video) {
|
||||
|
@ -284,14 +284,14 @@ EditorAssetLibraryItemDescription::EditorAssetLibraryItemDescription() {
|
|||
|
||||
description = memnew(RichTextLabel);
|
||||
desc_vbox->add_child(description);
|
||||
description->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
description->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
description->connect("meta_clicked", callable_mp(this, &EditorAssetLibraryItemDescription::_link_click));
|
||||
description->add_constant_override("line_separation", Math::round(5 * EDSCALE));
|
||||
|
||||
VBoxContainer *previews_vbox = memnew(VBoxContainer);
|
||||
hbox->add_child(previews_vbox);
|
||||
previews_vbox->add_constant_override("separation", 15 * EDSCALE);
|
||||
previews_vbox->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
previews_vbox->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
preview = memnew(TextureRect);
|
||||
previews_vbox->add_child(preview);
|
||||
|
@ -308,7 +308,7 @@ EditorAssetLibraryItemDescription::EditorAssetLibraryItemDescription() {
|
|||
previews->set_enable_v_scroll(false);
|
||||
previews->set_enable_h_scroll(true);
|
||||
preview_hb = memnew(HBoxContainer);
|
||||
preview_hb->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
preview_hb->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
previews->add_child(preview_hb);
|
||||
get_ok()->set_text(TTR("Download"));
|
||||
|
@ -375,7 +375,7 @@ void EditorAssetLibraryItemDownload::_http_download_completed(int p_status, int
|
|||
|
||||
if (error_text != String()) {
|
||||
download_error->set_text(TTR("Asset Download Error:") + "\n" + error_text);
|
||||
download_error->popup_centered_minsize();
|
||||
download_error->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -507,13 +507,13 @@ EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() {
|
|||
|
||||
VBoxContainer *vb = memnew(VBoxContainer);
|
||||
hb->add_child(vb);
|
||||
vb->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
vb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
HBoxContainer *title_hb = memnew(HBoxContainer);
|
||||
vb->add_child(title_hb);
|
||||
title = memnew(Label);
|
||||
title_hb->add_child(title);
|
||||
title->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
title->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
dismiss = memnew(TextureButton);
|
||||
dismiss->connect("pressed", callable_mp(this, &EditorAssetLibraryItemDownload::_close));
|
||||
|
@ -1260,7 +1260,7 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const
|
|||
|
||||
description = memnew(EditorAssetLibraryItemDescription);
|
||||
add_child(description);
|
||||
description->popup_centered_minsize();
|
||||
description->popup_centered();
|
||||
description->connect("confirmed", callable_mp(this, &EditorAssetLibrary::_install_asset));
|
||||
|
||||
description->configure(r["title"], r["asset_id"], category_map[r["category_id"]], r["category_id"], r["author"], r["author_id"], r["cost"], r["version"], r["version_string"], r["description"], r["download_url"], r["browse_url"], r["download_hash"]);
|
||||
|
@ -1357,7 +1357,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
|
|||
|
||||
filter = memnew(LineEdit);
|
||||
search_hb->add_child(filter);
|
||||
filter->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
filter->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
filter->connect("text_entered", callable_mp(this, &EditorAssetLibrary::_search_text_entered));
|
||||
search = memnew(Button(TTR("Search")));
|
||||
search->connect("pressed", callable_mp(this, &EditorAssetLibrary::_search), make_binds(0));
|
||||
|
@ -1392,7 +1392,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
|
|||
|
||||
search_hb2->add_child(sort);
|
||||
|
||||
sort->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
sort->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
sort->connect("item_selected", callable_mp(this, &EditorAssetLibrary::_rerun_search));
|
||||
|
||||
search_hb2->add_child(memnew(VSeparator));
|
||||
|
@ -1401,7 +1401,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
|
|||
categories = memnew(OptionButton);
|
||||
categories->add_item(TTR("All"));
|
||||
search_hb2->add_child(categories);
|
||||
categories->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
categories->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
categories->connect("item_selected", callable_mp(this, &EditorAssetLibrary::_rerun_search));
|
||||
|
||||
search_hb2->add_child(memnew(VSeparator));
|
||||
|
@ -1417,7 +1417,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
|
|||
repository->connect("item_selected", callable_mp(this, &EditorAssetLibrary::_repository_changed));
|
||||
|
||||
search_hb2->add_child(repository);
|
||||
repository->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
repository->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
search_hb2->add_child(memnew(VSeparator));
|
||||
|
||||
|
@ -1435,7 +1435,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
|
|||
|
||||
library_scroll_bg = memnew(PanelContainer);
|
||||
library_main->add_child(library_scroll_bg);
|
||||
library_scroll_bg->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
library_scroll_bg->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
library_scroll = memnew(ScrollContainer);
|
||||
library_scroll->set_enable_v_scroll(true);
|
||||
|
@ -1453,10 +1453,10 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
|
|||
PanelContainer *library_vb_border = memnew(PanelContainer);
|
||||
library_scroll->add_child(library_vb_border);
|
||||
library_vb_border->add_style_override("panel", border2);
|
||||
library_vb_border->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
library_vb_border->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
library_vb = memnew(VBoxContainer);
|
||||
library_vb->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
library_vb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
library_vb_border->add_child(library_vb);
|
||||
|
||||
|
@ -1516,7 +1516,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
|
|||
|
||||
asset_open->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
|
||||
asset_open->add_filter("*.zip ; " + TTR("Assets ZIP File"));
|
||||
asset_open->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
asset_open->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
add_child(asset_open);
|
||||
asset_open->connect("file_selected", callable_mp(this, &EditorAssetLibrary::_asset_file_selected));
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ public:
|
|||
label = memnew(Label);
|
||||
label->set_text(TTR("Grid Offset:"));
|
||||
child_container->add_child(label);
|
||||
label->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
label->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
grid_offset_x = memnew(SpinBox);
|
||||
grid_offset_x->set_min(-SPIN_BOX_GRID_RANGE);
|
||||
|
@ -107,7 +107,7 @@ public:
|
|||
grid_offset_x->set_allow_lesser(true);
|
||||
grid_offset_x->set_allow_greater(true);
|
||||
grid_offset_x->set_suffix("px");
|
||||
grid_offset_x->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
grid_offset_x->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
child_container->add_child(grid_offset_x);
|
||||
|
||||
grid_offset_y = memnew(SpinBox);
|
||||
|
@ -116,20 +116,20 @@ public:
|
|||
grid_offset_y->set_allow_lesser(true);
|
||||
grid_offset_y->set_allow_greater(true);
|
||||
grid_offset_y->set_suffix("px");
|
||||
grid_offset_y->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
grid_offset_y->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
child_container->add_child(grid_offset_y);
|
||||
|
||||
label = memnew(Label);
|
||||
label->set_text(TTR("Grid Step:"));
|
||||
child_container->add_child(label);
|
||||
label->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
label->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
grid_step_x = memnew(SpinBox);
|
||||
grid_step_x->set_min(0.01);
|
||||
grid_step_x->set_max(SPIN_BOX_GRID_RANGE);
|
||||
grid_step_x->set_allow_greater(true);
|
||||
grid_step_x->set_suffix("px");
|
||||
grid_step_x->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
grid_step_x->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
child_container->add_child(grid_step_x);
|
||||
|
||||
grid_step_y = memnew(SpinBox);
|
||||
|
@ -137,7 +137,7 @@ public:
|
|||
grid_step_y->set_max(SPIN_BOX_GRID_RANGE);
|
||||
grid_step_y->set_allow_greater(true);
|
||||
grid_step_y->set_suffix("px");
|
||||
grid_step_y->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
grid_step_y->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
child_container->add_child(grid_step_y);
|
||||
|
||||
child_container = memnew(GridContainer);
|
||||
|
@ -146,7 +146,7 @@ public:
|
|||
|
||||
label = memnew(Label);
|
||||
label->set_text(TTR("Primary Line Every:"));
|
||||
label->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
label->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
child_container->add_child(label);
|
||||
|
||||
primary_grid_steps = memnew(SpinBox);
|
||||
|
@ -155,7 +155,7 @@ public:
|
|||
primary_grid_steps->set_max(100);
|
||||
primary_grid_steps->set_allow_greater(true);
|
||||
primary_grid_steps->set_suffix(TTR("steps"));
|
||||
primary_grid_steps->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
primary_grid_steps->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
child_container->add_child(primary_grid_steps);
|
||||
|
||||
container->add_child(memnew(HSeparator));
|
||||
|
@ -169,25 +169,25 @@ public:
|
|||
label = memnew(Label);
|
||||
label->set_text(TTR("Rotation Offset:"));
|
||||
child_container->add_child(label);
|
||||
label->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
label->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
rotation_offset = memnew(SpinBox);
|
||||
rotation_offset->set_min(-SPIN_BOX_ROTATION_RANGE);
|
||||
rotation_offset->set_max(SPIN_BOX_ROTATION_RANGE);
|
||||
rotation_offset->set_suffix("deg");
|
||||
rotation_offset->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
rotation_offset->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
child_container->add_child(rotation_offset);
|
||||
|
||||
label = memnew(Label);
|
||||
label->set_text(TTR("Rotation Step:"));
|
||||
child_container->add_child(label);
|
||||
label->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
label->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
rotation_step = memnew(SpinBox);
|
||||
rotation_step->set_min(-SPIN_BOX_ROTATION_RANGE);
|
||||
rotation_step->set_max(SPIN_BOX_ROTATION_RANGE);
|
||||
rotation_step->set_suffix("deg");
|
||||
rotation_step->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
rotation_step->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
child_container->add_child(rotation_step);
|
||||
|
||||
container->add_child(memnew(HSeparator));
|
||||
|
@ -198,13 +198,13 @@ public:
|
|||
label = memnew(Label);
|
||||
label->set_text(TTR("Scale Step:"));
|
||||
child_container->add_child(label);
|
||||
label->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
label->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
scale_step = memnew(SpinBox);
|
||||
scale_step->set_min(SPIN_BOX_SCALE_MIN);
|
||||
scale_step->set_max(SPIN_BOX_SCALE_MAX);
|
||||
scale_step->set_allow_greater(true);
|
||||
scale_step->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
scale_step->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
scale_step->set_step(0.01f);
|
||||
child_container->add_child(scale_step);
|
||||
}
|
||||
|
@ -5420,18 +5420,18 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
|
|||
|
||||
bottom_split = memnew(VSplitContainer);
|
||||
add_child(bottom_split);
|
||||
bottom_split->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
bottom_split->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
palette_split = memnew(HSplitContainer);
|
||||
bottom_split->add_child(palette_split);
|
||||
palette_split->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
palette_split->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
viewport_scrollable = memnew(Control);
|
||||
palette_split->add_child(viewport_scrollable);
|
||||
viewport_scrollable->set_mouse_filter(MOUSE_FILTER_PASS);
|
||||
viewport_scrollable->set_clip_contents(true);
|
||||
viewport_scrollable->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
viewport_scrollable->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
viewport_scrollable->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
viewport_scrollable->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
viewport_scrollable->connect("draw", callable_mp(this, &CanvasItemEditor::_update_scrollbars));
|
||||
|
||||
ViewportContainer *scene_tree = memnew(ViewportContainer);
|
||||
|
@ -6049,7 +6049,7 @@ void CanvasItemEditorViewport::_perform_drop_data() {
|
|||
// Without root dropping multiple files is not allowed
|
||||
if (!target_node && selected_files.size() > 1) {
|
||||
accept->set_text(TTR("Cannot instantiate multiple nodes without root."));
|
||||
accept->popup_centered_minsize();
|
||||
accept->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -6110,7 +6110,7 @@ void CanvasItemEditorViewport::_perform_drop_data() {
|
|||
}
|
||||
files_str = files_str.substr(0, files_str.length() - 1);
|
||||
accept->set_text(vformat(TTR("Error instancing scene from %s"), files_str.c_str()));
|
||||
accept->popup_centered_minsize();
|
||||
accept->popup_centered();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6176,7 +6176,7 @@ void CanvasItemEditorViewport::_show_resource_type_selector() {
|
|||
check->set_pressed(check->get_text() == default_type);
|
||||
}
|
||||
selector->set_title(vformat(TTR("Add %s"), default_type));
|
||||
selector->popup_centered_minsize();
|
||||
selector->popup_centered();
|
||||
}
|
||||
|
||||
bool CanvasItemEditorViewport::_only_packed_scenes_selected() const {
|
||||
|
@ -6271,12 +6271,12 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte
|
|||
editor->get_gui_base()->add_child(selector);
|
||||
selector->set_title(TTR("Change Default Type"));
|
||||
selector->connect("confirmed", callable_mp(this, &CanvasItemEditorViewport::_on_change_type_confirmed));
|
||||
selector->connect("popup_hide", callable_mp(this, &CanvasItemEditorViewport::_on_change_type_closed));
|
||||
selector->connect("cancelled", callable_mp(this, &CanvasItemEditorViewport::_on_change_type_closed));
|
||||
|
||||
VBoxContainer *vbc = memnew(VBoxContainer);
|
||||
selector->add_child(vbc);
|
||||
vbc->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
vbc->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
vbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
vbc->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
vbc->set_custom_minimum_size(Size2(200, 260) * EDSCALE);
|
||||
|
||||
btn_group = memnew(VBoxContainer);
|
||||
|
|
|
@ -687,7 +687,7 @@ class CanvasItemEditorViewport : public Control {
|
|||
CanvasItemEditor *canvas_item_editor;
|
||||
Node2D *preview_node;
|
||||
AcceptDialog *accept;
|
||||
WindowDialog *selector;
|
||||
AcceptDialog *selector;
|
||||
Label *selector_label;
|
||||
Label *label;
|
||||
Label *label_desc;
|
||||
|
|
|
@ -60,7 +60,7 @@ void CPUParticles2DEditorPlugin::make_visible(bool p_visible) {
|
|||
void CPUParticles2DEditorPlugin::_file_selected(const String &p_file) {
|
||||
|
||||
source_emission_file = p_file;
|
||||
emission_mask->popup_centered_minsize();
|
||||
emission_mask->popup_centered();
|
||||
}
|
||||
|
||||
void CPUParticles2DEditorPlugin::_menu_callback(int p_idx) {
|
||||
|
@ -73,7 +73,7 @@ void CPUParticles2DEditorPlugin::_menu_callback(int p_idx) {
|
|||
} break;
|
||||
case MENU_CLEAR_EMISSION_MASK: {
|
||||
|
||||
emission_mask->popup_centered_minsize();
|
||||
emission_mask->popup_centered();
|
||||
} break;
|
||||
case MENU_RESTART: {
|
||||
|
||||
|
@ -276,7 +276,7 @@ CPUParticles2DEditorPlugin::CPUParticles2DEditorPlugin(EditorNode *p_node) {
|
|||
for (List<String>::Element *E = ext.front(); E; E = E->next()) {
|
||||
file->add_filter("*." + E->get() + "; " + E->get().to_upper());
|
||||
}
|
||||
file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
toolbar->add_child(file);
|
||||
|
||||
epoints = memnew(SpinBox);
|
||||
|
|
|
@ -165,7 +165,7 @@ GIProbeEditorPlugin::GIProbeEditorPlugin(EditorNode *p_node) {
|
|||
add_control_to_container(CONTAINER_SPATIAL_EDITOR_MENU, bake_hb);
|
||||
gi_probe = NULL;
|
||||
probe_file = memnew(EditorFileDialog);
|
||||
probe_file->set_mode(EditorFileDialog::MODE_SAVE_FILE);
|
||||
probe_file->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
|
||||
probe_file->add_filter("*.res");
|
||||
probe_file->connect("file_selected", callable_mp(this, &GIProbeEditorPlugin::_giprobe_save_path_and_bake));
|
||||
get_editor_interface()->get_base_control()->add_child(probe_file);
|
||||
|
|
|
@ -55,7 +55,7 @@ void MeshInstanceEditor::_menu_option(int p_option) {
|
|||
Ref<Mesh> mesh = node->get_mesh();
|
||||
if (mesh.is_null()) {
|
||||
err_dialog->set_text(TTR("Mesh is empty!"));
|
||||
err_dialog->popup_centered_minsize();
|
||||
err_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ void MeshInstanceEditor::_menu_option(int p_option) {
|
|||
Ref<Shape> shape = mesh->create_trimesh_shape();
|
||||
if (shape.is_null()) {
|
||||
err_dialog->set_text(TTR("Couldn't create a Trimesh collision shape."));
|
||||
err_dialog->popup_centered_minsize();
|
||||
err_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ void MeshInstanceEditor::_menu_option(int p_option) {
|
|||
|
||||
if (node == get_tree()->get_edited_scene_root()) {
|
||||
err_dialog->set_text(TTR("This doesn't work on scene root!"));
|
||||
err_dialog->popup_centered_minsize();
|
||||
err_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,7 @@ void MeshInstanceEditor::_menu_option(int p_option) {
|
|||
|
||||
if (node == get_tree()->get_edited_scene_root()) {
|
||||
err_dialog->set_text(TTR("Can't create a single convex collision shape for the scene root."));
|
||||
err_dialog->popup_centered_minsize();
|
||||
err_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -166,7 +166,7 @@ void MeshInstanceEditor::_menu_option(int p_option) {
|
|||
|
||||
if (shape.is_null()) {
|
||||
err_dialog->set_text(TTR("Couldn't create a single convex collision shape."));
|
||||
err_dialog->popup_centered_minsize();
|
||||
err_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
|
||||
|
@ -192,7 +192,7 @@ void MeshInstanceEditor::_menu_option(int p_option) {
|
|||
|
||||
if (node == get_tree()->get_edited_scene_root()) {
|
||||
err_dialog->set_text(TTR("Can't create multiple convex collision shapes for the scene root."));
|
||||
err_dialog->popup_centered_minsize();
|
||||
err_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -200,7 +200,7 @@ void MeshInstanceEditor::_menu_option(int p_option) {
|
|||
|
||||
if (!shapes.size()) {
|
||||
err_dialog->set_text(TTR("Couldn't create any collision shapes."));
|
||||
err_dialog->popup_centered_minsize();
|
||||
err_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
|
||||
|
@ -258,14 +258,14 @@ void MeshInstanceEditor::_menu_option(int p_option) {
|
|||
Ref<ArrayMesh> mesh2 = node->get_mesh();
|
||||
if (!mesh2.is_valid()) {
|
||||
err_dialog->set_text(TTR("Contained Mesh is not of type ArrayMesh."));
|
||||
err_dialog->popup_centered_minsize();
|
||||
err_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
Error err = mesh2->lightmap_unwrap(node->get_global_transform());
|
||||
if (err != OK) {
|
||||
err_dialog->set_text(TTR("UV Unwrap failed, mesh may not be manifold?"));
|
||||
err_dialog->popup_centered_minsize();
|
||||
err_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -274,7 +274,7 @@ void MeshInstanceEditor::_menu_option(int p_option) {
|
|||
Ref<Mesh> mesh2 = node->get_mesh();
|
||||
if (!mesh2.is_valid()) {
|
||||
err_dialog->set_text(TTR("No mesh to debug."));
|
||||
err_dialog->popup_centered_minsize();
|
||||
err_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
_create_uv_lines(0);
|
||||
|
@ -283,7 +283,7 @@ void MeshInstanceEditor::_menu_option(int p_option) {
|
|||
Ref<Mesh> mesh2 = node->get_mesh();
|
||||
if (!mesh2.is_valid()) {
|
||||
err_dialog->set_text(TTR("No mesh to debug."));
|
||||
err_dialog->popup_centered_minsize();
|
||||
err_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
_create_uv_lines(1);
|
||||
|
@ -330,7 +330,7 @@ void MeshInstanceEditor::_create_uv_lines(int p_layer) {
|
|||
Vector<Vector2> uv = a[p_layer == 0 ? Mesh::ARRAY_TEX_UV : Mesh::ARRAY_TEX_UV2];
|
||||
if (uv.size() == 0) {
|
||||
err_dialog->set_text(TTR("Model has no UV in this layer"));
|
||||
err_dialog->popup_centered_minsize();
|
||||
err_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -374,7 +374,7 @@ void MeshInstanceEditor::_create_uv_lines(int p_layer) {
|
|||
}
|
||||
}
|
||||
|
||||
debug_uv_dialog->popup_centered_minsize();
|
||||
debug_uv_dialog->popup_centered();
|
||||
}
|
||||
|
||||
void MeshInstanceEditor::_debug_uv_draw() {
|
||||
|
@ -393,17 +393,17 @@ void MeshInstanceEditor::_create_outline_mesh() {
|
|||
Ref<Mesh> mesh = node->get_mesh();
|
||||
if (mesh.is_null()) {
|
||||
err_dialog->set_text(TTR("MeshInstance lacks a Mesh!"));
|
||||
err_dialog->popup_centered_minsize();
|
||||
err_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
if (mesh->get_surface_count() == 0) {
|
||||
err_dialog->set_text(TTR("Mesh has not surface to create outlines from!"));
|
||||
err_dialog->popup_centered_minsize();
|
||||
err_dialog->popup_centered();
|
||||
return;
|
||||
} else if (mesh->get_surface_count() == 1 && mesh->surface_get_primitive_type(0) != Mesh::PRIMITIVE_TRIANGLES) {
|
||||
err_dialog->set_text(TTR("Mesh primitive type is not PRIMITIVE_TRIANGLES!"));
|
||||
err_dialog->popup_centered_minsize();
|
||||
err_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -411,7 +411,7 @@ void MeshInstanceEditor::_create_outline_mesh() {
|
|||
|
||||
if (mesho.is_null()) {
|
||||
err_dialog->set_text(TTR("Could not create outline!"));
|
||||
err_dialog->popup_centered_minsize();
|
||||
err_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -253,7 +253,7 @@ void MeshLibraryEditor::_bind_methods() {
|
|||
MeshLibraryEditor::MeshLibraryEditor(EditorNode *p_editor) {
|
||||
|
||||
file = memnew(EditorFileDialog);
|
||||
file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
//not for now?
|
||||
List<String> extensions;
|
||||
ResourceLoader::get_recognized_extensions_for_type("PackedScene", &extensions);
|
||||
|
|
|
@ -56,13 +56,13 @@ void MultiMeshEditor::_populate() {
|
|||
if (multimesh.is_null()) {
|
||||
|
||||
err_dialog->set_text(TTR("No mesh source specified (and no MultiMesh set in node)."));
|
||||
err_dialog->popup_centered_minsize();
|
||||
err_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
if (multimesh->get_mesh().is_null()) {
|
||||
|
||||
err_dialog->set_text(TTR("No mesh source specified (and MultiMesh contains no Mesh)."));
|
||||
err_dialog->popup_centered_minsize();
|
||||
err_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ void MultiMeshEditor::_populate() {
|
|||
if (!ms_node) {
|
||||
|
||||
err_dialog->set_text(TTR("Mesh source is invalid (invalid path)."));
|
||||
err_dialog->popup_centered_minsize();
|
||||
err_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ void MultiMeshEditor::_populate() {
|
|||
if (!ms_instance) {
|
||||
|
||||
err_dialog->set_text(TTR("Mesh source is invalid (not a MeshInstance)."));
|
||||
err_dialog->popup_centered_minsize();
|
||||
err_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ void MultiMeshEditor::_populate() {
|
|||
if (mesh.is_null()) {
|
||||
|
||||
err_dialog->set_text(TTR("Mesh source is invalid (contains no Mesh resource)."));
|
||||
err_dialog->popup_centered_minsize();
|
||||
err_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ void MultiMeshEditor::_populate() {
|
|||
if (surface_source->get_text() == "") {
|
||||
|
||||
err_dialog->set_text(TTR("No surface source specified."));
|
||||
err_dialog->popup_centered_minsize();
|
||||
err_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ void MultiMeshEditor::_populate() {
|
|||
if (!ss_node) {
|
||||
|
||||
err_dialog->set_text(TTR("Surface source is invalid (invalid path)."));
|
||||
err_dialog->popup_centered_minsize();
|
||||
err_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@ void MultiMeshEditor::_populate() {
|
|||
if (!ss_instance) {
|
||||
|
||||
err_dialog->set_text(TTR("Surface source is invalid (no geometry)."));
|
||||
err_dialog->popup_centered_minsize();
|
||||
err_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ void MultiMeshEditor::_populate() {
|
|||
if (geometry.size() == 0) {
|
||||
|
||||
err_dialog->set_text(TTR("Surface source is invalid (no faces)."));
|
||||
err_dialog->popup_centered_minsize();
|
||||
err_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ void Particles2DEditorPlugin::make_visible(bool p_visible) {
|
|||
void Particles2DEditorPlugin::_file_selected(const String &p_file) {
|
||||
|
||||
source_emission_file = p_file;
|
||||
emission_mask->popup_centered_minsize();
|
||||
emission_mask->popup_centered();
|
||||
}
|
||||
|
||||
void Particles2DEditorPlugin::_menu_callback(int p_idx) {
|
||||
|
@ -72,7 +72,7 @@ void Particles2DEditorPlugin::_menu_callback(int p_idx) {
|
|||
generate_seconds->set_value(1.0);
|
||||
else
|
||||
generate_seconds->set_value(trunc(gen_time) + 1.0);
|
||||
generate_visibility_rect->popup_centered_minsize();
|
||||
generate_visibility_rect->popup_centered();
|
||||
} break;
|
||||
case MENU_LOAD_EMISSION_MASK: {
|
||||
|
||||
|
@ -81,7 +81,7 @@ void Particles2DEditorPlugin::_menu_callback(int p_idx) {
|
|||
} break;
|
||||
case MENU_CLEAR_EMISSION_MASK: {
|
||||
|
||||
emission_mask->popup_centered_minsize();
|
||||
emission_mask->popup_centered();
|
||||
} break;
|
||||
case MENU_OPTION_CONVERT_TO_CPU_PARTICLES: {
|
||||
|
||||
|
@ -389,7 +389,7 @@ Particles2DEditorPlugin::Particles2DEditorPlugin(EditorNode *p_node) {
|
|||
for (List<String>::Element *E = ext.front(); E; E = E->next()) {
|
||||
file->add_filter("*." + E->get() + "; " + E->get().to_upper());
|
||||
}
|
||||
file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
toolbar->add_child(file);
|
||||
|
||||
epoints = memnew(SpinBox);
|
||||
|
|
|
@ -260,7 +260,7 @@ void ParticlesEditor::_menu_option(int p_option) {
|
|||
generate_seconds->set_value(1.0);
|
||||
else
|
||||
generate_seconds->set_value(trunc(gen_time) + 1.0);
|
||||
generate_aabb->popup_centered_minsize();
|
||||
generate_aabb->popup_centered();
|
||||
} break;
|
||||
case MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_NODE: {
|
||||
Ref<ParticlesMaterial> material = node->get_process_material();
|
||||
|
|
|
@ -110,7 +110,7 @@ void Polygon2DEditor::_sync_bones() {
|
|||
Skeleton2D *skeleton = NULL;
|
||||
if (!node->has_node(node->get_skeleton())) {
|
||||
error->set_text(TTR("The skeleton property of the Polygon2D does not point to a Skeleton2D node"));
|
||||
error->popup_centered_minsize();
|
||||
error->popup_centered();
|
||||
} else {
|
||||
Node *sn = node->get_node(node->get_skeleton());
|
||||
skeleton = Object::cast_to<Skeleton2D>(sn);
|
||||
|
@ -121,7 +121,7 @@ void Polygon2DEditor::_sync_bones() {
|
|||
|
||||
if (!skeleton) {
|
||||
error->set_text(TTR("The skeleton property of the Polygon2D does not point to a Skeleton2D node"));
|
||||
error->popup_centered_minsize();
|
||||
error->popup_centered();
|
||||
} else {
|
||||
for (int i = 0; i < skeleton->get_bone_count(); i++) {
|
||||
NodePath path = skeleton->get_path_to(skeleton->get_bone(i));
|
||||
|
@ -275,7 +275,7 @@ void Polygon2DEditor::_uv_edit_mode_select(int p_mode) {
|
|||
|
||||
void Polygon2DEditor::_uv_edit_popup_hide() {
|
||||
|
||||
EditorSettings::get_singleton()->set("interface/dialogs/uv_editor_bounds", uv_edit->get_rect());
|
||||
EditorSettings::get_singleton()->set("interface/dialogs/uv_editor_bounds", Rect2(uv_edit->get_position(), uv_edit->get_size()));
|
||||
|
||||
_cancel_editing();
|
||||
}
|
||||
|
@ -289,7 +289,7 @@ void Polygon2DEditor::_menu_option(int p_option) {
|
|||
if (node->get_texture().is_null()) {
|
||||
|
||||
error->set_text(TTR("No texture in this polygon.\nSet a texture to be able to edit UV."));
|
||||
error->popup_centered_minsize();
|
||||
error->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -351,7 +351,7 @@ void Polygon2DEditor::_menu_option(int p_option) {
|
|||
} break;
|
||||
case UVEDIT_GRID_SETTINGS: {
|
||||
|
||||
grid_settings->popup_centered_minsize();
|
||||
grid_settings->popup_centered();
|
||||
} break;
|
||||
default: {
|
||||
|
||||
|
@ -683,7 +683,7 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) {
|
|||
//close
|
||||
if (polygon_create.size() < 3) {
|
||||
error->set_text(TTR("Invalid Polygon (need 3 different vertices)"));
|
||||
error->popup_centered_minsize();
|
||||
error->popup_centered();
|
||||
} else {
|
||||
Array polygons = node->get_polygons();
|
||||
polygons = polygons.duplicate(); //copy because its a reference
|
||||
|
@ -1265,8 +1265,7 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) :
|
|||
uv_edit = memnew(AcceptDialog);
|
||||
add_child(uv_edit);
|
||||
uv_edit->set_title(TTR("Polygon 2D UV Editor"));
|
||||
uv_edit->set_resizable(true);
|
||||
uv_edit->connect("popup_hide", callable_mp(this, &Polygon2DEditor::_uv_edit_popup_hide));
|
||||
uv_edit->connect("cancelled", callable_mp(this, &Polygon2DEditor::_uv_edit_popup_hide));
|
||||
|
||||
VBoxContainer *uv_main_vb = memnew(VBoxContainer);
|
||||
uv_edit->add_child(uv_main_vb);
|
||||
|
|
|
@ -67,7 +67,7 @@ void ResourcePreloaderEditor::_files_load_request(const Vector<String> &p_paths)
|
|||
dialog->set_title(TTR("Error!"));
|
||||
//dialog->get_cancel()->set_text("Close");
|
||||
dialog->get_ok()->set_text(TTR("Close"));
|
||||
dialog->popup_centered_minsize();
|
||||
dialog->popup_centered();
|
||||
return; ///beh should show an error i guess
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ void ResourcePreloaderEditor::_load_pressed() {
|
|||
for (int i = 0; i < extensions.size(); i++)
|
||||
file->add_filter("*." + extensions[i]);
|
||||
|
||||
file->set_mode(EditorFileDialog::MODE_OPEN_FILES);
|
||||
file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILES);
|
||||
|
||||
file->popup_centered_ratio();
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ void ResourcePreloaderEditor::_paste_pressed() {
|
|||
dialog->set_text(TTR("Resource clipboard is empty!"));
|
||||
dialog->set_title(TTR("Error!"));
|
||||
dialog->get_ok()->set_text(TTR("Close"));
|
||||
dialog->popup_centered_minsize();
|
||||
dialog->popup_centered();
|
||||
return; ///beh should show an error i guess
|
||||
}
|
||||
|
||||
|
|
|
@ -215,9 +215,9 @@ void ScriptEditorQuickOpen::_notification(int p_what) {
|
|||
|
||||
search_box->set_clear_button_enabled(true);
|
||||
[[fallthrough]];
|
||||
}
|
||||
case NOTIFICATION_THEME_CHANGED: {
|
||||
search_box->set_right_icon(get_icon("Search", "EditorIcons"));
|
||||
};
|
||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||
search_box->set_right_icon(search_options->get_icon("Search", "EditorIcons"));
|
||||
} break;
|
||||
case NOTIFICATION_EXIT_TREE: {
|
||||
disconnect("confirmed", callable_mp(this, &ScriptEditorQuickOpen::_confirmed));
|
||||
|
@ -557,7 +557,7 @@ void ScriptEditor::_open_recent_script(int p_idx) {
|
|||
void ScriptEditor::_show_error_dialog(String p_path) {
|
||||
|
||||
error_dialog->set_text(vformat(TTR("Can't open '%s'. The file could have been moved or deleted."), p_path));
|
||||
error_dialog->popup_centered_minsize();
|
||||
error_dialog->popup_centered();
|
||||
}
|
||||
|
||||
void ScriptEditor::_close_tab(int p_idx, bool p_save, bool p_history_back) {
|
||||
|
@ -704,7 +704,7 @@ void ScriptEditor::_close_all_tabs() {
|
|||
|
||||
void ScriptEditor::_ask_close_current_unsaved_tab(ScriptEditorBase *current) {
|
||||
erase_tab_confirm->set_text(TTR("Close and save changes?") + "\n\"" + current->get_name() + "\"");
|
||||
erase_tab_confirm->popup_centered_minsize();
|
||||
erase_tab_confirm->popup_centered();
|
||||
}
|
||||
|
||||
void ScriptEditor::_resave_scripts(const String &p_str) {
|
||||
|
@ -996,7 +996,7 @@ void ScriptEditor::_menu_option(int p_option) {
|
|||
script_create_dialog->popup_centered();
|
||||
} break;
|
||||
case FILE_NEW_TEXTFILE: {
|
||||
file_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE);
|
||||
file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
|
||||
file_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
|
||||
file_dialog_option = FILE_NEW_TEXTFILE;
|
||||
|
||||
|
@ -1005,7 +1005,7 @@ void ScriptEditor::_menu_option(int p_option) {
|
|||
file_dialog->set_title(TTR("New Text File..."));
|
||||
} break;
|
||||
case FILE_OPEN: {
|
||||
file_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
file_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
|
||||
file_dialog_option = FILE_OPEN;
|
||||
|
||||
|
@ -1170,7 +1170,7 @@ void ScriptEditor::_menu_option(int p_option) {
|
|||
|
||||
Ref<TextFile> text_file = current->get_edited_resource();
|
||||
if (text_file != NULL) {
|
||||
file_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE);
|
||||
file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
|
||||
file_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
|
||||
file_dialog_option = FILE_SAVE_AS;
|
||||
|
||||
|
@ -1336,7 +1336,7 @@ void ScriptEditor::_menu_option(int p_option) {
|
|||
void ScriptEditor::_theme_option(int p_option) {
|
||||
switch (p_option) {
|
||||
case THEME_IMPORT: {
|
||||
file_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
file_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
|
||||
file_dialog_option = THEME_IMPORT;
|
||||
file_dialog->clear_filters();
|
||||
|
@ -1361,7 +1361,7 @@ void ScriptEditor::_theme_option(int p_option) {
|
|||
}
|
||||
|
||||
void ScriptEditor::_show_save_theme_as_dialog() {
|
||||
file_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE);
|
||||
file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
|
||||
file_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
|
||||
file_dialog_option = THEME_SAVE_AS;
|
||||
file_dialog->clear_filters();
|
||||
|
@ -2953,7 +2953,7 @@ void ScriptEditor::_on_find_in_files_requested(String text) {
|
|||
|
||||
find_in_files_dialog->set_find_in_files_mode(FindInFilesDialog::SEARCH_MODE);
|
||||
find_in_files_dialog->set_search_text(text);
|
||||
find_in_files_dialog->popup_centered_minsize();
|
||||
find_in_files_dialog->popup_centered();
|
||||
}
|
||||
|
||||
void ScriptEditor::_on_replace_in_files_requested(String text) {
|
||||
|
@ -2961,7 +2961,7 @@ void ScriptEditor::_on_replace_in_files_requested(String text) {
|
|||
find_in_files_dialog->set_find_in_files_mode(FindInFilesDialog::REPLACE_MODE);
|
||||
find_in_files_dialog->set_search_text(text);
|
||||
find_in_files_dialog->set_replace_text("");
|
||||
find_in_files_dialog->popup_centered_minsize();
|
||||
find_in_files_dialog->popup_centered();
|
||||
}
|
||||
|
||||
void ScriptEditor::_on_find_in_files_result_selected(String fpath, int line_number, int begin, int end) {
|
||||
|
|
|
@ -65,7 +65,8 @@ void ConnectionInfoDialog::popup_connections(String p_method, Vector<Node *> p_n
|
|||
node_item->set_editable(0, false);
|
||||
|
||||
node_item->set_text(1, connection.signal.get_name());
|
||||
node_item->set_icon(1, get_parent_control()->get_icon("Slot", "EditorIcons"));
|
||||
Control *p = Object::cast_to<Control>(get_parent());
|
||||
node_item->set_icon(1, p->get_icon("Slot", "EditorIcons"));
|
||||
node_item->set_selectable(1, false);
|
||||
node_item->set_editable(1, false);
|
||||
|
||||
|
@ -83,10 +84,10 @@ ConnectionInfoDialog::ConnectionInfoDialog() {
|
|||
set_title(TTR("Connections to method:"));
|
||||
|
||||
VBoxContainer *vbc = memnew(VBoxContainer);
|
||||
vbc->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 8 * EDSCALE);
|
||||
vbc->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 8 * EDSCALE);
|
||||
vbc->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -8 * EDSCALE);
|
||||
vbc->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, -8 * EDSCALE);
|
||||
vbc->set_anchor_and_margin(MARGIN_LEFT, Control::ANCHOR_BEGIN, 8 * EDSCALE);
|
||||
vbc->set_anchor_and_margin(MARGIN_TOP, Control::ANCHOR_BEGIN, 8 * EDSCALE);
|
||||
vbc->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, -8 * EDSCALE);
|
||||
vbc->set_anchor_and_margin(MARGIN_BOTTOM, Control::ANCHOR_END, -8 * EDSCALE);
|
||||
add_child(vbc);
|
||||
|
||||
method = memnew(Label);
|
||||
|
@ -101,7 +102,7 @@ ConnectionInfoDialog::ConnectionInfoDialog() {
|
|||
tree->set_column_title(1, TTR("Signal"));
|
||||
tree->set_column_title(2, TTR("Target"));
|
||||
vbc->add_child(tree);
|
||||
tree->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
tree->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
tree->set_allow_rmb_select(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ void Skeleton2DEditor::_menu_option(int p_option) {
|
|||
|
||||
if (node->get_bone_count() == 0) {
|
||||
err_dialog->set_text(TTR("This skeleton has no bones, create some children Bone2D nodes."));
|
||||
err_dialog->popup_centered_minsize();
|
||||
err_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
|
||||
|
@ -75,7 +75,7 @@ void Skeleton2DEditor::_menu_option(int p_option) {
|
|||
case MENU_OPTION_SET_REST: {
|
||||
if (node->get_bone_count() == 0) {
|
||||
err_dialog->set_text(TTR("This skeleton has no bones, create some children Bone2D nodes."));
|
||||
err_dialog->popup_centered_minsize();
|
||||
err_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
|
||||
|
|
|
@ -3706,7 +3706,7 @@ void SpatialEditorViewport::_perform_drop_data() {
|
|||
}
|
||||
files_str = files_str.substr(0, files_str.length() - 1);
|
||||
accept->set_text(vformat(TTR("Error instancing scene from %s"), files_str.c_str()));
|
||||
accept->popup_centered_minsize();
|
||||
accept->popup_centered();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3786,14 +3786,14 @@ void SpatialEditorViewport::drop_data_fw(const Point2 &p_point, const Variant &p
|
|||
list.push_back(root_node);
|
||||
} else {
|
||||
accept->set_text(TTR("No parent to instance a child at."));
|
||||
accept->popup_centered_minsize();
|
||||
accept->popup_centered();
|
||||
_remove_preview();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (list.size() != 1) {
|
||||
accept->set_text(TTR("This operation requires a single selected node."));
|
||||
accept->popup_centered_minsize();
|
||||
accept->popup_centered();
|
||||
_remove_preview();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -170,13 +170,13 @@ void SpriteEditor::_update_mesh_data() {
|
|||
Ref<Texture2D> texture = node->get_texture();
|
||||
if (texture.is_null()) {
|
||||
err_dialog->set_text(TTR("Sprite is empty!"));
|
||||
err_dialog->popup_centered_minsize();
|
||||
err_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
if (node->get_hframes() > 1 || node->get_vframes() > 1) {
|
||||
err_dialog->set_text(TTR("Can't convert a sprite using animation frames to mesh."));
|
||||
err_dialog->popup_centered_minsize();
|
||||
err_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -317,7 +317,7 @@ void SpriteEditor::_convert_to_mesh_2d_node() {
|
|||
|
||||
if (computed_vertices.size() < 3) {
|
||||
err_dialog->set_text(TTR("Invalid geometry, can't replace by mesh."));
|
||||
err_dialog->popup_centered_minsize();
|
||||
err_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -348,7 +348,7 @@ void SpriteEditor::_convert_to_polygon_2d_node() {
|
|||
|
||||
if (computed_outline_lines.empty()) {
|
||||
err_dialog->set_text(TTR("Invalid geometry, can't create polygon."));
|
||||
err_dialog->popup_centered_minsize();
|
||||
err_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -407,7 +407,7 @@ void SpriteEditor::_create_collision_polygon_2d_node() {
|
|||
|
||||
if (computed_outline_lines.empty()) {
|
||||
err_dialog->set_text(TTR("Invalid geometry, can't create collision polygon."));
|
||||
err_dialog->popup_centered_minsize();
|
||||
err_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -431,7 +431,7 @@ void SpriteEditor::_create_light_occluder_2d_node() {
|
|||
|
||||
if (computed_outline_lines.empty()) {
|
||||
err_dialog->set_text(TTR("Invalid geometry, can't create light occluder."));
|
||||
err_dialog->popup_centered_minsize();
|
||||
err_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -262,7 +262,7 @@ void SpriteFramesEditor::_file_load_request(const Vector<String> &p_path, int p_
|
|||
|
||||
//dialog->get_cancel()->set_text("Close");
|
||||
dialog->get_ok()->set_text(TTR("Close"));
|
||||
dialog->popup_centered_minsize();
|
||||
dialog->popup_centered();
|
||||
return; ///beh should show an error i guess
|
||||
}
|
||||
|
||||
|
@ -301,7 +301,7 @@ void SpriteFramesEditor::_load_pressed() {
|
|||
for (int i = 0; i < extensions.size(); i++)
|
||||
file->add_filter("*." + extensions[i]);
|
||||
|
||||
file->set_mode(EditorFileDialog::MODE_OPEN_FILES);
|
||||
file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILES);
|
||||
|
||||
file->popup_centered_ratio();
|
||||
}
|
||||
|
@ -316,7 +316,7 @@ void SpriteFramesEditor::_paste_pressed() {
|
|||
dialog->set_title(TTR("Error!"));
|
||||
//dialog->get_cancel()->set_text("Close");
|
||||
dialog->get_ok()->set_text(TTR("Close"));
|
||||
dialog->popup_centered_minsize();
|
||||
dialog->popup_centered();
|
||||
return; ///beh should show an error i guess
|
||||
}
|
||||
|
||||
|
@ -591,7 +591,7 @@ void SpriteFramesEditor::_animation_remove() {
|
|||
return;
|
||||
|
||||
delete_dialog->set_text(TTR("Delete Animation?"));
|
||||
delete_dialog->popup_centered_minsize();
|
||||
delete_dialog->popup_centered();
|
||||
}
|
||||
|
||||
void SpriteFramesEditor::_animation_remove_confirmed() {
|
||||
|
@ -1058,7 +1058,7 @@ SpriteFramesEditor::SpriteFramesEditor() {
|
|||
|
||||
file_split_sheet = memnew(EditorFileDialog);
|
||||
file_split_sheet->set_title(TTR("Create Frames from Sprite Sheet"));
|
||||
file_split_sheet->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
file_split_sheet->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
add_child(file_split_sheet);
|
||||
file_split_sheet->connect("file_selected", callable_mp(this, &SpriteFramesEditor::_prepare_sprite_sheet));
|
||||
}
|
||||
|
|
|
@ -619,7 +619,7 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) {
|
|||
//---------------
|
||||
texture_dialog = memnew(EditorFileDialog);
|
||||
texture_dialog->set_access(EditorFileDialog::ACCESS_RESOURCES);
|
||||
texture_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILES);
|
||||
texture_dialog->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILES);
|
||||
texture_dialog->clear_filters();
|
||||
List<String> extensions;
|
||||
|
||||
|
|
|
@ -412,7 +412,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() {
|
|||
|
||||
set_up_dialog = memnew(AcceptDialog);
|
||||
set_up_dialog->set_title(TTR("Set Up Version Control"));
|
||||
set_up_dialog->set_custom_minimum_size(Size2(400, 100));
|
||||
set_up_dialog->set_min_size(Size2(400, 100));
|
||||
version_control_actions->add_child(set_up_dialog);
|
||||
|
||||
set_up_ok_button = set_up_dialog->get_ok();
|
||||
|
|
|
@ -1648,7 +1648,7 @@ void VisualShaderEditor::_show_members_dialog(bool at_mouse_pos) {
|
|||
|
||||
// keep dialog within window bounds
|
||||
Size2 window_size = DisplayServer::get_singleton()->window_get_size();
|
||||
Rect2 dialog_rect = members_dialog->get_global_rect();
|
||||
Rect2 dialog_rect = Rect2(members_dialog->get_position(), members_dialog->get_size());
|
||||
if (dialog_rect.position.y + dialog_rect.size.y > window_size.y) {
|
||||
int difference = dialog_rect.position.y + dialog_rect.size.y - window_size.y;
|
||||
members_dialog->set_position(members_dialog->get_position() - Point2(0, difference));
|
||||
|
@ -2490,13 +2490,10 @@ VisualShaderEditor::VisualShaderEditor() {
|
|||
members_dialog->get_ok()->set_text(TTR("Create"));
|
||||
members_dialog->get_ok()->connect("pressed", callable_mp(this, &VisualShaderEditor::_member_create));
|
||||
members_dialog->get_ok()->set_disabled(true);
|
||||
members_dialog->set_resizable(true);
|
||||
members_dialog->set_as_minsize();
|
||||
members_dialog->connect("hide", callable_mp(this, &VisualShaderEditor::_member_cancel));
|
||||
members_dialog->connect("cancelled", callable_mp(this, &VisualShaderEditor::_member_cancel));
|
||||
add_child(members_dialog);
|
||||
|
||||
alert = memnew(AcceptDialog);
|
||||
alert->set_as_minsize();
|
||||
alert->get_label()->set_autowrap(true);
|
||||
alert->get_label()->set_align(Label::ALIGN_CENTER);
|
||||
alert->get_label()->set_valign(Label::VALIGN_CENTER);
|
||||
|
|
|
@ -163,7 +163,7 @@ void ProgressDialog::_popup() {
|
|||
main->set_margin(MARGIN_BOTTOM, -style->get_margin(MARGIN_BOTTOM));
|
||||
|
||||
raise();
|
||||
popup_centered(ms);
|
||||
popup_centered_size(ms);
|
||||
}
|
||||
|
||||
void ProgressDialog::add_task(const String &p_task, const String &p_label, int p_steps, bool p_can_cancel) {
|
||||
|
|
|
@ -48,24 +48,26 @@
|
|||
#include "scene/gui/tab_container.h"
|
||||
#include "servers/display_server.h"
|
||||
|
||||
void ProjectExportDialog::_theme_changed() {
|
||||
duplicate_preset->set_icon(presets->get_icon("Duplicate", "EditorIcons"));
|
||||
delete_preset->set_icon(presets->get_icon("Remove", "EditorIcons"));
|
||||
Control *panel = custom_feature_display->get_parent_control();
|
||||
if (panel)
|
||||
panel->add_style_override("panel", patches->get_stylebox("bg", "Tree"));
|
||||
}
|
||||
void ProjectExportDialog::_notification(int p_what) {
|
||||
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||
if (!is_visible()) {
|
||||
EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "export", Rect2(get_position(), get_size()));
|
||||
}
|
||||
} break;
|
||||
case NOTIFICATION_READY: {
|
||||
duplicate_preset->set_icon(get_icon("Duplicate", "EditorIcons"));
|
||||
delete_preset->set_icon(get_icon("Remove", "EditorIcons"));
|
||||
duplicate_preset->set_icon(presets->get_icon("Duplicate", "EditorIcons"));
|
||||
delete_preset->set_icon(presets->get_icon("Remove", "EditorIcons"));
|
||||
connect("confirmed", callable_mp(this, &ProjectExportDialog::_export_pck_zip));
|
||||
custom_feature_display->get_parent_control()->add_style_override("panel", get_stylebox("bg", "Tree"));
|
||||
} break;
|
||||
case NOTIFICATION_POPUP_HIDE: {
|
||||
EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "export", get_rect());
|
||||
} break;
|
||||
case NOTIFICATION_THEME_CHANGED: {
|
||||
duplicate_preset->set_icon(get_icon("Duplicate", "EditorIcons"));
|
||||
delete_preset->set_icon(get_icon("Remove", "EditorIcons"));
|
||||
Control *panel = custom_feature_display->get_parent_control();
|
||||
if (panel)
|
||||
panel->add_style_override("panel", get_stylebox("bg", "Tree"));
|
||||
custom_feature_display->get_parent_control()->add_style_override("panel", patches->get_stylebox("bg", "Tree"));
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
@ -248,8 +250,8 @@ void ProjectExportDialog::_edit_preset(int p_index) {
|
|||
patch->set_checked(0, true);
|
||||
patch->set_tooltip(0, patchlist[i]);
|
||||
patch->set_metadata(0, i);
|
||||
patch->add_button(0, get_icon("Remove", "EditorIcons"), 0);
|
||||
patch->add_button(0, get_icon("folder", "FileDialog"), 1);
|
||||
patch->add_button(0, presets->get_icon("Remove", "EditorIcons"), 0);
|
||||
patch->add_button(0, presets->get_icon("folder", "FileDialog"), 1);
|
||||
}
|
||||
|
||||
TreeItem *patch_add = patches->create_item(patch_root);
|
||||
|
@ -259,7 +261,7 @@ void ProjectExportDialog::_edit_preset(int p_index) {
|
|||
else
|
||||
patch_add->set_text(0, TTR("Add previous patches..."));
|
||||
|
||||
patch_add->add_button(0, get_icon("folder", "FileDialog"), 1);
|
||||
patch_add->add_button(0, presets->get_icon("folder", "FileDialog"), 1);
|
||||
|
||||
_fill_resource_tree();
|
||||
|
||||
|
@ -300,7 +302,7 @@ void ProjectExportDialog::_edit_preset(int p_index) {
|
|||
custom_features->set_text(current->get_custom_features());
|
||||
_update_feature_list();
|
||||
_update_export_all();
|
||||
minimum_size_changed();
|
||||
child_controls_changed();
|
||||
|
||||
int script_export_mode = current->get_script_export_mode();
|
||||
script_mode->select(script_export_mode);
|
||||
|
@ -389,7 +391,7 @@ void ProjectExportDialog::_patch_button_pressed(Object *p_item, int p_column, in
|
|||
Vector<String> patches = current->get_patches();
|
||||
ERR_FAIL_INDEX(patch_index, patches.size());
|
||||
patch_erase->set_text(vformat(TTR("Delete patch '%s' from list?"), patches[patch_index].get_file()));
|
||||
patch_erase->popup_centered_minsize();
|
||||
patch_erase->popup_centered();
|
||||
} else {
|
||||
patch_dialog->popup_centered_ratio();
|
||||
}
|
||||
|
@ -619,7 +621,7 @@ void ProjectExportDialog::_delete_preset() {
|
|||
return;
|
||||
|
||||
delete_confirm->set_text(vformat(TTR("Delete preset '%s'?"), current->get_name()));
|
||||
delete_confirm->popup_centered_minsize();
|
||||
delete_confirm->popup_centered();
|
||||
}
|
||||
|
||||
void ProjectExportDialog::_delete_preset_confirm() {
|
||||
|
@ -650,7 +652,7 @@ Variant ProjectExportDialog::get_drag_data_fw(const Point2 &p_point, Control *p_
|
|||
label->set_text(presets->get_item_text(pos));
|
||||
drag->add_child(label);
|
||||
|
||||
set_drag_preview(drag);
|
||||
presets->set_drag_preview(drag);
|
||||
|
||||
return d;
|
||||
}
|
||||
|
@ -667,7 +669,7 @@ Variant ProjectExportDialog::get_drag_data_fw(const Point2 &p_point, Control *p_
|
|||
|
||||
Label *label = memnew(Label);
|
||||
label->set_text(item->get_text(0));
|
||||
set_drag_preview(label);
|
||||
patches->set_drag_preview(label);
|
||||
|
||||
return d;
|
||||
}
|
||||
|
@ -817,7 +819,7 @@ void ProjectExportDialog::_fill_resource_tree() {
|
|||
|
||||
bool ProjectExportDialog::_fill_tree(EditorFileSystemDirectory *p_dir, TreeItem *p_item, Ref<EditorExportPreset> ¤t, bool p_only_scenes) {
|
||||
|
||||
p_item->set_icon(0, get_icon("folder", "FileDialog"));
|
||||
p_item->set_icon(0, presets->get_icon("folder", "FileDialog"));
|
||||
p_item->set_text(0, p_dir->get_name() + "/");
|
||||
|
||||
bool used = false;
|
||||
|
@ -955,7 +957,7 @@ void ProjectExportDialog::_export_project() {
|
|||
export_project->get_line_edit()->connect_compat("text_entered", export_project, "_file_entered");
|
||||
}
|
||||
|
||||
export_project->set_mode(EditorFileDialog::MODE_SAVE_FILE);
|
||||
export_project->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
|
||||
export_project->popup_centered_ratio();
|
||||
}
|
||||
|
||||
|
@ -980,14 +982,14 @@ void ProjectExportDialog::_export_project_to_path(const String &p_path) {
|
|||
|
||||
ERR_PRINT(vformat("Failed to export the project for platform '%s'.", platform->get_name()));
|
||||
error_dialog->show();
|
||||
error_dialog->popup_centered_minsize(Size2(300, 80));
|
||||
error_dialog->popup_centered(Size2(300, 80));
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectExportDialog::_export_all_dialog() {
|
||||
|
||||
export_all_dialog->show();
|
||||
export_all_dialog->popup_centered_minsize(Size2(300, 80));
|
||||
export_all_dialog->popup_centered(Size2(300, 80));
|
||||
}
|
||||
|
||||
void ProjectExportDialog::_export_all_dialog_action(const String &p_str) {
|
||||
|
@ -1018,7 +1020,7 @@ void ProjectExportDialog::_export_all(bool p_debug) {
|
|||
error_dialog->set_text(TTR("Export templates for this platform are missing/corrupted:") + " " + platform->get_name());
|
||||
}
|
||||
error_dialog->show();
|
||||
error_dialog->popup_centered_minsize(Size2(300, 80));
|
||||
error_dialog->popup_centered(Size2(300, 80));
|
||||
ERR_PRINT("Failed to export project");
|
||||
}
|
||||
}
|
||||
|
@ -1040,13 +1042,13 @@ void ProjectExportDialog::_bind_methods() {
|
|||
ProjectExportDialog::ProjectExportDialog() {
|
||||
|
||||
set_title(TTR("Export"));
|
||||
set_resizable(true);
|
||||
|
||||
VBoxContainer *main_vb = memnew(VBoxContainer);
|
||||
main_vb->connect("theme_changed", callable_mp(this, &ProjectExportDialog::_theme_changed));
|
||||
add_child(main_vb);
|
||||
HSplitContainer *hbox = memnew(HSplitContainer);
|
||||
main_vb->add_child(hbox);
|
||||
hbox->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
hbox->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
// Presets list.
|
||||
|
||||
|
@ -1065,9 +1067,12 @@ ProjectExportDialog::ProjectExportDialog() {
|
|||
preset_hb->add_child(add_preset);
|
||||
MarginContainer *mc = memnew(MarginContainer);
|
||||
preset_vb->add_child(mc);
|
||||
mc->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
mc->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
presets = memnew(ItemList);
|
||||
presets->set_drag_forwarding(this);
|
||||
#ifndef _MSC_VER
|
||||
#warning must reimplement drag forward
|
||||
#endif
|
||||
//presets->set_drag_forwarding(this);
|
||||
mc->add_child(presets);
|
||||
presets->connect("item_selected", callable_mp(this, &ProjectExportDialog::_edit_preset));
|
||||
duplicate_preset = memnew(ToolButton);
|
||||
|
@ -1105,14 +1110,14 @@ ProjectExportDialog::ProjectExportDialog() {
|
|||
sections->set_tab_align(TabContainer::ALIGN_LEFT);
|
||||
sections->set_use_hidden_tabs_for_min_size(true);
|
||||
settings_vb->add_child(sections);
|
||||
sections->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
sections->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
// Main preset parameters.
|
||||
|
||||
parameters = memnew(EditorInspector);
|
||||
sections->add_child(parameters);
|
||||
parameters->set_name(TTR("Options"));
|
||||
parameters->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
parameters->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
parameters->connect("property_edited", callable_mp(this, &ProjectExportDialog::_update_parameters));
|
||||
|
||||
// Resources export parameters.
|
||||
|
@ -1132,7 +1137,7 @@ ProjectExportDialog::ProjectExportDialog() {
|
|||
include_label->set_text(TTR("Resources to export:"));
|
||||
resources_vb->add_child(include_label);
|
||||
include_margin = memnew(MarginContainer);
|
||||
include_margin->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
include_margin->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
resources_vb->add_child(include_margin);
|
||||
|
||||
include_files = memnew(Tree);
|
||||
|
@ -1164,11 +1169,14 @@ ProjectExportDialog::ProjectExportDialog() {
|
|||
|
||||
patches = memnew(Tree);
|
||||
patch_vb->add_child(patches);
|
||||
patches->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
patches->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
patches->set_hide_root(true);
|
||||
patches->connect("button_pressed", callable_mp(this, &ProjectExportDialog::_patch_button_pressed));
|
||||
patches->connect("item_edited", callable_mp(this, &ProjectExportDialog::_patch_edited));
|
||||
patches->set_drag_forwarding(this);
|
||||
#ifndef _MSC_VER
|
||||
#warning must reimplement drag forward
|
||||
#endif
|
||||
//patches->set_drag_forwarding(this);
|
||||
patches->set_edit_checkbox_cell_only_when_checkbox_is_pressed(true);
|
||||
|
||||
HBoxContainer *patches_hb = memnew(HBoxContainer);
|
||||
|
@ -1181,7 +1189,7 @@ ProjectExportDialog::ProjectExportDialog() {
|
|||
|
||||
patch_dialog = memnew(EditorFileDialog);
|
||||
patch_dialog->add_filter("*.pck ; " + TTR("Pack File"));
|
||||
patch_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
patch_dialog->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
patch_dialog->connect("file_selected", callable_mp(this, &ProjectExportDialog::_patch_selected));
|
||||
add_child(patch_dialog);
|
||||
|
||||
|
@ -1201,7 +1209,7 @@ ProjectExportDialog::ProjectExportDialog() {
|
|||
custom_feature_display = memnew(RichTextLabel);
|
||||
features_panel->add_child(custom_feature_display);
|
||||
custom_feature_display->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 10 * EDSCALE);
|
||||
custom_feature_display->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
custom_feature_display->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
feature_vb->add_margin_child(TTR("Feature List:"), features_panel, true);
|
||||
sections->add_child(feature_vb);
|
||||
|
||||
|
@ -1274,7 +1282,7 @@ ProjectExportDialog::ProjectExportDialog() {
|
|||
export_pck_zip->add_filter("*.zip ; " + TTR("ZIP File"));
|
||||
export_pck_zip->add_filter("*.pck ; " + TTR("Godot Game Pack"));
|
||||
export_pck_zip->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
|
||||
export_pck_zip->set_mode(EditorFileDialog::MODE_SAVE_FILE);
|
||||
export_pck_zip->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
|
||||
add_child(export_pck_zip);
|
||||
export_pck_zip->connect("file_selected", callable_mp(this, &ProjectExportDialog::_export_pck_zip_selected));
|
||||
|
||||
|
@ -1300,7 +1308,7 @@ ProjectExportDialog::ProjectExportDialog() {
|
|||
|
||||
LinkButton *download_templates = memnew(LinkButton);
|
||||
download_templates->set_text(TTR("Manage Export Templates"));
|
||||
download_templates->set_v_size_flags(SIZE_SHRINK_CENTER);
|
||||
download_templates->set_v_size_flags(Control::SIZE_SHRINK_CENTER);
|
||||
export_templates_error->add_child(download_templates);
|
||||
download_templates->connect("pressed", callable_mp(this, &ProjectExportDialog::_open_export_template_manager));
|
||||
|
||||
|
|
|
@ -167,6 +167,7 @@ private:
|
|||
void _tab_changed(int);
|
||||
|
||||
protected:
|
||||
void _theme_changed();
|
||||
void _notification(int p_what);
|
||||
static void _bind_methods();
|
||||
|
||||
|
|
|
@ -117,22 +117,22 @@ private:
|
|||
|
||||
case MESSAGE_ERROR: {
|
||||
|
||||
msg->add_color_override("font_color", get_color("error_color", "Editor"));
|
||||
msg->add_color_override("font_color", msg->get_color("error_color", "Editor"));
|
||||
msg->set_modulate(Color(1, 1, 1, 1));
|
||||
new_icon = get_icon("StatusError", "EditorIcons");
|
||||
new_icon = msg->get_icon("StatusError", "EditorIcons");
|
||||
|
||||
} break;
|
||||
case MESSAGE_WARNING: {
|
||||
|
||||
msg->add_color_override("font_color", get_color("warning_color", "Editor"));
|
||||
msg->add_color_override("font_color", msg->get_color("warning_color", "Editor"));
|
||||
msg->set_modulate(Color(1, 1, 1, 1));
|
||||
new_icon = get_icon("StatusWarning", "EditorIcons");
|
||||
new_icon = msg->get_icon("StatusWarning", "EditorIcons");
|
||||
|
||||
} break;
|
||||
case MESSAGE_SUCCESS: {
|
||||
|
||||
msg->set_modulate(Color(1, 1, 1, 0));
|
||||
new_icon = get_icon("StatusSuccess", "EditorIcons");
|
||||
new_icon = msg->get_icon("StatusSuccess", "EditorIcons");
|
||||
|
||||
} break;
|
||||
}
|
||||
|
@ -379,19 +379,19 @@ private:
|
|||
|
||||
if (mode == MODE_IMPORT) {
|
||||
|
||||
fdialog->set_mode(FileDialog::MODE_OPEN_FILE);
|
||||
fdialog->set_file_mode(FileDialog::FILE_MODE_OPEN_FILE);
|
||||
fdialog->clear_filters();
|
||||
fdialog->add_filter(vformat("project.godot ; %s %s", VERSION_NAME, TTR("Project")));
|
||||
fdialog->add_filter("*.zip ; " + TTR("ZIP File"));
|
||||
} else {
|
||||
fdialog->set_mode(FileDialog::MODE_OPEN_DIR);
|
||||
fdialog->set_file_mode(FileDialog::FILE_MODE_OPEN_DIR);
|
||||
}
|
||||
fdialog->popup_centered_ratio();
|
||||
}
|
||||
|
||||
void _browse_install_path() {
|
||||
fdialog_install->set_current_dir(install_path->get_text());
|
||||
fdialog_install->set_mode(FileDialog::MODE_OPEN_DIR);
|
||||
fdialog_install->set_file_mode(FileDialog::FILE_MODE_OPEN_DIR);
|
||||
fdialog_install->popup_centered_ratio();
|
||||
}
|
||||
|
||||
|
@ -418,12 +418,12 @@ private:
|
|||
} else {
|
||||
|
||||
dialog_error->set_text(TTR("Couldn't create folder."));
|
||||
dialog_error->popup_centered_minsize();
|
||||
dialog_error->popup_centered();
|
||||
}
|
||||
} else {
|
||||
|
||||
dialog_error->set_text(TTR("There is already a folder in this path with the specified name."));
|
||||
dialog_error->popup_centered_minsize();
|
||||
dialog_error->popup_centered();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -500,7 +500,7 @@ private:
|
|||
if (ProjectSettings::get_singleton()->save_custom(dir.plus_file("project.godot"), initial_settings, Vector<String>(), false) != OK) {
|
||||
set_message(TTR("Couldn't create project.godot in project path."), MESSAGE_ERROR);
|
||||
} else {
|
||||
ResourceSaver::save(dir.plus_file("icon.png"), get_icon("DefaultProjectIcon", "EditorIcons"));
|
||||
ResourceSaver::save(dir.plus_file("icon.png"), msg->get_icon("DefaultProjectIcon", "EditorIcons"));
|
||||
|
||||
FileAccess *f = FileAccess::open(dir.plus_file("default_env.tres"), FileAccess::WRITE);
|
||||
if (!f) {
|
||||
|
@ -529,7 +529,7 @@ private:
|
|||
if (!pkg) {
|
||||
|
||||
dialog_error->set_text(TTR("Error opening package file, not in ZIP format."));
|
||||
dialog_error->popup_centered_minsize();
|
||||
dialog_error->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -607,11 +607,11 @@ private:
|
|||
}
|
||||
|
||||
dialog_error->set_text(msg);
|
||||
dialog_error->popup_centered_minsize();
|
||||
dialog_error->popup_centered();
|
||||
|
||||
} else if (!project_path->get_text().ends_with(".zip")) {
|
||||
dialog_error->set_text(TTR("Package installed successfully!"));
|
||||
dialog_error->popup_centered_minsize();
|
||||
dialog_error->popup_centered();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -649,10 +649,10 @@ private:
|
|||
project_name->clear();
|
||||
_text_changed("");
|
||||
|
||||
if (status_rect->get_texture() == get_icon("StatusError", "EditorIcons"))
|
||||
if (status_rect->get_texture() == msg->get_icon("StatusError", "EditorIcons"))
|
||||
msg->show();
|
||||
|
||||
if (install_status_rect->get_texture() == get_icon("StatusError", "EditorIcons"))
|
||||
if (install_status_rect->get_texture() == msg->get_icon("StatusError", "EditorIcons"))
|
||||
msg->show();
|
||||
}
|
||||
|
||||
|
@ -788,7 +788,7 @@ public:
|
|||
_test_path();
|
||||
}
|
||||
|
||||
popup_centered_minsize(Size2(500, 0) * EDSCALE);
|
||||
popup_centered(Size2(500, 0) * EDSCALE);
|
||||
}
|
||||
|
||||
ProjectDialog() {
|
||||
|
@ -807,7 +807,7 @@ public:
|
|||
name_container->add_child(pnhb);
|
||||
|
||||
project_name = memnew(LineEdit);
|
||||
project_name->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
project_name->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
pnhb->add_child(project_name);
|
||||
|
||||
create_dir = memnew(Button);
|
||||
|
@ -826,7 +826,7 @@ public:
|
|||
path_container->add_child(pphb);
|
||||
|
||||
project_path = memnew(LineEdit);
|
||||
project_path->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
project_path->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
pphb->add_child(project_path);
|
||||
|
||||
install_path_container = memnew(VBoxContainer);
|
||||
|
@ -840,7 +840,7 @@ public:
|
|||
install_path_container->add_child(iphb);
|
||||
|
||||
install_path = memnew(LineEdit);
|
||||
install_path->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
install_path->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
iphb->add_child(install_path);
|
||||
|
||||
// status icon
|
||||
|
@ -878,7 +878,7 @@ public:
|
|||
rasterizer_button_group.instance();
|
||||
|
||||
Container *rvb = memnew(VBoxContainer);
|
||||
rvb->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
rvb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
rshb->add_child(rvb);
|
||||
Button *rs_button = memnew(CheckBox);
|
||||
rs_button->set_button_group(rasterizer_button_group);
|
||||
|
@ -897,7 +897,7 @@ public:
|
|||
TTR("The GLES2 renderer is currently unavailable, as it needs to be reworked for Godot 4.0.\nUse Godot 3.2 if you need GLES2 support.");
|
||||
|
||||
rvb = memnew(VBoxContainer);
|
||||
rvb->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
rvb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
rshb->add_child(rvb);
|
||||
rs_button = memnew(CheckBox);
|
||||
rs_button->set_button_group(rasterizer_button_group);
|
||||
|
@ -912,7 +912,7 @@ public:
|
|||
// Also set the tooltip on the label so it appears when hovering either the checkbox or label.
|
||||
l->set_tooltip(gles2_unsupported_tooltip);
|
||||
// Required for the tooltip to show.
|
||||
l->set_mouse_filter(MOUSE_FILTER_STOP);
|
||||
l->set_mouse_filter(Control::MOUSE_FILTER_STOP);
|
||||
rvb->add_child(l);
|
||||
|
||||
l = memnew(Label);
|
||||
|
@ -1118,7 +1118,7 @@ ProjectList::ProjectList() {
|
|||
_order_option = ProjectListFilter::FILTER_EDIT_DATE;
|
||||
|
||||
_scroll_children = memnew(VBoxContainer);
|
||||
_scroll_children->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
_scroll_children->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
add_child(_scroll_children);
|
||||
|
||||
_icon_load_index = 0;
|
||||
|
@ -1359,7 +1359,7 @@ void ProjectList::create_project_item_control(int p_index) {
|
|||
VBoxContainer *vb = memnew(VBoxContainer);
|
||||
if (item.grayed)
|
||||
vb->set_modulate(Color(1, 1, 1, 0.5));
|
||||
vb->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
vb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
hb->add_child(vb);
|
||||
Control *ec = memnew(Control);
|
||||
ec->set_custom_minimum_size(Size2(0, 1));
|
||||
|
@ -1372,7 +1372,7 @@ void ProjectList::create_project_item_control(int p_index) {
|
|||
vb->add_child(title);
|
||||
|
||||
HBoxContainer *path_hb = memnew(HBoxContainer);
|
||||
path_hb->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
path_hb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
vb->add_child(path_hb);
|
||||
|
||||
Button *show = memnew(Button);
|
||||
|
@ -1394,7 +1394,7 @@ void ProjectList::create_project_item_control(int p_index) {
|
|||
|
||||
Label *fpath = memnew(Label(item.path));
|
||||
path_hb->add_child(fpath);
|
||||
fpath->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
fpath->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
fpath->set_modulate(Color(1, 1, 1, 0.5));
|
||||
fpath->add_color_override("font_color", font_color);
|
||||
fpath->set_clip_text(true);
|
||||
|
@ -1833,13 +1833,13 @@ void ProjectManager::_notification(int p_what) {
|
|||
case NOTIFICATION_RESIZED: {
|
||||
|
||||
if (open_templates->is_visible()) {
|
||||
open_templates->popup_centered_minsize();
|
||||
open_templates->popup_centered();
|
||||
}
|
||||
} break;
|
||||
case NOTIFICATION_READY: {
|
||||
|
||||
if (_project_list->get_project_count() == 0 && StreamPeerSSL::is_available())
|
||||
open_templates->popup_centered_minsize();
|
||||
open_templates->popup_centered();
|
||||
|
||||
if (_project_list->get_project_count() >= 1) {
|
||||
// Focus on the search box immediately to allow the user
|
||||
|
@ -2059,7 +2059,7 @@ void ProjectManager::_open_selected_projects() {
|
|||
|
||||
if (!FileAccess::exists(conf)) {
|
||||
dialog_error->set_text(vformat(TTR("Can't open project at '%s'."), path));
|
||||
dialog_error->popup_centered_minsize();
|
||||
dialog_error->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2097,7 +2097,7 @@ void ProjectManager::_open_selected_projects_ask() {
|
|||
|
||||
if (selected_list.size() > 1) {
|
||||
multi_open_ask->set_text(TTR("Are you sure to open more than one project?"));
|
||||
multi_open_ask->popup_centered_minsize();
|
||||
multi_open_ask->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2113,19 +2113,19 @@ void ProjectManager::_open_selected_projects_ask() {
|
|||
// Check if the config_version property was empty or 0
|
||||
if (config_version == 0) {
|
||||
ask_update_settings->set_text(vformat(TTR("The following project settings file does not specify the version of Godot through which it was created.\n\n%s\n\nIf you proceed with opening it, it will be converted to Godot's current configuration file format.\nWarning: You won't be able to open the project with previous versions of the engine anymore."), conf));
|
||||
ask_update_settings->popup_centered_minsize();
|
||||
ask_update_settings->popup_centered();
|
||||
return;
|
||||
}
|
||||
// Check if we need to convert project settings from an earlier engine version
|
||||
if (config_version < ProjectSettings::CONFIG_VERSION) {
|
||||
ask_update_settings->set_text(vformat(TTR("The following project settings file was generated by an older engine version, and needs to be converted for this version:\n\n%s\n\nDo you want to convert it?\nWarning: You won't be able to open the project with previous versions of the engine anymore."), conf));
|
||||
ask_update_settings->popup_centered_minsize();
|
||||
ask_update_settings->popup_centered();
|
||||
return;
|
||||
}
|
||||
// Check if the file was generated by a newer, incompatible engine version
|
||||
if (config_version > ProjectSettings::CONFIG_VERSION) {
|
||||
dialog_error->set_text(vformat(TTR("Can't open project at '%s'.") + "\n" + TTR("The project settings were created by a newer engine version, whose settings are not compatible with this version."), project.path));
|
||||
dialog_error->popup_centered_minsize();
|
||||
dialog_error->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2185,7 +2185,7 @@ void ProjectManager::_run_project() {
|
|||
|
||||
if (selected_list.size() > 1) {
|
||||
multi_run_ask->set_text(vformat(TTR("Are you sure to run %d projects at once?"), selected_list.size()));
|
||||
multi_run_ask->popup_centered_minsize();
|
||||
multi_run_ask->popup_centered();
|
||||
} else {
|
||||
_run_project_confirm();
|
||||
}
|
||||
|
@ -2282,13 +2282,13 @@ void ProjectManager::_erase_project() {
|
|||
}
|
||||
|
||||
erase_ask->set_text(confirm_message);
|
||||
erase_ask->popup_centered_minsize();
|
||||
erase_ask->popup_centered();
|
||||
}
|
||||
|
||||
void ProjectManager::_erase_missing_projects() {
|
||||
|
||||
erase_missing_ask->set_text(TTR("Remove all missing projects from the list?\nThe project folders' contents won't be modified."));
|
||||
erase_missing_ask->popup_centered_minsize();
|
||||
erase_missing_ask->popup_centered();
|
||||
}
|
||||
|
||||
void ProjectManager::_language_selected(int p_id) {
|
||||
|
@ -2363,7 +2363,7 @@ void ProjectManager::_files_dropped(PackedStringArray p_files, int p_screen) {
|
|||
multi_scan_ask->get_ok()->connect("pressed", callable_mp(this, &ProjectManager::_scan_multiple_folders), varray(folders));
|
||||
multi_scan_ask->set_text(
|
||||
vformat(TTR("Are you sure to scan %s folders for existing Godot projects?\nThis could take a while."), folders.size()));
|
||||
multi_scan_ask->popup_centered_minsize();
|
||||
multi_scan_ask->popup_centered();
|
||||
} else {
|
||||
_scan_multiple_folders(folders);
|
||||
}
|
||||
|
@ -2468,7 +2468,7 @@ ProjectManager::ProjectManager() {
|
|||
DisplayServer::get_singleton()->window_set_title(VERSION_NAME + String(" - ") + TTR("Project Manager") + " - " + cp + " 2007-2020 Juan Linietsky, Ariel Manzur & Godot Contributors");
|
||||
|
||||
Control *center_box = memnew(Control);
|
||||
center_box->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
center_box->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
vb->add_child(center_box);
|
||||
|
||||
tabs = memnew(TabContainer);
|
||||
|
@ -2485,7 +2485,7 @@ ProjectManager::ProjectManager() {
|
|||
|
||||
VBoxContainer *search_tree_vb = memnew(VBoxContainer);
|
||||
tree_hb->add_child(search_tree_vb);
|
||||
search_tree_vb->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
search_tree_vb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
HBoxContainer *sort_filters = memnew(HBoxContainer);
|
||||
Label *sort_label = memnew(Label);
|
||||
|
@ -2519,7 +2519,7 @@ ProjectManager::ProjectManager() {
|
|||
PanelContainer *pc = memnew(PanelContainer);
|
||||
pc->add_style_override("panel", gui_base->get_stylebox("bg", "Tree"));
|
||||
search_tree_vb->add_child(pc);
|
||||
pc->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
pc->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
_project_list = memnew(ProjectList);
|
||||
_project_list->connect(ProjectList::SIGNAL_SELECTION_CHANGED, callable_mp(this, &ProjectManager::_update_project_buttons));
|
||||
|
@ -2553,7 +2553,7 @@ ProjectManager::ProjectManager() {
|
|||
|
||||
scan_dir = memnew(FileDialog);
|
||||
scan_dir->set_access(FileDialog::ACCESS_FILESYSTEM);
|
||||
scan_dir->set_mode(FileDialog::MODE_OPEN_DIR);
|
||||
scan_dir->set_file_mode(FileDialog::FILE_MODE_OPEN_DIR);
|
||||
scan_dir->set_title(TTR("Select a Folder to Scan")); // must be after mode or it's overridden
|
||||
scan_dir->set_current_dir(EditorSettings::get_singleton()->get("filesystem/directories/default_project_path"));
|
||||
gui_base->add_child(scan_dir);
|
||||
|
@ -2775,7 +2775,7 @@ void ProjectListFilter::add_search_box() {
|
|||
search_box = memnew(LineEdit);
|
||||
search_box->set_placeholder(TTR("Search"));
|
||||
search_box->connect("text_changed", callable_mp(this, &ProjectListFilter::_search_text_changed));
|
||||
search_box->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
add_child(search_box);
|
||||
|
||||
has_search_box = true;
|
||||
|
|
|
@ -80,7 +80,7 @@ void ProjectSettingsEditor::_unhandled_input(const Ref<InputEvent> &p_event) {
|
|||
|
||||
const Ref<InputEventKey> k = p_event;
|
||||
|
||||
if (k.is_valid() && is_window_modal_on_top() && k->is_pressed()) {
|
||||
if (k.is_valid() && k->is_pressed()) {
|
||||
|
||||
if (k->get_keycode_with_modifiers() == (KEY_MASK_CMD | KEY_F)) {
|
||||
if (search_button->is_pressed()) {
|
||||
|
@ -91,7 +91,7 @@ void ProjectSettingsEditor::_unhandled_input(const Ref<InputEvent> &p_event) {
|
|||
search_button->set_pressed(true);
|
||||
}
|
||||
|
||||
accept_event();
|
||||
set_input_as_handled();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -99,22 +99,28 @@ void ProjectSettingsEditor::_unhandled_input(const Ref<InputEvent> &p_event) {
|
|||
void ProjectSettingsEditor::_notification(int p_what) {
|
||||
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||
if (!is_visible()) {
|
||||
EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "project_settings", Rect2(get_position(), get_size()));
|
||||
set_process_unhandled_input(false);
|
||||
}
|
||||
} break;
|
||||
case NOTIFICATION_ENTER_TREE: {
|
||||
globals_editor->edit(ProjectSettings::get_singleton());
|
||||
|
||||
search_button->set_icon(get_icon("Search", "EditorIcons"));
|
||||
search_box->set_right_icon(get_icon("Search", "EditorIcons"));
|
||||
search_button->set_icon(input_editor->get_icon("Search", "EditorIcons"));
|
||||
search_box->set_right_icon(input_editor->get_icon("Search", "EditorIcons"));
|
||||
search_box->set_clear_button_enabled(true);
|
||||
|
||||
action_add_error->add_color_override("font_color", get_color("error_color", "Editor"));
|
||||
action_add_error->add_color_override("font_color", input_editor->get_color("error_color", "Editor"));
|
||||
|
||||
translation_list->connect("button_pressed", callable_mp(this, &ProjectSettingsEditor::_translation_delete));
|
||||
_update_actions();
|
||||
popup_add->add_icon_item(get_icon("Keyboard", "EditorIcons"), TTR("Key"), INPUT_KEY); //"Key " - because the word 'key' has already been used as a key animation
|
||||
popup_add->add_icon_item(get_icon("KeyboardPhysical", "EditorIcons"), TTR("Physical Key"), INPUT_KEY_PHYSICAL);
|
||||
popup_add->add_icon_item(get_icon("JoyButton", "EditorIcons"), TTR("Joy Button"), INPUT_JOY_BUTTON);
|
||||
popup_add->add_icon_item(get_icon("JoyAxis", "EditorIcons"), TTR("Joy Axis"), INPUT_JOY_MOTION);
|
||||
popup_add->add_icon_item(get_icon("Mouse", "EditorIcons"), TTR("Mouse Button"), INPUT_MOUSE_BUTTON);
|
||||
popup_add->add_icon_item(input_editor->get_icon("Keyboard", "EditorIcons"), TTR("Key"), INPUT_KEY);
|
||||
popup_add->add_icon_item(input_editor->get_icon("KeyboardPhysical", "EditorIcons"), TTR("Physical Key"), INPUT_KEY_PHYSICAL);
|
||||
popup_add->add_icon_item(input_editor->get_icon("JoyButton", "EditorIcons"), TTR("Joy Button"), INPUT_JOY_BUTTON);
|
||||
popup_add->add_icon_item(input_editor->get_icon("JoyAxis", "EditorIcons"), TTR("Joy Axis"), INPUT_JOY_MOTION);
|
||||
popup_add->add_icon_item(input_editor->get_icon("Mouse", "EditorIcons"), TTR("Mouse Button"), INPUT_MOUSE_BUTTON);
|
||||
|
||||
List<String> tfn;
|
||||
ResourceLoader::get_recognized_extensions_for_type("Translation", &tfn);
|
||||
|
@ -131,26 +137,22 @@ void ProjectSettingsEditor::_notification(int p_what) {
|
|||
translation_res_option_file_open->add_filter("*." + E->get());
|
||||
}
|
||||
|
||||
restart_close_button->set_icon(get_icon("Close", "EditorIcons"));
|
||||
restart_container->add_style_override("panel", get_stylebox("bg", "Tree"));
|
||||
restart_icon->set_texture(get_icon("StatusWarning", "EditorIcons"));
|
||||
restart_label->add_color_override("font_color", get_color("warning_color", "Editor"));
|
||||
restart_close_button->set_icon(input_editor->get_icon("Close", "EditorIcons"));
|
||||
restart_container->add_style_override("panel", input_editor->get_stylebox("bg", "Tree"));
|
||||
restart_icon->set_texture(input_editor->get_icon("StatusWarning", "EditorIcons"));
|
||||
restart_label->add_color_override("font_color", input_editor->get_color("warning_color", "Editor"));
|
||||
|
||||
} break;
|
||||
case NOTIFICATION_POPUP_HIDE: {
|
||||
EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "project_settings", get_rect());
|
||||
set_process_unhandled_input(false);
|
||||
} break;
|
||||
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
||||
search_button->set_icon(get_icon("Search", "EditorIcons"));
|
||||
search_box->set_right_icon(get_icon("Search", "EditorIcons"));
|
||||
search_button->set_icon(input_editor->get_icon("Search", "EditorIcons"));
|
||||
search_box->set_right_icon(input_editor->get_icon("Search", "EditorIcons"));
|
||||
search_box->set_clear_button_enabled(true);
|
||||
action_add_error->add_color_override("font_color", get_color("error_color", "Editor"));
|
||||
popup_add->set_item_icon(popup_add->get_item_index(INPUT_KEY), get_icon("Keyboard", "EditorIcons"));
|
||||
popup_add->set_item_icon(popup_add->get_item_index(INPUT_KEY_PHYSICAL), get_icon("KeyboardPhysical", "EditorIcons"));
|
||||
popup_add->set_item_icon(popup_add->get_item_index(INPUT_JOY_BUTTON), get_icon("JoyButton", "EditorIcons"));
|
||||
popup_add->set_item_icon(popup_add->get_item_index(INPUT_JOY_MOTION), get_icon("JoyAxis", "EditorIcons"));
|
||||
popup_add->set_item_icon(popup_add->get_item_index(INPUT_MOUSE_BUTTON), get_icon("Mouse", "EditorIcons"));
|
||||
action_add_error->add_color_override("font_color", input_editor->get_color("error_color", "Editor"));
|
||||
popup_add->set_item_icon(popup_add->get_item_index(INPUT_KEY), input_editor->get_icon("Keyboard", "EditorIcons"));
|
||||
popup_add->set_item_icon(popup_add->get_item_index(INPUT_KEY_PHYSICAL), input_editor->get_icon("KeyboardPhysical", "EditorIcons"));
|
||||
popup_add->set_item_icon(popup_add->get_item_index(INPUT_JOY_BUTTON), input_editor->get_icon("JoyButton", "EditorIcons"));
|
||||
popup_add->set_item_icon(popup_add->get_item_index(INPUT_JOY_MOTION), input_editor->get_icon("JoyAxis", "EditorIcons"));
|
||||
popup_add->set_item_icon(popup_add->get_item_index(INPUT_MOUSE_BUTTON), input_editor->get_icon("Mouse", "EditorIcons"));
|
||||
_update_actions();
|
||||
} break;
|
||||
}
|
||||
|
@ -462,7 +464,7 @@ void ProjectSettingsEditor::_wait_for_key(const Ref<InputEvent> &p_event) {
|
|||
|
||||
press_a_key_label->set_text(str);
|
||||
press_a_key->get_ok()->set_disabled(false);
|
||||
press_a_key->accept_event();
|
||||
press_a_key->set_input_as_handled();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -479,7 +481,7 @@ void ProjectSettingsEditor::_add_item(int p_item, Ref<InputEvent> p_exiting_even
|
|||
press_a_key->get_ok()->set_disabled(true);
|
||||
last_wait_for_key = Ref<InputEvent>();
|
||||
press_a_key->popup_centered(Size2(250, 80) * EDSCALE);
|
||||
press_a_key->grab_focus();
|
||||
//press_a_key->grab_focus();
|
||||
|
||||
} break;
|
||||
case INPUT_KEY_PHYSICAL: {
|
||||
|
@ -505,7 +507,7 @@ void ProjectSettingsEditor::_add_item(int p_item, Ref<InputEvent> p_exiting_even
|
|||
device_index->add_item(TTR("Wheel Right Button"));
|
||||
device_index->add_item(TTR("X Button 1"));
|
||||
device_index->add_item(TTR("X Button 2"));
|
||||
device_input->popup_centered_minsize(Size2(350, 95) * EDSCALE);
|
||||
device_input->popup_centered(Size2(350, 95) * EDSCALE);
|
||||
|
||||
Ref<InputEventMouseButton> mb = p_exiting_event;
|
||||
if (mb.is_valid()) {
|
||||
|
@ -527,7 +529,7 @@ void ProjectSettingsEditor::_add_item(int p_item, Ref<InputEvent> p_exiting_even
|
|||
String desc = _axis_names[i];
|
||||
device_index->add_item(TTR("Axis") + " " + itos(i / 2) + " " + ((i & 1) ? "+" : "-") + desc);
|
||||
}
|
||||
device_input->popup_centered_minsize(Size2(350, 95) * EDSCALE);
|
||||
device_input->popup_centered(Size2(350, 95) * EDSCALE);
|
||||
|
||||
Ref<InputEventJoypadMotion> jm = p_exiting_event;
|
||||
if (jm.is_valid()) {
|
||||
|
@ -549,7 +551,7 @@ void ProjectSettingsEditor::_add_item(int p_item, Ref<InputEvent> p_exiting_even
|
|||
|
||||
device_index->add_item(itos(i) + ": " + String(_button_names[i]));
|
||||
}
|
||||
device_input->popup_centered_minsize(Size2(350, 95) * EDSCALE);
|
||||
device_input->popup_centered(Size2(350, 95) * EDSCALE);
|
||||
|
||||
Ref<InputEventJoypadButton> jb = p_exiting_event;
|
||||
if (jb.is_valid()) {
|
||||
|
@ -738,7 +740,7 @@ void ProjectSettingsEditor::_update_actions() {
|
|||
|
||||
TreeItem *item = input_editor->create_item(root);
|
||||
item->set_text(0, name);
|
||||
item->set_custom_bg_color(0, get_color("prop_subsection", "Editor"));
|
||||
item->set_custom_bg_color(0, input_editor->get_color("prop_subsection", "Editor"));
|
||||
if (collapsed.has(name))
|
||||
item->set_collapsed(collapsed[name]);
|
||||
|
||||
|
@ -746,12 +748,12 @@ void ProjectSettingsEditor::_update_actions() {
|
|||
item->set_cell_mode(1, TreeItem::CELL_MODE_RANGE);
|
||||
item->set_range_config(1, 0.0, 1.0, 0.01);
|
||||
item->set_range(1, action["deadzone"]);
|
||||
item->set_custom_bg_color(1, get_color("prop_subsection", "Editor"));
|
||||
item->set_custom_bg_color(1, input_editor->get_color("prop_subsection", "Editor"));
|
||||
|
||||
const bool is_builtin_input = ProjectSettings::get_singleton()->get_input_presets().find(pi.name) != NULL;
|
||||
const String tooltip = is_builtin_input ? TTR("Built-in actions can't be removed as they're used for UI navigation.") : TTR("Remove");
|
||||
item->add_button(2, get_icon("Add", "EditorIcons"), 1, false, TTR("Add Event"));
|
||||
item->add_button(2, get_icon("Remove", "EditorIcons"), 2, false, tooltip);
|
||||
item->add_button(2, input_editor->get_icon("Add", "EditorIcons"), 1, false, TTR("Add Event"));
|
||||
item->add_button(2, input_editor->get_icon("Remove", "EditorIcons"), 2, false, tooltip);
|
||||
|
||||
if (is_builtin_input) {
|
||||
// Built-in action (like `ui_up`). Make the action not removable,
|
||||
|
@ -778,9 +780,9 @@ void ProjectSettingsEditor::_update_actions() {
|
|||
|
||||
action2->set_text(0, str);
|
||||
if ((k->get_keycode() != 0)) {
|
||||
action2->set_icon(0, get_icon("Keyboard", "EditorIcons"));
|
||||
action2->set_icon(0, input_editor->get_icon("Keyboard", "EditorIcons"));
|
||||
} else {
|
||||
action2->set_icon(0, get_icon("KeyboardPhysical", "EditorIcons"));
|
||||
action2->set_icon(0, input_editor->get_icon("KeyboardPhysical", "EditorIcons"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -794,7 +796,7 @@ void ProjectSettingsEditor::_update_actions() {
|
|||
}
|
||||
|
||||
action2->set_text(0, str);
|
||||
action2->set_icon(0, get_icon("JoyButton", "EditorIcons"));
|
||||
action2->set_icon(0, input_editor->get_icon("JoyButton", "EditorIcons"));
|
||||
}
|
||||
|
||||
Ref<InputEventMouseButton> mb = event;
|
||||
|
@ -811,7 +813,7 @@ void ProjectSettingsEditor::_update_actions() {
|
|||
}
|
||||
|
||||
action2->set_text(0, str);
|
||||
action2->set_icon(0, get_icon("Mouse", "EditorIcons"));
|
||||
action2->set_icon(0, input_editor->get_icon("Mouse", "EditorIcons"));
|
||||
}
|
||||
|
||||
Ref<InputEventJoypadMotion> jm = event;
|
||||
|
@ -823,13 +825,13 @@ void ProjectSettingsEditor::_update_actions() {
|
|||
String desc = _axis_names[n];
|
||||
String str = _get_device_string(jm->get_device()) + ", " + TTR("Axis") + " " + itos(ax) + " " + (jm->get_axis_value() < 0 ? "-" : "+") + desc;
|
||||
action2->set_text(0, str);
|
||||
action2->set_icon(0, get_icon("JoyAxis", "EditorIcons"));
|
||||
action2->set_icon(0, input_editor->get_icon("JoyAxis", "EditorIcons"));
|
||||
}
|
||||
action2->set_metadata(0, i);
|
||||
action2->set_meta("__input", event);
|
||||
|
||||
action2->add_button(2, get_icon("Edit", "EditorIcons"), 3, false, TTR("Edit"));
|
||||
action2->add_button(2, get_icon("Remove", "EditorIcons"), 2, false, TTR("Remove"));
|
||||
action2->add_button(2, input_editor->get_icon("Edit", "EditorIcons"), 3, false, TTR("Edit"));
|
||||
action2->add_button(2, input_editor->get_icon("Remove", "EditorIcons"), 2, false, TTR("Remove"));
|
||||
// Fade out the individual event buttons slightly to make the
|
||||
// Add/Remove buttons stand out more.
|
||||
action2->set_button_color(2, 0, Color(1, 1, 1, 0.75));
|
||||
|
@ -1112,7 +1114,7 @@ Variant ProjectSettingsEditor::get_drag_data_fw(const Point2 &p_point, Control *
|
|||
hb->set_modulate(Color(1, 1, 1, 1.0f));
|
||||
hb->add_child(label);
|
||||
vb->add_child(hb);
|
||||
set_drag_preview(vb);
|
||||
input_editor->set_drag_preview(vb);
|
||||
|
||||
Dictionary drag_data;
|
||||
drag_data["type"] = "nodes";
|
||||
|
@ -1547,7 +1549,7 @@ void ProjectSettingsEditor::_update_translations() {
|
|||
t->set_text(0, translations[i].replace_first("res://", ""));
|
||||
t->set_tooltip(0, translations[i]);
|
||||
t->set_metadata(0, i);
|
||||
t->add_button(0, get_icon("Remove", "EditorIcons"), 0, false, TTR("Remove"));
|
||||
t->add_button(0, input_editor->get_icon("Remove", "EditorIcons"), 0, false, TTR("Remove"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1670,7 +1672,7 @@ void ProjectSettingsEditor::_update_translations() {
|
|||
t->set_text(0, keys[i].replace_first("res://", ""));
|
||||
t->set_tooltip(0, keys[i]);
|
||||
t->set_metadata(0, keys[i]);
|
||||
t->add_button(0, get_icon("Remove", "EditorIcons"), 0, false, TTR("Remove"));
|
||||
t->add_button(0, input_editor->get_icon("Remove", "EditorIcons"), 0, false, TTR("Remove"));
|
||||
if (keys[i] == remap_selected) {
|
||||
t->select(0);
|
||||
translation_res_option_add_button->set_disabled(false);
|
||||
|
@ -1688,7 +1690,7 @@ void ProjectSettingsEditor::_update_translations() {
|
|||
t2->set_text(0, path.replace_first("res://", ""));
|
||||
t2->set_tooltip(0, path);
|
||||
t2->set_metadata(0, j);
|
||||
t2->add_button(0, get_icon("Remove", "EditorIcons"), 0, false, TTR("Remove"));
|
||||
t2->add_button(0, input_editor->get_icon("Remove", "EditorIcons"), 0, false, TTR("Remove"));
|
||||
t2->set_cell_mode(1, TreeItem::CELL_MODE_RANGE);
|
||||
t2->set_text(1, langnames);
|
||||
t2->set_editable(1, true);
|
||||
|
@ -1774,7 +1776,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
|
|||
|
||||
singleton = this;
|
||||
set_title(TTR("Project Settings (project.godot)"));
|
||||
set_resizable(true);
|
||||
|
||||
undo_redo = &p_data->get_undo_redo();
|
||||
data = p_data;
|
||||
|
||||
|
@ -1883,7 +1885,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
|
|||
HBoxContainer *restart_hb = memnew(HBoxContainer);
|
||||
restart_container->add_child(restart_hb);
|
||||
restart_icon = memnew(TextureRect);
|
||||
restart_icon->set_v_size_flags(SIZE_SHRINK_CENTER);
|
||||
restart_icon->set_v_size_flags(Control::SIZE_SHRINK_CENTER);
|
||||
restart_hb->add_child(restart_icon);
|
||||
restart_label = memnew(Label);
|
||||
restart_label->set_text(TTR("The editor must be restarted for changes to take effect."));
|
||||
|
@ -1907,10 +1909,10 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
|
|||
|
||||
VBoxContainer *vbc = memnew(VBoxContainer);
|
||||
input_base->add_child(vbc);
|
||||
vbc->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 0);
|
||||
vbc->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 0);
|
||||
vbc->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 0);
|
||||
vbc->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 0);
|
||||
vbc->set_anchor_and_margin(MARGIN_TOP, Control::ANCHOR_BEGIN, 0);
|
||||
vbc->set_anchor_and_margin(MARGIN_BOTTOM, Control::ANCHOR_END, 0);
|
||||
vbc->set_anchor_and_margin(MARGIN_LEFT, Control::ANCHOR_BEGIN, 0);
|
||||
vbc->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, 0);
|
||||
|
||||
hbc = memnew(HBoxContainer);
|
||||
vbc->add_child(hbc);
|
||||
|
@ -1920,7 +1922,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
|
|||
l->set_text(TTR("Action:"));
|
||||
|
||||
action_name = memnew(LineEdit);
|
||||
action_name->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
action_name->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
hbc->add_child(action_name);
|
||||
action_name->connect("text_entered", callable_mp(this, &ProjectSettingsEditor::_action_adds));
|
||||
action_name->connect("text_changed", callable_mp(this, &ProjectSettingsEditor::_action_check));
|
||||
|
@ -1938,7 +1940,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
|
|||
|
||||
input_editor = memnew(Tree);
|
||||
vbc->add_child(input_editor);
|
||||
input_editor->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
input_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
input_editor->set_columns(3);
|
||||
input_editor->set_column_titles_visible(true);
|
||||
input_editor->set_column_title(0, TTR("Action"));
|
||||
|
@ -1951,7 +1953,10 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
|
|||
input_editor->connect("item_activated", callable_mp(this, &ProjectSettingsEditor::_action_activated));
|
||||
input_editor->connect("cell_selected", callable_mp(this, &ProjectSettingsEditor::_action_selected));
|
||||
input_editor->connect("button_pressed", callable_mp(this, &ProjectSettingsEditor::_action_button_pressed));
|
||||
input_editor->set_drag_forwarding(this);
|
||||
#ifndef _MSC_VER
|
||||
#warning need to make drag data forwarding to non controls happen
|
||||
#endif
|
||||
//input_editor->set_drag_forwarding(this);
|
||||
|
||||
popup_add = memnew(PopupMenu);
|
||||
add_child(popup_add);
|
||||
|
@ -1960,7 +1965,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
|
|||
press_a_key_physical = false;
|
||||
|
||||
press_a_key = memnew(ConfirmationDialog);
|
||||
press_a_key->set_focus_mode(FOCUS_ALL);
|
||||
//press_a_key->set_focus_mode(Control::FOCUS_ALL);
|
||||
add_child(press_a_key);
|
||||
|
||||
l = memnew(Label);
|
||||
|
@ -1968,11 +1973,11 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
|
|||
l->set_anchors_and_margins_preset(Control::PRESET_WIDE);
|
||||
l->set_align(Label::ALIGN_CENTER);
|
||||
l->set_margin(MARGIN_TOP, 20);
|
||||
l->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_BEGIN, 30);
|
||||
l->set_anchor_and_margin(MARGIN_BOTTOM, Control::ANCHOR_BEGIN, 30);
|
||||
press_a_key->get_ok()->set_disabled(true);
|
||||
press_a_key_label = l;
|
||||
press_a_key->add_child(l);
|
||||
press_a_key->connect("gui_input", callable_mp(this, &ProjectSettingsEditor::_wait_for_key));
|
||||
press_a_key->connect("window_input", callable_mp(this, &ProjectSettingsEditor::_wait_for_key));
|
||||
press_a_key->connect("confirmed", callable_mp(this, &ProjectSettingsEditor::_press_a_key_confirm));
|
||||
|
||||
device_input = memnew(ConfirmationDialog);
|
||||
|
@ -1998,7 +2003,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
|
|||
|
||||
VBoxContainer *vbc_right = memnew(VBoxContainer);
|
||||
hbc->add_child(vbc_right);
|
||||
vbc_right->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
vbc_right->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
l = memnew(Label);
|
||||
l->set_text(TTR("Index:"));
|
||||
|
@ -2035,14 +2040,14 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
|
|||
thb->add_child(addtr);
|
||||
VBoxContainer *tmc = memnew(VBoxContainer);
|
||||
tvb->add_child(tmc);
|
||||
tmc->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
tmc->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
translation_list = memnew(Tree);
|
||||
translation_list->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
translation_list->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
tmc->add_child(translation_list);
|
||||
|
||||
translation_file_open = memnew(EditorFileDialog);
|
||||
add_child(translation_file_open);
|
||||
translation_file_open->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
translation_file_open->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
translation_file_open->connect("file_selected", callable_mp(this, &ProjectSettingsEditor::_translation_add));
|
||||
}
|
||||
|
||||
|
@ -2059,16 +2064,16 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
|
|||
thb->add_child(addtr);
|
||||
VBoxContainer *tmc = memnew(VBoxContainer);
|
||||
tvb->add_child(tmc);
|
||||
tmc->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
tmc->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
translation_remap = memnew(Tree);
|
||||
translation_remap->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
translation_remap->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
translation_remap->connect("cell_selected", callable_mp(this, &ProjectSettingsEditor::_translation_res_select));
|
||||
tmc->add_child(translation_remap);
|
||||
translation_remap->connect("button_pressed", callable_mp(this, &ProjectSettingsEditor::_translation_res_delete));
|
||||
|
||||
translation_res_file_open = memnew(EditorFileDialog);
|
||||
add_child(translation_res_file_open);
|
||||
translation_res_file_open->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
translation_res_file_open->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
translation_res_file_open->connect("file_selected", callable_mp(this, &ProjectSettingsEditor::_translation_res_add));
|
||||
|
||||
thb = memnew(HBoxContainer);
|
||||
|
@ -2081,9 +2086,9 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
|
|||
thb->add_child(addtr);
|
||||
tmc = memnew(VBoxContainer);
|
||||
tvb->add_child(tmc);
|
||||
tmc->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
tmc->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
translation_remap_options = memnew(Tree);
|
||||
translation_remap_options->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
translation_remap_options->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
tmc->add_child(translation_remap_options);
|
||||
|
||||
translation_remap_options->set_columns(2);
|
||||
|
@ -2098,7 +2103,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
|
|||
|
||||
translation_res_option_file_open = memnew(EditorFileDialog);
|
||||
add_child(translation_res_option_file_open);
|
||||
translation_res_option_file_open->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
translation_res_option_file_open->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
translation_res_option_file_open->connect("file_selected", callable_mp(this, &ProjectSettingsEditor::_translation_res_option_add));
|
||||
}
|
||||
|
||||
|
@ -2107,7 +2112,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
|
|||
translations->add_child(tvb);
|
||||
tvb->set_name(TTR("Locales Filter"));
|
||||
VBoxContainer *tmc = memnew(VBoxContainer);
|
||||
tmc->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
tmc->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
tvb->add_child(tmc);
|
||||
|
||||
translation_locale_filter_mode = memnew(OptionButton);
|
||||
|
@ -2118,7 +2123,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
|
|||
translation_locale_filter_mode->connect("item_selected", callable_mp(this, &ProjectSettingsEditor::_translation_filter_mode_changed));
|
||||
|
||||
translation_filter = memnew(Tree);
|
||||
translation_filter->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
translation_filter->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
translation_filter->set_columns(1);
|
||||
tmc->add_child(memnew(Label(TTR("Locales:"))));
|
||||
tmc->add_child(translation_filter);
|
||||
|
|
|
@ -151,7 +151,7 @@ void CustomPropertyEditor::_menu_option(int p_which) {
|
|||
switch (p_which) {
|
||||
case OBJ_MENU_LOAD: {
|
||||
|
||||
file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
String type = (hint == PROPERTY_HINT_RESOURCE_TYPE) ? hint_text : String();
|
||||
|
||||
List<String> extensions;
|
||||
|
@ -1105,7 +1105,7 @@ void CustomPropertyEditor::_file_selected(String p_file) {
|
|||
RES res = ResourceLoader::load(p_file, type);
|
||||
if (res.is_null()) {
|
||||
error->set_text(TTR("Error loading file: Not a resource!"));
|
||||
error->popup_centered_minsize();
|
||||
error->popup_centered();
|
||||
break;
|
||||
}
|
||||
v = res;
|
||||
|
@ -1282,7 +1282,7 @@ void CustomPropertyEditor::_action_pressed(int p_which) {
|
|||
else
|
||||
file->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
|
||||
|
||||
file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
file->clear_filters();
|
||||
|
||||
file->clear_filters();
|
||||
|
@ -1316,7 +1316,7 @@ void CustomPropertyEditor::_action_pressed(int p_which) {
|
|||
file->set_access(EditorFileDialog::ACCESS_RESOURCES);
|
||||
else
|
||||
file->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
|
||||
file->set_mode(EditorFileDialog::MODE_OPEN_DIR);
|
||||
file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_DIR);
|
||||
file->clear_filters();
|
||||
file->popup_centered_ratio();
|
||||
} else {
|
||||
|
@ -1385,7 +1385,7 @@ void CustomPropertyEditor::_action_pressed(int p_which) {
|
|||
} else if (p_which == 1) {
|
||||
|
||||
file->set_access(EditorFileDialog::ACCESS_RESOURCES);
|
||||
file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
List<String> extensions;
|
||||
String type = (hint == PROPERTY_HINT_RESOURCE_TYPE) ? hint_text : String();
|
||||
|
||||
|
|
|
@ -121,33 +121,33 @@ void PropertySelector::_update_search() {
|
|||
bool found = false;
|
||||
|
||||
Ref<Texture2D> type_icons[Variant::VARIANT_MAX] = {
|
||||
Control::get_icon("Variant", "EditorIcons"),
|
||||
Control::get_icon("bool", "EditorIcons"),
|
||||
Control::get_icon("int", "EditorIcons"),
|
||||
Control::get_icon("float", "EditorIcons"),
|
||||
Control::get_icon("String", "EditorIcons"),
|
||||
Control::get_icon("Vector2", "EditorIcons"),
|
||||
Control::get_icon("Rect2", "EditorIcons"),
|
||||
Control::get_icon("Vector3", "EditorIcons"),
|
||||
Control::get_icon("Transform2D", "EditorIcons"),
|
||||
Control::get_icon("Plane", "EditorIcons"),
|
||||
Control::get_icon("Quat", "EditorIcons"),
|
||||
Control::get_icon("AABB", "EditorIcons"),
|
||||
Control::get_icon("Basis", "EditorIcons"),
|
||||
Control::get_icon("Transform", "EditorIcons"),
|
||||
Control::get_icon("Color", "EditorIcons"),
|
||||
Control::get_icon("Path", "EditorIcons"),
|
||||
Control::get_icon("RID", "EditorIcons"),
|
||||
Control::get_icon("Object", "EditorIcons"),
|
||||
Control::get_icon("Dictionary", "EditorIcons"),
|
||||
Control::get_icon("Array", "EditorIcons"),
|
||||
Control::get_icon("PackedByteArray", "EditorIcons"),
|
||||
Control::get_icon("PackedInt32Array", "EditorIcons"),
|
||||
Control::get_icon("PackedFloat32Array", "EditorIcons"),
|
||||
Control::get_icon("PackedStringArray", "EditorIcons"),
|
||||
Control::get_icon("PackedVector2Array", "EditorIcons"),
|
||||
Control::get_icon("PackedVector3Array", "EditorIcons"),
|
||||
Control::get_icon("PackedColorArray", "EditorIcons")
|
||||
search_options->get_icon("Variant", "EditorIcons"),
|
||||
search_options->get_icon("bool", "EditorIcons"),
|
||||
search_options->get_icon("int", "EditorIcons"),
|
||||
search_options->get_icon("float", "EditorIcons"),
|
||||
search_options->get_icon("String", "EditorIcons"),
|
||||
search_options->get_icon("Vector2", "EditorIcons"),
|
||||
search_options->get_icon("Rect2", "EditorIcons"),
|
||||
search_options->get_icon("Vector3", "EditorIcons"),
|
||||
search_options->get_icon("Transform2D", "EditorIcons"),
|
||||
search_options->get_icon("Plane", "EditorIcons"),
|
||||
search_options->get_icon("Quat", "EditorIcons"),
|
||||
search_options->get_icon("AABB", "EditorIcons"),
|
||||
search_options->get_icon("Basis", "EditorIcons"),
|
||||
search_options->get_icon("Transform", "EditorIcons"),
|
||||
search_options->get_icon("Color", "EditorIcons"),
|
||||
search_options->get_icon("Path", "EditorIcons"),
|
||||
search_options->get_icon("RID", "EditorIcons"),
|
||||
search_options->get_icon("Object", "EditorIcons"),
|
||||
search_options->get_icon("Dictionary", "EditorIcons"),
|
||||
search_options->get_icon("Array", "EditorIcons"),
|
||||
search_options->get_icon("PackedByteArray", "EditorIcons"),
|
||||
search_options->get_icon("PackedInt32Array", "EditorIcons"),
|
||||
search_options->get_icon("PackedFloat32Array", "EditorIcons"),
|
||||
search_options->get_icon("PackedStringArray", "EditorIcons"),
|
||||
search_options->get_icon("PackedVector2Array", "EditorIcons"),
|
||||
search_options->get_icon("PackedVector3Array", "EditorIcons"),
|
||||
search_options->get_icon("PackedColorArray", "EditorIcons")
|
||||
};
|
||||
|
||||
for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) {
|
||||
|
@ -161,7 +161,7 @@ void PropertySelector::_update_search() {
|
|||
|
||||
Ref<Texture2D> icon;
|
||||
if (E->get().name == "Script Variables") {
|
||||
icon = get_icon("Script", "EditorIcons");
|
||||
icon = search_options->get_icon("Script", "EditorIcons");
|
||||
} else {
|
||||
icon = EditorNode::get_singleton()->get_class_icon(E->get().name);
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ void PropertySelector::_update_search() {
|
|||
script_methods = false;
|
||||
String rep = E->get().name.replace("*", "");
|
||||
if (E->get().name == "*Script Methods") {
|
||||
icon = get_icon("Script", "EditorIcons");
|
||||
icon = search_options->get_icon("Script", "EditorIcons");
|
||||
script_methods = true;
|
||||
} else {
|
||||
icon = EditorNode::get_singleton()->get_class_icon(rep);
|
||||
|
@ -390,7 +390,7 @@ void PropertySelector::_item_selected() {
|
|||
}
|
||||
|
||||
void PropertySelector::_hide_requested() {
|
||||
_closed(); // From WindowDialog.
|
||||
_cancel_pressed(); // From AcceptDialog.
|
||||
}
|
||||
|
||||
void PropertySelector::_notification(int p_what) {
|
||||
|
|
|
@ -142,7 +142,7 @@ void EditorQuickOpen::_parse_fs(EditorFileSystemDirectory *efsd, Vector<Pair<Str
|
|||
if (search_text.is_subsequence_ofi(path)) {
|
||||
Pair<String, Ref<Texture2D>> pair;
|
||||
pair.first = path;
|
||||
pair.second = get_icon("folder", "FileDialog");
|
||||
pair.second = search_options->get_icon("folder", "FileDialog");
|
||||
|
||||
if (search_text != String() && list.size() > 0) {
|
||||
|
||||
|
@ -171,7 +171,7 @@ void EditorQuickOpen::_parse_fs(EditorFileSystemDirectory *efsd, Vector<Pair<Str
|
|||
if (ClassDB::is_parent_class(efsd->get_file_type(i), base_type) && (search_text.is_subsequence_ofi(file))) {
|
||||
Pair<String, Ref<Texture2D>> pair;
|
||||
pair.first = file;
|
||||
pair.second = get_icon((has_icon(efsd->get_file_type(i), ei) ? efsd->get_file_type(i) : ot), ei);
|
||||
pair.second = search_options->get_icon((search_options->has_icon(efsd->get_file_type(i), ei) ? efsd->get_file_type(i) : ot), ei);
|
||||
list.push_back(pair);
|
||||
}
|
||||
}
|
||||
|
@ -253,6 +253,11 @@ void EditorQuickOpen::_confirmed() {
|
|||
hide();
|
||||
}
|
||||
|
||||
void EditorQuickOpen::_theme_changed() {
|
||||
|
||||
search_box->set_right_icon(search_options->get_icon("Search", "EditorIcons"));
|
||||
}
|
||||
|
||||
void EditorQuickOpen::_notification(int p_what) {
|
||||
|
||||
switch (p_what) {
|
||||
|
@ -262,9 +267,6 @@ void EditorQuickOpen::_notification(int p_what) {
|
|||
search_box->set_clear_button_enabled(true);
|
||||
[[fallthrough]];
|
||||
}
|
||||
case NOTIFICATION_THEME_CHANGED: {
|
||||
search_box->set_right_icon(get_icon("Search", "EditorIcons"));
|
||||
} break;
|
||||
case NOTIFICATION_EXIT_TREE: {
|
||||
disconnect("confirmed", callable_mp(this, &EditorQuickOpen::_confirmed));
|
||||
} break;
|
||||
|
@ -284,6 +286,8 @@ void EditorQuickOpen::_bind_methods() {
|
|||
EditorQuickOpen::EditorQuickOpen() {
|
||||
|
||||
VBoxContainer *vbc = memnew(VBoxContainer);
|
||||
vbc->connect("theme_changed", callable_mp(this, &EditorQuickOpen::_theme_changed));
|
||||
|
||||
add_child(vbc);
|
||||
search_box = memnew(LineEdit);
|
||||
vbc->add_margin_child(TTR("Search:"), search_box);
|
||||
|
|
|
@ -56,6 +56,8 @@ class EditorQuickOpen : public ConfirmationDialog {
|
|||
void _confirmed();
|
||||
void _text_changed(const String &p_newtext);
|
||||
|
||||
void _theme_changed();
|
||||
|
||||
protected:
|
||||
void _notification(int p_what);
|
||||
static void _bind_methods();
|
||||
|
|
|
@ -56,7 +56,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
|
|||
|
||||
GridContainer *grd_main = memnew(GridContainer);
|
||||
grd_main->set_columns(2);
|
||||
grd_main->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
grd_main->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
vbc->add_child(grd_main);
|
||||
|
||||
// ---- 1st & 2nd row
|
||||
|
@ -67,7 +67,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
|
|||
lne_search = memnew(LineEdit);
|
||||
lne_search->set_placeholder(TTR("Search"));
|
||||
lne_search->set_name("lne_search");
|
||||
lne_search->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
lne_search->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
Label *lbl_replace = memnew(Label);
|
||||
lbl_replace->set_text(TTR("Replace"));
|
||||
|
@ -75,7 +75,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
|
|||
lne_replace = memnew(LineEdit);
|
||||
lne_replace->set_placeholder(TTR("Replace"));
|
||||
lne_replace->set_name("lne_replace");
|
||||
lne_replace->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
lne_replace->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
grd_main->add_child(lbl_search);
|
||||
grd_main->add_child(lbl_replace);
|
||||
|
@ -90,7 +90,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
|
|||
lne_prefix = memnew(LineEdit);
|
||||
lne_prefix->set_placeholder(TTR("Prefix"));
|
||||
lne_prefix->set_name("lne_prefix");
|
||||
lne_prefix->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
lne_prefix->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
Label *lbl_suffix = memnew(Label);
|
||||
lbl_suffix->set_text(TTR("Suffix"));
|
||||
|
@ -98,7 +98,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
|
|||
lne_suffix = memnew(LineEdit);
|
||||
lne_suffix->set_placeholder(TTR("Suffix"));
|
||||
lne_suffix->set_name("lne_suffix");
|
||||
lne_suffix->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
lne_suffix->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
grd_main->add_child(lbl_prefix);
|
||||
grd_main->add_child(lbl_suffix);
|
||||
|
@ -124,7 +124,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
|
|||
// ---- Tab Substitute
|
||||
|
||||
VBoxContainer *vbc_substitute = memnew(VBoxContainer);
|
||||
vbc_substitute->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
vbc_substitute->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
vbc_substitute->set_custom_minimum_size(Size2(0, feature_min_height));
|
||||
|
||||
vbc_substitute->set_name(TTR("Substitute"));
|
||||
|
@ -143,9 +143,9 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
|
|||
but_insert_name = memnew(Button);
|
||||
but_insert_name->set_text("NAME");
|
||||
but_insert_name->set_tooltip(String("${NAME}\n") + TTR("Node name"));
|
||||
but_insert_name->set_focus_mode(FOCUS_NONE);
|
||||
but_insert_name->set_focus_mode(Control::FOCUS_NONE);
|
||||
but_insert_name->connect("pressed", callable_mp(this, &RenameDialog::_insert_text), make_binds("${NAME}"));
|
||||
but_insert_name->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
but_insert_name->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
grd_substitute->add_child(but_insert_name);
|
||||
|
||||
// Parent
|
||||
|
@ -153,9 +153,9 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
|
|||
but_insert_parent = memnew(Button);
|
||||
but_insert_parent->set_text("PARENT");
|
||||
but_insert_parent->set_tooltip(String("${PARENT}\n") + TTR("Node's parent name, if available"));
|
||||
but_insert_parent->set_focus_mode(FOCUS_NONE);
|
||||
but_insert_parent->set_focus_mode(Control::FOCUS_NONE);
|
||||
but_insert_parent->connect("pressed", callable_mp(this, &RenameDialog::_insert_text), make_binds("${PARENT}"));
|
||||
but_insert_parent->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
but_insert_parent->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
grd_substitute->add_child(but_insert_parent);
|
||||
|
||||
// Type
|
||||
|
@ -163,9 +163,9 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
|
|||
but_insert_type = memnew(Button);
|
||||
but_insert_type->set_text("TYPE");
|
||||
but_insert_type->set_tooltip(String("${TYPE}\n") + TTR("Node type"));
|
||||
but_insert_type->set_focus_mode(FOCUS_NONE);
|
||||
but_insert_type->set_focus_mode(Control::FOCUS_NONE);
|
||||
but_insert_type->connect("pressed", callable_mp(this, &RenameDialog::_insert_text), make_binds("${TYPE}"));
|
||||
but_insert_type->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
but_insert_type->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
grd_substitute->add_child(but_insert_type);
|
||||
|
||||
// Scene
|
||||
|
@ -173,9 +173,9 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
|
|||
but_insert_scene = memnew(Button);
|
||||
but_insert_scene->set_text("SCENE");
|
||||
but_insert_scene->set_tooltip(String("${SCENE}\n") + TTR("Current scene name"));
|
||||
but_insert_scene->set_focus_mode(FOCUS_NONE);
|
||||
but_insert_scene->set_focus_mode(Control::FOCUS_NONE);
|
||||
but_insert_scene->connect("pressed", callable_mp(this, &RenameDialog::_insert_text), make_binds("${SCENE}"));
|
||||
but_insert_scene->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
but_insert_scene->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
grd_substitute->add_child(but_insert_scene);
|
||||
|
||||
// Root
|
||||
|
@ -183,9 +183,9 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
|
|||
but_insert_root = memnew(Button);
|
||||
but_insert_root->set_text("ROOT");
|
||||
but_insert_root->set_tooltip(String("${ROOT}\n") + TTR("Root node name"));
|
||||
but_insert_root->set_focus_mode(FOCUS_NONE);
|
||||
but_insert_root->set_focus_mode(Control::FOCUS_NONE);
|
||||
but_insert_root->connect("pressed", callable_mp(this, &RenameDialog::_insert_text), make_binds("${ROOT}"));
|
||||
but_insert_root->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
but_insert_root->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
grd_substitute->add_child(but_insert_root);
|
||||
|
||||
// Count
|
||||
|
@ -193,9 +193,9 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
|
|||
but_insert_count = memnew(Button);
|
||||
but_insert_count->set_text("COUNTER");
|
||||
but_insert_count->set_tooltip(String("${COUNTER}\n") + TTR("Sequential integer counter.\nCompare counter options."));
|
||||
but_insert_count->set_focus_mode(FOCUS_NONE);
|
||||
but_insert_count->set_focus_mode(Control::FOCUS_NONE);
|
||||
but_insert_count->connect("pressed", callable_mp(this, &RenameDialog::_insert_text), make_binds("${COUNTER}"));
|
||||
but_insert_count->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
but_insert_count->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
grd_substitute->add_child(but_insert_count);
|
||||
|
||||
chk_per_level_counter = memnew(CheckBox);
|
||||
|
@ -240,7 +240,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
|
|||
// ---- Tab Process
|
||||
|
||||
VBoxContainer *vbc_process = memnew(VBoxContainer);
|
||||
vbc_process->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
vbc_process->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
vbc_process->set_name(TTR("Post-Process"));
|
||||
vbc_process->set_custom_minimum_size(Size2(0, feature_min_height));
|
||||
tabc_features->add_child(vbc_process);
|
||||
|
@ -296,8 +296,8 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
|
|||
|
||||
// ---- Dialog related
|
||||
|
||||
set_custom_minimum_size(Size2(383, 0));
|
||||
set_as_toplevel(true);
|
||||
set_min_size(Size2(383, 0));
|
||||
//set_as_toplevel(true);
|
||||
get_ok()->set_text(TTR("Rename"));
|
||||
Button *but_reset = add_button(TTR("Reset"));
|
||||
|
||||
|
@ -347,7 +347,7 @@ void RenameDialog::_bind_methods() {
|
|||
|
||||
void RenameDialog::_update_substitute() {
|
||||
|
||||
LineEdit *focus_owner_line_edit = Object::cast_to<LineEdit>(get_focus_owner());
|
||||
LineEdit *focus_owner_line_edit = Object::cast_to<LineEdit>(scene_tree_editor->get_focus_owner());
|
||||
bool is_main_field = _is_main_field(focus_owner_line_edit);
|
||||
|
||||
but_insert_name->set_disabled(!is_main_field);
|
||||
|
@ -358,12 +358,12 @@ void RenameDialog::_update_substitute() {
|
|||
but_insert_count->set_disabled(!is_main_field);
|
||||
|
||||
// The focus mode seems to be reset when disabling/re-enabling
|
||||
but_insert_name->set_focus_mode(FOCUS_NONE);
|
||||
but_insert_parent->set_focus_mode(FOCUS_NONE);
|
||||
but_insert_type->set_focus_mode(FOCUS_NONE);
|
||||
but_insert_scene->set_focus_mode(FOCUS_NONE);
|
||||
but_insert_root->set_focus_mode(FOCUS_NONE);
|
||||
but_insert_count->set_focus_mode(FOCUS_NONE);
|
||||
but_insert_name->set_focus_mode(Control::FOCUS_NONE);
|
||||
but_insert_parent->set_focus_mode(Control::FOCUS_NONE);
|
||||
but_insert_type->set_focus_mode(Control::FOCUS_NONE);
|
||||
but_insert_scene->set_focus_mode(Control::FOCUS_NONE);
|
||||
but_insert_root->set_focus_mode(Control::FOCUS_NONE);
|
||||
but_insert_count->set_focus_mode(Control::FOCUS_NONE);
|
||||
}
|
||||
|
||||
void RenameDialog::_post_popup() {
|
||||
|
@ -652,7 +652,7 @@ bool RenameDialog::_is_main_field(LineEdit *line_edit) {
|
|||
|
||||
void RenameDialog::_insert_text(String text) {
|
||||
|
||||
LineEdit *focus_owner = Object::cast_to<LineEdit>(get_focus_owner());
|
||||
LineEdit *focus_owner = Object::cast_to<LineEdit>(scene_tree_editor->get_focus_owner());
|
||||
|
||||
if (_is_main_field(focus_owner)) {
|
||||
focus_owner->selection_delete();
|
||||
|
|
|
@ -103,7 +103,6 @@ class RenameDialog : public ConfirmationDialog {
|
|||
bool has_errors;
|
||||
|
||||
protected:
|
||||
void _notification(int p_what){};
|
||||
static void _bind_methods();
|
||||
virtual void _post_popup();
|
||||
|
||||
|
|
|
@ -45,12 +45,6 @@ void ReparentDialog::_notification(int p_what) {
|
|||
|
||||
disconnect("confirmed", callable_mp(this, &ReparentDialog::_reparent));
|
||||
}
|
||||
|
||||
if (p_what == NOTIFICATION_DRAW) {
|
||||
|
||||
//RID ci = get_canvas_item();
|
||||
//get_stylebox("panel","PopupMenu")->draw(ci,Rect2(Point2(),get_size()));
|
||||
}
|
||||
}
|
||||
|
||||
void ReparentDialog::_cancel() {
|
||||
|
|
|
@ -133,7 +133,7 @@ void SceneTreeDock::instance(const String &p_file) {
|
|||
|
||||
current_option = -1;
|
||||
accept->set_text(TTR("No parent to instance a child at."));
|
||||
accept->popup_centered_minsize();
|
||||
accept->popup_centered();
|
||||
return;
|
||||
};
|
||||
|
||||
|
@ -155,7 +155,7 @@ void SceneTreeDock::instance_scenes(const Vector<String> &p_files, Node *p_paren
|
|||
if (!parent || !edited_scene) {
|
||||
|
||||
accept->set_text(TTR("No parent to instance the scenes at."));
|
||||
accept->popup_centered_minsize();
|
||||
accept->popup_centered();
|
||||
return;
|
||||
};
|
||||
|
||||
|
@ -176,7 +176,7 @@ void SceneTreeDock::_perform_instance_scenes(const Vector<String> &p_files, Node
|
|||
if (!sdata.is_valid()) {
|
||||
current_option = -1;
|
||||
accept->set_text(vformat(TTR("Error loading scene from %s"), p_files[i]));
|
||||
accept->popup_centered_minsize();
|
||||
accept->popup_centered();
|
||||
error = true;
|
||||
break;
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ void SceneTreeDock::_perform_instance_scenes(const Vector<String> &p_files, Node
|
|||
if (!instanced_scene) {
|
||||
current_option = -1;
|
||||
accept->set_text(vformat(TTR("Error instancing scene from %s"), p_files[i]));
|
||||
accept->popup_centered_minsize();
|
||||
accept->popup_centered();
|
||||
error = true;
|
||||
break;
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ void SceneTreeDock::_perform_instance_scenes(const Vector<String> &p_files, Node
|
|||
if (_cyclical_dependency_exists(edited_scene->get_filename(), instanced_scene)) {
|
||||
|
||||
accept->set_text(vformat(TTR("Cannot instance the scene '%s' because the current scene exists within one of its nodes."), p_files[i]));
|
||||
accept->popup_centered_minsize();
|
||||
accept->popup_centered();
|
||||
error = true;
|
||||
break;
|
||||
}
|
||||
|
@ -242,14 +242,14 @@ void SceneTreeDock::_replace_with_branch_scene(const String &p_file, Node *base)
|
|||
Ref<PackedScene> sdata = ResourceLoader::load(p_file);
|
||||
if (!sdata.is_valid()) {
|
||||
accept->set_text(vformat(TTR("Error loading scene from %s"), p_file));
|
||||
accept->popup_centered_minsize();
|
||||
accept->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
Node *instanced_scene = sdata->instance(PackedScene::GEN_EDIT_STATE_INSTANCE);
|
||||
if (!instanced_scene) {
|
||||
accept->set_text(vformat(TTR("Error instancing scene from %s"), p_file));
|
||||
accept->popup_centered_minsize();
|
||||
accept->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -473,7 +473,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|||
|
||||
current_option = -1;
|
||||
accept->set_text(TTR("This operation can't be done on the tree root."));
|
||||
accept->popup_centered_minsize();
|
||||
accept->popup_centered();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -537,7 +537,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|||
|
||||
current_option = -1;
|
||||
accept->set_text(TTR("This operation can't be done on the tree root."));
|
||||
accept->popup_centered_minsize();
|
||||
accept->popup_centered();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -620,7 +620,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|||
|
||||
current_option = -1;
|
||||
accept->set_text(TTR("This operation can't be done on the tree root."));
|
||||
accept->popup_centered_minsize();
|
||||
accept->popup_centered();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -656,19 +656,19 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|||
|
||||
if (root->get_scene_inherited_state().is_valid()) {
|
||||
accept->set_text(TTR("Can't reparent nodes in inherited scenes, order of nodes can't change."));
|
||||
accept->popup_centered_minsize();
|
||||
accept->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
if (node->get_owner() != root) {
|
||||
accept->set_text(TTR("Node must belong to the edited scene to become root."));
|
||||
accept->popup_centered_minsize();
|
||||
accept->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
if (node->get_filename() != String()) {
|
||||
accept->set_text(TTR("Instantiated scenes can't become root"));
|
||||
accept->popup_centered_minsize();
|
||||
accept->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -747,7 +747,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|||
// This prevents the dialog from being too wide after displaying
|
||||
// a deletion confirmation for a node with a long name.
|
||||
delete_dialog->set_size(Size2());
|
||||
delete_dialog->popup_centered_minsize();
|
||||
delete_dialog->popup_centered();
|
||||
}
|
||||
|
||||
} break;
|
||||
|
@ -769,7 +769,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|||
|
||||
if (!scene) {
|
||||
accept->set_text(TTR("This operation can't be done without a scene."));
|
||||
accept->popup_centered_minsize();
|
||||
accept->popup_centered();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -777,7 +777,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|||
|
||||
if (selection.size() != 1) {
|
||||
accept->set_text(TTR("This operation requires a single selected node."));
|
||||
accept->popup_centered_minsize();
|
||||
accept->popup_centered();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -785,17 +785,17 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|||
|
||||
if (tocopy == scene) {
|
||||
accept->set_text(TTR("Can not perform with the root node."));
|
||||
accept->popup_centered_minsize();
|
||||
accept->popup_centered();
|
||||
break;
|
||||
}
|
||||
|
||||
if (tocopy != editor_data->get_edited_scene_root() && tocopy->get_filename() != "") {
|
||||
accept->set_text(TTR("This operation can't be done on instanced scenes."));
|
||||
accept->popup_centered_minsize();
|
||||
accept->popup_centered();
|
||||
break;
|
||||
}
|
||||
|
||||
new_scene_from_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE);
|
||||
new_scene_from_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
|
||||
|
||||
List<String> extensions;
|
||||
Ref<PackedScene> sd = memnew(PackedScene);
|
||||
|
@ -850,7 +850,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|||
|
||||
if (editable) {
|
||||
editable_instance_remove_dialog->set_text(TTR("Disabling \"editable_instance\" will cause all properties of the node to be reverted to their default."));
|
||||
editable_instance_remove_dialog->popup_centered_minsize();
|
||||
editable_instance_remove_dialog->popup_centered();
|
||||
break;
|
||||
}
|
||||
_toggle_editable_children(node);
|
||||
|
@ -874,7 +874,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|||
// Fire confirmation dialog when children are editable.
|
||||
if (editable && !placeholder) {
|
||||
placeholder_editable_instance_remove_dialog->set_text(TTR("Enabling \"Load As Placeholder\" will disable \"Editable Children\" and cause all properties of the node to be reverted to their default."));
|
||||
placeholder_editable_instance_remove_dialog->popup_centered_minsize();
|
||||
placeholder_editable_instance_remove_dialog->popup_centered();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -931,7 +931,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|||
break;
|
||||
}
|
||||
|
||||
clear_inherit_confirm->popup_centered_minsize();
|
||||
clear_inherit_confirm->popup_centered();
|
||||
} break;
|
||||
case TOOL_SCENE_CLEAR_INHERITANCE_CONFIRM: {
|
||||
if (!profile_allow_editing) {
|
||||
|
@ -1480,7 +1480,7 @@ bool SceneTreeDock::_validate_no_foreign() {
|
|||
if (E->get() != edited_scene && E->get()->get_owner() != edited_scene) {
|
||||
|
||||
accept->set_text(TTR("Can't operate on nodes from a foreign scene!"));
|
||||
accept->popup_centered_minsize();
|
||||
accept->popup_centered();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1494,7 +1494,7 @@ bool SceneTreeDock::_validate_no_foreign() {
|
|||
if (edited_scene->get_scene_inherited_state().is_valid() && edited_scene->get_scene_inherited_state()->find_node_by_path(edited_scene->get_path_to(E->get())) >= 0) {
|
||||
|
||||
accept->set_text(TTR("Can't operate on nodes the current scene inherits from!"));
|
||||
accept->popup_centered_minsize();
|
||||
accept->popup_centered();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -2189,13 +2189,13 @@ void SceneTreeDock::_new_scene_from(String p_file) {
|
|||
|
||||
if (selection.size() != 1) {
|
||||
accept->set_text(TTR("This operation requires a single selected node."));
|
||||
accept->popup_centered_minsize();
|
||||
accept->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
if (EditorNode::get_singleton()->is_scene_open(p_file)) {
|
||||
accept->set_text(TTR("Can't overwrite scene that is still open!"));
|
||||
accept->popup_centered_minsize();
|
||||
accept->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2212,7 +2212,7 @@ void SceneTreeDock::_new_scene_from(String p_file) {
|
|||
|
||||
if (err != OK) {
|
||||
accept->set_text(TTR("Couldn't save new scene. Likely dependencies (instances) couldn't be satisfied."));
|
||||
accept->popup_centered_minsize();
|
||||
accept->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2223,13 +2223,13 @@ void SceneTreeDock::_new_scene_from(String p_file) {
|
|||
err = ResourceSaver::save(p_file, sdata, flg);
|
||||
if (err != OK) {
|
||||
accept->set_text(TTR("Error saving scene."));
|
||||
accept->popup_centered_minsize();
|
||||
accept->popup_centered();
|
||||
return;
|
||||
}
|
||||
_replace_with_branch_scene(p_file, base);
|
||||
} else {
|
||||
accept->set_text(TTR("Error duplicating scene to save it."));
|
||||
accept->popup_centered_minsize();
|
||||
accept->popup_centered();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -2941,7 +2941,7 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel
|
|||
import_subscene_dialog->connect("subscene_selected", callable_mp(this, &SceneTreeDock::_import_subscene));
|
||||
|
||||
new_scene_from_dialog = memnew(EditorFileDialog);
|
||||
new_scene_from_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE);
|
||||
new_scene_from_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
|
||||
add_child(new_scene_from_dialog);
|
||||
new_scene_from_dialog->connect("file_selected", callable_mp(this, &SceneTreeDock::_new_scene_from));
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item, int p_column, int p_i
|
|||
return;
|
||||
config_err = config_err.word_wrap(80);
|
||||
warning->set_text(config_err);
|
||||
warning->popup_centered_minsize();
|
||||
warning->popup_centered();
|
||||
|
||||
} else if (p_id == BUTTON_SIGNALS) {
|
||||
|
||||
|
@ -757,7 +757,7 @@ void SceneTreeEditor::_renamed() {
|
|||
if (!Node::_validate_node_name(new_name)) {
|
||||
|
||||
error->set_text(TTR("Invalid node name, the following characters are not allowed:") + "\n" + Node::invalid_character);
|
||||
error->popup_centered_minsize();
|
||||
error->popup_centered();
|
||||
|
||||
if (new_name.empty()) {
|
||||
which->set_text(0, n->get_name());
|
||||
|
@ -1193,18 +1193,19 @@ SceneTreeEditor::~SceneTreeEditor() {
|
|||
void SceneTreeDialog::_notification(int p_what) {
|
||||
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||
|
||||
if (is_visible())
|
||||
tree->update_tree();
|
||||
} break;
|
||||
case NOTIFICATION_ENTER_TREE: {
|
||||
connect("confirmed", callable_mp(this, &SceneTreeDialog::_select));
|
||||
filter->set_right_icon(get_icon("Search", "EditorIcons"));
|
||||
filter->set_right_icon(tree->get_icon("Search", "EditorIcons"));
|
||||
filter->set_clear_button_enabled(true);
|
||||
} break;
|
||||
case NOTIFICATION_EXIT_TREE: {
|
||||
disconnect("confirmed", callable_mp(this, &SceneTreeDialog::_select));
|
||||
} break;
|
||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||
if (is_visible_in_tree())
|
||||
tree->update_tree();
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1239,14 +1240,14 @@ SceneTreeDialog::SceneTreeDialog() {
|
|||
add_child(vbc);
|
||||
|
||||
filter = memnew(LineEdit);
|
||||
filter->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
filter->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
filter->set_placeholder(TTR("Filter nodes"));
|
||||
filter->add_constant_override("minimum_spaces", 0);
|
||||
filter->connect("text_changed", callable_mp(this, &SceneTreeDialog::_filter_changed));
|
||||
vbc->add_child(filter);
|
||||
|
||||
tree = memnew(SceneTreeEditor(false, false, true));
|
||||
tree->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
tree->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
tree->get_scene_tree()->connect("item_activated", callable_mp(this, &SceneTreeDialog::_select));
|
||||
vbc->add_child(tree);
|
||||
}
|
||||
|
|
|
@ -40,36 +40,38 @@
|
|||
#include "editor/editor_scale.h"
|
||||
#include "editor_file_system.h"
|
||||
|
||||
void ScriptCreateDialog::_theme_changed() {
|
||||
for (int i = 0; i < ScriptServer::get_language_count(); i++) {
|
||||
String lang = ScriptServer::get_language(i)->get_type();
|
||||
Ref<Texture2D> lang_icon = gc->get_icon(lang, "EditorIcons");
|
||||
if (lang_icon.is_valid()) {
|
||||
language_menu->set_item_icon(i, lang_icon);
|
||||
}
|
||||
}
|
||||
|
||||
String last_lang = EditorSettings::get_singleton()->get_project_metadata("script_setup", "last_selected_language", "");
|
||||
if (!last_lang.empty()) {
|
||||
for (int i = 0; i < language_menu->get_item_count(); i++) {
|
||||
if (language_menu->get_item_text(i) == last_lang) {
|
||||
language_menu->select(i);
|
||||
current_language = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
language_menu->select(default_language);
|
||||
}
|
||||
|
||||
path_button->set_icon(gc->get_icon("Folder", "EditorIcons"));
|
||||
parent_browse_button->set_icon(gc->get_icon("Folder", "EditorIcons"));
|
||||
parent_search_button->set_icon(gc->get_icon("ClassList", "EditorIcons"));
|
||||
status_panel->add_style_override("panel", gc->get_stylebox("bg", "Tree"));
|
||||
}
|
||||
void ScriptCreateDialog::_notification(int p_what) {
|
||||
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_THEME_CHANGED:
|
||||
case NOTIFICATION_ENTER_TREE: {
|
||||
for (int i = 0; i < ScriptServer::get_language_count(); i++) {
|
||||
String lang = ScriptServer::get_language(i)->get_type();
|
||||
Ref<Texture2D> lang_icon = get_icon(lang, "EditorIcons");
|
||||
if (lang_icon.is_valid()) {
|
||||
language_menu->set_item_icon(i, lang_icon);
|
||||
}
|
||||
}
|
||||
|
||||
String last_lang = EditorSettings::get_singleton()->get_project_metadata("script_setup", "last_selected_language", "");
|
||||
if (!last_lang.empty()) {
|
||||
for (int i = 0; i < language_menu->get_item_count(); i++) {
|
||||
if (language_menu->get_item_text(i) == last_lang) {
|
||||
language_menu->select(i);
|
||||
current_language = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
language_menu->select(default_language);
|
||||
}
|
||||
|
||||
path_button->set_icon(get_icon("Folder", "EditorIcons"));
|
||||
parent_browse_button->set_icon(get_icon("Folder", "EditorIcons"));
|
||||
parent_search_button->set_icon(get_icon("ClassList", "EditorIcons"));
|
||||
status_panel->add_style_override("panel", get_stylebox("bg", "Tree"));
|
||||
_theme_changed();
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
@ -442,7 +444,7 @@ void ScriptCreateDialog::_lang_changed(int l) {
|
|||
override_info += ", ";
|
||||
}
|
||||
}
|
||||
template_menu->set_item_icon(extended.id, get_icon("Override", "EditorIcons"));
|
||||
template_menu->set_item_icon(extended.id, gc->get_icon("Override", "EditorIcons"));
|
||||
template_menu->get_popup()->set_item_tooltip(extended.id, override_info.as_string());
|
||||
}
|
||||
// Reselect last selected template
|
||||
|
@ -517,11 +519,11 @@ void ScriptCreateDialog::_browse_path(bool browse_parent, bool p_save) {
|
|||
is_browsing_parent = browse_parent;
|
||||
|
||||
if (p_save) {
|
||||
file_browse->set_mode(EditorFileDialog::MODE_SAVE_FILE);
|
||||
file_browse->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
|
||||
file_browse->set_title(TTR("Open Script / Choose Location"));
|
||||
file_browse->get_ok()->set_text(TTR("Open"));
|
||||
} else {
|
||||
file_browse->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
file_browse->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
file_browse->set_title(TTR("Open Script"));
|
||||
}
|
||||
|
||||
|
@ -607,9 +609,9 @@ void ScriptCreateDialog::_msg_script_valid(bool valid, const String &p_msg) {
|
|||
|
||||
error_label->set_text("- " + TTR(p_msg));
|
||||
if (valid) {
|
||||
error_label->add_color_override("font_color", get_color("success_color", "Editor"));
|
||||
error_label->add_color_override("font_color", gc->get_color("success_color", "Editor"));
|
||||
} else {
|
||||
error_label->add_color_override("font_color", get_color("error_color", "Editor"));
|
||||
error_label->add_color_override("font_color", gc->get_color("error_color", "Editor"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -617,9 +619,9 @@ void ScriptCreateDialog::_msg_path_valid(bool valid, const String &p_msg) {
|
|||
|
||||
path_error_label->set_text("- " + TTR(p_msg));
|
||||
if (valid) {
|
||||
path_error_label->add_color_override("font_color", get_color("success_color", "Editor"));
|
||||
path_error_label->add_color_override("font_color", gc->get_color("success_color", "Editor"));
|
||||
} else {
|
||||
path_error_label->add_color_override("font_color", get_color("error_color", "Editor"));
|
||||
path_error_label->add_color_override("font_color", gc->get_color("error_color", "Editor"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -739,9 +741,11 @@ ScriptCreateDialog::ScriptCreateDialog() {
|
|||
|
||||
/* Main Controls */
|
||||
|
||||
GridContainer *gc = memnew(GridContainer);
|
||||
gc = memnew(GridContainer);
|
||||
gc->set_columns(2);
|
||||
|
||||
gc->connect("theme_changed", callable_mp(this, &ScriptCreateDialog::_theme_changed));
|
||||
|
||||
/* Error Messages Field */
|
||||
|
||||
VBoxContainer *vb = memnew(VBoxContainer);
|
||||
|
@ -774,7 +778,7 @@ ScriptCreateDialog::ScriptCreateDialog() {
|
|||
|
||||
language_menu = memnew(OptionButton);
|
||||
language_menu->set_custom_minimum_size(Size2(250, 0) * EDSCALE);
|
||||
language_menu->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
language_menu->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
gc->add_child(memnew(Label(TTR("Language:"))));
|
||||
gc->add_child(language_menu);
|
||||
|
||||
|
@ -798,10 +802,10 @@ ScriptCreateDialog::ScriptCreateDialog() {
|
|||
base_type = "Object";
|
||||
|
||||
hb = memnew(HBoxContainer);
|
||||
hb->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
hb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
parent_name = memnew(LineEdit);
|
||||
parent_name->connect("text_changed", callable_mp(this, &ScriptCreateDialog::_parent_name_changed));
|
||||
parent_name->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
parent_name->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
hb->add_child(parent_name);
|
||||
parent_search_button = memnew(Button);
|
||||
parent_search_button->set_flat(true);
|
||||
|
@ -819,7 +823,7 @@ ScriptCreateDialog::ScriptCreateDialog() {
|
|||
|
||||
class_name = memnew(LineEdit);
|
||||
class_name->connect("text_changed", callable_mp(this, &ScriptCreateDialog::_class_name_changed));
|
||||
class_name->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
class_name->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
gc->add_child(memnew(Label(TTR("Class Name:"))));
|
||||
gc->add_child(class_name);
|
||||
|
||||
|
@ -845,7 +849,7 @@ ScriptCreateDialog::ScriptCreateDialog() {
|
|||
file_path = memnew(LineEdit);
|
||||
file_path->connect("text_changed", callable_mp(this, &ScriptCreateDialog::_path_changed));
|
||||
file_path->connect("text_entered", callable_mp(this, &ScriptCreateDialog::_path_entered));
|
||||
file_path->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
file_path->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
hb->add_child(file_path);
|
||||
path_button = memnew(Button);
|
||||
path_button->set_flat(true);
|
||||
|
@ -863,18 +867,16 @@ ScriptCreateDialog::ScriptCreateDialog() {
|
|||
|
||||
file_browse = memnew(EditorFileDialog);
|
||||
file_browse->connect("file_selected", callable_mp(this, &ScriptCreateDialog::_file_selected));
|
||||
file_browse->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
file_browse->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
add_child(file_browse);
|
||||
get_ok()->set_text(TTR("Create"));
|
||||
alert = memnew(AcceptDialog);
|
||||
alert->set_as_minsize();
|
||||
alert->get_label()->set_autowrap(true);
|
||||
alert->get_label()->set_align(Label::ALIGN_CENTER);
|
||||
alert->get_label()->set_valign(Label::VALIGN_CENTER);
|
||||
alert->get_label()->set_custom_minimum_size(Size2(325, 60) * EDSCALE);
|
||||
add_child(alert);
|
||||
|
||||
set_as_minsize();
|
||||
set_hide_on_ok(false);
|
||||
set_title(TTR("Attach Node Script"));
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ class CreateDialog;
|
|||
class ScriptCreateDialog : public ConfirmationDialog {
|
||||
GDCLASS(ScriptCreateDialog, ConfirmationDialog);
|
||||
|
||||
GridContainer *gc;
|
||||
LineEdit *class_name;
|
||||
Label *error_label;
|
||||
Label *path_error_label;
|
||||
|
@ -123,6 +124,7 @@ class ScriptCreateDialog : public ConfirmationDialog {
|
|||
void _update_dialog();
|
||||
|
||||
protected:
|
||||
void _theme_changed();
|
||||
void _notification(int p_what);
|
||||
static void _bind_methods();
|
||||
|
||||
|
|
|
@ -118,6 +118,12 @@ void EditorSettingsDialog::_undo_redo_callback(void *p_self, const String &p_nam
|
|||
void EditorSettingsDialog::_notification(int p_what) {
|
||||
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||
if (!is_visible()) {
|
||||
EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "editor_settings", Rect2(get_position(), get_size()));
|
||||
set_process_unhandled_input(false);
|
||||
}
|
||||
} break;
|
||||
case NOTIFICATION_READY: {
|
||||
undo_redo->set_method_notify_callback(EditorDebuggerNode::_method_changeds, NULL);
|
||||
undo_redo->set_property_notify_callback(EditorDebuggerNode::_property_changeds, NULL);
|
||||
|
@ -126,10 +132,6 @@ void EditorSettingsDialog::_notification(int p_what) {
|
|||
case NOTIFICATION_ENTER_TREE: {
|
||||
_update_icons();
|
||||
} break;
|
||||
case NOTIFICATION_POPUP_HIDE: {
|
||||
EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "editor_settings", get_rect());
|
||||
set_process_unhandled_input(false);
|
||||
} break;
|
||||
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
||||
_update_icons();
|
||||
// Update theme colors.
|
||||
|
@ -143,7 +145,7 @@ void EditorSettingsDialog::_unhandled_input(const Ref<InputEvent> &p_event) {
|
|||
|
||||
const Ref<InputEventKey> k = p_event;
|
||||
|
||||
if (k.is_valid() && is_window_modal_on_top() && k->is_pressed()) {
|
||||
if (k.is_valid() && k->is_pressed()) {
|
||||
|
||||
bool handled = false;
|
||||
|
||||
|
@ -169,22 +171,22 @@ void EditorSettingsDialog::_unhandled_input(const Ref<InputEvent> &p_event) {
|
|||
}
|
||||
|
||||
if (handled) {
|
||||
accept_event();
|
||||
set_input_as_handled();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EditorSettingsDialog::_update_icons() {
|
||||
|
||||
search_box->set_right_icon(get_icon("Search", "EditorIcons"));
|
||||
search_box->set_right_icon(shortcuts->get_icon("Search", "EditorIcons"));
|
||||
search_box->set_clear_button_enabled(true);
|
||||
shortcut_search_box->set_right_icon(get_icon("Search", "EditorIcons"));
|
||||
shortcut_search_box->set_right_icon(shortcuts->get_icon("Search", "EditorIcons"));
|
||||
shortcut_search_box->set_clear_button_enabled(true);
|
||||
|
||||
restart_close_button->set_icon(get_icon("Close", "EditorIcons"));
|
||||
restart_container->add_style_override("panel", get_stylebox("bg", "Tree"));
|
||||
restart_icon->set_texture(get_icon("StatusWarning", "EditorIcons"));
|
||||
restart_label->add_color_override("font_color", get_color("warning_color", "Editor"));
|
||||
restart_close_button->set_icon(shortcuts->get_icon("Close", "EditorIcons"));
|
||||
restart_container->add_style_override("panel", shortcuts->get_stylebox("bg", "Tree"));
|
||||
restart_icon->set_texture(shortcuts->get_icon("StatusWarning", "EditorIcons"));
|
||||
restart_label->add_color_override("font_color", shortcuts->get_color("warning_color", "Editor"));
|
||||
}
|
||||
|
||||
void EditorSettingsDialog::_update_shortcuts() {
|
||||
|
@ -230,8 +232,8 @@ void EditorSettingsDialog::_update_shortcuts() {
|
|||
}
|
||||
|
||||
sections[section_name] = section;
|
||||
section->set_custom_bg_color(0, get_color("prop_subsection", "Editor"));
|
||||
section->set_custom_bg_color(1, get_color("prop_subsection", "Editor"));
|
||||
section->set_custom_bg_color(0, shortcuts->get_color("prop_subsection", "Editor"));
|
||||
section->set_custom_bg_color(1, shortcuts->get_color("prop_subsection", "Editor"));
|
||||
}
|
||||
|
||||
// Don't match unassigned shortcuts when searching for assigned keys in search results.
|
||||
|
@ -243,16 +245,16 @@ void EditorSettingsDialog::_update_shortcuts() {
|
|||
item->set_text(1, sc->get_as_text());
|
||||
|
||||
if (!sc->is_shortcut(original) && !(sc->get_shortcut().is_null() && original.is_null())) {
|
||||
item->add_button(1, get_icon("Reload", "EditorIcons"), 2);
|
||||
item->add_button(1, shortcuts->get_icon("Reload", "EditorIcons"), 2);
|
||||
}
|
||||
|
||||
if (sc->get_as_text() == "None") {
|
||||
// Fade out unassigned shortcut labels for easier visual grepping.
|
||||
item->set_custom_color(1, get_color("font_color", "Label") * Color(1, 1, 1, 0.5));
|
||||
item->set_custom_color(1, shortcuts->get_color("font_color", "Label") * Color(1, 1, 1, 0.5));
|
||||
}
|
||||
|
||||
item->add_button(1, get_icon("Edit", "EditorIcons"), 0);
|
||||
item->add_button(1, get_icon("Close", "EditorIcons"), 1);
|
||||
item->add_button(1, shortcuts->get_icon("Edit", "EditorIcons"), 0);
|
||||
item->add_button(1, shortcuts->get_icon("Close", "EditorIcons"), 1);
|
||||
item->set_tooltip(0, E->get());
|
||||
item->set_metadata(0, E->get());
|
||||
}
|
||||
|
@ -279,9 +281,9 @@ void EditorSettingsDialog::_shortcut_button_pressed(Object *p_item, int p_column
|
|||
press_a_key_label->set_text(TTR("Press a Key..."));
|
||||
last_wait_for_key = Ref<InputEventKey>();
|
||||
press_a_key->popup_centered(Size2(250, 80) * EDSCALE);
|
||||
press_a_key->grab_focus();
|
||||
press_a_key->get_ok()->set_focus_mode(FOCUS_NONE);
|
||||
press_a_key->get_cancel()->set_focus_mode(FOCUS_NONE);
|
||||
//press_a_key->grab_focus();
|
||||
press_a_key->get_ok()->set_focus_mode(Control::FOCUS_NONE);
|
||||
press_a_key->get_cancel()->set_focus_mode(Control::FOCUS_NONE);
|
||||
shortcut_configured = item;
|
||||
|
||||
} else if (p_idx == 1) { //erase
|
||||
|
@ -323,7 +325,7 @@ void EditorSettingsDialog::_wait_for_key(const Ref<InputEvent> &p_event) {
|
|||
const String str = keycode_get_string(k->get_keycode_with_modifiers());
|
||||
|
||||
press_a_key_label->set_text(str);
|
||||
press_a_key->accept_event();
|
||||
press_a_key->set_input_as_handled();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -394,7 +396,7 @@ void EditorSettingsDialog::_bind_methods() {
|
|||
EditorSettingsDialog::EditorSettingsDialog() {
|
||||
|
||||
set_title(TTR("Editor Settings"));
|
||||
set_resizable(true);
|
||||
|
||||
undo_redo = memnew(UndoRedo);
|
||||
|
||||
tabs = memnew(TabContainer);
|
||||
|
@ -430,7 +432,7 @@ EditorSettingsDialog::EditorSettingsDialog() {
|
|||
HBoxContainer *restart_hb = memnew(HBoxContainer);
|
||||
restart_container->add_child(restart_hb);
|
||||
restart_icon = memnew(TextureRect);
|
||||
restart_icon->set_v_size_flags(SIZE_SHRINK_CENTER);
|
||||
restart_icon->set_v_size_flags(Control::SIZE_SHRINK_CENTER);
|
||||
restart_hb->add_child(restart_icon);
|
||||
restart_label = memnew(Label);
|
||||
restart_label->set_text(TTR("The editor must be restarted for changes to take effect."));
|
||||
|
@ -462,7 +464,7 @@ EditorSettingsDialog::EditorSettingsDialog() {
|
|||
|
||||
shortcuts = memnew(Tree);
|
||||
tab_shortcuts->add_child(shortcuts, true);
|
||||
shortcuts->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
shortcuts->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
shortcuts->set_columns(2);
|
||||
shortcuts->set_hide_root(true);
|
||||
shortcuts->set_column_titles_visible(true);
|
||||
|
@ -471,7 +473,7 @@ EditorSettingsDialog::EditorSettingsDialog() {
|
|||
shortcuts->connect("button_pressed", callable_mp(this, &EditorSettingsDialog::_shortcut_button_pressed));
|
||||
|
||||
press_a_key = memnew(ConfirmationDialog);
|
||||
press_a_key->set_focus_mode(FOCUS_ALL);
|
||||
//press_a_key->set_focus_mode(Control::FOCUS_ALL);
|
||||
add_child(press_a_key);
|
||||
|
||||
Label *l = memnew(Label);
|
||||
|
@ -479,10 +481,10 @@ EditorSettingsDialog::EditorSettingsDialog() {
|
|||
l->set_anchors_and_margins_preset(Control::PRESET_WIDE);
|
||||
l->set_align(Label::ALIGN_CENTER);
|
||||
l->set_margin(MARGIN_TOP, 20);
|
||||
l->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_BEGIN, 30);
|
||||
l->set_anchor_and_margin(MARGIN_BOTTOM, Control::ANCHOR_BEGIN, 30);
|
||||
press_a_key_label = l;
|
||||
press_a_key->add_child(l);
|
||||
press_a_key->connect("gui_input", callable_mp(this, &EditorSettingsDialog::_wait_for_key));
|
||||
press_a_key->connect("window_input", callable_mp(this, &EditorSettingsDialog::_wait_for_key));
|
||||
press_a_key->connect("confirmed", callable_mp(this, &EditorSettingsDialog::_press_a_key_confirm));
|
||||
|
||||
set_hide_on_ok(true);
|
||||
|
|
|
@ -133,15 +133,15 @@ void GDNativeLibraryEditor::_on_item_button(Object *item, int column, int id) {
|
|||
|
||||
if (id == BUTTON_SELECT_LIBRARY || id == BUTTON_SELECT_DEPENDENCES) {
|
||||
|
||||
EditorFileDialog::Mode mode = EditorFileDialog::MODE_OPEN_FILE;
|
||||
EditorFileDialog::FileMode mode = EditorFileDialog::FILE_MODE_OPEN_FILE;
|
||||
if (id == BUTTON_SELECT_DEPENDENCES)
|
||||
mode = EditorFileDialog::MODE_OPEN_FILES;
|
||||
mode = EditorFileDialog::FILE_MODE_OPEN_FILES;
|
||||
|
||||
file_dialog->set_meta("target", target);
|
||||
file_dialog->set_meta("section", section);
|
||||
file_dialog->clear_filters();
|
||||
file_dialog->add_filter(Object::cast_to<TreeItem>(item)->get_parent()->get_metadata(0));
|
||||
file_dialog->set_mode(mode);
|
||||
file_dialog->set_file_mode(mode);
|
||||
file_dialog->popup_centered_ratio();
|
||||
|
||||
} else if (id == BUTTON_CLEAR_LIBRARY) {
|
||||
|
@ -372,7 +372,7 @@ GDNativeLibraryEditor::GDNativeLibraryEditor() {
|
|||
|
||||
file_dialog = memnew(EditorFileDialog);
|
||||
file_dialog->set_access(EditorFileDialog::ACCESS_RESOURCES);
|
||||
file_dialog->set_resizable(true);
|
||||
//file_dialog->set_resizable(true);
|
||||
add_child(file_dialog);
|
||||
file_dialog->connect("file_selected", callable_mp(this, &GDNativeLibraryEditor::_on_library_selected));
|
||||
file_dialog->connect("files_selected", callable_mp(this, &GDNativeLibraryEditor::_on_dependencies_selected));
|
||||
|
@ -382,7 +382,7 @@ GDNativeLibraryEditor::GDNativeLibraryEditor() {
|
|||
new_architecture_dialog->set_title(TTR("Add an architecture entry"));
|
||||
new_architecture_input = memnew(LineEdit);
|
||||
new_architecture_dialog->add_child(new_architecture_input);
|
||||
new_architecture_dialog->set_custom_minimum_size(Vector2(300, 80) * EDSCALE);
|
||||
// new_architecture_dialog->set_custom_minimum_size(Vector2(300, 80) * EDSCALE);
|
||||
new_architecture_input->set_anchors_and_margins_preset(PRESET_HCENTER_WIDE, PRESET_MODE_MINSIZE, 5 * EDSCALE);
|
||||
new_architecture_dialog->get_ok()->connect("pressed", callable_mp(this, &GDNativeLibraryEditor::_on_create_new_entry));
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ void NavigationMeshEditor::_bake_pressed() {
|
|||
ERR_FAIL_COND(!node);
|
||||
if (!node->get_navigation_mesh().is_valid()) {
|
||||
err_dialog->set_text(TTR("A NavigationMesh resource must be set or created for this node to work."));
|
||||
err_dialog->popup_centered_minsize();
|
||||
err_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -4578,7 +4578,7 @@ void VisualScriptEditor::_member_option(int p_option) {
|
|||
} else if (p_option == MEMBER_EDIT) {
|
||||
variable_editor->edit(name);
|
||||
edit_variable_dialog->set_title(TTR("Editing Variable:") + " " + name);
|
||||
edit_variable_dialog->popup_centered_minsize(Size2(400, 200) * EDSCALE);
|
||||
edit_variable_dialog->popup_centered(Size2(400, 200) * EDSCALE);
|
||||
}
|
||||
} break;
|
||||
case MEMBER_SIGNAL: {
|
||||
|
@ -4599,7 +4599,7 @@ void VisualScriptEditor::_member_option(int p_option) {
|
|||
} else if (p_option == MEMBER_EDIT) {
|
||||
signal_editor->edit(name);
|
||||
edit_signal_dialog->set_title(TTR("Editing Signal:") + " " + name);
|
||||
edit_signal_dialog->popup_centered_minsize(Size2(400, 300) * EDSCALE);
|
||||
edit_signal_dialog->popup_centered(Size2(400, 300) * EDSCALE);
|
||||
}
|
||||
} break;
|
||||
}
|
||||
|
@ -4687,10 +4687,9 @@ VisualScriptEditor::VisualScriptEditor() {
|
|||
add_child(member_popup);
|
||||
member_popup->connect("id_pressed", callable_mp(this, &VisualScriptEditor::_member_option));
|
||||
|
||||
function_name_edit = memnew(PopupDialog);
|
||||
function_name_edit = memnew(AcceptDialog);
|
||||
function_name_box = memnew(LineEdit);
|
||||
function_name_edit->add_child(function_name_box);
|
||||
function_name_edit->set_h_size_flags(SIZE_EXPAND);
|
||||
function_name_box->connect("gui_input", callable_mp(this, &VisualScriptEditor::_fn_name_box_input));
|
||||
function_name_box->set_expand_to_text_length(true);
|
||||
add_child(function_name_edit);
|
||||
|
@ -4770,7 +4769,6 @@ VisualScriptEditor::VisualScriptEditor() {
|
|||
func_input_scroll->add_child(func_input_vbox);
|
||||
|
||||
function_create_dialog = memnew(ConfirmationDialog);
|
||||
function_create_dialog->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
function_create_dialog->set_title(TTR("Create Function"));
|
||||
function_create_dialog->add_child(function_vb);
|
||||
function_create_dialog->get_ok()->set_text(TTR("Create"));
|
||||
|
@ -4859,7 +4857,6 @@ VisualScriptEditor::VisualScriptEditor() {
|
|||
|
||||
new_connect_node_select = memnew(VisualScriptPropertySelector);
|
||||
add_child(new_connect_node_select);
|
||||
new_connect_node_select->set_resizable(true);
|
||||
new_connect_node_select->connect("selected", callable_mp(this, &VisualScriptEditor::_selected_connect_node));
|
||||
new_connect_node_select->get_cancel()->connect("pressed", callable_mp(this, &VisualScriptEditor::_cancel_connect_node));
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ class VisualScriptEditor : public ScriptEditorBase {
|
|||
UndoRedo *undo_redo;
|
||||
|
||||
Tree *members;
|
||||
PopupDialog *function_name_edit;
|
||||
AcceptDialog *function_name_edit;
|
||||
LineEdit *function_name_box;
|
||||
|
||||
Label *hint_text;
|
||||
|
|
|
@ -99,35 +99,35 @@ void VisualScriptPropertySelector::_update_search() {
|
|||
List<PropertyInfo> props;
|
||||
TreeItem *category = NULL;
|
||||
Ref<Texture2D> type_icons[Variant::VARIANT_MAX] = {
|
||||
Control::get_icon("Variant", "EditorIcons"),
|
||||
Control::get_icon("bool", "EditorIcons"),
|
||||
Control::get_icon("int", "EditorIcons"),
|
||||
Control::get_icon("float", "EditorIcons"),
|
||||
Control::get_icon("String", "EditorIcons"),
|
||||
Control::get_icon("Vector2", "EditorIcons"),
|
||||
Control::get_icon("Rect2", "EditorIcons"),
|
||||
Control::get_icon("Vector3", "EditorIcons"),
|
||||
Control::get_icon("Transform2D", "EditorIcons"),
|
||||
Control::get_icon("Plane", "EditorIcons"),
|
||||
Control::get_icon("Quat", "EditorIcons"),
|
||||
Control::get_icon("AABB", "EditorIcons"),
|
||||
Control::get_icon("Basis", "EditorIcons"),
|
||||
Control::get_icon("Transform", "EditorIcons"),
|
||||
Control::get_icon("Color", "EditorIcons"),
|
||||
Control::get_icon("Path", "EditorIcons"),
|
||||
Control::get_icon("RID", "EditorIcons"),
|
||||
Control::get_icon("Object", "EditorIcons"),
|
||||
Control::get_icon("Dictionary", "EditorIcons"),
|
||||
Control::get_icon("Array", "EditorIcons"),
|
||||
Control::get_icon("PackedByteArray", "EditorIcons"),
|
||||
Control::get_icon("PackedInt32Array", "EditorIcons"),
|
||||
Control::get_icon("PackedFloat32Array", "EditorIcons"),
|
||||
Control::get_icon("PackedInt64Array", "EditorIcons"),
|
||||
Control::get_icon("PackedFloat64Array", "EditorIcons"),
|
||||
Control::get_icon("PackedStringArray", "EditorIcons"),
|
||||
Control::get_icon("PackedVector2Array", "EditorIcons"),
|
||||
Control::get_icon("PackedVector3Array", "EditorIcons"),
|
||||
Control::get_icon("PackedColorArray", "EditorIcons")
|
||||
vbc->get_icon("Variant", "EditorIcons"),
|
||||
vbc->get_icon("bool", "EditorIcons"),
|
||||
vbc->get_icon("int", "EditorIcons"),
|
||||
vbc->get_icon("float", "EditorIcons"),
|
||||
vbc->get_icon("String", "EditorIcons"),
|
||||
vbc->get_icon("Vector2", "EditorIcons"),
|
||||
vbc->get_icon("Rect2", "EditorIcons"),
|
||||
vbc->get_icon("Vector3", "EditorIcons"),
|
||||
vbc->get_icon("Transform2D", "EditorIcons"),
|
||||
vbc->get_icon("Plane", "EditorIcons"),
|
||||
vbc->get_icon("Quat", "EditorIcons"),
|
||||
vbc->get_icon("AABB", "EditorIcons"),
|
||||
vbc->get_icon("Basis", "EditorIcons"),
|
||||
vbc->get_icon("Transform", "EditorIcons"),
|
||||
vbc->get_icon("Color", "EditorIcons"),
|
||||
vbc->get_icon("Path", "EditorIcons"),
|
||||
vbc->get_icon("RID", "EditorIcons"),
|
||||
vbc->get_icon("Object", "EditorIcons"),
|
||||
vbc->get_icon("Dictionary", "EditorIcons"),
|
||||
vbc->get_icon("Array", "EditorIcons"),
|
||||
vbc->get_icon("PackedByteArray", "EditorIcons"),
|
||||
vbc->get_icon("PackedInt32Array", "EditorIcons"),
|
||||
vbc->get_icon("PackedFloat32Array", "EditorIcons"),
|
||||
vbc->get_icon("PackedInt64Array", "EditorIcons"),
|
||||
vbc->get_icon("PackedFloat64Array", "EditorIcons"),
|
||||
vbc->get_icon("PackedStringArray", "EditorIcons"),
|
||||
vbc->get_icon("PackedVector2Array", "EditorIcons"),
|
||||
vbc->get_icon("PackedVector3Array", "EditorIcons"),
|
||||
vbc->get_icon("PackedColorArray", "EditorIcons")
|
||||
};
|
||||
{
|
||||
String b = String(E->get());
|
||||
|
@ -252,7 +252,7 @@ void VisualScriptPropertySelector::_update_search() {
|
|||
|
||||
TreeItem *item = search_options->create_item(category ? category : root);
|
||||
item->set_text(0, desc);
|
||||
item->set_icon(0, get_icon("MemberMethod", "EditorIcons"));
|
||||
item->set_icon(0, vbc->get_icon("MemberMethod", "EditorIcons"));
|
||||
item->set_metadata(0, name);
|
||||
item->set_selectable(0, true);
|
||||
|
||||
|
@ -316,7 +316,7 @@ void VisualScriptPropertySelector::create_visualscript_item(const String &name,
|
|||
if (search_input == String() || text.findn(search_input) != -1) {
|
||||
TreeItem *item = search_options->create_item(root);
|
||||
item->set_text(0, text);
|
||||
item->set_icon(0, get_icon("VisualScript", "EditorIcons"));
|
||||
item->set_icon(0, vbc->get_icon("VisualScript", "EditorIcons"));
|
||||
item->set_metadata(0, name);
|
||||
item->set_metadata(1, "action");
|
||||
item->set_selectable(0, true);
|
||||
|
@ -399,7 +399,7 @@ void VisualScriptPropertySelector::get_visual_node_names(const String &root_filt
|
|||
}
|
||||
|
||||
item->set_text(0, type_name + String("").join(desc));
|
||||
item->set_icon(0, get_icon("VisualScript", "EditorIcons"));
|
||||
item->set_icon(0, vbc->get_icon("VisualScript", "EditorIcons"));
|
||||
item->set_selectable(0, true);
|
||||
item->set_metadata(0, E->get());
|
||||
item->set_selectable(0, true);
|
||||
|
@ -416,7 +416,7 @@ void VisualScriptPropertySelector::_confirmed() {
|
|||
if (!ti)
|
||||
return;
|
||||
emit_signal("selected", ti->get_metadata(0), ti->get_metadata(1), ti->get_metadata(2));
|
||||
hide();
|
||||
set_visible(false);
|
||||
}
|
||||
|
||||
void VisualScriptPropertySelector::_item_selected() {
|
||||
|
@ -519,7 +519,7 @@ void VisualScriptPropertySelector::_item_selected() {
|
|||
}
|
||||
|
||||
void VisualScriptPropertySelector::_hide_requested() {
|
||||
_closed(); // From WindowDialog.
|
||||
_cancel_pressed(); // From AcceptDialog.
|
||||
}
|
||||
|
||||
void VisualScriptPropertySelector::_notification(int p_what) {
|
||||
|
@ -684,12 +684,8 @@ void VisualScriptPropertySelector::select_from_visual_script(const String &p_bas
|
|||
}
|
||||
|
||||
void VisualScriptPropertySelector::show_window(float p_screen_ratio) {
|
||||
Rect2 rect;
|
||||
Point2 window_size = get_viewport_rect().size;
|
||||
rect.size = (window_size * p_screen_ratio).floor();
|
||||
rect.size.x = rect.size.x / 2.2f;
|
||||
rect.position = ((window_size - rect.size) / 2.0f).floor();
|
||||
popup(rect);
|
||||
|
||||
popup_centered_ratio(p_screen_ratio);
|
||||
}
|
||||
|
||||
void VisualScriptPropertySelector::_bind_methods() {
|
||||
|
@ -699,7 +695,7 @@ void VisualScriptPropertySelector::_bind_methods() {
|
|||
|
||||
VisualScriptPropertySelector::VisualScriptPropertySelector() {
|
||||
|
||||
VBoxContainer *vbc = memnew(VBoxContainer);
|
||||
vbc = memnew(VBoxContainer);
|
||||
add_child(vbc);
|
||||
//set_child_rect(vbc);
|
||||
search_box = memnew(LineEdit);
|
||||
|
|
|
@ -64,6 +64,7 @@ class VisualScriptPropertySelector : public ConfirmationDialog {
|
|||
Object *instance;
|
||||
bool virtuals_only;
|
||||
bool seq_connect;
|
||||
VBoxContainer *vbc;
|
||||
|
||||
Vector<Variant::Type> type_filter;
|
||||
|
||||
|
|
|
@ -479,7 +479,9 @@ static String _clipboard_get_impl(Atom p_source, Window x11_window, ::Display *x
|
|||
ret.parse_utf8((const char *)data);
|
||||
} else
|
||||
printf("FAIL\n");
|
||||
XFree(data);
|
||||
if (data) {
|
||||
XFree(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -623,8 +625,7 @@ Vector<DisplayServer::WindowID> DisplayServerX11::get_window_list() const {
|
|||
|
||||
DisplayServer::WindowID DisplayServerX11::create_sub_window(WindowMode p_mode, uint32_t p_flags, const Rect2i &p_rect) {
|
||||
|
||||
WindowID id = _create_window(p_mode, p_rect.size);
|
||||
window_set_position(p_rect.position, id);
|
||||
WindowID id = _create_window(p_mode, p_rect);
|
||||
for (int i = 0; i < WINDOW_FLAG_MAX; i++) {
|
||||
if (p_flags & (1 << i)) {
|
||||
window_set_flag(WindowFlags(i), true, id);
|
||||
|
@ -635,7 +636,7 @@ DisplayServer::WindowID DisplayServerX11::create_sub_window(WindowMode p_mode, u
|
|||
}
|
||||
|
||||
void DisplayServerX11::delete_sub_window(WindowID p_id) {
|
||||
ERR_FAIL_COND(windows.has(p_id));
|
||||
ERR_FAIL_COND(!windows.has(p_id));
|
||||
ERR_FAIL_COND_MSG(p_id == MAIN_WINDOW_ID, "Main window can't be deleted"); //ma
|
||||
|
||||
WindowData &wd = windows[p_id];
|
||||
|
@ -800,7 +801,7 @@ void DisplayServerX11::window_set_position(const Point2i &p_position, WindowID p
|
|||
unsigned long remaining;
|
||||
unsigned char *data = NULL;
|
||||
if (XGetWindowProperty(x11_display, wd.x11_window, prop, 0, 4, False, AnyPropertyType, &type, &format, &len, &remaining, &data) == Success) {
|
||||
if (format == 32 && len == 4) {
|
||||
if (format == 32 && len == 4 && data) {
|
||||
long *extents = (long *)data;
|
||||
x = extents[0];
|
||||
y = extents[2];
|
||||
|
@ -963,7 +964,7 @@ Size2i DisplayServerX11::window_get_real_size(WindowID p_window) const {
|
|||
unsigned long remaining;
|
||||
unsigned char *data = NULL;
|
||||
if (XGetWindowProperty(x11_display, wd.x11_window, prop, 0, 4, False, AnyPropertyType, &type, &format, &len, &remaining, &data) == Success) {
|
||||
if (format == 32 && len == 4) {
|
||||
if (format == 32 && len == 4 && data) {
|
||||
long *extents = (long *)data;
|
||||
w += extents[0] + extents[1]; // left, right
|
||||
h += extents[2] + extents[3]; // top, bottom
|
||||
|
@ -1000,7 +1001,7 @@ bool DisplayServerX11::window_is_maximize_allowed(WindowID p_window) const {
|
|||
&remaining,
|
||||
&data);
|
||||
|
||||
if (result == Success) {
|
||||
if (result == Success && data) {
|
||||
Atom *atoms = (Atom *)data;
|
||||
Atom wm_act_max_horz = XInternAtom(x11_display, "_NET_WM_ACTION_MAXIMIZE_HORZ", False);
|
||||
Atom wm_act_max_vert = XInternAtom(x11_display, "_NET_WM_ACTION_MAXIMIZE_VERT", False);
|
||||
|
@ -1280,7 +1281,7 @@ DisplayServer::WindowMode DisplayServerX11::window_get_mode(WindowID p_window) c
|
|||
&remaining,
|
||||
&data);
|
||||
|
||||
if (result == Success) {
|
||||
if (result == Success && data) {
|
||||
Atom *atoms = (Atom *)data;
|
||||
Atom wm_max_horz = XInternAtom(x11_display, "_NET_WM_STATE_MAXIMIZED_HORZ", False);
|
||||
Atom wm_max_vert = XInternAtom(x11_display, "_NET_WM_STATE_MAXIMIZED_VERT", False);
|
||||
|
@ -1298,9 +1299,10 @@ DisplayServer::WindowMode DisplayServerX11::window_get_mode(WindowID p_window) c
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
XFree(data);
|
||||
}
|
||||
|
||||
XFree(data);
|
||||
if (retval) {
|
||||
return WINDOW_MODE_MAXIMIZED;
|
||||
}
|
||||
|
@ -1329,7 +1331,7 @@ DisplayServer::WindowMode DisplayServerX11::window_get_mode(WindowID p_window) c
|
|||
&remaining,
|
||||
&data);
|
||||
|
||||
if (result == Success) {
|
||||
if (result == Success && data) {
|
||||
long *state = (long *)data;
|
||||
if (state[0] == WM_IconicState)
|
||||
return WINDOW_MODE_MINIMIZED;
|
||||
|
@ -1451,7 +1453,9 @@ bool DisplayServerX11::window_get_flag(WindowFlags p_flag, WindowID p_window) co
|
|||
if (data && (format == 32) && (len >= 5)) {
|
||||
borderless = !((Hints *)data)->decorations;
|
||||
}
|
||||
XFree(data);
|
||||
if (data) {
|
||||
XFree(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
return borderless;
|
||||
|
@ -1886,6 +1890,7 @@ void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event,
|
|||
|
||||
_get_key_modifier_state(xkeyevent->state, k);
|
||||
|
||||
k->set_window_id(p_window);
|
||||
k->set_unicode(tmp[i]);
|
||||
|
||||
k->set_pressed(keypress);
|
||||
|
@ -1967,6 +1972,7 @@ void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event,
|
|||
|
||||
Ref<InputEventKey> k;
|
||||
k.instance();
|
||||
k->set_window_id(p_window);
|
||||
|
||||
_get_key_modifier_state(xkeyevent->state, k);
|
||||
|
||||
|
@ -2085,6 +2091,7 @@ void DisplayServerX11::_window_changed(XEvent *event) {
|
|||
// Not portable.
|
||||
window_set_ime_position(Point2(0, 1));
|
||||
}
|
||||
|
||||
if ((event->xconfigure.width == wd.size.width) &&
|
||||
(event->xconfigure.height == wd.size.height))
|
||||
return;
|
||||
|
@ -2861,7 +2868,7 @@ DisplayServer *DisplayServerX11::create_func(const String &p_rendering_driver, W
|
|||
return memnew(DisplayServerX11(p_rendering_driver, p_mode, p_flags, p_resolution, r_error));
|
||||
}
|
||||
|
||||
DisplayServerX11::WindowID DisplayServerX11::_create_window(WindowMode p_mode, const Vector2i &p_resolution) {
|
||||
DisplayServerX11::WindowID DisplayServerX11::_create_window(WindowMode p_mode, const Rect2i &p_rect) {
|
||||
|
||||
//Create window
|
||||
|
||||
|
@ -2884,8 +2891,22 @@ DisplayServerX11::WindowID DisplayServerX11::_create_window(WindowMode p_mode, c
|
|||
WindowID id;
|
||||
{
|
||||
WindowData wd;
|
||||
wd.x11_window = XCreateWindow(x11_display, RootWindow(x11_display, visualInfo->screen), 0, 0, p_resolution.width, p_resolution.height, 0, visualInfo->depth, InputOutput, visualInfo->visual, valuemask, &windowAttributes);
|
||||
wd.x11_window = XCreateWindow(x11_display, RootWindow(x11_display, visualInfo->screen), p_rect.position.x, p_rect.position.y, p_rect.size.width, p_rect.size.height, 0, visualInfo->depth, InputOutput, visualInfo->visual, valuemask, &windowAttributes);
|
||||
|
||||
if (windows.size() > 0) {
|
||||
//this is a sub window, don't let the window manager put it wherever it wants
|
||||
|
||||
XSizeHints my_hints = { 0 };
|
||||
|
||||
my_hints.flags = PPosition | PSize; /* I want to specify position and size */
|
||||
my_hints.x = p_rect.position.x; /* The origin and size coords I want */
|
||||
my_hints.y = p_rect.position.y;
|
||||
my_hints.width = p_rect.size.width;
|
||||
my_hints.height = p_rect.size.height;
|
||||
|
||||
XSetNormalHints(x11_display, wd.x11_window, &my_hints);
|
||||
//its still not working :(
|
||||
}
|
||||
//set_class_hint(x11_display, wd.x11_window);
|
||||
XMapWindow(x11_display, wd.x11_window);
|
||||
XFlush(x11_display);
|
||||
|
@ -2897,7 +2918,7 @@ DisplayServerX11::WindowID DisplayServerX11::_create_window(WindowMode p_mode, c
|
|||
|
||||
#if defined(VULKAN_ENABLED)
|
||||
if (context_vulkan) {
|
||||
Error err = context_vulkan->window_create(window_id_counter, wd.x11_window, x11_display, p_resolution.width, p_resolution.height);
|
||||
Error err = context_vulkan->window_create(window_id_counter, wd.x11_window, x11_display, p_rect.size.width, p_rect.size.height);
|
||||
ERR_FAIL_COND_V_MSG(err != OK, INVALID_WINDOW_ID, "Can't create a Vulkan window");
|
||||
}
|
||||
#endif
|
||||
|
@ -2988,6 +3009,19 @@ DisplayServerX11::WindowID DisplayServerX11::_create_window(WindowMode p_mode, c
|
|||
|
||||
window_set_mode(p_mode, id);
|
||||
|
||||
//sync size
|
||||
{
|
||||
XWindowAttributes xwa;
|
||||
|
||||
XSync(x11_display, False);
|
||||
XGetWindowAttributes(x11_display, wd.x11_window, &xwa);
|
||||
|
||||
wd.size.width = xwa.width;
|
||||
wd.size.height = xwa.height;
|
||||
|
||||
//print_line("created at rect: " + p_rect + " but at rect " + Rect2i(xwa.x, xwa.y, xwa.width, xwa.height));
|
||||
}
|
||||
|
||||
//set cursor
|
||||
if (cursors[current_cursor] != None) {
|
||||
|
||||
|
@ -3225,7 +3259,7 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
|
|||
}
|
||||
#endif
|
||||
|
||||
WindowID main_window = _create_window(p_mode, p_resolution);
|
||||
WindowID main_window = _create_window(p_mode, Rect2i(Point2(), p_resolution));
|
||||
for (int i = 0; i < WINDOW_FLAG_MAX; i++) {
|
||||
if (p_flags & (1 << i)) {
|
||||
window_set_flag(WindowFlags(i), true, main_window);
|
||||
|
|
|
@ -140,7 +140,7 @@ class DisplayServerX11 : public DisplayServer {
|
|||
Map<WindowID, WindowData> windows;
|
||||
|
||||
WindowID window_id_counter = MAIN_WINDOW_ID;
|
||||
WindowID _create_window(WindowMode p_mode, const Vector2i &p_resolution);
|
||||
WindowID _create_window(WindowMode p_mode, const Rect2i &p_rect);
|
||||
|
||||
String internal_clipboard;
|
||||
Window xdnd_source_window;
|
||||
|
|
|
@ -348,6 +348,9 @@ bool CanvasItem::is_visible_in_tree() const {
|
|||
while (p) {
|
||||
if (!p->visible)
|
||||
return false;
|
||||
if (p->window && !p->window->is_visible()) {
|
||||
return false;
|
||||
}
|
||||
p = p->get_parent_item();
|
||||
}
|
||||
|
||||
|
@ -549,10 +552,30 @@ void CanvasItem::_notification(int p_what) {
|
|||
_update_texture_repeat_changed(false);
|
||||
|
||||
first_draw = true;
|
||||
if (get_parent()) {
|
||||
CanvasItem *ci = Object::cast_to<CanvasItem>(get_parent());
|
||||
Node *parent = get_parent();
|
||||
if (parent) {
|
||||
CanvasItem *ci = Object::cast_to<CanvasItem>(parent);
|
||||
if (ci)
|
||||
C = ci->children_items.push_back(this);
|
||||
if (!ci) {
|
||||
//look for a window
|
||||
Viewport *viewport = nullptr;
|
||||
|
||||
while (parent) {
|
||||
viewport = Object::cast_to<Viewport>(parent);
|
||||
if (viewport) {
|
||||
break;
|
||||
}
|
||||
parent = parent->get_parent();
|
||||
}
|
||||
|
||||
ERR_FAIL_COND(!viewport);
|
||||
|
||||
window = Object::cast_to<Window>(viewport);
|
||||
if (window) {
|
||||
window->connect(SceneStringNames::get_singleton()->visibility_changed, callable_mp(this, &CanvasItem::_window_visibility_changed));
|
||||
}
|
||||
}
|
||||
}
|
||||
_enter_canvas();
|
||||
if (!block_transform_notify && !xform_change.in_list()) {
|
||||
|
@ -581,6 +604,9 @@ void CanvasItem::_notification(int p_what) {
|
|||
Object::cast_to<CanvasItem>(get_parent())->children_items.erase(C);
|
||||
C = NULL;
|
||||
}
|
||||
if (window) {
|
||||
window->disconnect(SceneStringNames::get_singleton()->visibility_changed, callable_mp(this, &CanvasItem::_window_visibility_changed));
|
||||
}
|
||||
global_invalid = true;
|
||||
} break;
|
||||
case NOTIFICATION_DRAW:
|
||||
|
@ -601,6 +627,14 @@ void CanvasItem::set_visible(bool p_visible) {
|
|||
else
|
||||
hide();
|
||||
}
|
||||
|
||||
void CanvasItem::_window_visibility_changed() {
|
||||
|
||||
if (visible) {
|
||||
_propagate_visibility_changed(window->is_visible());
|
||||
}
|
||||
}
|
||||
|
||||
bool CanvasItem::is_visible() const {
|
||||
|
||||
return visible;
|
||||
|
@ -1409,6 +1443,7 @@ CanvasItem::TextureRepeat CanvasItem::get_texture_repeat() const {
|
|||
CanvasItem::CanvasItem() :
|
||||
xform_change(this) {
|
||||
|
||||
window = nullptr;
|
||||
canvas_item = VisualServer::get_singleton()->canvas_item_create();
|
||||
visible = true;
|
||||
pending_update = false;
|
||||
|
|
|
@ -201,6 +201,7 @@ private:
|
|||
|
||||
int light_mask;
|
||||
|
||||
Window *window;
|
||||
bool first_draw;
|
||||
bool visible;
|
||||
bool pending_update;
|
||||
|
@ -232,6 +233,8 @@ private:
|
|||
void _enter_canvas();
|
||||
void _exit_canvas();
|
||||
|
||||
void _window_visibility_changed();
|
||||
|
||||
void _notify_transform(CanvasItem *p_node);
|
||||
|
||||
void _set_on_top(bool p_on_top) { set_draw_behind_parent(!p_on_top); }
|
||||
|
|
|
@ -438,22 +438,30 @@ void Control::_resize(const Size2 &p_size) {
|
|||
void Control::add_child_notify(Node *p_child) {
|
||||
|
||||
Control *child_c = Object::cast_to<Control>(p_child);
|
||||
if (!child_c)
|
||||
return;
|
||||
|
||||
if (child_c->data.theme.is_null() && data.theme_owner) {
|
||||
_propagate_theme_changed(child_c, data.theme_owner); //need to propagate here, since many controls may require setting up stuff
|
||||
if (child_c && child_c->data.theme.is_null() && (data.theme_owner || data.theme_owner_window)) {
|
||||
_propagate_theme_changed(child_c, data.theme_owner, data.theme_owner_window); //need to propagate here, since many controls may require setting up stuff
|
||||
}
|
||||
|
||||
Window *child_w = Object::cast_to<Window>(p_child);
|
||||
|
||||
if (child_w && child_w->theme.is_null() && (data.theme_owner || data.theme_owner_window)) {
|
||||
_propagate_theme_changed(child_w, data.theme_owner, data.theme_owner_window); //need to propagate here, since many controls may require setting up stuff
|
||||
}
|
||||
}
|
||||
|
||||
void Control::remove_child_notify(Node *p_child) {
|
||||
|
||||
Control *child_c = Object::cast_to<Control>(p_child);
|
||||
if (!child_c)
|
||||
return;
|
||||
|
||||
if (child_c->data.theme_owner && child_c->data.theme.is_null()) {
|
||||
_propagate_theme_changed(child_c, NULL);
|
||||
if (child_c && (child_c->data.theme_owner || child_c->data.theme_owner_window) && child_c->data.theme.is_null()) {
|
||||
_propagate_theme_changed(child_c, NULL, NULL);
|
||||
}
|
||||
|
||||
Window *child_w = Object::cast_to<Window>(p_child);
|
||||
|
||||
if (child_w && (child_w->theme_owner || child_w->theme_owner_window) && child_w->theme.is_null()) {
|
||||
_propagate_theme_changed(child_w, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -808,6 +816,97 @@ Size2 Control::get_minimum_size() const {
|
|||
return Size2();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool Control::_find_theme_item(T &r_ret, T (Theme::*get_func)(const StringName &, const StringName &) const, bool (Theme::*has_func)(const StringName &, const StringName &) const, const StringName &p_name, const StringName &p_type) const {
|
||||
|
||||
// try with custom themes
|
||||
Control *theme_owner = data.theme_owner;
|
||||
Window *theme_owner_window = data.theme_owner_window;
|
||||
|
||||
while (theme_owner || theme_owner_window) {
|
||||
|
||||
StringName class_name = p_type;
|
||||
|
||||
while (class_name != StringName()) {
|
||||
if (theme_owner && (theme_owner->data.theme.operator->()->*has_func)(p_name, class_name)) {
|
||||
r_ret = (theme_owner->data.theme.operator->()->*get_func)(p_name, class_name);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (theme_owner_window && (theme_owner_window->theme.operator->()->*has_func)(p_name, class_name)) {
|
||||
r_ret = (theme_owner_window->theme.operator->()->*get_func)(p_name, class_name);
|
||||
return true;
|
||||
}
|
||||
|
||||
class_name = ClassDB::get_parent_class_nocheck(class_name);
|
||||
}
|
||||
|
||||
Node *parent = theme_owner ? theme_owner->get_parent() : theme_owner_window->get_parent();
|
||||
|
||||
Control *parent_c = Object::cast_to<Control>(parent);
|
||||
|
||||
if (parent_c) {
|
||||
theme_owner = parent_c->data.theme_owner;
|
||||
theme_owner_window = parent_c->data.theme_owner_window;
|
||||
} else {
|
||||
Window *parent_w = Object::cast_to<Window>(parent);
|
||||
if (parent_w) {
|
||||
theme_owner = parent_w->theme_owner;
|
||||
theme_owner_window = parent_w->theme_owner_window;
|
||||
} else {
|
||||
|
||||
theme_owner = NULL;
|
||||
theme_owner_window = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Control::_has_theme_item(bool (Theme::*has_func)(const StringName &, const StringName &) const, const StringName &p_name, const StringName &p_type) const {
|
||||
|
||||
// try with custom themes
|
||||
Control *theme_owner = data.theme_owner;
|
||||
Window *theme_owner_window = data.theme_owner_window;
|
||||
|
||||
while (theme_owner || theme_owner_window) {
|
||||
|
||||
StringName class_name = p_type;
|
||||
|
||||
while (class_name != StringName()) {
|
||||
if (theme_owner && (theme_owner->data.theme.operator->()->*has_func)(p_name, class_name)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (theme_owner_window && (theme_owner_window->theme.operator->()->*has_func)(p_name, class_name)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
class_name = ClassDB::get_parent_class_nocheck(class_name);
|
||||
}
|
||||
|
||||
Node *parent = theme_owner ? theme_owner->get_parent() : theme_owner_window->get_parent();
|
||||
|
||||
Control *parent_c = Object::cast_to<Control>(parent);
|
||||
|
||||
if (parent_c) {
|
||||
theme_owner = parent_c->data.theme_owner;
|
||||
theme_owner_window = parent_c->data.theme_owner_window;
|
||||
} else {
|
||||
Window *parent_w = Object::cast_to<Window>(parent);
|
||||
if (parent_w) {
|
||||
theme_owner = parent_w->theme_owner;
|
||||
theme_owner_window = parent_w->theme_owner_window;
|
||||
} else {
|
||||
|
||||
theme_owner = NULL;
|
||||
theme_owner_window = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Ref<Texture2D> Control::get_icon(const StringName &p_name, const StringName &p_type) const {
|
||||
|
||||
if (p_type == StringName() || p_type == get_class_name()) {
|
||||
|
@ -819,27 +918,10 @@ Ref<Texture2D> Control::get_icon(const StringName &p_name, const StringName &p_t
|
|||
|
||||
StringName type = p_type ? p_type : get_class_name();
|
||||
|
||||
// try with custom themes
|
||||
Control *theme_owner = data.theme_owner;
|
||||
Ref<Texture2D> icon;
|
||||
|
||||
while (theme_owner) {
|
||||
|
||||
StringName class_name = type;
|
||||
|
||||
while (class_name != StringName()) {
|
||||
if (theme_owner->data.theme->has_icon(p_name, class_name)) {
|
||||
return theme_owner->data.theme->get_icon(p_name, class_name);
|
||||
}
|
||||
|
||||
class_name = ClassDB::get_parent_class_nocheck(class_name);
|
||||
}
|
||||
|
||||
Control *parent = Object::cast_to<Control>(theme_owner->get_parent());
|
||||
|
||||
if (parent)
|
||||
theme_owner = parent->data.theme_owner;
|
||||
else
|
||||
theme_owner = NULL;
|
||||
if (_find_theme_item(icon, &Theme::get_icon, &Theme::has_icon, p_name, type)) {
|
||||
return icon;
|
||||
}
|
||||
|
||||
if (Theme::get_project_default().is_valid()) {
|
||||
|
@ -861,27 +943,10 @@ Ref<Shader> Control::get_shader(const StringName &p_name, const StringName &p_ty
|
|||
|
||||
StringName type = p_type ? p_type : get_class_name();
|
||||
|
||||
// try with custom themes
|
||||
Control *theme_owner = data.theme_owner;
|
||||
Ref<Shader> shader;
|
||||
|
||||
while (theme_owner) {
|
||||
|
||||
StringName class_name = type;
|
||||
|
||||
while (class_name != StringName()) {
|
||||
if (theme_owner->data.theme->has_shader(p_name, class_name)) {
|
||||
return theme_owner->data.theme->get_shader(p_name, class_name);
|
||||
}
|
||||
|
||||
class_name = ClassDB::get_parent_class_nocheck(class_name);
|
||||
}
|
||||
|
||||
Control *parent = Object::cast_to<Control>(theme_owner->get_parent());
|
||||
|
||||
if (parent)
|
||||
theme_owner = parent->data.theme_owner;
|
||||
else
|
||||
theme_owner = NULL;
|
||||
if (_find_theme_item(shader, &Theme::get_shader, &Theme::has_shader, p_name, type)) {
|
||||
return shader;
|
||||
}
|
||||
|
||||
if (Theme::get_project_default().is_valid()) {
|
||||
|
@ -903,40 +968,18 @@ Ref<StyleBox> Control::get_stylebox(const StringName &p_name, const StringName &
|
|||
|
||||
StringName type = p_type ? p_type : get_class_name();
|
||||
|
||||
// try with custom themes
|
||||
Control *theme_owner = data.theme_owner;
|
||||
Ref<StyleBox> stylebox;
|
||||
|
||||
StringName class_name = type;
|
||||
|
||||
while (theme_owner) {
|
||||
|
||||
while (class_name != StringName()) {
|
||||
if (theme_owner->data.theme->has_stylebox(p_name, class_name)) {
|
||||
return theme_owner->data.theme->get_stylebox(p_name, class_name);
|
||||
}
|
||||
|
||||
class_name = ClassDB::get_parent_class_nocheck(class_name);
|
||||
}
|
||||
|
||||
class_name = type;
|
||||
|
||||
Control *parent = Object::cast_to<Control>(theme_owner->get_parent());
|
||||
|
||||
if (parent)
|
||||
theme_owner = parent->data.theme_owner;
|
||||
else
|
||||
theme_owner = NULL;
|
||||
if (_find_theme_item(stylebox, &Theme::get_stylebox, &Theme::has_stylebox, p_name, type)) {
|
||||
return stylebox;
|
||||
}
|
||||
|
||||
while (class_name != StringName()) {
|
||||
if (Theme::get_project_default().is_valid() && Theme::get_project_default()->has_stylebox(p_name, type))
|
||||
if (Theme::get_project_default().is_valid()) {
|
||||
if (Theme::get_project_default()->has_stylebox(p_name, type)) {
|
||||
return Theme::get_project_default()->get_stylebox(p_name, type);
|
||||
|
||||
if (Theme::get_default()->has_stylebox(p_name, class_name))
|
||||
return Theme::get_default()->get_stylebox(p_name, class_name);
|
||||
|
||||
class_name = ClassDB::get_parent_class_nocheck(class_name);
|
||||
}
|
||||
}
|
||||
|
||||
return Theme::get_default()->get_stylebox(p_name, type);
|
||||
}
|
||||
Ref<Font> Control::get_font(const StringName &p_name, const StringName &p_type) const {
|
||||
|
@ -949,29 +992,16 @@ Ref<Font> Control::get_font(const StringName &p_name, const StringName &p_type)
|
|||
|
||||
StringName type = p_type ? p_type : get_class_name();
|
||||
|
||||
// try with custom themes
|
||||
Control *theme_owner = data.theme_owner;
|
||||
Ref<Font> font;
|
||||
|
||||
while (theme_owner) {
|
||||
if (_find_theme_item(font, &Theme::get_font, &Theme::has_font, p_name, type)) {
|
||||
return font;
|
||||
}
|
||||
|
||||
StringName class_name = type;
|
||||
|
||||
while (class_name != StringName()) {
|
||||
if (theme_owner->data.theme->has_font(p_name, class_name)) {
|
||||
return theme_owner->data.theme->get_font(p_name, class_name);
|
||||
}
|
||||
|
||||
class_name = ClassDB::get_parent_class_nocheck(class_name);
|
||||
if (Theme::get_project_default().is_valid()) {
|
||||
if (Theme::get_project_default()->has_font(p_name, type)) {
|
||||
return Theme::get_project_default()->get_font(p_name, type);
|
||||
}
|
||||
|
||||
if (theme_owner->data.theme->get_default_theme_font().is_valid())
|
||||
return theme_owner->data.theme->get_default_theme_font();
|
||||
Control *parent = Object::cast_to<Control>(theme_owner->get_parent());
|
||||
|
||||
if (parent)
|
||||
theme_owner = parent->data.theme_owner;
|
||||
else
|
||||
theme_owner = NULL;
|
||||
}
|
||||
|
||||
return Theme::get_default()->get_font(p_name, type);
|
||||
|
@ -985,27 +1015,11 @@ Color Control::get_color(const StringName &p_name, const StringName &p_type) con
|
|||
}
|
||||
|
||||
StringName type = p_type ? p_type : get_class_name();
|
||||
// try with custom themes
|
||||
Control *theme_owner = data.theme_owner;
|
||||
|
||||
while (theme_owner) {
|
||||
Color color;
|
||||
|
||||
StringName class_name = type;
|
||||
|
||||
while (class_name != StringName()) {
|
||||
if (theme_owner->data.theme->has_color(p_name, class_name)) {
|
||||
return theme_owner->data.theme->get_color(p_name, class_name);
|
||||
}
|
||||
|
||||
class_name = ClassDB::get_parent_class_nocheck(class_name);
|
||||
}
|
||||
|
||||
Control *parent = Object::cast_to<Control>(theme_owner->get_parent());
|
||||
|
||||
if (parent)
|
||||
theme_owner = parent->data.theme_owner;
|
||||
else
|
||||
theme_owner = NULL;
|
||||
if (_find_theme_item(color, &Theme::get_color, &Theme::has_color, p_name, type)) {
|
||||
return color;
|
||||
}
|
||||
|
||||
if (Theme::get_project_default().is_valid()) {
|
||||
|
@ -1025,27 +1039,11 @@ int Control::get_constant(const StringName &p_name, const StringName &p_type) co
|
|||
}
|
||||
|
||||
StringName type = p_type ? p_type : get_class_name();
|
||||
// try with custom themes
|
||||
Control *theme_owner = data.theme_owner;
|
||||
|
||||
while (theme_owner) {
|
||||
int constant;
|
||||
|
||||
StringName class_name = type;
|
||||
|
||||
while (class_name != StringName()) {
|
||||
if (theme_owner->data.theme->has_constant(p_name, class_name)) {
|
||||
return theme_owner->data.theme->get_constant(p_name, class_name);
|
||||
}
|
||||
|
||||
class_name = ClassDB::get_parent_class_nocheck(class_name);
|
||||
}
|
||||
|
||||
Control *parent = Object::cast_to<Control>(theme_owner->get_parent());
|
||||
|
||||
if (parent)
|
||||
theme_owner = parent->data.theme_owner;
|
||||
else
|
||||
theme_owner = NULL;
|
||||
if (_find_theme_item(constant, &Theme::get_constant, &Theme::has_constant, p_name, type)) {
|
||||
return constant;
|
||||
}
|
||||
|
||||
if (Theme::get_project_default().is_valid()) {
|
||||
|
@ -1101,26 +1099,8 @@ bool Control::has_icon(const StringName &p_name, const StringName &p_type) const
|
|||
|
||||
StringName type = p_type ? p_type : get_class_name();
|
||||
|
||||
// try with custom themes
|
||||
Control *theme_owner = data.theme_owner;
|
||||
|
||||
while (theme_owner) {
|
||||
|
||||
StringName class_name = type;
|
||||
|
||||
while (class_name != StringName()) {
|
||||
if (theme_owner->data.theme->has_icon(p_name, class_name)) {
|
||||
return true;
|
||||
}
|
||||
class_name = ClassDB::get_parent_class_nocheck(class_name);
|
||||
}
|
||||
|
||||
Control *parent = Object::cast_to<Control>(theme_owner->get_parent());
|
||||
|
||||
if (parent)
|
||||
theme_owner = parent->data.theme_owner;
|
||||
else
|
||||
theme_owner = NULL;
|
||||
if (_has_theme_item(&Theme::has_icon, p_name, type)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Theme::get_project_default().is_valid()) {
|
||||
|
@ -1140,26 +1120,8 @@ bool Control::has_shader(const StringName &p_name, const StringName &p_type) con
|
|||
|
||||
StringName type = p_type ? p_type : get_class_name();
|
||||
|
||||
// try with custom themes
|
||||
Control *theme_owner = data.theme_owner;
|
||||
|
||||
while (theme_owner) {
|
||||
|
||||
StringName class_name = type;
|
||||
|
||||
while (class_name != StringName()) {
|
||||
if (theme_owner->data.theme->has_shader(p_name, class_name)) {
|
||||
return true;
|
||||
}
|
||||
class_name = ClassDB::get_parent_class_nocheck(class_name);
|
||||
}
|
||||
|
||||
Control *parent = Object::cast_to<Control>(theme_owner->get_parent());
|
||||
|
||||
if (parent)
|
||||
theme_owner = parent->data.theme_owner;
|
||||
else
|
||||
theme_owner = NULL;
|
||||
if (_has_theme_item(&Theme::has_shader, p_name, type)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Theme::get_project_default().is_valid()) {
|
||||
|
@ -1178,26 +1140,8 @@ bool Control::has_stylebox(const StringName &p_name, const StringName &p_type) c
|
|||
|
||||
StringName type = p_type ? p_type : get_class_name();
|
||||
|
||||
// try with custom themes
|
||||
Control *theme_owner = data.theme_owner;
|
||||
|
||||
while (theme_owner) {
|
||||
|
||||
StringName class_name = type;
|
||||
|
||||
while (class_name != StringName()) {
|
||||
if (theme_owner->data.theme->has_stylebox(p_name, class_name)) {
|
||||
return true;
|
||||
}
|
||||
class_name = ClassDB::get_parent_class_nocheck(class_name);
|
||||
}
|
||||
|
||||
Control *parent = Object::cast_to<Control>(theme_owner->get_parent());
|
||||
|
||||
if (parent)
|
||||
theme_owner = parent->data.theme_owner;
|
||||
else
|
||||
theme_owner = NULL;
|
||||
if (_has_theme_item(&Theme::has_stylebox, p_name, type)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Theme::get_project_default().is_valid()) {
|
||||
|
@ -1216,26 +1160,8 @@ bool Control::has_font(const StringName &p_name, const StringName &p_type) const
|
|||
|
||||
StringName type = p_type ? p_type : get_class_name();
|
||||
|
||||
// try with custom themes
|
||||
Control *theme_owner = data.theme_owner;
|
||||
|
||||
while (theme_owner) {
|
||||
|
||||
StringName class_name = type;
|
||||
|
||||
while (class_name != StringName()) {
|
||||
if (theme_owner->data.theme->has_font(p_name, class_name)) {
|
||||
return true;
|
||||
}
|
||||
class_name = ClassDB::get_parent_class_nocheck(class_name);
|
||||
}
|
||||
|
||||
Control *parent = Object::cast_to<Control>(theme_owner->get_parent());
|
||||
|
||||
if (parent)
|
||||
theme_owner = parent->data.theme_owner;
|
||||
else
|
||||
theme_owner = NULL;
|
||||
if (_has_theme_item(&Theme::has_font, p_name, type)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Theme::get_project_default().is_valid()) {
|
||||
|
@ -1255,26 +1181,8 @@ bool Control::has_color(const StringName &p_name, const StringName &p_type) cons
|
|||
|
||||
StringName type = p_type ? p_type : get_class_name();
|
||||
|
||||
// try with custom themes
|
||||
Control *theme_owner = data.theme_owner;
|
||||
|
||||
while (theme_owner) {
|
||||
|
||||
StringName class_name = type;
|
||||
|
||||
while (class_name != StringName()) {
|
||||
if (theme_owner->data.theme->has_color(p_name, class_name)) {
|
||||
return true;
|
||||
}
|
||||
class_name = ClassDB::get_parent_class_nocheck(class_name);
|
||||
}
|
||||
|
||||
Control *parent = Object::cast_to<Control>(theme_owner->get_parent());
|
||||
|
||||
if (parent)
|
||||
theme_owner = parent->data.theme_owner;
|
||||
else
|
||||
theme_owner = NULL;
|
||||
if (_has_theme_item(&Theme::has_color, p_name, type)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Theme::get_project_default().is_valid()) {
|
||||
|
@ -1294,26 +1202,8 @@ bool Control::has_constant(const StringName &p_name, const StringName &p_type) c
|
|||
|
||||
StringName type = p_type ? p_type : get_class_name();
|
||||
|
||||
// try with custom themes
|
||||
Control *theme_owner = data.theme_owner;
|
||||
|
||||
while (theme_owner) {
|
||||
|
||||
StringName class_name = type;
|
||||
|
||||
while (class_name != StringName()) {
|
||||
if (theme_owner->data.theme->has_constant(p_name, class_name)) {
|
||||
return true;
|
||||
}
|
||||
class_name = ClassDB::get_parent_class_nocheck(class_name);
|
||||
}
|
||||
|
||||
Control *parent = Object::cast_to<Control>(theme_owner->get_parent());
|
||||
|
||||
if (parent)
|
||||
theme_owner = parent->data.theme_owner;
|
||||
else
|
||||
theme_owner = NULL;
|
||||
if (_has_theme_item(&Theme::has_constant, p_name, type)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Theme::get_project_default().is_valid()) {
|
||||
|
@ -2222,18 +2112,32 @@ void Control::_modal_stack_remove() {
|
|||
data.modal_prev_focus_owner = ObjectID();
|
||||
}
|
||||
|
||||
void Control::_propagate_theme_changed(CanvasItem *p_at, Control *p_owner, bool p_assign) {
|
||||
void Control::_propagate_theme_changed(Node *p_at, Control *p_owner, Window *p_owner_window, bool p_assign) {
|
||||
|
||||
Control *c = Object::cast_to<Control>(p_at);
|
||||
|
||||
if (c && c != p_owner && c->data.theme.is_valid()) // has a theme, this can't be propagated
|
||||
return;
|
||||
|
||||
Window *w = c == nullptr ? Object::cast_to<Window>(p_at) : nullptr;
|
||||
|
||||
if (c && c != p_owner && c->data.theme.is_valid()) // has a theme, this can't be propagated
|
||||
return;
|
||||
|
||||
if (w && w != p_owner_window && w->theme.is_valid()) // has a theme, this can't be propagated
|
||||
return;
|
||||
|
||||
for (int i = 0; i < p_at->get_child_count(); i++) {
|
||||
|
||||
CanvasItem *child = Object::cast_to<CanvasItem>(p_at->get_child(i));
|
||||
if (child) {
|
||||
_propagate_theme_changed(child, p_owner, p_assign);
|
||||
_propagate_theme_changed(child, p_owner, p_owner_window, p_assign);
|
||||
} else {
|
||||
|
||||
Window *window = Object::cast_to<Window>(p_at->get_child(i));
|
||||
if (window) {
|
||||
_propagate_theme_changed(window, p_owner, p_owner_window, p_assign);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2241,14 +2145,26 @@ void Control::_propagate_theme_changed(CanvasItem *p_at, Control *p_owner, bool
|
|||
|
||||
if (p_assign) {
|
||||
c->data.theme_owner = p_owner;
|
||||
c->data.theme_owner_window = p_owner_window;
|
||||
}
|
||||
c->notification(NOTIFICATION_THEME_CHANGED);
|
||||
c->notification(Control::NOTIFICATION_THEME_CHANGED);
|
||||
c->emit_signal(SceneStringNames::get_singleton()->theme_changed);
|
||||
}
|
||||
|
||||
if (w) {
|
||||
|
||||
if (p_assign) {
|
||||
w->theme_owner = p_owner;
|
||||
w->theme_owner_window = p_owner_window;
|
||||
}
|
||||
w->notification(Window::NOTIFICATION_THEME_CHANGED);
|
||||
w->emit_signal(SceneStringNames::get_singleton()->theme_changed);
|
||||
}
|
||||
}
|
||||
|
||||
void Control::_theme_changed() {
|
||||
|
||||
_propagate_theme_changed(this, this, false);
|
||||
_propagate_theme_changed(this, this, nullptr, false);
|
||||
}
|
||||
|
||||
void Control::set_theme(const Ref<Theme> &p_theme) {
|
||||
|
@ -2264,15 +2180,21 @@ void Control::set_theme(const Ref<Theme> &p_theme) {
|
|||
if (!p_theme.is_null()) {
|
||||
|
||||
data.theme_owner = this;
|
||||
_propagate_theme_changed(this, this);
|
||||
data.theme_owner_window = nullptr;
|
||||
_propagate_theme_changed(this, this, nullptr);
|
||||
} else {
|
||||
|
||||
Control *parent = cast_to<Control>(get_parent());
|
||||
if (parent && parent->data.theme_owner) {
|
||||
_propagate_theme_changed(this, parent->data.theme_owner);
|
||||
} else {
|
||||
Control *parent_c = Object::cast_to<Control>(get_parent());
|
||||
|
||||
_propagate_theme_changed(this, NULL);
|
||||
if (parent_c && (parent_c->data.theme_owner || parent_c->data.theme_owner_window)) {
|
||||
Control::_propagate_theme_changed(this, parent_c->data.theme_owner, parent_c->data.theme_owner_window);
|
||||
} else {
|
||||
Window *parent_w = cast_to<Window>(get_parent());
|
||||
if (parent_w && (parent_w->theme_owner || parent_w->theme_owner_window)) {
|
||||
Control::_propagate_theme_changed(this, parent_w->theme_owner, parent_w->theme_owner_window);
|
||||
} else {
|
||||
Control::_propagate_theme_changed(this, nullptr, nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2564,6 +2486,12 @@ void Control::minimum_size_changed() {
|
|||
invalidate->data.minimum_size_valid = false;
|
||||
if (invalidate->is_set_as_toplevel())
|
||||
break; // do not go further up
|
||||
if (!invalidate->data.parent && get_parent()) {
|
||||
Window *parent_window = Object::cast_to<Window>(get_parent());
|
||||
if (parent_window && parent_window->is_wrapping_controls()) {
|
||||
parent_window->child_controls_changed();
|
||||
}
|
||||
}
|
||||
invalidate = invalidate->data.parent;
|
||||
}
|
||||
|
||||
|
@ -2653,6 +2581,7 @@ float Control::get_rotation_degrees() const {
|
|||
void Control::_override_changed() {
|
||||
|
||||
notification(NOTIFICATION_THEME_CHANGED);
|
||||
emit_signal(SceneStringNames::get_singleton()->theme_changed);
|
||||
minimum_size_changed(); // overrides are likely to affect minimum size
|
||||
}
|
||||
|
||||
|
@ -3078,6 +3007,7 @@ void Control::_bind_methods() {
|
|||
ADD_SIGNAL(MethodInfo("size_flags_changed"));
|
||||
ADD_SIGNAL(MethodInfo("minimum_size_changed"));
|
||||
ADD_SIGNAL(MethodInfo("modal_closed"));
|
||||
ADD_SIGNAL(MethodInfo("theme_changed"));
|
||||
|
||||
BIND_VMETHOD(MethodInfo(Variant::BOOL, "has_point", PropertyInfo(Variant::VECTOR2, "point")));
|
||||
}
|
||||
|
@ -3092,6 +3022,7 @@ Control::Control() {
|
|||
data.MI = NULL;
|
||||
data.RI = NULL;
|
||||
data.theme_owner = NULL;
|
||||
data.theme_owner_window = NULL;
|
||||
data.modal_exclusive = false;
|
||||
data.default_cursor = CURSOR_ARROW;
|
||||
data.h_size_flags = SIZE_FILL;
|
||||
|
|
|
@ -183,6 +183,7 @@ private:
|
|||
uint64_t modal_frame; //frame used to put something as modal
|
||||
Ref<Theme> theme;
|
||||
Control *theme_owner;
|
||||
Window *theme_owner_window;
|
||||
String tooltip;
|
||||
CursorShape default_cursor;
|
||||
|
||||
|
@ -218,7 +219,6 @@ private:
|
|||
void _set_global_position(const Point2 &p_point);
|
||||
void _set_size(const Size2 &p_size);
|
||||
|
||||
void _propagate_theme_changed(CanvasItem *p_at, Control *p_owner, bool p_assign = true);
|
||||
void _theme_changed();
|
||||
|
||||
void _change_notify_margins();
|
||||
|
@ -244,6 +244,13 @@ private:
|
|||
void _modal_set_prev_focus_owner(ObjectID p_prev);
|
||||
|
||||
void _update_minimum_size_cache();
|
||||
friend class Window;
|
||||
static void _propagate_theme_changed(Node *p_at, Control *p_owner, Window *p_owner_window, bool p_assign = true);
|
||||
|
||||
template <class T>
|
||||
_FORCE_INLINE_ bool _find_theme_item(T &, T (Theme::*get_func)(const StringName &, const StringName &) const, bool (Theme::*has_func)(const StringName &, const StringName &) const, const StringName &p_name, const StringName &p_type) const;
|
||||
|
||||
_FORCE_INLINE_ bool _has_theme_item(bool (Theme::*has_func)(const StringName &, const StringName &) const, const StringName &p_name, const StringName &p_type) const;
|
||||
|
||||
protected:
|
||||
virtual void add_child_notify(Node *p_child);
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
/*************************************************************************/
|
||||
|
||||
#include "dialogs.h"
|
||||
|
||||
#include "core/os/keyboard.h"
|
||||
#include "core/print_string.h"
|
||||
#include "core/translation.h"
|
||||
#include "line_edit.h"
|
||||
|
@ -39,359 +41,51 @@
|
|||
#include "scene/main/window.h" // Only used to check for more modals when dimming the editor.
|
||||
#endif
|
||||
|
||||
// WindowDialog
|
||||
|
||||
void WindowDialog::_post_popup() {
|
||||
|
||||
drag_type = DRAG_NONE; // just in case
|
||||
}
|
||||
|
||||
void WindowDialog::_fix_size() {
|
||||
|
||||
// Perhaps this should be called when the viewport resizes as well or windows go out of bounds...
|
||||
|
||||
// Ensure the whole window is visible.
|
||||
Point2i pos = get_global_position();
|
||||
Size2i size = get_size();
|
||||
Size2i viewport_size = get_viewport_rect().size;
|
||||
|
||||
// Windows require additional padding to keep the window chrome visible.
|
||||
Ref<StyleBox> panel = get_stylebox("panel", "WindowDialog");
|
||||
float top = 0;
|
||||
float left = 0;
|
||||
float bottom = 0;
|
||||
float right = 0;
|
||||
// Check validity, because the theme could contain a different type of StyleBox.
|
||||
if (panel->get_class() == "StyleBoxTexture") {
|
||||
Ref<StyleBoxTexture> panel_texture = Object::cast_to<StyleBoxTexture>(*panel);
|
||||
top = panel_texture->get_expand_margin_size(MARGIN_TOP);
|
||||
left = panel_texture->get_expand_margin_size(MARGIN_LEFT);
|
||||
bottom = panel_texture->get_expand_margin_size(MARGIN_BOTTOM);
|
||||
right = panel_texture->get_expand_margin_size(MARGIN_RIGHT);
|
||||
} else if (panel->get_class() == "StyleBoxFlat") {
|
||||
Ref<StyleBoxFlat> panel_flat = Object::cast_to<StyleBoxFlat>(*panel);
|
||||
top = panel_flat->get_expand_margin_size(MARGIN_TOP);
|
||||
left = panel_flat->get_expand_margin_size(MARGIN_LEFT);
|
||||
bottom = panel_flat->get_expand_margin_size(MARGIN_BOTTOM);
|
||||
right = panel_flat->get_expand_margin_size(MARGIN_RIGHT);
|
||||
}
|
||||
|
||||
pos.x = MAX(left, MIN(pos.x, viewport_size.x - size.x - right));
|
||||
pos.y = MAX(top, MIN(pos.y, viewport_size.y - size.y - bottom));
|
||||
set_global_position(pos);
|
||||
|
||||
if (resizable) {
|
||||
size.x = MIN(size.x, viewport_size.x - left - right);
|
||||
size.y = MIN(size.y, viewport_size.y - top - bottom);
|
||||
set_size(size);
|
||||
}
|
||||
}
|
||||
|
||||
bool WindowDialog::has_point(const Point2 &p_point) const {
|
||||
|
||||
Rect2 r(Point2(), get_size());
|
||||
|
||||
// Enlarge upwards for title bar.
|
||||
int title_height = get_constant("title_height", "WindowDialog");
|
||||
r.position.y -= title_height;
|
||||
r.size.y += title_height;
|
||||
|
||||
// Inflate by the resizable border thickness.
|
||||
if (resizable) {
|
||||
int scaleborder_size = get_constant("scaleborder_size", "WindowDialog");
|
||||
r.position.x -= scaleborder_size;
|
||||
r.size.width += scaleborder_size * 2;
|
||||
r.position.y -= scaleborder_size;
|
||||
r.size.height += scaleborder_size * 2;
|
||||
}
|
||||
|
||||
return r.has_point(p_point);
|
||||
}
|
||||
|
||||
void WindowDialog::_gui_input(const Ref<InputEvent> &p_event) {
|
||||
|
||||
Ref<InputEventMouseButton> mb = p_event;
|
||||
|
||||
if (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT) {
|
||||
|
||||
if (mb->is_pressed()) {
|
||||
// Begin a possible dragging operation.
|
||||
drag_type = _drag_hit_test(Point2(mb->get_position().x, mb->get_position().y));
|
||||
if (drag_type != DRAG_NONE)
|
||||
drag_offset = get_global_mouse_position() - get_position();
|
||||
drag_offset_far = get_position() + get_size() - get_global_mouse_position();
|
||||
} else if (drag_type != DRAG_NONE && !mb->is_pressed()) {
|
||||
// End a dragging operation.
|
||||
drag_type = DRAG_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
Ref<InputEventMouseMotion> mm = p_event;
|
||||
|
||||
if (mm.is_valid()) {
|
||||
|
||||
if (drag_type == DRAG_NONE) {
|
||||
// Update the cursor while moving along the borders.
|
||||
CursorShape cursor = CURSOR_ARROW;
|
||||
if (resizable) {
|
||||
int preview_drag_type = _drag_hit_test(Point2(mm->get_position().x, mm->get_position().y));
|
||||
switch (preview_drag_type) {
|
||||
case DRAG_RESIZE_TOP:
|
||||
case DRAG_RESIZE_BOTTOM:
|
||||
cursor = CURSOR_VSIZE;
|
||||
break;
|
||||
case DRAG_RESIZE_LEFT:
|
||||
case DRAG_RESIZE_RIGHT:
|
||||
cursor = CURSOR_HSIZE;
|
||||
break;
|
||||
case DRAG_RESIZE_TOP + DRAG_RESIZE_LEFT:
|
||||
case DRAG_RESIZE_BOTTOM + DRAG_RESIZE_RIGHT:
|
||||
cursor = CURSOR_FDIAGSIZE;
|
||||
break;
|
||||
case DRAG_RESIZE_TOP + DRAG_RESIZE_RIGHT:
|
||||
case DRAG_RESIZE_BOTTOM + DRAG_RESIZE_LEFT:
|
||||
cursor = CURSOR_BDIAGSIZE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (get_cursor_shape() != cursor)
|
||||
set_default_cursor_shape(cursor);
|
||||
} else {
|
||||
// Update while in a dragging operation.
|
||||
Point2 global_pos = get_global_mouse_position();
|
||||
global_pos.y = MAX(global_pos.y, 0); // Ensure title bar stays visible.
|
||||
|
||||
Rect2 rect = get_rect();
|
||||
Size2 min_size = get_combined_minimum_size();
|
||||
|
||||
if (drag_type == DRAG_MOVE) {
|
||||
rect.position = global_pos - drag_offset;
|
||||
} else {
|
||||
if (drag_type & DRAG_RESIZE_TOP) {
|
||||
int bottom = rect.position.y + rect.size.height;
|
||||
int max_y = bottom - min_size.height;
|
||||
rect.position.y = MIN(global_pos.y - drag_offset.y, max_y);
|
||||
rect.size.height = bottom - rect.position.y;
|
||||
} else if (drag_type & DRAG_RESIZE_BOTTOM) {
|
||||
rect.size.height = global_pos.y - rect.position.y + drag_offset_far.y;
|
||||
}
|
||||
if (drag_type & DRAG_RESIZE_LEFT) {
|
||||
int right = rect.position.x + rect.size.width;
|
||||
int max_x = right - min_size.width;
|
||||
rect.position.x = MIN(global_pos.x - drag_offset.x, max_x);
|
||||
rect.size.width = right - rect.position.x;
|
||||
} else if (drag_type & DRAG_RESIZE_RIGHT) {
|
||||
rect.size.width = global_pos.x - rect.position.x + drag_offset_far.x;
|
||||
}
|
||||
}
|
||||
|
||||
set_size(rect.size);
|
||||
set_position(rect.position);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WindowDialog::_notification(int p_what) {
|
||||
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_DRAW: {
|
||||
RID canvas = get_canvas_item();
|
||||
|
||||
// Draw the background.
|
||||
Ref<StyleBox> panel = get_stylebox("panel");
|
||||
Size2 size = get_size();
|
||||
panel->draw(canvas, Rect2(0, 0, size.x, size.y));
|
||||
|
||||
// Draw the title bar text.
|
||||
Ref<Font> title_font = get_font("title_font", "WindowDialog");
|
||||
Color title_color = get_color("title_color", "WindowDialog");
|
||||
int title_height = get_constant("title_height", "WindowDialog");
|
||||
int font_height = title_font->get_height() - title_font->get_descent() * 2;
|
||||
int x = (size.x - title_font->get_string_size(xl_title).x) / 2;
|
||||
int y = (-title_height + font_height) / 2;
|
||||
title_font->draw(canvas, Point2(x, y), xl_title, title_color, size.x - panel->get_minimum_size().x);
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_THEME_CHANGED:
|
||||
case NOTIFICATION_ENTER_TREE: {
|
||||
close_button->set_normal_texture(get_icon("close", "WindowDialog"));
|
||||
close_button->set_pressed_texture(get_icon("close", "WindowDialog"));
|
||||
close_button->set_hover_texture(get_icon("close_highlight", "WindowDialog"));
|
||||
close_button->set_anchor(MARGIN_LEFT, ANCHOR_END);
|
||||
close_button->set_begin(Point2(-get_constant("close_h_ofs", "WindowDialog"), -get_constant("close_v_ofs", "WindowDialog")));
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_TRANSLATION_CHANGED: {
|
||||
String new_title = tr(title);
|
||||
if (new_title != xl_title) {
|
||||
xl_title = new_title;
|
||||
minimum_size_changed();
|
||||
update();
|
||||
}
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_MOUSE_EXIT: {
|
||||
// Reset the mouse cursor when leaving the resizable window border.
|
||||
if (resizable && !drag_type) {
|
||||
if (get_default_cursor_shape() != CURSOR_ARROW)
|
||||
set_default_cursor_shape(CURSOR_ARROW);
|
||||
}
|
||||
} break;
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
case NOTIFICATION_POST_POPUP: {
|
||||
if (get_tree() && Engine::get_singleton()->is_editor_hint() && EditorNode::get_singleton()) {
|
||||
was_editor_dimmed = EditorNode::get_singleton()->is_editor_dimmed();
|
||||
EditorNode::get_singleton()->dim_editor(true);
|
||||
}
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_POPUP_HIDE: {
|
||||
if (get_tree() && Engine::get_singleton()->is_editor_hint() && EditorNode::get_singleton() && !was_editor_dimmed) {
|
||||
EditorNode::get_singleton()->dim_editor(false);
|
||||
set_pass_on_modal_close_click(false);
|
||||
}
|
||||
} break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void WindowDialog::_closed() {
|
||||
|
||||
_close_pressed();
|
||||
hide();
|
||||
}
|
||||
|
||||
int WindowDialog::_drag_hit_test(const Point2 &pos) const {
|
||||
int drag_type = DRAG_NONE;
|
||||
|
||||
if (resizable) {
|
||||
int title_height = get_constant("title_height", "WindowDialog");
|
||||
int scaleborder_size = get_constant("scaleborder_size", "WindowDialog");
|
||||
|
||||
Rect2 rect = get_rect();
|
||||
|
||||
if (pos.y < (-title_height + scaleborder_size))
|
||||
drag_type = DRAG_RESIZE_TOP;
|
||||
else if (pos.y >= (rect.size.height - scaleborder_size))
|
||||
drag_type = DRAG_RESIZE_BOTTOM;
|
||||
if (pos.x < scaleborder_size)
|
||||
drag_type |= DRAG_RESIZE_LEFT;
|
||||
else if (pos.x >= (rect.size.width - scaleborder_size))
|
||||
drag_type |= DRAG_RESIZE_RIGHT;
|
||||
}
|
||||
|
||||
if (drag_type == DRAG_NONE && pos.y < 0)
|
||||
drag_type = DRAG_MOVE;
|
||||
|
||||
return drag_type;
|
||||
}
|
||||
|
||||
void WindowDialog::set_title(const String &p_title) {
|
||||
|
||||
if (title != p_title) {
|
||||
title = p_title;
|
||||
xl_title = tr(p_title);
|
||||
minimum_size_changed();
|
||||
update();
|
||||
}
|
||||
}
|
||||
String WindowDialog::get_title() const {
|
||||
|
||||
return title;
|
||||
}
|
||||
|
||||
void WindowDialog::set_resizable(bool p_resizable) {
|
||||
resizable = p_resizable;
|
||||
}
|
||||
bool WindowDialog::get_resizable() const {
|
||||
return resizable;
|
||||
}
|
||||
|
||||
Size2 WindowDialog::get_minimum_size() const {
|
||||
|
||||
Ref<Font> font = get_font("title_font", "WindowDialog");
|
||||
|
||||
const int button_width = close_button->get_combined_minimum_size().x;
|
||||
const int title_width = font->get_string_size(xl_title).x;
|
||||
const int padding = button_width / 2;
|
||||
const int button_area = button_width + padding;
|
||||
|
||||
// As the title gets centered, title_width + close_button_width is not enough.
|
||||
// We want a width w, such that w / 2 - title_width / 2 >= button_area, i.e.
|
||||
// w >= 2 * button_area + title_width
|
||||
|
||||
return Size2(2 * button_area + title_width, 1);
|
||||
}
|
||||
|
||||
TextureButton *WindowDialog::get_close_button() {
|
||||
|
||||
return close_button;
|
||||
}
|
||||
|
||||
void WindowDialog::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_gui_input"), &WindowDialog::_gui_input);
|
||||
ClassDB::bind_method(D_METHOD("set_title", "title"), &WindowDialog::set_title);
|
||||
ClassDB::bind_method(D_METHOD("get_title"), &WindowDialog::get_title);
|
||||
ClassDB::bind_method(D_METHOD("set_resizable", "resizable"), &WindowDialog::set_resizable);
|
||||
ClassDB::bind_method(D_METHOD("get_resizable"), &WindowDialog::get_resizable);
|
||||
ClassDB::bind_method(D_METHOD("get_close_button"), &WindowDialog::get_close_button);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "window_title", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT_INTL), "set_title", "get_title");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "resizable", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT_INTL), "set_resizable", "get_resizable");
|
||||
}
|
||||
|
||||
WindowDialog::WindowDialog() {
|
||||
|
||||
drag_type = DRAG_NONE;
|
||||
resizable = false;
|
||||
close_button = memnew(TextureButton);
|
||||
add_child(close_button);
|
||||
close_button->connect("pressed", callable_mp(this, &WindowDialog::_closed));
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
was_editor_dimmed = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
WindowDialog::~WindowDialog() {
|
||||
}
|
||||
|
||||
// PopupDialog
|
||||
|
||||
void PopupDialog::_notification(int p_what) {
|
||||
|
||||
if (p_what == NOTIFICATION_DRAW) {
|
||||
RID ci = get_canvas_item();
|
||||
get_stylebox("panel")->draw(ci, Rect2(Point2(), get_size()));
|
||||
}
|
||||
}
|
||||
|
||||
PopupDialog::PopupDialog() {
|
||||
}
|
||||
|
||||
PopupDialog::~PopupDialog() {
|
||||
}
|
||||
|
||||
// AcceptDialog
|
||||
|
||||
void AcceptDialog::_post_popup() {
|
||||
void AcceptDialog::_input_from_window(const Ref<InputEvent> &p_event) {
|
||||
Ref<InputEventKey> key = p_event;
|
||||
if (key.is_valid() && key->is_pressed() && key->get_keycode() == KEY_ESCAPE) {
|
||||
_cancel_pressed();
|
||||
}
|
||||
}
|
||||
|
||||
WindowDialog::_post_popup();
|
||||
get_ok()->grab_focus();
|
||||
void AcceptDialog::_parent_focused() {
|
||||
_cancel_pressed();
|
||||
}
|
||||
|
||||
void AcceptDialog::_notification(int p_what) {
|
||||
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_MODAL_CLOSE: {
|
||||
cancel_pressed();
|
||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||
if (is_visible()) {
|
||||
|
||||
get_ok()->grab_focus();
|
||||
_update_child_rects();
|
||||
parent_visible = get_parent_visible_window();
|
||||
if (parent_visible) {
|
||||
parent_visible->connect("focus_entered", callable_mp(this, &AcceptDialog::_parent_focused));
|
||||
}
|
||||
} else {
|
||||
if (parent_visible) {
|
||||
parent_visible->disconnect("focus_entered", callable_mp(this, &AcceptDialog::_parent_focused));
|
||||
}
|
||||
}
|
||||
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_THEME_CHANGED: {
|
||||
bg->add_style_override("panel", bg->get_stylebox("panel", "AcceptDialog"));
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_READY:
|
||||
case NOTIFICATION_RESIZED: {
|
||||
_update_child_rects();
|
||||
case NOTIFICATION_WM_SIZE_CHANGED: {
|
||||
if (is_visible()) {
|
||||
_update_child_rects();
|
||||
}
|
||||
} break;
|
||||
case NOTIFICATION_WM_CLOSE_REQUEST: {
|
||||
_cancel_pressed();
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
@ -404,20 +98,28 @@ void AcceptDialog::_text_entered(const String &p_text) {
|
|||
void AcceptDialog::_ok_pressed() {
|
||||
|
||||
if (hide_on_ok)
|
||||
hide();
|
||||
set_visible(false);
|
||||
ok_pressed();
|
||||
emit_signal("confirmed");
|
||||
}
|
||||
|
||||
void AcceptDialog::_close_pressed() {
|
||||
void AcceptDialog::_cancel_pressed() {
|
||||
|
||||
Window *parent_window = parent_visible;
|
||||
if (parent_visible) {
|
||||
parent_visible->disconnect("focus_entered", callable_mp(this, &AcceptDialog::_parent_focused));
|
||||
parent_visible = nullptr;
|
||||
}
|
||||
|
||||
call_deferred("hide");
|
||||
|
||||
emit_signal("cancelled");
|
||||
|
||||
cancel_pressed();
|
||||
}
|
||||
|
||||
// FIXME: This is redundant with _closed_pressed, but there's a slight behavior
|
||||
// change (WindowDialog's _closed() also calls hide()) which should be assessed.
|
||||
void AcceptDialog::_on_close_pressed() {
|
||||
_closed(); // From WindowDialog.
|
||||
if (parent_window) {
|
||||
//parent_window->grab_focus();
|
||||
}
|
||||
}
|
||||
|
||||
String AcceptDialog::get_text() const {
|
||||
|
@ -427,8 +129,10 @@ String AcceptDialog::get_text() const {
|
|||
void AcceptDialog::set_text(String p_text) {
|
||||
|
||||
label->set_text(p_text);
|
||||
minimum_size_changed();
|
||||
_update_child_rects();
|
||||
child_controls_changed();
|
||||
if (is_visible()) {
|
||||
_update_child_rects();
|
||||
}
|
||||
}
|
||||
|
||||
void AcceptDialog::set_hide_on_ok(bool p_hide) {
|
||||
|
@ -463,7 +167,7 @@ void AcceptDialog::_update_child_rects() {
|
|||
if (label->get_text().empty()) {
|
||||
label_size.height = 0;
|
||||
}
|
||||
int margin = get_constant("margin", "Dialogs");
|
||||
int margin = hbc->get_constant("margin", "Dialogs");
|
||||
Size2 size = get_size();
|
||||
Size2 hminsize = hbc->get_combined_minimum_size();
|
||||
|
||||
|
@ -475,7 +179,7 @@ void AcceptDialog::_update_child_rects() {
|
|||
if (!c)
|
||||
continue;
|
||||
|
||||
if (c == hbc || c == label || c == get_close_button() || c->is_set_as_toplevel())
|
||||
if (c == hbc || c == label || c == bg || c->is_set_as_toplevel())
|
||||
continue;
|
||||
|
||||
c->set_position(cpos);
|
||||
|
@ -487,11 +191,14 @@ void AcceptDialog::_update_child_rects() {
|
|||
|
||||
hbc->set_position(cpos);
|
||||
hbc->set_size(csize);
|
||||
|
||||
bg->set_position(Point2());
|
||||
bg->set_size(size);
|
||||
}
|
||||
|
||||
Size2 AcceptDialog::get_minimum_size() const {
|
||||
Size2 AcceptDialog::_get_contents_minimum_size() const {
|
||||
|
||||
int margin = get_constant("margin", "Dialogs");
|
||||
int margin = hbc->get_constant("margin", "Dialogs");
|
||||
Size2 minsize = label->get_combined_minimum_size();
|
||||
|
||||
for (int i = 0; i < get_child_count(); i++) {
|
||||
|
@ -499,7 +206,7 @@ Size2 AcceptDialog::get_minimum_size() const {
|
|||
if (!c)
|
||||
continue;
|
||||
|
||||
if (c == hbc || c == label || c == const_cast<AcceptDialog *>(this)->get_close_button() || c->is_set_as_toplevel())
|
||||
if (c == hbc || c == label || c->is_set_as_toplevel())
|
||||
continue;
|
||||
|
||||
Size2 cminsize = c->get_combined_minimum_size();
|
||||
|
@ -513,7 +220,7 @@ Size2 AcceptDialog::get_minimum_size() const {
|
|||
minsize.x += margin * 2;
|
||||
minsize.y += margin * 3; //one as separation between hbc and child
|
||||
|
||||
Size2 wmsize = WindowDialog::get_minimum_size();
|
||||
Size2 wmsize = get_min_size();
|
||||
minsize.x = MAX(wmsize.x, minsize.x);
|
||||
return minsize;
|
||||
}
|
||||
|
@ -551,7 +258,7 @@ Button *AcceptDialog::add_cancel(const String &p_cancel) {
|
|||
if (p_cancel == "")
|
||||
c = RTR("Cancel");
|
||||
Button *b = swap_ok_cancel ? add_button(c, true) : add_button(c);
|
||||
b->connect("pressed", callable_mp(this, &AcceptDialog::_on_close_pressed));
|
||||
b->connect("pressed", callable_mp(this, &AcceptDialog::_cancel_pressed));
|
||||
return b;
|
||||
}
|
||||
|
||||
|
@ -570,6 +277,7 @@ void AcceptDialog::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("has_autowrap"), &AcceptDialog::has_autowrap);
|
||||
|
||||
ADD_SIGNAL(MethodInfo("confirmed"));
|
||||
ADD_SIGNAL(MethodInfo("cancelled"));
|
||||
ADD_SIGNAL(MethodInfo("custom_action", PropertyInfo(Variant::STRING_NAME, "action")));
|
||||
|
||||
ADD_GROUP("Dialog", "dialog");
|
||||
|
@ -586,12 +294,22 @@ void AcceptDialog::set_swap_ok_cancel(bool p_swap) {
|
|||
|
||||
AcceptDialog::AcceptDialog() {
|
||||
|
||||
int margin = get_constant("margin", "Dialogs");
|
||||
int button_margin = get_constant("button_margin", "Dialogs");
|
||||
parent_visible = nullptr;
|
||||
|
||||
set_visible(false);
|
||||
set_transient(true);
|
||||
|
||||
bg = memnew(Panel);
|
||||
add_child(bg);
|
||||
|
||||
hbc = memnew(HBoxContainer);
|
||||
|
||||
int margin = hbc->get_constant("margin", "Dialogs");
|
||||
int button_margin = hbc->get_constant("button_margin", "Dialogs");
|
||||
|
||||
label = memnew(Label);
|
||||
label->set_anchor(MARGIN_RIGHT, ANCHOR_END);
|
||||
label->set_anchor(MARGIN_BOTTOM, ANCHOR_END);
|
||||
label->set_anchor(MARGIN_RIGHT, Control::ANCHOR_END);
|
||||
label->set_anchor(MARGIN_BOTTOM, Control::ANCHOR_END);
|
||||
label->set_begin(Point2(margin, margin));
|
||||
label->set_end(Point2(-margin, -button_margin - 10));
|
||||
add_child(label);
|
||||
|
@ -606,10 +324,11 @@ AcceptDialog::AcceptDialog() {
|
|||
hbc->add_spacer();
|
||||
|
||||
ok->connect("pressed", callable_mp(this, &AcceptDialog::_ok_pressed));
|
||||
set_as_toplevel(true);
|
||||
|
||||
hide_on_ok = true;
|
||||
set_title(RTR("Alert!"));
|
||||
|
||||
connect("window_input", callable_mp(this, &AcceptDialog::_input_from_window));
|
||||
}
|
||||
|
||||
AcceptDialog::~AcceptDialog() {
|
||||
|
@ -631,7 +350,7 @@ ConfirmationDialog::ConfirmationDialog() {
|
|||
|
||||
set_title(RTR("Please Confirm..."));
|
||||
#ifdef TOOLS_ENABLED
|
||||
set_custom_minimum_size(Size2(200, 70) * EDSCALE);
|
||||
set_min_size(Size2(200, 70) * EDSCALE);
|
||||
#endif
|
||||
cancel = add_cancel();
|
||||
}
|
||||
|
|
|
@ -37,91 +37,32 @@
|
|||
#include "scene/gui/panel.h"
|
||||
#include "scene/gui/popup.h"
|
||||
#include "scene/gui/texture_button.h"
|
||||
|
||||
class WindowDialog : public Popup {
|
||||
|
||||
GDCLASS(WindowDialog, Popup);
|
||||
|
||||
enum DRAG_TYPE {
|
||||
DRAG_NONE = 0,
|
||||
DRAG_MOVE = 1,
|
||||
DRAG_RESIZE_TOP = 1 << 1,
|
||||
DRAG_RESIZE_RIGHT = 1 << 2,
|
||||
DRAG_RESIZE_BOTTOM = 1 << 3,
|
||||
DRAG_RESIZE_LEFT = 1 << 4
|
||||
};
|
||||
|
||||
TextureButton *close_button;
|
||||
String title;
|
||||
String xl_title;
|
||||
int drag_type;
|
||||
Point2 drag_offset;
|
||||
Point2 drag_offset_far;
|
||||
bool resizable;
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
bool was_editor_dimmed;
|
||||
#endif
|
||||
|
||||
void _gui_input(const Ref<InputEvent> &p_event);
|
||||
int _drag_hit_test(const Point2 &pos) const;
|
||||
|
||||
protected:
|
||||
virtual void _post_popup();
|
||||
virtual void _fix_size();
|
||||
virtual void _close_pressed() {}
|
||||
virtual bool has_point(const Point2 &p_point) const;
|
||||
void _notification(int p_what);
|
||||
static void _bind_methods();
|
||||
|
||||
// Not private since used by derived classes signal.
|
||||
void _closed();
|
||||
|
||||
public:
|
||||
TextureButton *get_close_button();
|
||||
|
||||
void set_title(const String &p_title);
|
||||
String get_title() const;
|
||||
void set_resizable(bool p_resizable);
|
||||
bool get_resizable() const;
|
||||
|
||||
Size2 get_minimum_size() const;
|
||||
|
||||
WindowDialog();
|
||||
~WindowDialog();
|
||||
};
|
||||
|
||||
class PopupDialog : public Popup {
|
||||
|
||||
GDCLASS(PopupDialog, Popup);
|
||||
|
||||
protected:
|
||||
void _notification(int p_what);
|
||||
|
||||
public:
|
||||
PopupDialog();
|
||||
~PopupDialog();
|
||||
};
|
||||
#include "scene/main/window.h"
|
||||
|
||||
class LineEdit;
|
||||
|
||||
class AcceptDialog : public WindowDialog {
|
||||
class AcceptDialog : public Window {
|
||||
|
||||
GDCLASS(AcceptDialog, WindowDialog);
|
||||
GDCLASS(AcceptDialog, Window);
|
||||
|
||||
Window *parent_visible;
|
||||
Panel *bg;
|
||||
HBoxContainer *hbc;
|
||||
Label *label;
|
||||
Button *ok;
|
||||
bool hide_on_ok;
|
||||
|
||||
void _custom_action(const String &p_action);
|
||||
void _close_pressed();
|
||||
void _update_child_rects();
|
||||
|
||||
static bool swap_ok_cancel;
|
||||
|
||||
void _input_from_window(const Ref<InputEvent> &p_event);
|
||||
void _parent_focused();
|
||||
|
||||
protected:
|
||||
virtual void _post_popup();
|
||||
virtual Size2 _get_contents_minimum_size() const;
|
||||
|
||||
void _notification(int p_what);
|
||||
static void _bind_methods();
|
||||
virtual void ok_pressed() {}
|
||||
|
@ -131,11 +72,9 @@ protected:
|
|||
// Not private since used by derived classes signal.
|
||||
void _text_entered(const String &p_text);
|
||||
void _ok_pressed();
|
||||
void _on_close_pressed();
|
||||
void _cancel_pressed();
|
||||
|
||||
public:
|
||||
Size2 get_minimum_size() const;
|
||||
|
||||
Label *get_label() { return label; }
|
||||
static void set_swap_ok_cancel(bool p_swap);
|
||||
|
||||
|
|
|
@ -44,42 +44,46 @@ VBoxContainer *FileDialog::get_vbox() {
|
|||
return vbox;
|
||||
}
|
||||
|
||||
void FileDialog::_theme_changed() {
|
||||
|
||||
Color font_color = vbc->get_color("font_color", "ToolButton");
|
||||
Color font_color_hover = vbc->get_color("font_color_hover", "ToolButton");
|
||||
Color font_color_pressed = vbc->get_color("font_color_pressed", "ToolButton");
|
||||
|
||||
dir_up->add_color_override("icon_color_normal", font_color);
|
||||
dir_up->add_color_override("icon_color_hover", font_color_hover);
|
||||
dir_up->add_color_override("icon_color_pressed", font_color_pressed);
|
||||
|
||||
refresh->add_color_override("icon_color_normal", font_color);
|
||||
refresh->add_color_override("icon_color_hover", font_color_hover);
|
||||
refresh->add_color_override("icon_color_pressed", font_color_pressed);
|
||||
|
||||
show_hidden->add_color_override("icon_color_normal", font_color);
|
||||
show_hidden->add_color_override("icon_color_hover", font_color_hover);
|
||||
show_hidden->add_color_override("icon_color_pressed", font_color_pressed);
|
||||
}
|
||||
|
||||
void FileDialog::_notification(int p_what) {
|
||||
|
||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
||||
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
|
||||
if (!is_visible()) {
|
||||
|
||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
||||
dir_up->set_icon(get_icon("parent_folder"));
|
||||
refresh->set_icon(get_icon("reload"));
|
||||
show_hidden->set_icon(get_icon("toggle_hidden"));
|
||||
set_process_unhandled_input(false);
|
||||
}
|
||||
}
|
||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
||||
|
||||
Color font_color = get_color("font_color", "ToolButton");
|
||||
Color font_color_hover = get_color("font_color_hover", "ToolButton");
|
||||
Color font_color_pressed = get_color("font_color_pressed", "ToolButton");
|
||||
|
||||
dir_up->add_color_override("icon_color_normal", font_color);
|
||||
dir_up->add_color_override("icon_color_hover", font_color_hover);
|
||||
dir_up->add_color_override("icon_color_pressed", font_color_pressed);
|
||||
|
||||
refresh->add_color_override("icon_color_normal", font_color);
|
||||
refresh->add_color_override("icon_color_hover", font_color_hover);
|
||||
refresh->add_color_override("icon_color_pressed", font_color_pressed);
|
||||
|
||||
show_hidden->add_color_override("icon_color_normal", font_color);
|
||||
show_hidden->add_color_override("icon_color_hover", font_color_hover);
|
||||
show_hidden->add_color_override("icon_color_pressed", font_color_pressed);
|
||||
|
||||
} else if (p_what == NOTIFICATION_POPUP_HIDE) {
|
||||
|
||||
set_process_unhandled_input(false);
|
||||
dir_up->set_icon(vbc->get_icon("parent_folder"));
|
||||
refresh->set_icon(vbc->get_icon("reload"));
|
||||
show_hidden->set_icon(vbc->get_icon("toggle_hidden"));
|
||||
_theme_changed();
|
||||
}
|
||||
}
|
||||
|
||||
void FileDialog::_unhandled_input(const Ref<InputEvent> &p_event) {
|
||||
|
||||
Ref<InputEventKey> k = p_event;
|
||||
if (k.is_valid() && is_window_modal_on_top()) {
|
||||
if (k.is_valid() && has_focus()) {
|
||||
|
||||
if (k->is_pressed()) {
|
||||
|
||||
|
@ -110,7 +114,7 @@ void FileDialog::_unhandled_input(const Ref<InputEvent> &p_event) {
|
|||
}
|
||||
|
||||
if (handled)
|
||||
accept_event();
|
||||
set_input_as_handled();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -171,7 +175,7 @@ void FileDialog::_post_popup() {
|
|||
update_file_list();
|
||||
invalidated = false;
|
||||
}
|
||||
if (mode == MODE_SAVE_FILE)
|
||||
if (mode == FILE_MODE_SAVE_FILE)
|
||||
file->grab_focus();
|
||||
else
|
||||
tree->grab_focus();
|
||||
|
@ -179,7 +183,7 @@ void FileDialog::_post_popup() {
|
|||
set_process_unhandled_input(true);
|
||||
|
||||
// For open dir mode, deselect all items on file dialog open.
|
||||
if (mode == MODE_OPEN_DIR) {
|
||||
if (mode == FILE_MODE_OPEN_DIR) {
|
||||
deselect_items();
|
||||
file_box->set_visible(false);
|
||||
} else {
|
||||
|
@ -189,7 +193,7 @@ void FileDialog::_post_popup() {
|
|||
|
||||
void FileDialog::_action_pressed() {
|
||||
|
||||
if (mode == MODE_OPEN_FILES) {
|
||||
if (mode == FILE_MODE_OPEN_FILES) {
|
||||
|
||||
TreeItem *ti = tree->get_next_selected(NULL);
|
||||
String fbase = dir_access->get_current_dir();
|
||||
|
@ -211,10 +215,10 @@ void FileDialog::_action_pressed() {
|
|||
|
||||
String f = dir_access->get_current_dir().plus_file(file->get_text());
|
||||
|
||||
if ((mode == MODE_OPEN_ANY || mode == MODE_OPEN_FILE) && dir_access->file_exists(f)) {
|
||||
if ((mode == FILE_MODE_OPEN_ANY || mode == FILE_MODE_OPEN_FILE) && dir_access->file_exists(f)) {
|
||||
emit_signal("file_selected", f);
|
||||
hide();
|
||||
} else if (mode == MODE_OPEN_ANY || mode == MODE_OPEN_DIR) {
|
||||
} else if (mode == FILE_MODE_OPEN_ANY || mode == FILE_MODE_OPEN_DIR) {
|
||||
|
||||
String path = dir_access->get_current_dir();
|
||||
|
||||
|
@ -231,7 +235,7 @@ void FileDialog::_action_pressed() {
|
|||
hide();
|
||||
}
|
||||
|
||||
if (mode == MODE_SAVE_FILE) {
|
||||
if (mode == FILE_MODE_SAVE_FILE) {
|
||||
|
||||
bool valid = false;
|
||||
|
||||
|
@ -283,7 +287,7 @@ void FileDialog::_action_pressed() {
|
|||
|
||||
if (!valid) {
|
||||
|
||||
exterr->popup_centered_minsize(Size2(250, 80));
|
||||
exterr->popup_centered(Size2(250, 80));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -307,7 +311,7 @@ void FileDialog::_cancel_pressed() {
|
|||
|
||||
bool FileDialog::_is_open_should_be_disabled() {
|
||||
|
||||
if (mode == MODE_OPEN_ANY || mode == MODE_SAVE_FILE)
|
||||
if (mode == FILE_MODE_OPEN_ANY || mode == FILE_MODE_SAVE_FILE)
|
||||
return false;
|
||||
|
||||
TreeItem *ti = tree->get_next_selected(tree->get_root());
|
||||
|
@ -319,13 +323,13 @@ bool FileDialog::_is_open_should_be_disabled() {
|
|||
}
|
||||
// We have something that we can't select?
|
||||
if (!ti)
|
||||
return mode != MODE_OPEN_DIR; // In "Open folder" mode, having nothing selected picks the current folder.
|
||||
return mode != FILE_MODE_OPEN_DIR; // In "Open folder" mode, having nothing selected picks the current folder.
|
||||
|
||||
Dictionary d = ti->get_metadata(0);
|
||||
|
||||
// Opening a file, but selected a folder? Forbidden.
|
||||
return ((mode == MODE_OPEN_FILE || mode == MODE_OPEN_FILES) && d["dir"]) || // Flipped case, also forbidden.
|
||||
(mode == MODE_OPEN_DIR && !d["dir"]);
|
||||
return ((mode == FILE_MODE_OPEN_FILE || mode == FILE_MODE_OPEN_FILES) && d["dir"]) || // Flipped case, also forbidden.
|
||||
(mode == FILE_MODE_OPEN_DIR && !d["dir"]);
|
||||
}
|
||||
|
||||
void FileDialog::_go_up() {
|
||||
|
@ -346,15 +350,15 @@ void FileDialog::deselect_items() {
|
|||
|
||||
switch (mode) {
|
||||
|
||||
case MODE_OPEN_FILE:
|
||||
case MODE_OPEN_FILES:
|
||||
case FILE_MODE_OPEN_FILE:
|
||||
case FILE_MODE_OPEN_FILES:
|
||||
get_ok()->set_text(RTR("Open"));
|
||||
break;
|
||||
case MODE_OPEN_DIR:
|
||||
case FILE_MODE_OPEN_DIR:
|
||||
get_ok()->set_text(RTR("Select Current Folder"));
|
||||
break;
|
||||
case MODE_OPEN_ANY:
|
||||
case MODE_SAVE_FILE:
|
||||
case FILE_MODE_OPEN_ANY:
|
||||
case FILE_MODE_SAVE_FILE:
|
||||
// FIXME: Implement, or refactor to avoid duplication with set_mode
|
||||
break;
|
||||
}
|
||||
|
@ -375,7 +379,7 @@ void FileDialog::_tree_selected() {
|
|||
if (!d["dir"]) {
|
||||
|
||||
file->set_text(d["name"]);
|
||||
} else if (mode == MODE_OPEN_DIR) {
|
||||
} else if (mode == FILE_MODE_OPEN_DIR) {
|
||||
get_ok()->set_text(RTR("Select This Folder"));
|
||||
}
|
||||
|
||||
|
@ -393,7 +397,7 @@ void FileDialog::_tree_item_activated() {
|
|||
if (d["dir"]) {
|
||||
|
||||
dir_access->change_dir(d["name"]);
|
||||
if (mode == MODE_OPEN_FILE || mode == MODE_OPEN_FILES || mode == MODE_OPEN_DIR || mode == MODE_OPEN_ANY)
|
||||
if (mode == FILE_MODE_OPEN_FILE || mode == FILE_MODE_OPEN_FILES || mode == FILE_MODE_OPEN_DIR || mode == FILE_MODE_OPEN_ANY)
|
||||
file->set_text("");
|
||||
call_deferred("_update_file_list");
|
||||
call_deferred("_update_dir");
|
||||
|
@ -425,8 +429,8 @@ void FileDialog::update_file_list() {
|
|||
dir_access->list_dir_begin();
|
||||
|
||||
TreeItem *root = tree->create_item();
|
||||
Ref<Texture2D> folder = get_icon("folder");
|
||||
const Color folder_color = get_color("folder_icon_modulate");
|
||||
Ref<Texture2D> folder = vbc->get_icon("folder");
|
||||
const Color folder_color = vbc->get_color("folder_icon_modulate");
|
||||
List<String> files;
|
||||
List<String> dirs;
|
||||
|
||||
|
@ -523,8 +527,8 @@ void FileDialog::update_file_list() {
|
|||
ti->set_icon(0, icon);
|
||||
}
|
||||
|
||||
if (mode == MODE_OPEN_DIR) {
|
||||
ti->set_custom_color(0, get_color("files_disabled"));
|
||||
if (mode == FILE_MODE_OPEN_DIR) {
|
||||
ti->set_custom_color(0, vbc->get_color("files_disabled"));
|
||||
ti->set_selectable(0, false);
|
||||
}
|
||||
Dictionary d;
|
||||
|
@ -661,38 +665,38 @@ bool FileDialog::is_mode_overriding_title() const {
|
|||
return mode_overrides_title;
|
||||
}
|
||||
|
||||
void FileDialog::set_mode(Mode p_mode) {
|
||||
void FileDialog::set_file_mode(FileMode p_mode) {
|
||||
|
||||
ERR_FAIL_INDEX((int)p_mode, 5);
|
||||
|
||||
mode = p_mode;
|
||||
switch (mode) {
|
||||
|
||||
case MODE_OPEN_FILE:
|
||||
case FILE_MODE_OPEN_FILE:
|
||||
get_ok()->set_text(RTR("Open"));
|
||||
if (mode_overrides_title)
|
||||
set_title(RTR("Open a File"));
|
||||
makedir->hide();
|
||||
break;
|
||||
case MODE_OPEN_FILES:
|
||||
case FILE_MODE_OPEN_FILES:
|
||||
get_ok()->set_text(RTR("Open"));
|
||||
if (mode_overrides_title)
|
||||
set_title(RTR("Open File(s)"));
|
||||
makedir->hide();
|
||||
break;
|
||||
case MODE_OPEN_DIR:
|
||||
case FILE_MODE_OPEN_DIR:
|
||||
get_ok()->set_text(RTR("Select Current Folder"));
|
||||
if (mode_overrides_title)
|
||||
set_title(RTR("Open a Directory"));
|
||||
makedir->show();
|
||||
break;
|
||||
case MODE_OPEN_ANY:
|
||||
case FILE_MODE_OPEN_ANY:
|
||||
get_ok()->set_text(RTR("Open"));
|
||||
if (mode_overrides_title)
|
||||
set_title(RTR("Open a File or Directory"));
|
||||
makedir->show();
|
||||
break;
|
||||
case MODE_SAVE_FILE:
|
||||
case FILE_MODE_SAVE_FILE:
|
||||
get_ok()->set_text(RTR("Save"));
|
||||
if (mode_overrides_title)
|
||||
set_title(RTR("Save a File"));
|
||||
|
@ -700,14 +704,14 @@ void FileDialog::set_mode(Mode p_mode) {
|
|||
break;
|
||||
}
|
||||
|
||||
if (mode == MODE_OPEN_FILES) {
|
||||
if (mode == FILE_MODE_OPEN_FILES) {
|
||||
tree->set_select_mode(Tree::SELECT_MULTI);
|
||||
} else {
|
||||
tree->set_select_mode(Tree::SELECT_SINGLE);
|
||||
}
|
||||
}
|
||||
|
||||
FileDialog::Mode FileDialog::get_mode() const {
|
||||
FileDialog::FileMode FileDialog::get_file_mode() const {
|
||||
|
||||
return mode;
|
||||
}
|
||||
|
@ -741,7 +745,7 @@ void FileDialog::set_access(Access p_access) {
|
|||
|
||||
void FileDialog::invalidate() {
|
||||
|
||||
if (is_visible_in_tree()) {
|
||||
if (is_visible()) {
|
||||
update_file_list();
|
||||
invalidated = false;
|
||||
} else {
|
||||
|
@ -763,14 +767,14 @@ void FileDialog::_make_dir_confirm() {
|
|||
update_filters();
|
||||
update_dir();
|
||||
} else {
|
||||
mkdirerr->popup_centered_minsize(Size2(250, 50));
|
||||
mkdirerr->popup_centered(Size2(250, 50));
|
||||
}
|
||||
makedirname->set_text(""); // reset label
|
||||
}
|
||||
|
||||
void FileDialog::_make_dir() {
|
||||
|
||||
makedialog->popup_centered_minsize(Size2(250, 80));
|
||||
makedialog->popup_centered(Size2(250, 80));
|
||||
makedirname->grab_focus();
|
||||
}
|
||||
|
||||
|
@ -826,8 +830,8 @@ void FileDialog::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("set_current_path", "path"), &FileDialog::set_current_path);
|
||||
ClassDB::bind_method(D_METHOD("set_mode_overrides_title", "override"), &FileDialog::set_mode_overrides_title);
|
||||
ClassDB::bind_method(D_METHOD("is_mode_overriding_title"), &FileDialog::is_mode_overriding_title);
|
||||
ClassDB::bind_method(D_METHOD("set_mode", "mode"), &FileDialog::set_mode);
|
||||
ClassDB::bind_method(D_METHOD("get_mode"), &FileDialog::get_mode);
|
||||
ClassDB::bind_method(D_METHOD("set_file_mode", "mode"), &FileDialog::set_file_mode);
|
||||
ClassDB::bind_method(D_METHOD("get_file_mode"), &FileDialog::get_file_mode);
|
||||
ClassDB::bind_method(D_METHOD("get_vbox"), &FileDialog::get_vbox);
|
||||
ClassDB::bind_method(D_METHOD("get_line_edit"), &FileDialog::get_line_edit);
|
||||
ClassDB::bind_method(D_METHOD("set_access", "access"), &FileDialog::set_access);
|
||||
|
@ -842,7 +846,7 @@ void FileDialog::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("invalidate"), &FileDialog::invalidate);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "mode_overrides_title"), "set_mode_overrides_title", "is_mode_overriding_title");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Open File,Open Files,Open Folder,Open Any,Save"), "set_mode", "get_mode");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "file_mode", PROPERTY_HINT_ENUM, "Open File,Open Files,Open Folder,Open Any,Save"), "set_file_mode", "get_file_mode");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "access", PROPERTY_HINT_ENUM, "Resources,User data,File system"), "set_access", "get_access");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::PACKED_STRING_ARRAY, "filters"), "set_filters", "get_filters");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "show_hidden_files"), "set_show_hidden_files", "is_showing_hidden_files");
|
||||
|
@ -854,11 +858,11 @@ void FileDialog::_bind_methods() {
|
|||
ADD_SIGNAL(MethodInfo("files_selected", PropertyInfo(Variant::PACKED_STRING_ARRAY, "paths")));
|
||||
ADD_SIGNAL(MethodInfo("dir_selected", PropertyInfo(Variant::STRING, "dir")));
|
||||
|
||||
BIND_ENUM_CONSTANT(MODE_OPEN_FILE);
|
||||
BIND_ENUM_CONSTANT(MODE_OPEN_FILES);
|
||||
BIND_ENUM_CONSTANT(MODE_OPEN_DIR);
|
||||
BIND_ENUM_CONSTANT(MODE_OPEN_ANY);
|
||||
BIND_ENUM_CONSTANT(MODE_SAVE_FILE);
|
||||
BIND_ENUM_CONSTANT(FILE_MODE_OPEN_FILE);
|
||||
BIND_ENUM_CONSTANT(FILE_MODE_OPEN_FILES);
|
||||
BIND_ENUM_CONSTANT(FILE_MODE_OPEN_DIR);
|
||||
BIND_ENUM_CONSTANT(FILE_MODE_OPEN_ANY);
|
||||
BIND_ENUM_CONSTANT(FILE_MODE_SAVE_FILE);
|
||||
|
||||
BIND_ENUM_CONSTANT(ACCESS_RESOURCES);
|
||||
BIND_ENUM_CONSTANT(ACCESS_USERDATA);
|
||||
|
@ -884,10 +888,11 @@ FileDialog::FileDialog() {
|
|||
|
||||
mode_overrides_title = true;
|
||||
|
||||
VBoxContainer *vbc = memnew(VBoxContainer);
|
||||
vbc = memnew(VBoxContainer);
|
||||
add_child(vbc);
|
||||
vbc->connect("theme_changed", callable_mp(this, &FileDialog::_theme_changed));
|
||||
|
||||
mode = MODE_SAVE_FILE;
|
||||
mode = FILE_MODE_SAVE_FILE;
|
||||
set_title(RTR("Save a File"));
|
||||
|
||||
HBoxContainer *hbc = memnew(HBoxContainer);
|
||||
|
@ -907,7 +912,7 @@ FileDialog::FileDialog() {
|
|||
|
||||
dir = memnew(LineEdit);
|
||||
hbc->add_child(dir);
|
||||
dir->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
dir->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
refresh = memnew(ToolButton);
|
||||
refresh->set_tooltip(RTR("Refresh files."));
|
||||
|
@ -938,11 +943,11 @@ FileDialog::FileDialog() {
|
|||
file_box->add_child(memnew(Label(RTR("File:"))));
|
||||
file = memnew(LineEdit);
|
||||
file->set_stretch_ratio(4);
|
||||
file->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
file->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
file_box->add_child(file);
|
||||
filter = memnew(OptionButton);
|
||||
filter->set_stretch_ratio(3);
|
||||
filter->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
filter->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
filter->set_clip_text(true); // too many extensions overflows it
|
||||
file_box->add_child(filter);
|
||||
vbc->add_child(file_box);
|
||||
|
@ -961,7 +966,7 @@ FileDialog::FileDialog() {
|
|||
filter->connect("item_selected", callable_mp(this, &FileDialog::_filter_selected));
|
||||
|
||||
confirm_save = memnew(ConfirmationDialog);
|
||||
confirm_save->set_as_toplevel(true);
|
||||
// confirm_save->set_as_toplevel(true);
|
||||
add_child(confirm_save);
|
||||
|
||||
confirm_save->connect("confirmed", callable_mp(this, &FileDialog::_save_confirm_pressed));
|
||||
|
@ -1024,7 +1029,7 @@ LineEditFileChooser::LineEditFileChooser() {
|
|||
|
||||
line_edit = memnew(LineEdit);
|
||||
add_child(line_edit);
|
||||
line_edit->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
line_edit->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
button = memnew(Button);
|
||||
button->set_text(" .. ");
|
||||
add_child(button);
|
||||
|
|
|
@ -50,12 +50,12 @@ public:
|
|||
ACCESS_FILESYSTEM
|
||||
};
|
||||
|
||||
enum Mode {
|
||||
MODE_OPEN_FILE,
|
||||
MODE_OPEN_FILES,
|
||||
MODE_OPEN_DIR,
|
||||
MODE_OPEN_ANY,
|
||||
MODE_SAVE_FILE
|
||||
enum FileMode {
|
||||
FILE_MODE_OPEN_FILE,
|
||||
FILE_MODE_OPEN_FILES,
|
||||
FILE_MODE_OPEN_DIR,
|
||||
FILE_MODE_OPEN_ANY,
|
||||
FILE_MODE_SAVE_FILE
|
||||
};
|
||||
|
||||
typedef Ref<Texture2D> (*GetIconFunc)(const String &);
|
||||
|
@ -70,11 +70,12 @@ private:
|
|||
ConfirmationDialog *makedialog;
|
||||
LineEdit *makedirname;
|
||||
|
||||
VBoxContainer *vbc;
|
||||
Button *makedir;
|
||||
Access access;
|
||||
//Button *action;
|
||||
VBoxContainer *vbox;
|
||||
Mode mode;
|
||||
FileMode mode;
|
||||
LineEdit *dir;
|
||||
HBoxContainer *drives_container;
|
||||
HBoxContainer *shortcuts_container;
|
||||
|
@ -131,6 +132,8 @@ private:
|
|||
virtual void _post_popup();
|
||||
|
||||
protected:
|
||||
void _theme_changed();
|
||||
|
||||
void _notification(int p_what);
|
||||
static void _bind_methods();
|
||||
//bind helpers
|
||||
|
@ -153,8 +156,8 @@ public:
|
|||
void set_mode_overrides_title(bool p_override);
|
||||
bool is_mode_overriding_title() const;
|
||||
|
||||
void set_mode(Mode p_mode);
|
||||
Mode get_mode() const;
|
||||
void set_file_mode(FileMode p_mode);
|
||||
FileMode get_file_mode() const;
|
||||
|
||||
VBoxContainer *get_vbox();
|
||||
LineEdit *get_line_edit() { return file; }
|
||||
|
@ -196,7 +199,7 @@ public:
|
|||
LineEditFileChooser();
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST(FileDialog::Mode);
|
||||
VARIANT_ENUM_CAST(FileDialog::FileMode);
|
||||
VARIANT_ENUM_CAST(FileDialog::Access);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -36,11 +36,25 @@ void Panel::_notification(int p_what) {
|
|||
if (p_what == NOTIFICATION_DRAW) {
|
||||
|
||||
RID ci = get_canvas_item();
|
||||
Ref<StyleBox> style = get_stylebox("panel");
|
||||
Ref<StyleBox> style = mode == MODE_BACKGROUND ? get_stylebox("panel") : get_stylebox("panel_fg");
|
||||
style->draw(ci, Rect2(Point2(), get_size()));
|
||||
}
|
||||
}
|
||||
|
||||
void Panel::set_mode(Mode p_mode) {
|
||||
mode = p_mode;
|
||||
update();
|
||||
}
|
||||
Panel::Mode Panel::get_mode() const {
|
||||
return mode;
|
||||
}
|
||||
|
||||
void Panel::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_mode", "mode"), &Panel::set_mode);
|
||||
ClassDB::bind_method(D_METHOD("get_mode"), &Panel::get_mode);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Background,Foreground"), "set_mode", "get_mode");
|
||||
}
|
||||
Panel::Panel() {
|
||||
// Has visible stylebox, so stop by default.
|
||||
set_mouse_filter(MOUSE_FILTER_STOP);
|
||||
|
|
|
@ -37,12 +37,26 @@ class Panel : public Control {
|
|||
|
||||
GDCLASS(Panel, Control);
|
||||
|
||||
public:
|
||||
enum Mode {
|
||||
MODE_BACKGROUND,
|
||||
MODE_FOREGROUND
|
||||
};
|
||||
|
||||
private:
|
||||
Mode mode = MODE_BACKGROUND;
|
||||
|
||||
protected:
|
||||
void _notification(int p_what);
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
void set_mode(Mode p_mode);
|
||||
Mode get_mode() const;
|
||||
|
||||
Panel();
|
||||
~Panel();
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST(Panel::Mode)
|
||||
#endif
|
||||
|
|
|
@ -132,17 +132,17 @@ void Popup::popup_centered_clamped(const Size2 &p_size, float p_fallback_ratio)
|
|||
popup_size.x = MIN(window_size.x * p_fallback_ratio, popup_size.x);
|
||||
popup_size.y = MIN(window_size.y * p_fallback_ratio, popup_size.y);
|
||||
|
||||
popup_centered(popup_size);
|
||||
popup_centered_size(popup_size);
|
||||
}
|
||||
|
||||
void Popup::popup_centered_minsize(const Size2 &p_minsize) {
|
||||
|
||||
set_custom_minimum_size(p_minsize);
|
||||
_fix_size();
|
||||
popup_centered();
|
||||
popup_centered_size();
|
||||
}
|
||||
|
||||
void Popup::popup_centered(const Size2 &p_size) {
|
||||
void Popup::popup_centered_size(const Size2 &p_size) {
|
||||
|
||||
Rect2 rect;
|
||||
Size2 window_size = get_viewport_rect().size;
|
||||
|
@ -208,7 +208,7 @@ bool Popup::is_exclusive() const {
|
|||
void Popup::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_as_minsize"), &Popup::set_as_minsize);
|
||||
ClassDB::bind_method(D_METHOD("popup_centered", "size"), &Popup::popup_centered, DEFVAL(Size2()));
|
||||
ClassDB::bind_method(D_METHOD("popup_centered_size", "size"), &Popup::popup_centered_size, DEFVAL(Size2()));
|
||||
ClassDB::bind_method(D_METHOD("popup_centered_ratio", "ratio"), &Popup::popup_centered_ratio, DEFVAL(0.75));
|
||||
ClassDB::bind_method(D_METHOD("popup_centered_minsize", "minsize"), &Popup::popup_centered_minsize, DEFVAL(Size2()));
|
||||
ClassDB::bind_method(D_METHOD("popup_centered_clamped", "size", "fallback_ratio"), &Popup::popup_centered_clamped, DEFVAL(Size2()), DEFVAL(0.75));
|
||||
|
|
|
@ -61,7 +61,7 @@ public:
|
|||
bool is_exclusive() const;
|
||||
|
||||
void popup_centered_ratio(float p_screen_ratio = 0.75);
|
||||
void popup_centered(const Size2 &p_size = Size2());
|
||||
void popup_centered_size(const Size2 &p_size = Size2());
|
||||
void popup_centered_minsize(const Size2 &p_minsize = Size2());
|
||||
void set_as_minsize();
|
||||
void popup_centered_clamped(const Size2 &p_size = Size2(), float p_fallback_ratio = 0.75);
|
||||
|
|
|
@ -2952,6 +2952,7 @@ void Node::_bind_methods() {
|
|||
BIND_CONSTANT(NOTIFICATION_WM_FOCUS_OUT);
|
||||
BIND_CONSTANT(NOTIFICATION_WM_CLOSE_REQUEST);
|
||||
BIND_CONSTANT(NOTIFICATION_WM_GO_BACK_REQUEST);
|
||||
BIND_CONSTANT(NOTIFICATION_WM_SIZE_CHANGED);
|
||||
BIND_CONSTANT(NOTIFICATION_OS_MEMORY_WARNING);
|
||||
BIND_CONSTANT(NOTIFICATION_TRANSLATION_CHANGED);
|
||||
BIND_CONSTANT(NOTIFICATION_WM_ABOUT);
|
||||
|
|
|
@ -251,6 +251,7 @@ public:
|
|||
NOTIFICATION_WM_FOCUS_OUT = 1005,
|
||||
NOTIFICATION_WM_CLOSE_REQUEST = 1006,
|
||||
NOTIFICATION_WM_GO_BACK_REQUEST = 1007,
|
||||
NOTIFICATION_WM_SIZE_CHANGED = 1008,
|
||||
|
||||
NOTIFICATION_OS_MEMORY_WARNING = MainLoop::NOTIFICATION_OS_MEMORY_WARNING,
|
||||
NOTIFICATION_TRANSLATION_CHANGED = MainLoop::NOTIFICATION_TRANSLATION_CHANGED,
|
||||
|
|
|
@ -32,8 +32,9 @@
|
|||
|
||||
#include "core/debugger/engine_debugger.h"
|
||||
#include "core/os/keyboard.h"
|
||||
#include "scene/gui/control.h"
|
||||
#include "scene/resources/dynamic_font.h"
|
||||
|
||||
#include "scene/scene_string_names.h"
|
||||
void Window::set_title(const String &p_title) {
|
||||
title = p_title;
|
||||
if (window_id == DisplayServer::INVALID_WINDOW_ID)
|
||||
|
@ -73,7 +74,7 @@ Point2i Window::get_position() const {
|
|||
|
||||
void Window::set_size(const Size2i &p_size) {
|
||||
size = p_size;
|
||||
if (window_id == DisplayServer::INVALID_WINDOW_ID) {
|
||||
if (window_id != DisplayServer::INVALID_WINDOW_ID) {
|
||||
DisplayServer::get_singleton()->window_set_size(p_size, window_id);
|
||||
}
|
||||
_update_size();
|
||||
|
@ -255,12 +256,14 @@ void Window::_clear_window() {
|
|||
}
|
||||
|
||||
_update_from_window();
|
||||
print_line("deleting window bye");
|
||||
DisplayServer::get_singleton()->delete_sub_window(window_id);
|
||||
window_id = DisplayServer::INVALID_WINDOW_ID;
|
||||
_update_size();
|
||||
}
|
||||
|
||||
void Window::_resize_callback(const Size2i &p_callback) {
|
||||
|
||||
size = p_callback;
|
||||
_update_size();
|
||||
}
|
||||
|
@ -289,14 +292,20 @@ void Window::_event_callback(DisplayServer::WindowEvent p_event) {
|
|||
emit_signal("mouse_exited");
|
||||
} break;
|
||||
case DisplayServer::WINDOW_EVENT_FOCUS_IN: {
|
||||
focused = true;
|
||||
_propagate_window_notification(this, NOTIFICATION_WM_FOCUS_IN);
|
||||
emit_signal("focus_entered");
|
||||
|
||||
} break;
|
||||
case DisplayServer::WINDOW_EVENT_FOCUS_OUT: {
|
||||
focused = false;
|
||||
_propagate_window_notification(this, NOTIFICATION_WM_FOCUS_OUT);
|
||||
emit_signal("focus_exited");
|
||||
} break;
|
||||
case DisplayServer::WINDOW_EVENT_CLOSE_REQUEST: {
|
||||
if (exclusive_child != nullptr) {
|
||||
break; //has an exclusive child, can't get events until child is closed
|
||||
}
|
||||
_propagate_window_notification(this, NOTIFICATION_WM_CLOSE_REQUEST);
|
||||
emit_signal("close_requested");
|
||||
} break;
|
||||
|
@ -307,29 +316,46 @@ void Window::_event_callback(DisplayServer::WindowEvent p_event) {
|
|||
}
|
||||
}
|
||||
|
||||
void Window::show() {
|
||||
set_visible(true);
|
||||
}
|
||||
void Window::hide() {
|
||||
set_visible(false);
|
||||
}
|
||||
|
||||
void Window::set_visible(bool p_visible) {
|
||||
|
||||
if (visible == p_visible) {
|
||||
return;
|
||||
}
|
||||
|
||||
visible = p_visible;
|
||||
|
||||
if (!is_inside_tree()) {
|
||||
return;
|
||||
}
|
||||
|
||||
ERR_FAIL_COND_MSG(get_parent() == nullptr, "Can't change visibility of main window.");
|
||||
|
||||
bool subwindow = get_parent() && get_parent()->get_viewport()->is_embedding_subwindows();
|
||||
|
||||
visible = p_visible;
|
||||
|
||||
if (!subwindow) {
|
||||
if (p_visible && window_id != DisplayServer::INVALID_WINDOW_ID) {
|
||||
if (!p_visible && window_id != DisplayServer::INVALID_WINDOW_ID) {
|
||||
_clear_window();
|
||||
}
|
||||
if (!p_visible && window_id == DisplayServer::INVALID_WINDOW_ID) {
|
||||
if (p_visible && window_id == DisplayServer::INVALID_WINDOW_ID) {
|
||||
_make_window();
|
||||
_update_window_callbacks();
|
||||
}
|
||||
} else {
|
||||
_update_size();
|
||||
}
|
||||
|
||||
if (!visible) {
|
||||
focused = false;
|
||||
}
|
||||
notification(NOTIFICATION_VISIBILITY_CHANGED);
|
||||
emit_signal(SceneStringNames::get_singleton()->visibility_changed);
|
||||
}
|
||||
|
||||
void Window::_clear_transient() {
|
||||
|
@ -338,6 +364,9 @@ void Window::_clear_transient() {
|
|||
DisplayServer::get_singleton()->window_set_transient(window_id, DisplayServer::INVALID_WINDOW_ID);
|
||||
}
|
||||
transient_parent->transient_children.erase(this);
|
||||
if (transient_parent->exclusive_child == this) {
|
||||
transient_parent->exclusive_child = nullptr;
|
||||
}
|
||||
transient_parent = nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -365,6 +394,13 @@ void Window::_make_transient() {
|
|||
if (window) {
|
||||
transient_parent = window;
|
||||
window->transient_children.insert(this);
|
||||
if (exclusive) {
|
||||
if (transient_parent->exclusive_child == nullptr) {
|
||||
transient_parent->exclusive_child = this;
|
||||
} else if (transient_parent->exclusive_child != this) {
|
||||
ERR_PRINT("Making child transient exclusive, but parent has another exclusive child");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//see if we can make transient
|
||||
|
@ -394,6 +430,30 @@ bool Window::is_transient() const {
|
|||
return transient;
|
||||
}
|
||||
|
||||
void Window::set_exclusive(bool p_exclusive) {
|
||||
|
||||
if (exclusive == p_exclusive) {
|
||||
return;
|
||||
}
|
||||
|
||||
exclusive = p_exclusive;
|
||||
|
||||
if (transient_parent) {
|
||||
if (p_exclusive) {
|
||||
ERR_FAIL_COND_MSG(transient_parent->exclusive_child && transient_parent->exclusive_child != this, "Transient parent has another exclusive child.");
|
||||
transient_parent->exclusive_child = nullptr;
|
||||
} else {
|
||||
if (transient_parent->exclusive_child == this) {
|
||||
transient_parent->exclusive_child = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Window::is_exclusive() const {
|
||||
return exclusive;
|
||||
}
|
||||
|
||||
bool Window::is_visible() const {
|
||||
return visible;
|
||||
}
|
||||
|
@ -524,6 +584,8 @@ void Window::_update_size() {
|
|||
DynamicFont::update_oversampling();
|
||||
}
|
||||
}
|
||||
|
||||
notification(NOTIFICATION_WM_SIZE_CHANGED);
|
||||
}
|
||||
|
||||
void Window::_update_window_callbacks() {
|
||||
|
@ -541,20 +603,34 @@ void Window::_notification(int p_what) {
|
|||
} else {
|
||||
if (get_parent() == nullptr) {
|
||||
//it's the root window!
|
||||
visible = true; //always visible
|
||||
window_id = DisplayServer::MAIN_WINDOW_ID;
|
||||
_update_from_window();
|
||||
_update_size();
|
||||
_update_window_callbacks();
|
||||
} else {
|
||||
//create
|
||||
_make_window();
|
||||
_update_window_callbacks();
|
||||
if (visible) {
|
||||
_make_window();
|
||||
_update_window_callbacks();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (transient) {
|
||||
_make_transient();
|
||||
}
|
||||
if (visible) {
|
||||
notification(NOTIFICATION_VISIBILITY_CHANGED);
|
||||
emit_signal(SceneStringNames::get_singleton()->visibility_changed);
|
||||
}
|
||||
}
|
||||
|
||||
if (p_what == NOTIFICATION_READY) {
|
||||
|
||||
if (wrap_controls) {
|
||||
_update_child_controls();
|
||||
}
|
||||
}
|
||||
|
||||
if (p_what == NOTIFICATION_EXIT_TREE) {
|
||||
|
@ -572,7 +648,7 @@ void Window::_notification(int p_what) {
|
|||
_clear_window();
|
||||
}
|
||||
} else {
|
||||
_update_size();
|
||||
_update_size(); //called by clear and make, which does not happen here
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -619,6 +695,58 @@ DisplayServer::WindowID Window::get_window_id() const {
|
|||
return window_id;
|
||||
}
|
||||
|
||||
void Window::set_wrap_controls(bool p_enable) {
|
||||
wrap_controls = p_enable;
|
||||
if (wrap_controls) {
|
||||
child_controls_changed();
|
||||
}
|
||||
}
|
||||
|
||||
bool Window::is_wrapping_controls() const {
|
||||
return wrap_controls;
|
||||
}
|
||||
|
||||
Size2 Window::_get_contents_minimum_size() const {
|
||||
Size2 max;
|
||||
|
||||
for (int i = 0; i < get_child_count(); i++) {
|
||||
Control *c = Object::cast_to<Control>(get_child(i));
|
||||
if (c) {
|
||||
Point2i pos = c->get_position();
|
||||
Size2i min = c->get_combined_minimum_size();
|
||||
|
||||
max.x = MAX(pos.x + min.x, max.x);
|
||||
max.y = MAX(pos.y + min.y, max.y);
|
||||
}
|
||||
}
|
||||
|
||||
return max;
|
||||
}
|
||||
void Window::_update_child_controls() {
|
||||
|
||||
Size2 max = _get_contents_minimum_size();
|
||||
|
||||
Size2 new_size(MAX(max.x, size.x), MAX(max.y, size.y));
|
||||
|
||||
if (new_size != size) {
|
||||
set_size(new_size);
|
||||
}
|
||||
set_min_size(max);
|
||||
updating_child_controls = false;
|
||||
}
|
||||
void Window::child_controls_changed() {
|
||||
if (!is_inside_tree()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (updating_child_controls) {
|
||||
return;
|
||||
}
|
||||
|
||||
updating_child_controls = true;
|
||||
call_deferred("_update_child_controls");
|
||||
}
|
||||
|
||||
void Window::_window_input(const Ref<InputEvent> &p_ev) {
|
||||
|
||||
if (Engine::get_singleton()->is_editor_hint() && (Object::cast_to<InputEventJoypadButton>(p_ev.ptr()) || Object::cast_to<InputEventJoypadMotion>(*p_ev)))
|
||||
|
@ -632,6 +760,11 @@ void Window::_window_input(const Ref<InputEvent> &p_ev) {
|
|||
}
|
||||
}
|
||||
|
||||
if (exclusive_child != nullptr) {
|
||||
exclusive_child->grab_focus();
|
||||
return; //has an exclusive child, can't get events until child is closed
|
||||
}
|
||||
emit_signal(SceneStringNames::get_singleton()->window_input, p_ev);
|
||||
input(p_ev);
|
||||
if (!is_input_handled()) {
|
||||
unhandled_input(p_ev);
|
||||
|
@ -644,6 +777,208 @@ void Window::_window_drop_files(const Vector<String> &p_files) {
|
|||
emit_signal("files_dropped", p_files);
|
||||
}
|
||||
|
||||
Viewport *Window::get_parent_viewport() const {
|
||||
|
||||
if (get_parent()) {
|
||||
return get_parent()->get_viewport();
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
Window *Window::get_parent_visible_window() const {
|
||||
|
||||
Viewport *vp = get_parent_viewport();
|
||||
Window *window = nullptr;
|
||||
while (vp) {
|
||||
window = Object::cast_to<Window>(vp);
|
||||
if (window && window->visible) {
|
||||
break;
|
||||
}
|
||||
if (!vp->get_parent()) {
|
||||
break;
|
||||
}
|
||||
|
||||
vp = vp->get_parent()->get_viewport();
|
||||
}
|
||||
return window;
|
||||
}
|
||||
|
||||
void Window::popup_on_parent(const Rect2 &p_parent_rect) {
|
||||
|
||||
ERR_FAIL_COND(!is_inside_tree());
|
||||
ERR_FAIL_COND_MSG(window_id == DisplayServer::MAIN_WINDOW_ID, "Can't popup the main window.");
|
||||
|
||||
if (!is_embedded()) {
|
||||
Window *window = get_parent_visible_window();
|
||||
|
||||
if (!window) {
|
||||
popup(p_parent_rect);
|
||||
} else {
|
||||
popup(Rect2(window->get_position() + p_parent_rect.position, p_parent_rect.size));
|
||||
}
|
||||
} else {
|
||||
popup(p_parent_rect);
|
||||
}
|
||||
}
|
||||
|
||||
void Window::popup_centered_clamped(const Size2 &p_size, float p_fallback_ratio) {
|
||||
|
||||
ERR_FAIL_COND(!is_inside_tree());
|
||||
ERR_FAIL_COND_MSG(window_id == DisplayServer::MAIN_WINDOW_ID, "Can't popup the main window.");
|
||||
|
||||
Rect2 parent_rect;
|
||||
|
||||
if (is_embedded()) {
|
||||
parent_rect = get_parent_viewport()->get_visible_rect();
|
||||
} else {
|
||||
DisplayServer::WindowID parent_id = get_parent_visible_window()->get_window_id();
|
||||
int parent_screen = DisplayServer::get_singleton()->window_get_current_screen(parent_id);
|
||||
parent_rect.position = DisplayServer::get_singleton()->screen_get_position(parent_screen);
|
||||
parent_rect.size = DisplayServer::get_singleton()->screen_get_size(parent_screen);
|
||||
}
|
||||
|
||||
Vector2 size_ratio = parent_rect.size * p_fallback_ratio;
|
||||
|
||||
Rect2 popup_rect;
|
||||
popup_rect.size = Vector2(MIN(size_ratio.x, p_size.x), MIN(size_ratio.y, p_size.y));
|
||||
popup_rect.position = (parent_rect.size - popup_rect.size) / 2;
|
||||
|
||||
popup(popup_rect);
|
||||
}
|
||||
|
||||
void Window::popup_centered(const Size2 &p_minsize) {
|
||||
ERR_FAIL_COND(!is_inside_tree());
|
||||
ERR_FAIL_COND_MSG(window_id == DisplayServer::MAIN_WINDOW_ID, "Can't popup the main window.");
|
||||
|
||||
Rect2 parent_rect;
|
||||
|
||||
if (is_embedded()) {
|
||||
parent_rect = get_parent_viewport()->get_visible_rect();
|
||||
} else {
|
||||
DisplayServer::WindowID parent_id = get_parent_visible_window()->get_window_id();
|
||||
int parent_screen = DisplayServer::get_singleton()->window_get_current_screen(parent_id);
|
||||
parent_rect.position = DisplayServer::get_singleton()->screen_get_position(parent_screen);
|
||||
parent_rect.size = DisplayServer::get_singleton()->screen_get_size(parent_screen);
|
||||
}
|
||||
|
||||
Rect2 popup_rect;
|
||||
if (p_minsize == Size2()) {
|
||||
popup_rect.size = _get_contents_minimum_size();
|
||||
} else {
|
||||
popup_rect.size = p_minsize;
|
||||
}
|
||||
popup_rect.position = (parent_rect.size - popup_rect.size) / 2;
|
||||
|
||||
popup(popup_rect);
|
||||
}
|
||||
|
||||
void Window::popup_centered_ratio(float p_ratio) {
|
||||
|
||||
ERR_FAIL_COND(!is_inside_tree());
|
||||
ERR_FAIL_COND_MSG(window_id == DisplayServer::MAIN_WINDOW_ID, "Can't popup the main window.");
|
||||
|
||||
Rect2 parent_rect;
|
||||
|
||||
if (is_embedded()) {
|
||||
parent_rect = get_parent_viewport()->get_visible_rect();
|
||||
} else {
|
||||
DisplayServer::WindowID parent_id = get_parent_visible_window()->get_window_id();
|
||||
int parent_screen = DisplayServer::get_singleton()->window_get_current_screen(parent_id);
|
||||
parent_rect.position = DisplayServer::get_singleton()->screen_get_position(parent_screen);
|
||||
parent_rect.size = DisplayServer::get_singleton()->screen_get_size(parent_screen);
|
||||
}
|
||||
|
||||
Rect2 popup_rect;
|
||||
popup_rect.size = parent_rect.size * p_ratio;
|
||||
popup_rect.position = (parent_rect.size - popup_rect.size) / 2;
|
||||
|
||||
popup(popup_rect);
|
||||
}
|
||||
|
||||
void Window::popup(const Rect2 &p_screen_rect) {
|
||||
if (p_screen_rect != Rect2()) {
|
||||
set_position(p_screen_rect.position);
|
||||
set_size(p_screen_rect.size);
|
||||
}
|
||||
|
||||
set_transient(true);
|
||||
set_visible(true);
|
||||
_post_popup();
|
||||
notification(NOTIFICATION_POST_POPUP);
|
||||
}
|
||||
|
||||
void Window::grab_focus() {
|
||||
if (window_id != DisplayServer::INVALID_WINDOW_ID) {
|
||||
DisplayServer::get_singleton()->window_move_to_foreground(window_id);
|
||||
}
|
||||
}
|
||||
|
||||
bool Window::has_focus() const {
|
||||
return focused;
|
||||
}
|
||||
|
||||
void Window::add_child_notify(Node *p_child) {
|
||||
|
||||
Control *child_c = Object::cast_to<Control>(p_child);
|
||||
|
||||
if (child_c && child_c->data.theme.is_null() && (theme_owner || theme_owner_window)) {
|
||||
Control::_propagate_theme_changed(child_c, theme_owner, theme_owner_window); //need to propagate here, since many controls may require setting up stuff
|
||||
}
|
||||
|
||||
Window *child_w = Object::cast_to<Window>(p_child);
|
||||
|
||||
if (child_w && child_w->theme.is_null() && (theme_owner || theme_owner_window)) {
|
||||
Control::_propagate_theme_changed(child_w, theme_owner, theme_owner_window); //need to propagate here, since many controls may require setting up stuff
|
||||
}
|
||||
}
|
||||
|
||||
void Window::remove_child_notify(Node *p_child) {
|
||||
|
||||
Control *child_c = Object::cast_to<Control>(p_child);
|
||||
|
||||
if (child_c && (child_c->data.theme_owner || child_c->data.theme_owner_window) && child_c->data.theme.is_null()) {
|
||||
Control::_propagate_theme_changed(child_c, NULL, NULL);
|
||||
}
|
||||
|
||||
Window *child_w = Object::cast_to<Window>(p_child);
|
||||
|
||||
if (child_w && (child_w->theme_owner || child_w->theme_owner_window) && child_w->theme.is_null()) {
|
||||
Control::_propagate_theme_changed(child_w, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void Window::set_theme(const Ref<Theme> &p_theme) {
|
||||
|
||||
if (theme == p_theme)
|
||||
return;
|
||||
|
||||
theme = p_theme;
|
||||
|
||||
if (!p_theme.is_null()) {
|
||||
|
||||
theme_owner = nullptr;
|
||||
theme_owner_window = this;
|
||||
Control::_propagate_theme_changed(this, nullptr, this);
|
||||
} else {
|
||||
|
||||
Control *parent_c = cast_to<Control>(get_parent());
|
||||
if (parent_c && (parent_c->data.theme_owner || parent_c->data.theme_owner_window)) {
|
||||
Control::_propagate_theme_changed(this, parent_c->data.theme_owner, parent_c->data.theme_owner_window);
|
||||
} else {
|
||||
Window *parent_w = cast_to<Window>(get_parent());
|
||||
if (parent_w && (parent_w->theme_owner || parent_w->theme_owner_window)) {
|
||||
Control::_propagate_theme_changed(this, parent_w->theme_owner, parent_w->theme_owner_window);
|
||||
} else {
|
||||
Control::_propagate_theme_changed(this, nullptr, nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Ref<Theme> Window::get_theme() const {
|
||||
return theme;
|
||||
}
|
||||
|
||||
void Window::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_title", "title"), &Window::set_title);
|
||||
|
@ -681,10 +1016,18 @@ void Window::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("set_visible", "visible"), &Window::set_visible);
|
||||
ClassDB::bind_method(D_METHOD("is_visible"), &Window::is_visible);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("hide"), &Window::hide);
|
||||
ClassDB::bind_method(D_METHOD("show"), &Window::show);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_transient", "transient"), &Window::set_transient);
|
||||
ClassDB::bind_method(D_METHOD("is_transient"), &Window::is_transient);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_exclusive", "exclusive"), &Window::set_exclusive);
|
||||
ClassDB::bind_method(D_METHOD("is_exclusive"), &Window::is_exclusive);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("can_draw"), &Window::is_transient);
|
||||
ClassDB::bind_method(D_METHOD("has_focus"), &Window::has_focus);
|
||||
ClassDB::bind_method(D_METHOD("grab_focus"), &Window::grab_focus);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_ime_active"), &Window::set_ime_active);
|
||||
ClassDB::bind_method(D_METHOD("set_ime_position"), &Window::set_ime_position);
|
||||
|
@ -703,6 +1046,15 @@ void Window::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("set_use_font_oversampling", "enable"), &Window::set_use_font_oversampling);
|
||||
ClassDB::bind_method(D_METHOD("is_using_font_oversampling"), &Window::is_using_font_oversampling);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_wrap_controls", "enable"), &Window::set_wrap_controls);
|
||||
ClassDB::bind_method(D_METHOD("is_wrapping_controls"), &Window::is_wrapping_controls);
|
||||
ClassDB::bind_method(D_METHOD("child_controls_changed"), &Window::child_controls_changed);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_update_child_controls"), &Window::_update_child_controls);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_theme", "theme"), &Window::set_theme);
|
||||
ClassDB::bind_method(D_METHOD("get_theme"), &Window::get_theme);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "title"), "set_title", "get_title");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2I, "position"), "set_position", "get_position");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2I, "size"), "set_size", "get_size");
|
||||
|
@ -710,7 +1062,9 @@ void Window::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_screen"), "set_current_screen", "get_current_screen");
|
||||
ADD_GROUP("Flags", "");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "visible"), "set_visible", "is_visible");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "wrap_controls"), "set_wrap_controls", "is_wrapping_controls");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "transient"), "set_transient", "is_transient");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "exclusive"), "set_exclusive", "is_exclusive");
|
||||
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "unresizable"), "set_flag", "get_flag", FLAG_RESIZE_DISABLED);
|
||||
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "borderless"), "set_flag", "get_flag", FLAG_BORDERLESS);
|
||||
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "always_on_top"), "set_flag", "get_flag", FLAG_ALWAYS_ON_TOP);
|
||||
|
@ -722,7 +1076,10 @@ void Window::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2I, "content_scale_size"), "set_content_scale_size", "get_content_scale_size");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "content_scale_mode", PROPERTY_HINT_ENUM, "Disabled,Object,Pixels"), "set_content_scale_mode", "get_content_scale_mode");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "content_scale_aspect", PROPERTY_HINT_ENUM, "Ignore,Keep,KeepWidth,KeepHeight,Expand"), "set_content_scale_aspect", "get_content_scale_aspect");
|
||||
ADD_GROUP("Theme", "");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "theme", PROPERTY_HINT_RESOURCE_TYPE, "Theme"), "set_theme", "get_theme");
|
||||
|
||||
ADD_SIGNAL(MethodInfo("window_input", PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent")));
|
||||
ADD_SIGNAL(MethodInfo("files_dropped"));
|
||||
ADD_SIGNAL(MethodInfo("mouse_entered"));
|
||||
ADD_SIGNAL(MethodInfo("mouse_exited"));
|
||||
|
@ -730,6 +1087,9 @@ void Window::_bind_methods() {
|
|||
ADD_SIGNAL(MethodInfo("focus_exited"));
|
||||
ADD_SIGNAL(MethodInfo("close_requested"));
|
||||
ADD_SIGNAL(MethodInfo("go_back_requested"));
|
||||
ADD_SIGNAL(MethodInfo("visibility_changed"));
|
||||
|
||||
BIND_CONSTANT(NOTIFICATION_VISIBILITY_CHANGED);
|
||||
}
|
||||
|
||||
Window::Window() {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue