Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 5, 2008, 6:38:09 PM (17 years ago)
Author:
landauf
Message:

sync with notebook, there are some changes in the MultiTypes, XMLPort and the WorldEntity, but there's still a bug in some of the Converter-specializations

Location:
code/branches/core/src/orxonox
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core/src/orxonox/core/BaseObject.cc

    r852 r853  
    7979    Element& BaseObject::XMLPort(Element& xmlelement, bool loading)
    8080    {
     81        std::cout << "1_1: " << this->getName() << std::endl;
    8182        XMLPortParam(BaseObject, "name", setName, getName, xmlelement, loading);
    82 
     83std::cout << "1_2: " << this->getName() << std::endl;
    8384        return xmlelement;
    8485    }
  • code/branches/core/src/orxonox/core/XMLPort.h

    r850 r853  
    4848    xmlcontainer##loadfunction##savefunction->port(this, xmlelement, loading)
    4949
     50#define XMLPortParamLoadOnly(classname, paramname, loadfunction, xmlelement, loading) \
     51    orxonox::XMLPortClassParamContainer<classname>* xmlcontainer##loadfunction##savefunction = (orxonox::XMLPortClassParamContainer<classname>*)(this->getIdentifier()->getXMLPortParamContainer(paramname)); \
     52    if (!xmlcontainer##loadfunction##savefunction) \
     53    { \
     54        xmlcontainer##loadfunction##savefunction = new orxonox::XMLPortClassParamContainer<classname>(this->getIdentifier()->getName(), std::string(paramname), createFunctor(&classname::loadfunction), 0); \
     55        this->getIdentifier()->addXMLPortParamContainer(paramname, xmlcontainer##loadfunction##savefunction); \
     56    } \
     57    xmlcontainer##loadfunction##savefunction->port(this, xmlelement, loading)
    5058
    5159namespace orxonox
     
    100108                if (loading)
    101109                {
     110std::cout << "3_1: load param " << this->paramname_ << std::endl;
    102111                    std::string attribute = xmlelement.GetAttribute(this->paramname_);
     112std::cout << "3_2: attribute " << attribute << std::endl;
    103113                    if (attribute.size() > 0)
    104114                    {
    105115                        SubString tokens(attribute, ",", SubString::WhiteSpaces, false, '\\', '"', '(', ')', '\0');
     116std::cout << "3_3: tokens: " << tokens.size() << " params: " << this->loadfunction_->getParamCount() << std::endl;
    106117                        if ((unsigned int)tokens.size() >= (unsigned int)this->loadfunction_->getParamCount())
    107118                        {
    108                             MultiTypeMath param1, param2, param3, param4, param5;
    109                             if (tokens.size() >= 1) param1 = tokens[0];
    110                             if (tokens.size() >= 2) param1 = tokens[1];
    111                             if (tokens.size() >= 3) param1 = tokens[2];
    112                             if (tokens.size() >= 4) param1 = tokens[3];
    113                             if (tokens.size() >= 5) param1 = tokens[4];
     119                            if (this->loadfunction_->getParamCount() == 1)
     120                            {
     121std::cout << "3_4 start: load with whole attribute as input" << std::endl;
     122                                (*this->loadfunction_)(object, MultiTypeMath(attribute));
     123std::cout << "3_5 end" << std::endl;
     124                            }
     125                            else
     126                            {
     127std::cout << "3_4: load with tokens as input" << std::endl;
     128                                MultiTypeMath param1, param2, param3, param4, param5;
     129                                if (tokens.size() >= 1) param1 = tokens[0];
     130                                if (tokens.size() >= 2) param1 = tokens[1];
     131                                if (tokens.size() >= 3) param1 = tokens[2];
     132                                if (tokens.size() >= 4) param1 = tokens[3];
     133                                if (tokens.size() >= 5) param1 = tokens[4];
    114134
    115                             (*this->loadfunction_)(object, param1, param2, param3, param4, param5);
     135                                (*this->loadfunction_)(object, param1, param2, param3, param4, param5);
     136                            }
    116137                        }
    117138                        else
     
    123144                else
    124145                {
    125 //                    xmlelement.SetAttribute(this->paramname_, "...");
     146                    if (this->savefunction_)
     147                    {
     148//                        xmlelement.SetAttribute(this->paramname_, "...");
     149                    }
    126150                }
    127151
  • code/branches/core/src/orxonox/objects/WorldEntity.cc

    r850 r853  
    172172        XMLPortParam(WorldEntity, "position", setPosition, getPosition, xmlelement, loading);
    173173//        XMLPortParam(WorldEntity, "direction", setDirection, getDirection, xmlelement, loading);
    174 //        XMLPortParam(WorldEntity, "yaw", yaw, getYaw, xmlelement, loading);
    175 //        XMLPortParam(WorldEntity, "pitch", pitch, getPitch, xmlelement, loading);
    176 //        XMLPortParam(WorldEntity, "roll", roll, getRoll, xmlelement, loading);
    177         XMLPortParam(WorldEntity, "scale", setScale, getScale, xmlelement, loading);
     174        XMLPortParamLoadOnly(WorldEntity, "yaw", setYaw, xmlelement, loading);
     175        XMLPortParamLoadOnly(WorldEntity, "pitch", setPitch, xmlelement, loading);
     176        XMLPortParamLoadOnly(WorldEntity, "roll", setRoll, xmlelement, loading);
     177        XMLPortParam(WorldEntity, "scale", setTotalScale, getScale, xmlelement, loading);
    178178        XMLPortParam(WorldEntity, "rotationAxis", setRotationAxis, getRotationAxis, xmlelement, loading);
    179179        XMLPortParam(WorldEntity, "rotationRate", setRotationRate, getRotationRate, xmlelement, loading);
  • code/branches/core/src/orxonox/objects/WorldEntity.h

    r852 r853  
    5757                { this->node_->roll(angle, relativeTo); }
    5858
     59            inline void setYaw(const Degree &angle)
     60                { this->node_->yaw(angle, Ogre::Node::TS_LOCAL); }
     61            inline void setPitch(const Degree &angle)
     62                { this->node_->pitch(angle, Ogre::Node::TS_LOCAL); }
     63            inline void setRoll(const Degree &angle)
     64                { this->node_->roll(angle, Ogre::Node::TS_LOCAL); }
     65
    5966            inline const Ogre::Quaternion& getOrientation()
    6067              { return this->node_->getOrientation(); }
     
    7582              { this->node_->setScale(x, y, z); }
    7683            inline void setScale(Real scale)
     84              { this->node_->setScale(scale, scale, scale); }
     85            inline void setTotalScale(Real scale)
    7786              { this->node_->setScale(scale, scale, scale); }
    7887            inline const Vector3& getScale(void) const
Note: See TracChangeset for help on using the changeset viewer.