Bugfix: loading vertex colors for B-Mesh (fix provided by Remo Arpagaus).

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10890 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
experimental
Kae..pl 11 years ago
parent 21f9aac4ce
commit a4b6107f5b
  1. 9
      engine/src/blender/com/jme3/scene/plugins/blender/meshes/MeshHelper.java

@ -485,13 +485,12 @@ public class MeshHelper extends AbstractBlenderHelper {
* @throws BlenderFileException * @throws BlenderFileException
* this exception is thrown when the blend file structure is somehow invalid or corrupted * this exception is thrown when the blend file structure is somehow invalid or corrupted
*/ */
public List<byte[]> getVerticesColors(Structure meshStructure, BlenderContext blenderContext) throws BlenderFileException { private List<byte[]> getVerticesColors(Structure meshStructure, BlenderContext blenderContext) throws BlenderFileException {
Pointer pMCol = (Pointer) meshStructure.getFieldValue("mcol"); Pointer pMCol = (Pointer) meshStructure.getFieldValue(this.isBMeshCompatible(meshStructure) ? "mloopcol" : "mcol");
List<byte[]> verticesColors = null; List<byte[]> verticesColors = null;
List<Structure> mCol = null;
if (pMCol.isNotNull()) { if (pMCol.isNotNull()) {
verticesColors = new ArrayList<byte[]>(); List<Structure> mCol = pMCol.fetchData(blenderContext.getInputStream());
mCol = pMCol.fetchData(blenderContext.getInputStream()); verticesColors = new ArrayList<byte[]>(mCol.size());
for (Structure color : mCol) { for (Structure color : mCol) {
byte r = ((Number) color.getFieldValue("r")).byteValue(); byte r = ((Number) color.getFieldValue("r")).byteValue();
byte g = ((Number) color.getFieldValue("g")).byteValue(); byte g = ((Number) color.getFieldValue("g")).byteValue();

Loading…
Cancel
Save