yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #11713
[Branch ~yade-pkg/yade/git-trunk] Rev 3550: Add of O.thisScene() function to know in which scene we are
------------------------------------------------------------
revno: 3550
committer: jduriez <jerome.duriez@xxxxxxxxxxx>
timestamp: Mon 2014-12-01 11:20:51 -0700
message:
Add of O.thisScene() function to know in which scene we are
modified:
py/wrapper/yadeWrapper.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 'py/wrapper/yadeWrapper.cpp'
--- py/wrapper/yadeWrapper.cpp 2014-10-15 06:44:01 +0000
+++ py/wrapper/yadeWrapper.cpp 2014-12-01 18:20:51 +0000
@@ -693,6 +693,7 @@
OMEGA.sceneFile=":memory:"+mark;
load(OMEGA.sceneFile,true);
}
+ int thisScene(){return OMEGA.currentSceneNb;}
void save(std::string fileName,bool quiet=false){
assertScene();
@@ -849,6 +850,7 @@
.def("addScene",&pyOmega::addScene,"Add new scene to Omega, returns its number")
.def("switchToScene",&pyOmega::switchToScene,"Switch to defined scene. Default scene has number 0, other scenes have to be created by addScene method.")
.def("switchScene",&pyOmega::switchScene,"Switch to alternative simulation (while keeping the old one). Calling the function again switches back to the first one. Note that most variables from the first simulation will still refer to the first simulation even after the switch\n(e.g. b=O.bodies[4]; O.switchScene(); [b still refers to the body in the first simulation here])")
+ .add_property("thisScene",&pyOmega::thisScene,"Return current scene's id.")
.def("sceneToString",&pyOmega::sceneToString,"Return the entire scene as a string. Equivalent to using O.save(...) except that the scene goes to a string instead of a file. (see also stringToScene())")
.def("stringToScene",&pyOmega::stringToScene,(py::arg("mark")=""),"Load simulation from a string passed as argument (see also sceneToString).")
.def("labeledEngine",&pyOmega::labeled_engine_get,"Return instance of engine/functor with the given label. This function shouldn't be called by the user directly; every ehange in O.engines will assign respective global python variables according to labels.\n\nFor example:\n\n\t *O.engines=[InsertionSortCollider(label='collider')]*\n\n\t *collider.nBins=5 # collider has become a variable after assignment to O.engines automatically*")
Follow ups