Browse Source

- Taml serialization WIP.

MelvMay-GG 12 years ago
parent
commit
d15faaa

+ 2 - 2
engine/source/2d/assets/ParticleAsset.cc

@@ -480,7 +480,7 @@ void ParticleAsset::onTamlCustomWrite( TamlCustomNodes& customNodes )
     PROFILE_SCOPE(ParticleAsset_OnTamlCustomWrite);
 
     // Write the fields.
-    mParticleFields.onTamlCustomWrite( customProperties );
+    mParticleFields.onTamlCustomWrite( customNodes );
 }
 
 //-----------------------------------------------------------------------------
@@ -491,5 +491,5 @@ void ParticleAsset::onTamlCustomRead( const TamlCustomNodes& customNodes )
     PROFILE_SCOPE(ParticleAsset_OnTamlCustomRead);
 
     // Read the fields.
-    mParticleFields.onTamlCustomRead( customProperties );
+    mParticleFields.onTamlCustomRead( customNodes );
 }

+ 2 - 2
engine/source/2d/assets/ParticleAssetEmitter.cc

@@ -495,7 +495,7 @@ void ParticleAssetEmitter::onTamlCustomWrite( TamlCustomNodes& customNodes )
     PROFILE_SCOPE(ParticleAssetEmitter_OnTamlCustomWrite);
 
     // Write the fields.
-    mParticleFields.onTamlCustomWrite( customProperties );
+    mParticleFields.onTamlCustomWrite( customNodes );
 }
 
 //-----------------------------------------------------------------------------
@@ -506,6 +506,6 @@ void ParticleAssetEmitter::onTamlCustomRead( const TamlCustomNodes& customNodes
     PROFILE_SCOPE(ParticleAssetEmitter_OnTamlCustomRead);
 
     // Read the fields.
-    mParticleFields.onTamlCustomRead( customProperties );
+    mParticleFields.onTamlCustomRead( customNodes );
 }
 

+ 27 - 24
engine/source/2d/assets/ParticleAssetField.cc

@@ -509,34 +509,34 @@ F32 ParticleAssetField::calculateFieldBVLE( const ParticleAssetField& base, cons
 
 //------------------------------------------------------------------------------
 
-void ParticleAssetField::onTamlCustomWrite( TamlCustomProperty* pCustomProperty )
+void ParticleAssetField::onTamlCustomWrite( TamlCustomNode* pCustomNode )
 {
     // Debug Profiling.
     PROFILE_SCOPE(ParticleAssetField_OnTamlCustomWrite);
 
-    // Add a alias (ignore it if there ends up being no properties).
-    TamlPropertyAlias* pPropertyAlias = pCustomProperty->addAlias( getFieldName(), true );
+    // Add a child (ignore it if there ends up being no children).
+    TamlCustomNode* pAssetFieldNode = pCustomNode->addNode( getFieldName(), true );
 
     // Sanity!
-    AssertFatal( pPropertyAlias != NULL, "ParticleAssetField::onTamlCustomWrite() - Could not create field alias." );
+    AssertFatal( pAssetFieldNode != NULL, "ParticleAssetField::onTamlCustomWrite() - Could not create field node." );
 
     if ( mValueBoundsDirty && (mNotEqual( getMinValue(), 0.0f ) || mNotEqual( getMaxValue(), 0.0f )) )
     {
-        pPropertyAlias->addField( particleAssetFieldMinValueName, getMinValue() );
-        pPropertyAlias->addField( particleAssetFieldMaxValueName, getMaxValue() );
+        pAssetFieldNode->addField( particleAssetFieldMinValueName, getMinValue() );
+        pAssetFieldNode->addField( particleAssetFieldMaxValueName, getMaxValue() );
     }
     
     if ( mValueBoundsDirty && mNotEqual( getMaxTime(), 1.0f ) )
-        pPropertyAlias->addField( particleAssetFieldMaxTimeName, getMaxTime() );
+        pAssetFieldNode->addField( particleAssetFieldMaxTimeName, getMaxTime() );
 
     if ( mValueBoundsDirty && mNotEqual( getDefaultValue(), 1.0f ) )
-        pPropertyAlias->addField( particleAssetFieldDefaultValueName, getDefaultValue() );
+        pAssetFieldNode->addField( particleAssetFieldDefaultValueName, getDefaultValue() );
 
     if ( mNotEqual( getValueScale(), 1.0f ) )
-        pPropertyAlias->addField( particleAssetFieldValueScaleName, getValueScale() );
+        pAssetFieldNode->addField( particleAssetFieldValueScaleName, getValueScale() );
 
     if ( mNotEqual( getRepeatTime(), 1.0f ) )
-        pPropertyAlias->addField( particleAssetFieldRepeatTimeName, getRepeatTime() );
+        pAssetFieldNode->addField( particleAssetFieldRepeatTimeName, getRepeatTime() );
 
     // Fetch key count.
     const U32 keyCount = getDataKeyCount();
@@ -550,7 +550,7 @@ void ParticleAssetField::onTamlCustomWrite( TamlCustomProperty* pCustomProperty
         return;
 
     // Format the keys,
-    char keysBuffer[MAX_TAML_PROPERTY_FIELDVALUE_LENGTH];
+    char keysBuffer[MAX_TAML_NODE_FIELDVALUE_LENGTH];
     char* pKeysBuffer = keysBuffer;
     S32 bufferSize = sizeof(keysBuffer);
 
@@ -566,12 +566,12 @@ void ParticleAssetField::onTamlCustomWrite( TamlCustomProperty* pCustomProperty
         bufferSize -= written;
     }
 
-    pPropertyAlias->addField( particleAssetFieldDataKeysName, keysBuffer );
+    pAssetFieldNode->addField( particleAssetFieldDataKeysName, keysBuffer );
 }
 
 //-----------------------------------------------------------------------------
 
-void ParticleAssetField::onTamlCustomRead( const TamlPropertyAlias* pPropertyAlias )
+void ParticleAssetField::onTamlCustomRead( const TamlCustomNode* pCustomNode )
 {
     // Debug Profiling.
     PROFILE_SCOPE(ParticleAssetField_OnTamlCustomRead);
@@ -590,46 +590,49 @@ void ParticleAssetField::onTamlCustomRead( const TamlPropertyAlias* pPropertyAli
     // Clear the existing keys.
     mDataKeys.clear();
 
+    // Fetch children nodes.
+    const TamlCustomFieldVector& fieldNodes = pCustomNode->getFields();
+
     // Iterate property fields.
-    for ( TamlPropertyAlias::const_iterator propertyFieldItr = pPropertyAlias->begin(); propertyFieldItr != pPropertyAlias->end(); ++propertyFieldItr )
+    for ( TamlCustomFieldVector::const_iterator fieldNodeItr = fieldNodes.begin(); fieldNodeItr != fieldNodes.end(); ++fieldNodeItr )
     {
-        // Fetch property field.
-        TamlCustomNodeField* pPropertyField = *propertyFieldItr;
+        // Fetch field node.
+        TamlCustomNodeField* pFieldNode = *fieldNodeItr;
 
         // Fetch property field name.
-        StringTableEntry fieldName = pPropertyField->getFieldName();
+        StringTableEntry fieldName = pFieldNode->getFieldName();
 
         if ( fieldName == particleAssetFieldRepeatTimeName )
         {
-            pPropertyField->getFieldValue( repeatTime );
+            pFieldNode->getFieldValue( repeatTime );
         }
         else if ( fieldName == particleAssetFieldMaxTimeName )
         {
-            pPropertyField->getFieldValue( maxTime );
+            pFieldNode->getFieldValue( maxTime );
             mValueBoundsDirty = true;
         }
         else if ( fieldName == particleAssetFieldMinValueName )
         {
-            pPropertyField->getFieldValue( minValue );
+            pFieldNode->getFieldValue( minValue );
             mValueBoundsDirty = true;
         }
         else if ( fieldName == particleAssetFieldMaxValueName )
         {
-            pPropertyField->getFieldValue( maxValue );
+            pFieldNode->getFieldValue( maxValue );
             mValueBoundsDirty = true;
         }
         else if ( fieldName == particleAssetFieldDefaultValueName )
         {
-            pPropertyField->getFieldValue( defaultValue );
+            pFieldNode->getFieldValue( defaultValue );
             mValueBoundsDirty = true;
         }
         else if ( fieldName == particleAssetFieldValueScaleName )
         {
-            pPropertyField->getFieldValue( valueScale );
+            pFieldNode->getFieldValue( valueScale );
         }
         else if ( fieldName == particleAssetFieldDataKeysName )
         {
-            const char* pDataKeys = pPropertyField->getFieldValue();
+            const char* pDataKeys = pFieldNode->getFieldValue();
             const S32 elementCount = StringUnit::getUnitCount( pDataKeys, " ,\t" );
 
             // Are there a valid number of elements?

+ 2 - 2
engine/source/2d/assets/ParticleAssetField.h

@@ -109,8 +109,8 @@ public:
     static F32 calculateFieldBVE( const ParticleAssetField& base, const ParticleAssetField& variation, const ParticleAssetField& effect, const F32 effectAge, const bool modulate = false, const F32 modulo = 0.0f );
     static F32 calculateFieldBVLE( const ParticleAssetField& base, const ParticleAssetField& variation, const ParticleAssetField& overlife, const ParticleAssetField& effect, const F32 effectTime, const F32 particleAge, const bool modulate = false, const F32 modulo = 0.0f );
 
-    void onTamlCustomWrite( TamlCustomProperty* pCustomProperty  );
-    void onTamlCustomRead( const TamlPropertyAlias* pPropertyAlias );
+    void onTamlCustomWrite( TamlCustomNode* pCustomNode  );
+    void onTamlCustomRead( const TamlCustomNode* pCustomNode );
 };
 
 //-----------------------------------------------------------------------------

+ 20 - 17
engine/source/2d/assets/ParticleAssetFieldCollection.cc

@@ -24,7 +24,7 @@
 
 //-----------------------------------------------------------------------------
 
-static StringTableEntry particleAssetFieldCollectionName;
+static StringTableEntry particleAssetFieldNodeName;
 
 //-----------------------------------------------------------------------------
 
@@ -32,7 +32,7 @@ ParticleAssetFieldCollection::ParticleAssetFieldCollection() :
                                     mpSelectedField( NULL )
 {
     // Set custom property name.
-    particleAssetFieldCollectionName = StringTable->insert("Fields");
+    particleAssetFieldNodeName = StringTable->insert("Fields");
 }
 
 //-----------------------------------------------------------------------------
@@ -431,13 +431,13 @@ void ParticleAssetFieldCollection::onTamlCustomWrite( TamlCustomNodes& customNod
     if ( mFields.size() == 0 )
         return;
 
-    // Add particle asset custom property.
-    TamlCustomProperty* pParticleAssetCustomProperty = customProperties.addProperty( particleAssetFieldCollectionName );
+    // Add particle asset custom node.
+    TamlCustomNode* pParticleAssetCustomNode = customNodes.addNode( particleAssetFieldNodeName );
 
     // Iterate the fields.
     for( typeFieldHash::iterator fieldItr = mFields.begin(); fieldItr != mFields.end(); ++fieldItr )
     {
-        fieldItr->value->onTamlCustomWrite( pParticleAssetCustomProperty );
+        fieldItr->value->onTamlCustomWrite( pParticleAssetCustomNode );
     }
 }
 
@@ -448,35 +448,38 @@ void ParticleAssetFieldCollection::onTamlCustomRead( const TamlCustomNodes& cust
     // Debug Profiling.
     PROFILE_SCOPE(ParticleAssetFieldCollection_OnTamlCustomRead);
 
-    // Find the particle asset custom property.
-    const TamlCustomProperty* pParticleAssetCustomProperty = customProperties.findProperty( particleAssetFieldCollectionName );
+    // Find the particle asset custom node.
+    const TamlCustomNode* pParticleAssetCustomNode = customNodes.findNode( particleAssetFieldNodeName );
 
-    // Finish if we don't have a custom property.
-    if ( pParticleAssetCustomProperty == NULL )
+    // Finish if we don't have a custom node.
+    if ( pParticleAssetCustomNode == NULL )
         return;
 
+    // Fetch children.
+    const TamlCustomNodeVector& children = pParticleAssetCustomNode->getChildren();
+
     // Iterate the custom properties.
-    for( TamlCustomProperty::const_iterator propertyAliasItr = pParticleAssetCustomProperty->begin(); propertyAliasItr != pParticleAssetCustomProperty->end(); ++propertyAliasItr )
+    for( TamlCustomNodeVector::const_iterator childNodeItr = children.begin(); childNodeItr != children.end(); ++childNodeItr )
     {
-        // Fetch property alias.
-        TamlPropertyAlias* pPropertyAlias = *propertyAliasItr;
+        // Fetch child node.
+        TamlCustomNode* pChildNode = *childNodeItr;
 
-        // Fetch alias name.
-        StringTableEntry aliasName = pPropertyAlias->mAliasName;
+        // Fetch node name.
+        StringTableEntry nodeName = pChildNode->mNodeName;
 
         // Find the field.
-        ParticleAssetField* pParticleAssetField = findField( aliasName );
+        ParticleAssetField* pParticleAssetField = findField( nodeName );
 
         // Did we find the field?
         if ( pParticleAssetField == NULL )
         {
             // No, so warn.
-            Con::warnf( "ParticleAssetFieldCollection::onTamlCustomRead() - Cannot find data field '%s'.", aliasName );
+            Con::warnf( "ParticleAssetFieldCollection::onTamlCustomRead() - Cannot find data field '%s'.", nodeName );
             continue;
         }
 
         // Read the alias.
-        pParticleAssetField->onTamlCustomRead( pPropertyAlias );
+        pParticleAssetField->onTamlCustomRead( pChildNode );
     }
 }
 

+ 13 - 13
engine/source/2d/scene/Scene.cc

@@ -81,7 +81,7 @@ static U32 sSceneMasterIndex = 0;
 static bool tamlPropertiesInitialized = false;
 
 // Joint property names.
-static StringTableEntry jointCustomPropertyName;
+static StringTableEntry jointCustomNodeName;
 static StringTableEntry jointCollideConnectedName;
 static StringTableEntry jointObjectAName;
 static StringTableEntry jointObjectBName;
@@ -144,7 +144,7 @@ static StringTableEntry jointMotorMaxForceName;
 static StringTableEntry jointMotorMaxTorqueName;
 static StringTableEntry jointMotorCorrectionFactorName;
 
-static StringTableEntry controllerCustomPropertyName;
+static StringTableEntry controllerCustomNodeName;
 
 //-----------------------------------------------------------------------------
 
@@ -182,7 +182,7 @@ Scene::Scene() :
     // Initialize Taml property names.
     if ( !tamlPropertiesInitialized )
     {
-        jointCustomPropertyName           = StringTable->insert( "Joints" );
+        jointCustomNodeName           = StringTable->insert( "Joints" );
         jointCollideConnectedName         = StringTable->insert( "CollideConnected" );
         jointObjectAName                  = StringTable->insert( "AnchorA" );
         jointObjectBName                  = StringTable->insert( "AnchorB" );
@@ -245,7 +245,7 @@ Scene::Scene() :
         jointMotorMaxTorqueName           = jointRevoluteMotorMaxTorqueName;
         jointMotorCorrectionFactorName    = StringTable->insert( "CorrectionFactor" );
 
-		controllerCustomPropertyName	  = StringTable->insert( "Controllers" );
+		controllerCustomNodeName	  = StringTable->insert( "Controllers" );
 
         // Flag as initialized.
         tamlPropertiesInitialized = true;
@@ -3617,16 +3617,16 @@ void Scene::onTamlPreRead( void )
 
 //-----------------------------------------------------------------------------
 
-void Scene::onTamlPostRead( const TamlCustomNodes& customProperties )
+void Scene::onTamlPostRead( const TamlCustomNodes& customNodes )
 {
     // Call parent.
-    Parent::onTamlPostRead( customProperties );
+    Parent::onTamlPostRead( customNodes );
 
     // Reset the loading scene.
     Scene::LoadingScene = NULL;
 
-    // Find joint custom property.
-    const TamlCustomProperty* pJointProperty = customProperties.findProperty( jointCustomPropertyName );
+    // Find joint custom node.
+    const TamlCustomNode* pJointNode = customNodes.findNode( jointCustomNodeName );
 
     // Finish if no joints.
     if ( pJointProperty == NULL )
@@ -4306,7 +4306,7 @@ void Scene::onTamlPostRead( const TamlCustomNodes& customProperties )
 
 //-----------------------------------------------------------------------------
 
-void Scene::onTamlCustomWrite( TamlCustomNodes& customProperties )
+void Scene::onTamlCustomWrite( TamlCustomNodes& customNodes )
 {
     // Call parent.
     Parent::onTamlCustomWrite( customNodes );
@@ -4318,7 +4318,7 @@ void Scene::onTamlCustomWrite( TamlCustomNodes& customProperties )
     if ( jointCount > 0 )
 	{
 		// Yes, so add joint property.
-		TamlCustomProperty* pJointProperty = customProperties.addProperty( jointCustomPropertyName );
+		TamlCustomProperty* pJointProperty = customProperties.addProperty( jointCustomNodeName );
 
 		// Iterate joints.
 		for( typeJointHash::iterator jointItr = mJoints.begin(); jointItr != mJoints.end(); ++jointItr )
@@ -4724,7 +4724,7 @@ void Scene::onTamlCustomWrite( TamlCustomNodes& customProperties )
 	if ( sceneControllerCount > 0 )
 	{
 		// Yes, so add controller property.
-		TamlCustomProperty* pControllerProperty = customProperties.addProperty( controllerCustomPropertyName );
+		TamlCustomProperty* pControllerProperty = customProperties.addProperty( controllerCustomNodeName );
 
 		// Fetch the scene controllers.
 		SimSet* pControllerSet = getControllers();
@@ -4746,10 +4746,10 @@ void Scene::onTamlCustomWrite( TamlCustomNodes& customProperties )
 
 //-----------------------------------------------------------------------------
 
-void Scene::onTamlCustomRead( const TamlCustomNodes& customProperties )
+void Scene::onTamlCustomRead( const TamlCustomNodes& customNodes )
 {
     // Call parent.
-    Parent::onTamlCustomRead( customProperties );
+    Parent::onTamlCustomRead( customNodes );
 }
 
 //-----------------------------------------------------------------------------

+ 96 - 81
engine/source/2d/sceneobject/SceneObject.cc

@@ -87,7 +87,7 @@ static U32 sSceneObjectMasterSerialId = 0;
 // Collision shape property names.
 static bool collisionShapePropertiesInitialized = false;
 
-static StringTableEntry shapeCustomPropertyName;
+static StringTableEntry shapeCustomNodeName;
 
 static StringTableEntry shapeDensityName;
 static StringTableEntry shapeFrictionName;
@@ -208,7 +208,7 @@ SceneObject::SceneObject() :
     // Initialize collision shape field names.
     if ( !collisionShapePropertiesInitialized )
     {
-        shapeCustomPropertyName     = StringTable->insert( "CollisionShapes" );
+        shapeCustomNodeName     = StringTable->insert( "CollisionShapes" );
 
         shapeDensityName        = StringTable->insert( "Density" );
         shapeFrictionName       = StringTable->insert( "Friction" );
@@ -3386,8 +3386,8 @@ void SceneObject::onTamlCustomWrite( TamlCustomNodes& customNodes )
     if ( collisionShapeCount == 0 )
         return;
 
-    // Add collision shape property.
-    TamlCustomProperty* pCollisionShapeProperty = customProperties.addProperty( shapeCustomPropertyName );
+    // Add collision shape node.
+    TamlCustomNode* pCustomCollisionShapes = customNodes.addNode( shapeCustomNodeName );
 
     // Iterate collision shapes.
     for ( U32 shapeIndex = 0; shapeIndex < collisionShapeCount; ++shapeIndex )
@@ -3395,30 +3395,30 @@ void SceneObject::onTamlCustomWrite( TamlCustomNodes& customNodes )
         // Fetch collision shape definition.
         b2FixtureDef fixtureDef = getCollisionShapeDefinition( shapeIndex );
 
-        // Add collision shape alias.
-        // NOTE:    The name of the alias will get updated shortly.
-        TamlPropertyAlias* pCollisionShapeAlias = pCollisionShapeProperty->addAlias( StringTable->EmptyString );
+        // Add collision shape node.
+        // NOTE:    The name of the node will get updated shortly.
+        TamlCustomNode* pCollisionShapeNode = pCustomCollisionShapes->addNode( StringTable->EmptyString );
 
         // Add common collision shape fields.
         if ( mNotEqual( getDefaultDensity(), fixtureDef.density ) )
-            pCollisionShapeAlias->addField( shapeDensityName, fixtureDef.density );
+            pCollisionShapeNode->addField( shapeDensityName, fixtureDef.density );
 
         if ( mNotEqual( getDefaultFriction(), fixtureDef.friction ) )
-            pCollisionShapeAlias->addField( shapeFrictionName, fixtureDef.friction );
+            pCollisionShapeNode->addField( shapeFrictionName, fixtureDef.friction );
 
         if ( mNotEqual( getDefaultRestitution(), fixtureDef.restitution ) )
-            pCollisionShapeAlias->addField( shapeRestitutionName, fixtureDef.restitution );
+            pCollisionShapeNode->addField( shapeRestitutionName, fixtureDef.restitution );
 
         if ( fixtureDef.isSensor == true )
-            pCollisionShapeAlias->addField( shapeSensorName, fixtureDef.isSensor );
+            pCollisionShapeNode->addField( shapeSensorName, fixtureDef.isSensor );
 
         // Populate collision shape appropriately.
         switch( fixtureDef.shape->GetType() )
         {
         case b2Shape::e_circle:
             {
-                // Set alias name.
-                pCollisionShapeAlias->mAliasName = StringTable->insert( circleTypeName );
+                // Set node name.
+                pCollisionShapeNode->mNodeName = StringTable->insert( circleTypeName );
 
                 // Fetch shape.
                 const b2CircleShape* pShape = dynamic_cast<const b2CircleShape*>( fixtureDef.shape );
@@ -3427,18 +3427,18 @@ void SceneObject::onTamlCustomWrite( TamlCustomNodes& customNodes )
                 AssertFatal( pShape != NULL, "SceneObject::onTamlCustomWrite() - Invalid circle shape type returned." );
 
                 // Add radius property.
-                pCollisionShapeAlias->addField( circleRadiusName, pShape->m_radius );
+                pCollisionShapeNode->addField( circleRadiusName, pShape->m_radius );
 
                 // Add offset property (if not zero).
                 if ( !Vector2(pShape->m_p).isZero() )
-                    pCollisionShapeAlias->addField( circleOffsetName, pShape->m_p );
+                    pCollisionShapeNode->addField( circleOffsetName, pShape->m_p );
             }
             break;
 
         case b2Shape::e_polygon:
             {
-                // Set alias name.
-                pCollisionShapeAlias->mAliasName = StringTable->insert( polygonTypeName );
+                // Set node name.
+                pCollisionShapeNode->mNodeName = StringTable->insert( polygonTypeName );
 
                 // Fetch shape.
                 const b2PolygonShape* pShape = dynamic_cast<const b2PolygonShape*>( fixtureDef.shape );
@@ -3457,15 +3457,15 @@ void SceneObject::onTamlCustomWrite( TamlCustomNodes& customNodes )
                     dSprintf( pointIndexBuffer, sizeof(pointIndexBuffer), "%s%d", polygonPointName, pointIndex );
                     
                     // Add point property.
-                    pCollisionShapeAlias->addField( pointIndexBuffer, pShape->GetVertex( pointIndex ) );
+                    pCollisionShapeNode->addField( pointIndexBuffer, pShape->GetVertex( pointIndex ) );
                 }
             }
             break;
 
         case b2Shape::e_chain:
             {
-                // Set alias name.
-                pCollisionShapeAlias->mAliasName = StringTable->insert( chainTypeName );
+                // Set node name.
+                pCollisionShapeNode->mNodeName = StringTable->insert( chainTypeName );
 
                 // Fetch shape.
                 const b2ChainShape* pShape = dynamic_cast<const b2ChainShape*>( fixtureDef.shape );
@@ -3484,23 +3484,23 @@ void SceneObject::onTamlCustomWrite( TamlCustomNodes& customNodes )
                     dSprintf( pointIndexBuffer, sizeof(pointIndexBuffer), "%s%d", chainPointName, pointIndex );
                     
                     // Add point property.
-                    pCollisionShapeAlias->addField( pointIndexBuffer, pShape->m_vertices[pointIndex] );
+                    pCollisionShapeNode->addField( pointIndexBuffer, pShape->m_vertices[pointIndex] );
                 }
 
                 // Add adjacent start point (if specified).
                 if ( pShape->m_hasPrevVertex )
-                    pCollisionShapeAlias->addField( chainAdjacentStartName, pShape->m_prevVertex );
+                    pCollisionShapeNode->addField( chainAdjacentStartName, pShape->m_prevVertex );
 
                 // Add adjacent end point (if specified).
                 if ( pShape->m_hasNextVertex )
-                    pCollisionShapeAlias->addField( chainAdjacentEndName, pShape->m_nextVertex );
+                    pCollisionShapeNode->addField( chainAdjacentEndName, pShape->m_nextVertex );
             }
             break;
 
         case b2Shape::e_edge:
             {
-                // Set alias name.
-                pCollisionShapeAlias->mAliasName = StringTable->insert( edgeTypeName );
+                // Set node name.
+                pCollisionShapeNode->mNodeName = StringTable->insert( edgeTypeName );
 
                 // Fetch shape.
                 const b2EdgeShape* pShape = dynamic_cast<const b2EdgeShape*>( fixtureDef.shape );
@@ -3509,16 +3509,16 @@ void SceneObject::onTamlCustomWrite( TamlCustomNodes& customNodes )
                 AssertFatal( pShape != NULL, "SceneObject::onTamlCustomWrite() - Invalid edge shape type returned." );
 
                 // Add start/end points.
-                pCollisionShapeAlias->addField( edgeStartName, pShape->m_vertex1 );
-                pCollisionShapeAlias->addField( edgeEndName, pShape->m_vertex2 );
+                pCollisionShapeNode->addField( edgeStartName, pShape->m_vertex1 );
+                pCollisionShapeNode->addField( edgeEndName, pShape->m_vertex2 );
 
                 // Add adjacent start point (if specified).
                 if ( pShape->m_hasVertex0 )
-                    pCollisionShapeAlias->addField( edgeAdjacentStartName, pShape->m_vertex0 );
+                    pCollisionShapeNode->addField( edgeAdjacentStartName, pShape->m_vertex0 );
 
                 // Add adjacent end point (if specified).
                 if ( pShape->m_hasVertex3 )
-                    pCollisionShapeAlias->addField( edgeAdjacentEndName, pShape->m_vertex3 );
+                    pCollisionShapeNode->addField( edgeAdjacentEndName, pShape->m_vertex3 );
             }
             break;
 
@@ -3537,23 +3537,26 @@ void SceneObject::onTamlCustomRead( const TamlCustomNodes& customNodes )
     PROFILE_SCOPE(SceneObject_OnTamlCustomRead);
 
     // Call parent.
-    Parent::onTamlCustomRead( customProperties );
+    Parent::onTamlCustomRead( customNodes );
 
-    // Find collision shape custom property.
-    const TamlCustomProperty* pCollisionShapeProperty = customProperties.findProperty( shapeCustomPropertyName );
+    // Find collision shape custom node.
+    const TamlCustomNode* pCustomCollisionShapes = customNodes.findNode( shapeCustomNodeName );
 
     // Finish if we don't have collision shapes.
-    if ( pCollisionShapeProperty == NULL )
+    if ( pCustomCollisionShapes == NULL )
         return;
 
+    // Fetch children shapes.
+    const TamlCustomNodeVector& collisionShapeChildren = pCustomCollisionShapes->getChildren();
+
     // Iterate collision shapes.
-    for( TamlCustomProperty::const_iterator propertyAliasItr = pCollisionShapeProperty->begin(); propertyAliasItr != pCollisionShapeProperty->end(); ++propertyAliasItr )
+    for( TamlCustomNodeVector::const_iterator shapeNodeItr = collisionShapeChildren.begin(); shapeNodeItr != collisionShapeChildren.end(); ++shapeNodeItr )
     {
-        // Fetch property alias.
-        TamlPropertyAlias* pPropertyAlias = *propertyAliasItr;
+        // Fetch shape node.
+        TamlCustomNode* pShapeNode = *shapeNodeItr;
 
         // Fetch alias name.
-        StringTableEntry aliasName = pPropertyAlias->mAliasName;
+        StringTableEntry aliasName = pShapeNode->mNodeName;
 
         // Ready common fields.
         F32 shapeDensity     = getDefaultDensity();
@@ -3570,40 +3573,43 @@ void SceneObject::onTamlCustomRead( const TamlCustomNodes& customNodes )
             F32 radius = 0.0f;
             b2Vec2 offset( 0.0f, 0.0f );
 
+            // Fetch shape children.
+            const TamlCustomFieldVector& shapeFields = pShapeNode->getFields();
+
             // Iterate property fields.
-            for ( TamlPropertyAlias::const_iterator propertyFieldItr = pPropertyAlias->begin(); propertyFieldItr != pPropertyAlias->end(); ++propertyFieldItr )
+            for ( TamlCustomFieldVector::const_iterator shapeFieldItr = shapeFields.begin(); shapeFieldItr != shapeFields.end(); ++shapeFieldItr )
             {
-                // Fetch property field.
-                TamlCustomNodeField* pPropertyField = *propertyFieldItr;
+                // Fetch field node.
+                TamlCustomNodeField* pFieldNode = *shapeFieldItr;
 
                 // Fetch property field name.
-                StringTableEntry fieldName = pPropertyField->getFieldName();
+                StringTableEntry fieldName = pFieldNode->getFieldName();
 
                 // Check common fields.
                 if ( fieldName == shapeDensityName )
                 {
-                    pPropertyField->getFieldValue( shapeDensity );
+                    pFieldNode->getFieldValue( shapeDensity );
                 }
                 else if ( fieldName == shapeFrictionName )
                 {
-                    pPropertyField->getFieldValue( shapeFriction );
+                    pFieldNode->getFieldValue( shapeFriction );
                 }
                 else if ( fieldName == shapeRestitutionName )
                 {
-                    pPropertyField->getFieldValue( shapeRestitution );
+                    pFieldNode->getFieldValue( shapeRestitution );
                 }
                 else if ( fieldName == shapeSensorName )
                 {
-                    pPropertyField->getFieldValue( shapeSensor );
+                    pFieldNode->getFieldValue( shapeSensor );
                 }
                 // Check circle fields.
                 else if ( fieldName == circleRadiusName )
                 {
-                    pPropertyField->getFieldValue( radius );
+                    pFieldNode->getFieldValue( radius );
                 }
                 else if ( fieldName == circleOffsetName )
                 {
-                    pPropertyField->getFieldValue( offset );
+                    pFieldNode->getFieldValue( offset );
                 }                   
             }
 
@@ -3627,34 +3633,37 @@ void SceneObject::onTamlCustomRead( const TamlCustomNodes& customNodes )
             b2Vec2 points[b2_maxPolygonVertices];
             U32 pointCount = 0;
 
+            // Fetch shape children.
+            const TamlCustomFieldVector& shapeFields = pShapeNode->getFields();
+
             // Iterate property fields.
-            for ( TamlPropertyAlias::const_iterator propertyFieldItr = pPropertyAlias->begin(); propertyFieldItr != pPropertyAlias->end(); ++propertyFieldItr )
+            for ( TamlCustomFieldVector::const_iterator shapeFieldItr = shapeFields.begin(); shapeFieldItr != shapeFields.end(); ++shapeFieldItr )
             {
-                // Fetch property field.
-                TamlCustomNodeField* pPropertyField = *propertyFieldItr;
+                // Fetch field node.
+                TamlCustomNodeField* pFieldNode = *shapeFieldItr;
 
                 // Fetch property field name.
-                StringTableEntry fieldName = pPropertyField->getFieldName();
+                StringTableEntry fieldName = pFieldNode->getFieldName();
 
                 // Check common fields.
                 if ( fieldName == shapeDensityName )
                 {
-                    pPropertyField->getFieldValue( shapeDensity );
+                    pFieldNode->getFieldValue( shapeDensity );
                 }
                 else if ( fieldName == shapeFrictionName )
                 {
-                    pPropertyField->getFieldValue( shapeFriction );
+                    pFieldNode->getFieldValue( shapeFriction );
                 }
                 else if ( fieldName == shapeRestitutionName )
                 {
-                    pPropertyField->getFieldValue( shapeRestitution );
+                    pFieldNode->getFieldValue( shapeRestitution );
                 }
                 else if ( fieldName == shapeSensorName )
                 {
-                    pPropertyField->getFieldValue( shapeSensor );
+                    pFieldNode->getFieldValue( shapeSensor );
                 }
                 // Check polygon fields.
-                else if ( pPropertyField->fieldNameBeginsWith( polygonPointName ) )
+                else if ( pFieldNode->fieldNameBeginsWith( polygonPointName ) )
                 {
                     // Is the point count at maximum?
                     if ( pointCount == b2_maxPolygonVertices )
@@ -3665,7 +3674,7 @@ void SceneObject::onTamlCustomRead( const TamlCustomNodes& customNodes )
                     }
 
                     b2Vec2 point;
-                    pPropertyField->getFieldValue( point );
+                    pFieldNode->getFieldValue( point );
                     points[pointCount++] = point;
                 }
             }
@@ -3692,47 +3701,50 @@ void SceneObject::onTamlCustomRead( const TamlCustomNodes& customNodes )
             b2Vec2 adjacentStartPoint;
             b2Vec2 adjacentEndPoint;
 
+            // Fetch shape children.
+            const TamlCustomFieldVector& shapeFields = pShapeNode->getFields();
+
             // Iterate property fields.
-            for ( TamlPropertyAlias::const_iterator propertyFieldItr = pPropertyAlias->begin(); propertyFieldItr != pPropertyAlias->end(); ++propertyFieldItr )
+            for ( TamlCustomFieldVector::const_iterator shapeFieldItr = shapeFields.begin(); shapeFieldItr != shapeFields.end(); ++shapeFieldItr )
             {
-                // Fetch property field.
-                TamlCustomNodeField* pPropertyField = *propertyFieldItr;
+                // Fetch field node.
+                TamlCustomNodeField* pFieldNode = *shapeFieldItr;
 
                 // Fetch property field name.
-                StringTableEntry fieldName = pPropertyField->getFieldName();
+                StringTableEntry fieldName = pFieldNode->getFieldName();
 
                 // Check common fields.
                 if ( fieldName == shapeDensityName )
                 {
-                    pPropertyField->getFieldValue( shapeDensity );
+                    pFieldNode->getFieldValue( shapeDensity );
                 }
                 else if ( fieldName == shapeFrictionName )
                 {
-                    pPropertyField->getFieldValue( shapeFriction );
+                    pFieldNode->getFieldValue( shapeFriction );
                 }
                 else if ( fieldName == shapeRestitutionName )
                 {
-                    pPropertyField->getFieldValue( shapeRestitution );
+                    pFieldNode->getFieldValue( shapeRestitution );
                 }
                 else if ( fieldName == shapeSensorName )
                 {
-                    pPropertyField->getFieldValue( shapeSensor );
+                    pFieldNode->getFieldValue( shapeSensor );
                 }
                 // Check chain fields.
-                else if ( pPropertyField->fieldNameBeginsWith( chainPointName ) )
+                else if ( pFieldNode->fieldNameBeginsWith( chainPointName ) )
                 {
                     b2Vec2 point;
-                    pPropertyField->getFieldValue( point );
+                    pFieldNode->getFieldValue( point );
                     points.push_back( point );
                 }
                 else if ( fieldName == chainAdjacentStartName )
                 {
-                    pPropertyField->getFieldValue( adjacentStartPoint );
+                    pFieldNode->getFieldValue( adjacentStartPoint );
                     hasAdjacentStartPoint = true;
                 }
                 else if ( fieldName == chainAdjacentEndName )
                 {
-                    pPropertyField->getFieldValue( adjacentEndPoint );
+                    pFieldNode->getFieldValue( adjacentEndPoint );
                     hasAdjacentEndPoint = true;
                 }
             }
@@ -3760,49 +3772,52 @@ void SceneObject::onTamlCustomRead( const TamlCustomNodes& customNodes )
             b2Vec2 adjacentStartPoint;
             b2Vec2 adjacentEndPoint;
 
+            // Fetch shape children.
+            const TamlCustomFieldVector& shapeFields = pShapeNode->getFields();
+
             // Iterate property fields.
-            for ( TamlPropertyAlias::const_iterator propertyFieldItr = pPropertyAlias->begin(); propertyFieldItr != pPropertyAlias->end(); ++propertyFieldItr )
+            for ( TamlCustomFieldVector::const_iterator shapeFieldItr = shapeFields.begin(); shapeFieldItr != shapeFields.end(); ++shapeFieldItr )
             {
-                // Fetch property field.
-                TamlCustomNodeField* pPropertyField = *propertyFieldItr;
+                // Fetch field node.
+                TamlCustomNodeField* pFieldNode = *shapeFieldItr;
 
                 // Fetch property field name.
-                StringTableEntry fieldName = pPropertyField->getFieldName();
+                StringTableEntry fieldName = pFieldNode->getFieldName();
 
                 // Check common fields.
                 if ( fieldName == shapeDensityName )
                 {
-                    pPropertyField->getFieldValue( shapeDensity );
+                    pFieldNode->getFieldValue( shapeDensity );
                 }
                 else if ( fieldName == shapeFrictionName )
                 {
-                    pPropertyField->getFieldValue( shapeFriction );
+                    pFieldNode->getFieldValue( shapeFriction );
                 }
                 else if ( fieldName == shapeRestitutionName )
                 {
-                    pPropertyField->getFieldValue( shapeRestitution );
+                    pFieldNode->getFieldValue( shapeRestitution );
                 }
                 else if ( fieldName == shapeSensorName )
                 {
-                    pPropertyField->getFieldValue( shapeSensor );
+                    pFieldNode->getFieldValue( shapeSensor );
                 }
                 // Check edge fields.
                 else if ( fieldName == edgeStartName )
                 {
-                    pPropertyField->getFieldValue( point0 );
+                    pFieldNode->getFieldValue( point0 );
                 }
                 else if ( fieldName == edgeEndName )
                 {
-                    pPropertyField->getFieldValue( point1 );
+                    pFieldNode->getFieldValue( point1 );
                 }
                 else if ( fieldName == edgeAdjacentStartName )
                 {
-                    pPropertyField->getFieldValue( adjacentStartPoint );
+                    pFieldNode->getFieldValue( adjacentStartPoint );
                     hasAdjacentStartPoint = true;
                 }
                 else if ( fieldName == edgeAdjacentEndName )
                 {
-                    pPropertyField->getFieldValue( adjacentEndPoint );
+                    pFieldNode->getFieldValue( adjacentEndPoint );
                     hasAdjacentEndPoint = true;
                 }
             }

+ 3 - 3
engine/source/persistence/taml/taml.h

@@ -129,10 +129,10 @@ private:
     inline void tamlPreWrite( TamlCallbacks* pCallbacks )                                           { pCallbacks->onTamlPreWrite(); }
     inline void tamlPostWrite( TamlCallbacks* pCallbacks )                                          { pCallbacks->onTamlPostWrite(); }
     inline void tamlPreRead( TamlCallbacks* pCallbacks )                                            { pCallbacks->onTamlPreRead(); }
-    inline void tamlPostRead( TamlCallbacks* pCallbacks, const TamlCustomNodes& customNodes )   { pCallbacks->onTamlPostRead( customProperties ); }
+    inline void tamlPostRead( TamlCallbacks* pCallbacks, const TamlCustomNodes& customNodes )       { pCallbacks->onTamlPostRead( customNodes ); }
     inline void tamlAddParent( TamlCallbacks* pCallbacks, SimObject* pParentObject )                { pCallbacks->onTamlAddParent( pParentObject ); }
-    inline void tamlCustomWrite( TamlCallbacks* pCallbacks, TamlCustomNodes& customNodes )      { pCallbacks->onTamlCustomWrite( customProperties ); }
-    inline void tamlCustomRead( TamlCallbacks* pCallbacks, const TamlCustomNodes& customNodes ) { pCallbacks->onTamlCustomRead( customProperties ); }
+    inline void tamlCustomWrite( TamlCallbacks* pCallbacks, TamlCustomNodes& customNodes )          { pCallbacks->onTamlCustomWrite( customNodes ); }
+    inline void tamlCustomRead( TamlCallbacks* pCallbacks, const TamlCustomNodes& customNodes )     { pCallbacks->onTamlCustomRead( customNodes ); }
 
 public:
     Taml();