summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/error/error_macros.h183
-rw-r--r--core/string/translation.cpp9
-rw-r--r--doc/classes/PhysicsTestMotionParameters2D.xml3
-rw-r--r--doc/classes/PhysicsTestMotionParameters3D.xml3
-rw-r--r--drivers/unix/ip_unix.cpp4
-rw-r--r--drivers/wasapi/audio_driver_wasapi.h1
-rw-r--r--drivers/windows/dir_access_windows.cpp1
-rw-r--r--drivers/windows/file_access_windows.cpp1
-rw-r--r--drivers/winmidi/midi_driver_winmidi.h1
-rw-r--r--drivers/xaudio2/audio_driver_xaudio2.h1
-rw-r--r--modules/gdscript/gdscript_analyzer.cpp8
-rw-r--r--modules/mono/utils/mono_reg_utils.cpp2
-rw-r--r--modules/mono/utils/path_utils.cpp1
-rw-r--r--platform/uwp/os_uwp.cpp4
-rw-r--r--platform/uwp/os_uwp.h1
-rw-r--r--platform/windows/context_gl_windows.h1
-rw-r--r--platform/windows/crash_handler_windows.h1
-rw-r--r--platform/windows/display_server_windows.cpp2
-rw-r--r--platform/windows/display_server_windows.h1
-rw-r--r--platform/windows/key_mapping_windows.h2
-rw-r--r--platform/windows/os_windows.cpp6
-rw-r--r--platform/windows/os_windows.h2
-rw-r--r--platform/windows/vulkan_context_win.h2
-rw-r--r--platform/windows/windows_terminal_logger.cpp1
-rw-r--r--scene/2d/animated_sprite_2d.cpp5
-rw-r--r--scene/2d/physics_body_2d.cpp9
-rw-r--r--scene/2d/physics_body_2d.h1
-rw-r--r--scene/3d/physics_body_3d.cpp7
-rw-r--r--scene/3d/physics_body_3d.h1
-rw-r--r--scene/3d/sprite_3d.cpp14
-rw-r--r--servers/physics_2d/space_2d_sw.cpp9
-rw-r--r--servers/physics_3d/space_3d_sw.cpp10
-rw-r--r--servers/physics_server_2d.cpp24
-rw-r--r--servers/physics_server_2d.h4
-rw-r--r--servers/physics_server_3d.cpp24
-rw-r--r--servers/physics_server_3d.h4
36 files changed, 229 insertions, 124 deletions
diff --git a/core/error/error_macros.h b/core/error/error_macros.h
index f909a67d55..1bed8d366b 100644
--- a/core/error/error_macros.h
+++ b/core/error/error_macros.h
@@ -89,13 +89,6 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li
#define GENERATE_TRAP() __builtin_trap()
#endif
-// Used to strip debug messages in release mode
-#ifdef DEBUG_ENABLED
-#define DEBUG_STR(m_msg) m_msg
-#else
-#define DEBUG_STR(m_msg) ""
-#endif
-
/**
* Error macros.
* WARNING: These macros work in the opposite way to assert().
@@ -135,11 +128,11 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li
* Ensures an integer index `m_index` is less than `m_size` and greater than or equal to 0.
* If not, prints `m_msg` and the current function returns.
*/
-#define ERR_FAIL_INDEX_MSG(m_index, m_size, m_msg) \
- if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
- _err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), DEBUG_STR(m_msg)); \
- return; \
- } else \
+#define ERR_FAIL_INDEX_MSG(m_index, m_size, m_msg) \
+ if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
+ _err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), m_msg); \
+ return; \
+ } else \
((void)0)
/**
@@ -160,11 +153,11 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li
* Ensures an integer index `m_index` is less than `m_size` and greater than or equal to 0.
* If not, prints `m_msg` and the current function returns `m_retval`.
*/
-#define ERR_FAIL_INDEX_V_MSG(m_index, m_size, m_retval, m_msg) \
- if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
- _err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), DEBUG_STR(m_msg)); \
- return m_retval; \
- } else \
+#define ERR_FAIL_INDEX_V_MSG(m_index, m_size, m_retval, m_msg) \
+ if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
+ _err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), m_msg); \
+ return m_retval; \
+ } else \
((void)0)
/**
@@ -189,11 +182,11 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li
* Ensures an integer index `m_index` is less than `m_size` and greater than or equal to 0.
* If not, prints `m_msg` and the application crashes.
*/
-#define CRASH_BAD_INDEX_MSG(m_index, m_size, m_msg) \
- if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
- _err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), DEBUG_STR(m_msg), true); \
- GENERATE_TRAP(); \
- } else \
+#define CRASH_BAD_INDEX_MSG(m_index, m_size, m_msg) \
+ if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
+ _err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), m_msg, true); \
+ GENERATE_TRAP(); \
+ } else \
((void)0)
// Unsigned integer index out of bounds error macros.
@@ -216,11 +209,11 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li
* Ensures an unsigned integer index `m_index` is less than `m_size`.
* If not, prints `m_msg` and the current function returns.
*/
-#define ERR_FAIL_UNSIGNED_INDEX_MSG(m_index, m_size, m_msg) \
- if (unlikely((m_index) >= (m_size))) { \
- _err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), DEBUG_STR(m_msg)); \
- return; \
- } else \
+#define ERR_FAIL_UNSIGNED_INDEX_MSG(m_index, m_size, m_msg) \
+ if (unlikely((m_index) >= (m_size))) { \
+ _err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), m_msg); \
+ return; \
+ } else \
((void)0)
/**
@@ -241,11 +234,11 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li
* Ensures an unsigned integer index `m_index` is less than `m_size`.
* If not, prints `m_msg` and the current function returns `m_retval`.
*/
-#define ERR_FAIL_UNSIGNED_INDEX_V_MSG(m_index, m_size, m_retval, m_msg) \
- if (unlikely((m_index) >= (m_size))) { \
- _err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), DEBUG_STR(m_msg)); \
- return m_retval; \
- } else \
+#define ERR_FAIL_UNSIGNED_INDEX_V_MSG(m_index, m_size, m_retval, m_msg) \
+ if (unlikely((m_index) >= (m_size))) { \
+ _err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), m_msg); \
+ return m_retval; \
+ } else \
((void)0)
/**
@@ -270,11 +263,11 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li
* Ensures an unsigned integer index `m_index` is less than `m_size`.
* If not, prints `m_msg` and the application crashes.
*/
-#define CRASH_BAD_UNSIGNED_INDEX_MSG(m_index, m_size, m_msg) \
- if (unlikely((m_index) >= (m_size))) { \
- _err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), DEBUG_STR(m_msg), true); \
- GENERATE_TRAP(); \
- } else \
+#define CRASH_BAD_UNSIGNED_INDEX_MSG(m_index, m_size, m_msg) \
+ if (unlikely((m_index) >= (m_size))) { \
+ _err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), m_msg, true); \
+ GENERATE_TRAP(); \
+ } else \
((void)0)
// Null reference error macros.
@@ -297,11 +290,11 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li
* Ensures a pointer `m_param` is not null.
* If it is null, prints `m_msg` and the current function returns.
*/
-#define ERR_FAIL_NULL_MSG(m_param, m_msg) \
- if (unlikely(m_param == nullptr)) { \
- _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Parameter \"" _STR(m_param) "\" is null.", DEBUG_STR(m_msg)); \
- return; \
- } else \
+#define ERR_FAIL_NULL_MSG(m_param, m_msg) \
+ if (unlikely(m_param == nullptr)) { \
+ _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Parameter \"" _STR(m_param) "\" is null.", m_msg); \
+ return; \
+ } else \
((void)0)
/**
@@ -322,11 +315,11 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li
* Ensures a pointer `m_param` is not null.
* If it is null, prints `m_msg` and the current function returns `m_retval`.
*/
-#define ERR_FAIL_NULL_V_MSG(m_param, m_retval, m_msg) \
- if (unlikely(m_param == nullptr)) { \
- _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Parameter \"" _STR(m_param) "\" is null.", DEBUG_STR(m_msg)); \
- return m_retval; \
- } else \
+#define ERR_FAIL_NULL_V_MSG(m_param, m_retval, m_msg) \
+ if (unlikely(m_param == nullptr)) { \
+ _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Parameter \"" _STR(m_param) "\" is null.", m_msg); \
+ return m_retval; \
+ } else \
((void)0)
/**
@@ -352,11 +345,11 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li
* If checking for null use ERR_FAIL_NULL_MSG instead.
* If checking index bounds use ERR_FAIL_INDEX_MSG instead.
*/
-#define ERR_FAIL_COND_MSG(m_cond, m_msg) \
- if (unlikely(m_cond)) { \
- _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true.", DEBUG_STR(m_msg)); \
- return; \
- } else \
+#define ERR_FAIL_COND_MSG(m_cond, m_msg) \
+ if (unlikely(m_cond)) { \
+ _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true.", m_msg); \
+ return; \
+ } else \
((void)0)
/**
@@ -382,11 +375,11 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li
* If checking for null use ERR_FAIL_NULL_V_MSG instead.
* If checking index bounds use ERR_FAIL_INDEX_V_MSG instead.
*/
-#define ERR_FAIL_COND_V_MSG(m_cond, m_retval, m_msg) \
- if (unlikely(m_cond)) { \
- _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true. Returning: " _STR(m_retval), DEBUG_STR(m_msg)); \
- return m_retval; \
- } else \
+#define ERR_FAIL_COND_V_MSG(m_cond, m_retval, m_msg) \
+ if (unlikely(m_cond)) { \
+ _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true. Returning: " _STR(m_retval), m_msg); \
+ return m_retval; \
+ } else \
((void)0)
/**
@@ -407,11 +400,11 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li
* Ensures `m_cond` is false.
* If `m_cond` is true, prints `m_msg` and the current loop continues.
*/
-#define ERR_CONTINUE_MSG(m_cond, m_msg) \
- if (unlikely(m_cond)) { \
- _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true. Continuing.", DEBUG_STR(m_msg)); \
- continue; \
- } else \
+#define ERR_CONTINUE_MSG(m_cond, m_msg) \
+ if (unlikely(m_cond)) { \
+ _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true. Continuing.", m_msg); \
+ continue; \
+ } else \
((void)0)
/**
@@ -432,11 +425,11 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li
* Ensures `m_cond` is false.
* If `m_cond` is true, prints `m_msg` and the current loop breaks.
*/
-#define ERR_BREAK_MSG(m_cond, m_msg) \
- if (unlikely(m_cond)) { \
- _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true. Breaking.", DEBUG_STR(m_msg)); \
- break; \
- } else \
+#define ERR_BREAK_MSG(m_cond, m_msg) \
+ if (unlikely(m_cond)) { \
+ _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true. Breaking.", m_msg); \
+ break; \
+ } else \
((void)0)
/**
@@ -461,11 +454,11 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li
* Ensures `m_cond` is false.
* If `m_cond` is true, prints `m_msg` and the application crashes.
*/
-#define CRASH_COND_MSG(m_cond, m_msg) \
- if (unlikely(m_cond)) { \
- _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "FATAL: Condition \"" _STR(m_cond) "\" is true.", DEBUG_STR(m_msg)); \
- GENERATE_TRAP(); \
- } else \
+#define CRASH_COND_MSG(m_cond, m_msg) \
+ if (unlikely(m_cond)) { \
+ _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "FATAL: Condition \"" _STR(m_cond) "\" is true.", m_msg); \
+ GENERATE_TRAP(); \
+ } else \
((void)0)
// Generic error macros.
@@ -490,11 +483,11 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li
*
* Prints `m_msg`, and the current function returns.
*/
-#define ERR_FAIL_MSG(m_msg) \
- if (true) { \
- _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Method/function failed.", DEBUG_STR(m_msg)); \
- return; \
- } else \
+#define ERR_FAIL_MSG(m_msg) \
+ if (true) { \
+ _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Method/function failed.", m_msg); \
+ return; \
+ } else \
((void)0)
/**
@@ -517,11 +510,11 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li
*
* Prints `m_msg`, and the current function returns `m_retval`.
*/
-#define ERR_FAIL_V_MSG(m_retval, m_msg) \
- if (true) { \
- _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Method/function failed. Returning: " _STR(m_retval), DEBUG_STR(m_msg)); \
- return m_retval; \
- } else \
+#define ERR_FAIL_V_MSG(m_retval, m_msg) \
+ if (true) { \
+ _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Method/function failed. Returning: " _STR(m_retval), m_msg); \
+ return m_retval; \
+ } else \
((void)0)
/**
@@ -590,14 +583,14 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li
/**
* Warns that the current function is deprecated and prints `m_msg`.
*/
-#define WARN_DEPRECATED_MSG(m_msg) \
- if (true) { \
- static SafeFlag warning_shown; \
- if (!warning_shown.is_set()) { \
- _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "This method has been deprecated and will be removed in the future.", DEBUG_STR(m_msg), ERR_HANDLER_WARNING); \
- warning_shown.set(); \
- } \
- } else \
+#define WARN_DEPRECATED_MSG(m_msg) \
+ if (true) { \
+ static SafeFlag warning_shown; \
+ if (!warning_shown.is_set()) { \
+ _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "This method has been deprecated and will be removed in the future.", m_msg, ERR_HANDLER_WARNING); \
+ warning_shown.set(); \
+ } \
+ } else \
((void)0)
/**
@@ -618,11 +611,11 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li
*
* Prints `m_msg`, and then the application crashes.
*/
-#define CRASH_NOW_MSG(m_msg) \
- if (true) { \
- _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "FATAL: Method/function failed.", DEBUG_STR(m_msg)); \
- GENERATE_TRAP(); \
- } else \
+#define CRASH_NOW_MSG(m_msg) \
+ if (true) { \
+ _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "FATAL: Method/function failed.", m_msg); \
+ GENERATE_TRAP(); \
+ } else \
((void)0)
#endif // ERROR_MACROS_H
diff --git a/core/string/translation.cpp b/core/string/translation.cpp
index 37dc8915ab..cf61467d08 100644
--- a/core/string/translation.cpp
+++ b/core/string/translation.cpp
@@ -809,9 +809,12 @@ static const char *locale_names[] = {
// - https://msdn.microsoft.com/en-us/library/windows/desktop/ms693062(v=vs.85).aspx
static const char *locale_renames[][2] = {
- { "in", "id" }, // Indonesian
- { "iw", "he" }, // Hebrew
- { "no", "nb" }, // Norwegian Bokmål
+ { "in", "id" }, // Indonesian
+ { "iw", "he" }, // Hebrew
+ { "no", "nb" }, // Norwegian Bokmål
+ { "C", "en" }, // "C" is the simple/default/untranslated Computer locale.
+ // ASCII-only, English, no currency symbols. Godot treats this as "en".
+ // See https://unix.stackexchange.com/a/87763/164141 "The C locale is"...
{ nullptr, nullptr }
};
diff --git a/doc/classes/PhysicsTestMotionParameters2D.xml b/doc/classes/PhysicsTestMotionParameters2D.xml
index 7cea848039..46c1827b97 100644
--- a/doc/classes/PhysicsTestMotionParameters2D.xml
+++ b/doc/classes/PhysicsTestMotionParameters2D.xml
@@ -16,6 +16,9 @@
<member name="exclude_bodies" type="Array" setter="set_exclude_bodies" getter="get_exclude_bodies" default="[]">
Optional array of body [RID] to exclude from collision.
</member>
+ <member name="exclude_objects" type="Array" setter="set_exclude_objects" getter="get_exclude_objects" default="[]">
+ Optional array of object unique instance ID to exclude from collision. See [method Object.get_instance_id].
+ </member>
<member name="from" type="Transform2D" setter="set_from" getter="get_from" default="Transform2D(1, 0, 0, 1, 0, 0)">
Transform in global space where the motion should start. Usually set to [member Node2D.global_transform] for the current body's transform.
</member>
diff --git a/doc/classes/PhysicsTestMotionParameters3D.xml b/doc/classes/PhysicsTestMotionParameters3D.xml
index 07abbb1cb1..d66aee3ae6 100644
--- a/doc/classes/PhysicsTestMotionParameters3D.xml
+++ b/doc/classes/PhysicsTestMotionParameters3D.xml
@@ -16,6 +16,9 @@
<member name="exclude_bodies" type="Array" setter="set_exclude_bodies" getter="get_exclude_bodies" default="[]">
Optional array of body [RID] to exclude from collision.
</member>
+ <member name="exclude_objects" type="Array" setter="set_exclude_objects" getter="get_exclude_objects" default="[]">
+ Optional array of object unique instance ID to exclude from collision. See [method Object.get_instance_id].
+ </member>
<member name="from" type="Transform3D" setter="set_from" getter="get_from" default="Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)">
Transform in global space where the motion should start. Usually set to [member Node3D.global_transform] for the current body's transform.
</member>
diff --git a/drivers/unix/ip_unix.cpp b/drivers/unix/ip_unix.cpp
index 8a880ab9c8..d32592e81a 100644
--- a/drivers/unix/ip_unix.cpp
+++ b/drivers/unix/ip_unix.cpp
@@ -36,9 +36,9 @@
#ifdef WINDOWS_ENABLED
#include <stdio.h>
-#include <winsock2.h>
-// Needs to be included after winsocks2.h
+#define WIN32_LEAN_AND_MEAN
#include <windows.h>
+#include <winsock2.h>
#include <ws2tcpip.h>
#ifndef UWP_ENABLED
#include <iphlpapi.h>
diff --git a/drivers/wasapi/audio_driver_wasapi.h b/drivers/wasapi/audio_driver_wasapi.h
index 312b6a6781..a19cd3da09 100644
--- a/drivers/wasapi/audio_driver_wasapi.h
+++ b/drivers/wasapi/audio_driver_wasapi.h
@@ -39,6 +39,7 @@
#include <audioclient.h>
#include <mmdeviceapi.h>
+#define WIN32_LEAN_AND_MEAN
#include <windows.h>
class AudioDriverWASAPI : public AudioDriver {
diff --git a/drivers/windows/dir_access_windows.cpp b/drivers/windows/dir_access_windows.cpp
index ae781e9424..3e98e36d14 100644
--- a/drivers/windows/dir_access_windows.cpp
+++ b/drivers/windows/dir_access_windows.cpp
@@ -37,6 +37,7 @@
#include <stdio.h>
#include <wchar.h>
+#define WIN32_LEAN_AND_MEAN
#include <windows.h>
/*
diff --git a/drivers/windows/file_access_windows.cpp b/drivers/windows/file_access_windows.cpp
index 775c999b15..035c44a28c 100644
--- a/drivers/windows/file_access_windows.cpp
+++ b/drivers/windows/file_access_windows.cpp
@@ -37,6 +37,7 @@
#include <share.h> // _SH_DENYNO
#include <shlwapi.h>
+#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <errno.h>
diff --git a/drivers/winmidi/midi_driver_winmidi.h b/drivers/winmidi/midi_driver_winmidi.h
index bb9a87d610..2f691489b3 100644
--- a/drivers/winmidi/midi_driver_winmidi.h
+++ b/drivers/winmidi/midi_driver_winmidi.h
@@ -37,6 +37,7 @@
#include "core/templates/vector.h"
#include <stdio.h>
+#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <mmsystem.h>
diff --git a/drivers/xaudio2/audio_driver_xaudio2.h b/drivers/xaudio2/audio_driver_xaudio2.h
index d3938a19d0..c1910d3f5d 100644
--- a/drivers/xaudio2/audio_driver_xaudio2.h
+++ b/drivers/xaudio2/audio_driver_xaudio2.h
@@ -36,6 +36,7 @@
#include "servers/audio_server.h"
#include <mmsystem.h>
+#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <wrl/client.h>
#include <xaudio2.h>
diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp
index ac031baa8c..c07849bfa8 100644
--- a/modules/gdscript/gdscript_analyzer.cpp
+++ b/modules/gdscript/gdscript_analyzer.cpp
@@ -3305,7 +3305,13 @@ GDScriptParser::DataType GDScriptAnalyzer::type_from_variant(const Variant &p_va
current = current->_owner;
}
- Ref<GDScriptParserRef> ref = get_parser_for(current->path);
+ Ref<GDScriptParserRef> ref = get_parser_for(current->get_path());
+ if (ref.is_null()) {
+ push_error("Could not find script in path.", p_source);
+ GDScriptParser::DataType error_type;
+ error_type.kind = GDScriptParser::DataType::VARIANT;
+ return error_type;
+ }
ref->raise_status(GDScriptParserRef::INTERFACE_SOLVED);
GDScriptParser::ClassNode *found = ref->get_parser()->head;
diff --git a/modules/mono/utils/mono_reg_utils.cpp b/modules/mono/utils/mono_reg_utils.cpp
index 6b616dd52d..d0a27b27c1 100644
--- a/modules/mono/utils/mono_reg_utils.cpp
+++ b/modules/mono/utils/mono_reg_utils.cpp
@@ -35,7 +35,7 @@
#include "core/os/os.h"
-// Here, after os/os.h
+#define WIN32_LEAN_AND_MEAN
#include <windows.h>
namespace MonoRegUtils {
diff --git a/modules/mono/utils/path_utils.cpp b/modules/mono/utils/path_utils.cpp
index ec04d50704..64aec5d359 100644
--- a/modules/mono/utils/path_utils.cpp
+++ b/modules/mono/utils/path_utils.cpp
@@ -36,6 +36,7 @@
#include "core/os/os.h"
#ifdef WINDOWS_ENABLED
+#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#define ENV_PATH_SEP ";"
diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp
index 6ac5b55156..daf3c14f3b 100644
--- a/platform/uwp/os_uwp.cpp
+++ b/platform/uwp/os_uwp.cpp
@@ -28,14 +28,12 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-// Must include Winsock before windows.h (included by os_uwp.h)
-#include "drivers/unix/net_socket_posix.h"
-
#include "os_uwp.h"
#include "core/config/project_settings.h"
#include "core/io/marshalls.h"
#include "drivers/unix/ip_unix.h"
+#include "drivers/unix/net_socket_posix.h"
#include "drivers/windows/dir_access_windows.h"
#include "drivers/windows/file_access_windows.h"
#include "drivers/windows/mutex_windows.h"
diff --git a/platform/uwp/os_uwp.h b/platform/uwp/os_uwp.h
index c9b2600c8e..7945f409a1 100644
--- a/platform/uwp/os_uwp.h
+++ b/platform/uwp/os_uwp.h
@@ -45,6 +45,7 @@
#include <fcntl.h>
#include <io.h>
#include <stdio.h>
+#define WIN32_LEAN_AND_MEAN
#include <windows.h>
class OS_UWP : public OS {
diff --git a/platform/windows/context_gl_windows.h b/platform/windows/context_gl_windows.h
index c8e8a0891d..feff1d825b 100644
--- a/platform/windows/context_gl_windows.h
+++ b/platform/windows/context_gl_windows.h
@@ -38,6 +38,7 @@
#include "core/error/error_list.h"
#include "core/os/os.h"
+#define WIN32_LEAN_AND_MEAN
#include <windows.h>
typedef bool(APIENTRY *PFNWGLSWAPINTERVALEXTPROC)(int interval);
diff --git a/platform/windows/crash_handler_windows.h b/platform/windows/crash_handler_windows.h
index e1ec8e6787..5cdc6d3e05 100644
--- a/platform/windows/crash_handler_windows.h
+++ b/platform/windows/crash_handler_windows.h
@@ -31,6 +31,7 @@
#ifndef CRASH_HANDLER_WINDOWS_H
#define CRASH_HANDLER_WINDOWS_H
+#define WIN32_LEAN_AND_MEAN
#include <windows.h>
// Crash handler exception only enabled with MSVC
diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp
index 3100c0bd27..8a946d8136 100644
--- a/platform/windows/display_server_windows.cpp
+++ b/platform/windows/display_server_windows.cpp
@@ -38,7 +38,6 @@
#include <avrt.h>
-#ifdef DEBUG_ENABLED
static String format_error_message(DWORD id) {
LPWSTR messageBuffer = nullptr;
size_t size = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
@@ -50,7 +49,6 @@ static String format_error_message(DWORD id) {
return msg;
}
-#endif // DEBUG_ENABLED
bool DisplayServerWindows::has_feature(Feature p_feature) const {
switch (p_feature) {
diff --git a/platform/windows/display_server_windows.h b/platform/windows/display_server_windows.h
index 8b82288a40..6a90b28579 100644
--- a/platform/windows/display_server_windows.h
+++ b/platform/windows/display_server_windows.h
@@ -63,6 +63,7 @@
#include <fcntl.h>
#include <io.h>
#include <stdio.h>
+#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <windowsx.h>
diff --git a/platform/windows/key_mapping_windows.h b/platform/windows/key_mapping_windows.h
index f260666a3e..d056e88f06 100644
--- a/platform/windows/key_mapping_windows.h
+++ b/platform/windows/key_mapping_windows.h
@@ -33,8 +33,8 @@
#include "core/os/keyboard.h"
+#define WIN32_LEAN_AND_MEAN
#include <windows.h>
-
#include <winuser.h>
class KeyMappingWindows {
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 78b7be8a30..c03b600f2e 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -28,15 +28,13 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-// Must include Winsock before windows.h (included by os_windows.h)
-#include "drivers/unix/net_socket_posix.h"
-
#include "os_windows.h"
#include "core/debugger/engine_debugger.h"
#include "core/debugger/script_debugger.h"
#include "core/io/marshalls.h"
#include "core/version_generated.gen.h"
+#include "drivers/unix/net_socket_posix.h"
#include "drivers/windows/dir_access_windows.h"
#include "drivers/windows/file_access_windows.h"
#include "joypad_windows.h"
@@ -75,7 +73,6 @@ __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
#define GetProcAddress (void *)GetProcAddress
#endif
-#ifdef DEBUG_ENABLED
static String format_error_message(DWORD id) {
LPWSTR messageBuffer = nullptr;
size_t size = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
@@ -87,7 +84,6 @@ static String format_error_message(DWORD id) {
return msg;
}
-#endif // DEBUG_ENABLED
void RedirectIOToConsole() {
int hConHandle;
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index c4a2eda8f4..d24afa91eb 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -57,7 +57,9 @@
#include <fcntl.h>
#include <io.h>
+#include <shellapi.h>
#include <stdio.h>
+#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <windowsx.h>
diff --git a/platform/windows/vulkan_context_win.h b/platform/windows/vulkan_context_win.h
index 39dd2641fd..61e66b8ae0 100644
--- a/platform/windows/vulkan_context_win.h
+++ b/platform/windows/vulkan_context_win.h
@@ -32,6 +32,8 @@
#define VULKAN_DEVICE_WIN_H
#include "drivers/vulkan/vulkan_context.h"
+
+#define WIN32_LEAN_AND_MEAN
#include <windows.h>
class VulkanContextWindows : public VulkanContext {
diff --git a/platform/windows/windows_terminal_logger.cpp b/platform/windows/windows_terminal_logger.cpp
index 8cab7ca521..e54a61fdfd 100644
--- a/platform/windows/windows_terminal_logger.cpp
+++ b/platform/windows/windows_terminal_logger.cpp
@@ -33,6 +33,7 @@
#ifdef WINDOWS_ENABLED
#include <stdio.h>
+#define WIN32_LEAN_AND_MEAN
#include <windows.h>
void WindowsTerminalLogger::logv(const char *p_format, va_list p_list, bool p_err) {
diff --git a/scene/2d/animated_sprite_2d.cpp b/scene/2d/animated_sprite_2d.cpp
index 96a3134691..fad4784d51 100644
--- a/scene/2d/animated_sprite_2d.cpp
+++ b/scene/2d/animated_sprite_2d.cpp
@@ -94,7 +94,7 @@ Rect2 AnimatedSprite2D::_get_rect() const {
Point2 ofs = offset;
if (centered) {
- ofs -= Size2(s) / 2;
+ ofs -= s / 2;
}
if (s == Size2(0, 0)) {
@@ -228,8 +228,7 @@ void AnimatedSprite2D::_notification(int p_what) {
RID ci = get_canvas_item();
- Size2i s;
- s = texture->get_size();
+ Size2 s = texture->get_size();
Point2 ofs = offset;
if (centered) {
ofs -= s / 2;
diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp
index 9a10255acc..f493d97ceb 100644
--- a/scene/2d/physics_body_2d.cpp
+++ b/scene/2d/physics_body_2d.cpp
@@ -1089,6 +1089,9 @@ bool CharacterBody2D::move_and_slide() {
if (!current_platform_velocity.is_equal_approx(Vector2())) {
PhysicsServer2D::MotionParameters parameters(get_global_transform(), current_platform_velocity * delta, margin);
parameters.exclude_bodies.insert(platform_rid);
+ if (platform_object_id.is_valid()) {
+ parameters.exclude_objects.insert(platform_object_id);
+ }
PhysicsServer2D::MotionResult floor_result;
if (move_and_collide(parameters, floor_result, false, false)) {
@@ -1125,9 +1128,11 @@ void CharacterBody2D::_move_and_slide_grounded(double p_delta, bool p_was_on_flo
Vector2 prev_floor_normal = floor_normal;
RID prev_platform_rid = platform_rid;
+ ObjectID prev_platform_object_id = platform_object_id;
int prev_platform_layer = platform_layer;
platform_rid = RID();
+ platform_object_id = ObjectID();
floor_normal = Vector2();
platform_velocity = Vector2();
@@ -1199,6 +1204,7 @@ void CharacterBody2D::_move_and_slide_grounded(double p_delta, bool p_was_on_flo
}
on_floor = true;
platform_rid = prev_platform_rid;
+ platform_object_id = prev_platform_object_id;
platform_layer = prev_platform_layer;
platform_velocity = p_prev_platform_velocity;
floor_normal = prev_floor_normal;
@@ -1285,6 +1291,7 @@ void CharacterBody2D::_move_and_slide_free(double p_delta) {
Vector2 motion = motion_velocity * p_delta;
platform_rid = RID();
+ platform_object_id = ObjectID();
floor_normal = Vector2();
platform_velocity = Vector2();
@@ -1402,6 +1409,7 @@ void CharacterBody2D::_set_collision_direction(const PhysicsServer2D::MotionResu
void CharacterBody2D::_set_platform_data(const PhysicsServer2D::MotionResult &p_result) {
platform_rid = p_result.collider;
+ platform_object_id = p_result.collider_id;
platform_velocity = p_result.collider_velocity;
platform_layer = PhysicsServer2D::get_singleton()->body_get_collision_layer(platform_rid);
}
@@ -1620,6 +1628,7 @@ void CharacterBody2D::_notification(int p_what) {
// Reset move_and_slide() data.
on_floor = false;
platform_rid = RID();
+ platform_object_id = ObjectID();
on_ceiling = false;
on_wall = false;
motion_results.clear();
diff --git a/scene/2d/physics_body_2d.h b/scene/2d/physics_body_2d.h
index fd8bb66158..d1f52b33f2 100644
--- a/scene/2d/physics_body_2d.h
+++ b/scene/2d/physics_body_2d.h
@@ -368,6 +368,7 @@ private:
Vector2 real_velocity;
RID platform_rid;
+ ObjectID platform_object_id;
bool on_floor = false;
bool on_ceiling = false;
bool on_wall = false;
diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp
index b7c808398c..976bff4fbc 100644
--- a/scene/3d/physics_body_3d.cpp
+++ b/scene/3d/physics_body_3d.cpp
@@ -1131,6 +1131,9 @@ bool CharacterBody3D::move_and_slide() {
if (!current_platform_velocity.is_equal_approx(Vector3())) {
PhysicsServer3D::MotionParameters parameters(get_global_transform(), current_platform_velocity * delta, margin);
parameters.exclude_bodies.insert(platform_rid);
+ if (platform_object_id.is_valid()) {
+ parameters.exclude_objects.insert(platform_object_id);
+ }
PhysicsServer3D::MotionResult floor_result;
if (move_and_collide(parameters, floor_result, false, false)) {
@@ -1169,6 +1172,7 @@ void CharacterBody3D::_move_and_slide_grounded(double p_delta, bool p_was_on_flo
Vector3 prev_floor_normal = floor_normal;
platform_rid = RID();
+ platform_object_id = ObjectID();
platform_velocity = Vector3();
platform_ceiling_velocity = Vector3();
floor_normal = Vector3();
@@ -1416,6 +1420,7 @@ void CharacterBody3D::_move_and_slide_free(double p_delta) {
Vector3 motion = motion_velocity * p_delta;
platform_rid = RID();
+ platform_object_id = ObjectID();
floor_normal = Vector3();
platform_velocity = Vector3();
@@ -1611,6 +1616,7 @@ void CharacterBody3D::_set_collision_direction(const PhysicsServer3D::MotionResu
void CharacterBody3D::_set_platform_data(const PhysicsServer3D::MotionCollision &p_collision) {
platform_rid = p_collision.collider;
+ platform_object_id = p_collision.collider_id;
platform_velocity = p_collision.collider_velocity;
platform_layer = PhysicsServer3D::get_singleton()->body_get_collision_layer(platform_rid);
}
@@ -1833,6 +1839,7 @@ void CharacterBody3D::_notification(int p_what) {
// Reset move_and_slide() data.
collision_state.state = 0;
platform_rid = RID();
+ platform_object_id = ObjectID();
motion_results.clear();
platform_velocity = Vector3();
} break;
diff --git a/scene/3d/physics_body_3d.h b/scene/3d/physics_body_3d.h
index d2754e7726..5677df730c 100644
--- a/scene/3d/physics_body_3d.h
+++ b/scene/3d/physics_body_3d.h
@@ -383,6 +383,7 @@ private:
int max_slides = 6;
int platform_layer = 0;
RID platform_rid;
+ ObjectID platform_object_id;
uint32_t moving_platform_floor_layers = UINT32_MAX;
uint32_t moving_platform_wall_layers = 0;
real_t floor_snap_length = 0.1;
diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp
index b9a2736918..349a534680 100644
--- a/scene/3d/sprite_3d.cpp
+++ b/scene/3d/sprite_3d.cpp
@@ -712,7 +712,7 @@ Rect2 Sprite3D::get_item_rect() const {
return CanvasItem::get_item_rect();
*/
- Size2i s;
+ Size2 s;
if (region) {
s = region_rect.size;
@@ -807,22 +807,20 @@ void AnimatedSprite3D::_draw() {
set_base(RID());
return; //no texuture no life
}
- Vector2 tsize = texture->get_size();
+ Size2 tsize = texture->get_size();
if (tsize.x == 0 || tsize.y == 0) {
return;
}
- Size2i s = tsize;
Rect2 src_rect;
-
- src_rect.size = s;
+ src_rect.size = tsize;
Point2 ofs = get_offset();
if (is_centered()) {
- ofs -= s / 2;
+ ofs -= tsize / 2;
}
- Rect2 dst_rect(ofs, s);
+ Rect2 dst_rect(ofs, tsize);
Rect2 final_rect;
Rect2 final_src_rect;
@@ -1133,7 +1131,7 @@ Rect2 AnimatedSprite3D::get_item_rect() const {
if (t.is_null()) {
return Rect2(0, 0, 1, 1);
}
- Size2i s = t->get_size();
+ Size2 s = t->get_size();
Point2 ofs = get_offset();
if (centered) {
diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp
index 5e25d7f7c4..dd0780b5ff 100644
--- a/servers/physics_2d/space_2d_sw.cpp
+++ b/servers/physics_2d/space_2d_sw.cpp
@@ -615,6 +615,9 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const PhysicsServer2D::Motion
if (p_parameters.exclude_bodies.has(col_obj->get_self())) {
continue;
}
+ if (p_parameters.exclude_objects.has(col_obj->get_instance_id())) {
+ continue;
+ }
int shape_idx = intersection_query_subindex_results[i];
@@ -747,6 +750,9 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const PhysicsServer2D::Motion
if (p_parameters.exclude_bodies.has(col_obj->get_self())) {
continue;
}
+ if (p_parameters.exclude_objects.has(col_obj->get_instance_id())) {
+ continue;
+ }
int col_shape_idx = intersection_query_subindex_results[i];
Shape2DSW *against_shape = col_obj->get_shape(col_shape_idx);
@@ -896,6 +902,9 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const PhysicsServer2D::Motion
if (p_parameters.exclude_bodies.has(col_obj->get_self())) {
continue;
}
+ if (p_parameters.exclude_objects.has(col_obj->get_instance_id())) {
+ continue;
+ }
int shape_idx = intersection_query_subindex_results[i];
diff --git a/servers/physics_3d/space_3d_sw.cpp b/servers/physics_3d/space_3d_sw.cpp
index f5f497e167..c88747c017 100644
--- a/servers/physics_3d/space_3d_sw.cpp
+++ b/servers/physics_3d/space_3d_sw.cpp
@@ -704,6 +704,9 @@ bool Space3DSW::test_body_motion(Body3DSW *p_body, const PhysicsServer3D::Motion
if (p_parameters.exclude_bodies.has(col_obj->get_self())) {
continue;
}
+ if (p_parameters.exclude_objects.has(col_obj->get_instance_id())) {
+ continue;
+ }
int shape_idx = intersection_query_subindex_results[i];
@@ -795,6 +798,9 @@ bool Space3DSW::test_body_motion(Body3DSW *p_body, const PhysicsServer3D::Motion
if (p_parameters.exclude_bodies.has(col_obj->get_self())) {
continue;
}
+ if (p_parameters.exclude_objects.has(col_obj->get_instance_id())) {
+ continue;
+ }
int shape_idx = intersection_query_subindex_results[i];
@@ -916,6 +922,10 @@ bool Space3DSW::test_body_motion(Body3DSW *p_body, const PhysicsServer3D::Motion
if (p_parameters.exclude_bodies.has(col_obj->get_self())) {
continue;
}
+ if (p_parameters.exclude_objects.has(col_obj->get_instance_id())) {
+ continue;
+ }
+
int shape_idx = intersection_query_subindex_results[i];
rcd.object = col_obj;
diff --git a/servers/physics_server_2d.cpp b/servers/physics_server_2d.cpp
index ad53f9ed20..fe2970912a 100644
--- a/servers/physics_server_2d.cpp
+++ b/servers/physics_server_2d.cpp
@@ -430,6 +430,26 @@ void PhysicsTestMotionParameters2D::set_exclude_bodies(const Vector<RID> &p_excl
}
}
+Array PhysicsTestMotionParameters2D::get_exclude_objects() const {
+ Array exclude;
+ exclude.resize(parameters.exclude_objects.size());
+
+ int object_index = 0;
+ for (ObjectID object_id : parameters.exclude_objects) {
+ exclude[object_index++] = object_id;
+ }
+
+ return exclude;
+}
+
+void PhysicsTestMotionParameters2D::set_exclude_objects(const Array &p_exclude) {
+ for (int i = 0; i < p_exclude.size(); ++i) {
+ ObjectID object_id = p_exclude[i];
+ ERR_CONTINUE(object_id.is_null());
+ parameters.exclude_objects.insert(object_id);
+ }
+}
+
void PhysicsTestMotionParameters2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_from"), &PhysicsTestMotionParameters2D::get_from);
ClassDB::bind_method(D_METHOD("set_from"), &PhysicsTestMotionParameters2D::set_from);
@@ -446,11 +466,15 @@ void PhysicsTestMotionParameters2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_exclude_bodies"), &PhysicsTestMotionParameters2D::get_exclude_bodies);
ClassDB::bind_method(D_METHOD("set_exclude_bodies"), &PhysicsTestMotionParameters2D::set_exclude_bodies);
+ ClassDB::bind_method(D_METHOD("get_exclude_objects"), &PhysicsTestMotionParameters2D::get_exclude_objects);
+ ClassDB::bind_method(D_METHOD("set_exclude_objects"), &PhysicsTestMotionParameters2D::set_exclude_objects);
+
ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM2D, "from"), "set_from", "get_from");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "motion"), "set_motion", "get_motion");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "margin"), "set_margin", "get_margin");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "collide_separation_ray"), "set_collide_separation_ray_enabled", "is_collide_separation_ray_enabled");
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "exclude_bodies"), "set_exclude_bodies", "get_exclude_bodies");
+ ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "exclude_objects"), "set_exclude_objects", "get_exclude_objects");
}
///////////////////////////////
diff --git a/servers/physics_server_2d.h b/servers/physics_server_2d.h
index 1028be05b7..26e1411111 100644
--- a/servers/physics_server_2d.h
+++ b/servers/physics_server_2d.h
@@ -472,6 +472,7 @@ public:
real_t margin = 0.08;
bool collide_separation_ray = false;
Set<RID> exclude_bodies;
+ Set<ObjectID> exclude_objects;
MotionParameters() {}
@@ -609,6 +610,9 @@ public:
Vector<RID> get_exclude_bodies() const;
void set_exclude_bodies(const Vector<RID> &p_exclude);
+
+ Array get_exclude_objects() const;
+ void set_exclude_objects(const Array &p_exclude);
};
class PhysicsTestMotionResult2D : public RefCounted {
diff --git a/servers/physics_server_3d.cpp b/servers/physics_server_3d.cpp
index 1b47eba134..d66a8bfe0d 100644
--- a/servers/physics_server_3d.cpp
+++ b/servers/physics_server_3d.cpp
@@ -380,6 +380,26 @@ void PhysicsTestMotionParameters3D::set_exclude_bodies(const Vector<RID> &p_excl
}
}
+Array PhysicsTestMotionParameters3D::get_exclude_objects() const {
+ Array exclude;
+ exclude.resize(parameters.exclude_objects.size());
+
+ int object_index = 0;
+ for (ObjectID object_id : parameters.exclude_objects) {
+ exclude[object_index++] = object_id;
+ }
+
+ return exclude;
+}
+
+void PhysicsTestMotionParameters3D::set_exclude_objects(const Array &p_exclude) {
+ for (int i = 0; i < p_exclude.size(); ++i) {
+ ObjectID object_id = p_exclude[i];
+ ERR_CONTINUE(object_id.is_null());
+ parameters.exclude_objects.insert(object_id);
+ }
+}
+
void PhysicsTestMotionParameters3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_from"), &PhysicsTestMotionParameters3D::get_from);
ClassDB::bind_method(D_METHOD("set_from"), &PhysicsTestMotionParameters3D::set_from);
@@ -399,12 +419,16 @@ void PhysicsTestMotionParameters3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_exclude_bodies"), &PhysicsTestMotionParameters3D::get_exclude_bodies);
ClassDB::bind_method(D_METHOD("set_exclude_bodies"), &PhysicsTestMotionParameters3D::set_exclude_bodies);
+ ClassDB::bind_method(D_METHOD("get_exclude_objects"), &PhysicsTestMotionParameters3D::get_exclude_objects);
+ ClassDB::bind_method(D_METHOD("set_exclude_objects"), &PhysicsTestMotionParameters3D::set_exclude_objects);
+
ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM3D, "from"), "set_from", "get_from");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "motion"), "set_motion", "get_motion");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "margin"), "set_margin", "get_margin");
ADD_PROPERTY(PropertyInfo(Variant::INT, "max_collisions"), "set_max_collisions", "get_max_collisions");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "collide_separation_ray"), "set_collide_separation_ray_enabled", "is_collide_separation_ray_enabled");
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "exclude_bodies"), "set_exclude_bodies", "get_exclude_bodies");
+ ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "exclude_objects"), "set_exclude_objects", "get_exclude_objects");
}
///////////////////////////////
diff --git a/servers/physics_server_3d.h b/servers/physics_server_3d.h
index 3d884de095..c609afc11e 100644
--- a/servers/physics_server_3d.h
+++ b/servers/physics_server_3d.h
@@ -491,6 +491,7 @@ public:
int max_collisions = 1;
bool collide_separation_ray = false;
Set<RID> exclude_bodies;
+ Set<ObjectID> exclude_objects;
MotionParameters() {}
@@ -805,6 +806,9 @@ public:
Vector<RID> get_exclude_bodies() const;
void set_exclude_bodies(const Vector<RID> &p_exclude);
+
+ Array get_exclude_objects() const;
+ void set_exclude_objects(const Array &p_exclude);
};
class PhysicsTestMotionResult3D : public RefCounted {