Example #1
0
    void ActorRigid::ProtoSerialize(XML::Node& CurrentRoot) const
    {
        XML::Node ActorNode = CurrentRoot.AppendChild("ActorRigid");
        if (!ActorNode) { ThrowSerialError("create ActorRigidNode");}

        XML::Attribute Version = ActorNode.AppendAttribute("Version");
        if (Version)
            { Version.SetValue(1); }
        else
            { SerializeError("Create set Version on ActorRigid node", SerializableName()); }

        XML::Attribute ActorName = ActorNode.AppendAttribute("Name");
            ActorName.SetValue(this->GetName());
        XML::Attribute ActorFile = ActorNode.AppendAttribute("File");
            ActorFile.SetValue(this->GraphicsObject->getMesh()->getName());
        XML::Attribute ActorGroup = ActorNode.AppendAttribute("Group");
            ActorGroup.SetValue(this->GraphicsObject->getMesh()->getGroup());
        if( !(ActorName && ActorFile && ActorGroup) )
            { ThrowSerialError("creating ActorRigid Attributes");}

        XML::Node LinearMovementFactor = ActorNode.AppendChild("LinearMovementFactor");
        if (!LinearMovementFactor) { ThrowSerialError("create LinearMovementFactor Node"); }
        this->GetLinearMovementFactor().ProtoSerialize(LinearMovementFactor);

        XML::Node AngularMovementFactor = ActorNode.AppendChild("AngularMovementFactor");
        if (!AngularMovementFactor) { ThrowSerialError("create AngularMovementFactor Node"); }
        this->GetAngularMovementFactor().ProtoSerialize(AngularMovementFactor);

        ActorBase::ProtoSerialize(ActorNode);
    }
        void CapsuleCollisionShape::ProtoSerialize(XML::Node& CurrentRoot) const
        {
            XML::Node CollisionNode = CurrentRoot.AppendChild(this->CapsuleCollisionShape::SerializableName());
            if (!CollisionNode) { SerializeError("create CollisionNode",this->CapsuleCollisionShape::SerializableName());}

            XML::Attribute Version = CollisionNode.AppendAttribute("Version");
            if (Version)
                { Version.SetValue(1); }
            else
                { SerializeError("Create Version Attribute", SerializableName()); }
/*
            XML::Attribute RadiusAttr = CollisionNode.AppendAttribute("Radius");
            if (RadiusAttr)
                { RadiusAttr.SetValue(this->GetCleanRadius()); }
            else
                { SerializeError("Create RadiusAttr Attribute", SerializableName()); }

            XML::Attribute HeightAttr = CollisionNode.AppendAttribute("Height");
            if (HeightAttr)
                { HeightAttr.SetValue(this->GetCleanHeight()); }
            else
                { SerializeError("Create HeightAttr Attribute", SerializableName()); }
*/
            XML::Attribute AxisAttr = CollisionNode.AppendAttribute("Axis");
            if (AxisAttr)
                { AxisAttr.SetValue(this->GetUpStandardAxis()); }
            else
                { SerializeError("Create AxisAttr Attribute", SerializableName()); }

            this->PrimitiveCollisionShape::ProtoSerialize(CollisionNode);
        }
Example #3
0
    void WorldObject::ProtoSerialize(XML::Node& CurrentRoot) const
    {
        XML::Node WorldObjectNode = CurrentRoot.AppendChild("WorldObject");
        if (!WorldObjectNode) { ThrowSerialError("create WorldObjectNode");}

        XML::Node LocationNode = WorldObjectNode.AppendChild("Location");
        if (!LocationNode) { ThrowSerialError("create LocationNode"); }
        this->GetLocation().ProtoSerialize(LocationNode);

        XML::Node ScalingNode = WorldObjectNode.AppendChild("Scaling");
        if (!ScalingNode) { ThrowSerialError("create ScalingNode"); }
        this->GetScaling().ProtoSerialize(ScalingNode);

        this->GetGraphicsSettings()->ProtoSerialize(WorldObjectNode);
        this->GetPhysicsSettings()->ProtoSerialize(WorldObjectNode);

        XML::Attribute WorldObjectName = WorldObjectNode.AppendAttribute("Name");
            WorldObjectName.SetValue(this->GetName());
        XML::Attribute WorldObjectVersion = WorldObjectNode.AppendAttribute("Version");
            WorldObjectVersion.SetValue(1);
        XML::Attribute WorldObjectIsInWorld = WorldObjectNode.AppendAttribute("IsInWorld");
            WorldObjectIsInWorld.SetValue(this->IsInWorld());
        if ( !(WorldObjectName && WorldObjectVersion && WorldObjectIsInWorld) )
            { ThrowSerialError("create WorldObjectNode Attributes"); }

        /*XML::Attribute WorldObjectSoundSetName = WorldObjectNode.AppendAttribute("SoundSet");
        if(this->GetSounds())
        {
            WorldObjectSoundSetName.SetValue(this->GetSounds()->GetName());
        }else{
            WorldObjectSoundSetName.SetValue("");
        }//*/
    }
Example #4
0
        void SliderConstraint::ProtoSerializeProperties(XML::Node& SelfRoot) const
        {
            this->Constraint::ProtoSerializeProperties(SelfRoot);

            XML::Node PropertiesNode = SelfRoot.AppendChild( SliderConstraint::GetSerializableName() + "Properties" );

            if( PropertiesNode.AppendAttribute("Version").SetValue("1") &&
                PropertiesNode.AppendAttribute("UseFrameOffset").SetValue( this->GetUseFrameOffset() ) &&
                PropertiesNode.AppendAttribute("UpperLinLimit").SetValue( this->GetUpperLinLimit() ) &&
                PropertiesNode.AppendAttribute("UpperAngLimit").SetValue( this->GetUpperAngLimit() ) &&
                PropertiesNode.AppendAttribute("LowerLinLimit").SetValue( this->GetLowerLinLimit() ) &&
                PropertiesNode.AppendAttribute("LowerAngLimit").SetValue( this->GetLowerAngLimit() ) &&
                PropertiesNode.AppendAttribute("PoweredLinMotor").SetValue( this->GetPoweredLinMotor() ) &&
                PropertiesNode.AppendAttribute("PoweredAngMotor").SetValue( this->GetPoweredAngMotor() ) &&
                PropertiesNode.AppendAttribute("TargetLinMotorVelocity").SetValue( this->GetTargetLinMotorVelocity() ) &&
                PropertiesNode.AppendAttribute("TargetAngMotorVelocity").SetValue( this->GetTargetAngMotorVelocity() ) &&
                PropertiesNode.AppendAttribute("MaxLinMotorForce").SetValue( this->GetMaxLinMotorForce() ) &&
                PropertiesNode.AppendAttribute("MaxAngMotorForce").SetValue( this->GetMaxAngMotorForce() ) &&
                PropertiesNode.AppendAttribute("SoftnessLimLin").SetValue( this->GetSoftnessLimLin() ) &&
                PropertiesNode.AppendAttribute("SoftnessLimAng").SetValue( this->GetSoftnessLimAng() ) &&
                PropertiesNode.AppendAttribute("SoftnessOrthoLin").SetValue( this->GetSoftnessOrthoLin() ) &&
                PropertiesNode.AppendAttribute("SoftnessOrthoAng").SetValue( this->GetSoftnessOrthoAng() ) )
            {
                return;
            }else{
                SerializeError("Create XML Attribute Values",SliderConstraint::GetSerializableName() + "Properties",true);
            }
        }
Example #5
0
        void SimpleRenderer::ProtoSerializeProperties(XML::Node& SelfRoot) const
        {
            XML::Node PropertiesNode = SelfRoot.AppendChild( SimpleRenderer::GetSerializableName() + "Properties" );

            if( PropertiesNode.AppendAttribute("Version").SetValue("1") &&
                PropertiesNode.AppendAttribute("PriAtlas").SetValue(this->PriAtlas) )
            {
                return;
            }else{
                SerializeError("Create XML Attribute Values",SimpleRenderer::GetSerializableName() + "Properties",true);
            }
        }
Example #6
0
        void Widget::ProtoSerializeProperties(XML::Node& SelfRoot) const
        {
            this->QuadRenderable::ProtoSerializeProperties(SelfRoot);
            XML::Node PropertiesNode = SelfRoot.AppendChild( Widget::GetSerializableName() + "Properties" );

            if( PropertiesNode.AppendAttribute("Version").SetValue("1") &&
                PropertiesNode.AppendAttribute("State").SetValue( this->State ) )
            {
                return;
            }else{
                SerializeError("Create XML Attribute Values",Widget::GetSerializableName() + "Properties",true);
            }
        }
Example #7
0
    void NonStaticWorldObject::ProtoSerialize(XML::Node& CurrentRoot) const
    {
        XML::Node NonStaticWorldObjectNode = CurrentRoot.AppendChild("NonStaticWorldObject");
        if (!NonStaticWorldObjectNode) { ThrowSerialError("create NonStaticWorldObjectNode");}

        XML::Attribute Version = NonStaticWorldObjectNode.AppendAttribute("Version");
        Version.SetValue(1);

        XML::Node OrientationNode = NonStaticWorldObjectNode.AppendChild("Orientation");
        if(!OrientationNode)  { ThrowSerialError("create OrientationNode"); }

        this->GetOrientation().ProtoSerialize(OrientationNode);

        // if actor node is in scenemanager just save a name
        /*if( Entresol::GetSingletonPtr()->GetSceneManager()->GetNode( this->ObjectWorldNode->GetName() ) )
        {
            XML::Attribute NonStaticWorldObjectNodeAttrib = NonStaticWorldObjectNode.AppendAttribute("WorldNode");
            if(!NonStaticWorldObjectNodeAttrib.SetValue(this->ObjectWorldNode->GetName()))
                {ThrowSerialError("store WorldNode Name");}
        }else{
            SloppyProtoSerialize( *(this->ObjectWorldNode),NonStaticWorldObjectNode);                                   //Serialization performed in older style
        }// */

        WorldObject::ProtoSerialize(NonStaticWorldObjectNode);
    }
Example #8
0
    void GravityWell::ProtoSerializeProperties(XML::Node& SelfRoot) const
    {
        this->AreaEffect::ProtoSerializeProperties(SelfRoot);

        XML::Node PropertiesNode = SelfRoot.AppendChild( GravityWell::GetSerializableName() + "Properties" );

        if( PropertiesNode.AppendAttribute("Version").SetValue("1") &&
            PropertiesNode.AppendAttribute("AttenAmount").SetValue( this->GetAttenuationAmount() ) &&
            PropertiesNode.AppendAttribute("AttenStyle").SetValue( this->GetAttenuationStyle() ) &&
            PropertiesNode.AppendAttribute("Strength").SetValue( this->GetFieldStrength() ) &&
            PropertiesNode.AppendAttribute("AllowWorldGravity").SetValue( this->GetAllowWorldGravity() ? "true" : "false" ) )
        {
            return;
        }else{
            SerializeError("Create XML Attribute Values",GravityWell::GetSerializableName() + "Properties",true);
        }
    }
Example #9
0
        void MultiImageLayer::ProtoSerializeProperties(XML::Node& SelfRoot) const
        {
            this->ImageLayer::ProtoSerializeProperties(SelfRoot);
            XML::Node PropertiesNode = SelfRoot.AppendChild( MultiImageLayer::GetSerializableName() + "Properties" );

            if( PropertiesNode.AppendAttribute("Version").SetValue("1") )
            {
                XML::Node LayerImagesNode = PropertiesNode.AppendChild( "LayerImages" );
                LayerImagesNode.AppendAttribute("NumImages").SetValue( this->LayerImages.size() );

                for( ConstImageDataIterator ImageIt = this->LayerImages.begin() ; ImageIt != this->LayerImages.end() ; ++ImageIt )
                {
                    XML::Node ImageDataRoot = LayerImagesNode.AppendChild( "MultiImageData" );

                    if( ImageDataRoot.AppendAttribute("Version").SetValue("1") &&
                        ImageDataRoot.AppendAttribute("SpriteName").SetValue( (*ImageIt).LayerSprite ? (*ImageIt).LayerSprite->Name : "" ) &&
                        ImageDataRoot.AppendAttribute("SpriteAtlas").SetValue( (*ImageIt).LayerSprite ? (*ImageIt).LayerSprite->GetAtlasName() : "" ) )
                    {
                        XML::Node FillRectNode = ImageDataRoot.AppendChild("FillRect");
                        (*ImageIt).FillRect.ProtoSerialize( FillRectNode );

                        XML::Node FillColoursNode = ImageDataRoot.AppendChild("FillColours");
                        XML::Node TopLeftFillNode = FillColoursNode.AppendChild("TopLeft");
                        (*ImageIt).FillColours[UI::QC_TopLeft].ProtoSerialize(TopLeftFillNode);

                        XML::Node TopRightFillNode = FillColoursNode.AppendChild("TopRight");
                        (*ImageIt).FillColours[UI::QC_TopRight].ProtoSerialize(TopRightFillNode);

                        XML::Node BottomLeftFillNode = FillColoursNode.AppendChild("BottomLeft");
                        (*ImageIt).FillColours[UI::QC_BottomLeft].ProtoSerialize(BottomLeftFillNode);

                        XML::Node BottomRightFillNode = FillColoursNode.AppendChild("BottomRight");
                        (*ImageIt).FillColours[UI::QC_BottomRight].ProtoSerialize(BottomRightFillNode);

                        return;
                    }else{
                        SerializeError("Create XML Attribute Values","MultiImageData",true);
                    }
                }

                return;
            }else{
                SerializeError("Create XML Attribute Values",MultiImageLayer::GetSerializableName() + "Properties",true);
            }
        }
Example #10
0
    void WorldProxy::ProtoSerialize(XML::Node& ParentNode) const
    {
        XML::Node SelfRoot = ParentNode.AppendChild(this->GetDerivedSerializableName());
        if( !SelfRoot.AppendAttribute("InWorld").SetValue( this->IsInWorld() ? "true" : "false" ) ) {
            SerializeError("Create XML Attribute Values",WorldProxy::GetSerializableName(),true);
        }

        this->ProtoSerializeImpl(SelfRoot);
    }
Example #11
0
    void WorldProxy::ProtoSerializeProperties(XML::Node& SelfRoot) const
    {
        XML::Node PropertiesNode = SelfRoot.AppendChild( WorldProxy::GetSerializableName() + "Properties" );

        if( PropertiesNode.AppendAttribute("Version").SetValue("1") &&
            PropertiesNode.AppendAttribute("ProxyID").SetValue(this->ProxyID) )
        {
            XML::Node LocationNode = PropertiesNode.AppendChild("Location");
            this->GetLocation().ProtoSerialize( LocationNode );
            XML::Node OrientationNode = PropertiesNode.AppendChild("Orientation");
            this->GetOrientation().ProtoSerialize( OrientationNode );
            XML::Node ScaleNode = PropertiesNode.AppendChild("Scale");
            this->GetScale().ProtoSerialize( ScaleNode );

            return;
        }else{
            SerializeError("Create XML Attribute Values",WorldProxy::GetSerializableName() + "Properties",true);
        }
    }
Example #12
0
    void AreaEffect::ProtoSerialize(XML::Node& CurrentRoot) const
    {
        XML::Node AreaEffectNode = CurrentRoot.AppendChild("AreaEffect");
        if (!AreaEffectNode) { ThrowSerialError("create AreaEffectNode");}

        XML::Attribute AreaEffectVersion = AreaEffectNode.AppendAttribute("Version");
        AreaEffectVersion.SetValue(1);

        NonStaticWorldObject::ProtoSerialize(AreaEffectNode);
    }
Example #13
0
 void GraphicsManager::AppendCurrentSettings(XML::Node& SettingsRootNode)
 {
     // Create the Group node to be returned
     XML::Node CurrentSettings = SettingsRootNode.AppendChild("Current");
     // Create and initialize the rendersystem settings
     XML::Node RenderSystemNode = CurrentSettings.AppendChild("RenderSystem");
     RenderSystemNode.AppendAttribute("Name").SetValue( this->GetShortenedRenderSystemName(CurrRenderSys) );
     // Create and initialize the window configuration
     for( GameWindowIterator WinIt = this->BeginGameWindow() ; WinIt != this->EndGameWindow() ; ++WinIt )
         { (*WinIt)->ProtoSerialize(CurrentSettings); }
 }
Example #14
0
        void Widget::ProtoSerializeEvents(XML::Node& SelfRoot) const
        {
            XML::Node EventsNode = SelfRoot.AppendChild( "Events" );

            if( EventsNode.AppendAttribute("Version").SetValue("1") ) {
                for( ConstEventIterator EvIt = this->Events.begin() ; EvIt != this->Events.end() ; ++EvIt )
                {
                    XML::Node BindingNode = EventsNode.AppendChild( "Event" );

                    if( BindingNode.AppendAttribute("Version").SetValue("1") &&
                        BindingNode.AppendAttribute("Name").SetValue( (*EvIt).first ) )
                    {
                        continue;
                    }else{
                        SerializeError("Create XML Version Attribute","Event",true);
                    }
                }
            }else{
                SerializeError("Create XML Version Attribute","Events",true);
            }
        }
Example #15
0
        void Widget::ProtoSerializeStateGroupBindings(XML::Node& SelfRoot) const
        {
            XML::Node BindingsNode = SelfRoot.AppendChild( "StateGroupBindings" );

            if( BindingsNode.AppendAttribute("Version").SetValue("1") ) {
                for( ConstStateLayerGroupIterator BindingIt = this->StateGroupBindings.begin() ; BindingIt != this->StateGroupBindings.end() ; ++BindingIt )
                {
                    XML::Node BindingNode = BindingsNode.AppendChild( "StateGroupBinding" );

                    if( BindingNode.AppendAttribute("Version").SetValue("1") &&
                        BindingNode.AppendAttribute("StateID").SetValue( (*BindingIt).first ) &&
                        BindingNode.AppendAttribute("LayerGroupID").SetValue( (*BindingIt).second->GetGroupID() ) )
                    {
                        continue;
                    }else{
                        SerializeError("Create XML Version Attribute","StateGroupBinding",true);
                    }
                }
            }else{
                SerializeError("Create XML Version Attribute","StateGroupBindings",true);
            }
        }
Example #16
0
        void TabSet::ProtoSerializeButtonBindings(XML::Node& SelfRoot) const
        {
            XML::Node BindingsNode = SelfRoot.AppendChild( "SubSetBindings" );

            if( BindingsNode.AppendAttribute("Version").SetValue("1") ) {
                for( ConstTabbedSubSetIterator BindingIt = this->SubSetBindings.begin() ; BindingIt != this->SubSetBindings.end() ; ++BindingIt )
                {
                    XML::Node BindingNode = BindingsNode.AppendChild( "SubSetBinding" );

                    if( BindingNode.AppendAttribute("Version").SetValue("1") &&
                        BindingNode.AppendAttribute("ConfigID").SetValue( (*BindingIt).second ) &&
                        BindingNode.AppendAttribute("ButtonName").SetValue( (*BindingIt).first->GetName() ) )
                    {
                        continue;
                    }else{
                        SerializeError("Create XML Version Attribute","SubSetBinding",true);
                    }
                }
            }else{
                SerializeError("Create XML Version Attribute","SubSetBindings",true);
            }
        }
Example #17
0
        void ParticleAffector::ProtoSerializeCustomParameters(XML::Node& SelfRoot) const
        {
            XML::Node CustomParametersNode = SelfRoot.AppendChild( "CustomParameters" );

            if( CustomParametersNode.AppendAttribute("Version").SetValue("1") )
            {
                for( NameValuePairMap::const_iterator ParamIt = this->CustomAffectorParameters.begin() ; ParamIt != this->CustomAffectorParameters.end() ; ++ParamIt )
                {
                    XML::Node CustomParamNode = CustomParametersNode.AppendChild( "CustomParam" );
                    if( CustomParamNode.AppendAttribute("Version").SetValue("1") &&
                        CustomParamNode.AppendAttribute("ParamName").SetValue( (*ParamIt).first ) &&
                        CustomParamNode.AppendAttribute("ParamValue").SetValue( (*ParamIt).second ) )
                    {
                        return;
                    }else{
                        SerializeError("Create XML Attribute Values",ParticleAffector::GetSerializableName() + "CustomParameters",true);
                    }
                }
            }else{
                SerializeError("Create XML Attribute Values",ParticleAffector::GetSerializableName() + "CustomParameters",true);
            }
        }
Example #18
0
    void Transform::ProtoSerialize(XML::Node& CurrentRoot) const
    {
        XML::Node TransformNode = CurrentRoot.AppendChild(SerializableName());                     // The base node all the base constraint stuff will go in
        if (!TransformNode)
            { SerializeError("Create TransformNode", SerializableName()); }

        Mezzanine::XML::Attribute Version = TransformNode.AppendAttribute("Version");                            // Version
        if (!Version)
            { SerializeError("Create Version", SerializableName()); }
        Version.SetValue(1);

        this->Location.ProtoSerialize(TransformNode);
        this->Rotation.ProtoSerialize(TransformNode);
    }
Example #19
0
        void MeshCollisionShape::ProtoSerialize(XML::Node& CurrentRoot) const
        {
            XML::Node CollisionNode = CurrentRoot.AppendChild(this->MeshCollisionShape::GetSerializableName());
            if (!CollisionNode) { SerializeError("create CollisionNode",this->MeshCollisionShape::GetSerializableName());}

            XML::Attribute Version = CollisionNode.AppendAttribute("Version");
            if (Version)
                { Version.SetValue(1); }
            else
                { SerializeError("Create Version Attribute", GetSerializableName()); }

            this->CollisionShape::ProtoSerialize(CollisionNode);

        }
Example #20
0
        void RadioButton::ProtoSerializeGroupButtons(XML::Node& SelfRoot) const
        {
            XML::Node ButtonsNode = SelfRoot.AppendChild( "GroupButtons" );

            if( ButtonsNode.AppendAttribute("Version").SetValue("1") ) {
                RadioButtonGroup::ConstRadioButtonIterator ButBeg = this->ButtonGroup->RadioButtonBegin();
                RadioButtonGroup::ConstRadioButtonIterator ButEnd = this->ButtonGroup->RadioButtonEnd();
                for( RadioButtonGroup::ConstRadioButtonIterator ButIt = ButBeg ; ButIt != ButEnd ; ++ButIt )
                {
                    XML::Node ButtonNode = ButtonsNode.AppendChild( "GroupButton" );

                    if( ButtonNode.AppendAttribute("Version").SetValue("1") &&
                        ButtonNode.AppendAttribute("GroupButtonName").SetValue( (*ButIt)->GetName() ) )
                    {
                        continue;
                    }else{
                        SerializeError("Create XML Version Attribute","GroupButton",true);
                    }
                }
            }else{
                SerializeError("Create XML Version Attribute","GroupButtons",true);
            }
        }
Example #21
0
void LevelZone::ProtoSerializeProperties(XML::Node& SelfRoot) const
{
    this->AreaEffect::ProtoSerializeProperties(SelfRoot);
    XML::Node PropertiesNode = SelfRoot.AppendChild( LevelZone::GetSerializableName() + "Properties" );

    if( PropertiesNode.AppendAttribute("Version").SetValue("1") )
    {
        XML::Node ZoneSizeNode = PropertiesNode.AppendChild("ZoneSize");
        this->ZoneSize.ProtoSerialize( ZoneSizeNode );

        return;
    }else{
        SerializeError("Create XML Attribute Values",LevelZone::GetSerializableName() + "Properties",true);
    }
}
Example #22
0
        void CollisionShapeManager::SaveShapesToXMLFile(const String& FileName, ShapeVector& ShapesToSave)
        {
            XML::Document ShapesDoc;
            XML::Node DeclNode = ShapesDoc.AppendChild(XML::NodeDeclaration);
            XML::Attribute VerAttrib = DeclNode.AppendAttribute("version");

            if( DeclNode.SetName("xml") && VerAttrib.SetValue("1.0") ) {
                XML::Node ShapesRoot = ShapesDoc.AppendChild( "ShapesRoot" );
                for( ShapeVectorIterator ShapeIt = ShapesToSave.begin() ; ShapeIt != ShapesToSave.end() ; ++ShapeIt )
                {
                    (*ShapeIt)->ProtoSerialize( ShapesRoot );
                }

                /// @todo Replace this stack allocated stream for one initialized from the Resource Manager, after the system is ready.
                Resource::FileStream SettingsStream(FileName,".",Resource::SF_Truncate | Resource::SF_Write);
                ShapesDoc.Save(SettingsStream,"\t",XML::FormatIndent);
            }else{
                MEZZ_EXCEPTION(ExceptionBase::INVALID_STATE_EXCEPTION,"Failed to create XML document declaration for file \"" + FileName + "\".");
            }
        }