diff options
-rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 5 | ||||
-rw-r--r-- | editor/plugins/script_editor_plugin.h | 1 | ||||
-rw-r--r-- | editor/property_editor.cpp | 2 | ||||
-rw-r--r-- | editor/script_create_dialog.cpp | 15 | ||||
-rw-r--r-- | platform/windows/os_windows.cpp | 114 | ||||
-rw-r--r-- | platform/windows/os_windows.h | 2 | ||||
-rw-r--r-- | scene/2d/area_2d.cpp | 7 | ||||
-rw-r--r-- | scene/3d/area.cpp | 12 | ||||
-rw-r--r-- | scene/gui/control.cpp | 4 | ||||
-rw-r--r-- | scene/main/viewport.cpp | 2 |
10 files changed, 79 insertions, 85 deletions
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index aedc96d20e..dc2eddda39 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -876,6 +876,9 @@ void ScriptEditor::_menu_option(int p_option) { bool debug_with_external_editor = !debug_menu->get_popup()->is_item_checked(debug_menu->get_popup()->get_item_index(DEBUG_WITH_EXTERNAL_EDITOR)); debugger->set_debug_with_external_editor(debug_with_external_editor); debug_menu->get_popup()->set_item_checked(debug_menu->get_popup()->get_item_index(DEBUG_WITH_EXTERNAL_EDITOR), debug_with_external_editor); + } break; + case TOGGLE_SCRIPTS_PANEL: { + list_split->set_visible(!list_split->is_visible()); } } @@ -2235,6 +2238,8 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_docs", TTR("Close Docs")), CLOSE_DOCS); file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_file", TTR("Close"), KEY_MASK_CMD | KEY_W), FILE_CLOSE); file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_all", TTR("Close All")), CLOSE_ALL); + file_menu->get_popup()->add_separator(); + file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/toggle_scripts_panel", TTR("Toggle Scripts Panel"), KEY_MASK_CMD | KEY_BACKSLASH), TOGGLE_SCRIPTS_PANEL); file_menu->get_popup()->connect("id_pressed", this, "_menu_option"); script_search_menu = memnew(MenuButton); diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h index da8248a1a7..7f17365931 100644 --- a/editor/plugins/script_editor_plugin.h +++ b/editor/plugins/script_editor_plugin.h @@ -134,6 +134,7 @@ class ScriptEditor : public VBoxContainer { FILE_CLOSE, CLOSE_DOCS, CLOSE_ALL, + TOGGLE_SCRIPTS_PANEL, FILE_TOOL_RELOAD, FILE_TOOL_RELOAD_SOFT, DEBUG_NEXT, diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp index ad9b3607e9..8a9fd2cde5 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -4462,7 +4462,7 @@ class SectionedPropertyEditorFilter : public Object { continue; if (sp == -1) { - pi.name = "Global/" + pi.name; + pi.name = "global/" + pi.name; } if (pi.name.begins_with(section + "/")) { diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index 47675bcffe..4a9b64639b 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -58,7 +58,6 @@ void ScriptCreateDialog::config(const String &p_base_name, const String &p_base_ file_path->set_text(""); } _lang_changed(current_language); - _template_changed(template_menu->get_selected()); _parent_name_changed(parent_name->get_text()); _class_name_changed(""); _path_changed(file_path->get_text()); @@ -246,25 +245,31 @@ void ScriptCreateDialog::_lang_changed(int l) { bool use_templates = language->is_using_templates(); template_menu->set_disabled(!use_templates); + template_menu->clear(); if (use_templates) { + template_list = EditorSettings::get_singleton()->get_script_templates(language->get_extension()); String last_lang = EditorSettings::get_singleton()->get_project_metadata("script_setup", "last_selected_language", ""); String last_template = EditorSettings::get_singleton()->get_project_metadata("script_setup", "last_selected_template", ""); - template_menu->clear(); template_menu->add_item(TTR("Default")); for (int i = 0; i < template_list.size(); i++) { String s = template_list[i].capitalize(); template_menu->add_item(s); - if (language_menu->get_item_text(l) == last_lang && last_template == s) { + if (language_menu->get_item_text(language_menu->get_selected()) == last_lang && last_template == s) { template_menu->select(i + 1); } } - _template_changed(template_menu->get_selected()); - EditorSettings::get_singleton()->set_project_metadata("script_setup", "last_selected_language", language_menu->get_item_text(l)); + } else { + + template_menu->add_item(TTR("N/A")); + script_template = ""; } + _template_changed(template_menu->get_selected()); + EditorSettings::get_singleton()->set_project_metadata("script_setup", "last_selected_language", language_menu->get_item_text(language_menu->get_selected())); + _update_dialog(); } diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index e94529dd94..2daf580c0d 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -1410,28 +1410,21 @@ void OS_Windows::set_window_size(const Size2 p_size) { return; } - RECT crect; - GetClientRect(hWnd, &crect); + int w = p_size.width; + int h = p_size.height; RECT rect; GetWindowRect(hWnd, &rect); - int dx = (rect.right - rect.left) - (crect.right - crect.left); - int dy = (rect.bottom - rect.top) - (crect.bottom - crect.top); - rect.right = rect.left + p_size.width + dx; - rect.bottom = rect.top + p_size.height + dy; + if (video_mode.borderless_window == false) { + RECT crect; + GetClientRect(hWnd, &crect); - //print_line("PRE: "+itos(rect.left)+","+itos(rect.top)+","+itos(rect.right-rect.left)+","+itos(rect.bottom-rect.top)); - - /*if (video_mode.resizable) { - AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW, FALSE); - } else { - AdjustWindowRect(&rect, WS_CAPTION | WS_POPUPWINDOW, FALSE); - }*/ - - //print_line("POST: "+itos(rect.left)+","+itos(rect.top)+","+itos(rect.right-rect.left)+","+itos(rect.bottom-rect.top)); + w += (rect.right - rect.left) - (crect.right - crect.left); + h += (rect.bottom - rect.top) - (crect.bottom - crect.top); + } - MoveWindow(hWnd, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, TRUE); + MoveWindow(hWnd, rect.left, rect.top, w, h, TRUE); } void OS_Windows::set_window_fullscreen(bool p_enabled) { @@ -1451,21 +1444,18 @@ void OS_Windows::set_window_fullscreen(bool p_enabled) { Point2 pos = get_screen_position(cs); Size2 size = get_screen_size(cs); - /* r.left = pos.x; - r.top = pos.y; - r.bottom = pos.y+size.y; - r.right = pos.x+size.x; -*/ - SetWindowLongPtr(hWnd, GWL_STYLE, - WS_SYSMENU | WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE); - MoveWindow(hWnd, pos.x, pos.y, size.width, size.height, TRUE); - video_mode.fullscreen = true; + _update_window_style(false); + + MoveWindow(hWnd, pos.x, pos.y, size.width, size.height, TRUE); + } else { RECT rect; + video_mode.fullscreen = false; + if (pre_fs_valid) { rect = pre_fs_rect; } else { @@ -1475,35 +1465,12 @@ void OS_Windows::set_window_fullscreen(bool p_enabled) { rect.bottom = video_mode.height; } - if (video_mode.resizable) { - - SetWindowLongPtr(hWnd, GWL_STYLE, WS_OVERLAPPEDWINDOW | WS_VISIBLE); - //AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW, FALSE); - MoveWindow(hWnd, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, TRUE); - } else { + _update_window_style(false); - SetWindowLongPtr(hWnd, GWL_STYLE, WS_CAPTION | WS_POPUPWINDOW | WS_VISIBLE); - //AdjustWindowRect(&rect, WS_CAPTION | WS_POPUPWINDOW, FALSE); - MoveWindow(hWnd, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, TRUE); - } + MoveWindow(hWnd, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, TRUE); - video_mode.fullscreen = false; pre_fs_valid = true; - /* - DWORD dwExStyle=WS_EX_APPWINDOW | WS_EX_WINDOWEDGE; - DWORD dwStyle=WS_OVERLAPPEDWINDOW; - if (!video_mode.resizable) { - dwStyle &= ~WS_THICKFRAME; - dwStyle &= ~WS_MAXIMIZEBOX; - } - AdjustWindowRectEx(&pre_fs_rect, dwStyle, FALSE, dwExStyle); - video_mode.fullscreen=false; - video_mode.width=pre_fs_rect.right-pre_fs_rect.left; - video_mode.height=pre_fs_rect.bottom-pre_fs_rect.top; -*/ } - - //MoveWindow(hWnd,r.left,r.top,p_size.x,p_size.y,TRUE); } bool OS_Windows::is_window_fullscreen() const { @@ -1513,30 +1480,10 @@ void OS_Windows::set_window_resizable(bool p_enabled) { if (video_mode.resizable == p_enabled) return; - /* - GetWindowRect(hWnd,&pre_fs_rect); - DWORD dwExStyle=WS_EX_APPWINDOW | WS_EX_WINDOWEDGE; - DWORD dwStyle=WS_OVERLAPPEDWINDOW; - if (!p_enabled) { - dwStyle &= ~WS_THICKFRAME; - dwStyle &= ~WS_MAXIMIZEBOX; - } - AdjustWindowRectEx(&pre_fs_rect, dwStyle, FALSE, dwExStyle); - */ - - if (!video_mode.fullscreen) { - if (p_enabled) { - SetWindowLongPtr(hWnd, GWL_STYLE, WS_OVERLAPPEDWINDOW | WS_VISIBLE); - } else { - SetWindowLongPtr(hWnd, GWL_STYLE, WS_CAPTION | WS_MINIMIZEBOX | WS_POPUPWINDOW | WS_VISIBLE); - } - - RECT rect; - GetWindowRect(hWnd, &rect); - MoveWindow(hWnd, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, TRUE); - } video_mode.resizable = p_enabled; + + _update_window_style(); } bool OS_Windows::is_window_resizable() const { @@ -1576,13 +1523,36 @@ bool OS_Windows::is_window_maximized() const { } void OS_Windows::set_borderless_window(int p_borderless) { + if (video_mode.borderless_window == p_borderless) + return; + video_mode.borderless_window = p_borderless; + + _update_window_style(); } bool OS_Windows::get_borderless_window() { return video_mode.borderless_window; } +void OS_Windows::_update_window_style(bool repaint) { + if (video_mode.fullscreen || video_mode.borderless_window) { + SetWindowLongPtr(hWnd, GWL_STYLE, WS_SYSMENU | WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE); + } else { + if (video_mode.resizable) { + SetWindowLongPtr(hWnd, GWL_STYLE, WS_OVERLAPPEDWINDOW | WS_VISIBLE); + } else { + SetWindowLongPtr(hWnd, GWL_STYLE, WS_CAPTION | WS_MINIMIZEBOX | WS_POPUPWINDOW | WS_VISIBLE); + } + } + + if (repaint) { + RECT rect; + GetWindowRect(hWnd, &rect); + MoveWindow(hWnd, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, TRUE); + } +} + Error OS_Windows::open_dynamic_library(const String p_path, void *&p_library_handle) { p_library_handle = (void *)LoadLibrary(p_path.utf8().get_data()); if (!p_library_handle) { diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index 6cbdd58830..835141145f 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -133,6 +133,8 @@ class OS_Windows : public OS { void _drag_event(int p_x, int p_y, int idx); void _touch_event(bool p_pressed, int p_x, int p_y, int idx); + void _update_window_style(bool repaint = true); + // functions used by main to initialize/deintialize the OS protected: virtual int get_video_driver_count() const; diff --git a/scene/2d/area_2d.cpp b/scene/2d/area_2d.cpp index db22a38cec..841e2ef7d3 100644 --- a/scene/2d/area_2d.cpp +++ b/scene/2d/area_2d.cpp @@ -331,7 +331,10 @@ void Area2D::_clear_monitoring() { Object *obj = ObjectDB::get_instance(E->key()); Node *node = obj ? obj->cast_to<Node>() : NULL; - ERR_CONTINUE(!node); + + if (!node) //node may have been deleted in previous frame or at other legiminate point + continue; + //ERR_CONTINUE(!node); node->disconnect(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree); node->disconnect(SceneStringNames::get_singleton()->tree_exited, this, SceneStringNames::get_singleton()->_body_exit_tree); @@ -359,7 +362,7 @@ void Area2D::_clear_monitoring() { Object *obj = ObjectDB::get_instance(E->key()); Node *node = obj ? obj->cast_to<Node>() : NULL; - if (!node) //node may have been deleted in previous frame, this should not be an error + if (!node) //node may have been deleted in previous frame or at other legiminate point continue; //ERR_CONTINUE(!node); diff --git a/scene/3d/area.cpp b/scene/3d/area.cpp index 39a4e926b2..c62a866d8d 100644 --- a/scene/3d/area.cpp +++ b/scene/3d/area.cpp @@ -227,7 +227,11 @@ void Area::_clear_monitoring() { Object *obj = ObjectDB::get_instance(E->key()); Node *node = obj ? obj->cast_to<Node>() : NULL; - ERR_CONTINUE(!node); + + if (!node) //node may have been deleted in previous frame or at other legiminate point + continue; + //ERR_CONTINUE(!node); + if (!E->get().in_tree) continue; @@ -253,7 +257,11 @@ void Area::_clear_monitoring() { Object *obj = ObjectDB::get_instance(E->key()); Node *node = obj ? obj->cast_to<Node>() : NULL; - ERR_CONTINUE(!node); + + if (!node) //node may have been deleted in previous frame or at other legiminate point + continue; + //ERR_CONTINUE(!node); + if (!E->get().in_tree) continue; diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index bf8d81d4a6..e9e299ffc5 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -1229,8 +1229,8 @@ void Control::_size_changed() { } } - Point2 new_pos_cache = Point2(margin_pos[0], margin_pos[1]).floor(); - Size2 new_size_cache = Point2(margin_pos[2], margin_pos[3]).floor() - new_pos_cache; + Point2 new_pos_cache = Point2(margin_pos[0], margin_pos[1]); + Size2 new_size_cache = Point2(margin_pos[2], margin_pos[3]) - new_pos_cache; Size2 minimum_size = get_combined_minimum_size(); diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 3a9968d126..4fb4e02148 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -2352,7 +2352,7 @@ void Viewport::unhandled_input(const Ref<InputEvent> &p_event) { if (physics_object_picking && !get_tree()->input_handled) { - if (p_event->cast_to<InputEventMouseButton>() || p_event->cast_to<InputEventMouseMotion>() || p_event->cast_to<InputEventScreenDrag>() || p_event->cast_to<InputEventScreenTouch>()) { + if (Input::get_singleton()->get_mouse_mode() != Input::MOUSE_MODE_CAPTURED && (p_event->cast_to<InputEventMouseButton>() || p_event->cast_to<InputEventMouseMotion>() || p_event->cast_to<InputEventScreenDrag>() || p_event->cast_to<InputEventScreenTouch>())) { physics_picking_events.push_back(p_event); } } |