History

overload a single function and cleanup, add examples

James B. Pollack committed 11 years ago

Commit e928c821 parent 3cee5697 files · +92 −44Browse files

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

Unified · Split

libraries/script-engine/src/ScriptEngine.cpp+0−31
@@ -1170,37 +1170,6 @@ void ScriptEngine::refreshFileScript(const EntityItemID& entityID) { · 1169 unmodified lines
1170 recurseGuard = false;1170 recurseGuard = false;
1171}1171}
1172 1172
1173
1174void ScriptEngine::callEntityScriptMethod(const EntityItemID& entityID, const QString& methodName) {
1175 if (QThread::currentThread() != thread()) {
1176 #ifdef THREAD_DEBUGGING
1177 qDebug() << "*** WARNING *** ScriptEngine::callEntityScriptMethod() called on wrong thread [" << QThread::currentThread() << "], invoking on correct thread [" << thread() << "] "
1178 "entityID:" << entityID << "methodName:" << methodName;
1179 #endif
1180
1181 QMetaObject::invokeMethod(this, "callEntityScriptMethod",
1182 Q_ARG(const EntityItemID&, entityID),
1183 Q_ARG(const QString&, methodName));
1184 return;
1185 }
1186 #ifdef THREAD_DEBUGGING
1187 qDebug() << "ScriptEngine::callEntityScriptMethod() called on correct thread [" << thread() << "] "
1188 "entityID:" << entityID << "methodName:" << methodName;
1189 #endif
1190
1191 refreshFileScript(entityID);
1192 if (_entityScripts.contains(entityID)) {
1193 EntityScriptDetails details = _entityScripts[entityID];
1194 QScriptValue entityScript = details.scriptObject; // previously loaded
1195 if (entityScript.property(methodName).isFunction()) {
1196 QScriptValueList args;
1197 args << entityID.toScriptValue(this);
1198 entityScript.property(methodName).call(entityScript, args);
1199 }
1200
1201 }
1202}
1203
1204void ScriptEngine::callEntityScriptMethod(const EntityItemID& entityID, const QString& methodName, const QStringList& params) {1173void ScriptEngine::callEntityScriptMethod(const EntityItemID& entityID, const QString& methodName, const QStringList& params) {
1205 if (QThread::currentThread() != thread()) {1174 if (QThread::currentThread() != thread()) {
1206 #ifdef THREAD_DEBUGGING1175 #ifdef THREAD_DEBUGGING

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t