Bones - Skeletal and Pose Animations for jPCT/jPCT-AE > Bones

BonesIO Question

<< < (2/4) > >>

AGP:
Thanks for replying. My problem is Gson's fault. Clean, near-identical to yours, code produced a perfect model, loaded quickly, but with many copies of the same Skeleton. It turns out that Gson doesn't do instances very well. I'm working on a registerTypeAdapterFactory solution which is producing NullPointerExceptions for SkinClipSequences (but for no other class, including Skeleton and SkeletonPose). I also tried Jackson with no success, so I returned to Gson. I expect to succeed soon, and I will post the sources for BonesIO, AnimatedGroup and Animated3D here.

AGP:
I'm stuck, now, at an Exception in thread "main" com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: there is already a channel for joint 84. But I'm serializing the data as-is. I wonder if it's related to the potentially null instances of JointChannel in SkinClip.iterator().

raft:
Difficult to make a comment without knowing how you are actually importing/reading the data.

AGP:
I made the SkinClips work (in the sense that they're filled properly) by making a custom serializer and deserializer for them. But now I'm getting the same instancing issue with Skeletons. So I wrote the hacky method below and called it at the very end of the appropriate AnimatedGroup constructor. Now when I comment out the if (skeleton != pose.skeleton) test in SkinClip.applyTo(...), my model gets all bunched-up once, then doesn't animated at all (but doesn't crash, either) again.


--- Code: --- private void attemptSkeletonInstanceFix() {//Gson Skeleton instance crap
     SkinClip lastClip = skinClipSequence.getClip(0);
     if (lastClip.getSkeleton().equals(objects[0].getSkeleton()) && lastClip.getSkeleton() != objects[0].getSkeleton()) {
lastClip.skeleton = objects[0].getSkeleton();
     }
     for (int i = 1; i < skinClipSequence.getSize(); i++) {
if (lastClip.getSkeleton().equals(skinClipSequence.getClip(i).getSkeleton()) && lastClip.getSkeleton() != skinClipSequence.getClip(i).getSkeleton())
     skinClipSequence.getClip(i).skeleton = lastClip.getSkeleton();
lastClip = skinClipSequence.getClip(i);
     }
     for (Animated3D object : objects)
object.currentPose.skeleton = objects[0].getSkeleton();
}

--- End code ---

raft:
isnt this always returning false?

--- Code: ---if (lastClip.getSkeleton().equals(objects[0].getSkeleton()) && lastClip.getSkeleton() != objects[0].getSkeleton())
--- End code ---

like

--- Code: ---if (a.equals(b) && a != b)
--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version