Skip to content

Commit 3be582a

Browse files
committed
#3423 Add Lua as Compile Target in Viewer Script Editor
1 parent 9bdb4eb commit 3be582a

15 files changed

+318
-317
lines changed

indra/llmessage/message_prehash.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,8 @@ char const* const _PREHASH_FirstName = LLMessageStringTable::getInstance()->getS
714714
char const* const _PREHASH_AttachedSoundGainChange = LLMessageStringTable::getInstance()->getString("AttachedSoundGainChange");
715715
char const* const _PREHASH_LocationID = LLMessageStringTable::getInstance()->getString("LocationID");
716716
char const* const _PREHASH_Running = LLMessageStringTable::getInstance()->getString("Running");
717+
char const* const _PREHASH_Mono = LLMessageStringTable::getInstance()->getString("Mono");
718+
char const* const _PREHASH_CompileTarget = LLMessageStringTable::getInstance()->getString("CompileTarget");
717719
char const* const _PREHASH_AgentThrottle = LLMessageStringTable::getInstance()->getString("AgentThrottle");
718720
char const* const _PREHASH_NeighborList = LLMessageStringTable::getInstance()->getString("NeighborList");
719721
char const* const _PREHASH_PathTaperX = LLMessageStringTable::getInstance()->getString("PathTaperX");

indra/llmessage/message_prehash.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,8 @@ extern char const* const _PREHASH_FirstName;
714714
extern char const* const _PREHASH_AttachedSoundGainChange;
715715
extern char const* const _PREHASH_LocationID;
716716
extern char const* const _PREHASH_Running;
717+
extern char const* const _PREHASH_Mono;
718+
extern char const* const _PREHASH_CompileTarget;
717719
extern char const* const _PREHASH_AgentThrottle;
718720
extern char const* const _PREHASH_NeighborList;
719721
extern char const* const _PREHASH_PathTaperX;

indra/llui/llcombobox.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,21 @@ void LLComboBox::resetDirty()
246246
}
247247
}
248248

249-
bool LLComboBox::itemExists(const std::string& name)
249+
bool LLComboBox::itemExists(const std::string& name) const
250250
{
251251
return mList->getItemByLabel(name);
252252
}
253253

254+
bool LLComboBox::valueExists(const std::string& value) const
255+
{
256+
return mList->getItemByValue(value);
257+
}
258+
259+
LLScrollListItem* LLComboBox::findItemByValue(const std::string& value) const
260+
{
261+
return mList->getItemByValue(value);
262+
}
263+
254264
std::vector<LLScrollListItem*> LLComboBox::getAllData() const
255265
{
256266
return mList->getAllData();

indra/llui/llcombobox.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,9 @@ class LLComboBox
143143
LLScrollListItem* addSeparator(EAddPosition pos = ADD_BOTTOM);
144144
bool remove( S32 index ); // remove item by index, return true if found and removed
145145
void removeall() { clearRows(); }
146-
bool itemExists(const std::string& name);
146+
bool itemExists(const std::string& name) const;
147+
bool valueExists(const std::string& value) const;
148+
LLScrollListItem* findItemByValue(const std::string& value) const;
147149
std::vector<LLScrollListItem*> getAllData() const;
148150

149151
void sortByName(bool ascending = true); // Sort the entries in the combobox by name

indra/llui/llscrolllistctrl.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,6 +1281,19 @@ LLScrollListItem* LLScrollListCtrl::getItemByLabel(const std::string& label, boo
12811281
return NULL;
12821282
}
12831283

1284+
LLScrollListItem* LLScrollListCtrl::getItemByValue(const std::string& value)
1285+
{
1286+
for (LLScrollListItem* item : mItemList)
1287+
{
1288+
if (item->getValue().asString() == value)
1289+
{
1290+
return item;
1291+
}
1292+
}
1293+
1294+
return NULL;
1295+
}
1296+
12841297
LLScrollListItem* LLScrollListCtrl::getItemByIndex(S32 index)
12851298
{
12861299
if (index >= 0 && index < (S32)mItemList.size())

indra/llui/llscrolllistctrl.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,8 @@ class LLScrollListCtrl : public LLUICtrl, public LLEditMenuHandler,
262262
bool selectItemByLabel(const std::string& item, bool case_sensitive = true, S32 column = 0); // false if item not found
263263
bool selectItemByPrefix(const std::string& target, bool case_sensitive = true, S32 column = -1);
264264
bool selectItemByPrefix(const LLWString& target, bool case_sensitive = true, S32 column = -1);
265-
LLScrollListItem* getItemByLabel(const std::string& item, bool case_sensitive = true, S32 column = 0);
265+
LLScrollListItem* getItemByLabel(const std::string& label, bool case_sensitive = true, S32 column = 0);
266+
LLScrollListItem* getItemByValue(const std::string& value);
266267
LLScrollListItem* getItemByIndex(S32 index);
267268
std::string getSelectedItemLabel(S32 column = 0) const;
268269
LLSD getSelectedValue();

indra/newview/llcompilequeue.cpp

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ namespace
122122
class LLQueuedScriptAssetUpload : public LLScriptAssetUpload
123123
{
124124
public:
125-
LLQueuedScriptAssetUpload(LLUUID taskId, LLUUID itemId, LLUUID assetId, TargetType_t targetType,
125+
LLQueuedScriptAssetUpload(LLUUID taskId, LLUUID itemId, LLUUID assetId, std::string compileTarget,
126126
bool isRunning, std::string scriptName, LLUUID queueId, LLUUID exerienceId, taskUploadFinish_f finish) :
127-
LLScriptAssetUpload(taskId, itemId, targetType, isRunning,
127+
LLScriptAssetUpload(taskId, itemId, compileTarget, isRunning,
128128
exerienceId, std::string(), finish, nullptr),
129129
mScriptName(scriptName),
130130
mQueueId(queueId)
@@ -183,9 +183,7 @@ struct LLScriptQueueData
183183

184184
// Default constructor
185185
LLFloaterScriptQueue::LLFloaterScriptQueue(const LLSD& key) :
186-
LLFloater(key),
187-
mDone(false),
188-
mMono(false)
186+
LLFloater(key)
189187
{
190188

191189
}
@@ -197,7 +195,7 @@ LLFloaterScriptQueue::~LLFloaterScriptQueue()
197195

198196
bool LLFloaterScriptQueue::postBuild()
199197
{
200-
childSetAction("close",onCloseBtn,this);
198+
childSetAction("close", onCloseBtn, this);
201199
getChildView("close")->setEnabled(false);
202200
setVisible(true);
203201
return true;
@@ -222,8 +220,8 @@ bool LLFloaterScriptQueue::start()
222220

223221
LLStringUtil::format_map_t args;
224222
args["[START]"] = mStartString;
225-
args["[COUNT]"] = llformat ("%d", mObjectList.size());
226-
buffer = getString ("Starting", args);
223+
args["[COUNT]"] = llformat("%d", mObjectList.size());
224+
buffer = getString("Starting", args);
227225

228226
getChild<LLScrollListCtrl>("queue output")->addSimpleElement(buffer, ADD_BOTTOM);
229227

@@ -276,8 +274,8 @@ bool LLFloaterCompileQueue::hasExperience( const LLUUID& id ) const
276274
return mExperienceIds.find(id) != mExperienceIds.end();
277275
}
278276

279-
// //Attempt to record this asset ID. If it can not be inserted into the set
280-
// //then it has already been processed so return false.
277+
// Attempt to record this asset ID. If it can not be inserted into the set
278+
// then it has already been processed so return false.
281279

282280
void LLFloaterCompileQueue::handleHTTPResponse(std::string pumpName, const LLSD &expresult)
283281
{
@@ -359,7 +357,7 @@ bool LLFloaterCompileQueue::processScript(LLHandle<LLFloaterCompileQueue> hfloat
359357
LLCheckedHandle<LLFloaterCompileQueue> floater(hfloater);
360358
// Dereferencing floater may fail. If they do they throw LLExeceptionStaleHandle.
361359
// which is caught in objectScriptProcessingQueueCoro
362-
bool monocompile = floater->mMono;
360+
std::string compile_target = floater->mCompileTarget;
363361

364362
// Initial test to see if we can (or should) attempt to compile the script.
365363
LLInventoryItem *item = dynamic_cast<LLInventoryItem *>(inventory);
@@ -470,7 +468,7 @@ bool LLFloaterCompileQueue::processScript(LLHandle<LLFloaterCompileQueue> hfloat
470468
LLResourceUploadInfo::ptr_t uploadInfo(new LLQueuedScriptAssetUpload(object->getID(),
471469
inventory->getUUID(),
472470
assetId,
473-
monocompile ? LLScriptAssetUpload::MONO : LLScriptAssetUpload::LSL2,
471+
compile_target,
474472
true,
475473
inventory->getName(),
476474
LLUUID(),

indra/newview/llcompilequeue.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class LLFloaterScriptQueue : public LLFloater/*, public LLVOInventoryListener*/
5555

5656
/*virtual*/ bool postBuild();
5757

58-
void setMono(bool mono) { mMono = mono; }
58+
void setCompileTarget(std::string target) { mCompileTarget = target; }
5959

6060
// addObject() accepts an object id.
6161
void addObject(const LLUUID& id, std::string name);
@@ -80,8 +80,8 @@ class LLFloaterScriptQueue : public LLFloater/*, public LLVOInventoryListener*/
8080

8181
protected:
8282
// UI
83-
LLScrollListCtrl* mMessages;
84-
LLButton* mCloseBtn;
83+
LLScrollListCtrl* mMessages { nullptr };
84+
LLButton* mCloseBtn { nullptr };
8585

8686
// Object Queue
8787
struct ObjectData
@@ -93,14 +93,13 @@ class LLFloaterScriptQueue : public LLFloater/*, public LLVOInventoryListener*/
9393

9494
object_data_list_t mObjectList;
9595
LLUUID mCurrentObjectID;
96-
bool mDone;
96+
bool mDone { false };
9797

9898
std::string mStartString;
99-
bool mMono;
99+
std::string mCompileTarget { "lsl2" };
100100

101101
typedef boost::function<bool(const LLPointer<LLViewerObject> &, LLInventoryObject*, LLEventPump &)> fnQueueAction_t;
102102
static void objectScriptProcessingQueueCoro(std::string action, LLHandle<LLFloaterScriptQueue> hfloater, object_data_list_t objectList, fnQueueAction_t func);
103-
104103
};
105104

106105
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)