summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/linux_builds.yml2
-rw-r--r--.github/workflows/macos_builds.yml2
-rw-r--r--.github/workflows/windows_builds.yml2
-rw-r--r--README.md2
-rw-r--r--SConstruct21
-rw-r--r--core/bind/core_bind.cpp1
-rw-r--r--core/global_constants.cpp32
-rw-r--r--core/global_constants.h1
-rw-r--r--core/object.cpp2
-rw-r--r--core/project_settings.cpp19
-rw-r--r--core/project_settings.h10
-rw-r--r--core/ustring.cpp6
-rw-r--r--doc/classes/@GlobalScope.xml2
-rw-r--r--doc/classes/ProjectSettings.xml6
-rw-r--r--editor/doc_data.cpp32
-rw-r--r--editor/doc_data.h1
-rw-r--r--editor/plugins/script_editor_plugin.cpp4
-rw-r--r--main/SCsub3
-rw-r--r--main/main.cpp14
-rw-r--r--modules/gdscript/gdscript_compiler.cpp2
-rw-r--r--scene/register_scene_types.cpp2
-rw-r--r--tests/SCsub (renamed from main/tests/SCsub)0
-rw-r--r--tests/test_astar.cpp (renamed from main/tests/test_astar.cpp)0
-rw-r--r--tests/test_astar.h (renamed from main/tests/test_astar.h)0
-rw-r--r--tests/test_basis.cpp (renamed from main/tests/test_basis.cpp)0
-rw-r--r--tests/test_basis.h (renamed from main/tests/test_basis.h)0
-rw-r--r--tests/test_class_db.cpp (renamed from main/tests/test_class_db.cpp)0
-rw-r--r--tests/test_class_db.h (renamed from main/tests/test_class_db.h)0
-rw-r--r--tests/test_gdscript.cpp (renamed from main/tests/test_gdscript.cpp)0
-rw-r--r--tests/test_gdscript.h (renamed from main/tests/test_gdscript.h)0
-rw-r--r--tests/test_gui.cpp (renamed from main/tests/test_gui.cpp)0
-rw-r--r--tests/test_gui.h (renamed from main/tests/test_gui.h)0
-rw-r--r--tests/test_main.cpp (renamed from main/tests/test_main.cpp)0
-rw-r--r--tests/test_main.h (renamed from main/tests/test_main.h)0
-rw-r--r--tests/test_math.cpp (renamed from main/tests/test_math.cpp)0
-rw-r--r--tests/test_math.h (renamed from main/tests/test_math.h)0
-rw-r--r--tests/test_oa_hash_map.cpp (renamed from main/tests/test_oa_hash_map.cpp)0
-rw-r--r--tests/test_oa_hash_map.h (renamed from main/tests/test_oa_hash_map.h)0
-rw-r--r--tests/test_ordered_hash_map.cpp (renamed from main/tests/test_ordered_hash_map.cpp)0
-rw-r--r--tests/test_ordered_hash_map.h (renamed from main/tests/test_ordered_hash_map.h)0
-rw-r--r--tests/test_physics_2d.cpp (renamed from main/tests/test_physics_2d.cpp)0
-rw-r--r--tests/test_physics_2d.h (renamed from main/tests/test_physics_2d.h)0
-rw-r--r--tests/test_physics_3d.cpp (renamed from main/tests/test_physics_3d.cpp)0
-rw-r--r--tests/test_physics_3d.h (renamed from main/tests/test_physics_3d.h)0
-rw-r--r--tests/test_render.cpp (renamed from main/tests/test_render.cpp)0
-rw-r--r--tests/test_render.h (renamed from main/tests/test_render.h)0
-rw-r--r--tests/test_shader_lang.cpp (renamed from main/tests/test_shader_lang.cpp)0
-rw-r--r--tests/test_shader_lang.h (renamed from main/tests/test_shader_lang.h)0
-rw-r--r--tests/test_string.h (renamed from main/tests/test_string.h)0
-rw-r--r--tests/test_validate_testing.h (renamed from main/tests/test_validate_testing.h)0
50 files changed, 130 insertions, 36 deletions
diff --git a/.github/workflows/linux_builds.yml b/.github/workflows/linux_builds.yml
index be7737593a..a05bb09931 100644
--- a/.github/workflows/linux_builds.yml
+++ b/.github/workflows/linux_builds.yml
@@ -60,7 +60,7 @@ jobs:
env:
SCONS_CACHE: ${{github.workspace}}/.scons_cache/
run: |
- scons -j2 verbose=yes warnings=all werror=yes platform=linuxbsd tools=yes target=release_debug module_mono_enabled=yes mono_glue=no
+ scons -j2 verbose=yes warnings=all werror=yes platform=linuxbsd tools=yes tests=yes target=release_debug module_mono_enabled=yes mono_glue=no
# Execute unit tests for the editor
- name: Unit Tests
diff --git a/.github/workflows/macos_builds.yml b/.github/workflows/macos_builds.yml
index 4a9fa910d0..56a4343bbe 100644
--- a/.github/workflows/macos_builds.yml
+++ b/.github/workflows/macos_builds.yml
@@ -49,7 +49,7 @@ jobs:
env:
SCONS_CACHE: ${{github.workspace}}/.scons_cache/
run: |
- scons -j2 verbose=yes warnings=all werror=yes platform=osx tools=yes target=release_debug
+ scons -j2 verbose=yes warnings=all werror=yes platform=osx tools=yes tests=yes target=release_debug
# Execute unit tests for the editor
- name: Unit Tests
diff --git a/.github/workflows/windows_builds.yml b/.github/workflows/windows_builds.yml
index c58bae8275..2bc3fcfdaa 100644
--- a/.github/workflows/windows_builds.yml
+++ b/.github/workflows/windows_builds.yml
@@ -54,7 +54,7 @@ jobs:
env:
SCONS_CACHE: /.scons_cache/
run: |
- scons -j2 verbose=yes warnings=all werror=yes platform=windows tools=yes target=release_debug
+ scons -j2 verbose=yes warnings=all werror=yes platform=windows tools=yes tests=yes target=release_debug
# Execute unit tests for the editor
- name: Unit Tests
diff --git a/README.md b/README.md
index 5cfa10c5dd..e962f90333 100644
--- a/README.md
+++ b/README.md
@@ -66,9 +66,7 @@ There are also a number of other learning resources provided by the community,
such as text and video tutorials, demos, etc. Consult the [community channels](https://godotengine.org/community)
for more info.
-[![Travis Build Status](https://travis-ci.org/godotengine/godot.svg?branch=master)](https://travis-ci.org/godotengine/godot)
[![Actions Build Status](https://github.com/godotengine/godot/workflows/Godot/badge.svg?branch=master)](https://github.com/godotengine/godot/actions)
-[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/bfiihqq6byxsjxxh/branch/master?svg=true)](https://ci.appveyor.com/project/akien-mga/godot)
[![Code Triagers Badge](https://www.codetriage.com/godotengine/godot/badges/users.svg)](https://www.codetriage.com/godotengine/godot)
[![Translate on Weblate](https://hosted.weblate.org/widgets/godot-engine/-/godot/svg-badge.svg)](https://hosted.weblate.org/engage/godot-engine/?utm_source=widget)
[![Total alerts on LGTM](https://img.shields.io/lgtm/alerts/g/godotengine/godot.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/godotengine/godot/alerts)
diff --git a/SConstruct b/SConstruct
index e23aa1cdbc..98438d2c60 100644
--- a/SConstruct
+++ b/SConstruct
@@ -115,6 +115,7 @@ opts.Add(EnumVariable("target", "Compilation target", "debug", ("debug", "releas
opts.Add(EnumVariable("optimize", "Optimization type", "speed", ("speed", "size")))
opts.Add(BoolVariable("tools", "Build the tools (a.k.a. the Godot editor)", True))
+opts.Add(BoolVariable("tests", "Build the unit tests", False))
opts.Add(BoolVariable("use_lto", "Use link-time optimization", False))
opts.Add(BoolVariable("use_precise_math_checks", "Math checks use very precise epsilon (debug option)", False))
@@ -249,6 +250,10 @@ if env_base["target"] == "debug":
# http://scons.org/doc/production/HTML/scons-user/ch06s04.html
env_base.SetOption("implicit_cache", 1)
+if not env_base["tools"]:
+ # Export templates can't run unit test tool.
+ env_base["tests"] = False
+
if env_base["no_editor_splash"]:
env_base.Append(CPPDEFINES=["NO_EDITOR_SPLASH"])
@@ -312,6 +317,8 @@ if selected_platform in platform_list:
env["verbose"] = True
env["warnings"] = "extra"
env["werror"] = True
+ if env["tools"]:
+ env["tests"] = True
if env["vsproj"]:
env.vs_incs = []
@@ -586,6 +593,8 @@ if selected_platform in platform_list:
env.Append(CPPDEFINES=["PTRCALL_ENABLED"])
if env["tools"]:
env.Append(CPPDEFINES=["TOOLS_ENABLED"])
+ if env["tests"]:
+ env.Append(CPPDEFINES=["TESTS_ENABLED"])
if env["disable_3d"]:
if env["tools"]:
print(
@@ -641,8 +650,9 @@ if selected_platform in platform_list:
}
)
- # enable test framework globally and inform it of configuration method
- env.Append(CPPDEFINES=["DOCTEST_CONFIG_IMPLEMENT"])
+ # Enable test framework globally and inform it of configuration method.
+ if env["tests"]:
+ env.Append(CPPDEFINES=["DOCTEST_CONFIG_IMPLEMENT"])
scons_cache_path = os.environ.get("SCONS_CACHE")
if scons_cache_path != None:
@@ -651,8 +661,7 @@ if selected_platform in platform_list:
Export("env")
- # build subdirs, the build order is dependent on link order.
-
+ # Build subdirs, the build order is dependent on link order.
SConscript("core/SCsub")
SConscript("servers/SCsub")
SConscript("scene/SCsub")
@@ -661,9 +670,11 @@ if selected_platform in platform_list:
SConscript("platform/SCsub")
SConscript("modules/SCsub")
+ if env["tests"]:
+ SConscript("tests/SCsub")
SConscript("main/SCsub")
- SConscript("platform/" + selected_platform + "/SCsub") # build selected platform
+ SConscript("platform/" + selected_platform + "/SCsub") # Build selected platform.
# Microsoft Visual Studio Project Generation
if env["vsproj"]:
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index 2f8b11652b..045d7d5872 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -781,6 +781,7 @@ void _OS::_bind_methods() {
// Those default values need to be specified for the docs generator,
// to avoid using values from the documentation writer's own OS instance.
+ ADD_PROPERTY_DEFAULT("tablet_driver", "");
ADD_PROPERTY_DEFAULT("exit_code", 0);
ADD_PROPERTY_DEFAULT("low_processor_usage_mode", false);
ADD_PROPERTY_DEFAULT("low_processor_usage_mode_sleep_usec", 6900);
diff --git a/core/global_constants.cpp b/core/global_constants.cpp
index 6281e56395..b30685539a 100644
--- a/core/global_constants.cpp
+++ b/core/global_constants.cpp
@@ -38,6 +38,7 @@
struct _GlobalConstant {
#ifdef DEBUG_METHODS_ENABLED
StringName enum_name;
+ bool ignore_value_in_docs;
#endif
const char *name;
int value;
@@ -45,8 +46,9 @@ struct _GlobalConstant {
_GlobalConstant() {}
#ifdef DEBUG_METHODS_ENABLED
- _GlobalConstant(const StringName &p_enum_name, const char *p_name, int p_value) :
+ _GlobalConstant(const StringName &p_enum_name, const char *p_name, int p_value, bool p_ignore_value_in_docs = false) :
enum_name(p_enum_name),
+ ignore_value_in_docs(p_ignore_value_in_docs),
name(p_name),
value(p_value) {
}
@@ -71,6 +73,15 @@ static Vector<_GlobalConstant> _global_constants;
#define BIND_GLOBAL_ENUM_CONSTANT_CUSTOM(m_custom_name, m_constant) \
_global_constants.push_back(_GlobalConstant(__constant_get_enum_name(m_constant, #m_constant), m_custom_name, m_constant));
+#define BIND_GLOBAL_CONSTANT_NO_VAL(m_constant) \
+ _global_constants.push_back(_GlobalConstant(StringName(), #m_constant, m_constant, true));
+
+#define BIND_GLOBAL_ENUM_CONSTANT_NO_VAL(m_constant) \
+ _global_constants.push_back(_GlobalConstant(__constant_get_enum_name(m_constant, #m_constant), #m_constant, m_constant, true));
+
+#define BIND_GLOBAL_ENUM_CONSTANT_CUSTOM_NO_VAL(m_custom_name, m_constant) \
+ _global_constants.push_back(_GlobalConstant(__constant_get_enum_name(m_constant, #m_constant), m_custom_name, m_constant, true));
+
#else
#define BIND_GLOBAL_CONSTANT(m_constant) \
@@ -82,6 +93,15 @@ static Vector<_GlobalConstant> _global_constants;
#define BIND_GLOBAL_ENUM_CONSTANT_CUSTOM(m_custom_name, m_constant) \
_global_constants.push_back(_GlobalConstant(m_custom_name, m_constant));
+#define BIND_GLOBAL_CONSTANT_NO_VAL(m_constant) \
+ _global_constants.push_back(_GlobalConstant(#m_constant, m_constant));
+
+#define BIND_GLOBAL_ENUM_CONSTANT_NO_VAL(m_constant) \
+ _global_constants.push_back(_GlobalConstant(#m_constant, m_constant));
+
+#define BIND_GLOBAL_ENUM_CONSTANT_CUSTOM_NO_VAL(m_custom_name, m_constant) \
+ _global_constants.push_back(_GlobalConstant(m_custom_name, m_constant));
+
#endif
VARIANT_ENUM_CAST(KeyList);
@@ -368,7 +388,7 @@ void register_global_constants() {
BIND_GLOBAL_ENUM_CONSTANT(KEY_MASK_ALT);
BIND_GLOBAL_ENUM_CONSTANT(KEY_MASK_META);
BIND_GLOBAL_ENUM_CONSTANT(KEY_MASK_CTRL);
- BIND_GLOBAL_ENUM_CONSTANT(KEY_MASK_CMD);
+ BIND_GLOBAL_ENUM_CONSTANT_NO_VAL(KEY_MASK_CMD);
BIND_GLOBAL_ENUM_CONSTANT(KEY_MASK_KPAD);
BIND_GLOBAL_ENUM_CONSTANT(KEY_MASK_GROUP_SWITCH);
@@ -648,10 +668,18 @@ int GlobalConstants::get_global_constant_count() {
StringName GlobalConstants::get_global_constant_enum(int p_idx) {
return _global_constants[p_idx].enum_name;
}
+
+bool GlobalConstants::get_ignore_value_in_docs(int p_idx) {
+ return _global_constants[p_idx].ignore_value_in_docs;
+}
#else
StringName GlobalConstants::get_global_constant_enum(int p_idx) {
return StringName();
}
+
+bool GlobalConstants::get_ignore_value_in_docs(int p_idx) {
+ return false;
+}
#endif
const char *GlobalConstants::get_global_constant_name(int p_idx) {
diff --git a/core/global_constants.h b/core/global_constants.h
index a20b5ecd9a..989633a6fa 100644
--- a/core/global_constants.h
+++ b/core/global_constants.h
@@ -37,6 +37,7 @@ class GlobalConstants {
public:
static int get_global_constant_count();
static StringName get_global_constant_enum(int p_idx);
+ static bool get_ignore_value_in_docs(int p_idx);
static const char *get_global_constant_name(int p_idx);
static int get_global_constant_value(int p_idx);
};
diff --git a/core/object.cpp b/core/object.cpp
index 8abea9ca7e..ba002024e6 100644
--- a/core/object.cpp
+++ b/core/object.cpp
@@ -675,7 +675,7 @@ Variant Object::_call_deferred_bind(const Variant **p_args, int p_argcount, Call
StringName method = *p_args[0];
- MessageQueue::get_singleton()->push_call(get_instance_id(), method, &p_args[1], p_argcount - 1);
+ MessageQueue::get_singleton()->push_call(get_instance_id(), method, &p_args[1], p_argcount - 1, true);
return Variant();
}
diff --git a/core/project_settings.cpp b/core/project_settings.cpp
index 638987bb2f..e08a44d0c1 100644
--- a/core/project_settings.cpp
+++ b/core/project_settings.cpp
@@ -122,6 +122,22 @@ void ProjectSettings::set_restart_if_changed(const String &p_name, bool p_restar
props[p_name].restart_if_changed = p_restart;
}
+void ProjectSettings::set_ignore_value_in_docs(const String &p_name, bool p_ignore) {
+ ERR_FAIL_COND_MSG(!props.has(p_name), "Request for nonexistent project setting: " + p_name + ".");
+#ifdef DEBUG_METHODS_ENABLED
+ props[p_name].ignore_value_in_docs = p_ignore;
+#endif
+}
+
+bool ProjectSettings::get_ignore_value_in_docs(const String &p_name) const {
+ ERR_FAIL_COND_V_MSG(!props.has(p_name), false, "Request for nonexistent project setting: " + p_name + ".");
+#ifdef DEBUG_METHODS_ENABLED
+ return props[p_name].ignore_value_in_docs;
+#else
+ return false;
+#endif
+}
+
String ProjectSettings::globalize_path(const String &p_path) const {
if (p_path.begins_with("res://")) {
if (resource_path != "") {
@@ -876,7 +892,7 @@ Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_cust
}
}
-Variant _GLOBAL_DEF(const String &p_var, const Variant &p_default, bool p_restart_if_changed) {
+Variant _GLOBAL_DEF(const String &p_var, const Variant &p_default, bool p_restart_if_changed, bool p_ignore_value_in_docs) {
Variant ret;
if (!ProjectSettings::get_singleton()->has_setting(p_var)) {
ProjectSettings::get_singleton()->set(p_var, p_default);
@@ -886,6 +902,7 @@ Variant _GLOBAL_DEF(const String &p_var, const Variant &p_default, bool p_restar
ProjectSettings::get_singleton()->set_initial_value(p_var, p_default);
ProjectSettings::get_singleton()->set_builtin_order(p_var);
ProjectSettings::get_singleton()->set_restart_if_changed(p_var, p_restart_if_changed);
+ ProjectSettings::get_singleton()->set_ignore_value_in_docs(p_var, p_ignore_value_in_docs);
return ret;
}
diff --git a/core/project_settings.h b/core/project_settings.h
index 4aceafe3c0..659ee402b3 100644
--- a/core/project_settings.h
+++ b/core/project_settings.h
@@ -62,6 +62,9 @@ protected:
bool hide_from_editor = false;
bool overridden = false;
bool restart_if_changed = false;
+#ifdef DEBUG_METHODS_ENABLED
+ bool ignore_value_in_docs = false;
+#endif
VariantContainer() {}
@@ -125,6 +128,9 @@ public:
void set_initial_value(const String &p_name, const Variant &p_value);
void set_restart_if_changed(const String &p_name, bool p_restart);
+ void set_ignore_value_in_docs(const String &p_name, bool p_ignore);
+ bool get_ignore_value_in_docs(const String &p_name) const;
+
bool property_can_revert(const String &p_name);
Variant property_get_revert(const String &p_name);
@@ -167,9 +173,11 @@ public:
};
//not a macro any longer
-Variant _GLOBAL_DEF(const String &p_var, const Variant &p_default, bool p_restart_if_changed = false);
+Variant _GLOBAL_DEF(const String &p_var, const Variant &p_default, bool p_restart_if_changed = false, bool p_ignore_value_in_docs = false);
#define GLOBAL_DEF(m_var, m_value) _GLOBAL_DEF(m_var, m_value)
#define GLOBAL_DEF_RST(m_var, m_value) _GLOBAL_DEF(m_var, m_value, true)
+#define GLOBAL_DEF_NOVAL(m_var, m_value) _GLOBAL_DEF(m_var, m_value, false, true)
+#define GLOBAL_DEF_RST_NOVAL(m_var, m_value) _GLOBAL_DEF(m_var, m_value, true, true)
#define GLOBAL_GET(m_var) ProjectSettings::get_singleton()->get(m_var)
#endif // PROJECT_SETTINGS_H
diff --git a/core/ustring.cpp b/core/ustring.cpp
index 5d3cf5f1a4..572ad1af59 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -1025,6 +1025,9 @@ String String::chr(CharType p_char) {
}
String String::num(double p_num, int p_decimals) {
+ if (Math::is_nan(p_num)) {
+ return "nan";
+ }
#ifndef NO_USE_STDLIB
if (p_decimals > 16) {
@@ -1313,6 +1316,9 @@ String String::num_real(double p_num) {
}
String String::num_scientific(double p_num) {
+ if (Math::is_nan(p_num)) {
+ return "nan";
+ }
#ifndef NO_USE_STDLIB
char buf[256];
diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml
index 9a28a0d085..7f7df33471 100644
--- a/doc/classes/@GlobalScope.xml
+++ b/doc/classes/@GlobalScope.xml
@@ -898,7 +898,7 @@
<constant name="KEY_MASK_CTRL" value="268435456" enum="KeyModifierMask">
Ctrl key mask.
</constant>
- <constant name="KEY_MASK_CMD" value="268435456" enum="KeyModifierMask">
+ <constant name="KEY_MASK_CMD" value="platform-dependent" enum="KeyModifierMask">
Command key mask. On macOS, this is equivalent to [constant KEY_MASK_META]. On other platforms, this is equivalent to [constant KEY_MASK_CTRL]. This mask should be preferred to [constant KEY_MASK_META] or [constant KEY_MASK_CTRL] for system shortcuts as it handles all platforms correctly.
</constant>
<constant name="KEY_MASK_KPAD" value="536870912" enum="KeyModifierMask">
diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml
index e255ce2e1a..733bb559cb 100644
--- a/doc/classes/ProjectSettings.xml
+++ b/doc/classes/ProjectSettings.xml
@@ -244,7 +244,7 @@
<member name="audio/default_bus_layout" type="String" setter="" getter="" default="&quot;res://default_bus_layout.tres&quot;">
Default [AudioBusLayout] resource file to use in the project, unless overridden by the scene.
</member>
- <member name="audio/driver" type="String" setter="" getter="" default="&quot;PulseAudio&quot;">
+ <member name="audio/driver" type="String" setter="" getter="">
Specifies the audio driver to use. This setting is platform-dependent as each platform supports different audio drivers. If left empty, the default audio driver will be used.
</member>
<member name="audio/enable_audio_input" type="bool" setter="" getter="" default="false">
@@ -453,7 +453,7 @@
<member name="display/window/size/width" type="int" setter="" getter="" default="1024">
Sets the game's main viewport width. On desktop platforms, this is the default window size. Stretch mode settings also use this as a reference when enabled.
</member>
- <member name="display/window/tablet_driver" type="String" setter="" getter="" default="&quot;&quot;">
+ <member name="display/window/tablet_driver" type="String" setter="" getter="">
Specifies the tablet driver to use. If left empty, the default driver will be used.
</member>
<member name="display/window/vsync/use_vsync" type="bool" setter="" getter="" default="true">
@@ -472,7 +472,7 @@
<member name="gui/common/default_scroll_deadzone" type="int" setter="" getter="" default="0">
Default value for [member ScrollContainer.scroll_deadzone], which will be used for all [ScrollContainer]s unless overridden.
</member>
- <member name="gui/common/swap_cancel_ok" type="bool" setter="" getter="" default="false">
+ <member name="gui/common/swap_cancel_ok" type="bool" setter="" getter="">
If [code]true[/code], swaps Cancel and OK buttons in dialogs on Windows and UWP to follow interface conventions.
</member>
<member name="gui/common/text_edit_undo_stack_max_size" type="int" setter="" getter="" default="1024">
diff --git a/editor/doc_data.cpp b/editor/doc_data.cpp
index 54acbe9559..75b16b4510 100644
--- a/editor/doc_data.cpp
+++ b/editor/doc_data.cpp
@@ -321,12 +321,13 @@ void DocData::generate(bool p_basic_types) {
continue;
}
if (E->get().usage & PROPERTY_USAGE_EDITOR) {
- default_value = ProjectSettings::get_singleton()->property_get_revert(E->get().name);
- default_value_valid = true;
+ if (!ProjectSettings::get_singleton()->get_ignore_value_in_docs(E->get().name)) {
+ default_value = ProjectSettings::get_singleton()->property_get_revert(E->get().name);
+ default_value_valid = true;
+ }
}
} else {
default_value = get_documentation_default_value(name, E->get().name, default_value_valid);
-
if (inherited) {
bool base_default_value_valid = false;
Variant base_default_value = get_documentation_default_value(ClassDB::get_parent_class(name), E->get().name, base_default_value_valid);
@@ -478,6 +479,7 @@ void DocData::generate(bool p_basic_types) {
ConstantDoc constant;
constant.name = E->get();
constant.value = itos(ClassDB::get_integer_constant(name, E->get()));
+ constant.is_value_valid = true;
constant.enumeration = ClassDB::get_integer_constant_enum(name, E->get());
c.constants.push_back(constant);
}
@@ -620,6 +622,7 @@ void DocData::generate(bool p_basic_types) {
constant.name = E->get();
Variant value = Variant::get_constant_value(Variant::Type(i), E->get());
constant.value = value.get_type() == Variant::INT ? itos(value) : value.get_construct_string();
+ constant.is_value_valid = true;
c.constants.push_back(constant);
}
}
@@ -635,7 +638,12 @@ void DocData::generate(bool p_basic_types) {
for (int i = 0; i < GlobalConstants::get_global_constant_count(); i++) {
ConstantDoc cd;
cd.name = GlobalConstants::get_global_constant_name(i);
- cd.value = itos(GlobalConstants::get_global_constant_value(i));
+ if (!GlobalConstants::get_ignore_value_in_docs(i)) {
+ cd.value = itos(GlobalConstants::get_global_constant_value(i));
+ cd.is_value_valid = true;
+ } else {
+ cd.is_value_valid = false;
+ }
cd.enumeration = GlobalConstants::get_global_constant_enum(i);
c.constants.push_back(cd);
}
@@ -715,6 +723,7 @@ void DocData::generate(bool p_basic_types) {
ConstantDoc cd;
cd.name = E->get().first;
cd.value = E->get().second;
+ cd.is_value_valid = true;
c.constants.push_back(cd);
}
@@ -989,6 +998,7 @@ Error DocData::_load(Ref<XMLParser> parser) {
constant2.name = parser->get_attribute_value("name");
ERR_FAIL_COND_V(!parser->has_attribute("value"), ERR_FILE_CORRUPT);
constant2.value = parser->get_attribute_value("value");
+ constant2.is_value_valid = true;
if (parser->has_attribute("enum")) {
constant2.enumeration = parser->get_attribute_value("enum");
}
@@ -1178,10 +1188,18 @@ Error DocData::save_classes(const String &p_default_path, const Map<String, Stri
for (int i = 0; i < c.constants.size(); i++) {
const ConstantDoc &k = c.constants[i];
- if (k.enumeration != String()) {
- _write_string(f, 2, "<constant name=\"" + k.name + "\" value=\"" + k.value + "\" enum=\"" + k.enumeration + "\">");
+ if (k.is_value_valid) {
+ if (k.enumeration != String()) {
+ _write_string(f, 2, "<constant name=\"" + k.name + "\" value=\"" + k.value + "\" enum=\"" + k.enumeration + "\">");
+ } else {
+ _write_string(f, 2, "<constant name=\"" + k.name + "\" value=\"" + k.value + "\">");
+ }
} else {
- _write_string(f, 2, "<constant name=\"" + k.name + "\" value=\"" + k.value + "\">");
+ if (k.enumeration != String()) {
+ _write_string(f, 2, "<constant name=\"" + k.name + "\" value=\"platform-dependent\" enum=\"" + k.enumeration + "\">");
+ } else {
+ _write_string(f, 2, "<constant name=\"" + k.name + "\" value=\"platform-dependent\">");
+ }
}
_write_string(f, 3, k.description.strip_edges().xml_escape());
_write_string(f, 2, "</constant>");
diff --git a/editor/doc_data.h b/editor/doc_data.h
index 1880be81ed..a35cfb59c7 100644
--- a/editor/doc_data.h
+++ b/editor/doc_data.h
@@ -62,6 +62,7 @@ public:
struct ConstantDoc {
String name;
String value;
+ bool is_value_valid;
String enumeration;
String description;
bool operator<(const ConstantDoc &p_const) const {
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 71830d0464..00fee90841 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -1577,7 +1577,9 @@ void ScriptEditor::get_breakpoints(List<String> *p_breakpoints) {
List<int> bpoints;
se->get_breakpoints(&bpoints);
String base = script->get_path();
- ERR_CONTINUE(base.begins_with("local://") || base == "");
+ if (base.begins_with("local://") || base == "") {
+ continue;
+ }
for (List<int>::Element *E = bpoints.front(); E; E = E->next()) {
p_breakpoints->push_back(base + ":" + itos(E->get() + 1));
diff --git a/main/SCsub b/main/SCsub
index bf188d7328..152d0c4d03 100644
--- a/main/SCsub
+++ b/main/SCsub
@@ -20,8 +20,5 @@ env.CommandNoCache(
env.Depends("#main/app_icon.gen.h", "#main/app_icon.png")
env.CommandNoCache("#main/app_icon.gen.h", "#main/app_icon.png", run_in_subprocess(main_builders.make_app_icon))
-if env["tools"]:
- SConscript("tests/SCsub")
-
lib = env.add_library("main", env.main_sources)
env.Prepend(LIBS=[lib])
diff --git a/main/main.cpp b/main/main.cpp
index 35aa99c720..6965e5415a 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -55,7 +55,6 @@
#include "main/performance.h"
#include "main/splash.gen.h"
#include "main/splash_editor.gen.h"
-#include "main/tests/test_main.h"
#include "modules/modules_enabled.gen.h"
#include "modules/register_module_types.h"
#include "platform/register_platform_apis.h"
@@ -75,6 +74,10 @@
#include "servers/rendering/rendering_server_wrap_mt.h"
#include "servers/xr_server.h"
+#ifdef TESTS_ENABLED
+#include "tests/test_main.h"
+#endif
+
#ifdef TOOLS_ENABLED
#include "editor/doc_data.h"
@@ -383,6 +386,7 @@ void Main::print_help(const char *p_binary) {
OS::get_singleton()->print(
" --gdnative-generate-json-api Generate JSON dump of the Godot API for GDNative bindings.\n");
#endif
+#ifdef TESTS_ENABLED
OS::get_singleton()->print(" --test <test> Run a unit test [");
const char **test_names = tests_get_names();
const char *comma = "";
@@ -393,10 +397,12 @@ void Main::print_help(const char *p_binary) {
}
OS::get_singleton()->print("].\n");
#endif
+ OS::get_singleton()->print("\n");
+#endif
}
int Main::test_entrypoint(int argc, char *argv[], bool &tests_need_run) {
-#ifdef TOOLS_ENABLED // templates can't run unit test tool
+#ifdef TESTS_ENABLED
for (int x = 0; x < argc; x++) {
if (strncmp(argv[x], "--test", 6) == 0) {
tests_need_run = true;
@@ -1191,7 +1197,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
OS::get_singleton()->_vsync_via_compositor = window_vsync_via_compositor;
if (tablet_driver == "") { // specified in project.godot
- tablet_driver = GLOBAL_DEF_RST("display/window/tablet_driver", OS::get_singleton()->get_tablet_driver_name(0));
+ tablet_driver = GLOBAL_DEF_RST_NOVAL("display/window/tablet_driver", OS::get_singleton()->get_tablet_driver_name(0));
}
for (int i = 0; i < OS::get_singleton()->get_tablet_driver_count(); i++) {
@@ -1245,7 +1251,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
}
if (audio_driver == "") { // specified in project.godot
- audio_driver = GLOBAL_DEF_RST("audio/driver", AudioDriverManager::get_driver(0)->get_name());
+ audio_driver = GLOBAL_DEF_RST_NOVAL("audio/driver", AudioDriverManager::get_driver(0)->get_name());
}
for (int i = 0; i < AudioDriverManager::get_driver_count(); i++) {
diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp
index 3d37c7f803..e34d87f5cc 100644
--- a/modules/gdscript/gdscript_compiler.cpp
+++ b/modules/gdscript/gdscript_compiler.cpp
@@ -736,7 +736,7 @@ int GDScriptCompiler::_parse_expression(CodeGen &codegen, const GDScriptParser::
} else {
if (callee->type == GDScriptParser::Node::IDENTIFIER) {
// Self function call.
- if (codegen.function_node && codegen.function_node->is_static) {
+ if ((codegen.function_node && codegen.function_node->is_static) || call->function_name == "new") {
ret = (GDScriptFunction::ADDR_TYPE_CLASS << GDScriptFunction::ADDR_BITS);
} else {
ret = (GDScriptFunction::ADDR_TYPE_SELF << GDScriptFunction::ADDR_BITS);
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp
index 3cbc64c075..db80dbe814 100644
--- a/scene/register_scene_types.cpp
+++ b/scene/register_scene_types.cpp
@@ -372,7 +372,7 @@ void register_scene_types() {
OS::get_singleton()->yield(); //may take time to init
- AcceptDialog::set_swap_cancel_ok(GLOBAL_DEF("gui/common/swap_cancel_ok", bool(DisplayServer::get_singleton()->get_swap_cancel_ok())));
+ AcceptDialog::set_swap_cancel_ok(GLOBAL_DEF_NOVAL("gui/common/swap_cancel_ok", bool(DisplayServer::get_singleton()->get_swap_cancel_ok())));
#endif
/* REGISTER 3D */
diff --git a/main/tests/SCsub b/tests/SCsub
index cb1d35b12f..cb1d35b12f 100644
--- a/main/tests/SCsub
+++ b/tests/SCsub
diff --git a/main/tests/test_astar.cpp b/tests/test_astar.cpp
index cb5fcfe37b..cb5fcfe37b 100644
--- a/main/tests/test_astar.cpp
+++ b/tests/test_astar.cpp
diff --git a/main/tests/test_astar.h b/tests/test_astar.h
index 0992812c18..0992812c18 100644
--- a/main/tests/test_astar.h
+++ b/tests/test_astar.h
diff --git a/main/tests/test_basis.cpp b/tests/test_basis.cpp
index 5904fc386a..5904fc386a 100644
--- a/main/tests/test_basis.cpp
+++ b/tests/test_basis.cpp
diff --git a/main/tests/test_basis.h b/tests/test_basis.h
index 63297bd3b8..63297bd3b8 100644
--- a/main/tests/test_basis.h
+++ b/tests/test_basis.h
diff --git a/main/tests/test_class_db.cpp b/tests/test_class_db.cpp
index 3171091402..3171091402 100644
--- a/main/tests/test_class_db.cpp
+++ b/tests/test_class_db.cpp
diff --git a/main/tests/test_class_db.h b/tests/test_class_db.h
index 1a31cfb01b..1a31cfb01b 100644
--- a/main/tests/test_class_db.h
+++ b/tests/test_class_db.h
diff --git a/main/tests/test_gdscript.cpp b/tests/test_gdscript.cpp
index a50311972f..a50311972f 100644
--- a/main/tests/test_gdscript.cpp
+++ b/tests/test_gdscript.cpp
diff --git a/main/tests/test_gdscript.h b/tests/test_gdscript.h
index 6595da1430..6595da1430 100644
--- a/main/tests/test_gdscript.h
+++ b/tests/test_gdscript.h
diff --git a/main/tests/test_gui.cpp b/tests/test_gui.cpp
index d46a13d2c0..d46a13d2c0 100644
--- a/main/tests/test_gui.cpp
+++ b/tests/test_gui.cpp
diff --git a/main/tests/test_gui.h b/tests/test_gui.h
index 5a23179eee..5a23179eee 100644
--- a/main/tests/test_gui.h
+++ b/tests/test_gui.h
diff --git a/main/tests/test_main.cpp b/tests/test_main.cpp
index 91eff28f86..91eff28f86 100644
--- a/main/tests/test_main.cpp
+++ b/tests/test_main.cpp
diff --git a/main/tests/test_main.h b/tests/test_main.h
index 8273b74eac..8273b74eac 100644
--- a/main/tests/test_main.h
+++ b/tests/test_main.h
diff --git a/main/tests/test_math.cpp b/tests/test_math.cpp
index 5f84bad4e9..5f84bad4e9 100644
--- a/main/tests/test_math.cpp
+++ b/tests/test_math.cpp
diff --git a/main/tests/test_math.h b/tests/test_math.h
index 77bce8dd66..77bce8dd66 100644
--- a/main/tests/test_math.h
+++ b/tests/test_math.h
diff --git a/main/tests/test_oa_hash_map.cpp b/tests/test_oa_hash_map.cpp
index 9182f66b61..9182f66b61 100644
--- a/main/tests/test_oa_hash_map.cpp
+++ b/tests/test_oa_hash_map.cpp
diff --git a/main/tests/test_oa_hash_map.h b/tests/test_oa_hash_map.h
index eb2b3d1e99..eb2b3d1e99 100644
--- a/main/tests/test_oa_hash_map.h
+++ b/tests/test_oa_hash_map.h
diff --git a/main/tests/test_ordered_hash_map.cpp b/tests/test_ordered_hash_map.cpp
index d18a3784be..d18a3784be 100644
--- a/main/tests/test_ordered_hash_map.cpp
+++ b/tests/test_ordered_hash_map.cpp
diff --git a/main/tests/test_ordered_hash_map.h b/tests/test_ordered_hash_map.h
index f251da0ba2..f251da0ba2 100644
--- a/main/tests/test_ordered_hash_map.h
+++ b/tests/test_ordered_hash_map.h
diff --git a/main/tests/test_physics_2d.cpp b/tests/test_physics_2d.cpp
index c82ae920bc..c82ae920bc 100644
--- a/main/tests/test_physics_2d.cpp
+++ b/tests/test_physics_2d.cpp
diff --git a/main/tests/test_physics_2d.h b/tests/test_physics_2d.h
index 517d324f3b..517d324f3b 100644
--- a/main/tests/test_physics_2d.h
+++ b/tests/test_physics_2d.h
diff --git a/main/tests/test_physics_3d.cpp b/tests/test_physics_3d.cpp
index 72de2041e4..72de2041e4 100644
--- a/main/tests/test_physics_3d.cpp
+++ b/tests/test_physics_3d.cpp
diff --git a/main/tests/test_physics_3d.h b/tests/test_physics_3d.h
index d03f2c6573..d03f2c6573 100644
--- a/main/tests/test_physics_3d.h
+++ b/tests/test_physics_3d.h
diff --git a/main/tests/test_render.cpp b/tests/test_render.cpp
index d936dd72e7..d936dd72e7 100644
--- a/main/tests/test_render.cpp
+++ b/tests/test_render.cpp
diff --git a/main/tests/test_render.h b/tests/test_render.h
index 4a6340c443..4a6340c443 100644
--- a/main/tests/test_render.h
+++ b/tests/test_render.h
diff --git a/main/tests/test_shader_lang.cpp b/tests/test_shader_lang.cpp
index 34ee3e3210..34ee3e3210 100644
--- a/main/tests/test_shader_lang.cpp
+++ b/tests/test_shader_lang.cpp
diff --git a/main/tests/test_shader_lang.h b/tests/test_shader_lang.h
index 2811c5f46e..2811c5f46e 100644
--- a/main/tests/test_shader_lang.h
+++ b/tests/test_shader_lang.h
diff --git a/main/tests/test_string.h b/tests/test_string.h
index 25fd513a1a..25fd513a1a 100644
--- a/main/tests/test_string.h
+++ b/tests/test_string.h
diff --git a/main/tests/test_validate_testing.h b/tests/test_validate_testing.h
index 5be7d45185..5be7d45185 100644
--- a/main/tests/test_validate_testing.h
+++ b/tests/test_validate_testing.h