diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/animations/ArmatureHelper.java b/engine/src/blender/com/jme3/scene/plugins/blender/animations/ArmatureHelper.java index a0112aba6..2775fb21a 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/animations/ArmatureHelper.java +++ b/engine/src/blender/com/jme3/scene/plugins/blender/animations/ArmatureHelper.java @@ -31,23 +31,23 @@ */ package com.jme3.scene.plugins.blender.animations; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + import com.jme3.animation.Bone; import com.jme3.animation.BoneTrack; import com.jme3.animation.Skeleton; import com.jme3.math.Matrix4f; -import com.jme3.scene.Spatial; import com.jme3.scene.plugins.blender.AbstractBlenderHelper; import com.jme3.scene.plugins.blender.BlenderContext; import com.jme3.scene.plugins.blender.curves.BezierCurve; import com.jme3.scene.plugins.blender.exceptions.BlenderFileException; import com.jme3.scene.plugins.blender.file.Pointer; import com.jme3.scene.plugins.blender.file.Structure; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; /** * This class defines the methods to calculate certain aspects of animation and 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 c6c8f1e1e..a69103f6b 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 @@ -314,9 +314,10 @@ import com.jme3.util.BufferUtils; List dw = pDW.fetchData(blenderContext.getInputStream()); for (Structure deformWeight : dw) { Integer boneIndex = groupToBoneIndexMap.get(((Number) deformWeight.getFieldValue("def_nr")).intValue()); - // null here means that we came accross group that has no bone attached to - if (boneIndex != null) { - float weight = ((Number) deformWeight.getFieldValue("weight")).floatValue(); + float weight = ((Number) deformWeight.getFieldValue("weight")).floatValue(); + // boneIndex == null: it here means that we came accross group that has no bone attached to, so simply ignore it + // if weight == 0 and weightIndex == 0 then ignore the weight (do not set weight = 0 as a first weight) + if (boneIndex != null && (weight > 0.0f || weightIndex > 0)) { if (weightIndex < MAXIMUM_WEIGHTS_PER_VERTEX) { if (weight == 0.0f) { boneIndex = Integer.valueOf(0); @@ -341,8 +342,8 @@ import com.jme3.util.BufferUtils; weightToIndexMap.put(weight, lowestWeightAndIndex.getValue()); } } + ++weightIndex; } - ++weightIndex; } } else { // 0.0 weight indicates, do not transform this vertex, but keep it in bind pose.