Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#3423 Add Lua as Compile Target in Viewer Script Editor #3467

Open
wants to merge 1 commit into
base: project/lua
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions indra/llmessage/message_prehash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,8 @@ char const* const _PREHASH_FirstName = LLMessageStringTable::getInstance()->getS
char const* const _PREHASH_AttachedSoundGainChange = LLMessageStringTable::getInstance()->getString("AttachedSoundGainChange");
char const* const _PREHASH_LocationID = LLMessageStringTable::getInstance()->getString("LocationID");
char const* const _PREHASH_Running = LLMessageStringTable::getInstance()->getString("Running");
char const* const _PREHASH_Mono = LLMessageStringTable::getInstance()->getString("Mono");
char const* const _PREHASH_CompileTarget = LLMessageStringTable::getInstance()->getString("CompileTarget");
char const* const _PREHASH_AgentThrottle = LLMessageStringTable::getInstance()->getString("AgentThrottle");
char const* const _PREHASH_NeighborList = LLMessageStringTable::getInstance()->getString("NeighborList");
char const* const _PREHASH_PathTaperX = LLMessageStringTable::getInstance()->getString("PathTaperX");
Expand Down
2 changes: 2 additions & 0 deletions indra/llmessage/message_prehash.h
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,8 @@ extern char const* const _PREHASH_FirstName;
extern char const* const _PREHASH_AttachedSoundGainChange;
extern char const* const _PREHASH_LocationID;
extern char const* const _PREHASH_Running;
extern char const* const _PREHASH_Mono;
extern char const* const _PREHASH_CompileTarget;
extern char const* const _PREHASH_AgentThrottle;
extern char const* const _PREHASH_NeighborList;
extern char const* const _PREHASH_PathTaperX;
Expand Down
17 changes: 16 additions & 1 deletion indra/llui/llcombobox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,26 @@ void LLComboBox::resetDirty()
}
}

bool LLComboBox::itemExists(const std::string& name)
bool LLComboBox::itemExists(const std::string& name) const
{
return mList->getItemByLabel(name);
}

bool LLComboBox::valueExists(const std::string& value) const
{
return mList->getItemByValue(value);
}

LLScrollListItem* LLComboBox::findItemByValue(const std::string& value) const
{
return mList->getItemByValue(value);
}

std::vector<LLScrollListItem*> LLComboBox::getAllData() const
{
return mList->getAllData();
}

// add item "name" to menu
LLScrollListItem* LLComboBox::add(const std::string& name, EAddPosition pos, bool enabled)
{
Expand Down
5 changes: 4 additions & 1 deletion indra/llui/llcombobox.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,10 @@ class LLComboBox
LLScrollListItem* addSeparator(EAddPosition pos = ADD_BOTTOM);
bool remove( S32 index ); // remove item by index, return true if found and removed
void removeall() { clearRows(); }
bool itemExists(const std::string& name);
bool itemExists(const std::string& name) const;
bool valueExists(const std::string& value) const;
LLScrollListItem* findItemByValue(const std::string& value) const;
std::vector<LLScrollListItem*> getAllData() const;

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

Expand Down
13 changes: 13 additions & 0 deletions indra/llui/llscrolllistctrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1281,6 +1281,19 @@ LLScrollListItem* LLScrollListCtrl::getItemByLabel(const std::string& label, boo
return NULL;
}

LLScrollListItem* LLScrollListCtrl::getItemByValue(const std::string& value)
{
for (LLScrollListItem* item : mItemList)
{
if (item->getValue().asString() == value)
{
return item;
}
}

return NULL;
}

LLScrollListItem* LLScrollListCtrl::getItemByIndex(S32 index)
{
if (index >= 0 && index < (S32)mItemList.size())
Expand Down
3 changes: 2 additions & 1 deletion indra/llui/llscrolllistctrl.h
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,8 @@ class LLScrollListCtrl : public LLUICtrl, public LLEditMenuHandler,
bool selectItemByLabel(const std::string& item, bool case_sensitive = true, S32 column = 0); // false if item not found
bool selectItemByPrefix(const std::string& target, bool case_sensitive = true, S32 column = -1);
bool selectItemByPrefix(const LLWString& target, bool case_sensitive = true, S32 column = -1);
LLScrollListItem* getItemByLabel(const std::string& item, bool case_sensitive = true, S32 column = 0);
LLScrollListItem* getItemByLabel(const std::string& label, bool case_sensitive = true, S32 column = 0);
LLScrollListItem* getItemByValue(const std::string& value);
LLScrollListItem* getItemByIndex(S32 index);
std::string getSelectedItemLabel(S32 column = 0) const;
LLSD getSelectedValue();
Expand Down
22 changes: 10 additions & 12 deletions indra/newview/llcompilequeue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ namespace
class LLQueuedScriptAssetUpload : public LLScriptAssetUpload
{
public:
LLQueuedScriptAssetUpload(LLUUID taskId, LLUUID itemId, LLUUID assetId, TargetType_t targetType,
LLQueuedScriptAssetUpload(LLUUID taskId, LLUUID itemId, LLUUID assetId, std::string compileTarget,
bool isRunning, std::string scriptName, LLUUID queueId, LLUUID exerienceId, taskUploadFinish_f finish) :
LLScriptAssetUpload(taskId, itemId, targetType, isRunning,
LLScriptAssetUpload(taskId, itemId, compileTarget, isRunning,
exerienceId, std::string(), finish, nullptr),
mScriptName(scriptName),
mQueueId(queueId)
Expand Down Expand Up @@ -183,9 +183,7 @@ struct LLScriptQueueData

// Default constructor
LLFloaterScriptQueue::LLFloaterScriptQueue(const LLSD& key) :
LLFloater(key),
mDone(false),
mMono(false)
LLFloater(key)
{

}
Expand All @@ -197,7 +195,7 @@ LLFloaterScriptQueue::~LLFloaterScriptQueue()

bool LLFloaterScriptQueue::postBuild()
{
childSetAction("close",onCloseBtn,this);
childSetAction("close", onCloseBtn, this);
getChildView("close")->setEnabled(false);
setVisible(true);
return true;
Expand All @@ -222,8 +220,8 @@ bool LLFloaterScriptQueue::start()

LLStringUtil::format_map_t args;
args["[START]"] = mStartString;
args["[COUNT]"] = llformat ("%d", mObjectList.size());
buffer = getString ("Starting", args);
args["[COUNT]"] = llformat("%d", mObjectList.size());
buffer = getString("Starting", args);

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

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

// //Attempt to record this asset ID. If it can not be inserted into the set
// //then it has already been processed so return false.
// Attempt to record this asset ID. If it can not be inserted into the set
// then it has already been processed so return false.

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

// Initial test to see if we can (or should) attempt to compile the script.
LLInventoryItem *item = dynamic_cast<LLInventoryItem *>(inventory);
Expand Down Expand Up @@ -470,7 +468,7 @@ bool LLFloaterCompileQueue::processScript(LLHandle<LLFloaterCompileQueue> hfloat
LLResourceUploadInfo::ptr_t uploadInfo(new LLQueuedScriptAssetUpload(object->getID(),
inventory->getUUID(),
assetId,
monocompile ? LLScriptAssetUpload::MONO : LLScriptAssetUpload::LSL2,
compile_target,
true,
inventory->getName(),
LLUUID(),
Expand Down
11 changes: 5 additions & 6 deletions indra/newview/llcompilequeue.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class LLFloaterScriptQueue : public LLFloater/*, public LLVOInventoryListener*/

/*virtual*/ bool postBuild();

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

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

protected:
// UI
LLScrollListCtrl* mMessages;
LLButton* mCloseBtn;
LLScrollListCtrl* mMessages { nullptr };
LLButton* mCloseBtn { nullptr };

// Object Queue
struct ObjectData
Expand All @@ -93,14 +93,13 @@ class LLFloaterScriptQueue : public LLFloater/*, public LLVOInventoryListener*/

object_data_list_t mObjectList;
LLUUID mCurrentObjectID;
bool mDone;
bool mDone { false };

std::string mStartString;
bool mMono;
std::string mCompileTarget { "lsl2" };

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

};

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
Loading
Loading