summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/crypto/crypto.h14
-rw-r--r--core/extension/gdextension.h8
-rw-r--r--core/input/input_builders.py2
-rw-r--r--core/io/image_loader.h8
-rw-r--r--core/io/json.h14
-rw-r--r--core/io/resource_format_binary.h28
-rw-r--r--core/io/resource_importer.h30
-rw-r--r--core/io/translation_loader_po.h8
-rw-r--r--core/string/ustring.cpp7
-rw-r--r--doc/classes/Control.xml8
-rw-r--r--doc/classes/DisplayServer.xml4
-rw-r--r--doc/classes/NativeMenu.xml13
-rw-r--r--doc/classes/Node.xml12
-rw-r--r--doc/classes/Object.xml2
-rw-r--r--doc/classes/Viewport.xml8
-rw-r--r--drivers/png/resource_saver_png.h6
-rw-r--r--editor/find_in_files.cpp12
-rw-r--r--editor/find_in_files.h3
-rw-r--r--editor/plugins/debugger_editor_plugin.cpp4
-rw-r--r--editor/plugins/script_editor_plugin.cpp27
-rw-r--r--editor/plugins/script_editor_plugin.h1
-rw-r--r--gles3_builders.py2
-rw-r--r--glsl_builders.py4
-rw-r--r--methods.py20
-rwxr-xr-xmisc/scripts/check_ci_log.py2
-rwxr-xr-xmisc/scripts/copyright_headers.py2
-rw-r--r--modules/dds/texture_loader_dds.h8
-rw-r--r--modules/gdscript/gdscript.h16
-rw-r--r--modules/ktx/texture_loader_ktx.h8
-rw-r--r--modules/raycast/godot_update_embree.py2
-rw-r--r--modules/theora/video_stream_theora.h8
-rw-r--r--modules/webp/resource_saver_webp.h6
-rw-r--r--scene/gui/file_dialog.cpp8
-rw-r--r--scene/gui/menu_bar.cpp86
-rw-r--r--scene/gui/menu_bar.h2
-rw-r--r--scene/main/viewport.cpp1
-rw-r--r--scene/main/viewport.h1
-rw-r--r--scene/resources/compressed_texture.h24
-rw-r--r--scene/resources/resource_format_text.h30
-rw-r--r--scene/resources/shader.h14
-rw-r--r--scene/resources/shader_include.h14
-rw-r--r--servers/native_menu.cpp14
-rw-r--r--servers/native_menu.h1
-rw-r--r--tests/core/string/test_string.h2
-rw-r--r--tests/create_test.py2
-rw-r--r--tests/python_build/test_gles3_builder.py6
-rw-r--r--tests/python_build/test_glsl_builder.py6
47 files changed, 300 insertions, 208 deletions
diff --git a/core/crypto/crypto.h b/core/crypto/crypto.h
index 0248b04034..fbd01be86d 100644
--- a/core/crypto/crypto.h
+++ b/core/crypto/crypto.h
@@ -153,17 +153,17 @@ public:
class ResourceFormatLoaderCrypto : public ResourceFormatLoader {
public:
- virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE);
- virtual void get_recognized_extensions(List<String> *p_extensions) const;
- virtual bool handles_type(const String &p_type) const;
- virtual String get_resource_type(const String &p_path) const;
+ virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override;
+ virtual void get_recognized_extensions(List<String> *p_extensions) const override;
+ virtual bool handles_type(const String &p_type) const override;
+ virtual String get_resource_type(const String &p_path) const override;
};
class ResourceFormatSaverCrypto : public ResourceFormatSaver {
public:
- virtual Error save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags = 0);
- virtual void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const;
- virtual bool recognize(const Ref<Resource> &p_resource) const;
+ virtual Error save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags = 0) override;
+ virtual void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const override;
+ virtual bool recognize(const Ref<Resource> &p_resource) const override;
};
#endif // CRYPTO_H
diff --git a/core/extension/gdextension.h b/core/extension/gdextension.h
index a2b948a38a..2d0cb6a5ba 100644
--- a/core/extension/gdextension.h
+++ b/core/extension/gdextension.h
@@ -176,10 +176,10 @@ class GDExtensionResourceLoader : public ResourceFormatLoader {
public:
static Error load_gdextension_resource(const String &p_path, Ref<GDExtension> &p_extension);
- virtual Ref<Resource> load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE);
- virtual void get_recognized_extensions(List<String> *p_extensions) const;
- virtual bool handles_type(const String &p_type) const;
- virtual String get_resource_type(const String &p_path) const;
+ virtual Ref<Resource> load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override;
+ virtual void get_recognized_extensions(List<String> *p_extensions) const override;
+ virtual bool handles_type(const String &p_type) const override;
+ virtual String get_resource_type(const String &p_path) const override;
};
#ifdef TOOLS_ENABLED
diff --git a/core/input/input_builders.py b/core/input/input_builders.py
index eabdefe543..ae848f4e7c 100644
--- a/core/input/input_builders.py
+++ b/core/input/input_builders.py
@@ -13,7 +13,7 @@ def make_default_controller_mappings(target, source, env):
# ensure mappings have a consistent order
platform_mappings: dict = OrderedDict()
for src_path in source:
- with open(str(src_path), "r") as f:
+ with open(str(src_path), "r", encoding="utf-8") as f:
# read mapping file and skip header
mapping_file_lines = f.readlines()[2:]
diff --git a/core/io/image_loader.h b/core/io/image_loader.h
index e9b434522d..26af650344 100644
--- a/core/io/image_loader.h
+++ b/core/io/image_loader.h
@@ -103,10 +103,10 @@ public:
class ResourceFormatLoaderImage : public ResourceFormatLoader {
public:
- virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE);
- virtual void get_recognized_extensions(List<String> *p_extensions) const;
- virtual bool handles_type(const String &p_type) const;
- virtual String get_resource_type(const String &p_path) const;
+ virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override;
+ virtual void get_recognized_extensions(List<String> *p_extensions) const override;
+ virtual bool handles_type(const String &p_type) const override;
+ virtual String get_resource_type(const String &p_path) const override;
};
#endif // IMAGE_LOADER_H
diff --git a/core/io/json.h b/core/io/json.h
index a21cc542fd..801fa29b4b 100644
--- a/core/io/json.h
+++ b/core/io/json.h
@@ -98,17 +98,17 @@ public:
class ResourceFormatLoaderJSON : public ResourceFormatLoader {
public:
- virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE);
- virtual void get_recognized_extensions(List<String> *p_extensions) const;
- virtual bool handles_type(const String &p_type) const;
- virtual String get_resource_type(const String &p_path) const;
+ virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override;
+ virtual void get_recognized_extensions(List<String> *p_extensions) const override;
+ virtual bool handles_type(const String &p_type) const override;
+ virtual String get_resource_type(const String &p_path) const override;
};
class ResourceFormatSaverJSON : public ResourceFormatSaver {
public:
- virtual Error save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags = 0);
- virtual void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const;
- virtual bool recognize(const Ref<Resource> &p_resource) const;
+ virtual Error save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags = 0) override;
+ virtual void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const override;
+ virtual bool recognize(const Ref<Resource> &p_resource) const override;
};
#endif // JSON_H
diff --git a/core/io/resource_format_binary.h b/core/io/resource_format_binary.h
index e01c5fa467..222e633e58 100644
--- a/core/io/resource_format_binary.h
+++ b/core/io/resource_format_binary.h
@@ -110,16 +110,16 @@ public:
class ResourceFormatLoaderBinary : public ResourceFormatLoader {
public:
- virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE);
- virtual void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const;
- virtual void get_recognized_extensions(List<String> *p_extensions) const;
- virtual bool handles_type(const String &p_type) const;
- virtual String get_resource_type(const String &p_path) const;
- virtual String get_resource_script_class(const String &p_path) const;
- virtual void get_classes_used(const String &p_path, HashSet<StringName> *r_classes);
- virtual ResourceUID::ID get_resource_uid(const String &p_path) const;
- virtual void get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types = false);
- virtual Error rename_dependencies(const String &p_path, const HashMap<String, String> &p_map);
+ virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override;
+ virtual void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const override;
+ virtual void get_recognized_extensions(List<String> *p_extensions) const override;
+ virtual bool handles_type(const String &p_type) const override;
+ virtual String get_resource_type(const String &p_path) const override;
+ virtual String get_resource_script_class(const String &p_path) const override;
+ virtual void get_classes_used(const String &p_path, HashSet<StringName> *r_classes) override;
+ virtual ResourceUID::ID get_resource_uid(const String &p_path) const override;
+ virtual void get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types = false) override;
+ virtual Error rename_dependencies(const String &p_path, const HashMap<String, String> &p_map) override;
};
class ResourceFormatSaverBinaryInstance {
@@ -181,10 +181,10 @@ public:
class ResourceFormatSaverBinary : public ResourceFormatSaver {
public:
static ResourceFormatSaverBinary *singleton;
- virtual Error save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags = 0);
- virtual Error set_uid(const String &p_path, ResourceUID::ID p_uid);
- virtual bool recognize(const Ref<Resource> &p_resource) const;
- virtual void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const;
+ virtual Error save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags = 0) override;
+ virtual Error set_uid(const String &p_path, ResourceUID::ID p_uid) override;
+ virtual bool recognize(const Ref<Resource> &p_resource) const override;
+ virtual void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const override;
ResourceFormatSaverBinary();
};
diff --git a/core/io/resource_importer.h b/core/io/resource_importer.h
index e17644058a..dbd9e70d16 100644
--- a/core/io/resource_importer.h
+++ b/core/io/resource_importer.h
@@ -59,22 +59,22 @@ class ResourceFormatImporter : public ResourceFormatLoader {
public:
static ResourceFormatImporter *get_singleton() { return singleton; }
- virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE);
- virtual void get_recognized_extensions(List<String> *p_extensions) const;
- virtual void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const;
- virtual bool recognize_path(const String &p_path, const String &p_for_type = String()) const;
- virtual bool handles_type(const String &p_type) const;
- virtual String get_resource_type(const String &p_path) const;
- virtual ResourceUID::ID get_resource_uid(const String &p_path) const;
+ virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override;
+ virtual void get_recognized_extensions(List<String> *p_extensions) const override;
+ virtual void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const override;
+ virtual bool recognize_path(const String &p_path, const String &p_for_type = String()) const override;
+ virtual bool handles_type(const String &p_type) const override;
+ virtual String get_resource_type(const String &p_path) const override;
+ virtual ResourceUID::ID get_resource_uid(const String &p_path) const override;
virtual Variant get_resource_metadata(const String &p_path) const;
- virtual bool is_import_valid(const String &p_path) const;
- virtual void get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types = false);
- virtual bool is_imported(const String &p_path) const { return recognize_path(p_path); }
- virtual String get_import_group_file(const String &p_path) const;
- virtual void get_classes_used(const String &p_path, HashSet<StringName> *r_classes);
- virtual bool exists(const String &p_path) const;
-
- virtual int get_import_order(const String &p_path) const;
+ virtual bool is_import_valid(const String &p_path) const override;
+ virtual void get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types = false) override;
+ virtual bool is_imported(const String &p_path) const override { return recognize_path(p_path); }
+ virtual String get_import_group_file(const String &p_path) const override;
+ virtual void get_classes_used(const String &p_path, HashSet<StringName> *r_classes) override;
+ virtual bool exists(const String &p_path) const override;
+
+ virtual int get_import_order(const String &p_path) const override;
Error get_import_order_threads_and_importer(const String &p_path, int &r_order, bool &r_can_threads, String &r_importer) const;
diff --git a/core/io/translation_loader_po.h b/core/io/translation_loader_po.h
index 16e7c28cbe..a695826e59 100644
--- a/core/io/translation_loader_po.h
+++ b/core/io/translation_loader_po.h
@@ -38,10 +38,10 @@
class TranslationLoaderPO : public ResourceFormatLoader {
public:
static Ref<Resource> load_translation(Ref<FileAccess> f, Error *r_error = nullptr);
- virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE);
- virtual void get_recognized_extensions(List<String> *p_extensions) const;
- virtual bool handles_type(const String &p_type) const;
- virtual String get_resource_type(const String &p_path) const;
+ virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override;
+ virtual void get_recognized_extensions(List<String> *p_extensions) const override;
+ virtual bool handles_type(const String &p_type) const override;
+ virtual String get_resource_type(const String &p_path) const override;
TranslationLoaderPO() {}
};
diff --git a/core/string/ustring.cpp b/core/string/ustring.cpp
index 93a08fd8b5..bdef1b9bbe 100644
--- a/core/string/ustring.cpp
+++ b/core/string/ustring.cpp
@@ -1043,12 +1043,11 @@ signed char String::naturalnocasecmp_to(const String &p_str) const {
static _FORCE_INLINE_ signed char file_cmp_common(const char32_t *&r_this_str, const char32_t *&r_that_str) {
// Compare leading `_` sequences.
- while (*r_this_str && *r_that_str) {
+ while ((*r_this_str == '_' && *r_that_str) || (*r_this_str && *r_that_str == '_')) {
// Sort `_` lower than everything except `.`
- if (*r_this_str != '_' && *r_that_str == '_') {
+ if (*r_this_str != '_') {
return *r_this_str == '.' ? -1 : 1;
- }
- if (*r_this_str == '_' && *r_that_str != '_') {
+ } else if (*r_that_str != '_') {
return *r_that_str == '.' ? 1 : -1;
}
r_this_str++;
diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml
index 697afed636..cc32964e87 100644
--- a/doc/classes/Control.xml
+++ b/doc/classes/Control.xml
@@ -1182,6 +1182,14 @@
- One of the node's theme property overrides is changed.
- The node enters the scene tree.
[b]Note:[/b] As an optimization, this notification won't be sent from changes that occur while this node is outside of the scene tree. Instead, all of the theme item updates can be applied at once when the node enters the scene tree.
+ [b]Note:[/b] This notification is received alongside [constant Node.NOTIFICATION_ENTER_TREE], so if you are instantiating a scene, the child nodes will not be initialized yet. You can use it to setup theming for this node, child nodes created from script, or if you want to access child nodes added in the editor, make sure the node is ready using [method Node.is_node_ready].
+ [codeblock]
+ func _notification(what):
+ if what == NOTIFICATION_THEME_CHANGED:
+ if not is_node_ready():
+ await ready # Wait until ready signal.
+ $Label.add_theme_color_override("font_color", Color.YELLOW)
+ [/codeblock]
</constant>
<constant name="NOTIFICATION_SCROLL_BEGIN" value="47">
Sent when this node is inside a [ScrollContainer] which has begun being scrolled when dragging the scrollable area [i]with a touch event[/i]. This notification is [i]not[/i] sent when scrolling by dragging the scrollbar, scrolling with the mouse wheel or scrolling with keyboard/gamepad events.
diff --git a/doc/classes/DisplayServer.xml b/doc/classes/DisplayServer.xml
index ecb8438edb..ae0dc53f5d 100644
--- a/doc/classes/DisplayServer.xml
+++ b/doc/classes/DisplayServer.xml
@@ -553,7 +553,7 @@
<param index="0" name="menu_root" type="String" />
<param index="1" name="tag" type="Variant" />
<description>
- Returns the index of the item with the specified [param tag]. Index is automatically assigned to each item by the engine. Index can not be set manually.
+ Returns the index of the item with the specified [param tag]. Indices are automatically assigned to each item by the engine, and cannot be set manually.
[b]Note:[/b] This method is implemented only on macOS.
</description>
</method>
@@ -562,7 +562,7 @@
<param index="0" name="menu_root" type="String" />
<param index="1" name="text" type="String" />
<description>
- Returns the index of the item with the specified [param text]. Index is automatically assigned to each item by the engine. Index can not be set manually.
+ Returns the index of the item with the specified [param text]. Indices are automatically assigned to each item by the engine, and cannot be set manually.
[b]Note:[/b] This method is implemented only on macOS.
</description>
</method>
diff --git a/doc/classes/NativeMenu.xml b/doc/classes/NativeMenu.xml
index cfe3f3f5c5..475874dee7 100644
--- a/doc/classes/NativeMenu.xml
+++ b/doc/classes/NativeMenu.xml
@@ -211,12 +211,21 @@
[b]Note:[/b] This method is implemented on macOS and Windows.
</description>
</method>
+ <method name="find_item_index_with_submenu" qualifiers="const">
+ <return type="int" />
+ <param index="0" name="rid" type="RID" />
+ <param index="1" name="submenu_rid" type="RID" />
+ <description>
+ Returns the index of the item with the submenu specified by [param submenu_rid]. Indices are automatically assigned to each item by the engine, and cannot be set manually.
+ [b]Note:[/b] This method is implemented on macOS and Windows.
+ </description>
+ </method>
<method name="find_item_index_with_tag" qualifiers="const">
<return type="int" />
<param index="0" name="rid" type="RID" />
<param index="1" name="tag" type="Variant" />
<description>
- Returns the index of the item with the specified [param tag]. Index is automatically assigned to each item by the engine. Index can not be set manually.
+ Returns the index of the item with the specified [param tag]. Indices are automatically assigned to each item by the engine, and cannot be set manually.
[b]Note:[/b] This method is implemented on macOS and Windows.
</description>
</method>
@@ -225,7 +234,7 @@
<param index="0" name="rid" type="RID" />
<param index="1" name="text" type="String" />
<description>
- Returns the index of the item with the specified [param text]. Index is automatically assigned to each item by the engine. Index can not be set manually.
+ Returns the index of the item with the specified [param text]. Indices are automatically assigned to each item by the engine, and cannot be set manually.
[b]Note:[/b] This method is implemented on macOS and Windows.
</description>
</method>
diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml
index c69e5edf0c..1ddcdce439 100644
--- a/doc/classes/Node.xml
+++ b/doc/classes/Node.xml
@@ -187,7 +187,7 @@
<param index="0" name="message" type="String" />
<param index="1" name="context" type="StringName" default="&quot;&quot;" />
<description>
- Translates a [param message], using the translation catalogs configured in the Project Settings. Further [param context] can be specified to help with the translation.
+ Translates a [param message], using the translation catalogs configured in the Project Settings. Further [param context] can be specified to help with the translation. Note that most [Control] nodes automatically translate their strings, so this method is mostly useful for formatted strings or custom drawn text.
This method works the same as [method Object.tr], with the addition of respecting the [member auto_translate_mode] state.
If [method Object.can_translate_messages] is [code]false[/code], or no translation is available, this method returns the [param message] without changes. See [method Object.set_message_translation].
For detailed examples, see [url=$DOCS_URL/tutorials/i18n/internationalizing_games.html]Internationalizing games[/url].
@@ -1201,7 +1201,15 @@
Implemented only on iOS.
</constant>
<constant name="NOTIFICATION_TRANSLATION_CHANGED" value="2010">
- Notification received when translations may have changed. Can be triggered by the user changing the locale. Can be used to respond to language changes, for example to change the UI strings on the fly. Useful when working with the built-in translation support, like [method Object.tr].
+ Notification received when translations may have changed. Can be triggered by the user changing the locale, changing [member auto_translate_mode] or when the node enters the scene tree. Can be used to respond to language changes, for example to change the UI strings on the fly. Useful when working with the built-in translation support, like [method Object.tr].
+ [b]Note:[/b] This notification is received alongside [constant NOTIFICATION_ENTER_TREE], so if you are instantiating a scene, the child nodes will not be initialized yet. You can use it to setup translations for this node, child nodes created from script, or if you want to access child nodes added in the editor, make sure the node is ready using [method is_node_ready].
+ [codeblock]
+ func _notification(what):
+ if what == NOTIFICATION_TRANSLATION_CHANGED:
+ if not is_node_ready():
+ await ready # Wait until ready signal.
+ $Label.text = atr("%d Bananas") % banana_counter
+ [/codeblock]
</constant>
<constant name="NOTIFICATION_WM_ABOUT" value="2011">
Notification received from the OS when a request for "About" information is sent.
diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml
index 85b9cf16f2..b69326b6e0 100644
--- a/doc/classes/Object.xml
+++ b/doc/classes/Object.xml
@@ -1024,7 +1024,7 @@
<param index="0" name="message" type="StringName" />
<param index="1" name="context" type="StringName" default="&amp;&quot;&quot;" />
<description>
- Translates a [param message], using the translation catalogs configured in the Project Settings. Further [param context] can be specified to help with the translation.
+ Translates a [param message], using the translation catalogs configured in the Project Settings. Further [param context] can be specified to help with the translation. Note that most [Control] nodes automatically translate their strings, so this method is mostly useful for formatted strings or custom drawn text.
If [method can_translate_messages] is [code]false[/code], or no translation is available, this method returns the [param message] without changes. See [method set_message_translation].
For detailed examples, see [url=$DOCS_URL/tutorials/i18n/internationalizing_games.html]Internationalizing games[/url].
</description>
diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml
index 13d84d96d6..dcc817427b 100644
--- a/doc/classes/Viewport.xml
+++ b/doc/classes/Viewport.xml
@@ -497,10 +497,16 @@
Represents the size of the [enum RenderInfo] enum.
</constant>
<constant name="RENDER_INFO_TYPE_VISIBLE" value="0" enum="RenderInfoType">
+ Visible render pass (excluding shadows).
</constant>
<constant name="RENDER_INFO_TYPE_SHADOW" value="1" enum="RenderInfoType">
+ Shadow render pass. Objects will be rendered several times depending on the number of amounts of lights with shadows and the number of directional shadow splits.
</constant>
- <constant name="RENDER_INFO_TYPE_MAX" value="2" enum="RenderInfoType">
+ <constant name="RENDER_INFO_TYPE_CANVAS" value="2" enum="RenderInfoType">
+ Canvas item rendering. This includes all 2D rendering.
+ </constant>
+ <constant name="RENDER_INFO_TYPE_MAX" value="3" enum="RenderInfoType">
+ Represents the size of the [enum RenderInfoType] enum.
</constant>
<constant name="DEBUG_DRAW_DISABLED" value="0" enum="DebugDraw">
Objects are displayed normally.
diff --git a/drivers/png/resource_saver_png.h b/drivers/png/resource_saver_png.h
index 2193b4a39b..2c24008074 100644
--- a/drivers/png/resource_saver_png.h
+++ b/drivers/png/resource_saver_png.h
@@ -39,9 +39,9 @@ public:
static Error save_image(const String &p_path, const Ref<Image> &p_img);
static Vector<uint8_t> save_image_to_buffer(const Ref<Image> &p_img);
- virtual Error save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags = 0);
- virtual bool recognize(const Ref<Resource> &p_resource) const;
- virtual void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const;
+ virtual Error save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags = 0) override;
+ virtual bool recognize(const Ref<Resource> &p_resource) const override;
+ virtual void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const override;
ResourceSaverPNG();
};
diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp
index 2d3f1a5b90..3bddc91b81 100644
--- a/editor/find_in_files.cpp
+++ b/editor/find_in_files.cpp
@@ -566,6 +566,7 @@ void FindInFilesDialog::_bind_methods() {
//-----------------------------------------------------------------------------
const char *FindInFilesPanel::SIGNAL_RESULT_SELECTED = "result_selected";
const char *FindInFilesPanel::SIGNAL_FILES_MODIFIED = "files_modified";
+const char *FindInFilesPanel::SIGNAL_CLOSE_BUTTON_CLICKED = "close_button_clicked";
FindInFilesPanel::FindInFilesPanel() {
_finder = memnew(FindInFiles);
@@ -611,6 +612,11 @@ FindInFilesPanel::FindInFilesPanel() {
_cancel_button->hide();
hbc->add_child(_cancel_button);
+ _close_button = memnew(Button);
+ _close_button->set_text(TTR("Close"));
+ _close_button->connect("pressed", callable_mp(this, &FindInFilesPanel::_on_close_button_clicked));
+ hbc->add_child(_close_button);
+
vbc->add_child(hbc);
}
@@ -843,6 +849,10 @@ void FindInFilesPanel::_on_cancel_button_clicked() {
stop_search();
}
+void FindInFilesPanel::_on_close_button_clicked() {
+ emit_signal(SNAME(SIGNAL_CLOSE_BUTTON_CLICKED));
+}
+
void FindInFilesPanel::_on_result_selected() {
TreeItem *item = _results_display->get_selected();
HashMap<TreeItem *, Result>::Iterator E = _result_items.find(item);
@@ -1010,4 +1020,6 @@ void FindInFilesPanel::_bind_methods() {
PropertyInfo(Variant::INT, "end")));
ADD_SIGNAL(MethodInfo(SIGNAL_FILES_MODIFIED, PropertyInfo(Variant::STRING, "paths")));
+
+ ADD_SIGNAL(MethodInfo(SIGNAL_CLOSE_BUTTON_CLICKED));
}
diff --git a/editor/find_in_files.h b/editor/find_in_files.h
index 7885931514..ac336b4e35 100644
--- a/editor/find_in_files.h
+++ b/editor/find_in_files.h
@@ -159,6 +159,7 @@ class FindInFilesPanel : public Control {
public:
static const char *SIGNAL_RESULT_SELECTED;
static const char *SIGNAL_FILES_MODIFIED;
+ static const char *SIGNAL_CLOSE_BUTTON_CLICKED;
FindInFilesPanel();
@@ -180,6 +181,7 @@ private:
void _on_finished();
void _on_refresh_button_clicked();
void _on_cancel_button_clicked();
+ void _on_close_button_clicked();
void _on_result_selected();
void _on_item_edited();
void _on_replace_text_changed(const String &text);
@@ -207,6 +209,7 @@ private:
Label *_status_label = nullptr;
Button *_refresh_button = nullptr;
Button *_cancel_button = nullptr;
+ Button *_close_button = nullptr;
ProgressBar *_progress_bar = nullptr;
HashMap<String, TreeItem *> _file_items;
HashMap<TreeItem *, Result> _result_items;
diff --git a/editor/plugins/debugger_editor_plugin.cpp b/editor/plugins/debugger_editor_plugin.cpp
index 2dc43098f7..edd0ddbdad 100644
--- a/editor/plugins/debugger_editor_plugin.cpp
+++ b/editor/plugins/debugger_editor_plugin.cpp
@@ -77,10 +77,10 @@ DebuggerEditorPlugin::DebuggerEditorPlugin(PopupMenu *p_debug_menu) {
TTR("When this option is enabled, curve resources used by path nodes will be visible in the running project."));
debug_menu->add_check_shortcut(ED_SHORTCUT("editor/visible_navigation", TTR("Visible Navigation")), RUN_DEBUG_NAVIGATION);
debug_menu->set_item_tooltip(-1,
- TTR("When this option is enabled, navigation meshes and polygons will be visible in the running project."));
+ TTR("When this option is enabled, navigation meshes, and polygons will be visible in the running project."));
debug_menu->add_check_shortcut(ED_SHORTCUT("editor/visible_avoidance", TTR("Visible Avoidance")), RUN_DEBUG_AVOIDANCE);
debug_menu->set_item_tooltip(-1,
- TTR("When this option is enabled, avoidance objects shapes, radius and velocities will be visible in the running project."));
+ TTR("When this option is enabled, avoidance object shapes, radiuses, and velocities will be visible in the running project."));
debug_menu->add_separator();
debug_menu->add_check_shortcut(ED_SHORTCUT("editor/visible_canvas_redraw", TTR("Debug CanvasItem Redraws")), RUN_DEBUG_CANVAS_REDRAW);
debug_menu->set_item_tooltip(-1,
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 9121ca09b4..6f1eef62de 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -1716,18 +1716,6 @@ void ScriptEditor::_notification(int p_what) {
_test_script_times_on_disk();
_update_modified_scripts_for_external_editor();
} break;
-
- case CanvasItem::NOTIFICATION_VISIBILITY_CHANGED: {
- if (is_visible()) {
- find_in_files_button->show();
- } else {
- if (find_in_files->is_visible_in_tree()) {
- EditorNode::get_bottom_panel()->hide_bottom_panel();
- }
- find_in_files_button->hide();
- }
-
- } break;
}
}
@@ -3776,6 +3764,7 @@ void ScriptEditor::_on_find_in_files_result_selected(const String &fpath, int li
ScriptTextEditor *ste = Object::cast_to<ScriptTextEditor>(_get_current_editor());
if (ste) {
+ EditorInterface::get_singleton()->set_main_screen_editor("Script");
ste->goto_line_selection(line_number, begin, end);
}
}
@@ -3790,6 +3779,7 @@ void ScriptEditor::_on_find_in_files_result_selected(const String &fpath, int li
ScriptTextEditor *ste = Object::cast_to<ScriptTextEditor>(_get_current_editor());
if (ste) {
+ EditorInterface::get_singleton()->set_main_screen_editor("Script");
ste->goto_line_selection(line_number - 1, begin, end);
}
return;
@@ -3823,6 +3813,13 @@ void ScriptEditor::_start_find_in_files(bool with_replace) {
find_in_files->set_replace_text(find_in_files_dialog->get_replace_text());
find_in_files->start_search();
+ if (find_in_files_button->get_index() != find_in_files_button->get_parent()->get_child_count()) {
+ find_in_files_button->get_parent()->move_child(find_in_files_button, -1);
+ }
+ if (!find_in_files_button->is_visible()) {
+ find_in_files_button->show();
+ }
+
EditorNode::get_bottom_panel()->make_item_visible(find_in_files);
}
@@ -3849,6 +3846,11 @@ void ScriptEditor::_set_zoom_factor(float p_zoom_factor) {
}
}
+void ScriptEditor::_on_find_in_files_close_button_clicked() {
+ EditorNode::get_bottom_panel()->hide_bottom_panel();
+ find_in_files_button->hide();
+}
+
void ScriptEditor::_window_changed(bool p_visible) {
make_floating->set_visible(!p_visible);
is_floating = p_visible;
@@ -4203,6 +4205,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) {
find_in_files->set_custom_minimum_size(Size2(0, 200) * EDSCALE);
find_in_files->connect(FindInFilesPanel::SIGNAL_RESULT_SELECTED, callable_mp(this, &ScriptEditor::_on_find_in_files_result_selected));
find_in_files->connect(FindInFilesPanel::SIGNAL_FILES_MODIFIED, callable_mp(this, &ScriptEditor::_on_find_in_files_modified_files));
+ find_in_files->connect(FindInFilesPanel::SIGNAL_CLOSE_BUTTON_CLICKED, callable_mp(this, &ScriptEditor::_on_find_in_files_close_button_clicked));
find_in_files->hide();
find_in_files_button->hide();
diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h
index d5c33c73b4..4fff724866 100644
--- a/editor/plugins/script_editor_plugin.h
+++ b/editor/plugins/script_editor_plugin.h
@@ -496,6 +496,7 @@ class ScriptEditor : public PanelContainer {
void _on_find_in_files_result_selected(const String &fpath, int line_number, int begin, int end);
void _start_find_in_files(bool with_replace);
void _on_find_in_files_modified_files(const PackedStringArray &paths);
+ void _on_find_in_files_close_button_clicked();
void _set_zoom_factor(float p_zoom_factor);
diff --git a/gles3_builders.py b/gles3_builders.py
index 985e9d547c..cf7c74f32d 100644
--- a/gles3_builders.py
+++ b/gles3_builders.py
@@ -31,7 +31,7 @@ class GLES3HeaderStruct:
def include_file_in_gles3_header(filename: str, header_data: GLES3HeaderStruct, depth: int):
- with open(filename, "r") as fs:
+ with open(filename, "r", encoding="utf-8") as fs:
line = fs.readline()
while line:
diff --git a/glsl_builders.py b/glsl_builders.py
index fd90e9a6c0..5a17e3ca7f 100644
--- a/glsl_builders.py
+++ b/glsl_builders.py
@@ -38,7 +38,7 @@ class RDHeaderStruct:
def include_file_in_rd_header(filename: str, header_data: RDHeaderStruct, depth: int) -> RDHeaderStruct:
- with open(filename, "r") as fs:
+ with open(filename, "r", encoding="utf-8") as fs:
line = fs.readline()
while line:
@@ -172,7 +172,7 @@ class RAWHeaderStruct:
def include_file_in_raw_header(filename: str, header_data: RAWHeaderStruct, depth: int) -> None:
- with open(filename, "r") as fs:
+ with open(filename, "r", encoding="utf-8") as fs:
line = fs.readline()
while line:
diff --git a/methods.py b/methods.py
index 5aa34888eb..c0d129f93e 100644
--- a/methods.py
+++ b/methods.py
@@ -179,7 +179,7 @@ def get_version_info(module_version_string="", silent=False):
gitfolder = ".git"
if os.path.isfile(".git"):
- with open(".git", "r") as file:
+ with open(".git", "r", encoding="utf-8") as file:
module_folder = file.readline().strip()
if module_folder.startswith("gitdir: "):
gitfolder = module_folder[8:]
@@ -196,12 +196,12 @@ def get_version_info(module_version_string="", silent=False):
head = os.path.join(gitfolder, ref)
packedrefs = os.path.join(gitfolder, "packed-refs")
if os.path.isfile(head):
- with open(head, "r") as file:
+ with open(head, "r", encoding="utf-8") as file:
githash = file.readline().strip()
elif os.path.isfile(packedrefs):
# Git may pack refs into a single file. This code searches .git/packed-refs file for the current ref's hash.
# https://mirrors.edge.kernel.org/pub/software/scm/git/docs/git-pack-refs.html
- for line in open(packedrefs, "r").read().splitlines():
+ for line in open(packedrefs, "r", encoding="utf-8").read().splitlines():
if line.startswith("#"):
continue
(line_hash, line_ref) = line.split(" ")
@@ -270,7 +270,7 @@ const uint64_t VERSION_TIMESTAMP = {git_timestamp};
def parse_cg_file(fname, uniforms, sizes, conditionals):
- with open(fname, "r") as fs:
+ with open(fname, "r", encoding="utf-8") as fs:
line = fs.readline()
while line:
@@ -1243,7 +1243,7 @@ def generate_vs_project(env, original_args, project_name="godot"):
).hexdigest()
if os.path.exists(f"{project_name}.vcxproj.filters"):
- with open(f"{project_name}.vcxproj.filters", "r") as file:
+ with open(f"{project_name}.vcxproj.filters", "r", encoding="utf-8") as file:
existing_filters = file.read()
match = re.search(r"(?ms)^<!-- CHECKSUM$.([0-9a-f]{32})", existing_filters)
if match is not None and md5 == match.group(1):
@@ -1255,7 +1255,7 @@ def generate_vs_project(env, original_args, project_name="godot"):
if not skip_filters:
print(f"Regenerating {project_name}.vcxproj.filters")
- with open("misc/msvs/vcxproj.filters.template", "r") as file:
+ with open("misc/msvs/vcxproj.filters.template", "r", encoding="utf-8") as file:
filters_template = file.read()
for i in range(1, 10):
filters_template = filters_template.replace(f"%%UUID{i}%%", str(uuid.uuid4()))
@@ -1409,7 +1409,7 @@ def generate_vs_project(env, original_args, project_name="godot"):
)
output = f'bin\\godot{env["PROGSUFFIX"]}'
- with open("misc/msvs/props.template", "r") as file:
+ with open("misc/msvs/props.template", "r", encoding="utf-8") as file:
props_template = file.read()
props_template = props_template.replace("%%VSCONF%%", vsconf)
@@ -1478,7 +1478,7 @@ def generate_vs_project(env, original_args, project_name="godot"):
sln_uuid = str(uuid.uuid4())
if os.path.exists(f"{project_name}.sln"):
- for line in open(f"{project_name}.sln", "r").read().splitlines():
+ for line in open(f"{project_name}.sln", "r", encoding="utf-8").read().splitlines():
if line.startswith('Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}")'):
proj_uuid = re.search(
r"\"{(\b[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-\b[0-9a-fA-F]{12}\b)}\"$",
@@ -1567,7 +1567,7 @@ def generate_vs_project(env, original_args, project_name="godot"):
section2 = sorted(section2)
if not get_bool(original_args, "vsproj_props_only", False):
- with open("misc/msvs/vcxproj.template", "r") as file:
+ with open("misc/msvs/vcxproj.template", "r", encoding="utf-8") as file:
proj_template = file.read()
proj_template = proj_template.replace("%%UUID%%", proj_uuid)
proj_template = proj_template.replace("%%CONFS%%", "\n ".join(configurations))
@@ -1579,7 +1579,7 @@ def generate_vs_project(env, original_args, project_name="godot"):
f.write(proj_template)
if not get_bool(original_args, "vsproj_props_only", False):
- with open("misc/msvs/sln.template", "r") as file:
+ with open("misc/msvs/sln.template", "r", encoding="utf-8") as file:
sln_template = file.read()
sln_template = sln_template.replace("%%NAME%%", project_name)
sln_template = sln_template.replace("%%UUID%%", proj_uuid)
diff --git a/misc/scripts/check_ci_log.py b/misc/scripts/check_ci_log.py
index d979d373de..d024a3e375 100755
--- a/misc/scripts/check_ci_log.py
+++ b/misc/scripts/check_ci_log.py
@@ -9,7 +9,7 @@ if len(sys.argv) < 2:
fname = sys.argv[1]
-with open(fname.strip(), "r") as fileread:
+with open(fname.strip(), "r", encoding="utf-8") as fileread:
file_contents = fileread.read()
# If find "ERROR: AddressSanitizer:", then happens invalid read or write
diff --git a/misc/scripts/copyright_headers.py b/misc/scripts/copyright_headers.py
index 82a4477cc0..169795921f 100755
--- a/misc/scripts/copyright_headers.py
+++ b/misc/scripts/copyright_headers.py
@@ -69,7 +69,7 @@ for f in sys.argv[1:]:
# In a second pass, we skip all consecutive comment lines starting with "/*",
# then we can append the rest (step 2).
- with open(fname.strip(), "r") as fileread:
+ with open(fname.strip(), "r", encoding="utf-8") as fileread:
line = fileread.readline()
header_done = False
diff --git a/modules/dds/texture_loader_dds.h b/modules/dds/texture_loader_dds.h
index 3763700ff1..ce5b7f4045 100644
--- a/modules/dds/texture_loader_dds.h
+++ b/modules/dds/texture_loader_dds.h
@@ -35,10 +35,10 @@
class ResourceFormatDDS : public ResourceFormatLoader {
public:
- virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE);
- virtual void get_recognized_extensions(List<String> *p_extensions) const;
- virtual bool handles_type(const String &p_type) const;
- virtual String get_resource_type(const String &p_path) const;
+ virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override;
+ virtual void get_recognized_extensions(List<String> *p_extensions) const override;
+ virtual bool handles_type(const String &p_type) const override;
+ virtual String get_resource_type(const String &p_path) const override;
virtual ~ResourceFormatDDS() {}
};
diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h
index fd5ad837f9..781e284bfc 100644
--- a/modules/gdscript/gdscript.h
+++ b/modules/gdscript/gdscript.h
@@ -629,18 +629,18 @@ public:
class ResourceFormatLoaderGDScript : public ResourceFormatLoader {
public:
- virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE);
- virtual void get_recognized_extensions(List<String> *p_extensions) const;
- virtual bool handles_type(const String &p_type) const;
- virtual String get_resource_type(const String &p_path) const;
- virtual void get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types = false);
+ virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override;
+ virtual void get_recognized_extensions(List<String> *p_extensions) const override;
+ virtual bool handles_type(const String &p_type) const override;
+ virtual String get_resource_type(const String &p_path) const override;
+ virtual void get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types = false) override;
};
class ResourceFormatSaverGDScript : public ResourceFormatSaver {
public:
- virtual Error save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags = 0);
- virtual void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const;
- virtual bool recognize(const Ref<Resource> &p_resource) const;
+ virtual Error save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags = 0) override;
+ virtual void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const override;
+ virtual bool recognize(const Ref<Resource> &p_resource) const override;
};
#endif // GDSCRIPT_H
diff --git a/modules/ktx/texture_loader_ktx.h b/modules/ktx/texture_loader_ktx.h
index 0ea676be6b..0de458a742 100644
--- a/modules/ktx/texture_loader_ktx.h
+++ b/modules/ktx/texture_loader_ktx.h
@@ -36,10 +36,10 @@
class ResourceFormatKTX : public ResourceFormatLoader {
public:
- virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE);
- virtual void get_recognized_extensions(List<String> *p_extensions) const;
- virtual bool handles_type(const String &p_type) const;
- virtual String get_resource_type(const String &p_path) const;
+ virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override;
+ virtual void get_recognized_extensions(List<String> *p_extensions) const override;
+ virtual bool handles_type(const String &p_type) const override;
+ virtual String get_resource_type(const String &p_path) const override;
virtual ~ResourceFormatKTX() {}
ResourceFormatKTX();
diff --git a/modules/raycast/godot_update_embree.py b/modules/raycast/godot_update_embree.py
index 0e62824adc..f7af937c8b 100644
--- a/modules/raycast/godot_update_embree.py
+++ b/modules/raycast/godot_update_embree.py
@@ -187,7 +187,7 @@ with open(os.path.join(dest_dir, "kernels/config.h"), "w", encoding="utf-8", new
)
-with open("CMakeLists.txt", "r") as cmake_file:
+with open("CMakeLists.txt", "r", encoding="utf-8") as cmake_file:
cmake_content = cmake_file.read()
major_version = int(re.compile(r"EMBREE_VERSION_MAJOR\s(\d+)").findall(cmake_content)[0])
minor_version = int(re.compile(r"EMBREE_VERSION_MINOR\s(\d+)").findall(cmake_content)[0])
diff --git a/modules/theora/video_stream_theora.h b/modules/theora/video_stream_theora.h
index 21d4caef45..1e7fd088cc 100644
--- a/modules/theora/video_stream_theora.h
+++ b/modules/theora/video_stream_theora.h
@@ -173,10 +173,10 @@ public:
class ResourceFormatLoaderTheora : public ResourceFormatLoader {
public:
- virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE);
- virtual void get_recognized_extensions(List<String> *p_extensions) const;
- virtual bool handles_type(const String &p_type) const;
- virtual String get_resource_type(const String &p_path) const;
+ virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override;
+ virtual void get_recognized_extensions(List<String> *p_extensions) const override;
+ virtual bool handles_type(const String &p_type) const override;
+ virtual String get_resource_type(const String &p_path) const override;
};
#endif // VIDEO_STREAM_THEORA_H
diff --git a/modules/webp/resource_saver_webp.h b/modules/webp/resource_saver_webp.h
index 5546c69e6d..65cd4377db 100644
--- a/modules/webp/resource_saver_webp.h
+++ b/modules/webp/resource_saver_webp.h
@@ -39,9 +39,9 @@ public:
static Error save_image(const String &p_path, const Ref<Image> &p_img, const bool p_lossy = false, const float p_quality = 0.75f);
static Vector<uint8_t> save_image_to_buffer(const Ref<Image> &p_img, const bool p_lossy = false, const float p_quality = 0.75f);
- virtual Error save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags = 0);
- virtual bool recognize(const Ref<Resource> &p_resource) const;
- virtual void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const;
+ virtual Error save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags = 0) override;
+ virtual bool recognize(const Ref<Resource> &p_resource) const override;
+ virtual void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const override;
ResourceSaverWebP();
};
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp
index 40ac87160c..c344272f38 100644
--- a/scene/gui/file_dialog.cpp
+++ b/scene/gui/file_dialog.cpp
@@ -197,15 +197,15 @@ void FileDialog::_notification(int p_what) {
dir_up->end_bulk_theme_override();
dir_prev->begin_bulk_theme_override();
- dir_prev->add_theme_color_override("icon_color_normal", theme_cache.icon_normal_color);
- dir_prev->add_theme_color_override("icon_color_hover", theme_cache.icon_hover_color);
+ dir_prev->add_theme_color_override("icon_normal_color", theme_cache.icon_normal_color);
+ dir_prev->add_theme_color_override("icon_hover_color", theme_cache.icon_hover_color);
dir_prev->add_theme_color_override("icon_focus_color", theme_cache.icon_focus_color);
dir_prev->add_theme_color_override("icon_color_pressed", theme_cache.icon_pressed_color);
dir_prev->end_bulk_theme_override();
dir_next->begin_bulk_theme_override();
- dir_next->add_theme_color_override("icon_color_normal", theme_cache.icon_normal_color);
- dir_next->add_theme_color_override("icon_color_hover", theme_cache.icon_hover_color);
+ dir_next->add_theme_color_override("icon_normal_color", theme_cache.icon_normal_color);
+ dir_next->add_theme_color_override("icon_hover_color", theme_cache.icon_hover_color);
dir_next->add_theme_color_override("icon_focus_color", theme_cache.icon_focus_color);
dir_next->add_theme_color_override("icon_color_pressed", theme_cache.icon_pressed_color);
dir_next->end_bulk_theme_override();
diff --git a/scene/gui/menu_bar.cpp b/scene/gui/menu_bar.cpp
index 8eb455d0ac..2ce12794a7 100644
--- a/scene/gui/menu_bar.cpp
+++ b/scene/gui/menu_bar.cpp
@@ -236,12 +236,12 @@ void MenuBar::bind_global_menu() {
RID submenu_rid = popups[i]->bind_global_menu();
if (!popups[i]->is_system_menu()) {
int index = nmenu->add_submenu_item(main_menu, menu_cache[i].name, submenu_rid, global_menu_tag + "#" + itos(i), global_start_idx + i);
- menu_cache.write[i].global_index = index;
+ menu_cache.write[i].submenu_rid = submenu_rid;
nmenu->set_item_hidden(main_menu, index, menu_cache[i].hidden);
nmenu->set_item_disabled(main_menu, index, menu_cache[i].disabled);
nmenu->set_item_tooltip(main_menu, index, menu_cache[i].tooltip);
} else {
- menu_cache.write[i].global_index = -1;
+ menu_cache.write[i].submenu_rid = RID();
}
}
}
@@ -257,11 +257,14 @@ void MenuBar::unbind_global_menu() {
Vector<PopupMenu *> popups = _get_popups();
for (int i = menu_cache.size() - 1; i >= 0; i--) {
if (!popups[i]->is_system_menu()) {
- popups[i]->unbind_global_menu();
- if (menu_cache[i].global_index >= 0) {
- nmenu->remove_item(main_menu, menu_cache[i].global_index);
+ if (menu_cache[i].submenu_rid.is_valid()) {
+ int item_idx = nmenu->find_item_index_with_submenu(main_menu, menu_cache[i].submenu_rid);
+ if (item_idx >= 0) {
+ nmenu->remove_item(main_menu, item_idx);
+ }
}
- menu_cache.write[i].global_index = -1;
+ popups[i]->unbind_global_menu();
+ menu_cache.write[i].submenu_rid = RID();
}
}
@@ -292,8 +295,11 @@ void MenuBar::_notification(int p_what) {
RID main_menu = is_global ? nmenu->get_system_menu(NativeMenu::MAIN_MENU_ID) : RID();
for (int i = 0; i < menu_cache.size(); i++) {
shape(menu_cache.write[i]);
- if (is_global && menu_cache[i].global_index >= 0) {
- nmenu->set_item_text(main_menu, menu_cache[i].global_index, atr(menu_cache[i].name));
+ if (is_global && menu_cache[i].submenu_rid.is_valid()) {
+ int item_idx = nmenu->find_item_index_with_submenu(main_menu, menu_cache[i].submenu_rid);
+ if (item_idx >= 0) {
+ nmenu->set_item_text(main_menu, item_idx, atr(menu_cache[i].name));
+ }
}
}
} break;
@@ -500,8 +506,11 @@ void MenuBar::_refresh_menu_names() {
if (!popups[i]->has_meta("_menu_name") && String(popups[i]->get_name()) != get_menu_title(i)) {
menu_cache.write[i].name = popups[i]->get_name();
shape(menu_cache.write[i]);
- if (is_global && menu_cache[i].global_index >= 0) {
- nmenu->set_item_text(main_menu, menu_cache[i].global_index, atr(menu_cache[i].name));
+ if (is_global && menu_cache[i].submenu_rid.is_valid()) {
+ int item_idx = nmenu->find_item_index_with_submenu(main_menu, menu_cache[i].submenu_rid);
+ if (item_idx >= 0) {
+ nmenu->set_item_text(main_menu, item_idx, atr(menu_cache[i].name));
+ }
}
}
}
@@ -554,8 +563,8 @@ void MenuBar::add_child_notify(Node *p_child) {
RID submenu_rid = pm->bind_global_menu();
if (!pm->is_system_menu()) {
- int index = nmenu->add_submenu_item(main_menu, atr(menu.name), submenu_rid, global_menu_tag + "#" + itos(menu_cache.size() - 1), _find_global_start_index() + menu_cache.size() - 1);
- menu_cache.write[menu_cache.size() - 1].global_index = index;
+ nmenu->add_submenu_item(main_menu, atr(menu.name), submenu_rid, global_menu_tag + "#" + itos(menu_cache.size() - 1), _find_global_start_index() + menu_cache.size() - 1);
+ menu_cache.write[menu_cache.size() - 1].submenu_rid = submenu_rid;
}
}
update_minimum_size();
@@ -589,13 +598,14 @@ void MenuBar::move_child_notify(Node *p_child) {
RID main_menu = nmenu->get_system_menu(NativeMenu::MAIN_MENU_ID);
int global_start = _find_global_start_index();
- if (menu.global_index >= 0) {
- nmenu->remove_item(main_menu, menu.global_index);
+ if (menu.submenu_rid.is_valid()) {
+ int item_idx = nmenu->find_item_index_with_submenu(main_menu, menu.submenu_rid);
+ if (item_idx >= 0) {
+ nmenu->remove_item(main_menu, item_idx);
+ }
}
if (new_idx != -1) {
- RID submenu_rid = pm->bind_global_menu();
- int index = nmenu->add_submenu_item(main_menu, atr(menu.name), submenu_rid, global_menu_tag + "#" + itos(new_idx), global_start + new_idx);
- menu_cache.write[new_idx].global_index = index;
+ nmenu->add_submenu_item(main_menu, atr(menu.name), menu.submenu_rid, global_menu_tag + "#" + itos(new_idx), global_start + new_idx);
}
}
}
@@ -611,20 +621,22 @@ void MenuBar::remove_child_notify(Node *p_child) {
int idx = get_menu_idx_from_control(pm);
- menu_cache.remove_at(idx);
-
if (!global_menu_tag.is_empty()) {
if (!pm->is_system_menu()) {
- pm->unbind_global_menu();
- if (menu_cache[idx].global_index >= 0) {
+ if (menu_cache[idx].submenu_rid.is_valid()) {
NativeMenu *nmenu = NativeMenu::get_singleton();
RID main_menu = nmenu->get_system_menu(NativeMenu::MAIN_MENU_ID);
- nmenu->remove_item(main_menu, menu_cache[idx].global_index);
- menu_cache.write[idx].global_index = -1;
+ int item_idx = nmenu->find_item_index_with_submenu(main_menu, menu_cache[idx].submenu_rid);
+ if (item_idx >= 0) {
+ nmenu->remove_item(main_menu, item_idx);
+ }
}
+ pm->unbind_global_menu();
}
}
+ menu_cache.remove_at(idx);
+
p_child->remove_meta("_menu_name");
p_child->remove_meta("_menu_tooltip");
@@ -817,10 +829,13 @@ void MenuBar::set_menu_title(int p_menu, const String &p_title) {
}
menu_cache.write[p_menu].name = p_title;
shape(menu_cache.write[p_menu]);
- if (!global_menu_tag.is_empty() && menu_cache[p_menu].global_index >= 0) {
+ if (!global_menu_tag.is_empty() && menu_cache[p_menu].submenu_rid.is_valid()) {
NativeMenu *nmenu = NativeMenu::get_singleton();
RID main_menu = nmenu->get_system_menu(NativeMenu::MAIN_MENU_ID);
- nmenu->set_item_text(main_menu, menu_cache[p_menu].global_index, atr(menu_cache[p_menu].name));
+ int item_idx = nmenu->find_item_index_with_submenu(main_menu, menu_cache[p_menu].submenu_rid);
+ if (item_idx >= 0) {
+ nmenu->set_item_text(main_menu, item_idx, atr(menu_cache[p_menu].name));
+ }
}
update_minimum_size();
}
@@ -835,10 +850,13 @@ void MenuBar::set_menu_tooltip(int p_menu, const String &p_tooltip) {
PopupMenu *pm = get_menu_popup(p_menu);
pm->set_meta("_menu_tooltip", p_tooltip);
menu_cache.write[p_menu].tooltip = p_tooltip;
- if (!global_menu_tag.is_empty() && menu_cache[p_menu].global_index >= 0) {
+ if (!global_menu_tag.is_empty() && menu_cache[p_menu].submenu_rid.is_valid()) {
NativeMenu *nmenu = NativeMenu::get_singleton();
RID main_menu = nmenu->get_system_menu(NativeMenu::MAIN_MENU_ID);
- nmenu->set_item_tooltip(main_menu, menu_cache[p_menu].global_index, p_tooltip);
+ int item_idx = nmenu->find_item_index_with_submenu(main_menu, menu_cache[p_menu].submenu_rid);
+ if (item_idx >= 0) {
+ nmenu->set_item_tooltip(main_menu, item_idx, p_tooltip);
+ }
}
}
@@ -850,10 +868,13 @@ String MenuBar::get_menu_tooltip(int p_menu) const {
void MenuBar::set_menu_disabled(int p_menu, bool p_disabled) {
ERR_FAIL_INDEX(p_menu, menu_cache.size());
menu_cache.write[p_menu].disabled = p_disabled;
- if (!global_menu_tag.is_empty() && menu_cache[p_menu].global_index >= 0) {
+ if (!global_menu_tag.is_empty() && menu_cache[p_menu].submenu_rid.is_valid()) {
NativeMenu *nmenu = NativeMenu::get_singleton();
RID main_menu = nmenu->get_system_menu(NativeMenu::MAIN_MENU_ID);
- nmenu->set_item_disabled(main_menu, menu_cache[p_menu].global_index, p_disabled);
+ int item_idx = nmenu->find_item_index_with_submenu(main_menu, menu_cache[p_menu].submenu_rid);
+ if (item_idx >= 0) {
+ nmenu->set_item_disabled(main_menu, item_idx, p_disabled);
+ }
}
}
@@ -865,10 +886,13 @@ bool MenuBar::is_menu_disabled(int p_menu) const {
void MenuBar::set_menu_hidden(int p_menu, bool p_hidden) {
ERR_FAIL_INDEX(p_menu, menu_cache.size());
menu_cache.write[p_menu].hidden = p_hidden;
- if (!global_menu_tag.is_empty() && menu_cache[p_menu].global_index >= 0) {
+ if (!global_menu_tag.is_empty() && menu_cache[p_menu].submenu_rid.is_valid()) {
NativeMenu *nmenu = NativeMenu::get_singleton();
RID main_menu = nmenu->get_system_menu(NativeMenu::MAIN_MENU_ID);
- nmenu->set_item_hidden(main_menu, menu_cache[p_menu].global_index, p_hidden);
+ int item_idx = nmenu->find_item_index_with_submenu(main_menu, menu_cache[p_menu].submenu_rid);
+ if (item_idx >= 0) {
+ nmenu->set_item_hidden(main_menu, item_idx, p_hidden);
+ }
}
update_minimum_size();
}
diff --git a/scene/gui/menu_bar.h b/scene/gui/menu_bar.h
index 631b791e1b..04f6afc2fa 100644
--- a/scene/gui/menu_bar.h
+++ b/scene/gui/menu_bar.h
@@ -55,7 +55,7 @@ class MenuBar : public Control {
Ref<TextLine> text_buf;
bool hidden = false;
bool disabled = false;
- int global_index = -1;
+ RID submenu_rid;
Menu(const String &p_name) {
name = p_name;
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 41f3ff108c..4e1d2b3983 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -4841,6 +4841,7 @@ void Viewport::_bind_methods() {
BIND_ENUM_CONSTANT(RENDER_INFO_TYPE_VISIBLE);
BIND_ENUM_CONSTANT(RENDER_INFO_TYPE_SHADOW);
+ BIND_ENUM_CONSTANT(RENDER_INFO_TYPE_CANVAS);
BIND_ENUM_CONSTANT(RENDER_INFO_TYPE_MAX);
BIND_ENUM_CONSTANT(DEBUG_DRAW_DISABLED);
diff --git a/scene/main/viewport.h b/scene/main/viewport.h
index 29ccdc5426..21832a454c 100644
--- a/scene/main/viewport.h
+++ b/scene/main/viewport.h
@@ -138,6 +138,7 @@ public:
enum RenderInfoType {
RENDER_INFO_TYPE_VISIBLE,
RENDER_INFO_TYPE_SHADOW,
+ RENDER_INFO_TYPE_CANVAS,
RENDER_INFO_TYPE_MAX
};
diff --git a/scene/resources/compressed_texture.h b/scene/resources/compressed_texture.h
index 5297d79cfe..439f7c097e 100644
--- a/scene/resources/compressed_texture.h
+++ b/scene/resources/compressed_texture.h
@@ -113,10 +113,10 @@ public:
class ResourceFormatLoaderCompressedTexture2D : public ResourceFormatLoader {
public:
- virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE);
- virtual void get_recognized_extensions(List<String> *p_extensions) const;
- virtual bool handles_type(const String &p_type) const;
- virtual String get_resource_type(const String &p_path) const;
+ virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override;
+ virtual void get_recognized_extensions(List<String> *p_extensions) const override;
+ virtual bool handles_type(const String &p_type) const override;
+ virtual String get_resource_type(const String &p_path) const override;
};
class CompressedTextureLayered : public TextureLayered {
@@ -178,10 +178,10 @@ public:
class ResourceFormatLoaderCompressedTextureLayered : public ResourceFormatLoader {
public:
- virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE);
- virtual void get_recognized_extensions(List<String> *p_extensions) const;
- virtual bool handles_type(const String &p_type) const;
- virtual String get_resource_type(const String &p_path) const;
+ virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override;
+ virtual void get_recognized_extensions(List<String> *p_extensions) const override;
+ virtual bool handles_type(const String &p_type) const override;
+ virtual String get_resource_type(const String &p_path) const override;
};
class CompressedTexture2DArray : public CompressedTextureLayered {
@@ -264,10 +264,10 @@ public:
class ResourceFormatLoaderCompressedTexture3D : public ResourceFormatLoader {
public:
- virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE);
- virtual void get_recognized_extensions(List<String> *p_extensions) const;
- virtual bool handles_type(const String &p_type) const;
- virtual String get_resource_type(const String &p_path) const;
+ virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override;
+ virtual void get_recognized_extensions(List<String> *p_extensions) const override;
+ virtual bool handles_type(const String &p_type) const override;
+ virtual String get_resource_type(const String &p_path) const override;
};
#endif // COMPRESSED_TEXTURE_H
diff --git a/scene/resources/resource_format_text.h b/scene/resources/resource_format_text.h
index 02898ce984..c05b7a24e1 100644
--- a/scene/resources/resource_format_text.h
+++ b/scene/resources/resource_format_text.h
@@ -139,17 +139,17 @@ public:
class ResourceFormatLoaderText : public ResourceFormatLoader {
public:
static ResourceFormatLoaderText *singleton;
- virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE);
- virtual void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const;
- virtual void get_recognized_extensions(List<String> *p_extensions) const;
- virtual bool handles_type(const String &p_type) const;
- virtual void get_classes_used(const String &p_path, HashSet<StringName> *r_classes);
-
- virtual String get_resource_type(const String &p_path) const;
- virtual String get_resource_script_class(const String &p_path) const;
- virtual ResourceUID::ID get_resource_uid(const String &p_path) const;
- virtual void get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types = false);
- virtual Error rename_dependencies(const String &p_path, const HashMap<String, String> &p_map);
+ virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override;
+ virtual void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const override;
+ virtual void get_recognized_extensions(List<String> *p_extensions) const override;
+ virtual bool handles_type(const String &p_type) const override;
+ virtual void get_classes_used(const String &p_path, HashSet<StringName> *r_classes) override;
+
+ virtual String get_resource_type(const String &p_path) const override;
+ virtual String get_resource_script_class(const String &p_path) const override;
+ virtual ResourceUID::ID get_resource_uid(const String &p_path) const override;
+ virtual void get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types = false) override;
+ virtual Error rename_dependencies(const String &p_path, const HashMap<String, String> &p_map) override;
static Error convert_file_to_binary(const String &p_src_path, const String &p_dst_path);
@@ -199,10 +199,10 @@ public:
class ResourceFormatSaverText : public ResourceFormatSaver {
public:
static ResourceFormatSaverText *singleton;
- virtual Error save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags = 0);
- virtual Error set_uid(const String &p_path, ResourceUID::ID p_uid);
- virtual bool recognize(const Ref<Resource> &p_resource) const;
- virtual void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const;
+ virtual Error save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags = 0) override;
+ virtual Error set_uid(const String &p_path, ResourceUID::ID p_uid) override;
+ virtual bool recognize(const Ref<Resource> &p_resource) const override;
+ virtual void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const override;
ResourceFormatSaverText();
};
diff --git a/scene/resources/shader.h b/scene/resources/shader.h
index ca889940ef..921143c219 100644
--- a/scene/resources/shader.h
+++ b/scene/resources/shader.h
@@ -96,17 +96,17 @@ VARIANT_ENUM_CAST(Shader::Mode);
class ResourceFormatLoaderShader : public ResourceFormatLoader {
public:
- virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE);
- virtual void get_recognized_extensions(List<String> *p_extensions) const;
- virtual bool handles_type(const String &p_type) const;
- virtual String get_resource_type(const String &p_path) const;
+ virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override;
+ virtual void get_recognized_extensions(List<String> *p_extensions) const override;
+ virtual bool handles_type(const String &p_type) const override;
+ virtual String get_resource_type(const String &p_path) const override;
};
class ResourceFormatSaverShader : public ResourceFormatSaver {
public:
- virtual Error save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags = 0);
- virtual void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const;
- virtual bool recognize(const Ref<Resource> &p_resource) const;
+ virtual Error save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags = 0) override;
+ virtual void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const override;
+ virtual bool recognize(const Ref<Resource> &p_resource) const override;
};
#endif // SHADER_H
diff --git a/scene/resources/shader_include.h b/scene/resources/shader_include.h
index a8949b327e..9fb4271623 100644
--- a/scene/resources/shader_include.h
+++ b/scene/resources/shader_include.h
@@ -58,17 +58,17 @@ public:
class ResourceFormatLoaderShaderInclude : public ResourceFormatLoader {
public:
- virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE);
- virtual void get_recognized_extensions(List<String> *p_extensions) const;
- virtual bool handles_type(const String &p_type) const;
- virtual String get_resource_type(const String &p_path) const;
+ virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override;
+ virtual void get_recognized_extensions(List<String> *p_extensions) const override;
+ virtual bool handles_type(const String &p_type) const override;
+ virtual String get_resource_type(const String &p_path) const override;
};
class ResourceFormatSaverShaderInclude : public ResourceFormatSaver {
public:
- virtual Error save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags = 0);
- virtual void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const;
- virtual bool recognize(const Ref<Resource> &p_resource) const;
+ virtual Error save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags = 0) override;
+ virtual void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const override;
+ virtual bool recognize(const Ref<Resource> &p_resource) const override;
};
#endif // SHADER_INCLUDE_H
diff --git a/servers/native_menu.cpp b/servers/native_menu.cpp
index d1894ba6c3..ca46560c7c 100644
--- a/servers/native_menu.cpp
+++ b/servers/native_menu.cpp
@@ -68,6 +68,7 @@ void NativeMenu::_bind_methods() {
ClassDB::bind_method(D_METHOD("find_item_index_with_text", "rid", "text"), &NativeMenu::find_item_index_with_text);
ClassDB::bind_method(D_METHOD("find_item_index_with_tag", "rid", "tag"), &NativeMenu::find_item_index_with_tag);
+ ClassDB::bind_method(D_METHOD("find_item_index_with_submenu", "rid", "submenu_rid"), &NativeMenu::find_item_index_with_submenu);
ClassDB::bind_method(D_METHOD("is_item_checked", "rid", "idx"), &NativeMenu::is_item_checked);
ClassDB::bind_method(D_METHOD("is_item_checkable", "rid", "idx"), &NativeMenu::is_item_checkable);
@@ -263,6 +264,19 @@ int NativeMenu::find_item_index_with_tag(const RID &p_rid, const Variant &p_tag)
return -1;
}
+int NativeMenu::find_item_index_with_submenu(const RID &p_rid, const RID &p_submenu_rid) const {
+ if (!has_menu(p_rid) || !has_menu(p_submenu_rid)) {
+ return -1;
+ }
+ int count = get_item_count(p_rid);
+ for (int i = 0; i < count; i++) {
+ if (p_submenu_rid == get_item_submenu(p_rid, i)) {
+ return i;
+ }
+ }
+ return -1;
+}
+
bool NativeMenu::is_item_checked(const RID &p_rid, int p_idx) const {
WARN_PRINT("Global menus are not supported on this platform.");
return false;
diff --git a/servers/native_menu.h b/servers/native_menu.h
index f65e193972..2bc061a216 100644
--- a/servers/native_menu.h
+++ b/servers/native_menu.h
@@ -102,6 +102,7 @@ public:
virtual int find_item_index_with_text(const RID &p_rid, const String &p_text) const;
virtual int find_item_index_with_tag(const RID &p_rid, const Variant &p_tag) const;
+ virtual int find_item_index_with_submenu(const RID &p_rid, const RID &p_submenu_rid) const;
virtual bool is_item_checked(const RID &p_rid, int p_idx) const;
virtual bool is_item_checkable(const RID &p_rid, int p_idx) const;
diff --git a/tests/core/string/test_string.h b/tests/core/string/test_string.h
index 027dcac92d..64f03e5879 100644
--- a/tests/core/string/test_string.h
+++ b/tests/core/string/test_string.h
@@ -338,10 +338,12 @@ TEST_CASE("[String] Natural compare function test") {
TEST_CASE("[String] File compare function test") {
String a = "_img2.png";
+ String b = "img2.png";
CHECK(a.nocasecmp_to("img10.png") > 0);
CHECK_MESSAGE(a.filenocasecmp_to("img10.png") < 0, "Should sort before letters.");
CHECK_MESSAGE(a.filenocasecmp_to(".img10.png") > 0, "Should sort after period.");
+ CHECK(b.filenocasecmp_to("img3.png") < 0);
}
TEST_CASE("[String] hex_encode_buffer") {
diff --git a/tests/create_test.py b/tests/create_test.py
index 4d1f1d656e..deb53aca20 100644
--- a/tests/create_test.py
+++ b/tests/create_test.py
@@ -101,7 +101,7 @@ TEST_CASE("[{name_pascal_case}] Example test case") {{
if args.invasive:
print("Trying to insert include directive in test_main.cpp...")
- with open("test_main.cpp", "r") as file:
+ with open("test_main.cpp", "r", encoding="utf-8") as file:
contents = file.read()
match = re.search(r'#include "tests.*\n', contents)
diff --git a/tests/python_build/test_gles3_builder.py b/tests/python_build/test_gles3_builder.py
index 861e0b84c4..6f16139eb9 100644
--- a/tests/python_build/test_gles3_builder.py
+++ b/tests/python_build/test_gles3_builder.py
@@ -17,15 +17,15 @@ def test_gles3_builder(shader_files, builder, header_struct):
builder(shader_files["path_input"], "drivers/gles3/shader_gles3.h", "GLES3", header_data=header)
- with open(shader_files["path_expected_parts"], "r") as f:
+ with open(shader_files["path_expected_parts"], "r", encoding="utf-8") as f:
expected_parts = json.load(f)
assert expected_parts == header.__dict__
- with open(shader_files["path_output"], "r") as f:
+ with open(shader_files["path_output"], "r", encoding="utf-8") as f:
actual_output = f.read()
assert actual_output
- with open(shader_files["path_expected_full"], "r") as f:
+ with open(shader_files["path_expected_full"], "r", encoding="utf-8") as f:
expected_output = f.read()
assert actual_output == expected_output
diff --git a/tests/python_build/test_glsl_builder.py b/tests/python_build/test_glsl_builder.py
index b9dcef48ac..348ef8441c 100644
--- a/tests/python_build/test_glsl_builder.py
+++ b/tests/python_build/test_glsl_builder.py
@@ -23,15 +23,15 @@ def test_glsl_builder(shader_files, builder, header_struct):
header = header_struct()
builder(shader_files["path_input"], header_data=header)
- with open(shader_files["path_expected_parts"], "r") as f:
+ with open(shader_files["path_expected_parts"], "r", encoding="utf-8") as f:
expected_parts = json.load(f)
assert expected_parts == header.__dict__
- with open(shader_files["path_output"], "r") as f:
+ with open(shader_files["path_output"], "r", encoding="utf-8") as f:
actual_output = f.read()
assert actual_output
- with open(shader_files["path_expected_full"], "r") as f:
+ with open(shader_files["path_expected_full"], "r", encoding="utf-8") as f:
expected_output = f.read()
assert actual_output == expected_output