diff options
author | Juan Linietsky <juan@godotengine.org> | 2020-03-06 14:00:16 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2020-03-26 15:49:40 +0100 |
commit | 4758057f205a7d2e0d2db2c034705b7afcdf310f (patch) | |
tree | 3a96eee6ba8758976581fcecb32faacd285baaee /modules | |
parent | f51fdc6eef636eba7bf43d313995e708f690c782 (diff) |
Working multiple window support, including editor
Diffstat (limited to 'modules')
6 files changed, 48 insertions, 54 deletions
diff --git a/modules/gdnative/gdnative_library_editor_plugin.cpp b/modules/gdnative/gdnative_library_editor_plugin.cpp index db90199e63..e2f1fc81ac 100644 --- a/modules/gdnative/gdnative_library_editor_plugin.cpp +++ b/modules/gdnative/gdnative_library_editor_plugin.cpp @@ -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)); } diff --git a/modules/gdnavigation/navigation_mesh_editor_plugin.cpp b/modules/gdnavigation/navigation_mesh_editor_plugin.cpp index e6ff7a7afa..ba55b13088 100644 --- a/modules/gdnavigation/navigation_mesh_editor_plugin.cpp +++ b/modules/gdnavigation/navigation_mesh_editor_plugin.cpp @@ -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; } diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index 9d14445221..94f1448ae4 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -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)); diff --git a/modules/visual_script/visual_script_editor.h b/modules/visual_script/visual_script_editor.h index 6ff00cf0a6..79388e7298 100644 --- a/modules/visual_script/visual_script_editor.h +++ b/modules/visual_script/visual_script_editor.h @@ -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; diff --git a/modules/visual_script/visual_script_property_selector.cpp b/modules/visual_script/visual_script_property_selector.cpp index 6e0d662be9..c12eda683a 100644 --- a/modules/visual_script/visual_script_property_selector.cpp +++ b/modules/visual_script/visual_script_property_selector.cpp @@ -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); diff --git a/modules/visual_script/visual_script_property_selector.h b/modules/visual_script/visual_script_property_selector.h index f438ca1f5b..cc49b2863d 100644 --- a/modules/visual_script/visual_script_property_selector.h +++ b/modules/visual_script/visual_script_property_selector.h @@ -64,6 +64,7 @@ class VisualScriptPropertySelector : public ConfirmationDialog { Object *instance; bool virtuals_only; bool seq_connect; + VBoxContainer *vbc; Vector<Variant::Type> type_filter; |