Simplify GDVIRTUAL_CALL calls

This commit is contained in:
kobewi 2022-10-18 18:47:44 +02:00
parent 4a96fce801
commit d06a8320e5
28 changed files with 507 additions and 983 deletions

View file

@ -52,10 +52,8 @@ bool ImageFormatLoader::recognize(const String &p_extension) const {
Error ImageFormatLoaderExtension::load_image(Ref<Image> p_image, Ref<FileAccess> p_fileaccess, BitField<ImageFormatLoader::LoaderFlags> p_flags, float p_scale) {
Error err = ERR_UNAVAILABLE;
if (GDVIRTUAL_CALL(_load_image, p_image, p_fileaccess, p_flags, p_scale, err)) {
GDVIRTUAL_CALL(_load_image, p_image, p_fileaccess, p_flags, p_scale, err);
return err;
}
return ERR_UNAVAILABLE;
}
void ImageFormatLoaderExtension::get_recognized_extensions(List<String> *p_extension) const {

View file

@ -74,11 +74,8 @@ bool ResourceFormatLoader::recognize_path(const String &p_path, const String &p_
bool ResourceFormatLoader::handles_type(const String &p_type) const {
bool success = false;
if (GDVIRTUAL_CALL(_handles_type, p_type, success)) {
GDVIRTUAL_CALL(_handles_type, p_type, success);
return success;
}
return false;
}
void ResourceFormatLoader::get_classes_used(const String &p_path, HashSet<StringName> *r_classes) {
@ -98,21 +95,14 @@ void ResourceFormatLoader::get_classes_used(const String &p_path, HashSet<String
String ResourceFormatLoader::get_resource_type(const String &p_path) const {
String ret;
if (GDVIRTUAL_CALL(_get_resource_type, p_path, ret)) {
GDVIRTUAL_CALL(_get_resource_type, p_path, ret);
return ret;
}
return "";
}
ResourceUID::ID ResourceFormatLoader::get_resource_uid(const String &p_path) const {
int64_t uid = ResourceUID::INVALID_ID;
if (GDVIRTUAL_CALL(_get_resource_uid, p_path, uid)) {
GDVIRTUAL_CALL(_get_resource_uid, p_path, uid);
return uid;
}
return ResourceUID::INVALID_ID;
}
void ResourceFormatLoader::get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const {
@ -132,7 +122,7 @@ bool ResourceFormatLoader::exists(const String &p_path) const {
if (GDVIRTUAL_CALL(_exists, p_path, success)) {
return success;
}
return FileAccess::exists(p_path); //by default just check file
return FileAccess::exists(p_path); // By default just check file.
}
void ResourceFormatLoader::get_recognized_extensions(List<String> *p_extensions) const {
@ -181,11 +171,8 @@ Error ResourceFormatLoader::rename_dependencies(const String &p_path, const Hash
}
int64_t err = OK;
if (GDVIRTUAL_CALL(_rename_dependencies, p_path, deps_dict, err)) {
GDVIRTUAL_CALL(_rename_dependencies, p_path, deps_dict, err);
return (Error)err;
}
return OK;
}
void ResourceFormatLoader::_bind_methods() {

View file

@ -43,20 +43,14 @@ ResourceSaverGetResourceIDForPath ResourceSaver::save_get_id_for_path = nullptr;
Error ResourceFormatSaver::save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags) {
int64_t res = ERR_METHOD_NOT_FOUND;
if (GDVIRTUAL_CALL(_save, p_resource, p_path, p_flags, res)) {
GDVIRTUAL_CALL(_save, p_resource, p_path, p_flags, res);
return (Error)res;
}
return ERR_METHOD_NOT_FOUND;
}
bool ResourceFormatSaver::recognize(const Ref<Resource> &p_resource) const {
bool success = false;
if (GDVIRTUAL_CALL(_recognize, p_resource, success)) {
GDVIRTUAL_CALL(_recognize, p_resource, success);
return success;
}
return false;
}
void ResourceFormatSaver::get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const {

View file

@ -65,21 +65,15 @@ void MainLoop::initialize() {
}
bool MainLoop::physics_process(double p_time) {
bool quit;
if (GDVIRTUAL_CALL(_physics_process, p_time, quit)) {
bool quit = false;
GDVIRTUAL_CALL(_physics_process, p_time, quit);
return quit;
}
return false;
}
bool MainLoop::process(double p_time) {
bool quit;
if (GDVIRTUAL_CALL(_process, p_time, quit)) {
bool quit = false;
GDVIRTUAL_CALL(_process, p_time, quit);
return quit;
}
return false;
}
void MainLoop::finalize() {

View file

@ -1062,10 +1062,8 @@ void EditorInspectorPlugin::add_property_editor_for_multiple_properties(const St
bool EditorInspectorPlugin::can_handle(Object *p_object) {
bool success = false;
if (GDVIRTUAL_CALL(_can_handle, p_object, success)) {
GDVIRTUAL_CALL(_can_handle, p_object, success);
return success;
}
return false;
}
void EditorInspectorPlugin::parse_begin(Object *p_object) {
@ -1082,10 +1080,8 @@ void EditorInspectorPlugin::parse_group(Object *p_object, const String &p_group)
bool EditorInspectorPlugin::parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide) {
bool ret = false;
if (GDVIRTUAL_CALL(_parse_property, p_object, p_type, p_path, p_hint, p_hint_text, p_usage, p_wide, ret)) {
GDVIRTUAL_CALL(_parse_property, p_object, p_type, p_path, p_hint, p_hint_text, p_usage, p_wide, ret);
return ret;
}
return false;
}
void EditorInspectorPlugin::parse_end(Object *p_object) {

View file

@ -571,10 +571,8 @@ void EditorPlugin::notify_resource_saved(const Ref<Resource> &p_resource) {
bool EditorPlugin::forward_canvas_gui_input(const Ref<InputEvent> &p_event) {
bool success = false;
if (GDVIRTUAL_CALL(_forward_canvas_gui_input, p_event, success)) {
GDVIRTUAL_CALL(_forward_canvas_gui_input, p_event, success);
return success;
}
return false;
}
void EditorPlugin::forward_canvas_draw_over_viewport(Control *p_overlay) {
@ -606,12 +604,8 @@ int EditorPlugin::update_overlays() const {
EditorPlugin::AfterGUIInput EditorPlugin::forward_3d_gui_input(Camera3D *p_camera, const Ref<InputEvent> &p_event) {
int success = EditorPlugin::AFTER_GUI_INPUT_PASS;
if (GDVIRTUAL_CALL(_forward_3d_gui_input, p_camera, p_event, success)) {
GDVIRTUAL_CALL(_forward_3d_gui_input, p_camera, p_event, success);
return static_cast<EditorPlugin::AfterGUIInput>(success);
}
return EditorPlugin::AFTER_GUI_INPUT_PASS;
}
void EditorPlugin::forward_3d_draw_over_viewport(Control *p_overlay) {
@ -624,29 +618,20 @@ void EditorPlugin::forward_3d_force_draw_over_viewport(Control *p_overlay) {
String EditorPlugin::get_name() const {
String name;
if (GDVIRTUAL_CALL(_get_plugin_name, name)) {
GDVIRTUAL_CALL(_get_plugin_name, name);
return name;
}
return String();
}
const Ref<Texture2D> EditorPlugin::get_icon() const {
Ref<Texture2D> icon;
if (GDVIRTUAL_CALL(_get_plugin_icon, icon)) {
GDVIRTUAL_CALL(_get_plugin_icon, icon);
return icon;
}
return Ref<Texture2D>();
}
bool EditorPlugin::has_main_screen() const {
bool success;
if (GDVIRTUAL_CALL(_has_main_screen, success)) {
bool success = false;
GDVIRTUAL_CALL(_has_main_screen, success);
return success;
}
return false;
}
void EditorPlugin::make_visible(bool p_visible) {
@ -663,20 +648,14 @@ void EditorPlugin::edit(Object *p_object) {
bool EditorPlugin::handles(Object *p_object) const {
bool success = false;
if (GDVIRTUAL_CALL(_handles, p_object, success)) {
GDVIRTUAL_CALL(_handles, p_object, success);
return success;
}
return false;
}
Dictionary EditorPlugin::get_state() const {
Dictionary state;
if (GDVIRTUAL_CALL(_get_state, state)) {
GDVIRTUAL_CALL(_get_state, state);
return state;
}
return Dictionary();
}
void EditorPlugin::set_state(const Dictionary &p_state) {
@ -822,11 +801,9 @@ void EditorPlugin::get_window_layout(Ref<ConfigFile> p_layout) {
}
bool EditorPlugin::build() {
bool success;
if (GDVIRTUAL_CALL(_build, success)) {
bool success = true;
GDVIRTUAL_CALL(_build, success);
return success;
}
return true;
}
void EditorPlugin::queue_save_layout() {

View file

@ -512,12 +512,9 @@ void EditorResourcePicker::set_create_options(Object *p_menu_node) {
}
bool EditorResourcePicker::handle_menu_selected(int p_which) {
bool success;
if (GDVIRTUAL_CALL(_handle_menu_selected, p_which, success)) {
bool success = false;
GDVIRTUAL_CALL(_handle_menu_selected, p_which, success);
return success;
}
return false;
}
void EditorResourcePicker::_button_draw() {

View file

@ -71,20 +71,14 @@ Ref<Texture2D> EditorResourcePreviewGenerator::generate_from_path(const String &
bool EditorResourcePreviewGenerator::generate_small_preview_automatically() const {
bool success = false;
if (GDVIRTUAL_CALL(_generate_small_preview_automatically, success)) {
GDVIRTUAL_CALL(_generate_small_preview_automatically, success);
return success;
}
return false;
}
bool EditorResourcePreviewGenerator::can_generate_small_preview() const {
bool success = false;
if (GDVIRTUAL_CALL(_can_generate_small_preview, success)) {
GDVIRTUAL_CALL(_can_generate_small_preview, success);
return success;
}
return false;
}
void EditorResourcePreviewGenerator::_bind_methods() {

View file

@ -142,10 +142,8 @@ void EditorExportPlugin::_export_end_script() {
bool EditorExportPlugin::_begin_customize_resources(const Ref<EditorExportPlatform> &p_platform, const Vector<String> &p_features) const {
bool ret = false;
if (GDVIRTUAL_CALL(_begin_customize_resources, p_platform, p_features, ret)) {
GDVIRTUAL_CALL(_begin_customize_resources, p_platform, p_features, ret);
return ret;
}
return false;
}
Ref<Resource> EditorExportPlugin::_customize_resource(const Ref<Resource> &p_resource, const String &p_path) {
@ -158,10 +156,8 @@ Ref<Resource> EditorExportPlugin::_customize_resource(const Ref<Resource> &p_res
bool EditorExportPlugin::_begin_customize_scenes(const Ref<EditorExportPlatform> &p_platform, const Vector<String> &p_features) const {
bool ret = false;
if (GDVIRTUAL_CALL(_begin_customize_scenes, p_platform, p_features, ret)) {
GDVIRTUAL_CALL(_begin_customize_scenes, p_platform, p_features, ret);
return ret;
}
return false;
}
Node *EditorExportPlugin::_customize_scene(Node *p_root, const String &p_path) {

View file

@ -38,27 +38,18 @@ void EditorResourceConversionPlugin::_bind_methods() {
String EditorResourceConversionPlugin::converts_to() const {
String ret;
if (GDVIRTUAL_CALL(_converts_to, ret)) {
GDVIRTUAL_CALL(_converts_to, ret);
return ret;
}
return "";
}
bool EditorResourceConversionPlugin::handles(const Ref<Resource> &p_resource) const {
bool ret = false;
if (GDVIRTUAL_CALL(_handles, p_resource, ret)) {
GDVIRTUAL_CALL(_handles, p_resource, ret);
return ret;
}
return false;
}
Ref<Resource> EditorResourceConversionPlugin::convert(const Ref<Resource> &p_resource) const {
Ref<Resource> ret;
if (GDVIRTUAL_CALL(_convert, p_resource, ret)) {
GDVIRTUAL_CALL(_convert, p_resource, ret);
return ret;
}
return Ref<Resource>();
}

View file

@ -1078,11 +1078,9 @@ void EditorNode3DGizmoPlugin::_bind_methods() {
}
bool EditorNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) {
bool success;
if (GDVIRTUAL_CALL(_has_gizmo, p_spatial, success)) {
bool success = false;
GDVIRTUAL_CALL(_has_gizmo, p_spatial, success);
return success;
}
return false;
}
Ref<EditorNode3DGizmo> EditorNode3DGizmoPlugin::create_gizmo(Node3D *p_spatial) {
@ -1099,19 +1097,15 @@ Ref<EditorNode3DGizmo> EditorNode3DGizmoPlugin::create_gizmo(Node3D *p_spatial)
}
bool EditorNode3DGizmoPlugin::can_be_hidden() const {
bool ret;
if (GDVIRTUAL_CALL(_can_be_hidden, ret)) {
bool ret = true;
GDVIRTUAL_CALL(_can_be_hidden, ret);
return ret;
}
return true;
}
bool EditorNode3DGizmoPlugin::is_selectable_when_hidden() const {
bool ret;
if (GDVIRTUAL_CALL(_is_selectable_when_hidden, ret)) {
bool ret = false;
GDVIRTUAL_CALL(_is_selectable_when_hidden, ret);
return ret;
}
return false;
}
void EditorNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
@ -1120,26 +1114,20 @@ void EditorNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
bool EditorNode3DGizmoPlugin::is_handle_highlighted(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary) const {
bool ret = false;
if (GDVIRTUAL_CALL(_is_handle_highlighted, Ref<EditorNode3DGizmo>(p_gizmo), p_id, p_secondary, ret)) {
GDVIRTUAL_CALL(_is_handle_highlighted, Ref<EditorNode3DGizmo>(p_gizmo), p_id, p_secondary, ret);
return ret;
}
return false;
}
String EditorNode3DGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary) const {
String ret;
if (GDVIRTUAL_CALL(_get_handle_name, Ref<EditorNode3DGizmo>(p_gizmo), p_id, p_secondary, ret)) {
GDVIRTUAL_CALL(_get_handle_name, Ref<EditorNode3DGizmo>(p_gizmo), p_id, p_secondary, ret);
return ret;
}
return "";
}
Variant EditorNode3DGizmoPlugin::get_handle_value(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary) const {
Variant ret;
if (GDVIRTUAL_CALL(_get_handle_value, Ref<EditorNode3DGizmo>(p_gizmo), p_id, p_secondary, ret)) {
GDVIRTUAL_CALL(_get_handle_value, Ref<EditorNode3DGizmo>(p_gizmo), p_id, p_secondary, ret);
return ret;
}
return Variant();
}
void EditorNode3DGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary, Camera3D *p_camera, const Point2 &p_point) {
@ -1152,10 +1140,8 @@ void EditorNode3DGizmoPlugin::commit_handle(const EditorNode3DGizmo *p_gizmo, in
int EditorNode3DGizmoPlugin::subgizmos_intersect_ray(const EditorNode3DGizmo *p_gizmo, Camera3D *p_camera, const Vector2 &p_point) const {
int ret = -1;
if (GDVIRTUAL_CALL(_subgizmos_intersect_ray, Ref<EditorNode3DGizmo>(p_gizmo), p_camera, p_point, ret)) {
GDVIRTUAL_CALL(_subgizmos_intersect_ray, Ref<EditorNode3DGizmo>(p_gizmo), p_camera, p_point, ret);
return ret;
}
return -1;
}
Vector<int> EditorNode3DGizmoPlugin::subgizmos_intersect_frustum(const EditorNode3DGizmo *p_gizmo, const Camera3D *p_camera, const Vector<Plane> &p_frustum) const {
@ -1165,20 +1151,14 @@ Vector<int> EditorNode3DGizmoPlugin::subgizmos_intersect_frustum(const EditorNod
frustum[i] = p_frustum[i];
}
Vector<int> ret;
if (GDVIRTUAL_CALL(_subgizmos_intersect_frustum, Ref<EditorNode3DGizmo>(p_gizmo), p_camera, frustum, ret)) {
GDVIRTUAL_CALL(_subgizmos_intersect_frustum, Ref<EditorNode3DGizmo>(p_gizmo), p_camera, frustum, ret);
return ret;
}
return Vector<int>();
}
Transform3D EditorNode3DGizmoPlugin::get_subgizmo_transform(const EditorNode3DGizmo *p_gizmo, int p_id) const {
Transform3D ret;
if (GDVIRTUAL_CALL(_get_subgizmo_transform, Ref<EditorNode3DGizmo>(p_gizmo), p_id, ret)) {
GDVIRTUAL_CALL(_get_subgizmo_transform, Ref<EditorNode3DGizmo>(p_gizmo), p_id, ret);
return ret;
}
return Transform3D();
}
void EditorNode3DGizmoPlugin::set_subgizmo_transform(const EditorNode3DGizmo *p_gizmo, int p_id, Transform3D p_transform) {

View file

@ -59,19 +59,15 @@
/*** SYNTAX HIGHLIGHTER ****/
String EditorSyntaxHighlighter::_get_name() const {
String ret;
if (GDVIRTUAL_CALL(_get_name, ret)) {
String ret = "Unnamed";
GDVIRTUAL_CALL(_get_name, ret);
return ret;
}
return "Unnamed";
}
PackedStringArray EditorSyntaxHighlighter::_get_supported_languages() const {
PackedStringArray ret;
if (GDVIRTUAL_CALL(_get_supported_languages, ret)) {
GDVIRTUAL_CALL(_get_supported_languages, ret);
return ret;
}
return PackedStringArray();
}
Ref<EditorSyntaxHighlighter> EditorSyntaxHighlighter::_create() const {

View file

@ -87,10 +87,8 @@ void VisualShaderNodePlugin::set_editor(VisualShaderEditor *p_editor) {
Control *VisualShaderNodePlugin::create_editor(const Ref<Resource> &p_parent_resource, const Ref<VisualShaderNode> &p_node) {
Object *ret = nullptr;
if (GDVIRTUAL_CALL(_create_editor, p_parent_resource, p_node, ret)) {
GDVIRTUAL_CALL(_create_editor, p_parent_resource, p_node, ret);
return Object::cast_to<Control>(ret);
}
return nullptr;
}
void VisualShaderNodePlugin::_bind_methods() {

View file

@ -51,45 +51,35 @@ 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_state, ERR_INVALID_PARAMETER);
int err = OK;
if (GDVIRTUAL_CALL(_import_post, p_state, p_root, err)) {
GDVIRTUAL_CALL(_import_post, p_state, p_root, err);
return Error(err);
}
return OK;
}
Error GLTFDocumentExtension::import_preflight(Ref<GLTFState> p_state) {
ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
int err = OK;
if (GDVIRTUAL_CALL(_import_preflight, p_state, err)) {
GDVIRTUAL_CALL(_import_preflight, p_state, err);
return Error(err);
}
return OK;
}
Error GLTFDocumentExtension::import_post_parse(Ref<GLTFState> p_state) {
ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
int err = OK;
if (GDVIRTUAL_CALL(_import_post_parse, p_state, err)) {
GDVIRTUAL_CALL(_import_post_parse, p_state, err);
return Error(err);
}
return OK;
}
Error GLTFDocumentExtension::export_post(Ref<GLTFState> p_state) {
ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
int err = OK;
if (GDVIRTUAL_CALL(_export_post, p_state, err)) {
GDVIRTUAL_CALL(_export_post, p_state, err);
return Error(err);
}
return OK;
}
Error GLTFDocumentExtension::export_preflight(Node *p_root) {
ERR_FAIL_NULL_V(p_root, ERR_INVALID_PARAMETER);
int err = OK;
if (GDVIRTUAL_CALL(_export_preflight, p_root, err)) {
GDVIRTUAL_CALL(_export_preflight, p_root, err);
return Error(err);
}
return OK;
}
Error GLTFDocumentExtension::import_node(Ref<GLTFState> p_state, Ref<GLTFNode> p_gltf_node, Dictionary &r_dict, Node *p_node) {
@ -97,10 +87,8 @@ Error GLTFDocumentExtension::import_node(Ref<GLTFState> p_state, Ref<GLTFNode> p
ERR_FAIL_NULL_V(p_gltf_node, ERR_INVALID_PARAMETER);
ERR_FAIL_NULL_V(p_node, ERR_INVALID_PARAMETER);
int err = OK;
if (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 OK;
}
Error GLTFDocumentExtension::export_node(Ref<GLTFState> p_state, Ref<GLTFNode> p_gltf_node, Dictionary &r_dict, Node *p_node) {
@ -108,8 +96,6 @@ Error GLTFDocumentExtension::export_node(Ref<GLTFState> p_state, Ref<GLTFNode> p
ERR_FAIL_NULL_V(p_gltf_node, ERR_INVALID_PARAMETER);
ERR_FAIL_NULL_V(p_node, ERR_INVALID_PARAMETER);
int err = OK;
if (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 OK;
}

View file

@ -34,10 +34,8 @@
AABB VisualInstance3D::get_aabb() const {
AABB ret;
if (GDVIRTUAL_CALL(_get_aabb, ret)) {
GDVIRTUAL_CALL(_get_aabb, ret);
return ret;
}
return AABB();
}
AABB VisualInstance3D::get_transformed_aabb() const {

View file

@ -50,10 +50,8 @@ void AnimationNode::get_parameter_list(List<PropertyInfo> *r_list) const {
Variant AnimationNode::get_parameter_default_value(const StringName &p_parameter) const {
Variant ret;
if (GDVIRTUAL_CALL(_get_parameter_default_value, p_parameter, ret)) {
GDVIRTUAL_CALL(_get_parameter_default_value, p_parameter, ret);
return ret;
}
return Variant();
}
void AnimationNode::set_parameter(const StringName &p_name, const Variant &p_value) {
@ -312,12 +310,9 @@ String AnimationNode::get_input_name(int p_input) {
}
String AnimationNode::get_caption() const {
String ret;
if (GDVIRTUAL_CALL(_get_caption, ret)) {
String ret = "Node";
GDVIRTUAL_CALL(_get_caption, ret);
return ret;
}
return "Node";
}
void AnimationNode::add_input(const String &p_name) {
@ -344,12 +339,9 @@ void AnimationNode::remove_input(int p_index) {
}
double AnimationNode::process(double p_time, bool p_seek, bool p_seek_root) {
double ret;
if (GDVIRTUAL_CALL(_process, p_time, p_seek, p_seek_root, ret)) {
double ret = 0;
GDVIRTUAL_CALL(_process, p_time, p_seek, p_seek_root, ret);
return ret;
}
return 0;
}
void AnimationNode::set_filter_path(const NodePath &p_path, bool p_enable) {
@ -373,12 +365,9 @@ bool AnimationNode::is_path_filtered(const NodePath &p_path) const {
}
bool AnimationNode::has_filter() const {
bool ret;
if (GDVIRTUAL_CALL(_has_filter, ret)) {
bool ret = false;
GDVIRTUAL_CALL(_has_filter, ret);
return ret;
}
return false;
}
Array AnimationNode::_get_filters() const {
@ -407,10 +396,8 @@ void AnimationNode::_validate_property(PropertyInfo &p_property) const {
Ref<AnimationNode> AnimationNode::get_child_by_name(const StringName &p_name) {
Ref<AnimationNode> ret;
if (GDVIRTUAL_CALL(_get_child_by_name, p_name, ret)) {
GDVIRTUAL_CALL(_get_child_by_name, p_name, ret);
return ret;
}
return Ref<AnimationNode>();
}
void AnimationNode::_bind_methods() {

View file

@ -1558,10 +1558,8 @@ bool Control::is_minimum_size_adjust_blocked() const {
Size2 Control::get_minimum_size() const {
Vector2 ms;
if (GDVIRTUAL_CALL(_get_minimum_size, ms)) {
GDVIRTUAL_CALL(_get_minimum_size, ms);
return ms;
}
return Vector2();
}
void Control::set_custom_minimum_size(const Size2i &p_custom) {
@ -1806,11 +1804,8 @@ Variant Control::get_drag_data(const Point2 &p_point) {
}
Variant dd;
if (GDVIRTUAL_CALL(_get_drag_data, p_point, dd)) {
GDVIRTUAL_CALL(_get_drag_data, p_point, dd);
return dd;
}
return Variant();
}
bool Control::can_drop_data(const Point2 &p_point, const Variant &p_data) const {
@ -1822,10 +1817,8 @@ bool Control::can_drop_data(const Point2 &p_point, const Variant &p_data) const
}
bool ret = false;
if (GDVIRTUAL_CALL(_can_drop_data, p_point, p_data, ret)) {
GDVIRTUAL_CALL(_can_drop_data, p_point, p_data, ret);
return ret;
}
return false;
}
void Control::drop_data(const Point2 &p_point, const Variant &p_data) {
@ -2732,11 +2725,8 @@ void Control::end_bulk_theme_override() {
TypedArray<Vector2i> Control::structured_text_parser(TextServer::StructuredTextParser p_parser_type, const Array &p_args, const String &p_text) const {
if (p_parser_type == TextServer::STRUCTURED_TEXT_CUSTOM) {
TypedArray<Vector2i> ret;
if (GDVIRTUAL_CALL(_structured_text_parser, p_args, p_text, ret)) {
GDVIRTUAL_CALL(_structured_text_parser, p_args, p_text, ret);
return ret;
} else {
return TypedArray<Vector2i>();
}
} else {
return TS->parse_structured_text(p_parser_type, p_args, p_text);
}
@ -2821,10 +2811,8 @@ String Control::get_tooltip(const Point2 &p_pos) const {
Control *Control::make_custom_tooltip(const String &p_text) const {
Object *ret = nullptr;
if (GDVIRTUAL_CALL(_make_custom_tooltip, p_text, ret)) {
GDVIRTUAL_CALL(_make_custom_tooltip, p_text, ret);
return Object::cast_to<Control>(ret);
}
return nullptr;
}
// Base object overrides.

View file

@ -1475,11 +1475,9 @@ void GraphEdit::force_connection_drag_end() {
}
bool GraphEdit::is_node_hover_valid(const StringName &p_from, const int p_from_port, const StringName &p_to, const int p_to_port) {
bool valid = false;
if (GDVIRTUAL_CALL(_is_node_hover_valid, p_from, p_from_port, p_to, p_to_port, valid)) {
bool valid = true;
GDVIRTUAL_CALL(_is_node_hover_valid, p_from, p_from_port, p_to, p_to_port, valid);
return valid;
}
return true;
}
void GraphEdit::set_panning_scheme(PanningScheme p_scheme) {

View file

@ -56,10 +56,8 @@ Variant RichTextEffect::get_bbcode() const {
bool RichTextEffect::_process_effect_impl(Ref<CharFXTransform> p_cfx) {
bool return_value = false;
if (GDVIRTUAL_CALL(_process_custom_fx, p_cfx, return_value)) {
GDVIRTUAL_CALL(_process_custom_fx, p_cfx, return_value);
return return_value;
}
return false;
}
RichTextEffect::RichTextEffect() {

View file

@ -329,11 +329,9 @@ void MultiplayerAPI::_bind_methods() {
/// MultiplayerAPIExtension
Error MultiplayerAPIExtension::poll() {
int err;
if (GDVIRTUAL_CALL(_poll, err)) {
int err = OK;
GDVIRTUAL_CALL(_poll, err);
return (Error)err;
}
return OK;
}
void MultiplayerAPIExtension::set_multiplayer_peer(const Ref<MultiplayerPeer> &p_peer) {
@ -342,26 +340,20 @@ void MultiplayerAPIExtension::set_multiplayer_peer(const Ref<MultiplayerPeer> &p
Ref<MultiplayerPeer> MultiplayerAPIExtension::get_multiplayer_peer() {
Ref<MultiplayerPeer> peer;
if (GDVIRTUAL_CALL(_get_multiplayer_peer, peer)) {
GDVIRTUAL_CALL(_get_multiplayer_peer, peer);
return peer;
}
return nullptr;
}
int MultiplayerAPIExtension::get_unique_id() {
int id;
if (GDVIRTUAL_CALL(_get_unique_id, id)) {
int id = 1;
GDVIRTUAL_CALL(_get_unique_id, id);
return id;
}
return 1;
}
Vector<int> MultiplayerAPIExtension::get_peer_ids() {
Vector<int> ids;
if (GDVIRTUAL_CALL(_get_peer_ids, ids)) {
GDVIRTUAL_CALL(_get_peer_ids, ids);
return ids;
}
return Vector<int>();
}
Error MultiplayerAPIExtension::rpcp(Object *p_obj, int p_peer_id, const StringName &p_method, const Variant **p_arg, int p_argcount) {
@ -373,34 +365,26 @@ Error MultiplayerAPIExtension::rpcp(Object *p_obj, int p_peer_id, const StringNa
args.push_back(*p_arg[i]);
}
int ret = FAILED;
if (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 FAILED;
}
int MultiplayerAPIExtension::get_remote_sender_id() {
int id = 0;
if (GDVIRTUAL_CALL(_get_remote_sender_id, id)) {
GDVIRTUAL_CALL(_get_remote_sender_id, id);
return id;
}
return 0;
}
Error MultiplayerAPIExtension::object_configuration_add(Object *p_object, Variant p_config) {
int err = ERR_UNAVAILABLE;
if (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_UNAVAILABLE;
}
Error MultiplayerAPIExtension::object_configuration_remove(Object *p_object, Variant p_config) {
int err = ERR_UNAVAILABLE;
if (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_UNAVAILABLE;
}
void MultiplayerAPIExtension::_bind_methods() {

View file

@ -107,18 +107,15 @@ Shader::Mode Material::get_shader_mode() const {
}
bool Material::_can_do_next_pass() const {
bool ret;
if (GDVIRTUAL_CALL(_can_do_next_pass, ret)) {
bool ret = false;
GDVIRTUAL_CALL(_can_do_next_pass, ret);
return ret;
}
return false;
}
bool Material::_can_use_render_priority() const {
bool ret;
if (GDVIRTUAL_CALL(_can_use_render_priority, ret)) {
bool ret = false;
GDVIRTUAL_CALL(_can_use_render_priority, ret);
return ret;
}
return false;
}
void Material::_bind_methods() {

View file

@ -43,12 +43,9 @@ float StyleBox::get_style_margin(Side p_side) const {
}
bool StyleBox::test_mask(const Point2 &p_point, const Rect2 &p_rect) const {
bool ret;
if (GDVIRTUAL_CALL(_test_mask, p_point, p_rect, ret)) {
bool ret = true;
GDVIRTUAL_CALL(_test_mask, p_point, p_rect, ret);
return ret;
}
return true;
}
void StyleBox::draw(RID p_canvas_item, const Rect2 &p_rect) const {
@ -109,11 +106,8 @@ Point2 StyleBox::get_offset() const {
Size2 StyleBox::get_center_size() const {
Size2 ret;
if (GDVIRTUAL_CALL(_get_center_size, ret)) {
GDVIRTUAL_CALL(_get_center_size, ret);
return ret;
}
return Size2();
}
Rect2 StyleBox::get_draw_rect(const Rect2 &p_rect) const {

View file

@ -60,20 +60,14 @@ Size2 Texture2D::get_size() const {
}
bool Texture2D::is_pixel_opaque(int p_x, int p_y) const {
bool ret;
if (GDVIRTUAL_CALL(_is_pixel_opaque, p_x, p_y, ret)) {
bool ret = true;
GDVIRTUAL_CALL(_is_pixel_opaque, p_x, p_y, ret);
return ret;
}
return true;
}
bool Texture2D::has_alpha() const {
bool ret;
if (GDVIRTUAL_CALL(_has_alpha, ret)) {
bool ret = true;
GDVIRTUAL_CALL(_has_alpha, ret);
return ret;
}
return true;
}
void Texture2D::draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate, bool p_transpose) const {

View file

@ -456,11 +456,9 @@ void VisualShaderNodeCustom::update_ports() {
}
String VisualShaderNodeCustom::get_caption() const {
String ret;
if (GDVIRTUAL_CALL(_get_name, ret)) {
String ret = "Unnamed";
GDVIRTUAL_CALL(_get_name, ret);
return ret;
}
return "Unnamed";
}
int VisualShaderNodeCustom::get_input_port_count() const {
@ -559,11 +557,9 @@ String VisualShaderNodeCustom::generate_global_per_func(Shader::Mode p_mode, Vis
}
bool VisualShaderNodeCustom::is_available(Shader::Mode p_mode, VisualShader::Type p_type) const {
bool ret;
if (GDVIRTUAL_CALL(_is_available, p_mode, p_type, ret)) {
bool ret = true;
GDVIRTUAL_CALL(_is_available, p_mode, p_type, ret);
return ret;
}
return true;
}
void VisualShaderNodeCustom::set_input_port_default_value(int p_port, const Variant &p_value, const Variant &p_prev_value) {

View file

@ -36,11 +36,9 @@ void AudioEffectInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_
}
}
bool AudioEffectInstance::process_silence() const {
bool ret;
if (GDVIRTUAL_CALL(_process_silence, ret)) {
bool ret = false;
GDVIRTUAL_CALL(_process_silence, ret);
return ret;
}
return false;
}
void AudioEffectInstance::_bind_methods() {

View file

@ -54,11 +54,9 @@ bool AudioStreamPlayback::is_playing() const {
}
int AudioStreamPlayback::get_loop_count() const {
int ret;
if (GDVIRTUAL_CALL(_get_loop_count, ret)) {
int ret = 0;
GDVIRTUAL_CALL(_get_loop_count, ret);
return ret;
}
return 0;
}
double AudioStreamPlayback::get_playback_position() const {
@ -69,9 +67,7 @@ double AudioStreamPlayback::get_playback_position() const {
ERR_FAIL_V_MSG(0, "AudioStreamPlayback::get_playback_position unimplemented!");
}
void AudioStreamPlayback::seek(double p_time) {
if (GDVIRTUAL_CALL(_seek, p_time)) {
return;
}
GDVIRTUAL_CALL(_seek, p_time);
}
int AudioStreamPlayback::mix(AudioFrame *p_buffer, float p_rate_scale, int p_frames) {
@ -201,58 +197,44 @@ Ref<AudioStreamPlayback> AudioStream::instantiate_playback() {
}
String AudioStream::get_stream_name() const {
String ret;
if (GDVIRTUAL_CALL(_get_stream_name, ret)) {
GDVIRTUAL_CALL(_get_stream_name, ret);
return ret;
}
return String();
}
double AudioStream::get_length() const {
double ret;
if (GDVIRTUAL_CALL(_get_length, ret)) {
double ret = 0;
GDVIRTUAL_CALL(_get_length, ret);
return ret;
}
return 0;
}
bool AudioStream::is_monophonic() const {
bool ret;
if (GDVIRTUAL_CALL(_is_monophonic, ret)) {
bool ret = true;
GDVIRTUAL_CALL(_is_monophonic, ret);
return ret;
}
return true;
}
double AudioStream::get_bpm() const {
double ret = 0;
if (GDVIRTUAL_CALL(_get_bpm, ret)) {
GDVIRTUAL_CALL(_get_bpm, ret);
return ret;
}
return 0;
}
bool AudioStream::has_loop() const {
bool ret = 0;
if (GDVIRTUAL_CALL(_has_loop, ret)) {
GDVIRTUAL_CALL(_has_loop, ret);
return ret;
}
return 0;
}
int AudioStream::get_bar_beats() const {
int ret = 0;
if (GDVIRTUAL_CALL(_get_bar_beats, ret)) {
GDVIRTUAL_CALL(_get_bar_beats, ret);
return ret;
}
return 0;
}
int AudioStream::get_beat_count() const {
int ret = 0;
if (GDVIRTUAL_CALL(_get_beat_count, ret)) {
GDVIRTUAL_CALL(_get_beat_count, ret);
return ret;
}
return 0;
}
void AudioStream::tag_used(float p_offset) {

File diff suppressed because it is too large Load diff

View file

@ -100,33 +100,21 @@ StringName XRInterfaceExtension::get_name() const {
}
uint32_t XRInterfaceExtension::get_capabilities() const {
uint32_t capabilities;
if (GDVIRTUAL_CALL(_get_capabilities, capabilities)) {
uint32_t capabilities = 0;
GDVIRTUAL_CALL(_get_capabilities, capabilities);
return capabilities;
}
return 0;
}
bool XRInterfaceExtension::is_initialized() const {
bool initialised = false;
if (GDVIRTUAL_CALL(_is_initialized, initialised)) {
GDVIRTUAL_CALL(_is_initialized, initialised);
return initialised;
}
return false;
}
bool XRInterfaceExtension::initialize() {
bool initialised = false;
if (GDVIRTUAL_CALL(_initialize, initialised)) {
GDVIRTUAL_CALL(_initialize, initialised);
return initialised;
}
return false;
}
void XRInterfaceExtension::uninitialize() {
@ -150,13 +138,9 @@ PackedStringArray XRInterfaceExtension::get_suggested_pose_names(const StringNam
}
XRInterface::TrackingStatus XRInterfaceExtension::get_tracking_status() const {
uint32_t status;
if (GDVIRTUAL_CALL(_get_tracking_status, status)) {
uint32_t status = XR_UNKNOWN_TRACKING;
GDVIRTUAL_CALL(_get_tracking_status, status);
return TrackingStatus(status);
}
return XR_UNKNOWN_TRACKING;
}
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) {
@ -164,52 +148,34 @@ void XRInterfaceExtension::trigger_haptic_pulse(const String &p_action_name, con
}
bool XRInterfaceExtension::supports_play_area_mode(XRInterface::PlayAreaMode p_mode) {
bool is_supported;
if (GDVIRTUAL_CALL(_supports_play_area_mode, p_mode, is_supported)) {
bool is_supported = false;
GDVIRTUAL_CALL(_supports_play_area_mode, p_mode, is_supported);
return is_supported;
}
return false;
}
XRInterface::PlayAreaMode XRInterfaceExtension::get_play_area_mode() const {
uint32_t mode;
if (GDVIRTUAL_CALL(_get_play_area_mode, mode)) {
uint32_t mode = XR_PLAY_AREA_UNKNOWN;
GDVIRTUAL_CALL(_get_play_area_mode, mode);
return XRInterface::PlayAreaMode(mode);
}
return XRInterface::XR_PLAY_AREA_UNKNOWN;
}
bool XRInterfaceExtension::set_play_area_mode(XRInterface::PlayAreaMode p_mode) {
bool success;
if (GDVIRTUAL_CALL(_set_play_area_mode, p_mode, success)) {
bool success = false;
GDVIRTUAL_CALL(_set_play_area_mode, p_mode, success);
return success;
}
return false;
}
PackedVector3Array XRInterfaceExtension::get_play_area() const {
PackedVector3Array arr;
GDVIRTUAL_CALL(_get_play_area, arr);
return arr;
}
/** these will only be implemented on AR interfaces, so we want dummies for VR **/
bool XRInterfaceExtension::get_anchor_detection_is_enabled() const {
bool enabled;
if (GDVIRTUAL_CALL(_get_anchor_detection_is_enabled, enabled)) {
bool enabled = false;
GDVIRTUAL_CALL(_get_anchor_detection_is_enabled, enabled);
return enabled;
}
return false;
}
void XRInterfaceExtension::set_anchor_detection_is_enabled(bool p_enable) {
@ -218,53 +184,33 @@ void XRInterfaceExtension::set_anchor_detection_is_enabled(bool p_enable) {
}
int XRInterfaceExtension::get_camera_feed_id() {
int feed_id;
if (GDVIRTUAL_CALL(_get_camera_feed_id, feed_id)) {
int feed_id = 0;
GDVIRTUAL_CALL(_get_camera_feed_id, feed_id);
return feed_id;
}
return 0;
}
Size2 XRInterfaceExtension::get_render_target_size() {
Size2 size;
if (GDVIRTUAL_CALL(_get_render_target_size, size)) {
GDVIRTUAL_CALL(_get_render_target_size, size);
return size;
}
return Size2(0, 0);
}
uint32_t XRInterfaceExtension::get_view_count() {
uint32_t view_count;
if (GDVIRTUAL_CALL(_get_view_count, view_count)) {
uint32_t view_count = 1;
GDVIRTUAL_CALL(_get_view_count, view_count);
return view_count;
}
return 1;
}
Transform3D XRInterfaceExtension::get_camera_transform() {
Transform3D transform;
if (GDVIRTUAL_CALL(_get_camera_transform, transform)) {
GDVIRTUAL_CALL(_get_camera_transform, transform);
return transform;
}
return Transform3D();
}
Transform3D XRInterfaceExtension::get_transform_for_view(uint32_t p_view, const Transform3D &p_cam_transform) {
Transform3D transform;
if (GDVIRTUAL_CALL(_get_transform_for_view, p_view, p_cam_transform, transform)) {
GDVIRTUAL_CALL(_get_transform_for_view, p_view, p_cam_transform, transform);
return transform;
}
return Transform3D();
}
Projection XRInterfaceExtension::get_projection_for_view(uint32_t p_view, double p_aspect, double p_z_near, double p_z_far) {
@ -294,29 +240,20 @@ RID XRInterfaceExtension::get_vrs_texture() {
RID XRInterfaceExtension::get_color_texture() {
RID texture;
if (GDVIRTUAL_CALL(_get_color_texture, texture)) {
GDVIRTUAL_CALL(_get_color_texture, texture);
return texture;
} else {
return RID();
}
}
RID XRInterfaceExtension::get_depth_texture() {
RID texture;
if (GDVIRTUAL_CALL(_get_depth_texture, texture)) {
GDVIRTUAL_CALL(_get_depth_texture, texture);
return texture;
} else {
return RID();
}
}
RID XRInterfaceExtension::get_velocity_texture() {
RID texture;
if (GDVIRTUAL_CALL(_get_velocity_texture, texture)) {
GDVIRTUAL_CALL(_get_velocity_texture, texture);
return texture;
} else {
return RID();
}
}
void XRInterfaceExtension::add_blit(RID p_render_target, Rect2 p_src_rect, Rect2i p_dst_rect, bool p_use_layer, uint32_t p_layer, bool p_apply_lens_distortion, Vector2 p_eye_center, double p_k1, double p_k2, double p_upscale, double p_aspect_ratio) {
@ -351,13 +288,8 @@ void XRInterfaceExtension::pre_render() {
bool XRInterfaceExtension::pre_draw_viewport(RID p_render_target) {
bool do_render = true;
if (GDVIRTUAL_CALL(_pre_draw_viewport, p_render_target, do_render)) {
return do_render;
} else {
// if not implemented we're returning true
return true;
}
GDVIRTUAL_CALL(_pre_draw_viewport, p_render_target, do_render);
return do_render; // If not implemented we're returning true.
}
Vector<BlitToScreen> XRInterfaceExtension::post_draw_viewport(RID p_render_target, const Rect2 &p_screen_rect) {