From 596522c7e5a9bff53a56db90597c7bcbcdbf1537 Mon Sep 17 00:00:00 2001 From: dolphin Date: Tue, 29 Jan 2013 13:58:13 -0800 Subject: Added a combox to the script editor to select an experience. Selected experience is sent with the script when saved. The list of experiences is currently populated with the avatar's current experience, if any. --- indra/newview/llpreviewscript.cpp | 105 +++++++++++++++++++++++++++++++++++--- 1 file changed, 98 insertions(+), 7 deletions(-) (limited to 'indra/newview/llpreviewscript.cpp') diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 9c25e69db0..98abd2c9dd 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -86,6 +86,7 @@ #include "lltrans.h" #include "llviewercontrol.h" #include "llappviewer.h" +#include "llexperiencecache.h" const std::string HELLO_LSL = "default\n" @@ -370,12 +371,21 @@ LLScriptEdCore::~LLScriptEdCore() delete mLiveFile; } +void LLScriptEdCore::experienceChanged() +{ + enableSave(TRUE); + getChildView("Save_btn")->setEnabled(true); +} + BOOL LLScriptEdCore::postBuild() { mErrorList = getChild("lsl errors"); mFunctions = getChild( "Insert..."); + mExperiences = getChild("Experiences..."); + mExperiences->setCommitCallback(boost::bind(&LLScriptEdCore::experienceChanged, this)); + childSetCommitCallback("Insert...", &LLScriptEdCore::onBtnInsertFunction, this); mEditor = getChild("Script Editor"); @@ -385,6 +395,10 @@ BOOL LLScriptEdCore::postBuild() childSetAction("Edit_btn", boost::bind(&LLScriptEdCore::openInExternalEditor, this)); initMenu(); + + + + requestExperiences(); std::vector funcs; @@ -1187,6 +1201,86 @@ bool LLScriptEdCore::enableLoadFromFileMenu(void* userdata) return (self && self->mEditor) ? self->mEditor->canLoadOrSaveToFile() : FALSE; } + +void AddExperienceResult(LLHandle panel, const LLSD& experience) +{ + LLScriptEdCore* scriptCore = panel.get(); + if(scriptCore) + { + scriptCore->addExperienceInfo(experience); + } +} + + +class ExperienceResponder : public LLHTTPClient::Responder +{ +public: + ExperienceResponder(const LLHandle& parent):mParent(parent) + { + } + + LLHandle mParent; + + virtual void result(const LLSD& content) + { + LLScriptEdCore* scriptCore = mParent.get(); + if(!scriptCore) + return; + + scriptCore->clearExperiences(); + + LLSD experiences = content["experiences"]; + LLSD::array_const_iterator it = experiences.beginArray(); + for( /**/ ; it != experiences.endArray(); ++it) + { + LLUUID public_key = it->asUUID(); + + LLExperienceCache::get(public_key, LLExperienceCache::PUBLIC_KEY, boost::bind(AddExperienceResult, mParent, _1)); + } + } +}; + +void LLScriptEdCore::requestExperiences() +{ + mExperiences->setEnabled(FALSE); + + LLViewerRegion* region = gAgent.getRegion(); + if (region) + { + std::string lookup_url=region->getCapability("GetExperiences"); + if(!lookup_url.empty()) + { + LLHTTPClient::get(lookup_url, new ExperienceResponder(getDerivedHandle())); + } + } +} + +void LLScriptEdCore::addExperienceInfo( const LLSD& experience ) +{ + mExperiences->setEnabled(TRUE); + mExperiences->add(experience[LLExperienceCache::NAME], experience); +} + +void LLScriptEdCore::clearExperiences() +{ + mExperiences->removeall(); + mExperiences->add("No Experience"); +} + +LLUUID LLScriptEdCore::getSelectedExperience()const +{ + LLSD value = mExperiences->getSelectedValue(); + if(value.has(LLExperienceCache::PUBLIC_KEY)) + { + return value[LLExperienceCache::PUBLIC_KEY].asUUID(); + } + return LLUUID::null; +} + + + + + /// --------------------------------------------------------------------------- /// LLScriptEdContainer /// --------------------------------------------------------------------------- @@ -2142,8 +2236,8 @@ void LLLiveLSLEditor::saveIfNeeded(bool sync /*= true*/) mPendingUploads++; BOOL is_running = getChild( "running")->get(); if (!url.empty()) - { - uploadAssetViaCaps(url, filename, mObjectUUID, mItemUUID, is_running); + { + uploadAssetViaCaps(url, filename, mObjectUUID, mItemUUID, is_running, mScriptEd->getSelectedExperience()); } else if (gAssetStorage) { @@ -2151,11 +2245,7 @@ void LLLiveLSLEditor::saveIfNeeded(bool sync /*= true*/) } } -void LLLiveLSLEditor::uploadAssetViaCaps(const std::string& url, - const std::string& filename, - const LLUUID& task_id, - const LLUUID& item_id, - BOOL is_running) +void LLLiveLSLEditor::uploadAssetViaCaps( const std::string& url, const std::string& filename, const LLUUID& task_id, const LLUUID& item_id, BOOL is_running, const LLUUID& experience_public_id ) { llinfos << "Update Task Inventory via capability " << url << llendl; LLSD body; @@ -2163,6 +2253,7 @@ void LLLiveLSLEditor::uploadAssetViaCaps(const std::string& url, body["item_id"] = item_id; body["is_script_running"] = is_running; body["target"] = monoChecked() ? "mono" : "lsl2"; + body["experience"] = experience_public_id; LLHTTPClient::post(url, body, new LLUpdateTaskInventoryResponder(body, filename, LLAssetType::AT_LSL_TEXT)); } -- cgit v1.2.3 From 61874872a7b4b8909f835650ab6732e24c61ffa2 Mon Sep 17 00:00:00 2001 From: dolphin Date: Wed, 13 Feb 2013 14:20:35 -0800 Subject: Updated experience cache to latest web service api Added new CAP request for experiences the avatar can sign --- indra/newview/llpreviewscript.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/newview/llpreviewscript.cpp') diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 98abd2c9dd..ba16c4dde8 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -1229,13 +1229,13 @@ public: scriptCore->clearExperiences(); - LLSD experiences = content["experiences"]; + LLSD experiences = content["experience_ids"]; LLSD::array_const_iterator it = experiences.beginArray(); for( /**/ ; it != experiences.endArray(); ++it) { LLUUID public_key = it->asUUID(); - LLExperienceCache::get(public_key, LLExperienceCache::PUBLIC_KEY, boost::bind(AddExperienceResult, mParent, _1)); + LLExperienceCache::get(public_key, boost::bind(AddExperienceResult, mParent, _1)); } } }; @@ -1247,7 +1247,7 @@ void LLScriptEdCore::requestExperiences() LLViewerRegion* region = gAgent.getRegion(); if (region) { - std::string lookup_url=region->getCapability("GetExperiences"); + std::string lookup_url=region->getCapability("GetCreatorExperiences"); if(!lookup_url.empty()) { LLHTTPClient::get(lookup_url, new ExperienceResponder(getDerivedHandle())); @@ -1270,9 +1270,9 @@ void LLScriptEdCore::clearExperiences() LLUUID LLScriptEdCore::getSelectedExperience()const { LLSD value = mExperiences->getSelectedValue(); - if(value.has(LLExperienceCache::PUBLIC_KEY)) + if(value.has(LLExperienceCache::EXPERIENCE_ID)) { - return value[LLExperienceCache::PUBLIC_KEY].asUUID(); + return value[LLExperienceCache::EXPERIENCE_ID].asUUID(); } return LLUUID::null; } -- cgit v1.2.3 From 6308f93c6adddc9d396e8d2527e97e0d02c4aa52 Mon Sep 17 00:00:00 2001 From: dolphin Date: Mon, 20 May 2013 10:04:29 -0700 Subject: WIP check in, testing GetMeta --- indra/newview/llpreviewscript.cpp | 71 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 67 insertions(+), 4 deletions(-) (limited to 'indra/newview/llpreviewscript.cpp') diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index f39a5ffd62..59a206b4d1 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -1244,6 +1244,33 @@ public: } }; +class ExperienceAssociationResponder : public LLHTTPClient::Responder +{ +public: + ExperienceAssociationResponder(const LLUUID& parent):mParent(parent) + { + } + + LLUUID mParent; + + virtual void result(const LLSD& content) + { + + LLLiveLSLEditor* scriptCore = LLFloaterReg::findTypedInstance("preview_scriptedit", mParent); + + if(!scriptCore || !content.has("experience")) + return; + + scriptCore->setAssociatedExperience(content["experience"].asUUID()); + } + + virtual void error(U32 status, const std::string& reason) + { + llinfos << "Failed to look up associated script: " << status << ": " << reason << llendl; + } + +}; + void LLScriptEdCore::requestExperiences() { mExperiences->setEnabled(FALSE); @@ -1262,13 +1289,13 @@ void LLScriptEdCore::requestExperiences() void LLScriptEdCore::addExperienceInfo( const LLSD& experience ) { mExperiences->setEnabled(TRUE); - mExperiences->add(experience[LLExperienceCache::NAME], experience); + mExperiences->add(experience[LLExperienceCache::NAME], experience[LLExperienceCache::EXPERIENCE_ID].asUUID()); } void LLScriptEdCore::clearExperiences() { mExperiences->removeall(); - mExperiences->add("No Experience"); + mExperiences->add("No Experience", LLUUID::null); } LLUUID LLScriptEdCore::getSelectedExperience()const @@ -1281,6 +1308,19 @@ LLUUID LLScriptEdCore::getSelectedExperience()const return LLUUID::null; } +void LLScriptEdCore::setAssociatedExperience( const LLUUID& experience_id ) +{ + mAssociatedExperience = experience_id; + if(experience_id.isNull()) + { + if(!mExperiences->setSelectedByValue(mAssociatedExperience, TRUE)) + { + mExperiences->setSelectedByValue(LLUUID::null, TRUE); + } + } +} + + @@ -1954,7 +1994,7 @@ void LLLiveLSLEditor::loadAsset() LLHost host(object->getRegion()->getIP(), object->getRegion()->getPort()); gMessageSystem->sendReliable(host); - */ + */ } } else @@ -1987,11 +2027,26 @@ void LLLiveLSLEditor::onLoadComplete(LLVFS *vfs, const LLUUID& asset_id, lldebugs << "LLLiveLSLEditor::onLoadComplete: got uuid " << asset_id << llendl; LLUUID* xored_id = (LLUUID*)user_data; - + + LLLiveLSLEditor* instance = LLFloaterReg::findTypedInstance("preview_scriptedit", *xored_id); if(instance ) { + LLViewerRegion* region = gAgent.getRegion(); + if (region) + { + std::string lookup_url=region->getCapability("GetMetadata"); + //lookup_url = "http://127.0.0.1:12035/meta"; + if(!lookup_url.empty()) + { + lookup_url += "/"; + lookup_url += asset_id.asString(); + lookup_url += "/experience"; + LLHTTPClient::get(lookup_url, new ExperienceAssociationResponder(*xored_id)); + } + } + if( LL_ERR_NOERR == status ) { instance->loadScriptText(vfs, asset_id, type); @@ -2509,3 +2564,11 @@ BOOL LLLiveLSLEditor::monoChecked() const } return FALSE; } + +void LLLiveLSLEditor::setAssociatedExperience( const LLUUID& experience_id ) +{ + if(mScriptEd) + { + mScriptEd->setAssociatedExperience(experience_id); + } +} -- cgit v1.2.3 From 10c2758a057b7287894acbaf909b21b7fc656c06 Mon Sep 17 00:00:00 2001 From: dolphin Date: Mon, 20 May 2013 22:07:41 -0700 Subject: fixed LLScriptEdCore::getSelectedExperience --- indra/newview/llpreviewscript.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'indra/newview/llpreviewscript.cpp') diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 59a206b4d1..0d7a8678a1 100755 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -1300,12 +1300,7 @@ void LLScriptEdCore::clearExperiences() LLUUID LLScriptEdCore::getSelectedExperience()const { - LLSD value = mExperiences->getSelectedValue(); - if(value.has(LLExperienceCache::EXPERIENCE_ID)) - { - return value[LLExperienceCache::EXPERIENCE_ID].asUUID(); - } - return LLUUID::null; + return (LLUUID)mExperiences->getSelectedValue(); } void LLScriptEdCore::setAssociatedExperience( const LLUUID& experience_id ) -- cgit v1.2.3 From 3d45290f8511e435f4a5bd03e485eb3b1758a332 Mon Sep 17 00:00:00 2001 From: dolphin Date: Mon, 20 May 2013 22:54:05 -0700 Subject: changing cast for the mac build --- indra/newview/llpreviewscript.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpreviewscript.cpp') diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 0d7a8678a1..7c1b83dfa9 100755 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -1300,7 +1300,7 @@ void LLScriptEdCore::clearExperiences() LLUUID LLScriptEdCore::getSelectedExperience()const { - return (LLUUID)mExperiences->getSelectedValue(); + return mExperiences->getSelectedValue().asUUID(); } void LLScriptEdCore::setAssociatedExperience( const LLUUID& experience_id ) -- cgit v1.2.3 From 37bd01152ac278e3401a96b12baf5505c5c1f789 Mon Sep 17 00:00:00 2001 From: dolphin Date: Tue, 21 May 2013 22:57:15 -0700 Subject: Update experience request to use the new post service. --- indra/newview/llpreviewscript.cpp | 40 +++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) (limited to 'indra/newview/llpreviewscript.cpp') diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 7c1b83dfa9..bba0f1330c 100755 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -1290,6 +1290,10 @@ void LLScriptEdCore::addExperienceInfo( const LLSD& experience ) { mExperiences->setEnabled(TRUE); mExperiences->add(experience[LLExperienceCache::NAME], experience[LLExperienceCache::EXPERIENCE_ID].asUUID()); + if(mAssociatedExperience == experience[LLExperienceCache::EXPERIENCE_ID].asUUID()) + { + setAssociatedExperience(mAssociatedExperience); + } } void LLScriptEdCore::clearExperiences() @@ -1306,7 +1310,7 @@ LLUUID LLScriptEdCore::getSelectedExperience()const void LLScriptEdCore::setAssociatedExperience( const LLUUID& experience_id ) { mAssociatedExperience = experience_id; - if(experience_id.isNull()) + if(experience_id.notNull()) { if(!mExperiences->setSelectedByValue(mAssociatedExperience, TRUE)) { @@ -2028,19 +2032,8 @@ void LLLiveLSLEditor::onLoadComplete(LLVFS *vfs, const LLUUID& asset_id, if(instance ) { - LLViewerRegion* region = gAgent.getRegion(); - if (region) - { - std::string lookup_url=region->getCapability("GetMetadata"); - //lookup_url = "http://127.0.0.1:12035/meta"; - if(!lookup_url.empty()) - { - lookup_url += "/"; - lookup_url += asset_id.asString(); - lookup_url += "/experience"; - LLHTTPClient::get(lookup_url, new ExperienceAssociationResponder(*xored_id)); - } - } + instance->fetchAssociatedExperience(asset_id); + if( LL_ERR_NOERR == status ) { @@ -2488,6 +2481,25 @@ void LLLiveLSLEditor::onSaveBytecodeComplete(const LLUUID& asset_uuid, void* use delete data; } +void LLLiveLSLEditor::fetchAssociatedExperience(const LLUUID& asset_id) +{ + LLViewerRegion* region = gAgent.getRegion(); + if (region) + { + std::string lookup_url=region->getCapability("GetMetadata"); + if(!lookup_url.empty()) + { + LLSD request; + request["asset-id"]=asset_id; + LLSD fields; + fields.append("experience"); + request["fields"] = fields; + LLHTTPClient::post(lookup_url, request, new ExperienceAssociationResponder(getKey())); + } + } +} + + BOOL LLLiveLSLEditor::canClose() { return (mScriptEd->canClose()); -- cgit v1.2.3 From 08a1ae6839f07aeadb58326208c2c01b2ef667c3 Mon Sep 17 00:00:00 2001 From: dolphin Date: Tue, 6 Aug 2013 16:05:09 -0700 Subject: Checkpoint script editor --- indra/newview/llpreviewscript.cpp | 91 ++++++++++++++++++++++++++++++++++----- 1 file changed, 80 insertions(+), 11 deletions(-) (limited to 'indra/newview/llpreviewscript.cpp') diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index bba0f1330c..ef2eb98ce9 100755 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -378,9 +378,43 @@ LLScriptEdCore::~LLScriptEdCore() void LLScriptEdCore::experienceChanged() { enableSave(TRUE); - getChildView("Save_btn")->setEnabled(true); + getChildView("Save_btn")->setEnabled(TRUE); + mAssociatedExperience = mExperiences->getSelectedValue().asUUID(); } +void LLScriptEdCore::onToggleExperience( LLUICtrl *ui, void* userdata ) +{ + LLScriptEdCore* self = (LLScriptEdCore*)userdata; + BOOL checked = self->mExperienceEnabled->get(); + BOOL expand = checked && self->mAssociatedExperience.isNull(); + self->mExpandExperience->setToggleState(expand); + self->mExpandExperience->setEnabled(checked); + self->mExperienceDetails->setVisible(expand); + if(!checked) + { + if(self->mAssociatedExperience.notNull()) + { + self->enableSave(TRUE); + } + self->setAssociatedExperience(LLUUID::null); + } + else if (expand) + { + self->mExperiences->selectFirstItem(); + self->setAssociatedExperience(self->mExperiences->getSelectedValue().asUUID()); + self->enableSave(TRUE); + } +} + +void LLScriptEdCore::onToggleExperienceDetails( void* userdata ) +{ + LLScriptEdCore* self = (LLScriptEdCore*)userdata; + BOOL checked = self->mExperienceEnabled->get(); + BOOL expanded = self->mExpandExperience->getToggleState(); + self->mExperienceDetails->setVisible(checked && expanded); +} + + BOOL LLScriptEdCore::postBuild() { mErrorList = getChild("lsl errors"); @@ -390,6 +424,14 @@ BOOL LLScriptEdCore::postBuild() mExperiences = getChild("Experiences..."); mExperiences->setCommitCallback(boost::bind(&LLScriptEdCore::experienceChanged, this)); + mExperienceEnabled = getChild("enable_xp"); + mExpandExperience = getChild("Expand Experience"); + mExperienceDetails = getChild("Experience Details"); + mExpandExperience->setClickedCallback(boost::bind(&LLScriptEdCore::onToggleExperienceDetails, this)); + + childSetCommitCallback("enable_xp", onToggleExperience, this); + + childSetCommitCallback("Insert...", &LLScriptEdCore::onBtnInsertFunction, this); mEditor = getChild("Script Editor"); @@ -1258,10 +1300,15 @@ public: LLLiveLSLEditor* scriptCore = LLFloaterReg::findTypedInstance("preview_scriptedit", mParent); - if(!scriptCore || !content.has("experience")) + if(!scriptCore) return; - scriptCore->setAssociatedExperience(content["experience"].asUUID()); + LLUUID id; + if(content.has("experience")) + { + id=content["experience"].asUUID(); + } + scriptCore->setAssociatedExperience(id); } virtual void error(U32 status, const std::string& reason) @@ -1294,31 +1341,53 @@ void LLScriptEdCore::addExperienceInfo( const LLSD& experience ) { setAssociatedExperience(mAssociatedExperience); } + LLUICtrl* no_experiences=getChild("No Experiences"); + if(no_experiences) + { + no_experiences->setVisible(FALSE); + } } void LLScriptEdCore::clearExperiences() { mExperiences->removeall(); - mExperiences->add("No Experience", LLUUID::null); + mExperiences->setEnabled(FALSE); + LLUICtrl* no_experiences=getChild("No Experiences"); + if(no_experiences) + { + no_experiences->setVisible(TRUE); + } } -LLUUID LLScriptEdCore::getSelectedExperience()const +LLUUID LLScriptEdCore::getAssociatedExperience()const { - return mExperiences->getSelectedValue().asUUID(); + return mAssociatedExperience; } void LLScriptEdCore::setAssociatedExperience( const LLUUID& experience_id ) { + mExperienceEnabled->setEnabled(TRUE); mAssociatedExperience = experience_id; if(experience_id.notNull()) { - if(!mExperiences->setSelectedByValue(mAssociatedExperience, TRUE)) - { - mExperiences->setSelectedByValue(LLUUID::null, TRUE); - } + LLExperienceCache::get(experience_id, boost::bind(&LLScriptEdCore::addAssociatedExperience, this, _1)); } } +void LLScriptEdCore::addAssociatedExperience(const LLSD& experience) +{ + + if(mExperiences->setSelectedByValue(mAssociatedExperience, TRUE)) + { + mExperienceEnabled->set(TRUE); + mExpandExperience->setEnabled(TRUE); + } + else + { + mExperiences->add(experience[LLExperienceCache::NAME], experience[LLExperienceCache::EXPERIENCE_ID].asUUID(), ADD_TOP, FALSE); + mExperienceEnabled->set(FALSE); + } +} @@ -2284,7 +2353,7 @@ void LLLiveLSLEditor::saveIfNeeded(bool sync /*= true*/) BOOL is_running = getChild( "running")->get(); if (!url.empty()) { - uploadAssetViaCaps(url, filename, mObjectUUID, mItemUUID, is_running, mScriptEd->getSelectedExperience()); + uploadAssetViaCaps(url, filename, mObjectUUID, mItemUUID, is_running, mScriptEd->getAssociatedExperience()); } else if (gAssetStorage) { -- cgit v1.2.3 From 6354ad379d0850b4cc3969130fb1b30b0e2c0ee9 Mon Sep 17 00:00:00 2001 From: dolphin Date: Thu, 8 Aug 2013 09:26:09 -0700 Subject: Simplified the experience panel to only the required elements --- indra/newview/llpreviewscript.cpp | 259 +++++++++++++++++++------------------- 1 file changed, 126 insertions(+), 133 deletions(-) (limited to 'indra/newview/llpreviewscript.cpp') diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index ef2eb98ce9..bd8f65e767 100755 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -119,6 +119,57 @@ static bool have_script_upload_cap(LLUUID& object_id) return object && (! object->getRegion()->getCapability("UpdateScriptTask").empty()); } +class ExperienceAssociationResponder : public LLHTTPClient::Responder +{ +public: + ExperienceAssociationResponder(const LLUUID& parent):mParent(parent) + { + } + + LLUUID mParent; + + virtual void result(const LLSD& content) + { + + LLLiveLSLEditor* scriptCore = LLFloaterReg::findTypedInstance("preview_scriptedit", mParent); + + if(!scriptCore) + return; + + LLUUID id; + if(content.has("experience")) + { + id=content["experience"].asUUID(); + } + scriptCore->setAssociatedExperience(id); + } + + virtual void error(U32 status, const std::string& reason) + { + llinfos << "Failed to look up associated script: " << status << ": " << reason << llendl; + } + +}; + +class ExperienceResponder : public LLHTTPClient::Responder +{ +public: + ExperienceResponder(const LLHandle& parent):mParent(parent) + { + } + + LLHandle mParent; + + virtual void result(const LLSD& content) + { + LLScriptEdCore* scriptCore = mParent.get(); + if(!scriptCore) + return; + + scriptCore->setExperienceIds(content["experience_ids"]); + } +}; + /// --------------------------------------------------------------------------- /// LLLiveLSLFile /// --------------------------------------------------------------------------- @@ -377,44 +428,34 @@ LLScriptEdCore::~LLScriptEdCore() void LLScriptEdCore::experienceChanged() { - enableSave(TRUE); - getChildView("Save_btn")->setEnabled(TRUE); - mAssociatedExperience = mExperiences->getSelectedValue().asUUID(); + if(mAssociatedExperience != mExperiences->getSelectedValue().asUUID()) + { + enableSave(TRUE); + getChildView("Save_btn")->setEnabled(TRUE); + mAssociatedExperience = mExperiences->getSelectedValue().asUUID(); + } } void LLScriptEdCore::onToggleExperience( LLUICtrl *ui, void* userdata ) { LLScriptEdCore* self = (LLScriptEdCore*)userdata; - BOOL checked = self->mExperienceEnabled->get(); - BOOL expand = checked && self->mAssociatedExperience.isNull(); - self->mExpandExperience->setToggleState(expand); - self->mExpandExperience->setEnabled(checked); - self->mExperienceDetails->setVisible(expand); - if(!checked) + + LLUUID id; + if(self->mExperienceEnabled->get()) { - if(self->mAssociatedExperience.notNull()) + if(self->mAssociatedExperience.isNull()) { - self->enableSave(TRUE); + id=self->mExperienceIds.beginArray()->asUUID(); } - self->setAssociatedExperience(LLUUID::null); } - else if (expand) + + if(id != self->mAssociatedExperience) { - self->mExperiences->selectFirstItem(); - self->setAssociatedExperience(self->mExperiences->getSelectedValue().asUUID()); self->enableSave(TRUE); } + self->setAssociatedExperience(id); } -void LLScriptEdCore::onToggleExperienceDetails( void* userdata ) -{ - LLScriptEdCore* self = (LLScriptEdCore*)userdata; - BOOL checked = self->mExperienceEnabled->get(); - BOOL expanded = self->mExpandExperience->getToggleState(); - self->mExperienceDetails->setVisible(checked && expanded); -} - - BOOL LLScriptEdCore::postBuild() { mErrorList = getChild("lsl errors"); @@ -425,9 +466,6 @@ BOOL LLScriptEdCore::postBuild() mExperiences->setCommitCallback(boost::bind(&LLScriptEdCore::experienceChanged, this)); mExperienceEnabled = getChild("enable_xp"); - mExpandExperience = getChild("Expand Experience"); - mExperienceDetails = getChild("Experience Details"); - mExpandExperience->setClickedCallback(boost::bind(&LLScriptEdCore::onToggleExperienceDetails, this)); childSetCommitCallback("enable_xp", onToggleExperience, this); @@ -1247,152 +1285,107 @@ bool LLScriptEdCore::enableLoadFromFileMenu(void* userdata) return (self && self->mEditor) ? self->mEditor->canLoadOrSaveToFile() : FALSE; } - -void AddExperienceResult(LLHandle panel, const LLSD& experience) +LLUUID LLScriptEdCore::getAssociatedExperience()const { - LLScriptEdCore* scriptCore = panel.get(); - if(scriptCore) - { - scriptCore->addExperienceInfo(experience); - } + return mAssociatedExperience; } - -class ExperienceResponder : public LLHTTPClient::Responder +void LLScriptEdCore::setExperienceIds( const LLSD& experience_ids ) { -public: - ExperienceResponder(const LLHandle& parent):mParent(parent) - { - } - - LLHandle mParent; - - virtual void result(const LLSD& content) - { - LLScriptEdCore* scriptCore = mParent.get(); - if(!scriptCore) - return; - - scriptCore->clearExperiences(); + mExperienceIds=experience_ids; + updateExperiencePanel(); +} - LLSD experiences = content["experience_ids"]; - LLSD::array_const_iterator it = experiences.beginArray(); - for( /**/ ; it != experiences.endArray(); ++it) - { - LLUUID public_key = it->asUUID(); - LLExperienceCache::get(public_key, boost::bind(AddExperienceResult, mParent, _1)); - } - } -}; - -class ExperienceAssociationResponder : public LLHTTPClient::Responder +void LLScriptEdCore::updateExperiencePanel() { -public: - ExperienceAssociationResponder(const LLUUID& parent):mParent(parent) - { - } + BOOL editable = mEditor->getEnabled(); - LLUUID mParent; - - virtual void result(const LLSD& content) + if(mAssociatedExperience.isNull()) { - - LLLiveLSLEditor* scriptCore = LLFloaterReg::findTypedInstance("preview_scriptedit", mParent); - - if(!scriptCore) - return; - - LLUUID id; - if(content.has("experience")) + mExperienceEnabled->set(FALSE); + mExperiences->setVisible(FALSE); + if(mExperienceIds.size()>0) { - id=content["experience"].asUUID(); + mExperienceEnabled->setEnabled(TRUE); + mExperienceEnabled->setToolTip(getString("add_experiences")); } - scriptCore->setAssociatedExperience(id); + else + { + mExperienceEnabled->setEnabled(FALSE); + mExperienceEnabled->setToolTip(getString("no_experiences")); + } + getChild("view_profile")->setVisible(FALSE); } - - virtual void error(U32 status, const std::string& reason) + else { - llinfos << "Failed to look up associated script: " << status << ": " << reason << llendl; + mExperienceEnabled->setToolTip(getString("experience_enabled")); + mExperienceEnabled->setEnabled(editable); + mExperienceEnabled->set(TRUE); + mExperiences->setVisible(TRUE); + getChild("view_profile")->setVisible(TRUE); + buildExperienceList(); } - -}; - -void LLScriptEdCore::requestExperiences() -{ - mExperiences->setEnabled(FALSE); - - LLViewerRegion* region = gAgent.getRegion(); - if (region) - { - std::string lookup_url=region->getCapability("GetCreatorExperiences"); - if(!lookup_url.empty()) - { - LLHTTPClient::get(lookup_url, new ExperienceResponder(getDerivedHandle())); - } - } } -void LLScriptEdCore::addExperienceInfo( const LLSD& experience ) -{ - mExperiences->setEnabled(TRUE); - mExperiences->add(experience[LLExperienceCache::NAME], experience[LLExperienceCache::EXPERIENCE_ID].asUUID()); - if(mAssociatedExperience == experience[LLExperienceCache::EXPERIENCE_ID].asUUID()) +void LLScriptEdCore::addExperienceInfo(const LLSD& experience, BOOL enabled) +{ + LLUUID id = experience[LLExperienceCache::EXPERIENCE_ID].asUUID(); + EAddPosition position = (id == mAssociatedExperience)?ADD_TOP:ADD_BOTTOM; + LLScrollListItem* item=mExperiences->add(experience[LLExperienceCache::NAME], id, position ); + if(!enabled) { - setAssociatedExperience(mAssociatedExperience); - } - LLUICtrl* no_experiences=getChild("No Experiences"); - if(no_experiences) - { - no_experiences->setVisible(FALSE); + item->setEnabled(FALSE); } } -void LLScriptEdCore::clearExperiences() +void LLScriptEdCore::buildExperienceList() { - mExperiences->removeall(); - mExperiences->setEnabled(FALSE); - LLUICtrl* no_experiences=getChild("No Experiences"); - if(no_experiences) + mExperiences->clear(); + bool foundAssociated=false; + for(LLSD::array_const_iterator it = mExperienceIds.beginArray(); it != mExperienceIds.endArray(); ++it) { - no_experiences->setVisible(TRUE); + LLUUID id = it->asUUID(); + foundAssociated |= (id == mAssociatedExperience); + LLExperienceCache::get(id, boost::bind(&LLScriptEdCore::addExperienceInfo, this, _1, TRUE)); + } + + if(!foundAssociated ) + { + LLExperienceCache::get(mAssociatedExperience, boost::bind(&LLScriptEdCore::addExperienceInfo, this, _1, FALSE)); } -} -LLUUID LLScriptEdCore::getAssociatedExperience()const -{ - return mAssociatedExperience; } + void LLScriptEdCore::setAssociatedExperience( const LLUUID& experience_id ) { - mExperienceEnabled->setEnabled(TRUE); mAssociatedExperience = experience_id; - if(experience_id.notNull()) - { - LLExperienceCache::get(experience_id, boost::bind(&LLScriptEdCore::addAssociatedExperience, this, _1)); - } + updateExperiencePanel(); } -void LLScriptEdCore::addAssociatedExperience(const LLSD& experience) -{ - if(mExperiences->setSelectedByValue(mAssociatedExperience, TRUE)) + +void LLScriptEdCore::requestExperiences() +{ + if (!mEditor->getEnabled()) { - mExperienceEnabled->set(TRUE); - mExpandExperience->setEnabled(TRUE); + return; } - else + + LLViewerRegion* region = gAgent.getRegion(); + if (region) { - mExperiences->add(experience[LLExperienceCache::NAME], experience[LLExperienceCache::EXPERIENCE_ID].asUUID(), ADD_TOP, FALSE); - mExperienceEnabled->set(FALSE); + std::string lookup_url=region->getCapability("GetCreatorExperiences"); + if(!lookup_url.empty()) + { + LLHTTPClient::get(lookup_url, new ExperienceResponder(getDerivedHandle())); + } } } - - /// --------------------------------------------------------------------------- /// LLScriptEdContainer /// --------------------------------------------------------------------------- -- cgit v1.2.3 From 02b501e4dc9a389878cd323e4f781bc752fec737 Mon Sep 17 00:00:00 2001 From: dolphin Date: Thu, 15 Aug 2013 09:32:12 -0700 Subject: Move the experience panel to the bottom of the editor floater --- indra/newview/llpreviewscript.cpp | 132 +++++++++++++++++--------------------- 1 file changed, 59 insertions(+), 73 deletions(-) (limited to 'indra/newview/llpreviewscript.cpp') diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index bd8f65e767..09152ac060 100755 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -87,6 +87,7 @@ #include "llviewercontrol.h" #include "llappviewer.h" #include "llexperiencecache.h" +#include "llexperienceassociationresponder.h" const std::string HELLO_LSL = "default\n" @@ -119,54 +120,23 @@ static bool have_script_upload_cap(LLUUID& object_id) return object && (! object->getRegion()->getCapability("UpdateScriptTask").empty()); } -class ExperienceAssociationResponder : public LLHTTPClient::Responder -{ -public: - ExperienceAssociationResponder(const LLUUID& parent):mParent(parent) - { - } - - LLUUID mParent; - - virtual void result(const LLSD& content) - { - - LLLiveLSLEditor* scriptCore = LLFloaterReg::findTypedInstance("preview_scriptedit", mParent); - - if(!scriptCore) - return; - - LLUUID id; - if(content.has("experience")) - { - id=content["experience"].asUUID(); - } - scriptCore->setAssociatedExperience(id); - } - - virtual void error(U32 status, const std::string& reason) - { - llinfos << "Failed to look up associated script: " << status << ": " << reason << llendl; - } - -}; class ExperienceResponder : public LLHTTPClient::Responder { public: - ExperienceResponder(const LLHandle& parent):mParent(parent) + ExperienceResponder(const LLHandle& parent):mParent(parent) { } - LLHandle mParent; + LLHandle mParent; virtual void result(const LLSD& content) { - LLScriptEdCore* scriptCore = mParent.get(); - if(!scriptCore) + LLLiveLSLEditor* parent = mParent.get(); + if(!parent) return; - scriptCore->setExperienceIds(content["experience_ids"]); + parent->setExperienceIds(content["experience_ids"]); } }; @@ -426,34 +396,37 @@ LLScriptEdCore::~LLScriptEdCore() delete mLiveFile; } -void LLScriptEdCore::experienceChanged() +void LLLiveLSLEditor::experienceChanged() { - if(mAssociatedExperience != mExperiences->getSelectedValue().asUUID()) + if(mScriptEd->getAssociatedExperience() != mExperiences->getSelectedValue().asUUID()) { - enableSave(TRUE); - getChildView("Save_btn")->setEnabled(TRUE); - mAssociatedExperience = mExperiences->getSelectedValue().asUUID(); + mScriptEd->enableSave(getIsModifiable()); + //getChildView("Save_btn")->setEnabled(TRUE); + mScriptEd->setAssociatedExperience(mExperiences->getSelectedValue().asUUID()); + updateExperiencePanel(); } } -void LLScriptEdCore::onToggleExperience( LLUICtrl *ui, void* userdata ) +void LLLiveLSLEditor::onToggleExperience( LLUICtrl *ui, void* userdata ) { - LLScriptEdCore* self = (LLScriptEdCore*)userdata; + LLLiveLSLEditor* self = (LLLiveLSLEditor*)userdata; LLUUID id; if(self->mExperienceEnabled->get()) { - if(self->mAssociatedExperience.isNull()) + if(self->mScriptEd->getAssociatedExperience().isNull()) { id=self->mExperienceIds.beginArray()->asUUID(); } } - if(id != self->mAssociatedExperience) + if(id != self->mScriptEd->getAssociatedExperience()) { - self->enableSave(TRUE); + self->mScriptEd->enableSave(self->getIsModifiable()); } - self->setAssociatedExperience(id); + self->mScriptEd->setAssociatedExperience(id); + + self->updateExperiencePanel(); } BOOL LLScriptEdCore::postBuild() @@ -462,12 +435,6 @@ BOOL LLScriptEdCore::postBuild() mFunctions = getChild( "Insert..."); - mExperiences = getChild("Experiences..."); - mExperiences->setCommitCallback(boost::bind(&LLScriptEdCore::experienceChanged, this)); - - mExperienceEnabled = getChild("enable_xp"); - - childSetCommitCallback("enable_xp", onToggleExperience, this); childSetCommitCallback("Insert...", &LLScriptEdCore::onBtnInsertFunction, this); @@ -482,8 +449,6 @@ BOOL LLScriptEdCore::postBuild() - requestExperiences(); - std::vector funcs; std::vector tooltips; @@ -1290,18 +1255,18 @@ LLUUID LLScriptEdCore::getAssociatedExperience()const return mAssociatedExperience; } -void LLScriptEdCore::setExperienceIds( const LLSD& experience_ids ) +void LLLiveLSLEditor::setExperienceIds( const LLSD& experience_ids ) { mExperienceIds=experience_ids; updateExperiencePanel(); } -void LLScriptEdCore::updateExperiencePanel() +void LLLiveLSLEditor::updateExperiencePanel() { - BOOL editable = mEditor->getEnabled(); + BOOL editable = getIsModifiable(); - if(mAssociatedExperience.isNull()) + if(mScriptEd->getAssociatedExperience().isNull()) { mExperienceEnabled->set(FALSE); mExperiences->setVisible(FALSE); @@ -1328,10 +1293,10 @@ void LLScriptEdCore::updateExperiencePanel() } } -void LLScriptEdCore::addExperienceInfo(const LLSD& experience, BOOL enabled) +void LLLiveLSLEditor::addExperienceInfo(const LLSD& experience, BOOL enabled) { LLUUID id = experience[LLExperienceCache::EXPERIENCE_ID].asUUID(); - EAddPosition position = (id == mAssociatedExperience)?ADD_TOP:ADD_BOTTOM; + EAddPosition position = (id == mScriptEd->getAssociatedExperience())?ADD_TOP:ADD_BOTTOM; LLScrollListItem* item=mExperiences->add(experience[LLExperienceCache::NAME], id, position ); if(!enabled) { @@ -1339,20 +1304,20 @@ void LLScriptEdCore::addExperienceInfo(const LLSD& experience, BOOL enabled) } } -void LLScriptEdCore::buildExperienceList() +void LLLiveLSLEditor::buildExperienceList() { mExperiences->clear(); bool foundAssociated=false; for(LLSD::array_const_iterator it = mExperienceIds.beginArray(); it != mExperienceIds.endArray(); ++it) { LLUUID id = it->asUUID(); - foundAssociated |= (id == mAssociatedExperience); - LLExperienceCache::get(id, boost::bind(&LLScriptEdCore::addExperienceInfo, this, _1, TRUE)); + foundAssociated |= (id == mScriptEd->getAssociatedExperience()); + LLExperienceCache::get(id, boost::bind(&LLLiveLSLEditor::addExperienceInfo, this, _1, TRUE)); } if(!foundAssociated ) { - LLExperienceCache::get(mAssociatedExperience, boost::bind(&LLScriptEdCore::addExperienceInfo, this, _1, FALSE)); + LLExperienceCache::get(mScriptEd->getAssociatedExperience(), boost::bind(&LLLiveLSLEditor::addExperienceInfo, this, _1, FALSE)); } } @@ -1361,14 +1326,13 @@ void LLScriptEdCore::buildExperienceList() void LLScriptEdCore::setAssociatedExperience( const LLUUID& experience_id ) { mAssociatedExperience = experience_id; - updateExperiencePanel(); } -void LLScriptEdCore::requestExperiences() +void LLLiveLSLEditor::requestExperiences() { - if (!mEditor->getEnabled()) + if (!getIsModifiable()) { return; } @@ -1379,7 +1343,7 @@ void LLScriptEdCore::requestExperiences() std::string lookup_url=region->getCapability("GetCreatorExperiences"); if(!lookup_url.empty()) { - LLHTTPClient::get(lookup_url, new ExperienceResponder(getDerivedHandle())); + LLHTTPClient::get(lookup_url, new ExperienceResponder(getDerivedHandle())); } } } @@ -1945,6 +1909,15 @@ BOOL LLLiveLSLEditor::postBuild() mScriptEd->mEditor->makePristine(); mScriptEd->mEditor->setFocus(TRUE); + + mExperiences = getChild("Experiences..."); + mExperiences->setCommitCallback(boost::bind(&LLLiveLSLEditor::experienceChanged, this)); + + mExperienceEnabled = getChild("enable_xp"); + + childSetCommitCallback("enable_xp", onToggleExperience, this); + + return LLPreview::postBuild(); } @@ -2078,6 +2051,8 @@ void LLLiveLSLEditor::loadAsset() time_corrected()); mAssetStatus = PREVIEW_ASSET_LOADED; } + + requestExperiences(); } // static @@ -2556,7 +2531,11 @@ void LLLiveLSLEditor::fetchAssociatedExperience(const LLUUID& asset_id) LLSD fields; fields.append("experience"); request["fields"] = fields; - LLHTTPClient::post(lookup_url, request, new ExperienceAssociationResponder(getKey())); + + ExperienceAssociationResponder::callback_t f = boost::bind(&LLLiveLSLEditor::setAssociatedExperience, getDerivedHandle(), _1); + LLHTTPClient::post(lookup_url, request, new ExperienceAssociationResponder(f)); + + //test me pls } } } @@ -2634,10 +2613,17 @@ BOOL LLLiveLSLEditor::monoChecked() const return FALSE; } -void LLLiveLSLEditor::setAssociatedExperience( const LLUUID& experience_id ) +void LLLiveLSLEditor::setAssociatedExperience( LLHandle editor, const LLSD& experience ) { - if(mScriptEd) + LLLiveLSLEditor* scriptEd = editor.get(); + if(scriptEd) { - mScriptEd->setAssociatedExperience(experience_id); + LLUUID id; + if(experience.has(LLExperienceCache::EXPERIENCE_ID)) + { + id=experience[LLExperienceCache::EXPERIENCE_ID].asUUID(); + } + scriptEd->mScriptEd->setAssociatedExperience(id); + scriptEd->updateExperiencePanel(); } } -- cgit v1.2.3 From b980efd014ddb56650fffeb7968901b8e6bc2837 Mon Sep 17 00:00:00 2001 From: dolphin Date: Mon, 19 Aug 2013 09:24:04 -0700 Subject: Added experience association info llsidepaneliteminfo for scripts. Changed the cap which looks up a script association to take a object/item id pair instead of a asset id. Updated llpreviewscript to use the new cap (which also improves loading time since it can be done in parallel with the lsltext retrieval). --- indra/newview/llpreviewscript.cpp | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) (limited to 'indra/newview/llpreviewscript.cpp') diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 09152ac060..f5a6ec3dd3 100755 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -1966,8 +1966,8 @@ void LLLiveLSLEditor::loadAsset() || gAgent.isGodlike())) { mItem = new LLViewerInventoryItem(item); - //llinfos << "asset id " << mItem->getAssetUUID() << llendl; } + ExperienceAssociationResponder::fetchAssociatedExperience(item->getParentUUID(), item->getUUID(), boost::bind(&LLLiveLSLEditor::setAssociatedExperience, getDerivedHandle(), _1)); if(!gAgent.isGodlike() && (item @@ -2069,9 +2069,6 @@ void LLLiveLSLEditor::onLoadComplete(LLVFS *vfs, const LLUUID& asset_id, if(instance ) { - instance->fetchAssociatedExperience(asset_id); - - if( LL_ERR_NOERR == status ) { instance->loadScriptText(vfs, asset_id, type); @@ -2518,29 +2515,6 @@ void LLLiveLSLEditor::onSaveBytecodeComplete(const LLUUID& asset_uuid, void* use delete data; } -void LLLiveLSLEditor::fetchAssociatedExperience(const LLUUID& asset_id) -{ - LLViewerRegion* region = gAgent.getRegion(); - if (region) - { - std::string lookup_url=region->getCapability("GetMetadata"); - if(!lookup_url.empty()) - { - LLSD request; - request["asset-id"]=asset_id; - LLSD fields; - fields.append("experience"); - request["fields"] = fields; - - ExperienceAssociationResponder::callback_t f = boost::bind(&LLLiveLSLEditor::setAssociatedExperience, getDerivedHandle(), _1); - LLHTTPClient::post(lookup_url, request, new ExperienceAssociationResponder(f)); - - //test me pls - } - } -} - - BOOL LLLiveLSLEditor::canClose() { return (mScriptEd->canClose()); -- cgit v1.2.3 From 257110c11e5546f0a5a07b087694cfc9059367b4 Mon Sep 17 00:00:00 2001 From: dolphin Date: Wed, 21 Aug 2013 15:43:09 -0700 Subject: Added new fields to the experience cache. Experience profile moved to it's own floater, will probalby be moving again. XP profile displays most data, though the presentation is not final Fixed a bug with the XP selection combobox in the script editor --- indra/newview/llpreviewscript.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpreviewscript.cpp') diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index f5a6ec3dd3..7c2638d82b 100755 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -87,6 +87,7 @@ #include "llviewercontrol.h" #include "llappviewer.h" #include "llexperiencecache.h" +#include "llfloaterexperienceprofile.h" #include "llexperienceassociationresponder.h" const std::string HELLO_LSL = @@ -407,6 +408,22 @@ void LLLiveLSLEditor::experienceChanged() } } +void LLLiveLSLEditor::onViewProfile( LLUICtrl *ui, void* userdata ) +{ + LLLiveLSLEditor* self = (LLLiveLSLEditor*)userdata; + + LLUUID id; + if(self->mExperienceEnabled->get()) + { + id=self->mScriptEd->getAssociatedExperience(); + if(id.notNull()) + { + LLFloaterReg::showInstance("experience_profile", id, true); + } + } + +} + void LLLiveLSLEditor::onToggleExperience( LLUICtrl *ui, void* userdata ) { LLLiveLSLEditor* self = (LLLiveLSLEditor*)userdata; @@ -1306,7 +1323,7 @@ void LLLiveLSLEditor::addExperienceInfo(const LLSD& experience, BOOL enabled) void LLLiveLSLEditor::buildExperienceList() { - mExperiences->clear(); + mExperiences->clearRows(); bool foundAssociated=false; for(LLSD::array_const_iterator it = mExperienceIds.beginArray(); it != mExperienceIds.endArray(); ++it) { @@ -1916,6 +1933,7 @@ BOOL LLLiveLSLEditor::postBuild() mExperienceEnabled = getChild("enable_xp"); childSetCommitCallback("enable_xp", onToggleExperience, this); + childSetCommitCallback("view_profile", onViewProfile, this); return LLPreview::postBuild(); -- cgit v1.2.3 From aed3cbce26a9e1e7ec70a43146fd405f3162f9d7 Mon Sep 17 00:00:00 2001 From: dolphin Date: Thu, 3 Oct 2013 10:16:52 -0700 Subject: Fix for ACME-986 and some cleanup --- indra/newview/llpreviewscript.cpp | 95 +++++++++++++++++++-------------------- 1 file changed, 47 insertions(+), 48 deletions(-) (limited to 'indra/newview/llpreviewscript.cpp') diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 1d3c7a3f20..d7d1ed3dfc 100755 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -1996,59 +1996,58 @@ void LLLiveLSLEditor::loadAsset() if(object) { LLViewerInventoryItem* item = dynamic_cast(object->getInventoryObject(mItemUUID)); - if(item - && (gAgent.allowOperation(PERM_COPY, item->getPermissions(), GP_OBJECT_MANIPULATE) - || gAgent.isGodlike())) - { - mItem = new LLViewerInventoryItem(item); - } - ExperienceAssociationResponder::fetchAssociatedExperience(item->getParentUUID(), item->getUUID(), boost::bind(&LLLiveLSLEditor::setAssociatedExperience, getDerivedHandle(), _1)); - if(!gAgent.isGodlike() - && (item - && (!gAgent.allowOperation(PERM_COPY, item->getPermissions(), GP_OBJECT_MANIPULATE) - || !gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE)))) - { - mItem = new LLViewerInventoryItem(item); - mScriptEd->setScriptText(getString("not_allowed"), FALSE); - mScriptEd->mEditor->makePristine(); - mScriptEd->enableSave(FALSE); - mAssetStatus = PREVIEW_ASSET_LOADED; - } - else if(item && mItem.notNull()) - { - // request the text from the object - LLUUID* user_data = new LLUUID(mItemUUID); // ^ mObjectUUID - gAssetStorage->getInvItemAsset(object->getRegion()->getHost(), - gAgent.getID(), - gAgent.getSessionID(), - item->getPermissions().getOwner(), - object->getID(), - item->getUUID(), - item->getAssetUUID(), - item->getType(), - &LLLiveLSLEditor::onLoadComplete, - (void*)user_data, - TRUE); - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_GetScriptRunning); - msg->nextBlockFast(_PREHASH_Script); - msg->addUUIDFast(_PREHASH_ObjectID, mObjectUUID); - msg->addUUIDFast(_PREHASH_ItemID, mItemUUID); - msg->sendReliable(object->getRegion()->getHost()); - mAskedForRunningInfo = TRUE; - mAssetStatus = PREVIEW_ASSET_LOADING; - } - else - { + if(item) + { + ExperienceAssociationResponder::fetchAssociatedExperience(item->getParentUUID(), item->getUUID(), boost::bind(&LLLiveLSLEditor::setAssociatedExperience, getDerivedHandle(), _1)); + + bool isGodlike = gAgent.isGodlike(); + bool copyManipulate = gAgent.allowOperation(PERM_COPY, item->getPermissions(), GP_OBJECT_MANIPULATE); + mIsModifiable = gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE); + + if(!isGodlike && (!copyManipulate || !mIsModifiable)) + { + mItem = new LLViewerInventoryItem(item); + mScriptEd->setScriptText(getString("not_allowed"), FALSE); + mScriptEd->mEditor->makePristine(); + mScriptEd->enableSave(FALSE); + mAssetStatus = PREVIEW_ASSET_LOADED; + } + else if(copyManipulate || isGodlike) + { + mItem = new LLViewerInventoryItem(item); + // request the text from the object + LLUUID* user_data = new LLUUID(mItemUUID); // ^ mObjectUUID + gAssetStorage->getInvItemAsset(object->getRegion()->getHost(), + gAgent.getID(), + gAgent.getSessionID(), + item->getPermissions().getOwner(), + object->getID(), + item->getUUID(), + item->getAssetUUID(), + item->getType(), + &LLLiveLSLEditor::onLoadComplete, + (void*)user_data, + TRUE); + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_GetScriptRunning); + msg->nextBlockFast(_PREHASH_Script); + msg->addUUIDFast(_PREHASH_ObjectID, mObjectUUID); + msg->addUUIDFast(_PREHASH_ItemID, mItemUUID); + msg->sendReliable(object->getRegion()->getHost()); + mAskedForRunningInfo = TRUE; + mAssetStatus = PREVIEW_ASSET_LOADING; + } + } + + if(mItem.isNull()) + { mScriptEd->setScriptText(LLStringUtil::null, FALSE); mScriptEd->mEditor->makePristine(); mAssetStatus = PREVIEW_ASSET_LOADED; - } + mIsModifiable = FALSE; + } - mIsModifiable = item && gAgent.allowOperation(PERM_MODIFY, - item->getPermissions(), - GP_OBJECT_MANIPULATE); // This is commented out, because we don't completely // handle script exports yet. -- cgit v1.2.3 From 7b9817cbcc5acab58d9d4355984b429850bd3ef8 Mon Sep 17 00:00:00 2001 From: dolphin Date: Mon, 10 Mar 2014 10:15:19 -0700 Subject: Fixed a bug that lost callbacks if > 10 experiences were looked up at a time. --- indra/newview/llpreviewscript.cpp | 66 ++++++++++++++++++++++++++------------- 1 file changed, 44 insertions(+), 22 deletions(-) (limited to 'indra/newview/llpreviewscript.cpp') diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index d7d1ed3dfc..e59c1c21f6 100755 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -1298,8 +1298,6 @@ void LLLiveLSLEditor::setExperienceIds( const LLSD& experience_ids ) void LLLiveLSLEditor::updateExperiencePanel() { - BOOL editable = getIsModifiable(); - if(mScriptEd->getAssociatedExperience().isNull()) { mExperienceEnabled->set(FALSE); @@ -1317,43 +1315,67 @@ void LLLiveLSLEditor::updateExperiencePanel() getChild("view_profile")->setVisible(FALSE); } else - { - mExperienceEnabled->setToolTip(getString("experience_enabled")); - mExperienceEnabled->setEnabled(editable); - mExperienceEnabled->set(TRUE); - mExperiences->setVisible(TRUE); - getChild("view_profile")->setVisible(TRUE); + { + mExperienceEnabled->setToolTip(getString("experience_enabled")); + mExperienceEnabled->setEnabled(getIsModifiable()); + mExperiences->setVisible(TRUE); buildExperienceList(); } } -void LLLiveLSLEditor::addExperienceInfo(const LLSD& experience, BOOL enabled) -{ - LLUUID id = experience[LLExperienceCache::EXPERIENCE_ID].asUUID(); - EAddPosition position = (id == mScriptEd->getAssociatedExperience())?ADD_TOP:ADD_BOTTOM; - LLScrollListItem* item=mExperiences->add(experience[LLExperienceCache::NAME], id, position ); - if(!enabled) - { - item->setEnabled(FALSE); - } -} - void LLLiveLSLEditor::buildExperienceList() { mExperiences->clearRows(); bool foundAssociated=false; + const LLUUID& associated = mScriptEd->getAssociatedExperience(); + LLSD experience; + LLUUID last; + LLScrollListItem* item; for(LLSD::array_const_iterator it = mExperienceIds.beginArray(); it != mExperienceIds.endArray(); ++it) { LLUUID id = it->asUUID(); - foundAssociated |= (id == mScriptEd->getAssociatedExperience()); - LLExperienceCache::get(id, boost::bind(&LLLiveLSLEditor::addExperienceInfo, this, _1, TRUE)); + EAddPosition position = ADD_BOTTOM; + if(id == associated) + { + foundAssociated = true; + position = ADD_TOP; + } + if(LLExperienceCache::get(id, experience)) + { + mExperiences->add(experience[LLExperienceCache::NAME].asString(), id, position); + } + else + { + mExperiences->add(getString("loading"), id, position); + last = id; + } + } if(!foundAssociated ) { - LLExperienceCache::get(mScriptEd->getAssociatedExperience(), boost::bind(&LLLiveLSLEditor::addExperienceInfo, this, _1, FALSE)); + if(LLExperienceCache::get(associated, experience)) + { + item=mExperiences->add(experience[LLExperienceCache::NAME].asString(), associated, ADD_TOP); + } + else + { + item=mExperiences->add(getString("loading"), associated, ADD_TOP); + last = associated; + } + item->setEnabled(FALSE); } + if(last.notNull()) + { + mExperiences->setEnabled(FALSE); + LLExperienceCache::get(last, boost::bind(&LLLiveLSLEditor::buildExperienceList, this)); + } + else + { + mExperiences->setEnabled(TRUE); + getChild("view_profile")->setVisible(TRUE); + } } -- cgit v1.2.3 From 74dcc04e69b845e62d25e83b615399f8a5d26d21 Mon Sep 17 00:00:00 2001 From: dolphin Date: Mon, 17 Mar 2014 15:57:15 -0700 Subject: Updated experience cache to get a const reference to xp data --- indra/newview/llpreviewscript.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'indra/newview/llpreviewscript.cpp') diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index e59c1c21f6..a4798f3911 100755 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -1319,6 +1319,7 @@ void LLLiveLSLEditor::updateExperiencePanel() mExperienceEnabled->setToolTip(getString("experience_enabled")); mExperienceEnabled->setEnabled(getIsModifiable()); mExperiences->setVisible(TRUE); + mExperienceEnabled->set(TRUE); buildExperienceList(); } } @@ -1328,7 +1329,6 @@ void LLLiveLSLEditor::buildExperienceList() mExperiences->clearRows(); bool foundAssociated=false; const LLUUID& associated = mScriptEd->getAssociatedExperience(); - LLSD experience; LLUUID last; LLScrollListItem* item; for(LLSD::array_const_iterator it = mExperienceIds.beginArray(); it != mExperienceIds.endArray(); ++it) @@ -1340,21 +1340,23 @@ void LLLiveLSLEditor::buildExperienceList() foundAssociated = true; position = ADD_TOP; } - if(LLExperienceCache::get(id, experience)) - { - mExperiences->add(experience[LLExperienceCache::NAME].asString(), id, position); - } - else + + const LLSD& experience = LLExperienceCache::get(id); + if(experience.isUndefined()) { mExperiences->add(getString("loading"), id, position); last = id; } - + else + { + mExperiences->add(experience[LLExperienceCache::NAME].asString(), id, position); + } } if(!foundAssociated ) - { - if(LLExperienceCache::get(associated, experience)) + { + const LLSD& experience = LLExperienceCache::get(associated); + if(experience.isDefined()) { item=mExperiences->add(experience[LLExperienceCache::NAME].asString(), associated, ADD_TOP); } -- cgit v1.2.3 From 8a45e1915dfa2bb1fed85b8340b0e21584e3dc8a Mon Sep 17 00:00:00 2001 From: dolphin Date: Tue, 27 May 2014 15:43:17 -0700 Subject: ACME-1495: Fxied merge --- indra/newview/llpreviewscript.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llpreviewscript.cpp') diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index d924b36bb9..99c6f2bd12 100755 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -2118,6 +2118,8 @@ void LLLiveLSLEditor::loadAsset() time_corrected()); mAssetStatus = PREVIEW_ASSET_LOADED; } + + requestExperiences(); } // static -- cgit v1.2.3 From a9c281eb57206a0ff7083788e593a22b9f8ad01a Mon Sep 17 00:00:00 2001 From: Cho Date: Tue, 24 Jun 2014 03:47:03 +0100 Subject: Updated ExperienceResponder in llpreviewscript.cpp to use new LLCurl::Responder interface for ACME-1534 --- indra/newview/llpreviewscript.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/llpreviewscript.cpp') diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 99c6f2bd12..780c41172d 100755 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -123,7 +123,7 @@ static bool have_script_upload_cap(LLUUID& object_id) } -class ExperienceResponder : public LLHTTPClient::Responder +class ExperienceResponder : public LLCurl::Responder { public: ExperienceResponder(const LLHandle& parent):mParent(parent) @@ -132,13 +132,13 @@ public: LLHandle mParent; - virtual void result(const LLSD& content) + /*virtual*/ void httpSuccess() { LLLiveLSLEditor* parent = mParent.get(); if(!parent) return; - parent->setExperienceIds(content["experience_ids"]); + parent->setExperienceIds(getContent()["experience_ids"]); } }; -- cgit v1.2.3 From 200788c344f5449f99eacc9167ac15c7e6262b69 Mon Sep 17 00:00:00 2001 From: Cho Date: Tue, 24 Jun 2014 22:43:23 +0100 Subject: Updated all experience responders for LLCurl::Responder interface changes for ACME-1535 and ACME-1536 --- indra/newview/llpreviewscript.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpreviewscript.cpp') diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 780c41172d..1732d4b3e5 100755 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -123,7 +123,7 @@ static bool have_script_upload_cap(LLUUID& object_id) } -class ExperienceResponder : public LLCurl::Responder +class ExperienceResponder : public LLHTTPClient::Responder { public: ExperienceResponder(const LLHandle& parent):mParent(parent) -- cgit v1.2.3 From 5b82645ba2db049589cdc2f22c8c63794b949772 Mon Sep 17 00:00:00 2001 From: Cho Date: Wed, 20 Aug 2014 00:33:23 +0100 Subject: Added tooltip to > button in script editor for ACME-1588 --- indra/newview/llpreviewscript.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llpreviewscript.cpp') diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index a4023112ea..6830998a8a 100755 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -1307,6 +1307,7 @@ void LLLiveLSLEditor::updateExperiencePanel() mExperienceEnabled->setEnabled(getIsModifiable()); mExperiences->setVisible(TRUE); mExperienceEnabled->set(TRUE); + getChild("view_profile")->setToolTip(getString("show_experience_profile")); buildExperienceList(); } } -- cgit v1.2.3 From da639d1c9817c7333b959638e9a33b6ae7c664c0 Mon Sep 17 00:00:00 2001 From: Cho Date: Thu, 21 Aug 2014 19:43:50 +0100 Subject: Show experiences with blank names as (untitled experience) in experience search, script editor, and allowed/trusted/blocked lists for ACME-1585 --- indra/newview/llpreviewscript.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpreviewscript.cpp') diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index ffaffbe538..17727ef9a1 100755 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -1337,7 +1337,12 @@ void LLLiveLSLEditor::buildExperienceList() } else { - mExperiences->add(experience[LLExperienceCache::NAME].asString(), id, position); + std::string experience_name_string = experience[LLExperienceCache::NAME].asString(); + if (experience_name_string.empty()) + { + experience_name_string = LLTrans::getString("ExperienceNameUntitled"); + } + mExperiences->add(experience_name_string, id, position); } } @@ -1346,7 +1351,12 @@ void LLLiveLSLEditor::buildExperienceList() const LLSD& experience = LLExperienceCache::get(associated); if(experience.isDefined()) { - item=mExperiences->add(experience[LLExperienceCache::NAME].asString(), associated, ADD_TOP); + std::string experience_name_string = experience[LLExperienceCache::NAME].asString(); + if (experience_name_string.empty()) + { + experience_name_string = LLTrans::getString("ExperienceNameUntitled"); + } + item=mExperiences->add(experience_name_string, associated, ADD_TOP); } else { -- cgit v1.2.3