-
Notifications
You must be signed in to change notification settings - Fork 0
/
RbxContent.cpp
56 lines (45 loc) · 1.35 KB
/
RbxContent.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/**
* RbxContent.cpp
* Copyright (c) 2013 ROBLOX Corp. All Rights Reserved.
*/
#include "stdafx.h"
#include "RbxContent.h"
// Roblox Headers
#include "util/Http.h"
#include "util/standardout.h"
#include "RobloxGameExplorer.h"
#include "UpdateUIManager.h"
FASTFLAG(StudioEnableGameAnimationsTab)
RbxContent::RbxContent( QObject *parent)
: QObject(parent)
{
}
// Publish Selection To Roblox
QString RbxContent::Upload(const QString &urlQStr)
{
QByteArray ba = urlQStr.toLocal8Bit();
const char *url = ba.data();
bool success = RBX::Http::trustCheck(url);
std::string response;
if(success)
{
try
{
RBX::Http http(url);
http.post(data, RBX::Http::kContentTypeApplicationXml, true, response);
}
catch (std::exception &e)
{
RBX::StandardOut::singleton()->print(RBX::MESSAGE_ERROR, e.what());
return QString("");
}
}
// if we are creating 'new' animation game asset then we will need to reload game explorer
if (FFlag::StudioEnableGameAnimationsTab && !response.empty() &&
urlQStr.contains("uploadnewanimation?assetTypeName=Animation") && urlQStr.contains("isGamesAsset=True"))
{
RobloxGameExplorer& gameExplorer = UpdateUIManager::Instance().getViewWidget<RobloxGameExplorer>(eDW_GAME_EXPLORER);
QMetaObject::invokeMethod(&gameExplorer, "reloadDataFromWeb", Qt::QueuedConnection);
}
return QString::fromStdString(response);
}