From fc96e52a4c085a0351a37fe571d51d8cdfb288e2 Mon Sep 17 00:00:00 2001 From: "Kae..pl" Date: Mon, 4 Mar 2013 11:06:18 +0000 Subject: [PATCH] Bugfix: fixed lowes weight removal method that did not remove all lowest vertices that were necessary (thanks to Tobias Downer for finding it :) ). git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10459 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../scene/plugins/blender/modifiers/ArmatureModifier.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/modifiers/ArmatureModifier.java b/engine/src/blender/com/jme3/scene/plugins/blender/modifiers/ArmatureModifier.java index 8b2e8611b..c6c8f1e1e 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/modifiers/ArmatureModifier.java +++ b/engine/src/blender/com/jme3/scene/plugins/blender/modifiers/ArmatureModifier.java @@ -332,8 +332,11 @@ import com.jme3.util.BufferUtils; warnAboutTooManyVertexWeights = true; Entry lowestWeightAndIndex = weightToIndexMap.firstEntry(); if (lowestWeightAndIndex != null && lowestWeightAndIndex.getKey() < weight) { - weightsFloatData.put(lowestWeightAndIndex.getValue(), weight); - indicesData.put(lowestWeightAndIndex.getValue(), boneIndex.byteValue()); + // we apply the weight to all referenced vertices + for (Integer index : vertexIndices) { + weightsFloatData.put(index * MAXIMUM_WEIGHTS_PER_VERTEX + lowestWeightAndIndex.getValue(), weight); + indicesData.put(index * MAXIMUM_WEIGHTS_PER_VERTEX + lowestWeightAndIndex.getValue(), boneIndex.byteValue()); + } weightToIndexMap.remove(lowestWeightAndIndex.getKey()); weightToIndexMap.put(weight, lowestWeightAndIndex.getValue()); }