← Back to team overview

yade-dev team mailing list archive

[svn] r1802 - in trunk: gui/py gui/qt3 pkg/common/Engine/MetaEngine

 

Author: eudoxos
Date: 2009-06-17 14:49:09 +0200 (Wed, 17 Jun 2009)
New Revision: 1802

Modified:
   trunk/gui/py/yadeControl.cpp
   trunk/gui/qt3/QtGUI.cpp
   trunk/gui/qt3/YadeQtMainWindow.cpp
   trunk/gui/qt3/YadeQtMainWindow.hpp
   trunk/pkg/common/Engine/MetaEngine/InteractionDispatchers.cpp
Log:
1. Handle groupMasks of bodies in InteractionDispatchers directly (not in geometry functors etc).
2. Fixes for qt3 started from within python
3. Add Body().dynamic flag to the wrapper, instead of using Body()['isDynamic'] all the time.


Modified: trunk/gui/py/yadeControl.cpp
===================================================================
--- trunk/gui/py/yadeControl.cpp	2009-06-16 20:20:22 UTC (rev 1801)
+++ trunk/gui/py/yadeControl.cpp	2009-06-17 12:49:09 UTC (rev 1802)
@@ -327,6 +327,7 @@
 	unsigned id_get(){ensureAcc(); return proxee->getId();}
 	int mask_get(){ensureAcc(); return proxee->groupMask;}
 	void mask_set(int m){ensureAcc(); proxee->groupMask=m;}
+	bool dynamic_get(){ensureAcc(); return proxee->isDynamic;} void dynamic_set(bool dyn){ensureAcc(); proxee->isDynamic=dyn;}
 	bool isStandalone(){ensureAcc(); return proxee->isStandalone();} bool isClumpMember(){ensureAcc(); return proxee->isClumpMember();} bool isClump(){ensureAcc(); return proxee->isClump();}
 BASIC_PY_PROXY_TAIL;
 
@@ -798,6 +799,7 @@
 		.add_property("mold",&pyBody::mold_get,&pyBody::mold_set)
 		.add_property("bound",&pyBody::bound_get,&pyBody::bound_set)
 		.add_property("phys",&pyBody::phys_get,&pyBody::phys_set)
+		.add_property("dynamic",&pyBody::dynamic_get,&pyBody::dynamic_set)
 		.add_property("id",&pyBody::id_get)
 		.add_property("mask",&pyBody::mask_get,&pyBody::mask_set)
 		.add_property("isStandalone",&pyBody::isStandalone)

Modified: trunk/gui/qt3/QtGUI.cpp
===================================================================
--- trunk/gui/qt3/QtGUI.cpp	2009-06-16 20:20:22 UTC (rev 1801)
+++ trunk/gui/qt3/QtGUI.cpp	2009-06-17 12:49:09 UTC (rev 1802)
@@ -88,21 +88,10 @@
 		XInitThreads();
 	   app=new QApplication(0,NULL);
 		if(!YadeQtMainWindow::self){
+			YadeQtMainWindow::guiMayDisappear=true;
 			mainWindow=new YadeQtMainWindow();
-			mainWindow->guiMayDisappear=true;
 			mainWindow->hide();
-			//app->setMainWidget(mainWindow);
 		} else { LOG_ERROR("Main window was there, but not QtGUI::app??"); }
 		boost::thread appThread(boost::bind(&QApplication::exec,app));
 	}
-	//mainWindow->showSomeGui();
-#if 0
-	else if (!YadeQtMainWindow::self){ // app exists and runs, just reopen the main window
-		//LOG_INFO("Recreating main window "<<YadeQtMainWindow::self);
-		//mainWindow=new YadeQtMainWindow();
-		//mainWindow->guiMayDisappear=true;
-		mainWindow->showSomeGui();
-		//app->setMainWidget(mainWindow);
-	}
-#endif
 }

Modified: trunk/gui/qt3/YadeQtMainWindow.cpp
===================================================================
--- trunk/gui/qt3/YadeQtMainWindow.cpp	2009-06-16 20:20:22 UTC (rev 1801)
+++ trunk/gui/qt3/YadeQtMainWindow.cpp	2009-06-17 12:49:09 UTC (rev 1802)
@@ -36,11 +36,11 @@
 CREATE_LOGGER(YadeQtMainWindow);
 
 YadeQtMainWindow* YadeQtMainWindow::self=NULL;
+bool YadeQtMainWindow::guiMayDisappear=false;
 
 YadeQtMainWindow::YadeQtMainWindow() : YadeQtGeneratedMainWindow()
 {
 	self=this;
-	guiMayDisappear=false;
 
 	QGLFormat format;
 	format.setStencil(TRUE);
@@ -76,19 +76,13 @@
 	move(preferences->mainWindowPositionX,preferences->mainWindowPositionY);
 
 	// HACK
-	if(Omega::instance().getSimulationFileName()!="") createController();
+	if(!guiMayDisappear && Omega::instance().getSimulationFileName()!="") createController();
 
 
 	// updates GL views, may also hide/show this window as needed
 	startTimer(100);
 }
 
-void YadeQtMainWindow::showSomeGui(){
-	if(controller||player||generator) return;
-	LOG_INFO("Showing main window");
-	this->show();
-}
-
 void YadeQtMainWindow::timerEvent(QTimerEvent* evt){
 	#if 1
 	//shared_ptr<MetaBody> rb=Omega::instance().getRootBody();

Modified: trunk/gui/qt3/YadeQtMainWindow.hpp
===================================================================
--- trunk/gui/qt3/YadeQtMainWindow.hpp	2009-06-16 20:20:22 UTC (rev 1801)
+++ trunk/gui/qt3/YadeQtMainWindow.hpp	2009-06-17 12:49:09 UTC (rev 1802)
@@ -41,7 +41,6 @@
 		void loadSimulation(string file);
 		void redrawAll(bool force=false);
 		void lookDown(shared_ptr<GLViewer> glv);
-		void showSomeGui();
 
 	protected :
 		shared_ptr<QtGUIPreferences> preferences;
@@ -51,7 +50,7 @@
 		YadeQtMainWindow ();
 		virtual ~YadeQtMainWindow ();
 		static YadeQtMainWindow* self; // retrieve instance pointer form elsewhere
-		bool guiMayDisappear;
+		static bool guiMayDisappear;
 
 		DECLARE_LOGGER;
 	public slots :

Modified: trunk/pkg/common/Engine/MetaEngine/InteractionDispatchers.cpp
===================================================================
--- trunk/pkg/common/Engine/MetaEngine/InteractionDispatchers.cpp	2009-06-16 20:20:22 UTC (rev 1801)
+++ trunk/pkg/common/Engine/MetaEngine/InteractionDispatchers.cpp	2009-06-17 12:49:09 UTC (rev 1802)
@@ -32,6 +32,9 @@
 			const shared_ptr<Body>& b1_=Body::byId(I->getId1(),rootBody);
 			const shared_ptr<Body>& b2_=Body::byId(I->getId2(),rootBody);
 
+			// go fast if this pair of bodies cannot interact at all
+			if((b1_->getGroupMask() & b2_->getGroupMask())==0) continue;
+
 			// we know there is no geometry functor already, take the short path
 			if(!I->functorCache.geomExists) { assert(!I->isReal()); continue; }
 			// no interaction geometry for either of bodies; no interaction possible