Showing the changes to interface/src/scripting/AssetMappingsScriptingInterface.cpp (1 of 1 file). Show all
Unified · Split
| @@ -105,6 +105,25 @@ void AssetMappingsScriptingInterface::uploadFile(QString path, QString mapping, · 104 unmodified lines | |||
| 105 | 105 | ||
| 106 | startedCallback.call(); | 106 | startedCallback.call(); |
| 107 | 107 | ||
| 108 | QFile file { path }; | ||
| 109 | int64_t size { 0 }; | ||
| 110 | if (file.open(QIODevice::ReadOnly)) { | ||
| 111 | size = file.size(); | ||
| 112 | file.close(); | ||
| 113 | } | ||
| 114 | |||
| 115 | QString extension = ""; | ||
| 116 | auto idx = path.lastIndexOf("."); | ||
| 117 | if (idx) { | ||
| 118 | extension = path.mid(idx + 1); | ||
| 119 | } | ||
| 120 | |||
| 121 | UserActivityLogger::getInstance().logAction("uploading_asset", { | ||
| 122 | { "size", size }, | ||
| 123 | { "mapping", mapping }, | ||
| 124 | { "extension", extension} | ||
| 125 | }); | ||
| 126 | |||
| 108 | auto upload = DependencyManager::get<AssetClient>()->createUpload(path); | 127 | auto upload = DependencyManager::get<AssetClient>()->createUpload(path); |
| 109 | QObject::connect(upload, &AssetUpload::finished, this, [=](AssetUpload* upload, const QString& hash) mutable { | 128 | QObject::connect(upload, &AssetUpload::finished, this, [=](AssetUpload* upload, const QString& hash) mutable { |
| 110 | if (upload->getError() != AssetUpload::NoError) { | 129 | if (upload->getError() != AssetUpload::NoError) { |