← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2110: 1. Rename many attributes in OpenGLRenderingEngine, using the deprecated attribute framework

 

------------------------------------------------------------
revno: 2110
committer: Václav Šmilauer <eudoxos@xxxxxxxx>
branch nick: trunk
timestamp: Sun 2010-03-28 23:22:25 +0200
message:
  1. Rename many attributes in OpenGLRenderingEngine, using the deprecated attribute framework
  2. Add pickling support to Serializables (useless)
  3. Fixes of docstrings here and there
modified:
  .bzrignore
  core/Dispatcher.hpp
  debian/rules
  examples/concrete/uniax.py
  lib/serialization/Serializable.cpp
  lib/serialization/Serializable.hpp
  pkg/common/RenderingEngine/OpenGLRenderingEngine.cpp
  pkg/common/RenderingEngine/OpenGLRenderingEngine.hpp
  py/pack/pack.py
  py/utils.py
  py/yadeWrapper/yadeWrapper.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 '.bzrignore'
--- .bzrignore	2009-08-22 18:21:25 +0000
+++ .bzrignore	2010-03-28 21:22:25 +0000
@@ -2,9 +2,8 @@
 scons.current-profile
 scons.profile-*
 .project
-./doc/doxygen
 VERSION
 yade.1
 debian/changelog
 debian/control
-doc/epydoc
+doc/epydoc
\ No newline at end of file

=== modified file 'core/Dispatcher.hpp'
--- core/Dispatcher.hpp	2010-03-09 14:20:36 +0000
+++ core/Dispatcher.hpp	2010-03-28 21:22:25 +0000
@@ -58,7 +58,7 @@
 
 // HELPER MACROS
 // supposed to be passed to YADE_CLASS_BASE_DOC_ATTRS_PY in the 5th argument; takes class name as arg
-#define YADE_PY_DISPATCHER(DispatcherT) .def("__init__",python::make_constructor(Dispatcher_ctor_list<DispatcherT>)).add_property("functors",&Dispatcher_functors_get<DispatcherT>,"Functors objects associated with this dispatcher.").def("dispMatrix",&DispatcherT::dump,python::arg("names")=true,"Return dictionary with contents of the dispatch matrix.").def("dispFunctor",&DispatcherT::getFunctor,"Return functor that would be dispatched for given argument(s); None if no dispatch; ambiguous dispatch throws.");
+#define YADE_PY_DISPATCHER(DispatcherT) .def("__init__",python::make_constructor(Dispatcher_ctor_list<DispatcherT>),"Construct with list of associated functors.").add_property("functors",&Dispatcher_functors_get<DispatcherT>,"Functors objects associated with this dispatcher.").def("dispMatrix",&DispatcherT::dump,python::arg("names")=true,"Return dictionary with contents of the dispatch matrix.").def("dispFunctor",&DispatcherT::getFunctor,"Return functor that would be dispatched for given argument(s); None if no dispatch; ambiguous dispatch throws.");
 
 
 // HELPER FUNCTIONS

=== modified file 'debian/rules'
--- debian/rules	2010-03-25 13:24:10 +0000
+++ debian/rules	2010-03-28 21:22:25 +0000
@@ -59,7 +59,7 @@
 	###   (a) use fakeroot-tcp instead of fakeroot
 	###   (b) use just 1 job
 	#debug build
-	NO_SCONS_GET_RECENT= scons buildPrefix=debian runtimePREFIX=/usr version=${VERSION} brief=0 chunkSize=20 linkStrategy=monolithic features=vtk,gts,log4cxx,opengl,openmp exclude=snow PREFIX=debian/yade${_VERSION}-dbg/usr variant=-dbg optimize=0 march= debug=1
+	NO_SCONS_GET_RECENT= scons buildPrefix=debian runtimePREFIX=/usr version=${VERSION} brief=0 chunkSize=-1 linkStrategy=monolithic features=vtk,gts,log4cxx,opengl,openmp exclude=snow PREFIX=debian/yade${_VERSION}-dbg/usr variant=-dbg optimize=0 march= debug=1 jobs=1 # added jobs to prevent lp builder hangs (?)
 	#optimized build
 	NO_SCONS_GET_RECENT= scons PREFIX=debian/yade${_VERSION}/usr variant='' optimize=1 debug=0
 	#install platform-independent files (docs, scripts, examples)

=== modified file 'examples/concrete/uniax.py'
--- examples/concrete/uniax.py	2010-03-21 15:25:50 +0000
+++ examples/concrete/uniax.py	2010-03-28 21:22:25 +0000
@@ -116,8 +116,7 @@
 	try:
 		from yade import qt
 		renderer=qt.Renderer()
-		renderer['scaleDisplacements']=True
-		renderer['displacementScale']=(1000,1000,1000) if mode=='tension' else (100,100,100)
+		renderer.dispScale=(1000,1000,1000) if mode=='tension' else (100,100,100)
 	except ImportError: pass
 	print "init done, will now run."
 	O.step(); O.step(); # to create initial contacts

=== modified file 'lib/serialization/Serializable.cpp'
--- lib/serialization/Serializable.cpp	2010-03-22 17:39:33 +0000
+++ lib/serialization/Serializable.cpp	2010-03-28 21:22:25 +0000
@@ -11,6 +11,32 @@
 #include "Serializable.hpp"
 
 
+void Serializable::pyRegisterClass(boost::python::object _scope) const {
+	if(!checkPyClassRegistersItself("Serializable")) return;
+	boost::python::scope thisScope(_scope); 
+	python::class_<Serializable, shared_ptr<Serializable>, noncopyable >("Serializable")
+		.add_property("name",&Serializable::getClassName,"Name of the class").def("__str__",&Serializable::pyStr).def("__repr__",&Serializable::pyStr).def("postProcessAttributes",&Serializable::postProcessAttributes,(python::arg("deserializing")=true),"Call Serializable::postProcessAttributes c++ method.")
+		.def("dict",&Serializable::pyDict,"Return dictionary of attributes.").def("__getitem__",&Serializable::pyGetAttr).def("__setitem__",&Serializable::pySetAttr).def("has_key",&Serializable::pyHasKey,"Predicate telling whether given attribute exists.").def("keys",&Serializable::pyKeys,"Return list of attribute names")
+		.def("updateAttrs",&Serializable::pyUpdateAttrs,"Update object attributes from given dictionary").def("updateExistingAttrs",&Serializable::pyUpdateExistingAttrs,"Update object attributes from given dictionary, skipping those that the instance doesn't have. Return list of attributes that did *not* exist and were not updated.")
+		.def("clone",&Serializable_clone<Serializable>,python::arg("attrs")=python::dict(),"Return clone of the instance, created by copying values of all attributes.")
+		/* boost::python pickling support, as per http://www.boost.org/doc/libs/1_42_0/libs/python/doc/v2/pickle.html */ 
+		.def("__getstate__",&Serializable::pyDict).def("__setstate__",&Serializable::pyUpdateAttrs)
+		.add_property("__safe_for_unpickling__",&Serializable::getClassName,"just define the attr, return some bogus data")
+		.add_property("__getstate_manages_dict__",&Serializable::getClassName,"just define the attr, return some bogus data")
+		// constructor with dictionary of attributes
+		.def("__init__",python::raw_constructor(Serializable_ctor_kwAttrs<Serializable>))
+		;
+}
+
+bool Serializable::checkPyClassRegistersItself(const std::string& thisClassName) const {
+	if(getClassName()!=thisClassName){
+		std::cerr<<"FIXME: class "+getClassName()+" does not register with YADE_CLASS_BASE_DOC_ATTR*; will be inaccessible from python."<<std::endl; return false;
+	}
+	return true;
+}
+
+
+
 void Serializable::pyUpdateAttrs(const python::dict& d){
 	python::list l=d.items(); size_t ll=python::len(l);
 	for(size_t i=0; i<ll; i++){

=== modified file 'lib/serialization/Serializable.hpp'
--- lib/serialization/Serializable.hpp	2010-03-27 22:18:10 +0000
+++ lib/serialization/Serializable.hpp	2010-03-28 21:22:25 +0000
@@ -75,7 +75,7 @@
 
 #define _DEPREC_OLDNAME(x) BOOST_PP_TUPLE_ELEM(3,0,x)
 #define _DEPREC_NEWNAME(x) BOOST_PP_TUPLE_ELEM(3,1,x)
-#define _DEPREC_COMMENT(x) BOOST_PP_TUPLE_ELEM(3,2,x)
+#define _DEPREC_COMMENT(x) BOOST_PP_TUPLE_ELEM(3,2,x) "" // if the argument is omited, return empty string instead of nothing
 
 // loop bodies for attribute access
 #define _PYGET_ATTR(x,y,z) if(key==BOOST_PP_STRINGIZE(z)) return boost::python::object(z);
@@ -86,7 +86,7 @@
 #define _PYHASKEY_ATTR_DEPREC(x,thisClass,z) if(key==BOOST_PP_STRINGIZE(_DEPREC_OLDNAME(z))) return true;
 #define _PYDICT_ATTR(x,y,z) ret[BOOST_PP_STRINGIZE(z)]=boost::python::object(z);
 #define _PYATTR_DEF(x,thisClass,z) .def_readwrite(BOOST_PP_STRINGIZE(BOOST_PP_TUPLE_ELEM(2,0,z)),&thisClass::BOOST_PP_TUPLE_ELEM(2,0,z),BOOST_PP_TUPLE_ELEM(2,1,z))
-#define _PYATTR_DEPREC_DEF(x,thisClass,z) .add_property(BOOST_PP_STRINGIZE(_DEPREC_OLDNAME(z)),&thisClass::BOOST_PP_CAT(_getDeprec_,_DEPREC_OLDNAME(z)),&thisClass::BOOST_PP_CAT(_setDeprec_,_DEPREC_OLDNAME(z)),"Deprecated alias for :yref:`" BOOST_PP_STRINGIZE(_DEPREC_NEWNAME(z)) "<" BOOST_PP_STRINGIZE(thisClass) "." BOOST_PP_STRINGIZE(_DEPREC_NEWNAME(z)) ">` (" _DEPREC_COMMENT(z) ")")
+#define _PYATTR_DEPREC_DEF(x,thisClass,z) .add_property(BOOST_PP_STRINGIZE(_DEPREC_OLDNAME(z)),&thisClass::BOOST_PP_CAT(_getDeprec_,_DEPREC_OLDNAME(z)),&thisClass::BOOST_PP_CAT(_setDeprec_,_DEPREC_OLDNAME(z)),"|ydeprecated| alias for :yref:`" BOOST_PP_STRINGIZE(_DEPREC_NEWNAME(z)) "<" BOOST_PP_STRINGIZE(thisClass) "." BOOST_PP_STRINGIZE(_DEPREC_NEWNAME(z)) ">` (" _DEPREC_COMMENT(z) ")")
 
 // register class attributes, putting them to both python ['attr'] access functions and yade::serialization (and boost::serialization, if enabled)
 #define REGISTER_ATTRIBUTES(baseClass,attrs) REGISTER_ATTRIBUTES_DEPREC(_SOME_CLASS,baseClass,attrs,)
@@ -266,19 +266,11 @@
 		virtual boost::python::list pyKeys() const {return ::pyKeys(); };
 		virtual bool pyHasKey(const std::string& key) const {return ::pyHasKey(key);}
 		virtual boost::python::dict pyDict() const { return ::pyDict(); }
-		// this check can be probably removed at some point
-		virtual bool checkPyClassRegistersItself(const std::string& thisClassName) const { if(getClassName()!=thisClassName){ std::cerr<<"FIXME: class "+getClassName()+" does not register with YADE_CLASS_BASE_DOC_ATTR*; will be inaccessible from python."<<std::endl; return false; } return true; }
-		virtual void pyRegisterClass(boost::python::object _scope) const {
-			if(!checkPyClassRegistersItself("Serializable")) return;
-			boost::python::scope thisScope(_scope); 
-			python::class_<Serializable, shared_ptr<Serializable>, noncopyable >("Serializable")
-				.add_property("name",&Serializable::getClassName,"Name of the class").def("__str__",&Serializable::pyStr).def("__repr__",&Serializable::pyStr).def("postProcessAttributes",&Serializable::postProcessAttributes,(python::arg("deserializing")=true),"Call Serializable::postProcessAttributes c++ method.")
-				.def("dict",&Serializable::pyDict,"Return dictionary of attributes.").def("__getitem__",&Serializable::pyGetAttr).def("__setitem__",&Serializable::pySetAttr).def("has_key",&Serializable::pyHasKey,"Predicate telling whether given attribute exists.").def("keys",&Serializable::pyKeys,"Return list of attribute names")
-				.def("updateAttrs",&Serializable::pyUpdateAttrs,"Update object attributes from given dictionary").def("updateExistingAttrs",&Serializable::pyUpdateExistingAttrs,"Update object attributes from given dictionary, skipping those that the instance doesn't have. Return list of attributes that did *not* exist and were not updated.")
-				.def("clone",&Serializable_clone<Serializable>,python::arg("attrs")=python::dict(),"Return clone of the instance, created by copying values of all attributes.")
-				.def("__init__",python::raw_constructor(Serializable_ctor_kwAttrs<Serializable>))
-				;
-		}
+		// check whether the class registers itself or whether it calls virtual function of some base class;
+		// that means that the class doesn't register itself properly
+		virtual bool checkPyClassRegistersItself(const std::string& thisClassName) const;
+		// perform class registration; overridden in all classes
+		virtual void pyRegisterClass(boost::python::object _scope) const;
 		
 		//! update attributes from dictionary
 		void pyUpdateAttrs(const boost::python::dict& d);

=== modified file 'pkg/common/RenderingEngine/OpenGLRenderingEngine.cpp'
--- pkg/common/RenderingEngine/OpenGLRenderingEngine.cpp	2010-02-12 01:28:18 +0000
+++ pkg/common/RenderingEngine/OpenGLRenderingEngine.cpp	2010-03-28 21:22:25 +0000
@@ -80,7 +80,7 @@
 		glRotatef(angle*Mathr::RAD_TO_DEG,axis[0],axis[1],axis[2]);
 		//if(b->shape->getClassName() != "LineSegment"){ // FIXME: a body needs to say: I am selectable ?!?!
 			glPushName(b->getId());
-			shapeDispatcher(b->shape,b->state,Body_wire || b->shape->wire,viewInfo);
+			shapeDispatcher(b->shape,b->state,wire || b->shape->wire,viewInfo);
 			glPopName();
 		//}
 		glPopMatrix();
@@ -96,6 +96,8 @@
 
 void OpenGLRenderingEngine::setBodiesDispInfo(){
 	if(scene->bodies->size()!=bodyDisp.size()) bodyDisp.resize(scene->bodies->size());
+	bool scaleRotations=(rotScale!=1.0);
+	bool scaleDisplacements=(dispScale!=Vector3r::ONE);
 	FOREACH(const shared_ptr<Body>& b, *scene->bodies){
 		if(!b || !b->state) continue;
 		size_t id=b->getId();
@@ -107,12 +109,12 @@
 		if(!(scaleDisplacements||scaleRotations||scene->isPeriodic)){ bodyDisp[id].pos=pos; bodyDisp[id].ori=ori; continue; }
 		// apply scaling
 		bodyDisp[id].pos=cellPos; // point of reference (inside the cell for periodic)
-		if(scaleDisplacements) bodyDisp[id].pos+=diagMult(displacementScale,pos-refPos); // add scaled translation to the point of reference
+		if(scaleDisplacements) bodyDisp[id].pos+=diagMult(dispScale,pos-refPos); // add scaled translation to the point of reference
 		if(!scaleRotations) bodyDisp[id].ori=ori;
 		else{
 			Quaternionr relRot=refOri.Conjugate()*ori;
 			Vector3r axis; Real angle; relRot.ToAxisAngle(axis,angle);
-			angle*=rotationScale;
+			angle*=rotScale;
 			bodyDisp[id].ori=refOri*Quaternionr(axis,angle);
 		}
 	}
@@ -124,7 +126,7 @@
 	glColor3v(Vector3r(1,1,0));
 	glPushMatrix();
 		Vector3r size=scene->cell->getSize();
-		if(scaleDisplacements) size+=diagMult(displacementScale,size-scene->cell->refSize);
+		if(dispScale!=Vector3r::ONE) size+=diagMult(dispScale,size-scene->cell->refSize);
 		glTranslatev(scene->cell->shearPt(.5*size)); // shear center (moves when sheared)
 		glMultMatrixd(scene->cell->getGlShearTrsfMatrix());
 		glScalev(size);
@@ -154,10 +156,10 @@
 		
 
 	// Draw light source
-	const GLfloat pos[4]	= {Light_position[0],Light_position[1],Light_position[2],1.0};
+	const GLfloat pos[4]	= {lightPos[0],lightPos[1],lightPos[2],1.0};
 	const GLfloat ambientColor[4]={0.5,0.5,0.5,1.0};	
 	//const GLfloat specularColor[4]={0.5,0.5,0.5,1.0};	
-	glClearColor(Background_color[0],Background_color[1],Background_color[2],1.0);
+	glClearColor(bgColor[0],bgColor[1],bgColor[2],1.0);
 	glLightfv(GL_LIGHT0, GL_POSITION, pos);
 	glLightModelfv(GL_LIGHT_MODEL_AMBIENT,ambientColor);
 	glLightModelf(GL_LIGHT_MODEL_TWO_SIDE,1); // important: do lighting calculations on both sides of polygons
@@ -165,7 +167,7 @@
 	glEnable(GL_LIGHT0);
 	glDisable(GL_LIGHTING);
 	glPushMatrix();
-		glTranslatef(Light_position[0],Light_position[1],Light_position[2]);
+		glTranslatef(lightPos[0],lightPos[1],lightPos[2]);
 		glColor3f(1.0,1.0,1.0);
 		glutSolidSphere(3,10,10);
 	glPopMatrix();	
@@ -187,16 +189,16 @@
 
 	drawPeriodicCell();
 
-	if (Show_DOF || Show_ID) renderDOF_ID();
-	if (Body_bounding_volume) renderBoundingVolume();
-	if (Body_interacting_geom){
+	if (dof || id) renderDOF_ID();
+	if (bound) renderBoundingVolume();
+	if (shape){
 		glEnable(GL_LIGHTING);
 		glEnable(GL_CULL_FACE);
 		renderShape();
 	}
 	if (intrAllWire) renderAllInteractionsWire();
-	if (Interaction_geometry) renderInteractionGeometry();
-	if (Interaction_physics) renderInteractionPhysics();
+	if (intrGeom) renderInteractionGeometry();
+	if (intrPhys) renderInteractionPhysics();
 }
 
 void OpenGLRenderingEngine::renderAllInteractionsWire(){
@@ -218,28 +220,28 @@
 	const GLfloat ambientColorUnselected[4]={0.5,0.5,0.5,1.0};	
 	FOREACH(const shared_ptr<Body> b, *scene->bodies){
 		if(!b) continue;
-		if(b->shape && ((b->getGroupMask() & Draw_mask) || b->getGroupMask()==0)){
+		if(b->shape && ((b->getGroupMask() & mask) || b->getGroupMask()==0)){
 			if(b->state /* && FIXME: !b->physicalParameters->isDisplayed */) continue;
-			if(!Show_ID && b->state->blockedDOFs==0) continue;
+			if(!id && b->state->blockedDOFs==0) continue;
 			const Se3r& se3=b->state->se3; // FIXME: should be dispSe3
 			glPushMatrix();
 			glTranslatef(se3.position[0],se3.position[1],se3.position[2]);
 			if(current_selection==b->getId()){glLightModelfv(GL_LIGHT_MODEL_AMBIENT,ambientColorSelected);}
 			{ // write text
-				glColor3f(1.0-Background_color[0],1.0-Background_color[1],1.0-Background_color[2]);
+				glColor3f(1.0-bgColor[0],1.0-bgColor[1],1.0-bgColor[2]);
 				unsigned DOF = b->state->blockedDOFs;
-				std::string dof = std::string("") 
+				std::string sDof = std::string("") 
 										+ (((DOF & State::DOF_X )!=0)?"X":" ")
 										+ (((DOF & State::DOF_Y )!=0)?"Y":" ")
 										+ (((DOF & State::DOF_Z )!=0)?"Z":" ")
 										+ (((DOF & State::DOF_RX)!=0)?"RX":"  ")
 										+ (((DOF & State::DOF_RY)!=0)?"RY":"  ")
 										+ (((DOF & State::DOF_RZ)!=0)?"RZ":"  ");
-				std::string id = boost::lexical_cast<std::string>(b->getId());
-				std::string str("");
-				if(Show_DOF && Show_ID) id += " ";
-				if(Show_ID) str += id;
-				if(Show_DOF) str += dof;
+				std::string sId = boost::lexical_cast<std::string>(b->getId());
+				std::string str;
+				if(dof && id) id += " ";
+				if(id) str += sId;
+				if(dof) str += sDof;
 				glPushMatrix();
 				glRasterPos2i(0,0);
 				for(unsigned int i=0;i<str.length();i++)
@@ -259,7 +261,7 @@
 			if(!I->interactionGeometry) continue;
 			const shared_ptr<Body>& b1=Body::byId(I->getId1(),scene), b2=Body::byId(I->getId2(),scene);
 			if(!(bodyDisp[I->getId1()].isDisplayed||bodyDisp[I->getId2()].isDisplayed)) continue;
-			glPushMatrix(); interactionGeometryDispatcher(I->interactionGeometry,I,b1,b2,Interaction_wire); glPopMatrix();
+			glPushMatrix(); interactionGeometryDispatcher(I->interactionGeometry,I,b1,b2,intrWire); glPopMatrix();
 		}
 	}
 }
@@ -273,7 +275,7 @@
 			const shared_ptr<Body>& b1=Body::byId(I->getId1(),scene), b2=Body::byId(I->getId2(),scene);
 			body_id_t id1=I->getId1(), id2=I->getId2();
 			if(!(bodyDisp[id1].isDisplayed||bodyDisp[id2].isDisplayed)) continue;
-			glPushMatrix(); interactionPhysicsDispatcher(I->interactionPhysics,I,b1,b2,Interaction_wire); glPopMatrix();
+			glPushMatrix(); interactionPhysicsDispatcher(I->interactionPhysics,I,b1,b2,intrWire); glPopMatrix();
 		}
 	}
 }
@@ -282,7 +284,7 @@
 	FOREACH(const shared_ptr<Body>& b, *scene->bodies){
 		if(!b || !b->bound) continue;
 		if(!bodyDisp[b->getId()].isDisplayed) continue;
-		if(b->bound && ((b->getGroupMask()&Draw_mask) || b->getGroupMask()==0)){
+		if(b->bound && ((b->getGroupMask()&mask) || b->getGroupMask()==0)){
 			glPushMatrix(); boundDispatcher(b->bound,scene.get()); glPopMatrix();
 		}
 	}
@@ -319,7 +321,7 @@
 		if(!bodyDisp[b->getId()].isDisplayed) continue;
 		Vector3r pos=bodyDisp[b->getId()].pos;
 		Quaternionr ori=bodyDisp[b->getId()].ori;
-		if(!b->shape || !((b->getGroupMask()&Draw_mask) || b->getGroupMask()==0)) continue;
+		if(!b->shape || !((b->getGroupMask()&mask) || b->getGroupMask()==0)) continue;
 		glPushMatrix();
 			Real angle;	Vector3r axis;	ori.ToAxisAngle(axis,angle);	
 			glTranslatef(pos[0],pos[1],pos[2]);
@@ -331,18 +333,18 @@
 				glColor4(h[0],h[1],h[2],.2);
 				glColorMaterial(GL_FRONT_AND_BACK,GL_DIFFUSE);
 				///
-				shapeDispatcher(b->shape,b->state,Body_wire || b->shape->wire,viewInfo);
+				shapeDispatcher(b->shape,b->state,wire || b->shape->wire,viewInfo);
 				///
 				glLightModelfv(GL_LIGHT_MODEL_AMBIENT,ambientColorUnselected);
 				glColorMaterial(GL_FRONT_AND_BACK,GL_EMISSION);
 				glColor3v(Vector3r::ZERO);
 				glColorMaterial(GL_FRONT_AND_BACK,GL_DIFFUSE);
 			} else {
-				shapeDispatcher(b->shape,b->state,Body_wire || b->shape->wire,viewInfo);
+				shapeDispatcher(b->shape,b->state,wire || b->shape->wire,viewInfo);
 			}
 		glPopMatrix();
 		if(current_selection==b->getId() || b->shape->highlight){
-			if(!b->bound || Body_wire || b->shape->wire) GLUtils::GLDrawInt(b->getId(),pos);
+			if(!b->bound || wire || b->shape->wire) GLUtils::GLDrawInt(b->getId(),pos);
 			else {
 				// move the label towards the camera by the bounding box so that it is not hidden inside the body
 				const Vector3r& mn=b->bound->min; const Vector3r& mx=b->bound->max; const Vector3r& p=pos;
@@ -372,7 +374,7 @@
 					glPushMatrix();
 						glTranslatev(pt);
 						glRotatef(angle*Mathr::RAD_TO_DEG,axis[0],axis[1],axis[2]);
-						shapeDispatcher(b->shape,b->state,/*Body_wire*/ true, viewInfo);
+						shapeDispatcher(b->shape,b->state,/*wire*/ true, viewInfo);
 					glPopMatrix();
 				}
 			}

=== modified file 'pkg/common/RenderingEngine/OpenGLRenderingEngine.hpp'
--- pkg/common/RenderingEngine/OpenGLRenderingEngine.hpp	2010-02-12 01:28:18 +0000
+++ pkg/common/RenderingEngine/OpenGLRenderingEngine.hpp	2010-03-28 21:22:25 +0000
@@ -83,29 +83,43 @@
 	
 	public: void postProcessAttributes(bool deserializing);
 
-	YADE_CLASS_BASE_DOC_ATTRS_CTOR_PY(OpenGLRenderingEngine,Serializable,"Class responsible for rendering scene on OpenGL devices.",
-		((bool,scaleDisplacements,false,"Whether to scale (artificially enlarge) displacements, so that they become better visible"))
-		((Vector3r,displacementScale,Vector3r::ONE,"Relative stretch of current body position from its reference position (independently in 3 dimensions), if scaleDisplacements is set."))
-		((bool,scaleRotations,false,"Whether to scale (artificially enlarge) rotations, so that they become better visible"))
-		((Real,rotationScale,1,"Relative growth of current body rotation from its reference orientation (independently in 3 dimensions), if scaleRotations is set."))
-		((Vector3r,Light_position,Vector3r(75,130,0),"Position of OpenGL light source in the scene."))
-		((Vector3r,Background_color,Vector3r(.2,.2,.2),"Color of the backgroud canvas (RGB)"))
-		((bool,Body_wire,false,"Render all bodies with wire only (faster)"))
-		((bool,Show_DOF,false,"Show which degrees of freedom are blocked for each body"))
-		((bool,Show_ID,false,"Show body id's"))
-		((bool,Body_state,false,"Render body state [deprecated]"))
-		((bool,Body_bounding_volume,false,"Render body bound"))
-		((bool,Body_interacting_geom,true,"Render body shape"))
-		((bool,Interaction_wire,false,"??"))
-		((bool,Interaction_geometry,false,"Render :yref:`geometry of interaction<Interaction::interactionGeometry>`"))
-		((bool,Interaction_physics,false,"Render :yref:`Interaction::interactionPhysics`"))
-		((int,Draw_mask,((void)"draw everything",~0),"Bitmask for showing only bodies where ((Draw_mask & Body::groupMask)!=0)"))
-		((bool,Draw_inside,true,"??"))
+	YADE_CLASS_BASE_DOC_ATTRS_DEPREC_INIT_CTOR_PY(OpenGLRenderingEngine,Serializable,"Class responsible for rendering scene on OpenGL devices.",
+		((Vector3r,dispScale,((void)"disable scaling",Vector3r::ONE),"Artificially enlarge (scale) dispalcements from bodies' :yref:`reference positions<State.refPos>` by this relative amount, so that they become better visible (independently in 3 dimensions). Disbled if (1,1,1)."))
+		((Real,rotScale,((void)"disable scaling",1.),"Artificially enlarge (scale) rotations of bodies relative to their :yref:`reference orientation<State.refOri>`, so the they are better visible."))
+		((Vector3r,lightPos,Vector3r(75,130,0),"Position of OpenGL light source in the scene."))
+		((Vector3r,bgColor,Vector3r(.2,.2,.2),"Color of the backgroud canvas (RGB)"))
+		((bool,wire,false,"Render all bodies with wire only (faster)"))
+		((bool,dof,false,"Show which degrees of freedom are blocked for each body"))
+		((bool,id,false,"Show body id's"))
+		((bool,bound,false,"Render body :yref:`Bound`"))
+		((bool,shape,true,"Render body :yref:`Shape`"))
+		((bool,intrWire,false,"If rendering interactions, use only wires to represent them."))
+		((bool,intrGeom,false,"Render :yref:`Interaction::interactionGeometry` objects."))
+		((bool,intrPhys,false,"Render :yref:`Interaction::interactionPhysics` objects"))
+		((int,mask,((void)"draw everything",~0),"Bitmask for showing only bodies where ((mask & :yref:`Body::mask`)!=0)"))
 		((vector<Se3r>,clipPlaneSe3,vector<Se3r>(numClipPlanes,Se3r(Vector3r::ZERO,Quaternionr::IDENTITY)),"Position and orientation of clipping planes"))
 		((vector<int>,clipPlaneActive,vector<int>(numClipPlanes,0),"Activate/deactivate respective clipping planes"))
 		((size_t,selectBodyLimit,1000,"Limit number of bodies to allow picking body with mouse (performance reasons)"))
 		((bool,intrAllWire,false,"Draw wire for all interactions, blue for potential and green for real ones (mostly for debugging)")),
-		/*ctor*/ ,
+		/*deprec*/
+			((Light_position,lightPos,))
+			((Background_color,bgColor,))
+			((Body_wire,wire,))
+			((Show_DOF,dof,))
+			((Show_ID,id,))
+			((Body_bounding_volume,bound,))
+			((Body_interacting_geom,shape,))
+			((Interaction_wire,intrWire,))
+			((Interaction_geometry,intrGeom,))
+			((Interaction_physics,intrPhys,))
+			((Draw_mask,mask,))
+			((displacementScale,dispScale,))
+			((rotationScale,rotScale,))
+			((scaleDisplacements,id,"! This option is no longer necessary, set dispScale to value different from (1,1,1) to have scaling applied."))
+			((scaleRotations,id,"! This option is no longer necessary, set rotScale to value different from 1.0 to have scaling applied."))
+		,
+		/*init*/,
+		/*ctor*/,
 		/*py*/
 		.def("setRefSe3",&OpenGLRenderingEngine::setBodiesRefSe3,"Make current positions and orientation reference for scaleDisplacements and scaleRotations.");
 	);

=== modified file 'py/pack/pack.py'
--- py/pack/pack.py	2010-03-27 22:18:10 +0000
+++ py/pack/pack.py	2010-03-28 21:22:25 +0000
@@ -115,13 +115,11 @@
 	If threshold is given (>0), then
 
 	* degenerate faces (with edges shorter than threshold) will not be created
-	* gts.Surface().cleanup(threshold) will be called before returning, which merges vertices mutually
-		closer than threshold. In case your pts are closed (last point concident with the first one)
-		this will the surface strip of triangles. If you additionally have capStart==True and capEnd==True,
-		the surface will be closed.
-
-	Note: capStart and capEnd make the most naive polygon triangulation (diagonals) and will perhaps fail
-	for non-convex sections.
+	* gts.Surface().cleanup(threshold) will be called before returning, which merges vertices mutually closer than threshold. In case your pts are closed (last point concident with the first one) this will the surface strip of triangles. If you additionally have capStart==True and capEnd==True, the surface will be closed.
+
+	.. note:: capStart and capEnd make the most naive polygon triangulation (diagonals) and will perhaps fail for non-convex sections.
+
+	.. warning:: the algorithm connects points sequentially; if two polylines are mutually rotated or have inverse sense, the algorithm will not detect it and connect them regardless in their given order.
 	"""
 	if not len(set([len(pts1) for pts1 in pts]))==1: raise RuntimeError("Polylines must be all of the same length!")
 	vtxs=[[gts.Vertex(x,y,z) for x,y,z in pts1] for pts1 in pts]

=== modified file 'py/utils.py'
--- py/utils.py	2010-03-27 22:18:10 +0000
+++ py/utils.py	2010-03-28 21:22:25 +0000
@@ -68,7 +68,9 @@
 	from math import sqrt
 	return radius/sqrt(young/density)
 
-def randomColor(): return Vector3(random.random(),random.random(),random.random())
+def randomColor():
+	"Return random Vector3 with each component in interval 0…1 (uniform distribution)"
+	return Vector3(random.random(),random.random(),random.random())
 
 def typedEngine(name):
 	"""Return first engine from current O.engines, identified by its type (as string). For example:
@@ -87,6 +89,10 @@
 
 
 def defaultMaterial():
+	"""Return default material, when creating bodies with :yref:`yade.utils.sphere` and friends, material is unspecified and there is no shared material defined yet. By default, this function returns::
+
+		FrictMat(density=1e3,young=1e7,poisson=.3,frictionAngle=.5,label='defaultMat')
+	"""
 	return FrictMat(density=1e3,young=1e7,poisson=.3,frictionAngle=.5,label='defaultMat')
 
 def _commonBodySetup(b,volume,geomInertia,material,noBound=False,resetState=True):
@@ -380,12 +386,12 @@
 
 
 def aabbDim(cutoff=0.,centers=False):
-	"""return dimensions of the bounding box, optionally cut."""
+	"""Return dimensions of the axis-aligned bounding box, optionally with relative part *cutoff* cut away."""
 	a=aabbExtrema(cutoff,centers)
 	return (a[1][0]-a[0][0],a[1][1]-a[0][1],a[1][2]-a[0][2])
 
 def aabbExtrema2d(pts):
-	"""return 2d bounding box for a sequence of 2-tuples"""
+	"""Return 2d bounding box for a sequence of 2-tuples."""
 	inf=float('inf')
 	min,max=[inf,inf],[-inf,-inf]
 	for pt in pts:
@@ -396,9 +402,9 @@
 	return tuple(min),tuple(max)
 
 def perpendicularArea(axis):
-	"""return area perpendicular to given axis (0=x,1=y,2=z) generated by bodies
+	"""Return area perpendicular to given axis (0=x,1=y,2=z) generated by bodies
 	for which the function consider returns True (defaults to returning True always)
-	and which is of the type "Sphere"
+	and which is of the type :yref:`Sphere`.
 	"""
 	ext=aabbExtrema()
 	other=((axis+1)%3,(axis+2)%3)
@@ -426,6 +432,7 @@
 	return sum([nums[i]*counts[i] for i in range(len(nums))])/(1.*sum(counts))
 
 def plotNumInteractionsHistogram(cutoff=0.):
+	"Plot histogram with number of interactions per body, optionally cutting away *cutoff* relative axis-aligned box from specimen margin."
 	nums,counts=bodyNumInteractionsHistogram(aabbExtrema(cutoff))
 	import pylab
 	pylab.bar(nums,counts)
@@ -515,13 +522,14 @@
 	if colliderIdx<0: raise RuntimeError("No Collider found within O.engines.")
 	O.engines=O.engines[:colliderIdx]+[colliderEngine]+O.engines[colliderIdx+1:]
 
-def procStatus(name):
+def _procStatus(name):
 	import os
 	for l in open('/proc/%d/status'%os.getpid()):
 		if l.split(':')[0]==name: return l
 	raise "No such line in /proc/[pid]/status: "+name
 def vmData():
-	l=procStatus('VmData'); ll=l.split(); assert(ll[2]=='kB')
+	"Return memory usage data from Linux's /proc/[pid]/status, line VmData."
+	l=_procStatus('VmData'); ll=l.split(); assert(ll[2]=='kB')
 	return int(ll[1])
 
 def uniaxialTestFeatures(filename=None,areaSections=10,**kw):
@@ -576,25 +584,31 @@
 	warnings.warn('Function utils.%s is deprecated, use %s instead.'%(old,new),stacklevel=2,category=DeprecationWarning)
 
 def sumBexForces(*args,**kw):
+	"|ydeprecated|"
 	_deprecatedUtilsFunction('sumBexForces','utils.sumForces')
 	return sumForces(*args,**kw)
 def sumBexTorques(*args,**kw):
+	"|ydeprecated|"
 	_deprecatedUtilsFunction('sumBexTorques','utils.sumTorques')
 	return sumTorques(*args,**kw)
 
 def spheresFromFile(*args,**kw):
+	"|ydeprecated|"
 	_deprecatedUtilsFunction('spheresFromFile','yade.import.text')
 	import yade.ymport
 	return yade.ymport.spheresFromFile(*args,**kw)
 def import_stl_geometry(*args,**kw):
+	"|ydeprecated|"
 	_deprecatedUtilsFunction('import_stl_geometry','yade.import.stl')
 	import yade.ymport
 	return yade.ymport.stl(*args,**kw)
 def import_mesh_geometry(*args,**kw):
+	"|ydeprecated|"
 	_deprecatedUtilsFunction('import_mesh_geometry','yade.import.gmsh')
 	import yade.ymport
 	return yade.ymport.stl(*args,**kw)
 def import_LSMGenGeo_geometry(*args,**kw):
+	"|ydeprecated|"
 	_deprecatedUtilsFunction('import_LSMGenGeo_geometry','yade.import.gengeo')
 	import yade.ymport
 	return yade.ymport.gengeo(*args,**kw)

=== modified file 'py/yadeWrapper/yadeWrapper.cpp'
--- py/yadeWrapper/yadeWrapper.cpp	2010-03-25 13:24:10 +0000
+++ py/yadeWrapper/yadeWrapper.cpp	2010-03-28 21:22:25 +0000
@@ -90,7 +90,7 @@
 	}
 	body_id_t append(shared_ptr<Body> b){
 		// shoud be >=0, but Body is by default created with id 0... :-|
-		if(b->getId()>=0){ PyErr_SetString(PyExc_IndexError,("Body already has id "+lexical_cast<string>(b->getId())+"set; appending such body (for the second time) is not allowed.").c_str()); python::throw_error_already_set(); }
+		if(b->getId()>=0){ PyErr_SetString(PyExc_IndexError,("Body already has id "+lexical_cast<string>(b->getId())+" set; appending such body (for the second time) is not allowed.").c_str()); python::throw_error_already_set(); }
 		return proxee->insert(b);
 	}
 	vector<body_id_t> appendList(vector<shared_ptr<Body> > bb){