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