[Orxonox-commit 1771] r6489 - code/branches/pickup3/src/orxonox/worldentities

dafrick at orxonox.net dafrick at orxonox.net
Mon Mar 8 08:09:17 CET 2010


Author: dafrick
Date: 2010-03-08 08:09:17 +0100 (Mon, 08 Mar 2010)
New Revision: 6489

Modified:
   code/branches/pickup3/src/orxonox/worldentities/WorldEntity.cc
   code/branches/pickup3/src/orxonox/worldentities/WorldEntity.h
Log:
Changed changedActivity and changedVisibility such that when transiting to inactive/invisible the current activity/visibility of all atached objects is saved by them and restored once the parent node transits to active/visible again.


Modified: code/branches/pickup3/src/orxonox/worldentities/WorldEntity.cc
===================================================================
--- code/branches/pickup3/src/orxonox/worldentities/WorldEntity.cc	2010-03-07 22:47:11 UTC (rev 6488)
+++ code/branches/pickup3/src/orxonox/worldentities/WorldEntity.cc	2010-03-08 07:09:17 UTC (rev 6489)
@@ -80,6 +80,10 @@
 
         this->node_->setPosition(Vector3::ZERO);
         this->node_->setOrientation(Quaternion::IDENTITY);
+        
+        // Activity and visibility memory.
+        this->bActiveMem_ = true;
+        this->bVisibleMem_ = true;
 
 
         // Default behaviour does not include physics
@@ -211,7 +215,15 @@
         
         for (std::set<WorldEntity*>::const_iterator it = this->getAttachedObjects().begin(); it != this->getAttachedObjects().end(); it++)
         {
-            (*it)->setActive(this->isActive());
+            if(!this->isActive())
+            {
+                (*it)->bActiveMem_ = (*it)->isActive();
+                (*it)->setActive(this->isActive());
+            }
+            else
+            {
+                (*it)->setActive((*it)->bActiveMem_);
+            }
         }
     }
     
@@ -225,7 +237,15 @@
         
         for (std::set<WorldEntity*>::const_iterator it = this->getAttachedObjects().begin(); it != this->getAttachedObjects().end(); it++)
         {
-            (*it)->setVisible(this->isVisible());
+            if(!this->isVisible())
+            {
+                (*it)->bVisibleMem_ = (*it)->isVisible();
+                (*it)->setVisible(this->isVisible());
+            }
+            else
+            {
+                (*it)->setVisible((*it)->bVisibleMem_);
+            }
         }
     }
 

Modified: code/branches/pickup3/src/orxonox/worldentities/WorldEntity.h
===================================================================
--- code/branches/pickup3/src/orxonox/worldentities/WorldEntity.h	2010-03-07 22:47:11 UTC (rev 6488)
+++ code/branches/pickup3/src/orxonox/worldentities/WorldEntity.h	2010-03-08 07:09:17 UTC (rev 6489)
@@ -234,6 +234,9 @@
             unsigned int parentID_;
             std::set<WorldEntity*> children_;
             bool bDeleteWithParent_;
+            
+            bool bActiveMem_;
+            bool bVisibleMem_;
 
 
         /////////////




More information about the Orxonox-commit mailing list