From 2bffe4dc68b3b957b05ec073d15d743efdd24fce Mon Sep 17 00:00:00 2001 From: Relintai Date: Thu, 30 Dec 2021 01:18:03 +0100 Subject: [PATCH] Fix visual server array len == 0 errors. --- .../addons/mesh_data_resource_editor/MIDGizmo.gd | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/game/addons/mesh_data_resource_editor/MIDGizmo.gd b/game/addons/mesh_data_resource_editor/MIDGizmo.gd index fa77a459..ea35c3f8 100644 --- a/game/addons/mesh_data_resource_editor/MIDGizmo.gd +++ b/game/addons/mesh_data_resource_editor/MIDGizmo.gd @@ -123,12 +123,13 @@ func redraw(): _mesh_outline_generator.setup(_mdr) add_lines(_mesh_outline_generator.lines, material, false) - var vs : PoolVector3Array = PoolVector3Array() - - for i in _selected_points: - vs.append(_handle_points[i]) - - add_handles(vs, handles_material) + if _selected_points.size() > 0: + var vs : PoolVector3Array = PoolVector3Array() + + for i in _selected_points: + vs.append(_handle_points[i]) + + add_handles(vs, handles_material) func apply() -> void: if !_mdr: @@ -176,6 +177,9 @@ func forward_spatial_gui_input(index, camera, event): apply() redraw() else: + if _selected_points.size() == 0: + return false + _selected_points.resize(0) redraw()