3drepo / 3drepobouncer

A C++ library providing 3D Repo Scene Graph definition, repository management logic and manipulation logic. It is is essentially the refactored 3DRepoCore and (parts of) 3DRepoGUI
GNU Affero General Public License v3.0
29 stars 13 forks source link

ISSUE #647 Revit file crash #652

Closed sebjf closed 11 months ago

sebjf commented 11 months ago

This fixes #647

Description

This PR adds additional checks around the OdGiMapper, used to transform UVs when getting the geometry data.

Our use of this is based on the Kernel SDK's ColladaExportView sample.

Previously, we checked for vertex attributes and assumed if they were present, that a mapper would be available, but on some files this is not true. This PR adds a check using the dedicated isMapperEnabled and isMapperAvailable methods before trying to use it.

Though we checked for attributes before, it is possible the vertex data includes attributes other than UVs - at the moment, ODA has only one possible parameter for the mapping channels, kAllChannels, but just because we can't specify diffuse texture coords, doesn't mine others can't exist.

Another (probably more likely) explanation for this case (attributes but no mapper) is that the mapper is not created when the view has the Hidden style (as no textures are shown), but the geometry is defined with Uvs, which is the condition that triggers us to try and process them. The example failing model had the {3D} view set to the Hidden style.

Test cases

The file attached in the #647 is imported with the changes, and succeeds and shows in the viewer. Setting the style of the {3D} view to Textures and reimporting also shows the textures in the viewer.