History

Merge branch 'master' of https://github.com/highfidelity/hifi into script-timer

Stephen Birarda committed 12 years ago

Commit d9cfaec2 parents a7f2406 8797c3536 files · +239 −183Browse files

Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 36 files). Show all

Unified · Split

libraries/script-engine/src/ScriptEngine.cpp+24−2
@@ -40,7 +40,8 @@ static QScriptValue soundConstructor(QScriptContext* context, QScriptEngine* eng · 39 unmodified lines
40}40}
41 41
42 42
43ScriptEngine::ScriptEngine(const QString& scriptContents, bool wantMenuItems, const QString& fileNameString, AbstractMenuInterface* menu,43ScriptEngine::ScriptEngine(const QString& scriptContents, bool wantMenuItems, const QString& fileNameString,
44 AbstractMenuInterface* menu,
44 AbstractControllerScriptingInterface* controllerScriptingInterface) :45 AbstractControllerScriptingInterface* controllerScriptingInterface) :
45 _isAvatar(false),46 _isAvatar(false),
46 _dataServerScriptingInterface(),47 _dataServerScriptingInterface(),
@@ -137,7 +138,7 @@ void ScriptEngine::init() { · 90 unmodified lines
137 QScriptValue timerValue = _engine.scriptValueFromQMetaObject<QTimer>();138 QScriptValue timerValue = _engine.scriptValueFromQMetaObject<QTimer>();
138 _engine.globalObject().setProperty("Timer", timerValue);139 _engine.globalObject().setProperty("Timer", timerValue);
139 140
140 registerGlobalObject("Agent", this);141 registerGlobalObject("Script", this);
141 registerGlobalObject("Audio", &_audioScriptingInterface);142 registerGlobalObject("Audio", &_audioScriptingInterface);
142 registerGlobalObject("Controller", _controllerScriptingInterface);143 registerGlobalObject("Controller", _controllerScriptingInterface);
143 registerGlobalObject("Data", &_dataServerScriptingInterface);144 registerGlobalObject("Data", &_dataServerScriptingInterface);
@@ -264,6 +265,27 @@ void ScriptEngine::run() { · 120 unmodified lines
264 }265 }
265 }266 }
266 emit scriptEnding();267 emit scriptEnding();
268
269 if (_voxelsScriptingInterface.getVoxelPacketSender()->serversExist()) {
270 // release the queue of edit voxel messages.
271 _voxelsScriptingInterface.getVoxelPacketSender()->releaseQueuedMessages();
272
273 // since we're in non-threaded mode, call process so that the packets are sent
274 if (!_voxelsScriptingInterface.getVoxelPacketSender()->isThreaded()) {
275 _voxelsScriptingInterface.getVoxelPacketSender()->process();
276 }
277 }
278
279 if (_particlesScriptingInterface.getParticlePacketSender()->serversExist()) {
280 // release the queue of edit voxel messages.
281 _particlesScriptingInterface.getParticlePacketSender()->releaseQueuedMessages();
282
283 // since we're in non-threaded mode, call process so that the packets are sent
284 if (!_particlesScriptingInterface.getParticlePacketSender()->isThreaded()) {
285 _particlesScriptingInterface.getParticlePacketSender()->process();
286 }
287 }
288
267 cleanMenuItems();289 cleanMenuItems();
268 290
269 // If we were on a thread, then wait till it's done291 // If we were on a thread, then wait till it's done