Bugfix: fixed a bug that caused importer to crash when the author of the
blend file assigned non existing UV coordinates group name to a mesh.
This commit is contained in:
parent
f1a0125dc2
commit
953a301d5e
@ -168,9 +168,11 @@ public final class MaterialContext implements Savable {
|
||||
|
||||
this.setTexture(material, combinedTexture.getMappingType(), combinedTexture.getResultTexture());
|
||||
List<Vector2f> uvs = combinedTexture.getResultUVS();
|
||||
VertexBuffer uvCoordsBuffer = new VertexBuffer(TextureHelper.TEXCOORD_TYPES[textureIndex++]);
|
||||
uvCoordsBuffer.setupData(Usage.Static, 2, Format.Float, BufferUtils.createFloatBuffer(uvs.toArray(new Vector2f[uvs.size()])));
|
||||
geometry.getMesh().setBuffer(uvCoordsBuffer);
|
||||
if(uvs != null && uvs.size() > 0) {
|
||||
VertexBuffer uvCoordsBuffer = new VertexBuffer(TextureHelper.TEXCOORD_TYPES[textureIndex++]);
|
||||
uvCoordsBuffer.setupData(Usage.Static, 2, Format.Float, BufferUtils.createFloatBuffer(uvs.toArray(new Vector2f[uvs.size()])));
|
||||
geometry.getMesh().setBuffer(uvCoordsBuffer);
|
||||
}//uvs might be null if the user assigned non existing UV coordinates group name to the mesh (this should be fixed in blender file)
|
||||
} else {
|
||||
LOGGER.log(Level.WARNING, "The texture could not be applied because JME only supports up to {0} different UV's.", TextureHelper.TEXCOORD_TYPES.length);
|
||||
}
|
||||
|
@ -158,6 +158,9 @@ public class CombinedTexture {
|
||||
} else {
|
||||
resultUVS = userDefinedUVCoordinates.get(textureData.uvCoordinatesName);
|
||||
}
|
||||
if(resultUVS == null && LOGGER.isLoggable(Level.WARNING)) {
|
||||
LOGGER.warning("The texture " + textureData.texture.getName() + " has assigned non existing UV coordinates group: " + textureData.uvCoordinatesName + ".");
|
||||
}
|
||||
masterUserUVSetName = textureData.uvCoordinatesName;
|
||||
} else {
|
||||
TemporalMesh temporalMesh = (TemporalMesh) blenderContext.getLoadedFeature(geometriesOMA, LoadedDataType.TEMPORAL_MESH);
|
||||
|
Loading…
x
Reference in New Issue
Block a user