Changeset 902
- Timestamp:
- Mar 19, 2008, 8:43:36 PM (17 years ago)
- Location:
- code/branches/core2/src/orxonox
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core2/src/orxonox/core/BaseObject.cc
r878 r902 79 79 @return The XML-element 80 80 */ 81 void BaseObject::XMLPort(Element& xmlelement, bool loading)81 void BaseObject::XMLPort(Element& xmlelement, XMLPort::Mode mode) 82 82 { 83 XMLPortParam(BaseObject, "name", setName, getName, xmlelement, loading);83 XMLPortParam(BaseObject, "name", setName, getName, xmlelement, mode); 84 84 } 85 85 -
code/branches/core2/src/orxonox/core/BaseObject.h
r879 r902 50 50 virtual ~BaseObject(); 51 51 virtual void loadParams(TiXmlElement* xmlElem); 52 virtual void XMLPort(Element& xmlelement, bool loading);52 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 53 53 54 54 /** @brief Sets the name of the object. @param name The name */ -
code/branches/core2/src/orxonox/core/CorePrereqs.h
r895 r902 65 65 namespace orxonox 66 66 { 67 #ifndef _XMLPort_Mode__ 68 #define _XMLPort_Mode__ 69 namespace XMLPort 70 { 71 enum Mode 72 { 73 LoadObject, 74 SaveObject 75 }; 76 } 77 #endif 78 67 79 typedef std::string LanguageEntryLabel; 68 80 -
code/branches/core2/src/orxonox/core/Loader.cc
r901 r902 129 129 rootNamespace->setNamespace(rootNamespace); 130 130 rootNamespace->setRoot(true); 131 rootNamespace->XMLPort(rootElement, true);131 rootNamespace->XMLPort(rootElement, XMLPort::LoadObject); 132 132 133 133 COUT(0) << "Finished loading " << level->getFile() << "." << std::endl; -
code/branches/core2/src/orxonox/core/Namespace.cc
r901 r902 58 58 @return The XML-element 59 59 */ 60 void Namespace::XMLPort(Element& xmlelement, bool loading)60 void Namespace::XMLPort(Element& xmlelement, XMLPort::Mode mode) 61 61 { 62 BaseObject::XMLPort(xmlelement, loading);62 BaseObject::XMLPort(xmlelement, mode); 63 63 64 64 std::string name = this->getName(); … … 89 89 } 90 90 91 XMLPortParam(Namespace, "operator", setOperator, getOperator, xmlelement, loading);92 XMLPortParam(Namespace, "bAutogenerated", setAutogenerated, isAutogenerated, xmlelement, loading);91 XMLPortParam(Namespace, "operator", setOperator, getOperator, xmlelement, mode); 92 XMLPortParam(Namespace, "bAutogenerated", setAutogenerated, isAutogenerated, xmlelement, mode); 93 93 94 94 if (this->bAutogeneratedFileRootNamespace_) … … 101 101 } 102 102 103 XMLPortObject(Namespace, BaseObject, "", loadObjects, saveObjects, xmlelement, loading, true, false);103 XMLPortObject(Namespace, BaseObject, "", loadObjects, saveObjects, xmlelement, mode, true, false); 104 104 } 105 105 -
code/branches/core2/src/orxonox/core/Namespace.h
r901 r902 44 44 virtual ~Namespace(); 45 45 46 virtual void XMLPort(Element& xmlelement, bool loading);46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 47 47 48 48 void loadObjects(BaseObject* object); -
code/branches/core2/src/orxonox/core/XMLPort.h
r901 r902 75 75 namespace orxonox 76 76 { 77 78 #ifndef _XMLPort_Mode__ 79 #define _XMLPort_Mode__ 80 namespace XMLPort 81 { 82 enum Mode 83 { 84 LoadObject, 85 SaveObject 86 }; 87 } 88 #endif 89 77 90 // ############################### 78 91 // ### XMLPortParamContainer ### … … 123 136 } 124 137 125 XMLPortParamContainer& port(T* object, Element& xmlelement, bool loading)126 { 127 if ( loading)138 XMLPortParamContainer& port(T* object, Element& xmlelement, XMLPort::Mode mode) 139 { 140 if (mode == XMLPort::LoadObject) 128 141 { 129 142 try … … 227 240 } 228 241 229 XMLPortObjectContainer& port(T* object, Element& xmlelement, bool loading)230 { 231 if ( loading)242 XMLPortObjectContainer& port(T* object, Element& xmlelement, XMLPort::Mode mode) 243 { 244 if (mode == XMLPort::LoadObject) 232 245 { 233 246 try … … 257 270 if (this->bLoadBefore_) 258 271 { 259 newObject->XMLPort(*child, true);272 newObject->XMLPort(*child, XMLPort::LoadObject); 260 273 COUT(4) << object->getLoaderIndentation() << "assigning " << child->Value() << " (objectname " << newObject->getName() << ") to " << this->classname_ << " (objectname " << object->getName() << ")" << std::endl; 261 274 } … … 266 279 (*object.*this->loadfunction_)(newObject); 267 280 if (!this->bLoadBefore_) 268 newObject->XMLPort(*child, true);281 newObject->XMLPort(*child, XMLPort::LoadObject); 269 282 COUT(5) << object->getLoaderIndentation() << "...fabricated " << child->Value() << " (objectname " << newObject->getName() << ")." << std::endl; 270 283 } -
code/branches/core2/src/orxonox/objects/Ambient.cc
r871 r902 85 85 @return The XML-element 86 86 */ 87 void Ambient::XMLPort(Element& xmlelement, bool loading)87 void Ambient::XMLPort(Element& xmlelement, XMLPort::Mode mode) 88 88 { 89 BaseObject::XMLPort(xmlelement, loading);89 BaseObject::XMLPort(xmlelement, mode); 90 90 91 XMLPortParamLoadOnly(Ambient, "colourvalue", setAmbientLight, xmlelement, loading);91 XMLPortParamLoadOnly(Ambient, "colourvalue", setAmbientLight, xmlelement, mode); 92 92 } 93 93 } -
code/branches/core2/src/orxonox/objects/Ambient.h
r871 r902 15 15 16 16 void loadParams(TiXmlElement* xmlElem); 17 virtual void XMLPort(Element& xmlelement, bool loading);17 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 18 18 void setAmbientLight(const ColourValue& colour); 19 19 -
code/branches/core2/src/orxonox/objects/Model.cc
r871 r902 67 67 @return The XML-element 68 68 */ 69 void Model::XMLPort(Element& xmlelement, bool loading)69 void Model::XMLPort(Element& xmlelement, XMLPort::Mode mode) 70 70 { 71 WorldEntity::XMLPort(xmlelement, loading);71 WorldEntity::XMLPort(xmlelement, mode); 72 72 73 XMLPortParamLoadOnly(Model, "mesh", setMesh, xmlelement, loading);73 XMLPortParamLoadOnly(Model, "mesh", setMesh, xmlelement, mode); 74 74 75 75 create(); -
code/branches/core2/src/orxonox/objects/Model.h
r871 r902 18 18 virtual ~Model(); 19 19 virtual void loadParams(TiXmlElement* xmlElem); 20 virtual void XMLPort(Element& xmlelement, bool loading);20 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 21 21 void setMesh(const std::string& meshname); 22 22 bool create(); -
code/branches/core2/src/orxonox/objects/Skybox.cc
r871 r902 77 77 @return The XML-element 78 78 */ 79 void Skybox::XMLPort(Element& xmlelement, bool loading)79 void Skybox::XMLPort(Element& xmlelement, XMLPort::Mode mode) 80 80 { 81 BaseObject::XMLPort(xmlelement, loading);81 BaseObject::XMLPort(xmlelement, mode); 82 82 83 XMLPortParamLoadOnly(Skybox, "src", setSkybox, xmlelement, loading);83 XMLPortParamLoadOnly(Skybox, "src", setSkybox, xmlelement, mode); 84 84 } 85 85 } -
code/branches/core2/src/orxonox/objects/Skybox.h
r871 r902 17 17 18 18 void loadParams(TiXmlElement* xmlElem); 19 virtual void XMLPort(Element& xmlelement, bool loading);19 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 20 20 void setSkybox(const std::string& skyboxname); 21 21 -
code/branches/core2/src/orxonox/objects/SpaceShip.cc
r871 r902 291 291 @return The XML-element 292 292 */ 293 void SpaceShip::XMLPort(Element& xmlelement, bool loading)294 { 295 Model::XMLPort(xmlelement, loading);296 297 XMLPortParamLoadOnly(SpaceShip, "camera", setCamera, xmlelement, loading);298 XMLPortParamLoadOnly(SpaceShip, "maxSpeed", setMaxSpeed, xmlelement, loading);299 XMLPortParamLoadOnly(SpaceShip, "maxSideAndBackSpeed", setMaxSideAndBackSpeed, xmlelement, loading);300 XMLPortParamLoadOnly(SpaceShip, "maxRotation", setMaxRotation, xmlelement, loading);301 XMLPortParamLoadOnly(SpaceShip, "transAcc", setTransAcc, xmlelement, loading);302 XMLPortParamLoadOnly(SpaceShip, "rotAcc", setRotAcc, xmlelement, loading);303 XMLPortParamLoadOnly(SpaceShip, "transDamp", setTransDamp, xmlelement, loading);304 XMLPortParamLoadOnly(SpaceShip, "rotDamp", setRotDamp, xmlelement, loading);293 void SpaceShip::XMLPort(Element& xmlelement, XMLPort::Mode mode) 294 { 295 Model::XMLPort(xmlelement, mode); 296 297 XMLPortParamLoadOnly(SpaceShip, "camera", setCamera, xmlelement, mode); 298 XMLPortParamLoadOnly(SpaceShip, "maxSpeed", setMaxSpeed, xmlelement, mode); 299 XMLPortParamLoadOnly(SpaceShip, "maxSideAndBackSpeed", setMaxSideAndBackSpeed, xmlelement, mode); 300 XMLPortParamLoadOnly(SpaceShip, "maxRotation", setMaxRotation, xmlelement, mode); 301 XMLPortParamLoadOnly(SpaceShip, "transAcc", setTransAcc, xmlelement, mode); 302 XMLPortParamLoadOnly(SpaceShip, "rotAcc", setRotAcc, xmlelement, mode); 303 XMLPortParamLoadOnly(SpaceShip, "transDamp", setTransDamp, xmlelement, mode); 304 XMLPortParamLoadOnly(SpaceShip, "rotDamp", setRotDamp, xmlelement, mode); 305 305 } 306 306 -
code/branches/core2/src/orxonox/objects/SpaceShip.h
r871 r902 24 24 void setConfigValues(); 25 25 virtual void loadParams(TiXmlElement* xmlElem); 26 virtual void XMLPort(Element& xmlelement, bool loading);26 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 27 27 virtual void tick(float dt); 28 28 -
code/branches/core2/src/orxonox/objects/WorldEntity.cc
r879 r902 171 171 @return The XML-element 172 172 */ 173 void WorldEntity::XMLPort(Element& xmlelement, bool loading)174 { 175 BaseObject::XMLPort(xmlelement, loading);176 177 XMLPortParam(WorldEntity, "position", setPositionLoader2, getPosition, xmlelement, loading);178 XMLPortParamLoadOnly(WorldEntity, "direction", setDirectionLoader, xmlelement, loading);179 XMLPortParamLoadOnly(WorldEntity, "yawpitchroll", setYawPitchRoll, xmlelement, loading);180 XMLPortParam(WorldEntity, "scale", setTotalScale, getScale, xmlelement, loading);181 XMLPortParam(WorldEntity, "rotationAxis", setRotationAxisLoader, getRotationAxis, xmlelement, loading);182 XMLPortParam(WorldEntity, "rotationRate", setRotationRate, getRotationRate, xmlelement, loading);183 184 XMLPortObject(WorldEntity, WorldEntity, "attached", attachWorldEntity, getAttachedWorldEntity, xmlelement, loading, false, true);173 void WorldEntity::XMLPort(Element& xmlelement, XMLPort::Mode mode) 174 { 175 BaseObject::XMLPort(xmlelement, mode); 176 177 XMLPortParam(WorldEntity, "position", setPositionLoader2, getPosition, xmlelement, mode); 178 XMLPortParamLoadOnly(WorldEntity, "direction", setDirectionLoader, xmlelement, mode); 179 XMLPortParamLoadOnly(WorldEntity, "yawpitchroll", setYawPitchRoll, xmlelement, mode); 180 XMLPortParam(WorldEntity, "scale", setTotalScale, getScale, xmlelement, mode); 181 XMLPortParam(WorldEntity, "rotationAxis", setRotationAxisLoader, getRotationAxis, xmlelement, mode); 182 XMLPortParam(WorldEntity, "rotationRate", setRotationRate, getRotationRate, xmlelement, mode); 183 184 XMLPortObject(WorldEntity, WorldEntity, "attached", attachWorldEntity, getAttachedWorldEntity, xmlelement, mode, false, true); 185 185 } 186 186 -
code/branches/core2/src/orxonox/objects/WorldEntity.h
r877 r902 25 25 virtual void tick(float dt); 26 26 virtual void loadParams(TiXmlElement* xmlElem); 27 virtual void XMLPort(Element& xmlelement, bool loading);27 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 28 28 bool create(); 29 29
Note: See TracChangeset
for help on using the changeset viewer.