← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 1903: 1. call centerScene() in GLViewer ctor, bind C to centerScene if no body is selected (was deactiv...

 

------------------------------------------------------------
revno: 1903
committer: Václav Šmilauer <eudoxos@xxxxxxxx>
branch nick: trunk
timestamp: Tue 2009-12-15 18:47:47 +0100
message:
  1. call centerScene() in GLViewer ctor, bind C to centerScene if no body is selected (was deactivated most likely by mistake, bzr annotate thinks it was me...!?). This should fix bug reported by Chiara for TriaxialTest with UpperCorner=Vector3(12,12,12)
modified:
  gui/qt3/GLViewer.cpp


--
lp:yade
https://code.launchpad.net/~yade-dev/yade/trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription.
=== modified file 'gui/qt3/GLViewer.cpp'
--- gui/qt3/GLViewer.cpp	2009-12-15 09:41:07 +0000
+++ gui/qt3/GLViewer.cpp	2009-12-15 17:47:47 +0000
@@ -85,7 +85,7 @@
 	//xyPlaneConstraint->setRotationConstraint(qglviewer::AxisPlaneConstraint::FORBIDDEN,qglviewer::Vec(0,0,1));
 	manipulatedFrame()->setConstraint(NULL);
 
-	setKeyDescription(Qt::Key_C,"Set scene center to the selected body (if any)");
+	setKeyDescription(Qt::Key_C,"Set scene center so that all bodies are visible; if a body is selected, center around this body.");
 	setKeyDescription(Qt::Key_C & Qt::ALT,"Set scene center to median body position");
 	setKeyDescription(Qt::Key_D,"Toggle time display mask");
 	setKeyDescription(Qt::Key_G,"Toggle grid");
@@ -117,6 +117,8 @@
 	setKeyDescription(Qt::Key_1 & Qt::ALT,"Add/remove plane #1 (2,...) to/from the bound group");
 	setKeyDescription(Qt::Key_0,"Clear the bound group");
 	setKeyDescription(Qt::Key_Space,"Activate/deactivate the manipulated clipping plane");
+
+	centerScene();
 }
 
 void GLViewer::mouseMovesCamera(){
@@ -252,8 +254,13 @@
 		else useDisplayParameters(n);
 	}
 	/* letters alphabetically */
-	else if(e->key()==Qt::Key_C && selectedName() >= 0 && (*(Omega::instance().getScene()->bodies)).exists(selectedName())) setSceneCenter(manipulatedFrame()->position());
 	else if(e->key()==Qt::Key_C && (e->state() & AltButton)){ displayMessage("Median centering"); centerMedianQuartile(); }
+	else if(e->key()==Qt::Key_C){
+		// center around selected body
+		if(selectedName() >= 0 && (*(Omega::instance().getScene()->bodies)).exists(selectedName())) setSceneCenter(manipulatedFrame()->position());
+		// make all bodies visible
+		else centerScene();
+	}
 	else if(e->key()==Qt::Key_D &&(e->state() & AltButton)){ body_id_t id; if((id=Omega::instance().getScene()->selectedBody)>=0){ const shared_ptr<Body>& b=Body::byId(id); b->isDynamic=!b->isDynamic; LOG_INFO("Body #"<<id<<" now "<<(b->isDynamic?"":"NOT")<<" dynamic"); } }
 	else if(e->key()==Qt::Key_D) {timeDispMask+=1; if(timeDispMask>(TIME_REAL|TIME_VIRT|TIME_ITER))timeDispMask=0; }
 	else if(e->key()==Qt::Key_G) {bool anyDrawn=drawGridXYZ[0]||drawGridXYZ[1]||drawGridXYZ[2]; for(int i=0; i<3; i++)drawGridXYZ[i]=!anyDrawn; }