• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Main repository of MikuMikuStudio


Commit MetaInfo

Revision802c4f9854667eb6794c8068d7f4b356354495cd (tree)
Time2013-03-05 18:35:35
AuthorKaelthas_Spellsinger@o2.pl <Kaelthas_Spellsinger@o2.p...>
CommiterKaelthas_Spellsinger@o2.pl

Log Message

Bugfix: fixed an error that could create wrogn vertex to bone group assignment. This caused animation to be played badly because some vertices remained in their places instead of moving with the proper bone.

git-svn-id: http://jmonkeyengine.googlecode.com/svn/trunk@10463 75d07b2b-3a1a-0410-a2c5-0572b91ccdca

Change Summary

Incremental Difference

--- 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 @@
3131 */
3232 package com.jme3.scene.plugins.blender.animations;
3333
34+import java.util.ArrayList;
35+import java.util.HashMap;
36+import java.util.List;
37+import java.util.Map;
38+import java.util.logging.Level;
39+import java.util.logging.Logger;
40+
3441 import com.jme3.animation.Bone;
3542 import com.jme3.animation.BoneTrack;
3643 import com.jme3.animation.Skeleton;
3744 import com.jme3.math.Matrix4f;
38-import com.jme3.scene.Spatial;
3945 import com.jme3.scene.plugins.blender.AbstractBlenderHelper;
4046 import com.jme3.scene.plugins.blender.BlenderContext;
4147 import com.jme3.scene.plugins.blender.curves.BezierCurve;
4248 import com.jme3.scene.plugins.blender.exceptions.BlenderFileException;
4349 import com.jme3.scene.plugins.blender.file.Pointer;
4450 import com.jme3.scene.plugins.blender.file.Structure;
45-import java.util.ArrayList;
46-import java.util.HashMap;
47-import java.util.List;
48-import java.util.Map;
49-import java.util.logging.Level;
50-import java.util.logging.Logger;
5151
5252 /**
5353 * This class defines the methods to calculate certain aspects of animation and
--- 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;
314314 List<Structure> dw = pDW.fetchData(blenderContext.getInputStream());
315315 for (Structure deformWeight : dw) {
316316 Integer boneIndex = groupToBoneIndexMap.get(((Number) deformWeight.getFieldValue("def_nr")).intValue());
317- // null here means that we came accross group that has no bone attached to
318- if (boneIndex != null) {
319- float weight = ((Number) deformWeight.getFieldValue("weight")).floatValue();
317+ float weight = ((Number) deformWeight.getFieldValue("weight")).floatValue();
318+ // boneIndex == null: it here means that we came accross group that has no bone attached to, so simply ignore it
319+ // if weight == 0 and weightIndex == 0 then ignore the weight (do not set weight = 0 as a first weight)
320+ if (boneIndex != null && (weight > 0.0f || weightIndex > 0)) {
320321 if (weightIndex < MAXIMUM_WEIGHTS_PER_VERTEX) {
321322 if (weight == 0.0f) {
322323 boneIndex = Integer.valueOf(0);
@@ -341,8 +342,8 @@ import com.jme3.util.BufferUtils;
341342 weightToIndexMap.put(weight, lowestWeightAndIndex.getValue());
342343 }
343344 }
345+ ++weightIndex;
344346 }
345- ++weightIndex;
346347 }
347348 } else {
348349 // 0.0 weight indicates, do not transform this vertex, but keep it in bind pose.