Exemple #1
0
    void ActorRigid::ProtoDeSerialize(const XML::Node& OneNode)
    {
        if ( Mezzanine::String(OneNode.Name())==this->ActorRigid::SerializableName() )
        {
            if(OneNode.GetAttribute("Version").AsInt() == 1)
            {
                this->ActorBase::ProtoDeSerialize(OneNode.GetChild(this->ActorBase::SerializableName()));

                Vector3 TempVec;
                XML::Node LinearMovementFactor = OneNode.GetChild("LinearMovementFactor").GetFirstChild();
                if(!LinearMovementFactor)
                    { DeSerializeError("locate LinearMovementFactor node",SerializableName()); }
                TempVec.ProtoDeSerialize(LinearMovementFactor);
                this->SetLinearMovementFactor(TempVec);

                XML::Node AngularMovementFactor = OneNode.GetChild("AngularMovementFactor").GetFirstChild();
                if(!AngularMovementFactor)
                    { DeSerializeError("locate AngularMovementFactor node",SerializableName()); }
                TempVec.ProtoDeSerialize(AngularMovementFactor);
                this->SetAngularMovementFactor(TempVec);
                // could not do Name, File, Group - done in ActorDeSerializer
            }else{
                DeSerializeError("find usable serialization version",SerializableName());
            }
        }else{
            DeSerializeError(String("find correct class to deserialize, found a ")+OneNode.Name(),SerializableName());
        }
    }
Exemple #2
0
    void WorldObject::ProtoDeSerialize(const XML::Node& OneNode)
    {
        if ( Mezzanine::String(OneNode.Name())==this->WorldObject::SerializableName() )
        {
            if(OneNode.GetAttribute("Version").AsInt() == 1)
            {
                Vector3 TempVec;
                XML::Node LocationNode = OneNode.GetChild("Location").GetFirstChild();
                if(!LocationNode)
                    { DeSerializeError("locate Location node",SerializableName()); }
                TempVec.ProtoDeSerialize(LocationNode);
                this->SetLocation(TempVec);

                XML::Node GraphicsSettingsNode = OneNode.GetChild(this->GraphicsSettingsSerializableName());
                if(!GraphicsSettingsNode)
                    { DeSerializeError("locate Graphics Settings node",SerializableName()); }
                this->GetGraphicsSettings()->ProtoDeSerialize(GraphicsSettingsNode);

                XML::Node PhysicsSettingsNode = OneNode.GetChild(this->PhysicsSettingsSerializableName());
                if(!PhysicsSettingsNode)
                    { DeSerializeError(String("locate Physics Settings node, ")+this->PhysicsSettingsSerializableName()+", ",SerializableName()); }
                this->GetPhysicsSettings()->ProtoDeSerialize(PhysicsSettingsNode);

                XML::Node ScalingNode = OneNode.GetChild("Scaling").GetFirstChild();
                if(!ScalingNode)
                    { DeSerializeError("locate Scaling node",SerializableName()); }
                TempVec.ProtoDeSerialize(ScalingNode);
                this->SetScaling(TempVec);

                if( this->IsInWorld() != OneNode.GetAttribute("IsInWorld").AsBool() )
                {
                    if(this->IsInWorld())
                        { this->RemoveFromWorld(); }
                    else
                        { this->AddToWorld(); }
                }

                /*if( 0!=OneNode.GetAttribute("SoundSet") && ""!=OneNode.GetAttribute("SoundSet").AsString())
                    { this->ObjectSounds = Audio::AudioManager::GetSingletonPtr()->GetSoundSet(OneNode.GetAttribute("SoundSet").AsString()); }
                else
                    { this->ObjectSounds = 0; }//*/
            }else{
                DeSerializeError("find usable serialization version",SerializableName());
            }
        }else{
            DeSerializeError(String("find correct class to deserialize, found a ")+OneNode.Name(),SerializableName());
        }
    }
Exemple #3
0
        void GearConstraint::ProtoDeSerialize(const XML::Node& OneNode)
        {
            if ( Mezzanine::String(OneNode.Name())==this->GearConstraint::SerializableName() )
            {
                if(OneNode.GetAttribute("Version").AsInt() == 1)
                {
                    this->Constraint::ProtoDeSerialize(OneNode.GetChild("Constraint"));

                    this->SetRotationRatio(OneNode.GetAttribute("Ratio").AsReal());

                    XML::Node ActorANode = OneNode.GetChild("ActorA");
                    if(!ActorANode)
                        { DeSerializeError("Could not find ActorA axis",SerializableName()); }

                    XML::Node ActorBNode = OneNode.GetChild("ActorB");
                    if(!ActorBNode)
                        { DeSerializeError("Could not find ActorB axis",SerializableName()); }

                    Vector3 temp;
                    temp.ProtoDeSerialize(ActorANode.GetFirstChild());
                    this->SetAxisA(temp);
                    temp.ProtoDeSerialize(ActorBNode.GetFirstChild());
                    this->SetAxisB(temp);
                }else{
                    DeSerializeError("find usable serialization version",SerializableName());
                }
            }else{
                DeSerializeError(String("find correct class to deserialize, found a ")+OneNode.Name(),SerializableName());
            }
        }
Exemple #4
0
void CapsuleCollisionShape::ProtoDeSerialize(const XML::Node& OneNode)
{
    if ( Mezzanine::String(OneNode.Name())==this->CapsuleCollisionShape::GetSerializableName() )
    {
        if(OneNode.GetAttribute("Version").AsInt() == 1)
        {
            XML::Node CollisionNode = OneNode.GetChild(this->PrimitiveCollisionShape::GetSerializableName());
            if(!CollisionNode)
            {
                DeSerializeError("locate PrimitiveCollisionShape node",GetSerializableName());
            }
            this->PrimitiveCollisionShape::ProtoDeSerialize(CollisionNode);
        } else {
            DeSerializeError("find usable serialization version",GetSerializableName());
        }
    } else {
        DeSerializeError(String("find correct class to deserialize, found a ")+OneNode.Name(),GetSerializableName());
    }
}
Exemple #5
0
 void AreaEffect::ProtoDeSerialize(const XML::Node& OneNode)
 {
     if ( Mezzanine::String(OneNode.Name())==this->AreaEffect::SerializableName() )
     {
         if(OneNode.GetAttribute("Version").AsInt() == 1)
         {
             NonStaticWorldObject::ProtoDeSerialize(OneNode.GetChild(this->NonStaticWorldObject::SerializableName()));
         }
     }
 }
Exemple #6
0
    void NonStaticWorldObject::ProtoDeSerialize(const XML::Node& OneNode)
    {
        if ( Mezzanine::String(OneNode.Name())==this->NonStaticWorldObject::SerializableName() )
        {
            if(OneNode.GetAttribute("Version").AsInt() == 1)
            {
                this->WorldObject::ProtoDeSerialize(OneNode.GetChild(this->WorldObject::SerializableName()));

                Quaternion TempQuat;
                XML::Node OrientationNode = OneNode.GetChild("Orientation").GetFirstChild();
                if(!OrientationNode)
                    { DeSerializeError("locate Orientation node",SerializableName()); }
                TempQuat.ProtoDeSerialize(OrientationNode);
                this->SetOrientation(TempQuat);

                /*if(0==OneNode.GetAttribute("WorldNode"))         // Are we dealing with a WorldNode Node or WorldNode Attribute.
                {
                    //Since the Attribute didn't exist we must have a node
                    XML::Node ObjectWorldNode = OneNode.GetChild("WorldNode");                               // Assumption made base on old style serialization
                    if(!ObjectWorldNode)
                        { DeSerializeError("locate ObjectWorldNode node",SerializableName()); }
                    if (0!=this->ObjectWorldNode && !Entresol::GetSingletonPtr()->GetSceneManager()->GetNode(this->ObjectWorldNode->GetName()) )    //If the current worldnode is not null and it is not in the manager, then delete it
                        { delete this->ObjectWorldNode; }
                    this->ObjectWorldNode = new WorldNode(ObjectWorldNode.GetAttribute("Name").AsString(),0);
                    ObjectWorldNode >> *(this->ObjectWorldNode);                                              // Deserialized with old style serialization
                }else{
                    WorldNode *TempWorldNode = Entresol::GetSingletonPtr()->GetSceneManager()->GetNode(OneNode.GetAttribute("WorldNode").AsString());
                    if( TempWorldNode == this->ObjectWorldNode )
                        { return; }                                                                         //This already has the correct node we are done
                    if (0!=this->ObjectWorldNode && !Entresol::GetSingletonPtr()->GetSceneManager()->GetNode(this->ObjectWorldNode->GetName()) )    //If the current worldnode is not null and it is not in the manager, then delete it
                        { delete this->ObjectWorldNode; }
                    this->ObjectWorldNode = TempWorldNode;                                                   // The old node has bee cleaned up and the new node is in place
                    if (0==this->ObjectWorldNode)
                        { DeSerializeError("locate ObjectWorldNode attribute",SerializableName()); }
                }//*/
            }else{
                DeSerializeError("find usable serialization version",SerializableName());
            }
        }else{
            DeSerializeError(String("find correct class to deserialize, found a ")+OneNode.Name(),SerializableName());
        }
    }
Exemple #7
0
 void Transform::ProtoDeSerialize(const XML::Node& OneNode)
 {
     if ( Mezzanine::String(OneNode.Name())==Mezzanine::String(SerializableName()) )
     {
         if(OneNode.GetAttribute("Version").AsInt() == 1)
         {
             this->Location.ProtoDeSerialize(OneNode.GetChild("Vector3"));
             this->Rotation.ProtoDeSerialize(OneNode.GetChild("Quaternion"));
         }else{
             MEZZ_EXCEPTION(Exception::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + SerializableName() + ": Not Version 1.");
         }
     }else{
         MEZZ_EXCEPTION(Exception::II_IDENTITY_INVALID_EXCEPTION,"Attempting to deserialize a " + SerializableName() + ", found a " + String(OneNode.Name()));
     }
 }
Exemple #8
0
 // DeSerializable
 void ColourValue::ProtoDeSerialize(const XML::Node& OneNode)
 {
     if( Mezzanine::String(OneNode.Name())==this->ColourValue::GetSerializableName() )
     {
         if(OneNode.GetAttribute("Version").AsInt() == 1)
         {
             this->RedChannel=OneNode.GetAttribute("Red").AsReal();
             this->GreenChannel=OneNode.GetAttribute("Green").AsReal();
             this->BlueChannel=OneNode.GetAttribute("Blue").AsReal();
             this->AlphaChannel=OneNode.GetAttribute("Alpha").AsReal();
         }else{
             MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + (this->ColourValue::GetSerializableName()) + ": Not Version 1");
         }
     }else{
         MEZZ_EXCEPTION(ExceptionBase::II_IDENTITY_INVALID_EXCEPTION,"Attempting to deserialize a " + (this->ColourValue::GetSerializableName()) + ", found a " + OneNode.Name());
     }
 }