Revision: 9026
          http://playerstage.svn.sourceforge.net/playerstage/?rev=9026&view=rev
Author:   natepak
Date:     2011-01-18 05:31:59 +0000 (Tue, 18 Jan 2011)

Log Message:
-----------
Fixing cg visual

Modified Paths:
--------------
    code/gazebo/branches/dev/server/physics/Body.cc
    code/gazebo/branches/dev/server/rendering/Visual.cc

Modified: code/gazebo/branches/dev/server/physics/Body.cc
===================================================================
--- code/gazebo/branches/dev/server/physics/Body.cc     2011-01-18 04:12:06 UTC 
(rev 9025)
+++ code/gazebo/branches/dev/server/physics/Body.cc     2011-01-18 05:31:59 UTC 
(rev 9026)
@@ -375,16 +375,15 @@
   this->linearAccel.Set(0,0,0);
   this->angularAccel.Set(0,0,0);
 
-  // NATY: put back in
   /// Attach mesh for CG visualization
   /// Add a renderable visual for CG, make visible in Update()
-  /*if (this->mass.GetAsDouble() > 0.0)
+  if (this->mass.GetAsDouble() > 0.0)
   {
     std::ostringstream visname;
     visname << this->GetCompleteScopedName() + ":" + this->GetName() << 
"_CGVISUAL" ;
 
     this->cgVisualMsg = new VisualMsg();
-    this->cgVisualMsg->parentId = this->comEntity->GetId();
+    this->cgVisualMsg->parentId = this->comEntity->GetCompleteScopedName();
     this->cgVisualMsg->id = visname.str();
     this->cgVisualMsg->render = VisualMsg::MESH_RESOURCE;
     this->cgVisualMsg->mesh = "body_cg";
@@ -392,9 +391,11 @@
     this->cgVisualMsg->castShadows = false;
     this->cgVisualMsg->attachAxes = true;
     this->cgVisualMsg->visible = false;
+    this->cgVisualMsg->size.Set(0.1, 0.1, 0.1);
     Simulator::Instance()->SendMessage(*this->cgVisualMsg);
+    this->cgVisualMsg->size.Set(100, 100, 100);
 
-    VisualMsg msg;
+    /*VisualMsg msg;
     msg.parentId = this->cgVisualMsg->id;
     msg.render = VisualMsg::LINE_LIST;
     msg.attachAxes = false;
@@ -412,7 +413,8 @@
 
       Simulator::Instance()->SendMessage(msg);
     }
-  }*/
+    */
+  }
 
   this->enabled = true;
 }

Modified: code/gazebo/branches/dev/server/rendering/Visual.cc
===================================================================
--- code/gazebo/branches/dev/server/rendering/Visual.cc 2011-01-18 04:12:06 UTC 
(rev 9025)
+++ code/gazebo/branches/dev/server/rendering/Visual.cc 2011-01-18 05:31:59 UTC 
(rev 9026)
@@ -195,6 +195,7 @@
   this->sizeP->SetValue(msg->size);
 
   this->Load(NULL);
+  this->SetVisible(msg->visible);
 }
 
 
////////////////////////////////////////////////////////////////////////////////
@@ -500,13 +501,6 @@
 ///  Set the scale
 void Visual::SetScale(const Vector3 &scale )
 {
-  // NATY
-  //boost::recursive_mutex::scoped_lock lock(*this->mutex);
-
-  // Stop here if the rendering engine has been disabled
-  if (!Simulator::Instance()->GetRenderEngineEnabled())
-    return;
-
   Ogre::Vector3 vscale;
   vscale.x=scale.x;
   vscale.y=scale.y;
@@ -759,13 +753,7 @@
 /// Set whether the visual is visible
 void Visual::SetVisible(bool visible, bool cascade)
 {
-  // NATY
-  //boost::recursive_mutex::scoped_lock lock(*this->mutex);
-
-  // Stop here if the rendering engine has been disabled
-  if (!Simulator::Instance()->GetRenderEngineEnabled())
-    return;
-
+  std::cout << "VIs[" << this->GetName() << "]=" << visible << "\n";
   this->sceneNode->setVisible( visible, cascade );
   this->visible = visible;
 }
@@ -788,13 +776,6 @@
 // Set the position of the visual
 void Visual::SetPosition( const Vector3 &pos)
 {
-  // NATY
-  //boost::recursive_mutex::scoped_lock lock(*this->mutex);
-
-  // Stop here if the rendering engine has been disabled
-  if (!Simulator::Instance()->GetRenderEngineEnabled())
-    return;
-
   /*if (this->IsStatic() && this->staticGeom)
   {
     this->staticGeom->reset();
@@ -1401,6 +1382,9 @@
   this->SetPose(msg->pose);
   this->SetTransparency(msg->transparency);
   this->SetScale(msg->size);
+  std::cout << "Scale[" << msg->size << "]\n";
+  
+  this->SetVisible(msg->visible, 1);
 }
 
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to