summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/classes/TabContainer.xml4
-rw-r--r--main/tests/test_class_db.cpp68
-rw-r--r--modules/mono/csharp_script.cpp56
-rw-r--r--modules/mono/csharp_script.h6
-rw-r--r--modules/mono/mono_gd/gd_mono.cpp3
-rw-r--r--platform/windows/display_server_windows.cpp24
-rw-r--r--scene/gui/tab_container.cpp4
-rw-r--r--scene/resources/default_theme/default_theme.cpp2
8 files changed, 100 insertions, 67 deletions
diff --git a/doc/classes/TabContainer.xml b/doc/classes/TabContainer.xml
index 22e92ae5d9..d56781105b 100644
--- a/doc/classes/TabContainer.xml
+++ b/doc/classes/TabContainer.xml
@@ -204,8 +204,8 @@
<theme_item name="font_color_fg" type="Color" default="Color( 0.94, 0.94, 0.94, 1 )">
Font color of the currently selected tab.
</theme_item>
- <theme_item name="hseparation" type="int" default="4">
- Horizontal separation between tabs.
+ <theme_item name="icon_separation" type="int" default="4">
+ Space between tab's name and its icon.
</theme_item>
<theme_item name="increment" type="Texture2D">
Icon for the right arrow button that appears when there are too many tabs to fit in the container width. When the button is disabled (i.e. the last tab is visible) it appears semi-transparent.
diff --git a/main/tests/test_class_db.cpp b/main/tests/test_class_db.cpp
index 4c00a09e9c..3171091402 100644
--- a/main/tests/test_class_db.cpp
+++ b/main/tests/test_class_db.cpp
@@ -44,21 +44,21 @@ enum class [[nodiscard]] TestResult{
PASS
};
-#define TEST_FAIL_COND_FATAL(m_cond, m_msg) \
- if (unlikely(m_cond)) { \
- ERR_PRINT(m_msg); \
- return TestResult::FAILED; \
- } else \
+#define TEST_FAIL_COND(m_cond, m_msg) \
+ if (unlikely(m_cond)) { \
+ ERR_PRINT(m_msg); \
+ return TestResult::FAILED; \
+ } else \
((void)0)
-#define TEST_FAIL_COND(m_cond, m_msg) \
+#define TEST_COND(m_cond, m_msg) \
if (unlikely(m_cond)) { \
ERR_PRINT(m_msg); \
__test_result__ = TestResult::FAILED; \
} else \
((void)0)
-#define TEST_CHECK_FATAL(m_test_expr) \
+#define TEST_FAIL_CHECK(m_test_expr) \
if (unlikely((m_test_expr) == TestResult::FAILED)) { \
return TestResult::FAILED; \
} else \
@@ -229,18 +229,18 @@ struct Context {
return elem ? &elem.value() : nullptr;
}
- bool has_type(const Context &p_context, const TypeReference &p_type_ref) const {
- if (p_context.builtin_types.find(p_type_ref.name) >= 0) {
+ bool has_type(const TypeReference &p_type_ref) const {
+ if (builtin_types.find(p_type_ref.name) >= 0) {
return true;
}
if (p_type_ref.is_enum) {
- if (p_context.enum_types.find(p_type_ref.name) >= 0) {
+ if (enum_types.find(p_type_ref.name) >= 0) {
return true;
}
// Enum not found. Most likely because none of its constants were bound, so it's empty. That's fine. Use int instead.
- return p_context.builtin_types.find(p_context.names_cache.int_type);
+ return builtin_types.find(names_cache.int_type);
}
return false;
@@ -370,10 +370,10 @@ TestResult validate_property(const Context &p_context, const ExposedClass &p_cla
const ExposedClass *prop_class = p_context.find_exposed_class(prop_type_ref);
if (prop_class) {
- TEST_FAIL_COND(prop_class->is_singleton,
+ TEST_COND(prop_class->is_singleton,
"Property type is a singleton: '" + p_class.name + "." + String(p_prop.name) + "'.");
} else {
- TEST_FAIL_COND(!p_context.has_type(p_context, prop_type_ref),
+ TEST_FAIL_COND(!p_context.has_type(prop_type_ref),
"Property type '" + prop_type_ref.name + "' not found: '" + p_class.name + "." + String(p_prop.name) + "'.");
}
@@ -382,7 +382,7 @@ TestResult validate_property(const Context &p_context, const ExposedClass &p_cla
const ArgumentData &idx_arg = getter->arguments.front()->get();
if (idx_arg.type.name != p_context.names_cache.int_type) {
// If not an int, it can be an enum
- TEST_FAIL_COND(p_context.enum_types.find(idx_arg.type.name) < 0,
+ TEST_COND(p_context.enum_types.find(idx_arg.type.name) < 0,
"Invalid type '" + idx_arg.type.name + "' for index argument of property getter: '" + p_class.name + "." + String(p_prop.name) + "'.");
}
}
@@ -394,7 +394,7 @@ TestResult validate_property(const Context &p_context, const ExposedClass &p_cla
if (idx_arg.type.name != p_context.names_cache.int_type) {
// Assume the index parameter is an enum
// If not an int, it can be an enum
- TEST_FAIL_COND(p_context.enum_types.find(idx_arg.type.name) < 0,
+ TEST_COND(p_context.enum_types.find(idx_arg.type.name) < 0,
"Invalid type '" + idx_arg.type.name + "' for index argument of property setter: '" + p_class.name + "." + String(p_prop.name) + "'.");
}
}
@@ -408,7 +408,7 @@ TestResult validate_method(const Context &p_context, const ExposedClass &p_class
const ExposedClass *return_class = p_context.find_exposed_class(p_method.return_type);
if (return_class) {
- TEST_FAIL_COND(return_class->is_singleton,
+ TEST_COND(return_class->is_singleton,
"Method return type is a singleton: '" + p_class.name + "." + p_method.name + "'.");
}
@@ -417,15 +417,15 @@ TestResult validate_method(const Context &p_context, const ExposedClass &p_class
const ExposedClass *arg_class = p_context.find_exposed_class(arg.type);
if (arg_class) {
- TEST_FAIL_COND(arg_class->is_singleton,
+ TEST_COND(arg_class->is_singleton,
"Argument type is a singleton: '" + arg.name + "' of method '" + p_class.name + "." + p_method.name + "'.");
} else {
- TEST_FAIL_COND(!p_context.has_type(p_context, arg.type),
+ TEST_FAIL_COND(!p_context.has_type(arg.type),
"Argument type '" + arg.type.name + "' not found: '" + arg.name + "' of method" + p_class.name + "." + p_method.name + "'.");
}
if (arg.has_defval) {
- TEST_FAIL_COND(!arg_default_value_is_assignable_to_type(p_context, arg.defval, arg.type),
+ TEST_COND(!arg_default_value_is_assignable_to_type(p_context, arg.defval, arg.type),
"Invalid default value for parameter '" + arg.name + "' of method '" + p_class.name + "." + p_method.name + "'.");
}
}
@@ -441,10 +441,10 @@ TestResult validate_signal(const Context &p_context, const ExposedClass &p_class
const ExposedClass *arg_class = p_context.find_exposed_class(arg.type);
if (arg_class) {
- TEST_FAIL_COND(arg_class->is_singleton,
+ TEST_COND(arg_class->is_singleton,
"Argument class is a singleton: '" + arg.name + "' of signal" + p_class.name + "." + p_signal.name + "'.");
} else {
- TEST_FAIL_COND(!p_context.has_type(p_context, arg.type),
+ TEST_FAIL_COND(!p_context.has_type(arg.type),
"Argument type '" + arg.type.name + "' not found: '" + arg.name + "' of signal" + p_class.name + "." + p_signal.name + "'.");
}
}
@@ -459,20 +459,20 @@ TestResult validate_class(const Context &p_context, const ExposedClass &p_expose
if (!is_derived_type) {
// Asserts about the base Object class
- TEST_FAIL_COND_FATAL(p_exposed_class.name != p_context.names_cache.object_class,
+ TEST_FAIL_COND(p_exposed_class.name != p_context.names_cache.object_class,
"Class '" + p_exposed_class.name + "' has no base class.");
- TEST_FAIL_COND_FATAL(!p_exposed_class.is_instantiable,
+ TEST_FAIL_COND(!p_exposed_class.is_instantiable,
"Object class is not instantiable.");
- TEST_FAIL_COND_FATAL(p_exposed_class.api_type != ClassDB::API_CORE,
+ TEST_FAIL_COND(p_exposed_class.api_type != ClassDB::API_CORE,
"Object class is API is not API_CORE.");
- TEST_FAIL_COND_FATAL(p_exposed_class.is_singleton,
+ TEST_FAIL_COND(p_exposed_class.is_singleton,
"Object class is registered as a singleton.");
}
- CRASH_COND_MSG(p_exposed_class.is_singleton && p_exposed_class.base != p_context.names_cache.object_class,
+ TEST_FAIL_COND(p_exposed_class.is_singleton && p_exposed_class.base != p_context.names_cache.object_class,
"Singleton base class '" + String(p_exposed_class.base) + "' is not Object, for class '" + p_exposed_class.name + "'.");
- CRASH_COND_MSG(is_derived_type && !p_context.exposed_classes.has(p_exposed_class.base),
+ TEST_FAIL_COND(is_derived_type && !p_context.exposed_classes.has(p_exposed_class.base),
"Base type '" + p_exposed_class.base.operator String() + "' does not exist, for class '" + p_exposed_class.name + "'.");
for (const List<PropertyData>::Element *F = p_exposed_class.properties.front(); F; F = F->next()) {
@@ -619,9 +619,9 @@ TestResult add_exposed_classes(Context &r_context) {
bool bad_reference_hint = !method.is_virtual && return_info.hint != PROPERTY_HINT_RESOURCE_TYPE &&
ClassDB::is_parent_class(return_info.class_name, r_context.names_cache.reference_class);
- TEST_FAIL_COND(bad_reference_hint, String() + "Return type is reference but hint is not '" _STR(PROPERTY_HINT_RESOURCE_TYPE) "'." +
- " Are you returning a reference type by pointer? Method: '" +
- exposed_class.name + "." + method.name + "'.");
+ TEST_COND(bad_reference_hint, String() + "Return type is reference but hint is not '" _STR(PROPERTY_HINT_RESOURCE_TYPE) "'." +
+ " Are you returning a reference type by pointer? Method: '" +
+ exposed_class.name + "." + method.name + "'.");
} else if (return_info.hint == PROPERTY_HINT_RESOURCE_TYPE) {
method.return_type.name = return_info.hint_string;
} else if (return_info.type == Variant::NIL && return_info.usage & PROPERTY_USAGE_NIL_IS_VARIANT) {
@@ -670,7 +670,7 @@ TestResult add_exposed_classes(Context &r_context) {
method.arguments.push_back(vararg);
}
- TEST_FAIL_COND(exposed_class.find_property_by_name(method.name),
+ TEST_COND(exposed_class.find_property_by_name(method.name),
"Method name conflicts with property: '" + String(class_name) + "." + String(method.name) + "'.");
// Classes starting with an underscore are ignored unless they're used as a property setter or getter
@@ -851,13 +851,13 @@ TestResult run_class_db_tests() {
Context context;
- TEST_CHECK_FATAL(add_exposed_classes(context));
+ TEST_FAIL_CHECK(add_exposed_classes(context));
add_builtin_types(context);
add_global_enums(context);
const ExposedClass *object_class = context.find_exposed_class(context.names_cache.object_class);
- TEST_FAIL_COND_FATAL(!object_class, "Object class not found.");
- TEST_FAIL_COND_FATAL(object_class->base != StringName(),
+ TEST_FAIL_COND(!object_class, "Object class not found.");
+ TEST_FAIL_COND(object_class->base != StringName(),
"Object class derives from another class: '" + object_class->base + "'.");
for (ExposedClasses::Element E = context.exposed_classes.front(); E; E = E.next()) {
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index 6e3bdf8e41..958d72adb1 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -2419,15 +2419,22 @@ bool CSharpScript::_update_exports() {
StringName member_name = field->get_name();
member_info[member_name] = prop_info;
+
+ if (exported) {
#ifdef TOOLS_ENABLED
- if (is_editor && exported) {
- exported_members_cache.push_front(prop_info);
+ if (is_editor) {
+ exported_members_cache.push_front(prop_info);
- if (tmp_object) {
- exported_members_defval_cache[member_name] = GDMonoMarshal::mono_object_to_variant(field->get_value(tmp_object));
+ if (tmp_object) {
+ exported_members_defval_cache[member_name] = GDMonoMarshal::mono_object_to_variant(field->get_value(tmp_object));
+ }
}
- }
#endif
+
+#if defined(TOOLS_ENABLED) || defined(DEBUG_ENABLED)
+ exported_members_names.insert(member_name);
+#endif
+ }
}
}
@@ -2440,21 +2447,28 @@ bool CSharpScript::_update_exports() {
StringName member_name = property->get_name();
member_info[member_name] = prop_info;
+
+ if (exported) {
#ifdef TOOLS_ENABLED
- if (is_editor && exported) {
- exported_members_cache.push_front(prop_info);
- if (tmp_object) {
- MonoException *exc = nullptr;
- MonoObject *ret = property->get_value(tmp_object, &exc);
- if (exc) {
- exported_members_defval_cache[member_name] = Variant();
- GDMonoUtils::debug_print_unhandled_exception(exc);
- } else {
- exported_members_defval_cache[member_name] = GDMonoMarshal::mono_object_to_variant(ret);
+ if (is_editor) {
+ exported_members_cache.push_front(prop_info);
+ if (tmp_object) {
+ MonoException *exc = nullptr;
+ MonoObject *ret = property->get_value(tmp_object, &exc);
+ if (exc) {
+ exported_members_defval_cache[member_name] = Variant();
+ GDMonoUtils::debug_print_unhandled_exception(exc);
+ } else {
+ exported_members_defval_cache[member_name] = GDMonoMarshal::mono_object_to_variant(ret);
+ }
}
}
- }
#endif
+
+#if defined(TOOLS_ENABLED) || defined(DEBUG_ENABLED)
+ exported_members_names.insert(member_name);
+#endif
+ }
}
}
@@ -3591,6 +3605,16 @@ CSharpScript::~CSharpScript() {
#endif
}
+void CSharpScript::get_members(Set<StringName> *p_members) {
+#if defined(TOOLS_ENABLED) || defined(DEBUG_ENABLED)
+ if (p_members) {
+ for (Set<StringName>::Element *E = exported_members_names.front(); E; E = E->next()) {
+ p_members->insert(E->get());
+ }
+ }
+#endif
+}
+
/*************** RESOURCE ***************/
RES ResourceFormatLoaderCSharpScript::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, bool p_no_cache) {
diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h
index 52b0783a6e..0bf08ceafd 100644
--- a/modules/mono/csharp_script.h
+++ b/modules/mono/csharp_script.h
@@ -138,6 +138,10 @@ private:
virtual void _placeholder_erased(PlaceHolderScriptInstance *p_placeholder);
#endif
+#if defined(TOOLS_ENABLED) || defined(DEBUG_ENABLED)
+ Set<StringName> exported_members_names;
+#endif
+
Map<StringName, PropertyInfo> member_info;
void _clear();
@@ -191,6 +195,8 @@ public:
virtual void get_script_property_list(List<PropertyInfo> *p_list) const;
virtual void update_exports();
+ void get_members(Set<StringName> *p_members) override;
+
virtual bool is_tool() const { return tool; }
virtual bool is_valid() const { return valid; }
diff --git a/modules/mono/mono_gd/gd_mono.cpp b/modules/mono/mono_gd/gd_mono.cpp
index 080f366692..5f518d0613 100644
--- a/modules/mono/mono_gd/gd_mono.cpp
+++ b/modules/mono/mono_gd/gd_mono.cpp
@@ -424,6 +424,9 @@ void GDMono::initialize_load_assemblies() {
CRASH_COND_MSG(!tool_assemblies_loaded, "Mono: Failed to load '" TOOLS_ASM_NAME "' assemblies.");
#endif
+ if (Main::is_project_manager())
+ return;
+
// Load the project's main assembly. This doesn't necessarily need to succeed.
// The game may not be using .NET at all, or if the project does use .NET and
// we're running in the editor, it may just happen to be it wasn't built yet.
diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp
index 30a3ad5a01..85acdababc 100644
--- a/platform/windows/display_server_windows.cpp
+++ b/platform/windows/display_server_windows.cpp
@@ -3074,18 +3074,6 @@ DisplayServerWindows::~DisplayServerWindows() {
cursors_cache.clear();
-#if defined(VULKAN_ENABLED)
- if (rendering_driver == "vulkan") {
- if (rendering_device_vulkan) {
- rendering_device_vulkan->finalize();
- memdelete(rendering_device_vulkan);
- }
-
- if (context_vulkan)
- memdelete(context_vulkan);
- }
-#endif
-
if (user_proc) {
SetWindowLongPtr(windows[MAIN_WINDOW_ID].hWnd, GWLP_WNDPROC, (LONG_PTR)user_proc);
};
@@ -3102,4 +3090,16 @@ DisplayServerWindows::~DisplayServerWindows() {
}
DestroyWindow(windows[MAIN_WINDOW_ID].hWnd);
}
+
+#if defined(VULKAN_ENABLED)
+ if (rendering_driver == "vulkan") {
+ if (rendering_device_vulkan) {
+ rendering_device_vulkan->finalize();
+ memdelete(rendering_device_vulkan);
+ }
+
+ if (context_vulkan)
+ memdelete(context_vulkan);
+ }
+#endif
}
diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp
index 97b8362214..8c4d9a5ece 100644
--- a/scene/gui/tab_container.cpp
+++ b/scene/gui/tab_container.cpp
@@ -278,7 +278,7 @@ void TabContainer::_notification(int p_what) {
Color font_color_bg = get_theme_color("font_color_bg");
Color font_color_disabled = get_theme_color("font_color_disabled");
int side_margin = get_theme_constant("side_margin");
- int icon_text_distance = get_theme_constant("hseparation");
+ int icon_text_distance = get_theme_constant("icon_separation");
// Find out start and width of the header area.
int header_x = side_margin;
@@ -465,7 +465,7 @@ int TabContainer::_get_tab_width(int p_index) const {
if (icon.is_valid()) {
width += icon->get_width();
if (text != "") {
- width += get_theme_constant("hseparation");
+ width += get_theme_constant("icon_separation");
}
}
}
diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp
index f5b987e8df..de39fac627 100644
--- a/scene/resources/default_theme/default_theme.cpp
+++ b/scene/resources/default_theme/default_theme.cpp
@@ -681,7 +681,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_color("font_color_disabled", "TabContainer", control_font_color_disabled);
theme->set_constant("side_margin", "TabContainer", 8 * scale);
- theme->set_constant("hseparation", "TabContainer", 4 * scale);
+ theme->set_constant("icon_separation", "TabContainer", 4 * scale);
// Tabs