Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 12, 2008, 12:57:45 AM (16 years ago)
Author:
rgrieder
Message:

svn save, just in case our house burns down over night…

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/hud/src/orxonox/hud/HUDBar.cc

    r1588 r1590  
    7575        HUDOverlay::XMLPort(xmlElement, mode);
    7676
    77         // create background
    78         this->background_ = static_cast<PanelOverlayElement*>(
    79                 OverlayManager::getSingleton().createOverlayElement("Panel", getName() + "_Background"));
    80         this->background_->setMaterialName("Orxonox/BarBackground");
    81         this->background_->setMetricsMode(GMM_RELATIVE);
    82         this->background_->setDimensions(1.0f, 0.3f);
    83         this->background_->setPosition(0.0f, 0.0f);
    84         this->overlay_->add2D(this->background_);
     77        if (mode == XMLPort::LoadObject)
     78        {
     79            // create background
     80            this->background_ = static_cast<PanelOverlayElement*>(
     81                    OverlayManager::getSingleton().createOverlayElement("Panel", getName() + "_Background"));
     82            this->background_->setMaterialName("Orxonox/BarBackground");
     83            this->background_->setMetricsMode(GMM_RELATIVE);
     84            this->background_->setDimensions(1.0f, 0.3f);
     85            this->background_->setPosition(0.0f, 0.0f);
     86            this->overlay_->add2D(this->background_);
    8587
    86         // create new material
    87         std::string materialname = "barmaterial" + getConvertedValue<unsigned int, std::string>(materialcount_s++);
    88         Ogre::MaterialPtr material = (Ogre::MaterialPtr)Ogre::MaterialManager::getSingleton().create(materialname, "General");
    89         material->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
    90         this->textureUnitState_ = material->getTechnique(0)->getPass(0)->createTextureUnitState();
    91         this->textureUnitState_->setTextureName("bar2.tga");
    92         // use the default colour
    93         this->textureUnitState_->setColourOperationEx(Ogre::LBX_MODULATE, Ogre::LBS_MANUAL, Ogre::LBS_CURRENT, ColourValue(0.2, 0.7, 0.2));
     88            // create new material
     89            std::string materialname = "barmaterial" + getConvertedValue<unsigned int, std::string>(materialcount_s++);
     90            Ogre::MaterialPtr material = (Ogre::MaterialPtr)Ogre::MaterialManager::getSingleton().create(materialname, "General");
     91            material->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
     92            this->textureUnitState_ = material->getTechnique(0)->getPass(0)->createTextureUnitState();
     93            this->textureUnitState_->setTextureName("bar2.tga");
     94            // use the default colour
     95            this->textureUnitState_->setColourOperationEx(Ogre::LBX_MODULATE, Ogre::LBS_MANUAL, Ogre::LBS_CURRENT, ColourValue(0.2, 0.7, 0.2));
    9496
    95         // create bar
    96         this->bar_ = static_cast<PanelOverlayElement*>(OverlayManager::getSingleton().createOverlayElement("Panel", getName() + "Bar"));
    97         this->bar_->setMaterialName(materialname);
    98         this->bar_->setMetricsMode(GMM_RELATIVE);
    99         this->background_->addChild(bar_);
     97            // create bar
     98            this->bar_ = static_cast<PanelOverlayElement*>(OverlayManager::getSingleton().createOverlayElement("Panel", getName() + "Bar"));
     99            this->bar_->setMaterialName(materialname);
     100            this->bar_->setMetricsMode(GMM_RELATIVE);
     101            this->background_->addChild(bar_);
     102        }
    100103
    101104        XMLPortParamLoadOnly(HUDBar, "value", setValue, xmlElement, mode);
    102105
    103         this->addColour(0.7, ColourValue(0.2, 0.7, 0.2));
    104         this->addColour(0.4, ColourValue(0.7, 0.5, 0.2));
    105         this->addColour(0.1, ColourValue(0.7, 0.2, 0.2));
     106        if (mode == XMLPort::LoadObject)
     107        {
     108            this->addColour(0.7, ColourValue(0.2, 0.7, 0.2));
     109            this->addColour(0.4, ColourValue(0.7, 0.5, 0.2));
     110            this->addColour(0.1, ColourValue(0.7, 0.2, 0.2));
     111        }
    106112    }
    107113
Note: See TracChangeset for help on using the changeset viewer.