StelScriptMgr.cpp   StelScriptMgr.cpp 
skipping to change at line 96 skipping to change at line 96
qScriptRegisterMetaType(&engine, vec3fToScriptValue, vec3fFromScript Value); qScriptRegisterMetaType(&engine, vec3fToScriptValue, vec3fFromScript Value);
// Constructor // Constructor
QScriptValue ctor = engine.newFunction(createVec3f); QScriptValue ctor = engine.newFunction(createVec3f);
engine.globalObject().setProperty("Vec3f", ctor); engine.globalObject().setProperty("Vec3f", ctor);
// Add the core object to access methods related to core // Add the core object to access methods related to core
mainAPI = new StelMainScriptAPI(this); mainAPI = new StelMainScriptAPI(this);
QScriptValue objectValue = engine.newQObject(mainAPI); QScriptValue objectValue = engine.newQObject(mainAPI);
engine.globalObject().setProperty("core", objectValue); engine.globalObject().setProperty("core", objectValue);
engine.evaluate("function mywait__(sleepDurationSec) {"
"if (sleepDurationSec<0) return;"
"var date = new Date();"
"var curDate = null;"
"do {curDate = new Date();}"
"while(curDate-date < sleepDurationSec*1000/scriptRa
teReadOnly);}");
engine.evaluate("core['wait'] = mywait__;");
engine.evaluate("function mywaitFor__(dt, spec) {"
"if (!spec) spec=\"utc\";"
"var deltaJD = core.jdFromDateString(dt, spec) - cor
e.getJDay();"
"var timeSpeed = core.getTimeRate();"
"if (timeSpeed == 0.) {core.debug(\"waitFor called w
ith no time passing - would be infinite. not waiting!\"); return;}"
"var date = new Date();"
"var curDate = null;"
"do {curDate = new Date();}"
"while(curDate-date < deltaJD*86400000/timeSpeed);}"
);
engine.evaluate("core['waitFor'] = mywaitFor__;");
// Add other classes which we want to be directly accessible from sc ripts // Add other classes which we want to be directly accessible from sc ripts
if(StelSkyLayerMgr* smgr = GETSTELMODULE(StelSkyLayerMgr)) if(StelSkyLayerMgr* smgr = GETSTELMODULE(StelSkyLayerMgr))
objectValue = engine.newQObject(smgr); objectValue = engine.newQObject(smgr);
// For accessing star scale, twinkle etc. // For accessing star scale, twinkle etc.
objectValue = engine.newQObject(StelApp::getInstance().getCore()->ge tSkyDrawer()); objectValue = engine.newQObject(StelApp::getInstance().getCore()->ge tSkyDrawer());
engine.globalObject().setProperty("StelSkyDrawer", objectValue); engine.globalObject().setProperty("StelSkyDrawer", objectValue);
setScriptRate(1.0); setScriptRate(1.0);
 End of changes. 1 change blocks. 
24 lines changed or deleted 0 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/