Changeset 853 for code/branches/core/src/orxonox
- Timestamp:
- Mar 5, 2008, 6:38:09 PM (17 years ago)
- Location:
- code/branches/core/src/orxonox
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core/src/orxonox/core/BaseObject.cc
r852 r853 79 79 Element& BaseObject::XMLPort(Element& xmlelement, bool loading) 80 80 { 81 std::cout << "1_1: " << this->getName() << std::endl; 81 82 XMLPortParam(BaseObject, "name", setName, getName, xmlelement, loading); 82 83 std::cout << "1_2: " << this->getName() << std::endl; 83 84 return xmlelement; 84 85 } -
code/branches/core/src/orxonox/core/XMLPort.h
r850 r853 48 48 xmlcontainer##loadfunction##savefunction->port(this, xmlelement, loading) 49 49 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) 50 58 51 59 namespace orxonox … … 100 108 if (loading) 101 109 { 110 std::cout << "3_1: load param " << this->paramname_ << std::endl; 102 111 std::string attribute = xmlelement.GetAttribute(this->paramname_); 112 std::cout << "3_2: attribute " << attribute << std::endl; 103 113 if (attribute.size() > 0) 104 114 { 105 115 SubString tokens(attribute, ",", SubString::WhiteSpaces, false, '\\', '"', '(', ')', '\0'); 116 std::cout << "3_3: tokens: " << tokens.size() << " params: " << this->loadfunction_->getParamCount() << std::endl; 106 117 if ((unsigned int)tokens.size() >= (unsigned int)this->loadfunction_->getParamCount()) 107 118 { 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 { 121 std::cout << "3_4 start: load with whole attribute as input" << std::endl; 122 (*this->loadfunction_)(object, MultiTypeMath(attribute)); 123 std::cout << "3_5 end" << std::endl; 124 } 125 else 126 { 127 std::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]; 114 134 115 (*this->loadfunction_)(object, param1, param2, param3, param4, param5); 135 (*this->loadfunction_)(object, param1, param2, param3, param4, param5); 136 } 116 137 } 117 138 else … … 123 144 else 124 145 { 125 // xmlelement.SetAttribute(this->paramname_, "..."); 146 if (this->savefunction_) 147 { 148 // xmlelement.SetAttribute(this->paramname_, "..."); 149 } 126 150 } 127 151 -
code/branches/core/src/orxonox/objects/WorldEntity.cc
r850 r853 172 172 XMLPortParam(WorldEntity, "position", setPosition, getPosition, xmlelement, loading); 173 173 // 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", set Scale, 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); 178 178 XMLPortParam(WorldEntity, "rotationAxis", setRotationAxis, getRotationAxis, xmlelement, loading); 179 179 XMLPortParam(WorldEntity, "rotationRate", setRotationRate, getRotationRate, xmlelement, loading); -
code/branches/core/src/orxonox/objects/WorldEntity.h
r852 r853 57 57 { this->node_->roll(angle, relativeTo); } 58 58 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 59 66 inline const Ogre::Quaternion& getOrientation() 60 67 { return this->node_->getOrientation(); } … … 75 82 { this->node_->setScale(x, y, z); } 76 83 inline void setScale(Real scale) 84 { this->node_->setScale(scale, scale, scale); } 85 inline void setTotalScale(Real scale) 77 86 { this->node_->setScale(scale, scale, scale); } 78 87 inline const Vector3& getScale(void) const
Note: See TracChangeset
for help on using the changeset viewer.