Changeset 4765 in orxonox.OLD for orxonox/trunk/src/lib
- Timestamp:
- Jul 2, 2005, 2:23:41 AM (19 years ago)
- Location:
- orxonox/trunk/src/lib/coord
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/coord/p_node.cc
r4761 r4765 128 128 LoadParam<PNode>(root, "parent", this, &PNode::setParent) 129 129 .describe("the Name of the Parent of this PNode"); 130 131 LoadParam<PNode>(root, "parent-mode", this, &PNode::setParentMode) 132 .describe("the mode to connect this node to its parent ()"); 133 134 // cycling properties 135 const TiXmlElement* element = root->FirstChildElement(); 136 while (element != NULL) 137 { 138 LoadParam<PNode>(root, "parent", this, &PNode::addChild, true) 139 .describe("adds a new Child to the current Node."); 140 141 element = element->NextSiblingElement(); 142 } 130 143 } 131 144 … … 289 302 290 303 /** 304 * @see PNode::addChild(PNode* parent); 305 * @param childName the name of the child to add to this PNode 306 */ 307 void PNode::addChild (const char* childName) 308 { 309 PNode* childNode = dynamic_cast<PNode*>(ClassList::getObject(childName, CL_PARENT_NODE)); 310 if (childNode != NULL) 311 this->addChild(childNode); 312 } 313 314 315 /** 291 316 \brief removes a child from the node 292 317 \param pNode the child to remove from this pNode. … … 340 365 { 341 366 PNode* parentNode = dynamic_cast<PNode*>(ClassList::getObject(parentName, CL_PARENT_NODE)); 342 343 344 printf("%p\n", parentNode);345 printf("%s\n", parentNode->getName());346 347 367 if (parentNode != NULL) 348 368 parentNode->addChild(this); … … 353 373 \param parentMode the mode of the bind-type. 354 374 */ 355 void PNode::setParentMode ( unsigned intparentMode)375 void PNode::setParentMode (PARENT_MODE parentMode) 356 376 { 357 377 this->parentMode = parentMode; 378 } 379 380 /** 381 * @brief sets the mode of this parent manually 382 * @param parentMode a String representing this parentingMode 383 */ 384 void PNode::setParentMode (const char* parentingMode) 385 { 386 if (!strcmp(parentingMode, "local-rotate")) 387 this->setParentMode(PNODE_LOCAL_ROTATE); 388 else if (!strcmp(parentingMode, "rotate-movement")) 389 this->setParentMode(PNODE_ROTATE_MOVEMENT); 390 else if (!strcmp(parentingMode, "movement")) 391 this->setParentMode(PNODE_MOVEMENT); 392 else if (!strcmp(parentingMode, "all")) 393 this->setParentMode(PNODE_ALL); 394 else if (!strcmp(parentingMode, "rotate-and-move")) 395 this->setParentMode(PNODE_ROTATE_AND_MOVE); 358 396 } 359 397 -
orxonox/trunk/src/lib/coord/p_node.h
r4761 r4765 32 32 template<class T> class tList; 33 33 34 // linkage modes 35 #define PNODE_LOCAL_ROTATE 1 //!< Rotates all the children around their centers. 36 #define PNODE_ROTATE_MOVEMENT 2 //!< Moves all the children around the center of their parent, without the rotation around their own centers. 37 #define PNODE_MOVEMENT 4 //!< Moves all children along with the parent. 34 //! Parental linkage modes 35 typedef enum 36 { 37 PNODE_LOCAL_ROTATE = 1, //!< Rotates all the children around their centers. 38 PNODE_ROTATE_MOVEMENT = 2, //!< Moves all the children around the center of their parent, without the rotation around their own centers. 39 40 PNODE_MOVEMENT = 4, //!< Moves all children along with the parent. 38 41 // special linkage modes 39 #define PNODE_ALL 3 //!< Moves all children around the center of their parent, and also rotates their centers 40 #define PNODE_ROTATE_AND_MOVE 5 //!< Rotates all children around their axis, and moves them as the Parent Moves, but does not rotate around the center of their parent. 42 PNODE_ALL = 3, //!< Moves all children around the center of their parent, and also rotates their centers 43 PNODE_ROTATE_AND_MOVE = 5 //!< Rotates all children around their axis, and moves them as the Parent Moves, but does not rotate around the center of their parent. 44 45 } PARENT_MODE; 41 46 42 47 //! The default mode of the translation-binding. … … 84 89 85 90 void addChild (PNode* pNode, int parentingMode = DEFAULT_MODE); 91 void addChild (const char* childName); 86 92 void removeChild (PNode* pNode); 87 93 void remove(); … … 90 96 void setParent (const char* name); 91 97 92 void setParentMode (unsigned int parentingMode); 98 void setParentMode (PARENT_MODE parentMode); 99 void setParentMode (const char* parentingMode); 93 100 /** \returns the Parenting mode of this node */ 94 101 int getParentMode() const { return this->parentMode; };
Note: See TracChangeset
for help on using the changeset viewer.