From a55cfb671b564b146f7fb7e72b0358975779b5d5 Mon Sep 17 00:00:00 2001 From: Arsh Panesar Date: Sun, 5 Jun 2022 19:38:41 +0530 Subject: [PATCH] Fixed Populating MultimeshInstance Crash When populating a MultimeshInstance (node), Godot would set the new Multimesh's color and custom data format as the current node's multimesh, which would cause a crash if node's multimesh is null. Populate Function will now check if node has a multimesh or not, and set the new multimesh with default (NONE) values if node's multimesh is null. Fixes Issue #61553 --- editor/plugins/multimesh_editor_plugin.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/editor/plugins/multimesh_editor_plugin.cpp b/editor/plugins/multimesh_editor_plugin.cpp index e5c379629..c2b7a11cd 100644 --- a/editor/plugins/multimesh_editor_plugin.cpp +++ b/editor/plugins/multimesh_editor_plugin.cpp @@ -190,8 +190,15 @@ void MultiMeshEditor::_populate() { int instance_count = populate_amount->get_value(); multimesh->set_transform_format(MultiMesh::TRANSFORM_3D); - multimesh->set_color_format(node->get_multimesh()->get_color_format()); - multimesh->set_custom_data_format(node->get_multimesh()->get_custom_data_format()); + + if (node->get_multimesh().is_null()) { + multimesh->set_color_format(MultiMesh::COLOR_NONE); + multimesh->set_custom_data_format(MultiMesh::CUSTOM_DATA_NONE); + } else { + multimesh->set_color_format(node->get_multimesh()->get_color_format()); + multimesh->set_custom_data_format(node->get_multimesh()->get_custom_data_format()); + } + multimesh->set_instance_count(instance_count); float _tilt_random = populate_tilt_random->get_value();