diff --git a/engine/src/core/com/jme3/scene/BatchNode.java b/engine/src/core/com/jme3/scene/BatchNode.java index 6be339992..2f7d983e1 100644 --- a/engine/src/core/com/jme3/scene/BatchNode.java +++ b/engine/src/core/com/jme3/scene/BatchNode.java @@ -414,6 +414,7 @@ public class BatchNode extends Node implements Savable { int totalVerts = 0; int totalTris = 0; int totalLodLevels = 0; + int maxWeights = -1; Mesh.Mode mode = null; for (Geometry geom : geometries) { @@ -450,6 +451,8 @@ public class BatchNode extends Node implements Savable { compsForBuf[vb.getBufferType().ordinal()] = vb.getNumComponents(); formatForBuf[vb.getBufferType().ordinal()] = vb.getFormat(); } + + maxWeights = Math.max(maxWeights, geom.getMesh().getMaxNumWeights()); if (mode != null && mode != listMode) { throw new UnsupportedOperationException("Cannot combine different" @@ -459,6 +462,7 @@ public class BatchNode extends Node implements Savable { compsForBuf[VertexBuffer.Type.Index.ordinal()] = components; } + outMesh.setMaxNumWeights(maxWeights); outMesh.setMode(mode); if (totalVerts >= 65536) { // make sure we create an UnsignedInt buffer so diff --git a/engine/src/tools/jme3tools/optimize/GeometryBatchFactory.java b/engine/src/tools/jme3tools/optimize/GeometryBatchFactory.java index 7cc09ef15..ef9f2bbbc 100644 --- a/engine/src/tools/jme3tools/optimize/GeometryBatchFactory.java +++ b/engine/src/tools/jme3tools/optimize/GeometryBatchFactory.java @@ -99,6 +99,7 @@ public class GeometryBatchFactory { int totalVerts = 0; int totalTris = 0; int totalLodLevels = 0; + int maxWeights = -1; Mode mode = null; for (Geometry geom : geometries) { @@ -133,6 +134,8 @@ public class GeometryBatchFactory { compsForBuf[vb.getBufferType().ordinal()] = vb.getNumComponents(); formatForBuf[vb.getBufferType().ordinal()] = vb.getFormat(); } + + maxWeights = Math.max(maxWeights, geom.getMesh().getMaxNumWeights()); if (mode != null && mode != listMode) { throw new UnsupportedOperationException("Cannot combine different" @@ -142,6 +145,7 @@ public class GeometryBatchFactory { compsForBuf[Type.Index.ordinal()] = components; } + outMesh.setMaxNumWeights(maxWeights); outMesh.setMode(mode); if (totalVerts >= 65536) { // make sure we create an UnsignedInt buffer so