Merge pull request #67588 from KoBeWi/if(!GDVIRTUAL_CALL)don't

Simplify GDVIRTUAL_CALL calls
This commit is contained in:
Rémi Verschelde 2022-10-31 11:55:56 +01:00
commit be126d42d4
No known key found for this signature in database
GPG Key ID: C3336907360768E1
28 changed files with 507 additions and 983 deletions

View File

@ -52,11 +52,9 @@ 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 {
PackedStringArray ext;

View File

@ -74,13 +74,10 @@ 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) {
Vector<String> ret;
if (GDVIRTUAL_CALL(_get_classes_used, p_path, ret)) {
@ -98,23 +95,16 @@ 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 {
if (p_type.is_empty() || handles_type(p_type)) {
get_recognized_extensions(p_extensions);
@ -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,13 +171,10 @@ 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() {
BIND_ENUM_CONSTANT(CACHE_MODE_IGNORE);
BIND_ENUM_CONSTANT(CACHE_MODE_REUSE);

View File

@ -43,22 +43,16 @@ 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 {
PackedStringArray exts;
if (GDVIRTUAL_CALL(_get_recognized_extensions, p_resource, exts)) {

View File

@ -65,23 +65,17 @@ 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() {
GDVIRTUAL_CALL(_finalize);

View File

@ -1062,11 +1062,9 @@ 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) {
GDVIRTUAL_CALL(_parse_begin, p_object);
@ -1082,11 +1080,9 @@ 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) {
GDVIRTUAL_CALL(_parse_end, p_object);

View File

@ -571,11 +571,9 @@ 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) {
GDVIRTUAL_CALL(_forward_canvas_draw_over_viewport, p_overlay);
@ -606,14 +604,10 @@ 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) {
GDVIRTUAL_CALL(_forward_3d_draw_over_viewport, p_overlay);
}
@ -624,31 +618,22 @@ 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) {
GDVIRTUAL_CALL(_make_visible, p_visible);
}
@ -663,22 +648,16 @@ 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) {
GDVIRTUAL_CALL(_set_state, p_state);
}
@ -822,12 +801,10 @@ 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() {
EditorNode::get_singleton()->save_layout();

View File

@ -512,14 +512,11 @@ 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() {
if (dropping) {
Color color = get_theme_color(SNAME("accent_color"), SNAME("Editor"));

View File

@ -71,22 +71,16 @@ 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() {
GDVIRTUAL_BIND(_handles, "type");
GDVIRTUAL_BIND(_generate, "resource", "size");

View File

@ -142,11 +142,9 @@ 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) {
Ref<Resource> ret;
@ -158,11 +156,9 @@ 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) {
Node *ret = nullptr;

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,12 +1078,10 @@ 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) {
Ref<EditorNode3DGizmo> ret;
@ -1099,20 +1097,16 @@ 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) {
GDVIRTUAL_CALL(_redraw, p_gizmo);
@ -1120,27 +1114,21 @@ 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) {
GDVIRTUAL_CALL(_set_handle, Ref<EditorNode3DGizmo>(p_gizmo), p_id, p_secondary, p_camera, p_point);
@ -1152,11 +1140,9 @@ 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 {
TypedArray<Transform3D> frustum;
@ -1165,22 +1151,16 @@ 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) {
GDVIRTUAL_CALL(_set_subgizmo_transform, Ref<EditorNode3DGizmo>(p_gizmo), p_id, p_transform);
}

View File

@ -59,20 +59,16 @@
/*** 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 {
Ref<EditorSyntaxHighlighter> syntax_highlighter;

View File

@ -87,11 +87,9 @@ 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() {
GDVIRTUAL_BIND(_create_editor, "parent_resource", "visual_shader_node");

View File

@ -51,65 +51,51 @@ 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) {
ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
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) {
ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
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,11 +34,9 @@
AABB VisualInstance3D::get_aabb() const {
AABB ret;
if (GDVIRTUAL_CALL(_get_aabb, ret)) {
GDVIRTUAL_CALL(_get_aabb, ret);
return ret;
}
return AABB();
}
void VisualInstance3D::_update_visibility() {
if (!is_inside_tree()) {

View File

@ -50,11 +50,9 @@ 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) {
ERR_FAIL_COND(!state);
@ -312,14 +310,11 @@ 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) {
//root nodes can't add inputs
ERR_FAIL_COND(Object::cast_to<AnimationRootNode>(this) != nullptr);
@ -344,14 +339,11 @@ 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) {
if (p_enable) {
filter[p_path] = true;
@ -373,14 +365,11 @@ 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 {
Array paths;
@ -407,11 +396,9 @@ 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() {
ClassDB::bind_method(D_METHOD("get_input_count"), &AnimationNode::get_input_count);

View File

@ -1551,11 +1551,9 @@ 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 Size2 &p_custom) {
if (p_custom == data.custom_minimum_size) {
@ -1799,13 +1797,10 @@ 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 {
if (data.drag_owner.is_valid()) {
Object *obj = ObjectDB::get_instance(data.drag_owner);
@ -1815,11 +1810,9 @@ 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) {
if (data.drag_owner.is_valid()) {
@ -2725,11 +2718,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);
}
@ -2814,11 +2804,9 @@ 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,12 +1475,10 @@ 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) {
panning_scheme = p_scheme;

View File

@ -56,11 +56,9 @@ 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,12 +329,10 @@ 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) {
GDVIRTUAL_CALL(_set_multiplayer_peer, p_peer);
@ -342,27 +340,21 @@ 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) {
if (!GDVIRTUAL_IS_OVERRIDDEN(_rpc)) {
@ -373,35 +365,27 @@ 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() {
GDVIRTUAL_BIND(_poll);

View File

@ -107,19 +107,16 @@ 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() {
ClassDB::bind_method(D_METHOD("set_next_pass", "next_pass"), &Material::set_next_pass);

View File

@ -43,14 +43,11 @@ 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 {
if (GDVIRTUAL_REQUIRED_CALL(_draw, p_canvas_item, p_rect)) {
return;
@ -109,13 +106,10 @@ 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 {
Rect2 ret;
if (GDVIRTUAL_CALL(_get_draw_rect, p_rect, ret)) {

View File

@ -60,22 +60,16 @@ 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 {
if (GDVIRTUAL_CALL(_draw, p_canvas_item, p_pos, p_modulate, p_transpose)) {
return;

View File

@ -456,12 +456,10 @@ 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 {
return input_ports.size();
@ -559,12 +557,10 @@ 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) {
if (!is_initialized) {

View File

@ -36,12 +36,10 @@ 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() {
GDVIRTUAL_BIND(_process, "src_buffer", "dst_buffer", "frame_count");

View File

@ -54,12 +54,10 @@ 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 {
double ret;
@ -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,59 +197,45 @@ 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) {
if (tagged_frame != AudioServer::get_singleton()->get_mixed_frames()) {

File diff suppressed because it is too large Load Diff

View File

@ -100,35 +100,23 @@ 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() {
GDVIRTUAL_CALL(_uninitialize);
}
@ -150,123 +138,81 @@ 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) {
GDVIRTUAL_CALL(_trigger_haptic_pulse, p_action_name, p_tracker_name, p_frequency, p_amplitude, p_duration_sec, p_delay_sec);
}
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) {
// don't do anything here, this needs to be implemented on AR interface to enable/disable things like plane detection etc.
GDVIRTUAL_CALL(_set_anchor_detection_is_enabled, 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) {
Projection cm;
PackedFloat64Array arr;
@ -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) {