← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 3457: reset id of erased bodies; enabling this: b=Body(); O.bodies.erase(O.bodies.append(b)); O.bodies....

 

------------------------------------------------------------
revno: 3457
committer: Bruno Chareyre <bruno.chareyre@xxxxxxxxxxx>
timestamp: Thu 2014-10-09 22:31:35 +0200
message:
  reset id of erased bodies; enabling this: b=Body(); O.bodies.erase(O.bodies.append(b)); O.bodies.append(b)
modified:
  core/BodyContainer.cpp


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

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== modified file 'core/BodyContainer.cpp'
--- core/BodyContainer.cpp	2014-09-01 09:53:04 +0000
+++ core/BodyContainer.cpp	2014-10-09 20:31:35 +0000
@@ -58,6 +58,7 @@
 	for(Body::MapId2IntrT::iterator it=b->intrs.begin(),end=b->intrs.end(); it!=end; ++it) {  //Iterate over all body's interactions
 		scene->interactions->requestErase((*it).second);
 	}
+	b->id=-1;//else it sits in the python scope without a chance to be inserted again
 	body[id].reset();
 	return true;
 }