Skip to content

Commit 9b96eaa

Browse files
committed
Merge pull request #107989 from Jojo-1000/docs-add-required-qualifier
Documentation: Add missing required qualifier for various classes
2 parents 78d1539 + ab17871 commit 9b96eaa

15 files changed

+42
-65
lines changed

core/io/resource_loader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ Ref<Resource> ResourceFormatLoader::load(const String &p_path, const String &p_o
174174
}
175175
}
176176

177-
ERR_FAIL_V_MSG(Ref<Resource>(), vformat("Failed to load resource '%s'. ResourceFormatLoader::load was not implemented for this resource type.", p_path));
177+
return Ref<Resource>();
178178
}
179179

180180
void ResourceFormatLoader::get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types) {

core/io/resource_loader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class ResourceFormatLoader : public RefCounted {
7070
GDVIRTUAL2RC(Error, _rename_dependencies, String, Dictionary)
7171
GDVIRTUAL1RC(bool, _exists, String)
7272

73-
GDVIRTUAL4RC(Variant, _load, String, String, bool, int)
73+
GDVIRTUAL4RC_REQUIRED(Variant, _load, String, String, bool, int)
7474

7575
public:
7676
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);

doc/classes/AudioStream.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
Override this method to return [code]true[/code] if this stream has a loop.
6565
</description>
6666
</method>
67-
<method name="_instantiate_playback" qualifiers="virtual const">
67+
<method name="_instantiate_playback" qualifiers="virtual required const">
6868
<return type="AudioStreamPlayback" />
6969
<description>
7070
Override this method to customize the returned value of [method instantiate_playback]. Should return a new [AudioStreamPlayback] created when the stream is played (such as by an [AudioStreamPlayer]).

doc/classes/AudioStreamPlayback.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323
Return the current value of a playback parameter by name (see [method AudioStream._get_parameter_list]).
2424
</description>
2525
</method>
26-
<method name="_get_playback_position" qualifiers="virtual const">
26+
<method name="_get_playback_position" qualifiers="virtual required const">
2727
<return type="float" />
2828
<description>
2929
Overridable method. Should return the current progress along the audio stream, in seconds.
3030
</description>
3131
</method>
32-
<method name="_is_playing" qualifiers="virtual const">
32+
<method name="_is_playing" qualifiers="virtual required const">
3333
<return type="bool" />
3434
<description>
3535
Overridable method. Should return [code]true[/code] if this playback is active and playing its audio stream.
@@ -60,14 +60,14 @@
6060
Set the current value of a playback parameter by name (see [method AudioStream._get_parameter_list]).
6161
</description>
6262
</method>
63-
<method name="_start" qualifiers="virtual">
63+
<method name="_start" qualifiers="virtual required">
6464
<return type="void" />
6565
<param index="0" name="from_pos" type="float" />
6666
<description>
6767
Override this method to customize what happens when the playback starts at the given position, such as by calling [method AudioStreamPlayer.play].
6868
</description>
6969
</method>
70-
<method name="_stop" qualifiers="virtual">
70+
<method name="_stop" qualifiers="virtual required">
7171
<return type="void" />
7272
<description>
7373
Override this method to customize what happens when the playback is stopped, such as by calling [method AudioStreamPlayer.stop].

doc/classes/EditorResourcePreviewGenerator.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
By default, it returns [code]false[/code].
1717
</description>
1818
</method>
19-
<method name="_generate" qualifiers="virtual const">
19+
<method name="_generate" qualifiers="virtual required const">
2020
<return type="Texture2D" />
2121
<param index="0" name="resource" type="Resource" />
2222
<param index="1" name="size" type="Vector2i" />
@@ -47,7 +47,7 @@
4747
By default, it returns [code]false[/code].
4848
</description>
4949
</method>
50-
<method name="_handles" qualifiers="virtual const">
50+
<method name="_handles" qualifiers="virtual required const">
5151
<return type="bool" />
5252
<param index="0" name="type" type="String" />
5353
<description>

doc/classes/EditorSceneFormatImporter.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<tutorials>
1111
</tutorials>
1212
<methods>
13-
<method name="_get_extensions" qualifiers="virtual const">
13+
<method name="_get_extensions" qualifiers="virtual required const">
1414
<return type="PackedStringArray" />
1515
<description>
1616
Return supported file extensions for this scene importer.
@@ -34,7 +34,7 @@
3434
Should return [code]true[/code] to show the given option, [code]false[/code] to hide the given option, or [code]null[/code] to ignore.
3535
</description>
3636
</method>
37-
<method name="_import_scene" qualifiers="virtual">
37+
<method name="_import_scene" qualifiers="virtual required">
3838
<return type="Object" />
3939
<param index="0" name="path" type="String" />
4040
<param index="1" name="flags" type="int" />

doc/classes/ResourceFormatLoader.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
[b]Note:[/b] Custom resource types defined by scripts aren't known by the [ClassDB], so you might just handle [code]"Resource"[/code] for them.
8181
</description>
8282
</method>
83-
<method name="_load" qualifiers="virtual const">
83+
<method name="_load" qualifiers="virtual required const">
8484
<return type="Variant" />
8585
<param index="0" name="path" type="String" />
8686
<param index="1" name="original_path" type="String" />

doc/classes/VideoStream.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<link title="Runtime file loading and saving">$DOCS_URL/tutorials/io/runtime_file_loading_and_saving.html</link>
1212
</tutorials>
1313
<methods>
14-
<method name="_instantiate_playback" qualifiers="virtual">
14+
<method name="_instantiate_playback" qualifiers="virtual required">
1515
<return type="VideoStreamPlayback" />
1616
<description>
1717
Called when the video starts playing, to initialize and return a subclass of [VideoStreamPlayback].

editor/import/3d/resource_importer_scene.cpp

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,10 @@
5959

6060
void EditorSceneFormatImporter::get_extensions(List<String> *r_extensions) const {
6161
Vector<String> arr;
62-
if (GDVIRTUAL_CALL(_get_extensions, arr)) {
63-
for (int i = 0; i < arr.size(); i++) {
64-
r_extensions->push_back(arr[i]);
65-
}
66-
return;
62+
GDVIRTUAL_CALL(_get_extensions, arr);
63+
for (int i = 0; i < arr.size(); i++) {
64+
r_extensions->push_back(arr[i]);
6765
}
68-
69-
ERR_FAIL();
7066
}
7167

7268
Node *EditorSceneFormatImporter::import_scene(const String &p_path, uint32_t p_flags, const HashMap<StringName, Variant> &p_options, List<String> *r_missing_deps, Error *r_err) {
@@ -75,11 +71,8 @@ Node *EditorSceneFormatImporter::import_scene(const String &p_path, uint32_t p_f
7571
options_dict[elem.key] = elem.value;
7672
}
7773
Object *ret = nullptr;
78-
if (GDVIRTUAL_CALL(_import_scene, p_path, p_flags, options_dict, ret)) {
79-
return Object::cast_to<Node>(ret);
80-
}
81-
82-
ERR_FAIL_V(nullptr);
74+
GDVIRTUAL_CALL(_import_scene, p_path, p_flags, options_dict, ret);
75+
return Object::cast_to<Node>(ret);
8376
}
8477

8578
void EditorSceneFormatImporter::add_import_option(const String &p_name, const Variant &p_default_value) {

editor/import/3d/resource_importer_scene.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ class EditorSceneFormatImporter : public RefCounted {
5757
Node *import_scene_wrapper(const String &p_path, uint32_t p_flags, const Dictionary &p_options);
5858
Ref<Animation> import_animation_wrapper(const String &p_path, uint32_t p_flags, const Dictionary &p_options);
5959

60-
GDVIRTUAL0RC(Vector<String>, _get_extensions)
61-
GDVIRTUAL3R(Object *, _import_scene, String, uint32_t, Dictionary)
60+
GDVIRTUAL0RC_REQUIRED(Vector<String>, _get_extensions)
61+
GDVIRTUAL3R_REQUIRED(Object *, _import_scene, String, uint32_t, Dictionary)
6262
GDVIRTUAL1(_get_import_options, String)
6363
GDVIRTUAL3RC(Variant, _get_option_visibility, String, bool, String)
6464

0 commit comments

Comments
 (0)