Browse Source

Use enum instead of int in virtual methods return type

Raul Santos 2 years ago
parent
commit
9e9eac4676

+ 2 - 2
core/io/resource_loader.cpp

@@ -176,9 +176,9 @@ Error ResourceFormatLoader::rename_dependencies(const String &p_path, const Hash
 		deps_dict[E.key] = E.value;
 		deps_dict[E.key] = E.value;
 	}
 	}
 
 
-	int64_t err = OK;
+	Error err = OK;
 	GDVIRTUAL_CALL(_rename_dependencies, p_path, deps_dict, err);
 	GDVIRTUAL_CALL(_rename_dependencies, p_path, deps_dict, err);
-	return (Error)err;
+	return err;
 }
 }
 
 
 void ResourceFormatLoader::_bind_methods() {
 void ResourceFormatLoader::_bind_methods() {

+ 1 - 1
core/io/resource_loader.h

@@ -58,7 +58,7 @@ protected:
 	GDVIRTUAL1RC(ResourceUID::ID, _get_resource_uid, String)
 	GDVIRTUAL1RC(ResourceUID::ID, _get_resource_uid, String)
 	GDVIRTUAL2RC(Vector<String>, _get_dependencies, String, bool)
 	GDVIRTUAL2RC(Vector<String>, _get_dependencies, String, bool)
 	GDVIRTUAL1RC(Vector<String>, _get_classes_used, String)
 	GDVIRTUAL1RC(Vector<String>, _get_classes_used, String)
-	GDVIRTUAL2RC(int64_t, _rename_dependencies, String, Dictionary)
+	GDVIRTUAL2RC(Error, _rename_dependencies, String, Dictionary)
 	GDVIRTUAL1RC(bool, _exists, String)
 	GDVIRTUAL1RC(bool, _exists, String)
 
 
 	GDVIRTUAL4RC(Variant, _load, String, String, bool, int)
 	GDVIRTUAL4RC(Variant, _load, String, String, bool, int)

+ 3 - 3
core/io/resource_saver.cpp

@@ -42,9 +42,9 @@ ResourceSavedCallback ResourceSaver::save_callback = nullptr;
 ResourceSaverGetResourceIDForPath ResourceSaver::save_get_id_for_path = nullptr;
 ResourceSaverGetResourceIDForPath ResourceSaver::save_get_id_for_path = nullptr;
 
 
 Error ResourceFormatSaver::save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags) {
 Error ResourceFormatSaver::save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags) {
-	int64_t res = ERR_METHOD_NOT_FOUND;
-	GDVIRTUAL_CALL(_save, p_resource, p_path, p_flags, res);
-	return (Error)res;
+	Error err = ERR_METHOD_NOT_FOUND;
+	GDVIRTUAL_CALL(_save, p_resource, p_path, p_flags, err);
+	return err;
 }
 }
 
 
 Error ResourceFormatSaver::set_uid(const String &p_path, ResourceUID::ID p_uid) {
 Error ResourceFormatSaver::set_uid(const String &p_path, ResourceUID::ID p_uid) {

+ 1 - 1
core/io/resource_saver.h

@@ -41,7 +41,7 @@ class ResourceFormatSaver : public RefCounted {
 protected:
 protected:
 	static void _bind_methods();
 	static void _bind_methods();
 
 
-	GDVIRTUAL3R(int64_t, _save, Ref<Resource>, String, uint32_t)
+	GDVIRTUAL3R(Error, _save, Ref<Resource>, String, uint32_t)
 	GDVIRTUAL2R(Error, _set_uid, String, ResourceUID::ID)
 	GDVIRTUAL2R(Error, _set_uid, String, ResourceUID::ID)
 	GDVIRTUAL1RC(bool, _recognize, Ref<Resource>)
 	GDVIRTUAL1RC(bool, _recognize, Ref<Resource>)
 	GDVIRTUAL1RC(Vector<String>, _get_recognized_extensions, Ref<Resource>)
 	GDVIRTUAL1RC(Vector<String>, _get_recognized_extensions, Ref<Resource>)

+ 1 - 1
doc/classes/EditorImportPlugin.xml

@@ -210,7 +210,7 @@
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="_import" qualifiers="virtual const">
 		<method name="_import" qualifiers="virtual const">
-			<return type="int" />
+			<return type="int" enum="Error" />
 			<param index="0" name="source_file" type="String" />
 			<param index="0" name="source_file" type="String" />
 			<param index="1" name="save_path" type="String" />
 			<param index="1" name="save_path" type="String" />
 			<param index="2" name="options" type="Dictionary" />
 			<param index="2" name="options" type="Dictionary" />

+ 4 - 4
doc/classes/MultiplayerAPIExtension.xml

@@ -99,7 +99,7 @@
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="_object_configuration_add" qualifiers="virtual">
 		<method name="_object_configuration_add" qualifiers="virtual">
-			<return type="int" />
+			<return type="int" enum="Error" />
 			<param index="0" name="object" type="Object" />
 			<param index="0" name="object" type="Object" />
 			<param index="1" name="configuration" type="Variant" />
 			<param index="1" name="configuration" type="Variant" />
 			<description>
 			<description>
@@ -107,7 +107,7 @@
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="_object_configuration_remove" qualifiers="virtual">
 		<method name="_object_configuration_remove" qualifiers="virtual">
-			<return type="int" />
+			<return type="int" enum="Error" />
 			<param index="0" name="object" type="Object" />
 			<param index="0" name="object" type="Object" />
 			<param index="1" name="configuration" type="Variant" />
 			<param index="1" name="configuration" type="Variant" />
 			<description>
 			<description>
@@ -115,13 +115,13 @@
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="_poll" qualifiers="virtual">
 		<method name="_poll" qualifiers="virtual">
-			<return type="int" />
+			<return type="int" enum="Error" />
 			<description>
 			<description>
 				Callback for [method MultiplayerAPI.poll].
 				Callback for [method MultiplayerAPI.poll].
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="_rpc" qualifiers="virtual">
 		<method name="_rpc" qualifiers="virtual">
-			<return type="int" />
+			<return type="int" enum="Error" />
 			<param index="0" name="peer" type="int" />
 			<param index="0" name="peer" type="int" />
 			<param index="1" name="object" type="Object" />
 			<param index="1" name="object" type="Object" />
 			<param index="2" name="method" type="StringName" />
 			<param index="2" name="method" type="StringName" />

+ 1 - 1
doc/classes/ResourceFormatLoader.xml

@@ -88,7 +88,7 @@
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="_rename_dependencies" qualifiers="virtual const">
 		<method name="_rename_dependencies" qualifiers="virtual const">
-			<return type="int" />
+			<return type="int" enum="Error" />
 			<param index="0" name="path" type="String" />
 			<param index="0" name="path" type="String" />
 			<param index="1" name="renames" type="Dictionary" />
 			<param index="1" name="renames" type="Dictionary" />
 			<description>
 			<description>

+ 1 - 1
doc/classes/ResourceFormatSaver.xml

@@ -34,7 +34,7 @@
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="_save" qualifiers="virtual">
 		<method name="_save" qualifiers="virtual">
-			<return type="int" />
+			<return type="int" enum="Error" />
 			<param index="0" name="resource" type="Resource" />
 			<param index="0" name="resource" type="Resource" />
 			<param index="1" name="path" type="String" />
 			<param index="1" name="path" type="String" />
 			<param index="2" name="flags" type="int" />
 			<param index="2" name="flags" type="int" />

+ 3 - 3
doc/classes/VisualShaderNodeCustom.xml

@@ -81,7 +81,7 @@
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="_get_input_port_type" qualifiers="virtual const">
 		<method name="_get_input_port_type" qualifiers="virtual const">
-			<return type="int" />
+			<return type="int" enum="VisualShaderNode.PortType" />
 			<param index="0" name="port" type="int" />
 			<param index="0" name="port" type="int" />
 			<description>
 			<description>
 				Override this method to define the returned type of each input port of the associated custom node (see [enum VisualShaderNode.PortType] for possible types).
 				Override this method to define the returned type of each input port of the associated custom node (see [enum VisualShaderNode.PortType] for possible types).
@@ -111,7 +111,7 @@
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="_get_output_port_type" qualifiers="virtual const">
 		<method name="_get_output_port_type" qualifiers="virtual const">
-			<return type="int" />
+			<return type="int" enum="VisualShaderNode.PortType" />
 			<param index="0" name="port" type="int" />
 			<param index="0" name="port" type="int" />
 			<description>
 			<description>
 				Override this method to define the returned type of each output port of the associated custom node (see [enum VisualShaderNode.PortType] for possible types).
 				Override this method to define the returned type of each output port of the associated custom node (see [enum VisualShaderNode.PortType] for possible types).
@@ -119,7 +119,7 @@
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="_get_return_icon_type" qualifiers="virtual const">
 		<method name="_get_return_icon_type" qualifiers="virtual const">
-			<return type="int" />
+			<return type="int" enum="VisualShaderNode.PortType" />
 			<description>
 			<description>
 				Override this method to define the return icon of the associated custom node in the Visual Shader Editor's members dialog.
 				Override this method to define the return icon of the associated custom node in the Visual Shader Editor's members dialog.
 				Defining this method is [b]optional[/b]. If not overridden, no return icon is shown.
 				Defining this method is [b]optional[/b]. If not overridden, no return icon is shown.

+ 3 - 3
doc/classes/XRInterfaceExtension.xml

@@ -64,7 +64,7 @@
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="_get_play_area_mode" qualifiers="virtual const">
 		<method name="_get_play_area_mode" qualifiers="virtual const">
-			<return type="int" />
+			<return type="int" enum="XRInterface.PlayAreaMode" />
 			<description>
 			<description>
 				Returns the [enum XRInterface.PlayAreaMode] that sets up our play area.
 				Returns the [enum XRInterface.PlayAreaMode] that sets up our play area.
 			</description>
 			</description>
@@ -99,7 +99,7 @@
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="_get_tracking_status" qualifiers="virtual const">
 		<method name="_get_tracking_status" qualifiers="virtual const">
-			<return type="int" />
+			<return type="int" enum="XRInterface.TrackingStatus" />
 			<description>
 			<description>
 				Returns a [enum XRInterface.TrackingStatus] specifying the current status of our tracking.
 				Returns a [enum XRInterface.TrackingStatus] specifying the current status of our tracking.
 			</description>
 			</description>
@@ -177,7 +177,7 @@
 		</method>
 		</method>
 		<method name="_set_play_area_mode" qualifiers="virtual const">
 		<method name="_set_play_area_mode" qualifiers="virtual const">
 			<return type="bool" />
 			<return type="bool" />
-			<param index="0" name="mode" type="int" />
+			<param index="0" name="mode" type="int" enum="XRInterface.PlayAreaMode" />
 			<description>
 			<description>
 				Set the play area mode for this interface.
 				Set the play area mode for this interface.
 			</description>
 			</description>

+ 2 - 4
editor/import/editor_import_plugin.cpp

@@ -172,17 +172,15 @@ Error EditorImportPlugin::import(const String &p_source_file, const String &p_sa
 		++E;
 		++E;
 	}
 	}
 
 
-	int err = 0;
+	Error err = OK;
 	if (GDVIRTUAL_CALL(_import, p_source_file, p_save_path, options, platform_variants, gen_files, err)) {
 	if (GDVIRTUAL_CALL(_import, p_source_file, p_save_path, options, platform_variants, gen_files, err)) {
-		Error ret_err = Error(err);
-
 		for (int i = 0; i < platform_variants.size(); i++) {
 		for (int i = 0; i < platform_variants.size(); i++) {
 			r_platform_variants->push_back(platform_variants[i]);
 			r_platform_variants->push_back(platform_variants[i]);
 		}
 		}
 		for (int i = 0; i < gen_files.size(); i++) {
 		for (int i = 0; i < gen_files.size(); i++) {
 			r_gen_files->push_back(gen_files[i]);
 			r_gen_files->push_back(gen_files[i]);
 		}
 		}
-		return ret_err;
+		return err;
 	}
 	}
 	ERR_FAIL_V_MSG(ERR_METHOD_NOT_FOUND, "Unimplemented _import in add-on.");
 	ERR_FAIL_V_MSG(ERR_METHOD_NOT_FOUND, "Unimplemented _import in add-on.");
 }
 }

+ 1 - 1
editor/import/editor_import_plugin.h

@@ -51,7 +51,7 @@ protected:
 	GDVIRTUAL0RC(float, _get_priority)
 	GDVIRTUAL0RC(float, _get_priority)
 	GDVIRTUAL0RC(int, _get_import_order)
 	GDVIRTUAL0RC(int, _get_import_order)
 	GDVIRTUAL3RC(bool, _get_option_visibility, String, StringName, Dictionary)
 	GDVIRTUAL3RC(bool, _get_option_visibility, String, StringName, Dictionary)
-	GDVIRTUAL5RC(int, _import, String, String, Dictionary, TypedArray<String>, TypedArray<String>)
+	GDVIRTUAL5RC(Error, _import, String, String, Dictionary, TypedArray<String>, TypedArray<String>)
 
 
 public:
 public:
 	EditorImportPlugin();
 	EditorImportPlugin();

+ 1 - 1
editor/import/resource_importer_scene.cpp

@@ -54,7 +54,7 @@
 #include "scene/resources/world_boundary_shape_3d.h"
 #include "scene/resources/world_boundary_shape_3d.h"
 
 
 uint32_t EditorSceneFormatImporter::get_import_flags() const {
 uint32_t EditorSceneFormatImporter::get_import_flags() const {
-	int ret;
+	uint32_t ret;
 	if (GDVIRTUAL_CALL(_get_import_flags, ret)) {
 	if (GDVIRTUAL_CALL(_get_import_flags, ret)) {
 		return ret;
 		return ret;
 	}
 	}

+ 1 - 1
editor/import/resource_importer_scene.h

@@ -56,7 +56,7 @@ protected:
 	Node *import_scene_wrapper(const String &p_path, uint32_t p_flags, Dictionary p_options);
 	Node *import_scene_wrapper(const String &p_path, uint32_t p_flags, Dictionary p_options);
 	Ref<Animation> import_animation_wrapper(const String &p_path, uint32_t p_flags, Dictionary p_options);
 	Ref<Animation> import_animation_wrapper(const String &p_path, uint32_t p_flags, Dictionary p_options);
 
 
-	GDVIRTUAL0RC(int, _get_import_flags)
+	GDVIRTUAL0RC(uint32_t, _get_import_flags)
 	GDVIRTUAL0RC(Vector<String>, _get_extensions)
 	GDVIRTUAL0RC(Vector<String>, _get_extensions)
 	GDVIRTUAL3R(Object *, _import_scene, String, uint32_t, Dictionary)
 	GDVIRTUAL3R(Object *, _import_scene, String, uint32_t, Dictionary)
 	GDVIRTUAL1(_get_import_options, String)
 	GDVIRTUAL1(_get_import_options, String)

+ 8 - 8
modules/gltf/doc_classes/GLTFDocumentExtension.xml

@@ -22,7 +22,7 @@
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="_export_node" qualifiers="virtual">
 		<method name="_export_node" qualifiers="virtual">
-			<return type="int" />
+			<return type="int" enum="Error" />
 			<param index="0" name="state" type="GLTFState" />
 			<param index="0" name="state" type="GLTFState" />
 			<param index="1" name="gltf_node" type="GLTFNode" />
 			<param index="1" name="gltf_node" type="GLTFNode" />
 			<param index="2" name="json" type="Dictionary" />
 			<param index="2" name="json" type="Dictionary" />
@@ -33,7 +33,7 @@
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="_export_post" qualifiers="virtual">
 		<method name="_export_post" qualifiers="virtual">
-			<return type="int" />
+			<return type="int" enum="Error" />
 			<param index="0" name="state" type="GLTFState" />
 			<param index="0" name="state" type="GLTFState" />
 			<description>
 			<description>
 				Part of the export process. This method is run last, after all other parts of the export process.
 				Part of the export process. This method is run last, after all other parts of the export process.
@@ -41,7 +41,7 @@
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="_export_preflight" qualifiers="virtual">
 		<method name="_export_preflight" qualifiers="virtual">
-			<return type="int" />
+			<return type="int" enum="Error" />
 			<param index="0" name="state" type="GLTFState" />
 			<param index="0" name="state" type="GLTFState" />
 			<param index="1" name="root" type="Node" />
 			<param index="1" name="root" type="Node" />
 			<description>
 			<description>
@@ -67,7 +67,7 @@
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="_import_node" qualifiers="virtual">
 		<method name="_import_node" qualifiers="virtual">
-			<return type="int" />
+			<return type="int" enum="Error" />
 			<param index="0" name="state" type="GLTFState" />
 			<param index="0" name="state" type="GLTFState" />
 			<param index="1" name="gltf_node" type="GLTFNode" />
 			<param index="1" name="gltf_node" type="GLTFNode" />
 			<param index="2" name="json" type="Dictionary" />
 			<param index="2" name="json" type="Dictionary" />
@@ -78,7 +78,7 @@
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="_import_post" qualifiers="virtual">
 		<method name="_import_post" qualifiers="virtual">
-			<return type="int" />
+			<return type="int" enum="Error" />
 			<param index="0" name="state" type="GLTFState" />
 			<param index="0" name="state" type="GLTFState" />
 			<param index="1" name="root" type="Node" />
 			<param index="1" name="root" type="Node" />
 			<description>
 			<description>
@@ -87,7 +87,7 @@
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="_import_post_parse" qualifiers="virtual">
 		<method name="_import_post_parse" qualifiers="virtual">
-			<return type="int" />
+			<return type="int" enum="Error" />
 			<param index="0" name="state" type="GLTFState" />
 			<param index="0" name="state" type="GLTFState" />
 			<description>
 			<description>
 				Part of the import process. This method is run after [method _generate_scene_node] and before [method _import_node].
 				Part of the import process. This method is run after [method _generate_scene_node] and before [method _import_node].
@@ -95,7 +95,7 @@
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="_import_preflight" qualifiers="virtual">
 		<method name="_import_preflight" qualifiers="virtual">
-			<return type="int" />
+			<return type="int" enum="Error" />
 			<param index="0" name="state" type="GLTFState" />
 			<param index="0" name="state" type="GLTFState" />
 			<param index="1" name="extensions" type="PackedStringArray" />
 			<param index="1" name="extensions" type="PackedStringArray" />
 			<description>
 			<description>
@@ -104,7 +104,7 @@
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="_parse_node_extensions" qualifiers="virtual">
 		<method name="_parse_node_extensions" qualifiers="virtual">
-			<return type="int" />
+			<return type="int" enum="Error" />
 			<param index="0" name="state" type="GLTFState" />
 			<param index="0" name="state" type="GLTFState" />
 			<param index="1" name="gltf_node" type="GLTFNode" />
 			<param index="1" name="gltf_node" type="GLTFNode" />
 			<param index="2" name="extensions" type="Dictionary" />
 			<param index="2" name="extensions" type="Dictionary" />

+ 16 - 16
modules/gltf/extensions/gltf_document_extension.cpp

@@ -49,9 +49,9 @@ void GLTFDocumentExtension::_bind_methods() {
 // Import process.
 // Import process.
 Error GLTFDocumentExtension::import_preflight(Ref<GLTFState> p_state, Vector<String> p_extensions) {
 Error GLTFDocumentExtension::import_preflight(Ref<GLTFState> p_state, Vector<String> p_extensions) {
 	ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
 	ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
-	int err = OK;
+	Error err = OK;
 	GDVIRTUAL_CALL(_import_preflight, p_state, p_extensions, err);
 	GDVIRTUAL_CALL(_import_preflight, p_state, p_extensions, err);
-	return Error(err);
+	return err;
 }
 }
 
 
 Vector<String> GLTFDocumentExtension::get_supported_extensions() {
 Vector<String> GLTFDocumentExtension::get_supported_extensions() {
@@ -63,9 +63,9 @@ Vector<String> GLTFDocumentExtension::get_supported_extensions() {
 Error GLTFDocumentExtension::parse_node_extensions(Ref<GLTFState> p_state, Ref<GLTFNode> p_gltf_node, Dictionary &p_extensions) {
 Error GLTFDocumentExtension::parse_node_extensions(Ref<GLTFState> p_state, Ref<GLTFNode> p_gltf_node, Dictionary &p_extensions) {
 	ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
 	ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
 	ERR_FAIL_NULL_V(p_gltf_node, ERR_INVALID_PARAMETER);
 	ERR_FAIL_NULL_V(p_gltf_node, ERR_INVALID_PARAMETER);
-	int err = OK;
+	Error err = OK;
 	GDVIRTUAL_CALL(_parse_node_extensions, p_state, p_gltf_node, p_extensions, err);
 	GDVIRTUAL_CALL(_parse_node_extensions, p_state, p_gltf_node, p_extensions, err);
-	return Error(err);
+	return err;
 }
 }
 
 
 Node3D *GLTFDocumentExtension::generate_scene_node(Ref<GLTFState> p_state, Ref<GLTFNode> p_gltf_node, Node *p_scene_parent) {
 Node3D *GLTFDocumentExtension::generate_scene_node(Ref<GLTFState> p_state, Ref<GLTFNode> p_gltf_node, Node *p_scene_parent) {
@@ -79,34 +79,34 @@ Node3D *GLTFDocumentExtension::generate_scene_node(Ref<GLTFState> p_state, Ref<G
 
 
 Error GLTFDocumentExtension::import_post_parse(Ref<GLTFState> p_state) {
 Error GLTFDocumentExtension::import_post_parse(Ref<GLTFState> p_state) {
 	ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
 	ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
-	int err = OK;
+	Error err = OK;
 	GDVIRTUAL_CALL(_import_post_parse, p_state, err);
 	GDVIRTUAL_CALL(_import_post_parse, p_state, err);
-	return Error(err);
+	return err;
 }
 }
 
 
 Error GLTFDocumentExtension::import_node(Ref<GLTFState> p_state, Ref<GLTFNode> p_gltf_node, Dictionary &r_dict, Node *p_node) {
 Error GLTFDocumentExtension::import_node(Ref<GLTFState> p_state, Ref<GLTFNode> p_gltf_node, Dictionary &r_dict, Node *p_node) {
 	ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
 	ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
 	ERR_FAIL_NULL_V(p_gltf_node, ERR_INVALID_PARAMETER);
 	ERR_FAIL_NULL_V(p_gltf_node, ERR_INVALID_PARAMETER);
 	ERR_FAIL_NULL_V(p_node, ERR_INVALID_PARAMETER);
 	ERR_FAIL_NULL_V(p_node, ERR_INVALID_PARAMETER);
-	int err = OK;
+	Error err = OK;
 	GDVIRTUAL_CALL(_import_node, p_state, p_gltf_node, r_dict, p_node, err);
 	GDVIRTUAL_CALL(_import_node, p_state, p_gltf_node, r_dict, p_node, err);
-	return Error(err);
+	return err;
 }
 }
 
 
 Error GLTFDocumentExtension::import_post(Ref<GLTFState> p_state, Node *p_root) {
 Error GLTFDocumentExtension::import_post(Ref<GLTFState> p_state, Node *p_root) {
 	ERR_FAIL_NULL_V(p_root, ERR_INVALID_PARAMETER);
 	ERR_FAIL_NULL_V(p_root, ERR_INVALID_PARAMETER);
 	ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
 	ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
-	int err = OK;
+	Error err = OK;
 	GDVIRTUAL_CALL(_import_post, p_state, p_root, err);
 	GDVIRTUAL_CALL(_import_post, p_state, p_root, err);
-	return Error(err);
+	return err;
 }
 }
 
 
 // Export process.
 // Export process.
 Error GLTFDocumentExtension::export_preflight(Ref<GLTFState> p_state, Node *p_root) {
 Error GLTFDocumentExtension::export_preflight(Ref<GLTFState> p_state, Node *p_root) {
 	ERR_FAIL_NULL_V(p_root, ERR_INVALID_PARAMETER);
 	ERR_FAIL_NULL_V(p_root, ERR_INVALID_PARAMETER);
-	int err = OK;
+	Error err = OK;
 	GDVIRTUAL_CALL(_export_preflight, p_state, p_root, err);
 	GDVIRTUAL_CALL(_export_preflight, p_state, p_root, err);
-	return Error(err);
+	return err;
 }
 }
 
 
 void GLTFDocumentExtension::convert_scene_node(Ref<GLTFState> p_state, Ref<GLTFNode> p_gltf_node, Node *p_scene_node) {
 void GLTFDocumentExtension::convert_scene_node(Ref<GLTFState> p_state, Ref<GLTFNode> p_gltf_node, Node *p_scene_node) {
@@ -120,14 +120,14 @@ Error GLTFDocumentExtension::export_node(Ref<GLTFState> p_state, Ref<GLTFNode> p
 	ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
 	ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
 	ERR_FAIL_NULL_V(p_gltf_node, ERR_INVALID_PARAMETER);
 	ERR_FAIL_NULL_V(p_gltf_node, ERR_INVALID_PARAMETER);
 	ERR_FAIL_NULL_V(p_node, ERR_INVALID_PARAMETER);
 	ERR_FAIL_NULL_V(p_node, ERR_INVALID_PARAMETER);
-	int err = OK;
+	Error err = OK;
 	GDVIRTUAL_CALL(_export_node, p_state, p_gltf_node, r_dict, p_node, err);
 	GDVIRTUAL_CALL(_export_node, p_state, p_gltf_node, r_dict, p_node, err);
-	return Error(err);
+	return err;
 }
 }
 
 
 Error GLTFDocumentExtension::export_post(Ref<GLTFState> p_state) {
 Error GLTFDocumentExtension::export_post(Ref<GLTFState> p_state) {
 	ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
 	ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
-	int err = OK;
+	Error err = OK;
 	GDVIRTUAL_CALL(_export_post, p_state, err);
 	GDVIRTUAL_CALL(_export_post, p_state, err);
-	return Error(err);
+	return err;
 }
 }

+ 8 - 8
modules/gltf/extensions/gltf_document_extension.h

@@ -55,18 +55,18 @@ public:
 	virtual Error export_post(Ref<GLTFState> p_state);
 	virtual Error export_post(Ref<GLTFState> p_state);
 
 
 	// Import process.
 	// Import process.
-	GDVIRTUAL2R(int, _import_preflight, Ref<GLTFState>, Vector<String>);
+	GDVIRTUAL2R(Error, _import_preflight, Ref<GLTFState>, Vector<String>);
 	GDVIRTUAL0R(Vector<String>, _get_supported_extensions);
 	GDVIRTUAL0R(Vector<String>, _get_supported_extensions);
-	GDVIRTUAL3R(int, _parse_node_extensions, Ref<GLTFState>, Ref<GLTFNode>, Dictionary);
+	GDVIRTUAL3R(Error, _parse_node_extensions, Ref<GLTFState>, Ref<GLTFNode>, Dictionary);
 	GDVIRTUAL3R(Node3D *, _generate_scene_node, Ref<GLTFState>, Ref<GLTFNode>, Node *);
 	GDVIRTUAL3R(Node3D *, _generate_scene_node, Ref<GLTFState>, Ref<GLTFNode>, Node *);
-	GDVIRTUAL1R(int, _import_post_parse, Ref<GLTFState>);
-	GDVIRTUAL4R(int, _import_node, Ref<GLTFState>, Ref<GLTFNode>, Dictionary, Node *);
-	GDVIRTUAL2R(int, _import_post, Ref<GLTFState>, Node *);
+	GDVIRTUAL1R(Error, _import_post_parse, Ref<GLTFState>);
+	GDVIRTUAL4R(Error, _import_node, Ref<GLTFState>, Ref<GLTFNode>, Dictionary, Node *);
+	GDVIRTUAL2R(Error, _import_post, Ref<GLTFState>, Node *);
 	// Export process.
 	// Export process.
-	GDVIRTUAL2R(int, _export_preflight, Ref<GLTFState>, Node *);
+	GDVIRTUAL2R(Error, _export_preflight, Ref<GLTFState>, Node *);
 	GDVIRTUAL3(_convert_scene_node, Ref<GLTFState>, Ref<GLTFNode>, Node *);
 	GDVIRTUAL3(_convert_scene_node, Ref<GLTFState>, Ref<GLTFNode>, Node *);
-	GDVIRTUAL4R(int, _export_node, Ref<GLTFState>, Ref<GLTFNode>, Dictionary, Node *);
-	GDVIRTUAL1R(int, _export_post, Ref<GLTFState>);
+	GDVIRTUAL4R(Error, _export_node, Ref<GLTFState>, Ref<GLTFNode>, Dictionary, Node *);
+	GDVIRTUAL1R(Error, _export_post, Ref<GLTFState>);
 };
 };
 
 
 #endif // GLTF_DOCUMENT_EXTENSION_H
 #endif // GLTF_DOCUMENT_EXTENSION_H

+ 8 - 8
scene/main/multiplayer_api.cpp

@@ -329,9 +329,9 @@ void MultiplayerAPI::_bind_methods() {
 /// MultiplayerAPIExtension
 /// MultiplayerAPIExtension
 
 
 Error MultiplayerAPIExtension::poll() {
 Error MultiplayerAPIExtension::poll() {
-	int err = OK;
+	Error err = OK;
 	GDVIRTUAL_CALL(_poll, err);
 	GDVIRTUAL_CALL(_poll, err);
-	return (Error)err;
+	return err;
 }
 }
 
 
 void MultiplayerAPIExtension::set_multiplayer_peer(const Ref<MultiplayerPeer> &p_peer) {
 void MultiplayerAPIExtension::set_multiplayer_peer(const Ref<MultiplayerPeer> &p_peer) {
@@ -364,9 +364,9 @@ Error MultiplayerAPIExtension::rpcp(Object *p_obj, int p_peer_id, const StringNa
 	for (int i = 0; i < p_argcount; i++) {
 	for (int i = 0; i < p_argcount; i++) {
 		args.push_back(*p_arg[i]);
 		args.push_back(*p_arg[i]);
 	}
 	}
-	int ret = FAILED;
+	Error ret = FAILED;
 	GDVIRTUAL_CALL(_rpc, p_peer_id, p_obj, p_method, args, ret);
 	GDVIRTUAL_CALL(_rpc, p_peer_id, p_obj, p_method, args, ret);
-	return (Error)ret;
+	return ret;
 }
 }
 
 
 int MultiplayerAPIExtension::get_remote_sender_id() {
 int MultiplayerAPIExtension::get_remote_sender_id() {
@@ -376,15 +376,15 @@ int MultiplayerAPIExtension::get_remote_sender_id() {
 }
 }
 
 
 Error MultiplayerAPIExtension::object_configuration_add(Object *p_object, Variant p_config) {
 Error MultiplayerAPIExtension::object_configuration_add(Object *p_object, Variant p_config) {
-	int err = ERR_UNAVAILABLE;
+	Error err = ERR_UNAVAILABLE;
 	GDVIRTUAL_CALL(_object_configuration_add, p_object, p_config, err);
 	GDVIRTUAL_CALL(_object_configuration_add, p_object, p_config, err);
-	return (Error)err;
+	return err;
 }
 }
 
 
 Error MultiplayerAPIExtension::object_configuration_remove(Object *p_object, Variant p_config) {
 Error MultiplayerAPIExtension::object_configuration_remove(Object *p_object, Variant p_config) {
-	int err = ERR_UNAVAILABLE;
+	Error err = ERR_UNAVAILABLE;
 	GDVIRTUAL_CALL(_object_configuration_remove, p_object, p_config, err);
 	GDVIRTUAL_CALL(_object_configuration_remove, p_object, p_config, err);
-	return (Error)err;
+	return err;
 }
 }
 
 
 void MultiplayerAPIExtension::_bind_methods() {
 void MultiplayerAPIExtension::_bind_methods() {

+ 4 - 4
scene/main/multiplayer_api.h

@@ -101,15 +101,15 @@ public:
 	virtual Error object_configuration_remove(Object *p_object, Variant p_config) override;
 	virtual Error object_configuration_remove(Object *p_object, Variant p_config) override;
 
 
 	// Extensions
 	// Extensions
-	GDVIRTUAL0R(int, _poll);
+	GDVIRTUAL0R(Error, _poll);
 	GDVIRTUAL1(_set_multiplayer_peer, Ref<MultiplayerPeer>);
 	GDVIRTUAL1(_set_multiplayer_peer, Ref<MultiplayerPeer>);
 	GDVIRTUAL0R(Ref<MultiplayerPeer>, _get_multiplayer_peer);
 	GDVIRTUAL0R(Ref<MultiplayerPeer>, _get_multiplayer_peer);
 	GDVIRTUAL0RC(int, _get_unique_id);
 	GDVIRTUAL0RC(int, _get_unique_id);
 	GDVIRTUAL0RC(PackedInt32Array, _get_peer_ids);
 	GDVIRTUAL0RC(PackedInt32Array, _get_peer_ids);
-	GDVIRTUAL4R(int, _rpc, int, Object *, StringName, Array);
+	GDVIRTUAL4R(Error, _rpc, int, Object *, StringName, Array);
 	GDVIRTUAL0RC(int, _get_remote_sender_id);
 	GDVIRTUAL0RC(int, _get_remote_sender_id);
-	GDVIRTUAL2R(int, _object_configuration_add, Object *, Variant);
-	GDVIRTUAL2R(int, _object_configuration_remove, Object *, Variant);
+	GDVIRTUAL2R(Error, _object_configuration_add, Object *, Variant);
+	GDVIRTUAL2R(Error, _object_configuration_remove, Object *, Variant);
 };
 };
 
 
 #endif // MULTIPLAYER_API_H
 #endif // MULTIPLAYER_API_H

+ 1 - 1
scene/main/multiplayer_peer.cpp

@@ -163,7 +163,7 @@ Error MultiplayerPeerExtension::put_packet(const uint8_t *p_buffer, int p_buffer
 		if (!GDVIRTUAL_CALL(_put_packet_script, a, err)) {
 		if (!GDVIRTUAL_CALL(_put_packet_script, a, err)) {
 			return FAILED;
 			return FAILED;
 		}
 		}
-		return (Error)err;
+		return err;
 	}
 	}
 	WARN_PRINT_ONCE("MultiplayerPeerExtension::_put_packet_native is unimplemented!");
 	WARN_PRINT_ONCE("MultiplayerPeerExtension::_put_packet_native is unimplemented!");
 	return FAILED;
 	return FAILED;

+ 8 - 2
scene/resources/visual_shader.cpp

@@ -427,7 +427,10 @@ void VisualShaderNodeCustom::update_ports() {
 				if (!GDVIRTUAL_CALL(_get_input_port_name, i, port.name)) {
 				if (!GDVIRTUAL_CALL(_get_input_port_name, i, port.name)) {
 					port.name = "in" + itos(i);
 					port.name = "in" + itos(i);
 				}
 				}
-				if (!GDVIRTUAL_CALL(_get_input_port_type, i, port.type)) {
+				PortType port_type;
+				if (GDVIRTUAL_CALL(_get_input_port_type, i, port_type)) {
+					port.type = (int)port_type;
+				} else {
 					port.type = (int)PortType::PORT_TYPE_SCALAR;
 					port.type = (int)PortType::PORT_TYPE_SCALAR;
 				}
 				}
 
 
@@ -445,7 +448,10 @@ void VisualShaderNodeCustom::update_ports() {
 				if (!GDVIRTUAL_CALL(_get_output_port_name, i, port.name)) {
 				if (!GDVIRTUAL_CALL(_get_output_port_name, i, port.name)) {
 					port.name = "out" + itos(i);
 					port.name = "out" + itos(i);
 				}
 				}
-				if (!GDVIRTUAL_CALL(_get_output_port_type, i, port.type)) {
+				PortType port_type;
+				if (GDVIRTUAL_CALL(_get_output_port_type, i, port_type)) {
+					port.type = (int)port_type;
+				} else {
 					port.type = (int)PortType::PORT_TYPE_SCALAR;
 					port.type = (int)PortType::PORT_TYPE_SCALAR;
 				}
 				}
 
 

+ 3 - 3
scene/resources/visual_shader.h

@@ -369,12 +369,12 @@ protected:
 	GDVIRTUAL0RC(String, _get_name)
 	GDVIRTUAL0RC(String, _get_name)
 	GDVIRTUAL0RC(String, _get_description)
 	GDVIRTUAL0RC(String, _get_description)
 	GDVIRTUAL0RC(String, _get_category)
 	GDVIRTUAL0RC(String, _get_category)
-	GDVIRTUAL0RC(int, _get_return_icon_type)
+	GDVIRTUAL0RC(PortType, _get_return_icon_type)
 	GDVIRTUAL0RC(int, _get_input_port_count)
 	GDVIRTUAL0RC(int, _get_input_port_count)
-	GDVIRTUAL1RC(int, _get_input_port_type, int)
+	GDVIRTUAL1RC(PortType, _get_input_port_type, int)
 	GDVIRTUAL1RC(String, _get_input_port_name, int)
 	GDVIRTUAL1RC(String, _get_input_port_name, int)
 	GDVIRTUAL0RC(int, _get_output_port_count)
 	GDVIRTUAL0RC(int, _get_output_port_count)
-	GDVIRTUAL1RC(int, _get_output_port_type, int)
+	GDVIRTUAL1RC(PortType, _get_output_port_type, int)
 	GDVIRTUAL1RC(String, _get_output_port_name, int)
 	GDVIRTUAL1RC(String, _get_output_port_name, int)
 	GDVIRTUAL4RC(String, _get_code, TypedArray<String>, TypedArray<String>, Shader::Mode, VisualShader::Type)
 	GDVIRTUAL4RC(String, _get_code, TypedArray<String>, TypedArray<String>, Shader::Mode, VisualShader::Type)
 	GDVIRTUAL2RC(String, _get_func_code, Shader::Mode, VisualShader::Type)
 	GDVIRTUAL2RC(String, _get_func_code, Shader::Mode, VisualShader::Type)

+ 4 - 4
servers/xr/xr_interface_extension.cpp

@@ -136,9 +136,9 @@ PackedStringArray XRInterfaceExtension::get_suggested_pose_names(const StringNam
 }
 }
 
 
 XRInterface::TrackingStatus XRInterfaceExtension::get_tracking_status() const {
 XRInterface::TrackingStatus XRInterfaceExtension::get_tracking_status() const {
-	uint32_t status = XR_UNKNOWN_TRACKING;
+	XRInterface::TrackingStatus status = XR_UNKNOWN_TRACKING;
 	GDVIRTUAL_CALL(_get_tracking_status, status);
 	GDVIRTUAL_CALL(_get_tracking_status, status);
-	return TrackingStatus(status);
+	return status;
 }
 }
 
 
 void XRInterfaceExtension::trigger_haptic_pulse(const String &p_action_name, const StringName &p_tracker_name, double p_frequency, double p_amplitude, double p_duration_sec, double p_delay_sec) {
 void XRInterfaceExtension::trigger_haptic_pulse(const String &p_action_name, const StringName &p_tracker_name, double p_frequency, double p_amplitude, double p_duration_sec, double p_delay_sec) {
@@ -152,9 +152,9 @@ bool XRInterfaceExtension::supports_play_area_mode(XRInterface::PlayAreaMode p_m
 }
 }
 
 
 XRInterface::PlayAreaMode XRInterfaceExtension::get_play_area_mode() const {
 XRInterface::PlayAreaMode XRInterfaceExtension::get_play_area_mode() const {
-	uint32_t mode = XR_PLAY_AREA_UNKNOWN;
+	XRInterface::PlayAreaMode mode = XR_PLAY_AREA_UNKNOWN;
 	GDVIRTUAL_CALL(_get_play_area_mode, mode);
 	GDVIRTUAL_CALL(_get_play_area_mode, mode);
-	return XRInterface::PlayAreaMode(mode);
+	return mode;
 }
 }
 
 
 bool XRInterfaceExtension::set_play_area_mode(XRInterface::PlayAreaMode p_mode) {
 bool XRInterfaceExtension::set_play_area_mode(XRInterface::PlayAreaMode p_mode) {

+ 3 - 3
servers/xr/xr_interface_extension.h

@@ -71,7 +71,7 @@ public:
 
 
 	GDVIRTUAL0RC(PackedStringArray, _get_suggested_tracker_names);
 	GDVIRTUAL0RC(PackedStringArray, _get_suggested_tracker_names);
 	GDVIRTUAL1RC(PackedStringArray, _get_suggested_pose_names, const StringName &);
 	GDVIRTUAL1RC(PackedStringArray, _get_suggested_pose_names, const StringName &);
-	GDVIRTUAL0RC(uint32_t, _get_tracking_status);
+	GDVIRTUAL0RC(XRInterface::TrackingStatus, _get_tracking_status);
 	GDVIRTUAL6(_trigger_haptic_pulse, const String &, const StringName &, double, double, double, double);
 	GDVIRTUAL6(_trigger_haptic_pulse, const String &, const StringName &, double, double, double, double);
 
 
 	/** specific to VR **/
 	/** specific to VR **/
@@ -81,8 +81,8 @@ public:
 	virtual PackedVector3Array get_play_area() const override; /* if available, returns an array of vectors denoting the play area the player can move around in */
 	virtual PackedVector3Array get_play_area() const override; /* if available, returns an array of vectors denoting the play area the player can move around in */
 
 
 	GDVIRTUAL1RC(bool, _supports_play_area_mode, XRInterface::PlayAreaMode);
 	GDVIRTUAL1RC(bool, _supports_play_area_mode, XRInterface::PlayAreaMode);
-	GDVIRTUAL0RC(uint32_t, _get_play_area_mode);
-	GDVIRTUAL1RC(bool, _set_play_area_mode, uint32_t);
+	GDVIRTUAL0RC(XRInterface::PlayAreaMode, _get_play_area_mode);
+	GDVIRTUAL1RC(bool, _set_play_area_mode, XRInterface::PlayAreaMode);
 	GDVIRTUAL0RC(PackedVector3Array, _get_play_area);
 	GDVIRTUAL0RC(PackedVector3Array, _get_play_area);
 
 
 	/** specific to AR **/
 	/** specific to AR **/