Browse Source

- Taml serialization WIP.

MelvMay-GG 12 years ago
parent
commit
8a4a6b7

+ 1 - 1
engine/source/2d/assets/ImageAsset.cc

@@ -929,7 +929,7 @@ void ImageAsset::onTamlCustomRead( const TamlCustomNodes& customNodes )
         TamlCustomNode* pCellNode = *cellNodeItr;
 
         // Fetch node name.
-        StringTableEntry nodeName = pCellNode->mNodeName;
+        StringTableEntry nodeName = pCellNode->getNodeName();
 
         // Is this a valid alias?
         if ( nodeName != cellNodeName )

+ 49 - 17
engine/source/2d/assets/ParticleAssetField.cc

@@ -50,6 +50,10 @@ static StringTableEntry particleAssetFieldDefaultValueName;
 static StringTableEntry particleAssetFieldValueScaleName;
 static StringTableEntry particleAssetFieldDataKeysName;
 
+static StringTableEntry particleAssetFieldDataKeyName;
+static StringTableEntry particleAssetFieldDataKeyTimeName;
+static StringTableEntry particleAssetFieldDataKeyValueName;
+
 ParticleAssetField::DataKey ParticleAssetField::BadDataKey( -1.0f, 0.0f );
 
 //-----------------------------------------------------------------------------
@@ -78,6 +82,10 @@ ParticleAssetField::ParticleAssetField() :
         particleAssetFieldValueScaleName   = StringTable->insert( "ValueScale" );
         particleAssetFieldDataKeysName     = StringTable->insert( "Keys" );
 
+        particleAssetFieldDataKeyName      = StringTable->insert( "Key" );
+        particleAssetFieldDataKeyTimeName  = StringTable->insert( "Time" );
+        particleAssetFieldDataKeyValueName = StringTable->insert( "Value" );
+
         // Flag as initialized.
         particleAssetFieldPropertiesInitialized = true;
     }
@@ -549,24 +557,19 @@ void ParticleAssetField::onTamlCustomWrite( TamlCustomNode* pCustomNode )
     if ( keyCount == 1 && mIsEqual(mDataKeys[0].mTime, 0.0f) && mIsEqual(mDataKeys[0].mValue, mDefaultValue) )
         return;
 
-    // Format the keys,
-    char keysBuffer[MAX_TAML_NODE_FIELDVALUE_LENGTH];
-    char* pKeysBuffer = keysBuffer;
-    S32 bufferSize = sizeof(keysBuffer);
-
     // Iterate the keys.
     for( U32 index = 0; index < keyCount; ++index )
     {
         // Fetch the data key.
         const DataKey& dataKey = mDataKeys[index];
 
-        // Format the key.
-        S32 written = dSprintf( pKeysBuffer, bufferSize, index == 0 ? "%.5g %.5g" : " %.5g %.5g", dataKey.mTime, dataKey.mValue );
-        pKeysBuffer += written;
-        bufferSize -= written;
-    }
+        // Add a key node.
+        TamlCustomNode* pKeyNode = pCustomNode->addNode( particleAssetFieldDataKeyName );
 
-    pAssetFieldNode->addField( particleAssetFieldDataKeysName, keysBuffer );
+        // Add key fields.
+        pKeyNode->addField( particleAssetFieldDataKeyTimeName, dataKey.mTime );
+        pKeyNode->addField( particleAssetFieldDataKeyValueName, dataKey.mValue );
+    }
 }
 
 //-----------------------------------------------------------------------------
@@ -593,7 +596,7 @@ void ParticleAssetField::onTamlCustomRead( const TamlCustomNode* pCustomNode )
     // Fetch children nodes.
     const TamlCustomFieldVector& fieldNodes = pCustomNode->getFields();
 
-    // Iterate property fields.
+    // Iterate node fields.
     for ( TamlCustomFieldVector::const_iterator fieldNodeItr = fieldNodes.begin(); fieldNodeItr != fieldNodes.end(); ++fieldNodeItr )
     {
         // Fetch field node.
@@ -655,6 +658,39 @@ void ParticleAssetField::onTamlCustomRead( const TamlCustomNode* pCustomNode )
         }
     }
 
+    // Fetch any children.
+    const TamlCustomNodeVector& childNodes = pCustomNode->getChildren();
+
+    // Iterate node children.
+    for( TamlCustomNodeVector::const_iterator childNodeItr = childNodes.begin(); childNodeItr != childNodes.end(); ++childNodeItr )
+    {
+        // Fetch node.
+        TamlCustomNode* pKeyNode = *childNodeItr;
+
+        // Ignore anything that isn't a key.
+        if ( pKeyNode->getNodeName() != particleAssetFieldDataKeyName )
+            continue;
+
+        // Fetch the fields.
+        const TamlCustomNodeField* pTimeField = pKeyNode->findField( particleAssetFieldDataKeyTimeName );
+        const TamlCustomNodeField* pValueField = pKeyNode->findField( particleAssetFieldDataKeyValueName );
+
+        // Did we find the fields?
+        if ( pTimeField == NULL || pValueField == NULL )
+        {
+            // No, so warn.
+            Con::warnf("ParticleAssetField::onTamlCustomRead() - Found a key but it did not have a time and value field." );
+
+            continue;
+        }
+
+        // Read key.
+        DataKey key;
+        pTimeField->getFieldValue( key.mTime );
+        pValueField->getFieldValue( key.mValue );
+        keys.push_back( key );
+    }
+
     // Set the value bounds.
     setValueBounds( maxTime, minValue, maxValue, defaultValue );
 
@@ -665,9 +701,5 @@ void ParticleAssetField::onTamlCustomRead( const TamlCustomNode* pCustomNode )
     setRepeatTime( repeatTime );
 
     // Set the data keys.
-    for ( S32 index = 0; index < keys.size(); ++index )
-    {
-        const DataKey& key = keys[index];
-        addDataKey( key.mTime, key.mValue );
-    }
+    mDataKeys = keys;
 }

+ 1 - 1
engine/source/2d/assets/ParticleAssetFieldCollection.cc

@@ -465,7 +465,7 @@ void ParticleAssetFieldCollection::onTamlCustomRead( const TamlCustomNodes& cust
         TamlCustomNode* pChildNode = *childNodeItr;
 
         // Fetch node name.
-        StringTableEntry nodeName = pChildNode->mNodeName;
+        StringTableEntry nodeName = pChildNode->getNodeName();
 
         // Find the field.
         ParticleAssetField* pParticleAssetField = findField( nodeName );

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

@@ -3637,7 +3637,7 @@ void Scene::onTamlPostRead( const TamlCustomNodes& customNodes )
             TamlCustomNode* pJointNode = *jointNodeItr;
 
             // Fetch node name.
-            StringTableEntry nodeName = pJointNode->mNodeName;
+            StringTableEntry nodeName = pJointNode->getNodeName();
 
             // Is this a distance joint?
             if ( nodeName == jointDistanceNodeName )
@@ -4479,7 +4479,7 @@ void Scene::onTamlCustomWrite( TamlCustomNodes& customNodes )
 				case e_distanceJoint:
 					{
 						// Set joint name.
-                        pJointNode->mNodeName = StringTable->insert( jointDistanceNodeName );
+                        pJointNode->setNodeName( jointDistanceNodeName );
 
 						// Fetch joint.
 						const b2DistanceJoint* pJoint = dynamic_cast<const b2DistanceJoint*>( pBaseJoint );
@@ -4516,7 +4516,7 @@ void Scene::onTamlCustomWrite( TamlCustomNodes& customNodes )
 				case e_ropeJoint:
 					{
 						// Set joint name.
-						pJointNode->mNodeName = StringTable->insert( jointRopeNodeName );
+						pJointNode->setNodeName( jointRopeNodeName );
 
 						// Fetch joint.
 						const b2RopeJoint* pJoint = dynamic_cast<const b2RopeJoint*>( pBaseJoint );
@@ -4546,7 +4546,7 @@ void Scene::onTamlCustomWrite( TamlCustomNodes& customNodes )
 				case e_revoluteJoint:
 					{
 						// Set join name.
-						pJointNode->mNodeName = StringTable->insert( jointRevoluteNodeName );
+						pJointNode->setNodeName( jointRevoluteNodeName );
 
 						// Fetch joint.
 						const b2RevoluteJoint* pJoint = dynamic_cast<const b2RevoluteJoint*>( pBaseJoint );
@@ -4588,7 +4588,7 @@ void Scene::onTamlCustomWrite( TamlCustomNodes& customNodes )
 				case e_weldJoint:
 					{
 						// Set joint name.
-						pJointNode->mNodeName = StringTable->insert( jointWeldNodeName );
+						pJointNode->setNodeName( jointWeldNodeName );
 
 						// Fetch joint.
 						const b2WeldJoint* pJoint = dynamic_cast<const b2WeldJoint*>( pBaseJoint );
@@ -4622,7 +4622,7 @@ void Scene::onTamlCustomWrite( TamlCustomNodes& customNodes )
 				case e_wheelJoint:
 					{
 						// Set joint name.
-						pJointNode->mNodeName = StringTable->insert( jointWheelNodeName );
+						pJointNode->setNodeName( jointWheelNodeName );
 
 						// Fetch joint.
 						b2WheelJoint* pJoint = dynamic_cast<b2WheelJoint*>( pBaseJoint );
@@ -4665,7 +4665,7 @@ void Scene::onTamlCustomWrite( TamlCustomNodes& customNodes )
 				case e_frictionJoint:
 					{
 						// Set joint name.
-						pJointNode->mNodeName = StringTable->insert( jointFrictionNodeName );
+						pJointNode->setNodeName( jointFrictionNodeName );
 
 						// Fetch joint.
 						const b2FrictionJoint* pJoint = dynamic_cast<const b2FrictionJoint*>( pBaseJoint );
@@ -4699,7 +4699,7 @@ void Scene::onTamlCustomWrite( TamlCustomNodes& customNodes )
 				case e_prismaticJoint:
 					{
 						// Set joint name.
-						pJointNode->mNodeName = StringTable->insert( jointPrismaticNodeName );
+						pJointNode->setNodeName( jointPrismaticNodeName );
 
 						// Fetch joint.
 						b2PrismaticJoint* pJoint = dynamic_cast<b2PrismaticJoint*>( pBaseJoint );
@@ -4742,7 +4742,7 @@ void Scene::onTamlCustomWrite( TamlCustomNodes& customNodes )
 				case e_pulleyJoint:
 					{
 						// Set joint name.
-						pJointNode->mNodeName = StringTable->insert( jointPulleyNodeName );
+						pJointNode->setNodeName( jointPulleyNodeName );
 
 						// Fetch joint.
 						b2PulleyJoint* pJoint = dynamic_cast<b2PulleyJoint*>( pBaseJoint );
@@ -4777,7 +4777,7 @@ void Scene::onTamlCustomWrite( TamlCustomNodes& customNodes )
 				case e_mouseJoint:
 					{
 						// Set joint name.
-						pJointNode->mNodeName = StringTable->insert( jointTargetNodeName );
+						pJointNode->setNodeName( jointTargetNodeName );
 
 						// Fetch joint.
 						const b2MouseJoint* pJoint = dynamic_cast<const b2MouseJoint*>( pBaseJoint );
@@ -4808,7 +4808,7 @@ void Scene::onTamlCustomWrite( TamlCustomNodes& customNodes )
 				case e_motorJoint:
 					{
 						// Set joint name.
-						pJointNode->mNodeName = StringTable->insert( jointMotorNodeName );
+						pJointNode->setNodeName( jointMotorNodeName );
 
 						// Fetch joint.
 						const b2MotorJoint* pJoint = dynamic_cast<const b2MotorJoint*>( pBaseJoint );

+ 26 - 17
engine/source/2d/sceneobject/SceneObject.cc

@@ -89,6 +89,9 @@ static bool collisionShapePropertiesInitialized = false;
 
 static StringTableEntry shapeCustomNodeName;
 
+static StringTableEntry pointXName;
+static StringTableEntry pointYName;
+
 static StringTableEntry shapeDensityName;
 static StringTableEntry shapeFrictionName;
 static StringTableEntry shapeRestitutionName;
@@ -210,6 +213,9 @@ SceneObject::SceneObject() :
     {
         shapeCustomNodeName     = StringTable->insert( "CollisionShapes" );
 
+        pointXName              = StringTable->insert( "x" );
+        pointYName              = StringTable->insert( "y" );
+
         shapeDensityName        = StringTable->insert( "Density" );
         shapeFrictionName       = StringTable->insert( "Friction" );
         shapeRestitutionName    = StringTable->insert( "Restitution" );
@@ -3418,7 +3424,7 @@ void SceneObject::onTamlCustomWrite( TamlCustomNodes& customNodes )
         case b2Shape::e_circle:
             {
                 // Set node name.
-                pCollisionShapeNode->mNodeName = StringTable->insert( circleTypeName );
+                pCollisionShapeNode->setNodeName( circleTypeName );
 
                 // Fetch shape.
                 const b2CircleShape* pShape = dynamic_cast<const b2CircleShape*>( fixtureDef.shape );
@@ -3438,7 +3444,7 @@ void SceneObject::onTamlCustomWrite( TamlCustomNodes& customNodes )
         case b2Shape::e_polygon:
             {
                 // Set node name.
-                pCollisionShapeNode->mNodeName = StringTable->insert( polygonTypeName );
+                pCollisionShapeNode->setNodeName( polygonTypeName );
 
                 // Fetch shape.
                 const b2PolygonShape* pShape = dynamic_cast<const b2PolygonShape*>( fixtureDef.shape );
@@ -3452,12 +3458,15 @@ void SceneObject::onTamlCustomWrite( TamlCustomNodes& customNodes )
                 // Add shape properties.
                 for ( U32 pointIndex = 0; pointIndex < pointCount; ++pointIndex )
                 {
-                    // Format point index name.
-                    char pointIndexBuffer[16];
-                    dSprintf( pointIndexBuffer, sizeof(pointIndexBuffer), "%s%d", polygonPointName, pointIndex );
-                    
-                    // Add point property.
-                    pCollisionShapeNode->addField( pointIndexBuffer, pShape->GetVertex( pointIndex ) );
+                    // Add point node.
+                    TamlCustomNode* pPointNode = pCollisionShapeNode->addNode( polygonPointName );
+
+                    // Fetch point.
+                    const b2Vec2& point = pShape->GetVertex( pointIndex );
+
+                    // Add point fields.
+                    pPointNode->addField( pointXName, point.x );
+                    pPointNode->addField( pointYName, point.y );
                 }
             }
             break;
@@ -3465,7 +3474,7 @@ void SceneObject::onTamlCustomWrite( TamlCustomNodes& customNodes )
         case b2Shape::e_chain:
             {
                 // Set node name.
-                pCollisionShapeNode->mNodeName = StringTable->insert( chainTypeName );
+                pCollisionShapeNode->setNodeName( chainTypeName );
 
                 // Fetch shape.
                 const b2ChainShape* pShape = dynamic_cast<const b2ChainShape*>( fixtureDef.shape );
@@ -3500,7 +3509,7 @@ void SceneObject::onTamlCustomWrite( TamlCustomNodes& customNodes )
         case b2Shape::e_edge:
             {
                 // Set node name.
-                pCollisionShapeNode->mNodeName = StringTable->insert( edgeTypeName );
+                pCollisionShapeNode->setNodeName( edgeTypeName );
 
                 // Fetch shape.
                 const b2EdgeShape* pShape = dynamic_cast<const b2EdgeShape*>( fixtureDef.shape );
@@ -3555,8 +3564,8 @@ void SceneObject::onTamlCustomRead( const TamlCustomNodes& customNodes )
         // Fetch shape node.
         TamlCustomNode* pShapeNode = *shapeNodeItr;
 
-        // Fetch alias name.
-        StringTableEntry aliasName = pShapeNode->mNodeName;
+        // Fetch shape name.
+        StringTableEntry shapeName = pShapeNode->getNodeName();
 
         // Ready common fields.
         F32 shapeDensity     = getDefaultDensity();
@@ -3567,7 +3576,7 @@ void SceneObject::onTamlCustomRead( const TamlCustomNodes& customNodes )
         S32 shapeIndex;
 
         // Is this a circle shape?
-        if ( aliasName == circleTypeName )
+        if ( shapeName == circleTypeName )
         {
             // Yes, so ready fields.
             F32 radius = 0.0f;
@@ -3627,7 +3636,7 @@ void SceneObject::onTamlCustomRead( const TamlCustomNodes& customNodes )
             shapeIndex = createCircleCollisionShape( radius, offset );
         }
         // Is this a polygon shape?
-        else if ( aliasName == polygonTypeName )
+        else if ( shapeName == polygonTypeName )
         {
             // Yes, so ready fields.
             b2Vec2 points[b2_maxPolygonVertices];
@@ -3692,7 +3701,7 @@ void SceneObject::onTamlCustomRead( const TamlCustomNodes& customNodes )
             shapeIndex = createPolygonCollisionShape( pointCount, points );
         }
         // Is this a chain shape?
-        else if ( aliasName == chainTypeName )
+        else if ( shapeName == chainTypeName )
         {
             // Yes, so ready fields.
             Vector<b2Vec2> points;
@@ -3762,7 +3771,7 @@ void SceneObject::onTamlCustomRead( const TamlCustomNodes& customNodes )
             shapeIndex = createChainCollisionShape( points.size(), points.address(), hasAdjacentStartPoint, hasAdjacentEndPoint, adjacentStartPoint, adjacentEndPoint );
         }
         // Is this an edge shape?
-        else if ( aliasName == edgeTypeName )
+        else if ( shapeName == edgeTypeName )
         {
             // Yes, so ready fields.
             b2Vec2 point0;
@@ -3829,7 +3838,7 @@ void SceneObject::onTamlCustomRead( const TamlCustomNodes& customNodes )
         else
         {
             // Warn.
-            Con::warnf( "Unknown shape type of '%s' encountered.", aliasName );
+            Con::warnf( "Unknown shape type of '%s' encountered.", shapeName );
 
             // Sanity!
             AssertFatal( false, "SceneObject::onTamlCustomRead() - Unknown shape type detected." );

+ 1 - 1
engine/source/assets/assetQuery.cc

@@ -101,7 +101,7 @@ void AssetQuery::onTamlCustomRead( const TamlCustomNodes& customNodes )
         const TamlCustomNode* pAssetNode = *assetNodeItr;
 
         // Skip if an unknown node name.
-        if ( pAssetNode->mNodeName != assetNodeName )
+        if ( pAssetNode->getNodeName() != assetNodeName )
             continue;
 
         // Fetch field.

+ 2 - 2
engine/source/assets/assetTagsManifest.cc

@@ -182,7 +182,7 @@ void AssetTagsManifest::onTamlCustomRead( const TamlCustomNodes& customNodes )
         const TamlCustomNode* pTagNode = *tagNodeItr;
 
         // Skip if an unknown node name.
-        if ( pTagNode->mNodeName != tagNodeName )
+        if ( pTagNode->getNodeName() != tagNodeName )
             continue;
 
         // Fetch "Name" field.
@@ -220,7 +220,7 @@ void AssetTagsManifest::onTamlCustomRead( const TamlCustomNodes& customNodes )
         const TamlCustomNode* pAssetTagNode = *assetTagNodeItr;
 
         // Skip if an unknown node name.
-        if ( pAssetTagNode->mNodeName != assetTagNodeName )
+        if ( pAssetTagNode->getNodeName() != assetTagNodeName )
             continue;
 
         // Fetch "AssetId" field.

+ 7 - 7
engine/source/component/behaviors/behaviorComponent.cpp

@@ -1017,16 +1017,16 @@ void BehaviorComponent::onTamlCustomRead( const TamlCustomNodes& customNodes )
             TamlCustomNode* pBehaviorNode = *behaviorNodeItr;
 
             // Fetch template.
-            BehaviorTemplate* pTemplate = dynamic_cast<BehaviorTemplate *>( Sim::findObject( pBehaviorNode->mNodeName ) );
+            BehaviorTemplate* pTemplate = dynamic_cast<BehaviorTemplate *>( Sim::findObject( pBehaviorNode->getNodeName() ) );
 
             // Find template?
             if( pTemplate == NULL )
             {
                 // No, so warn appropriately.
-                Con::warnf( "BehaviorComponent::onTamlCustomRead() - Missing Behavior '%s'", pBehaviorNode->mNodeName );
+                Con::warnf( "BehaviorComponent::onTamlCustomRead() - Missing Behavior '%s'", pBehaviorNode->getNodeName() );
 
                 if( isMethod( "onBehaviorMissing" ) )
-                    Con::executef( this, 2, "onBehaviorMissing", pBehaviorNode->mNodeName );
+                    Con::executef( this, 2, "onBehaviorMissing", pBehaviorNode->getNodeName() );
 
                 // Skip it.
                 continue;
@@ -1039,10 +1039,10 @@ void BehaviorComponent::onTamlCustomRead( const TamlCustomNodes& customNodes )
             if ( pBehaviorInstance == NULL )
             {
                 // No, so warn appropriately.
-                Con::warnf( "BehaviorComponent::onTamlCustomRead() - Found behavior could not create an instance '%s'", pBehaviorNode->mNodeName );
+                Con::warnf( "BehaviorComponent::onTamlCustomRead() - Found behavior could not create an instance '%s'", pBehaviorNode->getNodeName() );
 
                 if( isMethod( "onBehaviorMissing" ) )
-                    Con::executef( this, 2, "onBehaviorMissing", pBehaviorNode->mNodeName );
+                    Con::executef( this, 2, "onBehaviorMissing", pBehaviorNode->getNodeName() );
 
                 // Skip it.
                 continue;
@@ -1077,7 +1077,7 @@ void BehaviorComponent::onTamlCustomRead( const TamlCustomNodes& customNodes )
                         // No, so warn.
                         Con::warnf( "BehaviorComponent::onTamlCustomRead() - Encountered an invalid behavior Id of '%d' on behavior '%s'.",
                             behaviorId,
-                            pBehaviorNode->mNodeName );
+                            pBehaviorNode->getNodeName() );
                     }
 
                     // Update maximum behavior Id found.
@@ -1136,7 +1136,7 @@ void BehaviorComponent::onTamlCustomRead( const TamlCustomNodes& customNodes )
             TamlCustomNode* pConnectionNode = *connectionNodeItr;
 
             // Skip if the alias isn't a connection.
-            if ( pConnectionNode->mNodeName != connectionNodeName )
+            if ( pConnectionNode->getNodeName() != connectionNodeName )
                 continue;
 
             // Fetch field nodes.

+ 2 - 2
engine/source/persistence/taml/tamlBinaryWriter.cc

@@ -207,7 +207,7 @@ void TamlBinaryWriter::writeCustomElements( Stream& stream, const TamlWriteNode*
         TamlCustomNode* pCustomNode = *customNodesItr;
 
         // Write custom node name.
-        stream.writeString( pCustomNode->mNodeName );
+        stream.writeString( pCustomNode->getNodeName() );
 
         // Fetch node children.
         const TamlCustomNodeVector& nodeChildren = pCustomNode->getChildren();
@@ -243,7 +243,7 @@ void TamlBinaryWriter::writeCustomNode( Stream& stream, const TamlCustomNode* pC
     stream.write( false );
 
     // Write custom node name.
-    stream.writeString( pCustomNode->mNodeName );
+    stream.writeString( pCustomNode->getNodeName() );
 
     // Fetch node children.
     const TamlCustomNodeVector& nodeChildren = pCustomNode->getChildren();

+ 25 - 17
engine/source/persistence/taml/tamlCustom.h

@@ -238,16 +238,6 @@ public:
         mIgnoreEmpty = false;
     }
 
-    void set( const char* pNodeName )
-    {
-        // Sanity!
-        AssertFatal( pNodeName != NULL, "Node name cannot be NULL." );
-
-        mNodeName = StringTable->insert( pNodeName );
-    }
-
-    void setWriteNode( TamlWriteNode* pWriteNode );
-
     inline TamlCustomNode* addNode( SimObject* pProxyObject )
     {
         // Sanity!
@@ -268,11 +258,14 @@ public:
 
     inline TamlCustomNode* addNode( const char* pNodeName, const bool ignoreEmpty = true )
     {
+        // Sanity!
+        AssertFatal( pNodeName != NULL, "Cannot add a NULL node name." );
+
         // Create a custom node.
         TamlCustomNode* pCustomNode = TamlCustomNodeFactory.createObject();
 
-        // Set node name.
-        pCustomNode->set( pNodeName );
+        // Fetch node name.
+        StringTableEntry nodeName = StringTable->insert( pNodeName );
 
         // Set ignore-empty flag.
         pCustomNode->mIgnoreEmpty = ignoreEmpty;
@@ -306,7 +299,7 @@ public:
         // Find node.
         for( Vector<TamlCustomNode*>::const_iterator nodeItr = mChildren.begin(); nodeItr != mChildren.end(); ++nodeItr )
         {
-            if ( (*nodeItr)->mNodeName == nodeName )
+            if ( (*nodeItr)->getNodeName() == nodeName )
                 return (*nodeItr);
         }
 
@@ -456,8 +449,20 @@ public:
         return NULL;
     }
 
+    inline void setNodeName( const char* pNodeName )
+    {
+        // Sanity!
+        AssertFatal( pNodeName != NULL, "Cannot add a NULL node name." );
+
+        mNodeName = StringTable->insert( pNodeName );
+    }
+
     inline StringTableEntry getNodeName( void ) const { return mNodeName; }
 
+
+
+    void setWriteNode( TamlWriteNode* pWriteNode );
+
     inline const Vector<TamlCustomNode*>& getChildren( void ) const { return mChildren; }
     inline const TamlCustomFieldVector& getFields( void ) const { return mFields; }
 
@@ -467,8 +472,11 @@ public:
     template<typename T> T* composeProxyObject( void ) const;
 
     inline bool isEmpty( void ) const { return mChildren.size() == 0 && mFields.size() == 0; }
+
+    inline void setIgnoreEmpty( const bool ignoreEmpty ) { mIgnoreEmpty = ignoreEmpty; }
     inline bool getIgnoreEmpty( void ) const { return mIgnoreEmpty; }
 
+private:
     StringTableEntry        mNodeName;
     Vector<TamlCustomNode*> mChildren;
     TamlCustomFieldVector   mFields;
@@ -508,17 +516,17 @@ public:
         TamlCustomNode* pCustomNode = TamlCustomNodeFactory.createObject();
 
         // Set node name.
-        pCustomNode->set( pNodeName );
+        pCustomNode->setNodeName( pNodeName );
 
         // Set ignore-empty flag.
-        pCustomNode->mIgnoreEmpty = ignoreEmpty;
+        pCustomNode->setIgnoreEmpty( ignoreEmpty );
 
 #if TORQUE_DEBUG
         // Ensure a node name conflict does not exist.
         for( TamlCustomNodeVector::iterator nodeItr = mNodes.begin(); nodeItr != mNodes.end(); ++nodeItr )
         {
             // Skip if node name is not the same.
-            if ( pCustomNode->mNodeName != (*nodeItr)->mNodeName )
+            if ( pCustomNode->getNodeName() != (*nodeItr)->getNodeName() )
                 continue;
 
             // Warn!
@@ -558,7 +566,7 @@ public:
         // Find node.
         for( Vector<TamlCustomNode*>::const_iterator nodeItr = mNodes.begin(); nodeItr != mNodes.end(); ++nodeItr )
         {
-            if ( (*nodeItr)->mNodeName == nodeName )
+            if ( (*nodeItr)->getNodeName() == nodeName )
                 return (*nodeItr);
         }
 

+ 0 - 1
engine/source/persistence/taml/tamlXmlReader.cc

@@ -310,7 +310,6 @@ void TamlXmlReader::parseCustomElement( TiXmlElement* pXmlElement, TamlCustomNod
 
         // Parse custom node.
         parseCustomNode( pCustomXmlElement, pCustomNode );
-
     }
     while ( pCustomXmlNode != NULL );
 }

+ 5 - 5
engine/source/persistence/taml/tamlXmlWriter.cc

@@ -167,7 +167,7 @@ void TamlXmlWriter::compileCustomElements( TiXmlElement* pXmlElement, const Taml
 
         // Format extended element name.
         char extendedElementNameBuffer[256];
-        dSprintf( extendedElementNameBuffer, sizeof(extendedElementNameBuffer), "%s.%s", pXmlElement->Value(), pCustomNode->mNodeName );
+        dSprintf( extendedElementNameBuffer, sizeof(extendedElementNameBuffer), "%s.%s", pXmlElement->Value(), pCustomNode->getNodeName() );
         StringTableEntry extendedElementName = StringTable->insert( extendedElementNameBuffer );
 
         // Create element.
@@ -187,7 +187,7 @@ void TamlXmlWriter::compileCustomElements( TiXmlElement* pXmlElement, const Taml
         }
 
         // Finish if the node is set to ignore if empty and it is empty.
-        if ( pCustomNode->mIgnoreEmpty && pExtendedPropertyElement->NoChildren() )
+        if ( pCustomNode->getIgnoreEmpty() && pExtendedPropertyElement->NoChildren() )
         {
             // Yes, so delete the extended element.
             delete pExtendedPropertyElement;
@@ -206,11 +206,11 @@ void TamlXmlWriter::compileCustomElements( TiXmlElement* pXmlElement, const Taml
 void TamlXmlWriter::compileCustomNode( TiXmlElement* pXmlElement, const TamlCustomNode* pCustomNode )
 {
     // Finish if the node is set to ignore if empty and it is empty.
-    if ( pCustomNode->mIgnoreEmpty && pCustomNode->isEmpty() )
+    if ( pCustomNode->getIgnoreEmpty() && pCustomNode->isEmpty() )
         return;
 
     // Create element.
-    TiXmlElement* pNodeElement = new TiXmlElement( pCustomNode->mNodeName );
+    TiXmlElement* pNodeElement = new TiXmlElement( pCustomNode->getNodeName() );
 
     // Fetch node children.
     const TamlCustomNodeVector& nodeChildren = pCustomNode->getChildren();
@@ -249,7 +249,7 @@ void TamlXmlWriter::compileCustomNode( TiXmlElement* pXmlElement, const TamlCust
     }
 
     // Finish if the node is set to ignore if empty and it is empty (including fields).
-    if ( pCustomNode->mIgnoreEmpty && nodeFields.size() == 0 && pNodeElement->NoChildren() )
+    if ( pCustomNode->getIgnoreEmpty() && nodeFields.size() == 0 && pNodeElement->NoChildren() )
     {
         // Yes, so delete the extended element.
         delete pNodeElement;

+ 7 - 2
modules/ToyAssets/1/assets/particles/bonfire.asset.taml

@@ -26,8 +26,13 @@
 				Keys="0 0" />				
             <FixedForceVariation
                 Keys="0 0" />				
-            <SizeXLife
-                Keys="0 0 0.2 1 0.5 1 0.9 1 1 0" />
+            <SizeXLife>
+				<Key Time="0" Value="0"/>
+				<Key Time="0.2" Value="1"/>
+				<Key Time="0.5" Value="1"/>
+				<Key Time="0.9" Value="1"/>
+				<Key Time="1" Value="0"/>
+			</SizeXLife>
             <SizeXVariation
                 Keys="0 0.3" />				
             <SpinVariation