CapsuleCollisionShape::CapsuleCollisionShape(XML::Node OneNode) { if(OneNode.GetAttribute("Version").AsInt() == 1) { XML::Attribute OneName = OneNode.GetChild("PrimitiveCollisionShape").GetChild("CollisionShape").GetAttribute("Name"); // get name if(!OneName) { MEZZ_EXCEPTION(ExceptionBase::PARAMETERS_EXCEPTION,"Could not find Name Attribute on CollsionShape Node during preparation for deserialization"); } String Name_(OneName.AsString()); XML::Attribute Axis = OneNode.GetAttribute("Axis"); if (!Axis) { DeSerializeError("find Axis Attribute",CapsuleCollisionShape::GetSerializableName()); } /* XML::Attribute Radius = OneNode.GetAttribute("Radius"); if (!Radius) { DeSerializeError("find Radius Attribute",CapsuleCollisionShape::GetSerializableName()); } XML::Attribute Height = OneNode.GetAttribute("Height"); if (!Height) { DeSerializeError("find Height Attribute",CapsuleCollisionShape::GetSerializableName()); } //SetPointers(new CapsuleCollisionShape(Name_,Radius.AsReal(),Height.AsReal(), (StandardAxis)Axis.AsInteger()); // make and deserialize the shape this->Construct(Name_,Radius.AsReal(),Height.AsReal(),(StandardAxis)Axis.AsInteger()); */ this->Construct(Name_,0,0,(StandardAxis)Axis.AsInteger()); this->ProtoDeSerialize(OneNode); } else { DeSerializeError("find usable serialization version",CapsuleCollisionShape::GetSerializableName()); } }
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()); } }
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()); } }
void CapsuleCollisionShape::ProtoDeSerialize(const XML::Node& OneNode) { if ( Mezzanine::String(OneNode.Name())==this->CapsuleCollisionShape::SerializableName() ) { if(OneNode.GetAttribute("Version").AsInt() == 1) { XML::Node CollisionNode = OneNode.GetChild(this->PrimitiveCollisionShape::SerializableName()); if(!CollisionNode) { DeSerializeError("locate PrimitiveCollisionShape node",SerializableName()); } this->PrimitiveCollisionShape::ProtoDeSerialize(CollisionNode); }else{ DeSerializeError("find usable serialization version",SerializableName()); } }else{ DeSerializeError(String("find correct class to deserialize, found a ")+OneNode.Name(),SerializableName()); } }
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()); } }
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()); } }