summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/classes/TileMap.xml2
-rw-r--r--modules/websocket/wsl_peer.cpp5
-rw-r--r--platform/macos/gl_manager_macos_legacy.h1
-rw-r--r--platform/macos/gl_manager_macos_legacy.mm20
-rw-r--r--scene/2d/tile_map.cpp2
-rw-r--r--scene/gui/popup_menu.cpp3
-rw-r--r--servers/rendering/dummy/storage/light_storage.cpp86
-rw-r--r--servers/rendering/dummy/storage/light_storage.h36
-rw-r--r--servers/rendering/dummy/storage/utilities.h7
9 files changed, 145 insertions, 17 deletions
diff --git a/doc/classes/TileMap.xml b/doc/classes/TileMap.xml
index 3f70810a7f..d3197efc6b 100644
--- a/doc/classes/TileMap.xml
+++ b/doc/classes/TileMap.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="TileMap" inherits="Node2D" deprecated="Use multiple [TileMapLayer] nodes instead." keywords="gridmap" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
+<class name="TileMap" inherits="Node2D" deprecated="Use multiple [TileMapLayer] nodes instead. To convert a TileMap to a set of TileMapLayer nodes, open the TileMap bottom panel with the node selected, click the toolbox icon in the top-right corner and choose &apos;Extract TileMap layers as individual TileMapLayer nodes&apos;." keywords="gridmap" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
Node for 2D tile-based maps.
</brief_description>
diff --git a/modules/websocket/wsl_peer.cpp b/modules/websocket/wsl_peer.cpp
index 3c63aa4fbf..0a9a4053e3 100644
--- a/modules/websocket/wsl_peer.cpp
+++ b/modules/websocket/wsl_peer.cpp
@@ -99,6 +99,8 @@ void WSLPeer::Resolver::try_next_candidate(Ref<StreamPeerTCP> &p_tcp) {
p_tcp->poll();
StreamPeerTCP::Status status = p_tcp->get_status();
if (status == StreamPeerTCP::STATUS_CONNECTED) {
+ // On Windows, setting TCP_NODELAY may fail if the socket is still connecting.
+ p_tcp->set_no_delay(true);
ip_candidates.clear();
return;
} else if (status == StreamPeerTCP::STATUS_CONNECTING) {
@@ -112,7 +114,6 @@ void WSLPeer::Resolver::try_next_candidate(Ref<StreamPeerTCP> &p_tcp) {
while (ip_candidates.size()) {
Error err = p_tcp->connect_to_host(ip_candidates.pop_front(), port);
if (err == OK) {
- p_tcp->set_no_delay(true);
return;
} else {
p_tcp->disconnect_from_host();
@@ -311,7 +312,7 @@ void WSLPeer::_do_client_handshake() {
ERR_FAIL_COND(tcp.is_null());
// Try to connect to candidates.
- if (resolver.has_more_candidates()) {
+ if (resolver.has_more_candidates() || tcp->get_status() == StreamPeerTCP::STATUS_CONNECTING) {
resolver.try_next_candidate(tcp);
if (resolver.has_more_candidates()) {
return; // Still pending.
diff --git a/platform/macos/gl_manager_macos_legacy.h b/platform/macos/gl_manager_macos_legacy.h
index af9be8f5ba..383c5c3306 100644
--- a/platform/macos/gl_manager_macos_legacy.h
+++ b/platform/macos/gl_manager_macos_legacy.h
@@ -62,6 +62,7 @@ class GLManagerLegacy_MacOS {
Error create_context(GLWindow &win);
+ bool framework_loaded = false;
bool use_vsync = false;
CGLEnablePtr CGLEnable = nullptr;
CGLSetParameterPtr CGLSetParameter = nullptr;
diff --git a/platform/macos/gl_manager_macos_legacy.mm b/platform/macos/gl_manager_macos_legacy.mm
index 6ce3831d9c..a0d037144e 100644
--- a/platform/macos/gl_manager_macos_legacy.mm
+++ b/platform/macos/gl_manager_macos_legacy.mm
@@ -32,6 +32,7 @@
#if defined(MACOS_ENABLED) && defined(GLES3_ENABLED)
+#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
@@ -156,7 +157,7 @@ void GLManagerLegacy_MacOS::window_set_per_pixel_transparency_enabled(DisplaySer
}
Error GLManagerLegacy_MacOS::initialize() {
- return OK;
+ return framework_loaded ? OK : ERR_CANT_CREATE;
}
void GLManagerLegacy_MacOS::set_use_vsync(bool p_use) {
@@ -186,12 +187,17 @@ NSOpenGLContext *GLManagerLegacy_MacOS::get_context(DisplayServer::WindowID p_wi
}
GLManagerLegacy_MacOS::GLManagerLegacy_MacOS() {
- CFBundleRef framework = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.opengl"));
- CFBundleLoadExecutable(framework);
-
- CGLEnable = (CGLEnablePtr)CFBundleGetFunctionPointerForName(framework, CFSTR("CGLEnable"));
- CGLSetParameter = (CGLSetParameterPtr)CFBundleGetFunctionPointerForName(framework, CFSTR("CGLSetParameter"));
- CGLGetCurrentContext = (CGLGetCurrentContextPtr)CFBundleGetFunctionPointerForName(framework, CFSTR("CGLGetCurrentContext"));
+ NSBundle *framework = [NSBundle bundleWithPath:@"/System/Library/Frameworks/OpenGL.framework"];
+ if (framework) {
+ void *library_handle = dlopen([framework.executablePath UTF8String], RTLD_NOW);
+ if (library_handle) {
+ CGLEnable = (CGLEnablePtr)dlsym(library_handle, "CGLEnable");
+ CGLSetParameter = (CGLSetParameterPtr)dlsym(library_handle, "CGLSetParameter");
+ CGLGetCurrentContext = (CGLGetCurrentContextPtr)dlsym(library_handle, "CGLGetCurrentContext");
+
+ framework_loaded = CGLEnable && CGLSetParameter && CGLGetCurrentContext;
+ }
+ }
}
GLManagerLegacy_MacOS::~GLManagerLegacy_MacOS() {
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index 48ade1e5cc..c12b95314e 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -817,6 +817,8 @@ TypedArray<Vector2i> TileMap::get_surrounding_cells(const Vector2i &p_coords) {
PackedStringArray TileMap::get_configuration_warnings() const {
PackedStringArray warnings = Node::get_configuration_warnings();
+ warnings.push_back(RTR("The TileMap node is deprecated as it is superseded by the use of multiple TileMapLayer nodes.\nTo convert a TileMap to a set of TileMapLayer nodes, open the TileMap bottom panel with this node selected, click the toolbox icon in the top-right corner and choose \"Extract TileMap layers as individual TileMapLayer nodes\"."));
+
// Retrieve the set of Z index values with a Y-sorted layer.
RBSet<int> y_sorted_z_index;
for (const TileMapLayer *layer : layers) {
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index f62421061b..443fe4774a 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -608,7 +608,7 @@ void PopupMenu::_input_from_window_internal(const Ref<InputEvent> &p_event) {
return;
}
// Disable clicks under a time threshold to avoid selection right when opening the popup.
- if (was_during_grabbed_click && OS::get_singleton()->get_ticks_msec() - popup_time_msec < 150) {
+ if (was_during_grabbed_click && OS::get_singleton()->get_ticks_msec() - popup_time_msec < 400) {
return;
}
@@ -1064,6 +1064,7 @@ void PopupMenu::_notification(int p_what) {
} break;
case NOTIFICATION_POST_POPUP: {
+ popup_time_msec = OS::get_singleton()->get_ticks_msec();
initial_button_mask = Input::get_singleton()->get_mouse_button_mask();
during_grabbed_click = (bool)initial_button_mask;
} break;
diff --git a/servers/rendering/dummy/storage/light_storage.cpp b/servers/rendering/dummy/storage/light_storage.cpp
new file mode 100644
index 0000000000..443e047b37
--- /dev/null
+++ b/servers/rendering/dummy/storage/light_storage.cpp
@@ -0,0 +1,86 @@
+/**************************************************************************/
+/* light_storage.cpp */
+/**************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/**************************************************************************/
+/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
+/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/**************************************************************************/
+
+#include "light_storage.h"
+
+using namespace RendererDummy;
+
+LightStorage *LightStorage::singleton = nullptr;
+
+LightStorage *LightStorage::get_singleton() {
+ return singleton;
+}
+
+LightStorage::LightStorage() {
+ singleton = this;
+}
+
+LightStorage::~LightStorage() {
+ singleton = nullptr;
+}
+
+bool LightStorage::free(RID p_rid) {
+ if (owns_lightmap(p_rid)) {
+ lightmap_free(p_rid);
+ return true;
+ } else if (owns_lightmap_instance(p_rid)) {
+ lightmap_instance_free(p_rid);
+ return true;
+ }
+
+ return false;
+}
+
+/* LIGHTMAP API */
+
+RID LightStorage::lightmap_allocate() {
+ return lightmap_owner.allocate_rid();
+}
+
+void LightStorage::lightmap_initialize(RID p_lightmap) {
+ lightmap_owner.initialize_rid(p_lightmap, Lightmap());
+}
+
+void LightStorage::lightmap_free(RID p_rid) {
+ lightmap_set_textures(p_rid, RID(), false);
+ lightmap_owner.free(p_rid);
+}
+
+/* LIGHTMAP INSTANCE */
+
+RID LightStorage::lightmap_instance_create(RID p_lightmap) {
+ LightmapInstance li;
+ li.lightmap = p_lightmap;
+ return lightmap_instance_owner.make_rid(li);
+}
+
+void LightStorage::lightmap_instance_free(RID p_lightmap) {
+ lightmap_instance_owner.free(p_lightmap);
+}
diff --git a/servers/rendering/dummy/storage/light_storage.h b/servers/rendering/dummy/storage/light_storage.h
index 0a9602b603..c3b63cdbf6 100644
--- a/servers/rendering/dummy/storage/light_storage.h
+++ b/servers/rendering/dummy/storage/light_storage.h
@@ -36,7 +36,29 @@
namespace RendererDummy {
class LightStorage : public RendererLightStorage {
+private:
+ static LightStorage *singleton;
+ /* LIGHTMAP */
+ struct Lightmap {
+ // dummy lightmap, no data
+ };
+
+ mutable RID_Owner<Lightmap, true> lightmap_owner;
+ /* LIGHTMAP INSTANCE */
+
+ struct LightmapInstance {
+ RID lightmap;
+ };
+
+ mutable RID_Owner<LightmapInstance> lightmap_instance_owner;
+
public:
+ static LightStorage *get_singleton();
+
+ LightStorage();
+ virtual ~LightStorage();
+
+ bool free(RID p_rid);
/* Light API */
virtual RID directional_light_allocate() override { return RID(); }
@@ -146,9 +168,11 @@ public:
/* LIGHTMAP CAPTURE */
- virtual RID lightmap_allocate() override { return RID(); }
- virtual void lightmap_initialize(RID p_rid) override {}
- virtual void lightmap_free(RID p_rid) override {}
+ bool owns_lightmap(RID p_rid) { return lightmap_owner.owns(p_rid); }
+
+ virtual RID lightmap_allocate() override;
+ virtual void lightmap_initialize(RID p_rid) override;
+ virtual void lightmap_free(RID p_rid) override;
virtual void lightmap_set_textures(RID p_lightmap, RID p_light, bool p_uses_spherical_haromics) override {}
virtual void lightmap_set_probe_bounds(RID p_lightmap, const AABB &p_bounds) override {}
@@ -167,8 +191,10 @@ public:
/* LIGHTMAP INSTANCE */
- RID lightmap_instance_create(RID p_lightmap) override { return RID(); }
- void lightmap_instance_free(RID p_lightmap) override {}
+ bool owns_lightmap_instance(RID p_rid) { return lightmap_instance_owner.owns(p_rid); }
+
+ RID lightmap_instance_create(RID p_lightmap) override;
+ void lightmap_instance_free(RID p_lightmap) override;
void lightmap_instance_set_transform(RID p_lightmap, const Transform3D &p_transform) override {}
/* SHADOW ATLAS API */
diff --git a/servers/rendering/dummy/storage/utilities.h b/servers/rendering/dummy/storage/utilities.h
index 6e8af9afac..ae83547afd 100644
--- a/servers/rendering/dummy/storage/utilities.h
+++ b/servers/rendering/dummy/storage/utilities.h
@@ -31,6 +31,7 @@
#ifndef UTILITIES_DUMMY_H
#define UTILITIES_DUMMY_H
+#include "light_storage.h"
#include "material_storage.h"
#include "mesh_storage.h"
#include "servers/rendering/storage/utilities.h"
@@ -55,12 +56,16 @@ public:
return RS::INSTANCE_MESH;
} else if (RendererDummy::MeshStorage::get_singleton()->owns_multimesh(p_rid)) {
return RS::INSTANCE_MULTIMESH;
+ } else if (RendererDummy::LightStorage::get_singleton()->owns_lightmap(p_rid)) {
+ return RS::INSTANCE_LIGHTMAP;
}
return RS::INSTANCE_NONE;
}
virtual bool free(RID p_rid) override {
- if (RendererDummy::TextureStorage::get_singleton()->owns_texture(p_rid)) {
+ if (RendererDummy::LightStorage::get_singleton()->free(p_rid)) {
+ return true;
+ } else if (RendererDummy::TextureStorage::get_singleton()->owns_texture(p_rid)) {
RendererDummy::TextureStorage::get_singleton()->texture_free(p_rid);
return true;
} else if (RendererDummy::MeshStorage::get_singleton()->owns_mesh(p_rid)) {