Example #1
0
    void WorldProxy::ProtoDeSerializeProperties(const XML::Node& SelfRoot)
    {
        XML::Attribute CurrAttrib;
        XML::Node PropertiesNode = SelfRoot.GetChild( WorldProxy::GetSerializableName() + "Properties" );

        if( !PropertiesNode.Empty() ) {
            if(PropertiesNode.GetAttribute("Version").AsInt() == 1) {
                CurrAttrib = PropertiesNode.GetAttribute("ProxyID");
                if( !CurrAttrib.Empty() )
                    this->ProxyID = static_cast<UInt32>( CurrAttrib.AsUint() );

                XML::Node PositionNode = PropertiesNode.GetChild("Location").GetFirstChild();
                if( !PositionNode.Empty() ) {
                    Vector3 Loc(PositionNode);
                    this->SetLocation(Loc);
                }

                XML::Node OrientationNode = PropertiesNode.GetChild("Orientation").GetFirstChild();
                if( !PositionNode.Empty() ) {
                    Quaternion Rot(OrientationNode);
                    this->SetOrientation(Rot);
                }

                XML::Node ScaleNode = PropertiesNode.GetChild("Scale").GetFirstChild();
                if( !PositionNode.Empty() ) {
                    Vector3 Scale(ScaleNode);
                    this->SetScale(Scale);
                }
            }else{
                MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + (WorldProxy::GetSerializableName() + "Properties" ) + ": Not Version 1.");
            }
        }else{
            MEZZ_EXCEPTION(ExceptionBase::II_IDENTITY_NOT_FOUND_EXCEPTION,WorldProxy::GetSerializableName() + "Properties" + " was not found in the provided XML node, which was expected.");
        }
    }
Example #2
0
        void Widget::ProtoDeSerializeStateGroupBindings(const XML::Node& SelfRoot)
        {
            this->StateGroupBindings.clear();

            XML::Attribute CurrAttrib;
            XML::Node BindingsNode = SelfRoot.GetChild( "StateGroupBindings" );

            if( !BindingsNode.Empty() ) {
                if( BindingsNode.GetAttribute("Version").AsInt() == 1 ) {
                    for( XML::NodeIterator BindingNodeIt = BindingsNode.begin() ; BindingNodeIt != BindingsNode.end() ; ++BindingNodeIt )
                    {
                        if( (*BindingNodeIt).GetAttribute("Version").AsInt() == 1 ) {
                            UInt32 StateID = 0;

                            CurrAttrib = (*BindingNodeIt).GetAttribute("StateID");
                            if( !CurrAttrib.Empty() )
                                StateID = CurrAttrib.AsUint();

                            CurrAttrib = (*BindingNodeIt).GetAttribute("LayerGroupID");
                            if( !CurrAttrib.Empty() ) {
                                UInt16 LayerGroupID = CurrAttrib.AsUint();
                                RenderLayerGroup* NamedGroup = this->GetRenderLayerGroup( LayerGroupID );
                                if( NamedGroup != NULL ) {
                                    this->StateGroupBindings.insert( std::pair<UInt32,RenderLayerGroup*>(StateID,NamedGroup) );
                                }else{
                                    StringStream ExceptionStream;
                                    ExceptionStream << "Named RenderLayerGroup \"" << LayerGroupID << "\" not found when deserializing Widget named \"" << this->GetName() << "\".";
                                    MEZZ_EXCEPTION(ExceptionBase::PARAMETERS_EXCEPTION,ExceptionStream.str());
                                }
                            }
                        }else{
                            MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + String("StateGroupBindings") + ": Not Version 1.");
                        }
                    }
                }else{
                    MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + String("StateGroupBindings") + ": Not Version 1.");
                }
            }
        }
Example #3
0
        void Widget::ProtoDeSerializeProperties(const XML::Node& SelfRoot)
        {
            this->QuadRenderable::ProtoDeSerializeProperties(SelfRoot);

            XML::Attribute CurrAttrib;
            XML::Node PropertiesNode = SelfRoot.GetChild( Widget::GetSerializableName() + "Properties" );

            if( !PropertiesNode.Empty() ) {
                if(PropertiesNode.GetAttribute("Version").AsInt() == 1) {
                    CurrAttrib = PropertiesNode.GetAttribute("State");
                    if( !CurrAttrib.Empty() )
                        this->State = CurrAttrib.AsUint();
                }else{
                    MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + (Widget::GetSerializableName() + "Properties") + ": Not Version 1.");
                }
            }else{
                MEZZ_EXCEPTION(ExceptionBase::II_IDENTITY_NOT_FOUND_EXCEPTION,Widget::GetSerializableName() + "Properties" + " was not found in the provided XML node, which was expected.");
            }
        }
Example #4
0
        void TabSet::ProtoDeSerializeButtonBindings(const XML::Node& SelfRoot)
        {
            this->SubSetBindings.clear();

            XML::Attribute CurrAttrib;
            XML::Node BindingsNode = SelfRoot.GetChild( "SubSetBindings" );

            if( !BindingsNode.Empty() ) {
                if( BindingsNode.GetAttribute("Version").AsInt() == 1 ) {
                    for( XML::NodeIterator BindingNodeIt = BindingsNode.begin() ; BindingNodeIt != BindingsNode.end() ; ++BindingNodeIt )
                    {
                        if( (*BindingNodeIt).GetAttribute("Version").AsInt() == 1 ) {
                            UInt16 ConfigID = 0;
                            String ButtonName;

                            CurrAttrib = (*BindingNodeIt).GetAttribute("ConfigID");
                            if( !CurrAttrib.Empty() )
                                ConfigID = static_cast<UInt16>( CurrAttrib.AsUint() );

                            CurrAttrib = (*BindingNodeIt).GetAttribute("ButtonName");
                            if( !CurrAttrib.Empty() )
                                ButtonName = CurrAttrib.AsString();

                            if( !ButtonName.empty() ) {
                                Widget* NamedButton = this->ParentScreen->GetWidget(ButtonName);
                                if( NamedButton != NULL && NamedButton->GetTypeName() == StackButton::TypeName ) {
                                    this->SetButtonConfig(ConfigID,static_cast<StackButton*>(NamedButton));
                                }else{
                                    StringStream ExceptionStream;
                                    ExceptionStream << "Named StackButton \"" << ButtonName << "\" not found when deserializing Widget named \"" << this->GetName() << "\".";
                                    MEZZ_EXCEPTION(ExceptionBase::PARAMETERS_EXCEPTION,ExceptionStream.str());
                                }
                            }
                        }else{
                            MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + String("SubSetBindings") + ": Not Version 1.");
                        }
                    }
                }else{
                    MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + String("SubSetBindings") + ": Not Version 1.");
                }
            }
        }