Editing XML and Material Files

From WorldForgeWiki
Jump to: navigation, search

Command Line Tools

  • Converting OGRE.mesh files to OGRE.XML and OGRE.XML files to OGRE.mesh files is done by Ogre Command Line Tools

Run this command at any prompt

 OgreXmlConverter foo.mesh

to convert foo.mesh to foo.mesh.xml

  • When exporting files from a DCC the user will get the following for static objects
 .mesh.xml file
 .material file
  • For animated content the user will get the following:
 .mesh.xml file
 .skeleton.xml file
 .material file
  • These are simple XML files and you will want to edit the following sections
 material names
 location of the skeleton file for animated object
 material file 
  • When editing XML files, the recommendation is to utilize an IDE. My choice is Programmers Notepad [1]

Renaming the Material in the XML

  • Original XML file will have a submesh material that will look similar "<submesh material="material_name""
Error creating thumbnail: Unable to save thumbnail to destination
  • Changing XML submesh material entry to "<submesh material="/global/bipeds/races/human/male/body""
Error creating thumbnail: Unable to save thumbnail to destination
  • To generate that material name is very logical. The mesh file resides in C:\wf_trunk\3d_skeletons\bipeds\races\human\male. We truncate the C:\wf_trunk\3d_skeletons and convert it to global. We also convert the "\" "/". On top of that we add an identifier of the body part. In this case it is the body.

Skeleton link

For animated meshes, there's a link to the .skeleton file which represents the skeleton. For Ember to best be able to find the skeleton we suggest you specify it as a relative link. This will make the skeleton link be relative to the location of the mesh. In order for this to work the path to the skeleton must start with either "." or "..". For an example, if you want to provide a link to a skeleton name "male.skeleton" which is placed in a subdirectory named "anims", located directly under the directory of the mesh, you would use the path "./anims/male.skeleton". And if the "anims" directory instead were placed two levels above the directory of the mesh, you would use "../../anims/male.skeleton". You can use the meshmagick tool to alter the path of the skeleton.

Mesh Magick Tool Set

Another way to manipulate the OGRE mesh files is to utilize MeshMagick tool bundled with Command Line Tools. More information about the Mesh Magick command line tools available here Run this command to get infromation about the OGRE mesh file

MeshMagick info fence_assembly.mesh 

The output will be something like this

Analysing meshfile fence_assembly.mesh...
File version : [MeshSerializer_v1.40]
Endian mode  : Little Endian

Bounding box: [[-5.3, -0.18, -0], [0.18, 5.3, 1.5]]
No shared vertices.

Submesh 0 (unnamed) : 
   Default material: end
   280 vertices.
   buffer layout: p(f3)n(f3)u(f2)
   190 triangles.
   16 bit index buffer
Submesh 1 (unnamed) : 
   Default material: beams
   1348 vertices.
   buffer layout: p(f3)n(f3)u(f2)
   674 triangles.
   16 bit index buffer

Mesh does not have morph animations.
Mesh does not have poses.

Run this command to convert beams material name to /global/building_elements/wooden_fence material name.

MeshMagick rename -material=beams:/global/building_elements/wooden_fence fence_assembly.mesh 

Run this command to update the skeleton path.

MeshMagick rename -skeleton=./fence_assembly.skeleton fence_assembly.mesh 

Run this command to make mesh files Y axis up for content coming out of Blender3D

MeshMagick transform -rotate=-90/1/0/0 fence_pole_single.mesh



Editing the Material File