21a13649be
The function `_gen_shape_list` is using the resource `Res<Mesh>`, but during the import phase the resource used is instead `Ref<EditorSceneImporterMesh>`. Note: the `Ref<EditorSceneImporterMesh>` is an intermediate resource, that will be used to create a `Res<Mesh>` at the end of the import process. `Ref<EditorSceneImporterMesh>` and `Ref<Mesh>` are not inheriting each other, so the internal cast done by `Ref<>` during the assignment, is always null: ```c++ Ref<EditorSceneImporterMesh> import_mesh(/* Assume it's initialized */); CRASH_NOW(import_mesh.is_null()); Ref<Mesh> mesh = import_mesh; CRASH_NOW(mesh.is_null()); // <--- Here we have a crash, since it's impossible perform the above cast, and the `mesh` is always null. ``` Here the full list of call to `_gen_shape_list`, where we can notice that a `Ref<EditorSceneImporterMesh>` is passed: - https://github.com/AndreaCatania/godot/blob/master/editor/import/resource_importer_scene.cpp#L428 - https://github.com/AndreaCatania/godot/blob/master/editor/import/resource_importer_scene.cpp#L454-L458 - https://github.com/AndreaCatania/godot/blob/master/editor/import/resource_importer_scene.cpp#L512-L516 As you can notice, we always pass the following mesh: `Ref<EditorSceneImporterMesh> mesh = mi->get_mesh();`. We already have the function `_pre_gen_shape_list` that executes the exact same job but using the correct type; Since there is no further usage of the function `_gen_shape_list` in the code base, I think it's just some leftover code, so I removed it entirely to use the proper function. |
||
---|---|---|
.. | ||
atlas_import_failed.xpm | ||
collada.cpp | ||
collada.h | ||
editor_import_collada.cpp | ||
editor_import_collada.h | ||
editor_import_plugin.cpp | ||
editor_import_plugin.h | ||
resource_importer_bitmask.cpp | ||
resource_importer_bitmask.h | ||
resource_importer_csv_translation.cpp | ||
resource_importer_csv_translation.h | ||
resource_importer_image.cpp | ||
resource_importer_image.h | ||
resource_importer_layered_texture.cpp | ||
resource_importer_layered_texture.h | ||
resource_importer_obj.cpp | ||
resource_importer_obj.h | ||
resource_importer_scene.cpp | ||
resource_importer_scene.h | ||
resource_importer_shader_file.cpp | ||
resource_importer_shader_file.h | ||
resource_importer_texture_atlas.cpp | ||
resource_importer_texture_atlas.h | ||
resource_importer_texture.cpp | ||
resource_importer_texture.h | ||
resource_importer_wav.cpp | ||
resource_importer_wav.h | ||
scene_import_settings.cpp | ||
scene_import_settings.h | ||
scene_importer_mesh_node_3d.cpp | ||
scene_importer_mesh_node_3d.h | ||
scene_importer_mesh.cpp | ||
scene_importer_mesh.h | ||
SCsub |