Quellcode durchsuchen

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
Kae..pl vor 12 Jahren
Ursprung
Commit
a4b6107f5b

+ 4 - 5
engine/src/blender/com/jme3/scene/plugins/blender/meshes/MeshHelper.java

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