"Number of vertices differ" for 2 meshes with one skeleton

Started by kkl, October 05, 2015, 05:06:29 PM

Previous topic - Next topic

kkl

Hi raft,

I got this error message when converting ogre xml to bones. The 2 objects in Blender and the objects are sharing the same skeleton. What actually caused this error, since 2 objects are suppose to be different in their number of vertices and sharing the same skeleton? Did I miss anything when i separate the object into 2 with sharing skeleton?

raft


kkl

Sure. Here's the stack trace:


Exception in thread "main" java.lang.IllegalArgumentException: Number of vertices differ!
        at raft.jpct.bones.SkinData.checkAlmostEqual(SkinData.java:63)
        at raft.jpct.bones.Animated3D.mergeAnimations(Animated3D.java:607)
        at raft.jpct.bones.AnimatedGroup.mergeAnimations(AnimatedGroup.java:368)
        at raft.jpct.bones.util.JMEOgreImporter.loadGroup(JMEOgreImporter.java:95)
        at raft.jpct.bones.util.JMEOgreImporter.run(JMEOgreImporter.java:69)
        at raft.jpct.bones.util.JMEOgreImporter.main(JMEOgreImporter.java:170)

raft

seems as you are providing multiple input files to ogre importer script. in that case script assumes you are trying to merge multiple animation files. animations can only be merged if they have the same skeleton and mesh.

possibly this is not what you want, you want objects merged into a group, not animations merged. you should be able to export 2 obejcts at the same time from your editor. it's possible with OgreMax.

kkl

Quotepossibly this is not what you want, you want objects merged into a group, not animations merged.
Yup, you are right. I just want the 2 objects to be in one AnimationGroup but share the same skeleton. I'm able to export 2 objects out of Blender, 2 mesh xml and 2 skeleton xml respectively (the number of bones for the 2 skeleton xml are the same). How do we make the 2 objects merged into 1 AnimationGroup? Not by using the script with multiple input files? Or should we do it manually in code instead?

raft

how do you export 2 objects, one by one or at the same time? I'm not a Blender user but with OgreMax when you export multiple objects at the same time, they are exported into a single mesh and skeleton file. like ninja.xml (it contains both the body and the sword mesh)

kkl

At the same time, but it creates 2 mesh xml and 2 skeleton xml instead. How do you export it from OrgeMax? Maybe I can imitate some similar settings from OrgeMax to blender2orge.

raft

in OgreMax there is a dialog box in which you select the objects you want to export and that's all as far as I remember

raft

maybe there is an option like 'export as submesh' in exporter?

kkl

No option for export as submesh. The attachment is the screenshot of blender2orge settings.

I read abit of the blender2orge readme and it says this in FAQ:
QuoteQ: I have hundres of objects, is there a way i can merge them on export only?
A: Yes, just add them to a group named starting with "merge", or link the group.

So I tried to put the 2 objects into a merge group. It still exports 2 mesh xml and 2 skeleton xml, but with addition merge.mesh.xml. I use that file to convert to raft bones, it shows another error:

Exception in thread "main" java.lang.IllegalArgumentException: No controller found in OgreEntityNode. Means there is no skeleton or pose animation!
        at raft.jpct.bones.BonesImporter.importOgre(BonesImporter.java:135)
        at raft.jpct.bones.util.JMEOgreImporter.loadGroup(JMEOgreImporter.java:112)
        at raft.jpct.bones.util.JMEOgreImporter.loadGroup(JMEOgreImporter.java:88)
        at raft.jpct.bones.util.JMEOgreImporter.run(JMEOgreImporter.java:69)
        at raft.jpct.bones.util.JMEOgreImporter.main(JMEOgreImporter.java:170)


Does it have anything similar like that in OrgeMax?

raft

it has been quite a while since I used OgreMax last time but no, there were nothing like that in OgreMax.

you got that error, because somehow skeleton and your mesh is not associated. please compare your merge.mesh.xml with ninja.mesh.xml. do they look similar? in the bottom of ninja.mesh.xml there is a line:

<skeletonlink name="ninja.skeleton" />

possibly that's missing in your merged file. try manually adding it to see if it helps

kkl

yea the merge xml does not have the skeletonlink. If compared to ninja, ninja has 2 submeshes, but my merge xml has 1 submesh only. I also tried to copy and paste in all the xml to merge it to one, but it has "<boneassignments>" in each mesh xml and I have no idea what key is used to group them tgt (they are not in ninja xml though). I think it's still incorrect when exporting.

Or worst case, is it possible if we merge them using raft source code manually instead?

raft

mm then possibly that merge operation actually merges all objects into a single object.

please try this bones.jar. in the past I did some work to merge groups similar to what you need, then commented it out. this jar activates it again.

to use it you need to pass -mergeGroups switch to script file (by default if multiple input files are given it tries to merge animations not groups)

jmeOgre2Bones -mergeGroups -out out.file -in mesh1.xml mesh2.xml..

even if it works, there is a limitation at the moment, you cannot merge groups with pose animations.


kkl

hi raft, i tried with jar u gave me and it actually able to merge 2 objects into 1, but when animating it, only 1 object is working. The other remains still. Am i missing something?


raft

possibly not. that code wasnt tested properly. can you please try the files one by one and confirm that animations are working for each file individually