Showing the changes to libraries/script-engine/src/ScriptManager.cpp (1 of 63 files). Show all
Unified · Split
| @@ -538,8 +538,9 @@ static ScriptValue scriptableResourceToScriptValue(ScriptEngine* engine, · 537 unmodified lines | ||
| 538 | 538 | return object; |
| 539 | 539 | } |
| 540 | 540 | |
| 541 | −static void scriptableResourceFromScriptValue(const ScriptValue& value, ScriptableResourceRawPtr& resource) { | |
| 541 | +static bool scriptableResourceFromScriptValue(const ScriptValue& value, ScriptableResourceRawPtr& resource) { | |
| 542 | 542 | resource = static_cast<ScriptableResourceRawPtr>(value.toQObject()); |
| 543 | + return true; | |
| 543 | 544 | } |
| 544 | 545 | |
| 545 | 546 | /*@jsdoc |
| @@ -578,8 +579,9 @@ ScriptValue externalResourceBucketToScriptValue(ScriptEngine* engine, ExternalRe · 32 unmodified lines | ||
| 578 | 579 | return engine->newValue((int)in); |
| 579 | 580 | } |
| 580 | 581 | |
| 581 | −void externalResourceBucketFromScriptValue(const ScriptValue& object, ExternalResource::Bucket& out) { | |
| 582 | +bool externalResourceBucketFromScriptValue(const ScriptValue& object, ExternalResource::Bucket& out) { | |
| 582 | 583 | out = static_cast<ExternalResource::Bucket>(object.toInt32()); |
| 584 | + return true; | |
| 583 | 585 | } |
| 584 | 586 | |
| 585 | 587 | void ScriptManager::resetModuleCache(bool deleteScriptCache) { |
| @@ -722,6 +724,11 @@ void ScriptManager::init() { · 136 unmodified lines | ||
| 722 | 724 | })); |
| 723 | 725 | } |
| 724 | 726 | |
| 727 | +// registers a global object by name | |
| 728 | +void ScriptManager::registerValue(const QString& valueName, ScriptValue value) { | |
| 729 | + _engine->globalObject().setProperty(valueName, value); | |
| 730 | +} | |
| 731 | + | |
| 725 | 732 | // Unregister the handlers for this eventName and entityID. |
| 726 | 733 | void ScriptManager::removeEventHandler(const EntityItemID& entityID, const QString& eventName, const ScriptValue& handler) { |
| 727 | 734 | if (QThread::currentThread() != thread()) { |