Trouble with: > Script.getExternalPath(Script.ExternalPaths.Assets, "hi") [UncaughtException evaluate] Error: cannot call getExternalPath(): argument 1 has unknown type `ExternalResource::Bucket' (register the type with qScriptRegisterMetaType()) in about:console:1 [Backtrace] <global>() at about:console:1 TypeError: cannot call getExternalPath(): argument 1 has unknown type `ExternalResource::Bucket' (register the type with qScriptRegisterMetaType())
Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 6 files). Show all
Unified · Split
| @@ -769,6 +769,7 @@ void ScriptEngine::init() { · 768 unmodified lines | |||
| 769 | require.setProperty("resolve", resolve, READONLY_PROP_FLAGS); | 769 | require.setProperty("resolve", resolve, READONLY_PROP_FLAGS); |
| 770 | resetModuleCache(); | 770 | resetModuleCache(); |
| 771 | } | 771 | } |
| 772 | registerEnum("Script.ExternalPaths", QMetaEnum::fromType<ExternalResource::Bucket>()); | ||
| 772 | 773 | ||
| 773 | registerGlobalObject("Audio", DependencyManager::get<AudioScriptingInterface>().data()); | 774 | registerGlobalObject("Audio", DependencyManager::get<AudioScriptingInterface>().data()); |
| 774 | 775 | ||
| @@ -2869,3 +2870,7 @@ void ScriptEngine::callEntityScriptMethod(const EntityItemID& entityID, const QS · 2094 unmodified lines | |||
| 2869 | } | 2870 | } |
| 2870 | } | 2871 | } |
| 2871 | } | 2872 | } |
| 2873 | |||
| 2874 | QString ScriptEngine::getExternalPath(ExternalResource::Bucket bucket, const QString &relative_path) { | ||
| 2875 | return ExternalResource::getInstance()->getUrl(bucket, relative_path); | ||
| 2876 | } | ||