Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 878 for code


Ignore:
Timestamp:
Mar 10, 2008, 4:34:20 PM (17 years ago)
Author:
landauf
Message:

added boolean bApplyLoaderMask to the XMLPortObject macro to determine whether the ClassTreeMask from the Loader should be applied or not (the idea is: objects included in excluded objects are excluded too, no matter what the mask sais. but objects included in a namespace or directly in a level-file are filtered by the mask.)

Location:
code/branches/core2/src/orxonox
Files:
7 edited

Legend:

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

    r871 r878  
    5252        this->bVisible_ = true;
    5353        this->level_ = 0;
     54        this->namespace_ = 0;
    5455    }
    5556
  • code/branches/core2/src/orxonox/core/Loader.cc

    r877 r878  
    3333#include "Debug.h"
    3434#include "CoreIncludes.h"
     35#include "Namespace.h"
    3536
    3637#include "util/tinyxml/ticpp.h"
     
    120121                if (identifier)
    121122                {
    122                     if (Loader::currentMask_s.isIncluded(identifier))
     123                    if (identifier->isA(Class(Namespace)) || Loader::currentMask_s.isIncluded(identifier))
    123124                    {
    124125                        COUT(4) << "  fabricating " << child->Value() << "..." << std::endl;
  • code/branches/core2/src/orxonox/core/Namespace.cc

    r877 r878  
    3737    {
    3838        RegisterObject(Namespace);
     39
     40        this->representingNamespace_ = 0;
    3941    }
    4042
     
    5355        BaseObject::XMLPort(xmlelement, loading);
    5456
    55         XMLPortObject(Namespace, BaseObject, "", loadObjects, saveObjects, xmlelement, loading);
     57        XMLPortObject(Namespace, BaseObject, "", loadObjects, saveObjects, xmlelement, loading, true);
    5658    }
    5759
  • code/branches/core2/src/orxonox/core/Namespace.h

    r877 r878  
    5151        private:
    5252            std::list<Namespace*> namespaces_;
     53            Namespace* representingNamespace_;
    5354    };
    5455}
  • code/branches/core2/src/orxonox/core/XMLPort.cc

    r871 r878  
    2929#include "Language.h"
    3030#include "Loader.h"
     31#include "Namespace.h"
     32#include "CoreIncludes.h"
    3133
    3234namespace orxonox
     
    6567    {
    6668        this->bAddedDescription_ = false;
     69        this->bApplyLoaderMask_ = false;
    6770    }
    6871
     
    8689    bool XMLPortObjectContainer::identifierIsIncludedInLoaderMask(const Identifier* identifier)
    8790    {
    88         return Loader::currentMask_s.isIncluded(identifier);
     91        return ((!this->bApplyLoaderMask_) || identifier->isA(Class(Namespace)) || Loader::currentMask_s.isIncluded(identifier));
    8992    }
    9093}
  • code/branches/core2/src/orxonox/core/XMLPort.h

    r877 r878  
    5959    xmlcontainer##loadfunction##savefunction->port(this, xmlelement, loading)
    6060
    61 #define XMLPortObject(classname, objectclass, sectionname, loadfunction, savefunction, xmlelement, loading) \
     61#define XMLPortObject(classname, objectclass, sectionname, loadfunction, savefunction, xmlelement, loading, bApplyLoaderMask) \
    6262    orxonox::XMLPortClassObjectContainer<classname, objectclass>* xmlcontainer##loadfunction##savefunction = (orxonox::XMLPortClassObjectContainer<classname, objectclass>*)(this->getIdentifier()->getXMLPortObjectContainer(sectionname)); \
    6363    if (!xmlcontainer##loadfunction##savefunction) \
    6464    { \
    65         xmlcontainer##loadfunction##savefunction = new orxonox::XMLPortClassObjectContainer<classname, objectclass>(this->getIdentifier()->getName(), std::string(sectionname), &classname::loadfunction, &classname::savefunction); \
     65        xmlcontainer##loadfunction##savefunction = new orxonox::XMLPortClassObjectContainer<classname, objectclass>(this->getIdentifier()->getName(), std::string(sectionname), &classname::loadfunction, &classname::savefunction, bApplyLoaderMask); \
    6666        this->getIdentifier()->addXMLPortObjectContainer(sectionname, xmlcontainer##loadfunction##savefunction); \
    6767    } \
     
    196196            XMLPortObjectContainer& description(const std::string description);
    197197            const std::string& getDescription();
    198             static bool identifierIsIncludedInLoaderMask(const Identifier* identifier);
     198            bool identifierIsIncludedInLoaderMask(const Identifier* identifier);
    199199
    200200        protected:
    201201            std::string classname_;
    202202            std::string sectionname_;
     203            bool bApplyLoaderMask_;
    203204
    204205        private:
     
    211212    {
    212213        public:
    213             XMLPortClassObjectContainer(const std::string classname, const std::string sectionname, void (T::*loadfunction)(O*), const O* (T::*savefunction)(unsigned int) const)
     214            XMLPortClassObjectContainer(const std::string classname, const std::string sectionname, void (T::*loadfunction)(O*), const O* (T::*savefunction)(unsigned int) const, bool bApplyLoaderMask)
    214215            {
    215216                this->classname_ = classname;
     
    217218                this->loadfunction_ = loadfunction;
    218219                this->savefunction_ = savefunction;
     220                this->bApplyLoaderMask_ = bApplyLoaderMask;
    219221            }
    220222
  • code/branches/core2/src/orxonox/objects/WorldEntity.cc

    r877 r878  
    182182        XMLPortParam(WorldEntity, "rotationRate", setRotationRate, getRotationRate, xmlelement, loading);
    183183
    184         XMLPortObject(WorldEntity, WorldEntity, "attached", attachWorldEntity, getAttachedWorldEntity, xmlelement, loading);
     184        XMLPortObject(WorldEntity, WorldEntity, "attached", attachWorldEntity, getAttachedWorldEntity, xmlelement, loading, false);
    185185    }
    186186
Note: See TracChangeset for help on using the changeset viewer.