diff options
author | dolphin <dolphin@lindenlab.com> | 2013-05-20 10:04:29 -0700 |
---|---|---|
committer | dolphin <dolphin@lindenlab.com> | 2013-05-20 10:04:29 -0700 |
commit | 6308f93c6adddc9d396e8d2527e97e0d02c4aa52 (patch) | |
tree | 77190643f913c65cc17c49045f5f9c1fa0b13ce6 /indra/newview | |
parent | eec08ef64c59fa7569c7418d40135d73338e1d8d (diff) |
WIP check in, testing GetMeta
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llpreviewscript.cpp | 71 | ||||
-rw-r--r-- | indra/newview/llpreviewscript.h | 11 | ||||
-rw-r--r-- | indra/newview/llviewerregion.cpp | 3 |
3 files changed, 76 insertions, 9 deletions
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<LLLiveLSLEditor>("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<LLLiveLSLEditor>("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); + } +} diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h index 27252d17a1..b29d16c58d 100644 --- a/indra/newview/llpreviewscript.h +++ b/indra/newview/llpreviewscript.h @@ -108,7 +108,8 @@ public: virtual bool hasAccelerators() const { return true; } void addExperienceInfo( const LLSD& experience ); void clearExperiences(); - LLUUID getSelectedExperience()const; + LLUUID getSelectedExperience()const; + void setAssociatedExperience( const LLUUID& experience_id ); private: void onBtnHelp(); @@ -139,7 +140,7 @@ private: void (*mLoadCallback)(void* userdata); void (*mSaveCallback)(void* userdata, BOOL close_after_save); void (*mSearchReplaceCallback) (void* userdata); - void* mUserdata; + void* mUserdata; LLComboBox *mFunctions; LLComboBox *mExperiences; BOOL mForceClose; @@ -153,6 +154,7 @@ private: BOOL mEnableSave; BOOL mHasScriptData; LLLiveLSLFile* mLiveFile; + LLUUID mAssociatedExperience; LLScriptEdContainer* mContainer; // parent view }; @@ -234,7 +236,8 @@ public: /*virtual*/ BOOL postBuild(); - void setIsNew() { mIsNew = TRUE; } + void setIsNew() { mIsNew = TRUE; } + void setAssociatedExperience( const LLUUID& experience_id ); private: virtual BOOL canClose(); @@ -285,7 +288,7 @@ private: S32 mPendingUploads; BOOL getIsModifiable() const { return mIsModifiable; } // Evaluated on load assert - + LLCheckBoxCtrl* mMonoCheckbox; BOOL mIsModifiable; }; diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index cd33442f7c..421e354610 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1599,7 +1599,8 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) capabilityNames.append("GetExperiences"); capabilityNames.append("GetExperienceInfo"); capabilityNames.append("GetCreatorExperiences"); - capabilityNames.append("GetMesh"); + capabilityNames.append("GetMesh"); + capabilityNames.append("GetMetadata"); capabilityNames.append("GetObjectCost"); capabilityNames.append("GetObjectPhysicsData"); capabilityNames.append("GetTexture"); |