summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/config/project_settings.cpp1
-rw-r--r--core/extension/extension_api_dump.cpp17
-rw-r--r--core/input/shortcut.cpp2
-rw-r--r--core/io/resource.cpp2
-rw-r--r--core/object/object.h4
-rw-r--r--core/object/worker_thread_pool.cpp4
-rw-r--r--core/variant/array.cpp5
-rw-r--r--core/variant/array.h1
-rw-r--r--core/variant/variant_call.cpp1
-rw-r--r--core/variant/variant_parser.cpp2
10 files changed, 24 insertions, 15 deletions
diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp
index 7aaa9a46b7..d0de39a79d 100644
--- a/core/config/project_settings.cpp
+++ b/core/config/project_settings.cpp
@@ -1200,6 +1200,7 @@ ProjectSettings::ProjectSettings() {
// Initialization of engine variables should be done in the setup() method,
// so that the values can be overridden from project.godot or project.binary.
+ CRASH_COND_MSG(singleton != nullptr, "Instantiating a new ProjectSettings singleton is not supported.");
singleton = this;
GLOBAL_DEF_BASIC("application/config/name", "");
diff --git a/core/extension/extension_api_dump.cpp b/core/extension/extension_api_dump.cpp
index a2c507e350..196bb68b2b 100644
--- a/core/extension/extension_api_dump.cpp
+++ b/core/extension/extension_api_dump.cpp
@@ -266,7 +266,7 @@ Dictionary NativeExtensionAPIDump::generate_extension_api() {
{ Variant::VECTOR2I, "x", 0, 0, 0, 0 },
{ Variant::VECTOR2I, "y", sizeof(int32_t), sizeof(int32_t), sizeof(int32_t), sizeof(int32_t) },
{ Variant::RECT2, "position", 0, 0, 0, 0 },
- { Variant::RECT2, "size", 2 * sizeof(Vector2), 2 * sizeof(float), 2 * sizeof(double), 2 * sizeof(double) },
+ { Variant::RECT2, "size", 2 * sizeof(float), 2 * sizeof(float), 2 * sizeof(double), 2 * sizeof(double) },
{ Variant::RECT2I, "position", 0, 0, 0, 0 },
{ Variant::RECT2I, "size", 2 * sizeof(int32_t), 2 * sizeof(int32_t), 2 * sizeof(int32_t), 2 * sizeof(int32_t) },
{ Variant::VECTOR3, "x", 0, 0, 0, 0 },
@@ -871,9 +871,18 @@ Dictionary NativeExtensionAPIDump::generate_extension_api() {
Dictionary d2;
d2["type"] = get_property_info_type_name(F);
d2["name"] = String(property_name);
- d2["setter"] = ClassDB::get_property_setter(class_name, F.name);
- d2["getter"] = ClassDB::get_property_getter(class_name, F.name);
- d2["index"] = ClassDB::get_property_index(class_name, F.name);
+ StringName setter = ClassDB::get_property_setter(class_name, F.name);
+ if (!(setter == "")) {
+ d2["setter"] = setter;
+ }
+ StringName getter = ClassDB::get_property_getter(class_name, F.name);
+ if (!(getter == "")) {
+ d2["getter"] = getter;
+ }
+ int index = ClassDB::get_property_index(class_name, F.name);
+ if (index != -1) {
+ d2["index"] = index;
+ }
properties.push_back(d2);
}
diff --git a/core/input/shortcut.cpp b/core/input/shortcut.cpp
index 9eeeb449ba..e74ccb11bb 100644
--- a/core/input/shortcut.cpp
+++ b/core/input/shortcut.cpp
@@ -107,7 +107,7 @@ void Shortcut::_bind_methods() {
ClassDB::bind_method(D_METHOD("matches_event", "event"), &Shortcut::matches_event);
ClassDB::bind_method(D_METHOD("get_as_text"), &Shortcut::get_as_text);
- ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "events", PROPERTY_HINT_ARRAY_TYPE, vformat("%s/%s:%s", Variant::OBJECT, PROPERTY_HINT_RESOURCE_TYPE, "InputEvent")), "set_events", "get_events");
+ ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "events", PROPERTY_HINT_ARRAY_TYPE, MAKE_RESOURCE_TYPE_HINT("InputEvent")), "set_events", "get_events");
}
bool Shortcut::is_event_array_equal(const Array &p_event_array1, const Array &p_event_array2) {
diff --git a/core/io/resource.cpp b/core/io/resource.cpp
index ab30fb1ca3..be75ad7e25 100644
--- a/core/io/resource.cpp
+++ b/core/io/resource.cpp
@@ -436,7 +436,7 @@ void Resource::_bind_methods() {
ADD_GROUP("Resource", "resource_");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "resource_local_to_scene"), "set_local_to_scene", "is_local_to_scene");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "resource_path", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_path", "get_path");
- ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "resource_name"), "set_name", "get_name");
+ ADD_PROPERTY(PropertyInfo(Variant::STRING, "resource_name"), "set_name", "get_name");
MethodInfo get_rid_bind("_get_rid");
get_rid_bind.return_val.type = Variant::RID;
diff --git a/core/object/object.h b/core/object/object.h
index 16ad7b8832..9416eb7762 100644
--- a/core/object/object.h
+++ b/core/object/object.h
@@ -149,6 +149,10 @@ enum PropertyUsageFlags {
#define ADD_ARRAY_COUNT_WITH_USAGE_FLAGS(m_label, m_count_property, m_count_property_setter, m_count_property_getter, m_prefix, m_property_usage_flags) ClassDB::add_property_array_count(get_class_static(), m_label, m_count_property, _scs_create(m_count_property_setter), _scs_create(m_count_property_getter), m_prefix, m_property_usage_flags)
#define ADD_ARRAY(m_array_path, m_prefix) ClassDB::add_property_array(get_class_static(), m_array_path, m_prefix)
+// Helper macro to use with PROPERTY_HINT_ARRAY_TYPE for arrays of specific resources:
+// PropertyInfo(Variant::ARRAY, "fallbacks", PROPERTY_HINT_ARRAY_TYPE, MAKE_RESOURCE_TYPE_HINT("Font")
+#define MAKE_RESOURCE_TYPE_HINT(m_type) vformat("%s/%s:%s", Variant::OBJECT, PROPERTY_HINT_RESOURCE_TYPE, m_type)
+
struct PropertyInfo {
Variant::Type type = Variant::NIL;
String name;
diff --git a/core/object/worker_thread_pool.cpp b/core/object/worker_thread_pool.cpp
index 9b3dc6833e..0218a4c8f6 100644
--- a/core/object/worker_thread_pool.cpp
+++ b/core/object/worker_thread_pool.cpp
@@ -402,7 +402,9 @@ void WorkerThreadPool::wait_for_group_task_completion(GroupID p_group) {
}
}
- groups.erase(p_group); // Threads do not access this, so safe to erase here.
+ task_mutex.lock(); // This mutex is needed when Physics 2D and/or 3D is selected to run on a separate thread.
+ groups.erase(p_group);
+ task_mutex.unlock();
}
void WorkerThreadPool::init(int p_thread_count, bool p_use_native_threads_low_priority, float p_low_priority_task_ratio) {
diff --git a/core/variant/array.cpp b/core/variant/array.cpp
index c6bbd43dc4..6c4e8ba450 100644
--- a/core/variant/array.cpp
+++ b/core/variant/array.cpp
@@ -334,11 +334,6 @@ int Array::rfind(const Variant &p_value, int p_from) const {
return -1;
}
-int Array::find_last(const Variant &p_value) const {
- ERR_FAIL_COND_V(!_p->typed.validate(p_value, "find_last"), -1);
- return rfind(p_value);
-}
-
int Array::count(const Variant &p_value) const {
ERR_FAIL_COND_V(!_p->typed.validate(p_value, "count"), 0);
if (_p->array.size() == 0) {
diff --git a/core/variant/array.h b/core/variant/array.h
index ee265a9ffd..2dd3dde2d1 100644
--- a/core/variant/array.h
+++ b/core/variant/array.h
@@ -90,7 +90,6 @@ public:
int find(const Variant &p_value, int p_from = 0) const;
int rfind(const Variant &p_value, int p_from = -1) const;
- int find_last(const Variant &p_value) const;
int count(const Variant &p_value) const;
bool has(const Variant &p_value) const;
diff --git a/core/variant/variant_call.cpp b/core/variant/variant_call.cpp
index 1e80e2681d..2cb80dcab4 100644
--- a/core/variant/variant_call.cpp
+++ b/core/variant/variant_call.cpp
@@ -2058,7 +2058,6 @@ static void _register_variant_builtin_methods() {
bind_method(Array, pick_random, sarray(), varray());
bind_method(Array, find, sarray("what", "from"), varray(0));
bind_method(Array, rfind, sarray("what", "from"), varray(-1));
- bind_method(Array, find_last, sarray("value"), varray());
bind_method(Array, count, sarray("value"), varray());
bind_method(Array, has, sarray("value"), varray());
bind_method(Array, pop_back, sarray(), varray());
diff --git a/core/variant/variant_parser.cpp b/core/variant/variant_parser.cpp
index d2e4d752a4..17d41ca95e 100644
--- a/core/variant/variant_parser.cpp
+++ b/core/variant/variant_parser.cpp
@@ -1283,7 +1283,7 @@ Error VariantParser::_parse_dictionary(Dictionary &object, Stream *p_stream, int
Variant v;
err = parse_value(token, v, p_stream, line, r_err_str, p_res_parser);
- if (err) {
+ if (err && err != ERR_FILE_MISSING_DEPENDENCIES) {
return err;
}
object[key] = v;