Repository: godotengine/godot
File: editor/plugins/mesh_instance_3d_editor_plugin.cpp (C++)

Code before:
				body->add_child(cshape, true);

				Node *owner = get_tree()->get_edited_scene_root();

				ur->create_action(TTR("Create Static Trimesh Body"));
				ur->add_do_method(node, "add_child", body, true);
				ur->add_do_method(body, "set_owner", owner);
				ur->add_do_method(cshape, "set_owner", owner);
				ur->add_do_method(Node3DEditor::get_singleton(), SceneStringNames::get_singleton()->_request_gizmo, body);
				ur->add_do_method(Node3DEditor::get_singleton(), SceneStringNames::get_singleton()->_request_gizmo, cshape);
				ur->add_do_reference(body);
				ur->add_undo_method(node, "remove_child", body);
				ur->commit_action();
				return;
			}

			ur->create_action(TTR("Create Static Trimesh Body"));

			for (Node *E : selection) {
				MeshInstance3D *instance = Object::cast_to<MeshInstance3D>(E);
				if (!instance) {
					continue;
				}

				Ref<Mesh> m = instance->get_mesh();
				if (m.is_null()) {
					continue;
				}

				Ref<ConcavePolygonShape3D> shape = m->create_trimesh_shape();
				if (shape.is_null()) {
					continue;
				}

				CollisionShape3D *cshape = memnew(CollisionShape3D);
				cshape->set_shape(shape);
				StaticBody3D *body = memnew(StaticBody3D);
				body->add_child(cshape, true);

				Node *owner = get_tree()->get_edited_scene_root();

				ur->add_do_method(instance, "add_child", body, true);
				ur->add_do_method(body, "set_owner", owner);
				ur->add_do_method(cshape, "set_owner", owner);
				ur->add_do_method(Node3DEditor::get_singleton(), SceneStringNames::get_singleton()->_request_gizmo, body);
				ur->add_do_method(Node3DEditor::get_singleton(), SceneStringNames::get_singleton()->_request_gizmo, cshape);
				ur->add_do_reference(body);
				ur->add_undo_method(instance, "remove_child", body);
			}

			ur->commit_action();

Review comment (suggestion):
this is the culprit code I used in both case `shape_placement` while the second one was supposed to be `shape_type` must have been a bad copy paste. :(

Code after:
				err_dialog->popup_centered();
			}
		} break;

		case SHAPE_TYPE_MULTIPLE_CONVEX: {
			Ref<MeshConvexDecompositionSettings> settings;
			settings.instantiate();
			settings->set_max_convex_hulls(32);
			settings->set_max_concavity(0.001);

			shapes = p_mesh->convex_decompose(settings);

			if (p_verbose && shapes.is_empty()) {
				err_dialog->set_text(TTR("Couldn't create any collision shapes."));
				err_dialog->popup_centered();
			}
		} break;

		default:
			break;
	}
	return shapes;
}

void MeshInstance3DEditor::_create_collision_shape() {
	int placement_option = shape_placement->get_selected();
	int shape_type_option = shape_type->get_selected();

	EditorSelection *editor_selection = EditorNode::get_singleton()->get_editor_selection();
	EditorUndoRedoManager *ur = EditorUndoRedoManager::get_singleton();

	switch (shape_type_option) {
		case SHAPE_TYPE_TRIMESH: {
			ur->create_action(TTR(placement_option == SHAPE_PLACEMENT_SIBLING ? "Create Trimesh Collision Shape Sibling" : "Create Trimesh Static Body"));
		} break;
		case SHAPE_TYPE_SINGLE_CONVEX: {
			ur->create_action(TTR(placement_option == SHAPE_PLACEMENT_SIBLING ? "Create Single Convex Collision Shape Sibling" : "Create Single Convex Static Body"));
		} break;
		case SHAPE_TYPE_SIMPLIFIED_CONVEX: {
			ur->create_action(TTR(placement_option == SHAPE_PLACEMENT_SIBLING ? "Create Simplified Convex Collision Shape Sibling" : "Create Simplified Convex Static Body"));
		} break;
		case SHAPE_TYPE_MULTIPLE_CONVEX: {
			ur->create_action(TTR(placement_option == SHAPE_PLACEMENT_SIBLING ? "Create Multiple Convex Collision Shape Siblings" : "Create Multiple Convex Static Body"));
		} break;
		default:
			break;
	}

	List<Node *> selection = editor_selection->get_selected_node_list();

	bool verbose = false;