NxOgre DotSceneLoader Release

mcaden

11-10-2008 17:03:29

I've started with http://www.ogre3d.org/wiki/index.php/Ne ... ene_Loader and evolved it a bit to include UserData that would apply to NxOgre.

It is designed for any NxOgre release above 1.0'21 and Blender's dotScene exporter. This is intended for use in Blender but should work with any XML file that has the same format and can easily be ported to a different .scene format.

Simply take a .scene file (really it's just an XML file) which includes userdata for your objects. This userdata has names (presets required in the loader code...it's not very flexible, but it could be easily tweaked to your liking) and values. The loader reacts to those names/values and propagates them into physics parameters to make your actor, then passes that information along with userdata it didn't recognize into the function createPhysXObject(...) where you set up a nice little switch statement for you to parse your custom userData and create your customized Body.

The following userData, based on the code that has been uploaded (link is at the bottom of the post), places my actor and it's Ogre entity, fills out the physics properties, and the code I'm using attaches particles to the torso and eyes, and adds the attack 'Bite', along with adding 2 idle animations and 2 sniffing animations which I've set up in my player class which is instantiated by the createBody<Player>(...) call within the createPhysXObject(...) switch statement.

This solution is intended to work with the templated Body system made available in revision 22.


<node name="Garm">
<position x="6.337165" y="0.040385" z="-9.414388"/>
<quaternion x="0.000000" y="-0.325688" z="0.000000" w="0.945477"/>
<scale x="1.000000" y="1.000000" z="1.000000"/>
<entity name="Garm" meshFile="Garm.mesh"/>
<userData>
<property type="FLOAT" name="ColSize" data="1.0"/>
<property type="STRING" name="ColType" data="Cube"/>
<property type="STRING" name="ObType" data="Player"/>
<property type="STRING" name="FreezeRotX" data="true"/>
<property type="STRING" name="FreezeRotZ" data="true"/>
<property type="STRING" name="Mass" data="15"/>
<property type="FLOAT" name="LinearDamping" data="0.0"/>
<property type="FLOAT" name="AngularDamping" data="12.0"/>
<property type="STRING" name="Group" data="player"/>
<property type="STRING" name="Attack" data="Bite,Bite,30"/>
<property type="STRING" name="Particle1" data="backParticles1,Player/Garm_back,Torso"/>
<property type="STRING" name="Particle2" data="backParticles2,Player/Garm_back2,Torso"/>
<property type="STRING" name="Particle3" data="eyeParticles_L,Player/Garm_eye,Eye_L"/>
<property type="STRING" name="Particle4" data="eyeParticles_R,Player/Garm_eye,Eye_R"/>
<property type="STRING" name="MoveSpeed" data="50"/>
<property type="STRING" name="Idle1" data="Idle1"/>
<property type="STRING" name="Idle2" data="Idle2"/>
<property type="STRING" name="Sniff1" data="Sniff1"/>
<property type="STRING" name="Sniff2" data="Sniff2"/>
</userData>
</node>


This is designed to keep data independent from code as much as possible. This XML file loads in my player, all my enemies, and generic objects. Any entries without an ObType property are assumed to NOT be an NxOgre object and are loaded into Ogre as simply a mesh, light, billboard, etc...with no actor.

This code is based on the "New DotScene Loader" linked at the top of this post. I kept MOST of that code intact. If there are any memory leaks, or if some sort of parenting or setting doesn't work correctly and it's related to the DotSceneLoader - it probably has nothing to do with me :).

With that said, I myself have had no problems whatsoever with this in its current state. I have commented out the code that is specific to my project. I've kept it as an example of the possible usage of the loader, but commented it. I'm using this method in order to use Blender as a full level-editor.

Link - http://mcaden.katalyststudios.com/proje ... Loader.zip
Prerequisites - TinyXML - http://sourceforge.net/projects/tinyxml

NOTE: If you find any bugs, memory leaks, or find anything missing I'd be more than happy to take care of them. Make sure you get TinyXML. I linked it below my source files.

mcaden

17-10-2008 04:33:34

Either this is useless, or perfect and bugless so that nobody has any questions, errors, or suggestions...