History

more work on script engine

Brad Hefta-Gaub committed 11 years ago

Commit 94b273a1 parent a3c02886 files · +24 −27Browse files

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

Unified · Split

libraries/script-engine/src/ScriptEngine.cpp+18−0
@@ -999,6 +999,24 @@ void ScriptEngine::unloadEntityScript(const EntityItemID& entityID) { · 998 unmodified lines
999 }999 }
1000}1000}
1001 1001
1002void ScriptEngine::unloadAllEntityScripts() {
1003 if (QThread::currentThread() != thread()) {
1004#ifdef THREAD_DEBUGGING
1005 qDebug() << "*** WARNING *** ScriptEngine::unloadAllEntityScripts() called on wrong thread [" << QThread::currentThread() << "], invoking on correct thread [" << thread() << "]";
1006#endif
1007
1008 QMetaObject::invokeMethod(this, "unloadAllEntityScripts");
1009 return;
1010 }
1011#ifdef THREAD_DEBUGGING
1012 qDebug() << "ScriptEngine::unloadAllEntityScripts() called on correct thread [" << thread() << "]";
1013#endif
1014 foreach(const EntityItemID& entityID, _entityScripts.keys()) {
1015 callEntityScriptMethod(entityID, "unload");
1016 }
1017 _entityScripts.clear();
1018}
1019
1002void ScriptEngine::callEntityScriptMethod(const EntityItemID& entityID, const QString& methodName) {1020void ScriptEngine::callEntityScriptMethod(const EntityItemID& entityID, const QString& methodName) {
1003 if (QThread::currentThread() != thread()) {1021 if (QThread::currentThread() != thread()) {
1004 #ifdef THREAD_DEBUGGING1022 #ifdef THREAD_DEBUGGING