1574 lines · 67.4 KB · C++
RawDownload
        if (entityScript.property(methodName).isFunction()) {            QScriptValueList args;            args << entityID.toScriptValue(this);            args << qScriptValueFromSequence(this, params);            callWithEnvironment(entityID, details.definingSandboxURL, entityScript.property(methodName), entityScript, args);        }     }} void ScriptEngine::callEntityScriptMethod(const EntityItemID& entityID, const QString& methodName, const MouseEvent& event) {    if (QThread::currentThread() != thread()) {#ifdef THREAD_DEBUGGING        qDebug() << "*** WARNING *** ScriptEngine::callEntityScriptMethod() called on wrong thread [" << QThread::currentThread() << "], invoking on correct thread [" << thread() << "]  "            "entityID:" << entityID << "methodName:" << methodName << "event: mouseEvent";#endif         QMetaObject::invokeMethod(this, "callEntityScriptMethod",                                  Q_ARG(const EntityItemID&, entityID),                                  Q_ARG(const QString&, methodName),                                  Q_ARG(const MouseEvent&, event));        return;    }#ifdef THREAD_DEBUGGING    qDebug() << "ScriptEngine::callEntityScriptMethod() called on correct thread [" << thread() << "]  "        "entityID:" << entityID << "methodName:" << methodName << "event: mouseEvent";#endif     refreshFileScript(entityID);    if (_entityScripts.contains(entityID)) {        EntityScriptDetails details = _entityScripts[entityID];        QScriptValue entityScript = details.scriptObject; // previously loaded        if (entityScript.property(methodName).isFunction()) {            QScriptValueList args;            args << entityID.toScriptValue(this);            args << event.toScriptValue(this);            callWithEnvironment(entityID, details.definingSandboxURL, entityScript.property(methodName), entityScript, args);        }    }}  void ScriptEngine::callEntityScriptMethod(const EntityItemID& entityID, const QString& methodName, const EntityItemID& otherID, const Collision& collision) {    if (QThread::currentThread() != thread()) {#ifdef THREAD_DEBUGGING        qDebug() << "*** WARNING *** ScriptEngine::callEntityScriptMethod() called on wrong thread [" << QThread::currentThread() << "], invoking on correct thread [" << thread() << "]  "            "entityID:" << entityID << "methodName:" << methodName << "otherID:" << otherID << "collision: collision";#endif         QMetaObject::invokeMethod(this, "callEntityScriptMethod",                                  Q_ARG(const EntityItemID&, entityID),                                  Q_ARG(const QString&, methodName),                                  Q_ARG(const EntityItemID&, otherID),                                  Q_ARG(const Collision&, collision));        return;    }#ifdef THREAD_DEBUGGING    qDebug() << "ScriptEngine::callEntityScriptMethod() called on correct thread [" << thread() << "]  "        "entityID:" << entityID << "methodName:" << methodName << "otherID:" << otherID << "collision: collision";#endif        refreshFileScript(entityID);    if (_entityScripts.contains(entityID)) {        EntityScriptDetails details = _entityScripts[entityID];        QScriptValue entityScript = details.scriptObject; // previously loaded        if (entityScript.property(methodName).isFunction()) {            QScriptValueList args;            args << entityID.toScriptValue(this);            args << otherID.toScriptValue(this);            args << collisionToScriptValue(this, collision);            callWithEnvironment(entityID, details.definingSandboxURL, entityScript.property(methodName), entityScript, args);        }    }}

Lines 1501–1574 of 1574. Previous lines