OgreXMLConverter bug?

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
richFoto
Gnoblar
Posts: 4
Joined: Tue May 15, 2007 7:59 pm

OgreXMLConverter bug?

Post by richFoto »

I have an OGRE mesh file that I can convert it into XML, but cannot convert the same XML file back to binary. The mesh file was originally generated by the Maya exporter and it has a number of morphs stored as "pose". Here is the error message:

-----------------------------------
Details:
-----------------------------------
Error #: 7
Function: XMLMeshSerializer::readPoses
Description: Required attribute 'index' missing on pose.
File: ..\src\OgreXMLMeshSerializer.cpp
Line: 1291
Stack unwinding: <<beginning of stack>>


I checked the source code (from koders.com), found that if there is only one mesh (as in my case), the targetID is set to zero. However, at the section followed the code still tries to parse the "index" for submesh.

Is this a bug or I am using old version (1.2.5)?
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67

Post by sinbad »

If the the attribute 'target' is set to 'submesh' on the pose element then the 'index' attribute is required. Only if 'target' is 'mesh' can it be omitted.

I've checked the latest source and it writes the 'index' attribute correctly if it writes 'submesh' so I can't see how thiscould have happened if that XML was written by the XML converter. Can you check it again?
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67

Post by sinbad »

If the the attribute 'target' is set to 'submesh' on the pose element then the 'index' attribute is required. Only if 'target' is 'mesh' can it be omitted.

I've checked the latest source and it writes the 'index' attribute correctly if it writes 'submesh' so I can't see how thiscould have happened if that XML was written by the XML converter. Can you check it again?

It's not a case of the number of submeshes, it's what 'target' is set to that matters.
richFoto
Gnoblar
Posts: 4
Joined: Tue May 15, 2007 7:59 pm

Post by richFoto »

The first three lines of the XML file staring from <poses>:

<poses>
<pose target="mesh" name="chest_Small">
<poseoffset index="441" x="0" y="0.000318527" z="-0.000180006" />
<poseoffset index="449" x="0" y="-0.000478745" z="-0.000246793" />

So the target is set to mesh. In this case I think the converter shall not look for "index" of submesh.

Thanks,
Richard
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67

Post by sinbad »

Ah, I see it - a comparison that uses == on a const char* instead of a String object. Here:

Code: Select all

			const char* target = poseNode->Attribute("target");
			if (!target)
			{
				OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND, 
					"Required attribute 'target' missing on pose", 
					"XMLMeshSerializer::readPoses");
			}
			unsigned short targetID;
			if(target == "mesh")
			{
				targetID = 0;
Change const char* to String and it will be fixed. I've never hit this with my meshes so that was a fluke.

Dagon is not supported anymore so I will fix this in 1.4.2, but you can recompile your copy with that change to fix it if you're not upgrading.