diff options
22 files changed, 66 insertions, 51 deletions
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp index a363cc3694..5c39b2fa1b 100644 --- a/core/io/marshalls.cpp +++ b/core/io/marshalls.cpp @@ -94,7 +94,8 @@ static Error _decode_string(const uint8_t *&buf, int &len, int *r_len, String &r return OK; } -Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int *r_len, bool p_allow_objects) { +Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int *r_len, bool p_allow_objects, int p_depth) { + ERR_FAIL_COND_V_MSG(p_depth > Variant::MAX_RECURSION_DEPTH, ERR_OUT_OF_MEMORY, "Variant is too deep. Bailing."); const uint8_t *buf = p_buffer; int len = p_len; @@ -585,7 +586,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int Variant value; int used; - err = decode_variant(value, buf, len, &used, p_allow_objects); + err = decode_variant(value, buf, len, &used, p_allow_objects, p_depth + 1); if (err) { return err; } @@ -635,7 +636,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int Variant key, value; int used; - Error err = decode_variant(key, buf, len, &used, p_allow_objects); + Error err = decode_variant(key, buf, len, &used, p_allow_objects, p_depth + 1); ERR_FAIL_COND_V_MSG(err != OK, err, "Error when trying to decode Variant."); buf += used; @@ -644,7 +645,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int (*r_len) += used; } - err = decode_variant(value, buf, len, &used, p_allow_objects); + err = decode_variant(value, buf, len, &used, p_allow_objects, p_depth + 1); ERR_FAIL_COND_V_MSG(err != OK, err, "Error when trying to decode Variant."); buf += used; @@ -677,7 +678,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int for (int i = 0; i < count; i++) { int used = 0; Variant v; - Error err = decode_variant(v, buf, len, &used, p_allow_objects); + Error err = decode_variant(v, buf, len, &used, p_allow_objects, p_depth + 1); ERR_FAIL_COND_V_MSG(err != OK, err, "Error when trying to decode Variant."); buf += used; len -= used; diff --git a/core/io/marshalls.h b/core/io/marshalls.h index 4d7b98b749..fef3a1c2c1 100644 --- a/core/io/marshalls.h +++ b/core/io/marshalls.h @@ -212,7 +212,7 @@ public: EncodedObjectAsID() {} }; -Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int *r_len = nullptr, bool p_allow_objects = false); +Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int *r_len = nullptr, bool p_allow_objects = false, int p_depth = 0); Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bool p_full_objects = false, int p_depth = 0); #endif // MARSHALLS_H diff --git a/doc/classes/CodeEdit.xml b/doc/classes/CodeEdit.xml index 09696d4d2a..0e4e6ed258 100644 --- a/doc/classes/CodeEdit.xml +++ b/doc/classes/CodeEdit.xml @@ -589,7 +589,7 @@ <theme_item name="completion_font_color" data_type="color" type="Color" default="Color(0.67, 0.67, 0.67, 1)"> Font [Color] for the code completion popup. </theme_item> - <theme_item name="completion_scroll_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)"> + <theme_item name="completion_scroll_color" data_type="color" type="Color" default="Color(1, 1, 1, 0.29)"> [Color] of the scrollbar in the code completion popup. </theme_item> <theme_item name="completion_selected_color" data_type="color" type="Color" default="Color(0.26, 0.26, 0.27, 1)"> @@ -640,7 +640,7 @@ <theme_item name="completion_max_width" data_type="constant" type="int" default="50"> Max width of options in the code completion popup. Options longer then this will be cut off. </theme_item> - <theme_item name="completion_scroll_width" data_type="constant" type="int" default="3"> + <theme_item name="completion_scroll_width" data_type="constant" type="int" default="6"> Width of the scrollbar in the code completion popup. </theme_item> <theme_item name="line_spacing" data_type="constant" type="int" default="4"> diff --git a/doc/classes/Environment.xml b/doc/classes/Environment.xml index f2dbcec228..619ff06c02 100644 --- a/doc/classes/Environment.xml +++ b/doc/classes/Environment.xml @@ -57,7 +57,8 @@ The ambient light's energy. The higher the value, the stronger the light. </member> <member name="ambient_light_sky_contribution" type="float" setter="set_ambient_light_sky_contribution" getter="get_ambient_light_sky_contribution" default="1.0"> - Defines the amount of light that the sky brings on the scene. A value of 0 means that the sky's light emission has no effect on the scene illumination, thus all ambient illumination is provided by the ambient light. On the contrary, a value of 1 means that all the light that affects the scene is provided by the sky, thus the ambient light parameter has no effect on the scene. + Defines the amount of light that the sky brings on the scene. A value of [code]0.0[/code] means that the sky's light emission has no effect on the scene illumination, thus all ambient illumination is provided by the ambient light. On the contrary, a value of [code]1.0[/code] means that [i]all[/i] the light that affects the scene is provided by the sky, thus the ambient light parameter has no effect on the scene. + [b]Note:[/b] [member ambient_light_sky_contribution] is internally clamped between [code]0.0[/code] and [code]1.0[/code] (inclusive). </member> <member name="ambient_light_source" type="int" setter="set_ambient_source" getter="get_ambient_source" enum="Environment.AmbientSource" default="0"> </member> diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 73acea43fd..d5cd61d792 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -258,7 +258,7 @@ void EditorProperty::_notification(int p_what) { } int ofs = get_theme_constant(SNAME("font_offset")); - int text_limit = text_size; + int text_limit = text_size - ofs; if (checkable) { Ref<Texture2D> checkbox; @@ -280,8 +280,9 @@ void EditorProperty::_notification(int p_what) { } else { draw_texture(checkbox, check_rect.position, color2); } - ofs += get_theme_constant(SNAME("hseparator"), SNAME("Tree")) + checkbox->get_width() + get_theme_constant(SNAME("hseparation"), SNAME("CheckBox")); - text_limit -= ofs; + int check_ofs = get_theme_constant(SNAME("hseparator"), SNAME("Tree")) + checkbox->get_width() + get_theme_constant(SNAME("hseparation"), SNAME("CheckBox")); + ofs += check_ofs; + text_limit -= check_ofs; } else { check_rect = Rect2(); } @@ -289,7 +290,7 @@ void EditorProperty::_notification(int p_what) { if (can_revert && !is_read_only()) { Ref<Texture2D> reload_icon = get_theme_icon(SNAME("ReloadSmall"), SNAME("EditorIcons")); text_limit -= reload_icon->get_width() + get_theme_constant(SNAME("hseparator"), SNAME("Tree")) * 2; - revert_rect = Rect2(text_limit + get_theme_constant(SNAME("hseparator"), SNAME("Tree")), (size.height - reload_icon->get_height()) / 2, reload_icon->get_width(), reload_icon->get_height()); + revert_rect = Rect2(ofs + text_limit, (size.height - reload_icon->get_height()) / 2, reload_icon->get_width(), reload_icon->get_height()); Color color2(1, 1, 1); if (revert_hover) { diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 781b35d15b..43100ebf12 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -7033,7 +7033,7 @@ EditorNode::EditorNode() { add_editor_plugin(memnew(ControlEditorPlugin)); for (int i = 0; i < EditorPlugins::get_plugin_count(); i++) { - add_editor_plugin(EditorPlugins::create(i, this)); + add_editor_plugin(EditorPlugins::create(i)); } for (int i = 0; i < plugin_init_callback_count; i++) { diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h index f23c5f40f6..1a5be7a89b 100644 --- a/editor/editor_plugin.h +++ b/editor/editor_plugin.h @@ -43,7 +43,6 @@ #include "scene/main/node.h" #include "scene/resources/texture.h" -class EditorNode; class Node3D; class Camera3D; class EditorCommandPalette; @@ -312,7 +311,7 @@ public: VARIANT_ENUM_CAST(EditorPlugin::CustomControlContainer); VARIANT_ENUM_CAST(EditorPlugin::DockSlot); -typedef EditorPlugin *(*EditorPluginCreateFunc)(EditorNode *); +typedef EditorPlugin *(*EditorPluginCreateFunc)(); class EditorPlugins { enum { @@ -323,15 +322,15 @@ class EditorPlugins { static int creation_func_count; template <class T> - static EditorPlugin *creator(EditorNode *p_node) { - return memnew(T(p_node)); + static EditorPlugin *creator() { + return memnew(T); } public: static int get_plugin_count() { return creation_func_count; } - static EditorPlugin *create(int p_idx, EditorNode *p_editor) { + static EditorPlugin *create(int p_idx) { ERR_FAIL_INDEX_V(p_idx, creation_func_count, nullptr); - return creation_funcs[p_idx](p_editor); + return creation_funcs[p_idx](); } template <class T> diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 0c3f7287a5..c93a94e974 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -741,7 +741,7 @@ void EditorSettings::_load_godot2_text_editor_theme() { _initial_set("text_editor/theme/highlighting/completion_background_color", Color(0.17, 0.16, 0.2)); _initial_set("text_editor/theme/highlighting/completion_selected_color", Color(0.26, 0.26, 0.27)); _initial_set("text_editor/theme/highlighting/completion_existing_color", Color(0.87, 0.87, 0.87, 0.13)); - _initial_set("text_editor/theme/highlighting/completion_scroll_color", Color(1, 1, 1)); + _initial_set("text_editor/theme/highlighting/completion_scroll_color", Color(1, 1, 1, 0.29)); _initial_set("text_editor/theme/highlighting/completion_font_color", Color(0.67, 0.67, 0.67)); _initial_set("text_editor/theme/highlighting/text_color", Color(0.67, 0.67, 0.67)); _initial_set("text_editor/theme/highlighting/line_number_color", Color(0.67, 0.67, 0.67, 0.4)); diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 15664bbc0b..05aa638a4b 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -1544,7 +1544,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { const Color completion_background_color = dark_theme ? base_color : background_color; const Color completion_selected_color = alpha1; const Color completion_existing_color = alpha2; - const Color completion_scroll_color = alpha1; + // Same opacity as the scroll grabber editor icon. + const Color completion_scroll_color = Color(mono_value, mono_value, mono_value, 0.29); const Color completion_font_color = font_color; const Color text_color = font_color; const Color line_number_color = dim_color; diff --git a/modules/csg/csg_gizmos.cpp b/modules/csg/csg_gizmos.cpp index 6ad2274a53..95a0fc7ada 100644 --- a/modules/csg/csg_gizmos.cpp +++ b/modules/csg/csg_gizmos.cpp @@ -421,7 +421,7 @@ void CSGShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { } } -EditorPluginCSG::EditorPluginCSG(EditorNode *_p_editor) { +EditorPluginCSG::EditorPluginCSG() { Ref<CSGShape3DGizmoPlugin> gizmo_plugin = Ref<CSGShape3DGizmoPlugin>(memnew(CSGShape3DGizmoPlugin)); Node3DEditor::get_singleton()->add_gizmo_plugin(gizmo_plugin); } diff --git a/modules/csg/csg_gizmos.h b/modules/csg/csg_gizmos.h index f3c851d06b..43efe57e64 100644 --- a/modules/csg/csg_gizmos.h +++ b/modules/csg/csg_gizmos.h @@ -57,7 +57,7 @@ class EditorPluginCSG : public EditorPlugin { GDCLASS(EditorPluginCSG, EditorPlugin); public: - EditorPluginCSG(EditorNode *_p_editor); + EditorPluginCSG(); }; #endif // CSG_GIZMOS_H diff --git a/modules/gltf/editor_scene_exporter_gltf_plugin.cpp b/modules/gltf/editor_scene_exporter_gltf_plugin.cpp index f9bfde5597..601c70791c 100644 --- a/modules/gltf/editor_scene_exporter_gltf_plugin.cpp +++ b/modules/gltf/editor_scene_exporter_gltf_plugin.cpp @@ -53,7 +53,7 @@ bool SceneExporterGLTFPlugin::has_main_screen() const { return false; } -SceneExporterGLTFPlugin::SceneExporterGLTFPlugin(EditorNode *_p_node) { +SceneExporterGLTFPlugin::SceneExporterGLTFPlugin() { file_export_lib = memnew(EditorFileDialog); EditorNode::get_singleton()->get_gui_base()->add_child(file_export_lib); file_export_lib->connect("file_selected", callable_mp(this, &SceneExporterGLTFPlugin::_gltf2_dialog_action)); diff --git a/modules/gltf/editor_scene_exporter_gltf_plugin.h b/modules/gltf/editor_scene_exporter_gltf_plugin.h index 50febd45c9..c2c3f5710c 100644 --- a/modules/gltf/editor_scene_exporter_gltf_plugin.h +++ b/modules/gltf/editor_scene_exporter_gltf_plugin.h @@ -45,7 +45,7 @@ class SceneExporterGLTFPlugin : public EditorPlugin { public: virtual String get_name() const override; bool has_main_screen() const override; - SceneExporterGLTFPlugin(EditorNode *_p_node); + SceneExporterGLTFPlugin(); }; #endif // TOOLS_ENABLED #endif // EDITOR_SCENE_EXPORTER_GLTF_PLUGIN_H diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp index d1ca84fa6b..a7f93a6ce9 100644 --- a/modules/gridmap/grid_map_editor_plugin.cpp +++ b/modules/gridmap/grid_map_editor_plugin.cpp @@ -1489,7 +1489,7 @@ void GridMapEditorPlugin::make_visible(bool p_visible) { } } -GridMapEditorPlugin::GridMapEditorPlugin(EditorNode *_p_node) { +GridMapEditorPlugin::GridMapEditorPlugin() { EDITOR_DEF("editors/grid_map/editor_side", 1); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT, "editors/grid_map/editor_side", PROPERTY_HINT_ENUM, "Left,Right")); diff --git a/modules/gridmap/grid_map_editor_plugin.h b/modules/gridmap/grid_map_editor_plugin.h index 4a0ebdc237..10e466f096 100644 --- a/modules/gridmap/grid_map_editor_plugin.h +++ b/modules/gridmap/grid_map_editor_plugin.h @@ -257,7 +257,7 @@ public: virtual bool handles(Object *p_object) const override; virtual void make_visible(bool p_visible) override; - GridMapEditorPlugin(EditorNode *_p_node); + GridMapEditorPlugin(); ~GridMapEditorPlugin(); }; diff --git a/modules/navigation/navigation_mesh_editor_plugin.cpp b/modules/navigation/navigation_mesh_editor_plugin.cpp index af02bff4ca..04eca5fb0b 100644 --- a/modules/navigation/navigation_mesh_editor_plugin.cpp +++ b/modules/navigation/navigation_mesh_editor_plugin.cpp @@ -140,10 +140,9 @@ void NavigationMeshEditorPlugin::make_visible(bool p_visible) { } } -NavigationMeshEditorPlugin::NavigationMeshEditorPlugin(EditorNode *p_node) { - editor = p_node; +NavigationMeshEditorPlugin::NavigationMeshEditorPlugin() { navigation_mesh_editor = memnew(NavigationMeshEditor); - editor->get_main_control()->add_child(navigation_mesh_editor); + EditorNode::get_singleton()->get_main_control()->add_child(navigation_mesh_editor); add_control_to_container(CONTAINER_SPATIAL_EDITOR_MENU, navigation_mesh_editor->bake_hbox); navigation_mesh_editor->hide(); navigation_mesh_editor->bake_hbox->hide(); diff --git a/modules/navigation/navigation_mesh_editor_plugin.h b/modules/navigation/navigation_mesh_editor_plugin.h index 49ca28d3cf..0e4175eca0 100644 --- a/modules/navigation/navigation_mesh_editor_plugin.h +++ b/modules/navigation/navigation_mesh_editor_plugin.h @@ -35,7 +35,6 @@ #include "editor/editor_plugin.h" -class EditorNode; class NavigationRegion3D; class NavigationMeshEditor : public Control { @@ -70,7 +69,6 @@ class NavigationMeshEditorPlugin : public EditorPlugin { GDCLASS(NavigationMeshEditorPlugin, EditorPlugin); NavigationMeshEditor *navigation_mesh_editor; - EditorNode *editor; public: virtual String get_name() const override { return "NavigationMesh"; } @@ -79,7 +77,7 @@ public: virtual bool handles(Object *p_object) const override; virtual void make_visible(bool p_visible) override; - NavigationMeshEditorPlugin(EditorNode *p_node); + NavigationMeshEditorPlugin(); ~NavigationMeshEditorPlugin(); }; diff --git a/modules/vorbis/resource_importer_ogg_vorbis.cpp b/modules/vorbis/resource_importer_ogg_vorbis.cpp index ccd463fd52..d12e65a96a 100644 --- a/modules/vorbis/resource_importer_ogg_vorbis.cpp +++ b/modules/vorbis/resource_importer_ogg_vorbis.cpp @@ -136,11 +136,11 @@ Error ResourceImporterOGGVorbis::import(const String &p_source_file, const Strin // Have a page now. if (!initialized_stream) { - ogg_stream_init(&stream_state, ogg_page_serialno(&page)); - ERR_FAIL_COND_V_MSG((err = ogg_stream_check(&stream_state)), Error::ERR_INVALID_DATA, "Ogg stream error " + itos(err)); + if (ogg_stream_init(&stream_state, ogg_page_serialno(&page))) { + ERR_FAIL_V_MSG(Error::ERR_OUT_OF_MEMORY, "Failed allocating memory for OGG Vorbis stream."); + } initialized_stream = true; } - ERR_FAIL_COND_V_MSG((err = ogg_stream_check(&stream_state)), Error::ERR_INVALID_DATA, "Ogg stream error " + itos(err)); ogg_stream_pagein(&stream_state, &page); ERR_FAIL_COND_V_MSG((err = ogg_stream_check(&stream_state)), Error::ERR_INVALID_DATA, "Ogg stream error " + itos(err)); int desync_iters = 0; @@ -160,10 +160,12 @@ Error ResourceImporterOGGVorbis::import(const String &p_source_file, const Strin break; } if (packet_count == 0 && vorbis_synthesis_idheader(&packet) == 0) { - WARN_PRINT("Found a non-vorbis-header packet in a header position"); + print_verbose("Found a non-vorbis-header packet in a header position"); // Clearly this logical stream is not a vorbis stream, so destroy it and try again with the next page. - ogg_stream_destroy(&stream_state); - initialized_stream = false; + if (initialized_stream) { + ogg_stream_clear(&stream_state); + initialized_stream = false; + } break; } granule_pos = packet.granulepos; @@ -178,6 +180,14 @@ Error ResourceImporterOGGVorbis::import(const String &p_source_file, const Strin ogg_packet_sequence->push_page(granule_pos, packet_data); } } + if (initialized_stream) { + ogg_stream_clear(&stream_state); + } + ogg_sync_clear(&sync_state); + + if (ogg_packet_sequence->get_packet_granule_positions().is_empty()) { + ERR_FAIL_V_MSG(Error::ERR_FILE_CORRUPT, "OGG Vorbis decoding failed. Check that your data is a valid OGG Vorbis audio stream."); + } ogg_vorbis_stream->set_packet_sequence(ogg_packet_sequence); ogg_vorbis_stream->set_loop(loop); diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index a83e1e3128..6d5d1fee5e 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -466,7 +466,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, Ref<Te theme->set_color("completion_background_color", "CodeEdit", Color(0.17, 0.16, 0.2)); theme->set_color("completion_selected_color", "CodeEdit", Color(0.26, 0.26, 0.27)); theme->set_color("completion_existing_color", "CodeEdit", Color(0.87, 0.87, 0.87, 0.13)); - theme->set_color("completion_scroll_color", "CodeEdit", control_font_pressed_color); + theme->set_color("completion_scroll_color", "CodeEdit", control_font_pressed_color * Color(1, 1, 1, 0.29)); theme->set_color("completion_font_color", "CodeEdit", Color(0.67, 0.67, 0.67)); theme->set_color("font_color", "CodeEdit", control_font_color); theme->set_color("font_selected_color", "CodeEdit", Color(0, 0, 0)); @@ -490,7 +490,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, Ref<Te theme->set_constant("completion_lines", "CodeEdit", 7); theme->set_constant("completion_max_width", "CodeEdit", 50); - theme->set_constant("completion_scroll_width", "CodeEdit", 3); + theme->set_constant("completion_scroll_width", "CodeEdit", 6); theme->set_constant("line_spacing", "CodeEdit", 4 * scale); theme->set_constant("outline_size", "CodeEdit", 0); diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp index bf17a6ea97..82d8ad4444 100644 --- a/scene/resources/environment.cpp +++ b/scene/resources/environment.cpp @@ -155,7 +155,9 @@ float Environment::get_ambient_light_energy() const { } void Environment::set_ambient_light_sky_contribution(float p_ratio) { - ambient_sky_contribution = p_ratio; + // Sky contribution values outside the [0.0; 1.0] range don't make sense and + // can result in negative colors. + ambient_sky_contribution = CLAMP(p_ratio, 0.0, 1.0); _update_ambient_light(); } diff --git a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp index 2d34d2a2a0..718825d652 100644 --- a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp +++ b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp @@ -1818,11 +1818,14 @@ void RendererSceneRenderRD::_free_render_buffer_data(RenderBuffers *rb) { if (rb->blur[i].mipmaps[m].fb.is_valid()) { RD::get_singleton()->free(rb->blur[i].mipmaps[m].fb); } - if (rb->blur[i].mipmaps[m].half_fb.is_valid()) { - RD::get_singleton()->free(rb->blur[i].mipmaps[m].half_fb); - } - if (rb->blur[i].mipmaps[m].half_texture.is_valid()) { - RD::get_singleton()->free(rb->blur[i].mipmaps[m].half_texture); + // texture and framebuffer in both blur mipmaps are shared, so only free from the first one + if (i == 0) { + if (rb->blur[i].mipmaps[m].half_fb.is_valid()) { + RD::get_singleton()->free(rb->blur[i].mipmaps[m].half_fb); + } + if (rb->blur[i].mipmaps[m].half_texture.is_valid()) { + RD::get_singleton()->free(rb->blur[i].mipmaps[m].half_texture); + } } } rb->blur[i].mipmaps.clear(); diff --git a/servers/rendering/renderer_rd/renderer_storage_rd.cpp b/servers/rendering/renderer_rd/renderer_storage_rd.cpp index f345001539..b42591f9a3 100644 --- a/servers/rendering/renderer_rd/renderer_storage_rd.cpp +++ b/servers/rendering/renderer_rd/renderer_storage_rd.cpp @@ -3578,15 +3578,15 @@ void RendererStorageRD::mesh_instance_set_blend_shape_weight(RID p_mesh_instance void RendererStorageRD::_mesh_instance_clear(MeshInstance *mi) { for (uint32_t i = 0; i < mi->surfaces.size(); i++) { - if (mi->surfaces[i].vertex_buffer.is_valid()) { - RD::get_singleton()->free(mi->surfaces[i].vertex_buffer); - } if (mi->surfaces[i].versions) { for (uint32_t j = 0; j < mi->surfaces[i].version_count; j++) { RD::get_singleton()->free(mi->surfaces[i].versions[j].vertex_array); } memfree(mi->surfaces[i].versions); } + if (mi->surfaces[i].vertex_buffer.is_valid()) { + RD::get_singleton()->free(mi->surfaces[i].vertex_buffer); + } } mi->surfaces.clear(); |