Revision: 7495
http://playerstage.svn.sourceforge.net/playerstage/?rev=7495&view=rev
Author: hsujohnhsu
Date: 2009-03-17 00:44:57 +0000 (Tue, 17 Mar 2009)
Log Message:
-----------
update Entity for headless mode.
Update Entity transparency setting.
Modified Paths:
--------------
code/gazebo/branches/ogre-1.4.9/server/Entity.cc
code/gazebo/branches/ogre-1.4.9/server/Entity.hh
Modified: code/gazebo/branches/ogre-1.4.9/server/Entity.cc
===================================================================
--- code/gazebo/branches/ogre-1.4.9/server/Entity.cc 2009-03-17 00:39:47 UTC
(rev 7494)
+++ code/gazebo/branches/ogre-1.4.9/server/Entity.cc 2009-03-17 00:44:57 UTC
(rev 7495)
@@ -32,6 +32,7 @@
#include "World.hh"
#include "PhysicsEngine.hh"
#include "Entity.hh"
+#include "Simulator.hh"
using namespace gazebo;
@@ -51,12 +52,14 @@
if (this->parent)
{
this->parent->AddChild(this);
- this->visualNode=new OgreVisual(this->parent->GetVisualNode());
+ if (Simulator::Instance()->GetRenderEngineEnabled())
+ this->visualNode=new OgreVisual(this->parent->GetVisualNode());
this->SetStatic(parent->IsStatic());
}
else
{
- this->visualNode = new OgreVisual(NULL);
+ if (Simulator::Instance()->GetRenderEngineEnabled())
+ this->visualNode = new OgreVisual(NULL);
}
// Add this to the phyic's engine
@@ -69,7 +72,8 @@
{
delete this->staticP;
- GZ_DELETE(this->visualNode);
+ if (Simulator::Instance()->GetRenderEngineEnabled())
+ GZ_DELETE(this->visualNode);
World::Instance()->GetPhysicsEngine()->RemoveEntity(this);
}
@@ -160,13 +164,29 @@
Body *body = NULL;
this->selected = s;
+ //std::cout << " SetSelected Entity : " << this->GetName() << " selected("
<< s << ")" << std::endl;
for (iter = this->children.begin(); iter != this->children.end(); iter++)
{
+ //std::cout << " SetSelected Entity Children: " << (*iter)->GetName() <<
std::endl;
(*iter)->SetSelected(s);
body = dynamic_cast<Body*>(*iter);
+
+ //enabling SetEnabled(!s) makes body unstabel upon unselection
+ //if (body)
+ // body->SetEnabled(!s);
+ }
+}
+
+void Entity::SetTransparency(float t)
+{
+ std::vector< Entity *>::iterator iter;
+ Body *body = NULL;
+ for (iter = this->children.begin(); iter != this->children.end(); iter++)
+ {
+ body = dynamic_cast<Body*>(*iter);
if (body)
- body->SetEnabled(!s);
+ body->SetTransparency(t);
}
}
Modified: code/gazebo/branches/ogre-1.4.9/server/Entity.hh
===================================================================
--- code/gazebo/branches/ogre-1.4.9/server/Entity.hh 2009-03-17 00:39:47 UTC
(rev 7494)
+++ code/gazebo/branches/ogre-1.4.9/server/Entity.hh 2009-03-17 00:44:57 UTC
(rev 7495)
@@ -101,6 +101,9 @@
/// \brief Returns true if the entities are the same. Checks only the name
public: bool operator==(const Entity &ent) const;
+ /// \brief Set transparency of all children bodies->geoms
+ public: void SetTransparency(float t);
+
/// \brief Parent of this entity
protected: Entity *parent;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit