From fc971a2c8fb701e07825e1f0abb2c720d40e0bf2 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Fri, 27 Feb 2015 12:52:40 +0100 Subject: [PATCH] Housekeeping... --- indra/newview/ao.cpp | 523 ++++---- indra/newview/ao.h | 8 +- indra/newview/aoengine.cpp | 1209 +++++++++++-------- indra/newview/aoengine.h | 34 +- indra/newview/aoset.cpp | 78 +- indra/newview/aoset.h | 4 +- indra/newview/dialogstack.cpp | 6 +- indra/newview/fsfloaterim.cpp | 59 +- indra/newview/fsfloaterim.h | 16 +- indra/newview/fsfloaternearbychat.cpp | 18 +- indra/newview/fsfloaternearbychat.h | 19 +- indra/newview/fspanelprofile.cpp | 114 +- indra/newview/fspanelprofileclassifieds.cpp | 79 +- indra/newview/llviewerfloaterreg.cpp | 2 +- 14 files changed, 1190 insertions(+), 979 deletions(-) diff --git a/indra/newview/ao.cpp b/indra/newview/ao.cpp index 91cf8b8f30..c763b2905c 100644 --- a/indra/newview/ao.cpp +++ b/indra/newview/ao.cpp @@ -39,7 +39,7 @@ #include "utilitybar.h" FloaterAO::FloaterAO(const LLSD& key) -: LLTransientDockableFloater(NULL,true,key),LLEventTimer(10.f), +: LLTransientDockableFloater(NULL, true, key), LLEventTimer(10.f), mSetList(0), mSelectedSet(0), mSelectedState(0), @@ -57,10 +57,14 @@ FloaterAO::~FloaterAO() void FloaterAO::reloading(BOOL yes) { - if(yes) + if (yes) + { mEventTimer.start(); + } else + { mEventTimer.stop(); + } mReloadCoverPanel->setVisible(yes); enableSetControls(!yes); @@ -81,7 +85,7 @@ void FloaterAO::updateSetParameters() mOverrideSitsCheckBoxSmall->setValue(mSelectedSet->getSitOverride()); mSmartCheckBox->setValue(mSelectedSet->getSmart()); mDisableMouselookCheckBox->setValue(mSelectedSet->getMouselookDisable()); - BOOL isDefault=(mSelectedSet==AOEngine::instance().getDefaultSet()) ? TRUE : FALSE; + BOOL isDefault = (mSelectedSet == AOEngine::instance().getDefaultSet()) ? TRUE : FALSE; mDefaultCheckBox->setValue(isDefault); mDefaultCheckBox->setEnabled(!isDefault); updateSmart(); @@ -89,31 +93,35 @@ void FloaterAO::updateSetParameters() void FloaterAO::updateAnimationList() { - S32 currentStateSelected=mStateSelector->getCurrentIndex(); + S32 currentStateSelected = mStateSelector->getCurrentIndex(); mStateSelector->removeall(); onChangeAnimationSelection(); - if(!mSelectedSet) + if (!mSelectedSet) { mStateSelector->setEnabled(FALSE); mStateSelector->add(getString("ao_no_animations_loaded")); return; } - for(U32 index=0;indexmStateNames.size();index++) + for (U32 index = 0; index < mSelectedSet->mStateNames.size(); ++index) { - std::string stateName=mSelectedSet->mStateNames[index]; - AOSet::AOState* state=mSelectedSet->getStateByName(stateName); - mStateSelector->add(stateName,state,ADD_BOTTOM,TRUE); + std::string stateName = mSelectedSet->mStateNames[index]; + AOSet::AOState* state = mSelectedSet->getStateByName(stateName); + mStateSelector->add(stateName, state, ADD_BOTTOM, TRUE); } enableStateControls(TRUE); - if(currentStateSelected==-1) + if (currentStateSelected == -1) + { mStateSelector->selectFirstItem(); + } else + { mStateSelector->selectNthItem(currentStateSelected); + } onSelectState(); } @@ -121,11 +129,13 @@ void FloaterAO::updateAnimationList() void FloaterAO::updateList() { mReloadButton->setEnabled(TRUE); - mImportRunning=FALSE; + mImportRunning = FALSE; - std::string currentSetName=mSetSelector->getSelectedItemLabel(); - if(currentSetName.empty()) - currentSetName=AOEngine::instance().getCurrentSetName(); + std::string currentSetName = mSetSelector->getSelectedItemLabel(); + if (currentSetName.empty()) + { + currentSetName = AOEngine::instance().getCurrentSetName(); + } mSetList=AOEngine::instance().getSetList(); mSetSelector->removeall(); @@ -134,10 +144,10 @@ void FloaterAO::updateList() mSetSelectorSmall->clear(); mAnimationList->deleteAllItems(); - mCurrentBoldItem=NULL; + mCurrentBoldItem = NULL; reloading(FALSE); - if(mSetList.empty()) + if (mSetList.empty()) { LL_DEBUGS("AOEngine") << "empty set list" << LL_ENDL; mSetSelector->add(getString("ao_no_sets_loaded")); @@ -148,14 +158,14 @@ void FloaterAO::updateList() return; } - for(U32 index=0;indexgetName(); - mSetSelector->add(setName,&mSetList[index],ADD_BOTTOM,TRUE); - mSetSelectorSmall->add(setName,&mSetList[index],ADD_BOTTOM,TRUE); - if(setName.compare(currentSetName)==0) + std::string setName = mSetList[index]->getName(); + mSetSelector->add(setName, &mSetList[index], ADD_BOTTOM, TRUE); + mSetSelectorSmall->add(setName, &mSetList[index], ADD_BOTTOM, TRUE); + if (setName.compare(currentSetName) == 0) { - mSelectedSet=AOEngine::instance().selectSetByName(currentSetName); + mSelectedSet = AOEngine::instance().selectSetByName(currentSetName); mSetSelector->selectNthItem(index); mSetSelectorSmall->selectNthItem(index); updateSetParameters(); @@ -167,76 +177,76 @@ void FloaterAO::updateList() BOOL FloaterAO::postBuild() { - LLPanel* aoPanel=getChild("animation_overrider_outer_panel"); - mMainInterfacePanel=aoPanel->getChild("animation_overrider_panel"); - mSmallInterfacePanel=aoPanel->getChild("animation_overrider_panel_small"); - mReloadCoverPanel=aoPanel->getChild("ao_reload_cover"); + LLPanel* aoPanel = getChild("animation_overrider_outer_panel"); + mMainInterfacePanel = aoPanel->getChild("animation_overrider_panel"); + mSmallInterfacePanel = aoPanel->getChild("animation_overrider_panel_small"); + mReloadCoverPanel = aoPanel->getChild("ao_reload_cover"); - mSetSelector=mMainInterfacePanel->getChild("ao_set_selection_combo"); - mActivateSetButton=mMainInterfacePanel->getChild("ao_activate"); - mAddButton=mMainInterfacePanel->getChild("ao_add"); - mRemoveButton=mMainInterfacePanel->getChild("ao_remove"); - mDefaultCheckBox=mMainInterfacePanel->getChild("ao_default"); - mOverrideSitsCheckBox=mMainInterfacePanel->getChild("ao_sit_override"); - mSmartCheckBox=mMainInterfacePanel->getChild("ao_smart"); - mDisableMouselookCheckBox=mMainInterfacePanel->getChild("ao_disable_stands_in_mouselook"); + mSetSelector = mMainInterfacePanel->getChild("ao_set_selection_combo"); + mActivateSetButton = mMainInterfacePanel->getChild("ao_activate"); + mAddButton = mMainInterfacePanel->getChild("ao_add"); + mRemoveButton = mMainInterfacePanel->getChild("ao_remove"); + mDefaultCheckBox = mMainInterfacePanel->getChild("ao_default"); + mOverrideSitsCheckBox = mMainInterfacePanel->getChild("ao_sit_override"); + mSmartCheckBox = mMainInterfacePanel->getChild("ao_smart"); + mDisableMouselookCheckBox = mMainInterfacePanel->getChild("ao_disable_stands_in_mouselook"); - mStateSelector=mMainInterfacePanel->getChild("ao_state_selection_combo"); - mAnimationList=mMainInterfacePanel->getChild("ao_state_animation_list"); - mMoveUpButton=mMainInterfacePanel->getChild("ao_move_up"); - mMoveDownButton=mMainInterfacePanel->getChild("ao_move_down"); - mTrashButton=mMainInterfacePanel->getChild("ao_trash"); - mCycleCheckBox=mMainInterfacePanel->getChild("ao_cycle"); - mRandomizeCheckBox=mMainInterfacePanel->getChild("ao_randomize"); - mCycleTimeTextLabel=mMainInterfacePanel->getChild("ao_cycle_time_seconds_label"); - mCycleTimeSpinner=mMainInterfacePanel->getChild("ao_cycle_time"); + mStateSelector = mMainInterfacePanel->getChild("ao_state_selection_combo"); + mAnimationList = mMainInterfacePanel->getChild("ao_state_animation_list"); + mMoveUpButton = mMainInterfacePanel->getChild("ao_move_up"); + mMoveDownButton = mMainInterfacePanel->getChild("ao_move_down"); + mTrashButton = mMainInterfacePanel->getChild("ao_trash"); + mCycleCheckBox = mMainInterfacePanel->getChild("ao_cycle"); + mRandomizeCheckBox = mMainInterfacePanel->getChild("ao_randomize"); + mCycleTimeTextLabel = mMainInterfacePanel->getChild("ao_cycle_time_seconds_label"); + mCycleTimeSpinner = mMainInterfacePanel->getChild("ao_cycle_time"); - mReloadButton=mMainInterfacePanel->getChild("ao_reload"); - mPreviousButton=mMainInterfacePanel->getChild("ao_previous"); - mNextButton=mMainInterfacePanel->getChild("ao_next"); - mLessButton=mMainInterfacePanel->getChild("ao_less"); + mReloadButton = mMainInterfacePanel->getChild("ao_reload"); + mPreviousButton = mMainInterfacePanel->getChild("ao_previous"); + mNextButton = mMainInterfacePanel->getChild("ao_next"); + mLessButton = mMainInterfacePanel->getChild("ao_less"); - mSetSelectorSmall=mSmallInterfacePanel->getChild("ao_set_selection_combo_small"); - mMoreButton=mSmallInterfacePanel->getChild("ao_more"); - mPreviousButtonSmall=mSmallInterfacePanel->getChild("ao_previous_small"); - mNextButtonSmall=mSmallInterfacePanel->getChild("ao_next_small"); - mOverrideSitsCheckBoxSmall=mSmallInterfacePanel->getChild("ao_sit_override_small"); + mSetSelectorSmall = mSmallInterfacePanel->getChild("ao_set_selection_combo_small"); + mMoreButton = mSmallInterfacePanel->getChild("ao_more"); + mPreviousButtonSmall = mSmallInterfacePanel->getChild("ao_previous_small"); + mNextButtonSmall = mSmallInterfacePanel->getChild("ao_next_small"); + mOverrideSitsCheckBoxSmall = mSmallInterfacePanel->getChild("ao_sit_override_small"); - mSetSelector->setCommitCallback(boost::bind(&FloaterAO::onSelectSet,this)); - mActivateSetButton->setCommitCallback(boost::bind(&FloaterAO::onClickActivate,this)); - mAddButton->setCommitCallback(boost::bind(&FloaterAO::onClickAdd,this)); - mRemoveButton->setCommitCallback(boost::bind(&FloaterAO::onClickRemove,this)); - mDefaultCheckBox->setCommitCallback(boost::bind(&FloaterAO::onCheckDefault,this)); - mOverrideSitsCheckBox->setCommitCallback(boost::bind(&FloaterAO::onCheckOverrideSits,this)); - mSmartCheckBox->setCommitCallback(boost::bind(&FloaterAO::onCheckSmart,this)); - mDisableMouselookCheckBox->setCommitCallback(boost::bind(&FloaterAO::onCheckDisableStands,this)); + mSetSelector->setCommitCallback(boost::bind(&FloaterAO::onSelectSet, this)); + mActivateSetButton->setCommitCallback(boost::bind(&FloaterAO::onClickActivate, this)); + mAddButton->setCommitCallback(boost::bind(&FloaterAO::onClickAdd, this)); + mRemoveButton->setCommitCallback(boost::bind(&FloaterAO::onClickRemove, this)); + mDefaultCheckBox->setCommitCallback(boost::bind(&FloaterAO::onCheckDefault, this)); + mOverrideSitsCheckBox->setCommitCallback(boost::bind(&FloaterAO::onCheckOverrideSits, this)); + mSmartCheckBox->setCommitCallback(boost::bind(&FloaterAO::onCheckSmart, this)); + mDisableMouselookCheckBox->setCommitCallback(boost::bind(&FloaterAO::onCheckDisableStands, this)); mAnimationList->setCommitOnSelectionChange(TRUE); - mStateSelector->setCommitCallback(boost::bind(&FloaterAO::onSelectState,this)); - mAnimationList->setCommitCallback(boost::bind(&FloaterAO::onChangeAnimationSelection,this)); - mMoveUpButton->setCommitCallback(boost::bind(&FloaterAO::onClickMoveUp,this)); - mMoveDownButton->setCommitCallback(boost::bind(&FloaterAO::onClickMoveDown,this)); - mTrashButton->setCommitCallback(boost::bind(&FloaterAO::onClickTrash,this)); - mCycleCheckBox->setCommitCallback(boost::bind(&FloaterAO::onCheckCycle,this)); - mRandomizeCheckBox->setCommitCallback(boost::bind(&FloaterAO::onCheckRandomize,this)); - mCycleTimeSpinner->setCommitCallback(boost::bind(&FloaterAO::onChangeCycleTime,this)); + mStateSelector->setCommitCallback(boost::bind(&FloaterAO::onSelectState, this)); + mAnimationList->setCommitCallback(boost::bind(&FloaterAO::onChangeAnimationSelection, this)); + mMoveUpButton->setCommitCallback(boost::bind(&FloaterAO::onClickMoveUp, this)); + mMoveDownButton->setCommitCallback(boost::bind(&FloaterAO::onClickMoveDown, this)); + mTrashButton->setCommitCallback(boost::bind(&FloaterAO::onClickTrash, this)); + mCycleCheckBox->setCommitCallback(boost::bind(&FloaterAO::onCheckCycle, this)); + mRandomizeCheckBox->setCommitCallback(boost::bind(&FloaterAO::onCheckRandomize, this)); + mCycleTimeSpinner->setCommitCallback(boost::bind(&FloaterAO::onChangeCycleTime, this)); - mReloadButton->setCommitCallback(boost::bind(&FloaterAO::onClickReload,this)); - mPreviousButton->setCommitCallback(boost::bind(&FloaterAO::onClickPrevious,this)); - mNextButton->setCommitCallback(boost::bind(&FloaterAO::onClickNext,this)); - mLessButton->setCommitCallback(boost::bind(&FloaterAO::onClickLess,this)); - mOverrideSitsCheckBoxSmall->setCommitCallback(boost::bind(&FloaterAO::onCheckOverrideSitsSmall,this)); + mReloadButton->setCommitCallback(boost::bind(&FloaterAO::onClickReload, this)); + mPreviousButton->setCommitCallback(boost::bind(&FloaterAO::onClickPrevious, this)); + mNextButton->setCommitCallback(boost::bind(&FloaterAO::onClickNext, this)); + mLessButton->setCommitCallback(boost::bind(&FloaterAO::onClickLess, this)); + mOverrideSitsCheckBoxSmall->setCommitCallback(boost::bind(&FloaterAO::onCheckOverrideSitsSmall, this)); - mSetSelectorSmall->setCommitCallback(boost::bind(&FloaterAO::onSelectSetSmall,this)); - mMoreButton->setCommitCallback(boost::bind(&FloaterAO::onClickMore,this)); - mPreviousButtonSmall->setCommitCallback(boost::bind(&FloaterAO::onClickPrevious,this)); - mNextButtonSmall->setCommitCallback(boost::bind(&FloaterAO::onClickNext,this)); + mSetSelectorSmall->setCommitCallback(boost::bind(&FloaterAO::onSelectSetSmall, this)); + mMoreButton->setCommitCallback(boost::bind(&FloaterAO::onClickMore, this)); + mPreviousButtonSmall->setCommitCallback(boost::bind(&FloaterAO::onClickPrevious, this)); + mNextButtonSmall->setCommitCallback(boost::bind(&FloaterAO::onClickNext, this)); updateSmart(); - AOEngine::instance().setReloadCallback(boost::bind(&FloaterAO::updateList,this)); - AOEngine::instance().setAnimationChangedCallback(boost::bind(&FloaterAO::onAnimationChanged,this,_1)); + AOEngine::instance().setReloadCallback(boost::bind(&FloaterAO::updateList, this)); + AOEngine::instance().setAnimationChangedCallback(boost::bind(&FloaterAO::onAnimationChanged, this, _1)); onChangeAnimationSelection(); mMainInterfacePanel->setVisible(TRUE); @@ -245,10 +255,14 @@ BOOL FloaterAO::postBuild() updateList(); - if(gSavedPerAccountSettings.getBOOL("UseFullAOInterface")) + if (gSavedPerAccountSettings.getBOOL("UseFullAOInterface")) + { onClickMore(); + } else + { onClickLess(); + } return LLDockableFloater::postBuild(); } @@ -263,8 +277,11 @@ void FloaterAO::enableSetControls(BOOL yes) mOverrideSitsCheckBox->setEnabled(yes); mOverrideSitsCheckBoxSmall->setEnabled(yes); mDisableMouselookCheckBox->setEnabled(yes); - if(!yes) + + if (!yes) + { enableStateControls(yes); + } } void FloaterAO::enableStateControls(BOOL yes) @@ -272,8 +289,10 @@ void FloaterAO::enableStateControls(BOOL yes) mStateSelector->setEnabled(yes); mAnimationList->setEnabled(yes); mCycleCheckBox->setEnabled(yes); - if(yes) + if (yes) + { updateCycleParameters(); + } else { mRandomizeCheckBox->setEnabled(yes); @@ -284,7 +303,7 @@ void FloaterAO::enableStateControls(BOOL yes) mPreviousButtonSmall->setEnabled(yes); mNextButton->setEnabled(yes); mNextButtonSmall->setEnabled(yes); - mCanDragAndDrop=yes; + mCanDragAndDrop = yes; } void FloaterAO::onOpen(const LLSD& key) @@ -302,8 +321,8 @@ void FloaterAO::onClose(bool app_quitting) void FloaterAO::onSelectSet() { - AOSet* set=AOEngine::instance().getSetByName(mSetSelector->getSelectedItemLabel()); - if(!set) + AOSet* set = AOEngine::instance().getSetByName(mSetSelector->getSelectedItemLabel()); + if (!set) { onRenameSet(); return; @@ -320,8 +339,8 @@ void FloaterAO::onSelectSetSmall() // sync main set selector with small set selector mSetSelector->selectNthItem(mSetSelectorSmall->getCurrentIndex()); - mSelectedSet=AOEngine::instance().getSetByName(mSetSelectorSmall->getSelectedItemLabel()); - if(mSelectedSet) + mSelectedSet = AOEngine::instance().getSetByName(mSetSelectorSmall->getSelectedItemLabel()); + if (mSelectedSet) { updateSetParameters(); updateAnimationList(); @@ -333,24 +352,24 @@ void FloaterAO::onSelectSetSmall() void FloaterAO::onRenameSet() { - if(!mSelectedSet) + if (!mSelectedSet) { LL_WARNS("AOEngine") << "Rename AO set without set selected." << LL_ENDL; return; } - std::string name=mSetSelector->getSimple(); + std::string name = mSetSelector->getSimple(); LLStringUtil::trim(name); - LLUIString new_set_name=name; + LLUIString new_set_name = name; - if(!name.empty()) + if (!name.empty()) { - if( + if ( LLTextValidate::validateASCIIPrintableNoPipe(new_set_name.getWString()) && // only allow ASCII - name.find_first_of(":|")==std::string::npos) // don't allow : or | + name.find_first_of(":|") == std::string::npos) // don't allow : or | { - if(AOEngine::instance().renameSet(mSelectedSet,name)) + if (AOEngine::instance().renameSet(mSelectedSet, name)) { reloading(TRUE); return; @@ -359,8 +378,8 @@ void FloaterAO::onRenameSet() else { LLSD args; - args["AO_SET_NAME"]=name; - LLNotificationsUtil::add("RenameAOMustBeASCII",args); + args["AO_SET_NAME"] = name; + LLNotificationsUtil::add("RenameAOMustBeASCII", args); } } mSetSelector->setSimple(mSelectedSet->getName()); @@ -378,13 +397,13 @@ void FloaterAO::onClickActivate() LLScrollListItem* FloaterAO::addAnimation(const std::string& name) { LLSD row; - row["columns"][0]["column"]="icon"; - row["columns"][0]["type"]="icon"; - row["columns"][0]["value"]="Inv_Animation"; + row["columns"][0]["column"] = "icon"; + row["columns"][0]["type"] = "icon"; + row["columns"][0]["value"] = "Inv_Animation"; - row["columns"][1]["column"]="animation_name"; - row["columns"][1]["type"]="text"; - row["columns"][1]["value"]=name; + row["columns"][1]["column"] = "animation_name"; + row["columns"][1]["type"] = "text"; + row["columns"][1]["value"] = name; return mAnimationList->addElement(row); } @@ -392,27 +411,33 @@ LLScrollListItem* FloaterAO::addAnimation(const std::string& name) void FloaterAO::onSelectState() { mAnimationList->deleteAllItems(); - mCurrentBoldItem=NULL; + mCurrentBoldItem = NULL; mAnimationList->setCommentText(getString("ao_no_animations_loaded")); mAnimationList->setEnabled(FALSE); onChangeAnimationSelection(); - if(!mSelectedSet) - return; - - mSelectedState=mSelectedSet->getStateByName(mStateSelector->getSelectedItemLabel()); - if(!mSelectedState) - return; - - mSelectedState=(AOSet::AOState*) mStateSelector->getCurrentUserdata(); - if(mSelectedState->mAnimations.size()) + if (!mSelectedSet) { - for(U32 index=0;indexmAnimations.size();index++) + return; + } + + mSelectedState = mSelectedSet->getStateByName(mStateSelector->getSelectedItemLabel()); + if (!mSelectedState) + { + return; + } + + mSelectedState = (AOSet::AOState*)mStateSelector->getCurrentUserdata(); + if (mSelectedState->mAnimations.size()) + { + for (U32 index = 0; index < mSelectedState->mAnimations.size(); ++index) { - LLScrollListItem* item=addAnimation(mSelectedState->mAnimations[index].mName); - if(item) + LLScrollListItem* item = addAnimation(mSelectedState->mAnimations[index].mName); + if (item) + { item->setUserdata(&mSelectedState->mAnimations[index].mInventoryUUID); + } } mAnimationList->setCommentText(""); @@ -430,8 +455,8 @@ void FloaterAO::onClickReload() { reloading(TRUE); - mSelectedSet=0; - mSelectedState=0; + mSelectedSet = 0; + mSelectedState = 0; AOEngine::instance().reload(false); updateList(); @@ -439,35 +464,35 @@ void FloaterAO::onClickReload() void FloaterAO::onClickAdd() { - LLNotificationsUtil::add("NewAOSet",LLSD(),LLSD(),boost::bind(&FloaterAO::newSetCallback,this,_1,_2)); + LLNotificationsUtil::add("NewAOSet", LLSD(), LLSD(), boost::bind(&FloaterAO::newSetCallback, this, _1, _2)); } -BOOL FloaterAO::newSetCallback(const LLSD& notification,const LLSD& response) +BOOL FloaterAO::newSetCallback(const LLSD& notification, const LLSD& response) { - std::string newSetName=response["message"].asString(); - S32 option=LLNotificationsUtil::getSelectedOption(notification,response); + std::string newSetName = response["message"].asString(); + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); LLStringUtil::trim(newSetName); - LLUIString new_set_name=newSetName; + LLUIString new_set_name = newSetName; - if(newSetName.empty()) + if (newSetName.empty()) { return FALSE; } - else if( + else if ( !LLTextValidate::validateASCIIPrintableNoPipe(new_set_name.getWString()) || // only allow ASCII - newSetName.find_first_of(":|")!=std::string::npos) // don't allow : or | + newSetName.find_first_of(":|") != std::string::npos) // don't allow : or | { LLSD args; - args["AO_SET_NAME"]=newSetName; - LLNotificationsUtil::add("NewAOCantContainNonASCII",args); + args["AO_SET_NAME"] = newSetName; + LLNotificationsUtil::add("NewAOCantContainNonASCII", args); return FALSE; } - if(option==0) + if (option == 0) { - if(AOEngine::instance().addSet(newSetName).notNull()) + if (AOEngine::instance().addSet(newSetName).notNull()) { reloading(TRUE); return TRUE; @@ -478,22 +503,24 @@ BOOL FloaterAO::newSetCallback(const LLSD& notification,const LLSD& response) void FloaterAO::onClickRemove() { - if(!mSelectedSet) + if (!mSelectedSet) + { return; + } LLSD args; - args["AO_SET_NAME"]=mSelectedSet->getName(); - LLNotificationsUtil::add("RemoveAOSet",args,LLSD(),boost::bind(&FloaterAO::removeSetCallback,this,_1,_2)); + args["AO_SET_NAME"] = mSelectedSet->getName(); + LLNotificationsUtil::add("RemoveAOSet", args, LLSD(), boost::bind(&FloaterAO::removeSetCallback, this, _1, _2)); } -BOOL FloaterAO::removeSetCallback(const LLSD& notification,const LLSD& response) +BOOL FloaterAO::removeSetCallback(const LLSD& notification, const LLSD& response) { - std::string newSetName=response["message"].asString(); - S32 option=LLNotificationsUtil::getSelectedOption(notification,response); + std::string newSetName = response["message"].asString(); + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - if(option==0) + if (option ==0 ) { - if(AOEngine::instance().removeSet(mSelectedSet)) + if (AOEngine::instance().removeSet(mSelectedSet)) { reloading(TRUE); // to prevent snapping back to deleted set @@ -503,7 +530,7 @@ BOOL FloaterAO::removeSetCallback(const LLSD& notification,const LLSD& response) mSetSelector->clear(); mSetSelectorSmall->clear(); mAnimationList->deleteAllItems(); - mCurrentBoldItem=NULL; + mCurrentBoldItem = NULL; return TRUE; } } @@ -512,15 +539,19 @@ BOOL FloaterAO::removeSetCallback(const LLSD& notification,const LLSD& response) void FloaterAO::onCheckDefault() { - if(mSelectedSet) + if (mSelectedSet) + { AOEngine::instance().setDefaultSet(mSelectedSet); + } } void FloaterAO::onCheckOverrideSits() { mOverrideSitsCheckBoxSmall->setValue(mOverrideSitsCheckBox->getValue()); - if(mSelectedSet) - AOEngine::instance().setOverrideSits(mSelectedSet,mOverrideSitsCheckBox->getValue().asBoolean()); + if (mSelectedSet) + { + AOEngine::instance().setOverrideSits(mSelectedSet, mOverrideSitsCheckBox->getValue().asBoolean()); + } updateSmart(); } @@ -537,37 +568,43 @@ void FloaterAO::updateSmart() void FloaterAO::onCheckSmart() { - if(mSelectedSet) - AOEngine::instance().setSmart(mSelectedSet,mSmartCheckBox->getValue().asBoolean()); + if (mSelectedSet) + { + AOEngine::instance().setSmart(mSelectedSet, mSmartCheckBox->getValue().asBoolean()); + } } void FloaterAO::onCheckDisableStands() { - if(mSelectedSet) - AOEngine::instance().setDisableStands(mSelectedSet,mDisableMouselookCheckBox->getValue().asBoolean()); + if (mSelectedSet) + { + AOEngine::instance().setDisableStands(mSelectedSet, mDisableMouselookCheckBox->getValue().asBoolean()); + } } void FloaterAO::onChangeAnimationSelection() { - std::vector list=mAnimationList->getAllSelected(); + std::vector list = mAnimationList->getAllSelected(); LL_DEBUGS("AOEngine") << "Selection count: " << list.size() << LL_ENDL; - BOOL resortEnable=FALSE; - BOOL trashEnable=FALSE; + BOOL resortEnable = FALSE; + BOOL trashEnable = FALSE; // Linden Lab bug: scroll lists still select the first item when you click on them, even when they are disabled. // The control does not memorize it's enabled/disabled state, so mAnimationList->mEnabled() doesn't seem to work. // So we need to safeguard against it. - if(!mCanDragAndDrop) + if (!mCanDragAndDrop) { mAnimationList->deselectAllItems(); LL_DEBUGS("AOEngine") << "Selection count now: " << list.size() << LL_ENDL; } - else if(list.size()>0) + else if (list.size() > 0) { - if(list.size()==1) - resortEnable=TRUE; - trashEnable=TRUE; + if (list.size() == 1) + { + resortEnable = TRUE; + } + trashEnable = TRUE; } mMoveDownButton->setEnabled(resortEnable); @@ -577,57 +614,79 @@ void FloaterAO::onChangeAnimationSelection() void FloaterAO::onClickMoveUp() { - if(!mSelectedState) + if (!mSelectedState) + { return; + } - std::vector list=mAnimationList->getAllSelected(); - if(list.size()!=1) + std::vector list = mAnimationList->getAllSelected(); + if (list.size() != 1) + { return; + } - S32 currentIndex=mAnimationList->getFirstSelectedIndex(); - if(currentIndex==-1) + S32 currentIndex = mAnimationList->getFirstSelectedIndex(); + if (currentIndex == -1) + { return; + } - if(AOEngine::instance().swapWithPrevious(mSelectedState,currentIndex)) + if (AOEngine::instance().swapWithPrevious(mSelectedState, currentIndex)) + { mAnimationList->swapWithPrevious(currentIndex); + } } void FloaterAO::onClickMoveDown() { - if(!mSelectedState) + if (!mSelectedState) + { return; + } - std::vector list=mAnimationList->getAllSelected(); - if(list.size()!=1) + std::vector list = mAnimationList->getAllSelected(); + if (list.size() != 1) + { return; + } - S32 currentIndex=mAnimationList->getFirstSelectedIndex(); - if(currentIndex>=(mAnimationList->getItemCount()-1)) + S32 currentIndex = mAnimationList->getFirstSelectedIndex(); + if (currentIndex >= (mAnimationList->getItemCount() - 1)) + { return; + } - if(AOEngine::instance().swapWithNext(mSelectedState,currentIndex)) + if (AOEngine::instance().swapWithNext(mSelectedState, currentIndex)) + { mAnimationList->swapWithNext(currentIndex); + } } void FloaterAO::onClickTrash() { - if(!mSelectedState) + if (!mSelectedState) + { return; + } - std::vector list=mAnimationList->getAllSelected(); - if(list.size()==0) + std::vector list = mAnimationList->getAllSelected(); + if (list.size() == 0) + { return; + } - for(S32 index=list.size()-1;index!=-1;index--) - AOEngine::instance().removeAnimation(mSelectedSet,mSelectedState,mAnimationList->getItemIndex(list[index])); + for (S32 index = list.size() - 1; index != -1; --index) + { + AOEngine::instance().removeAnimation(mSelectedSet, mSelectedState, mAnimationList->getItemIndex(list[index])); + } mAnimationList->deleteSelectedItems(); - mCurrentBoldItem=NULL; + mCurrentBoldItem = NULL; } void FloaterAO::updateCycleParameters() { - BOOL yes=mCycleCheckBox->getValue().asBoolean(); + BOOL yes = mCycleCheckBox->getValue().asBoolean(); mRandomizeCheckBox->setEnabled(yes); mCycleTimeTextLabel->setEnabled(yes); mCycleTimeSpinner->setEnabled(yes); @@ -635,24 +694,28 @@ void FloaterAO::updateCycleParameters() void FloaterAO::onCheckCycle() { - if(mSelectedState) + if (mSelectedState) { - BOOL yes=mCycleCheckBox->getValue().asBoolean(); - AOEngine::instance().setCycle(mSelectedState,yes); + BOOL yes = mCycleCheckBox->getValue().asBoolean(); + AOEngine::instance().setCycle(mSelectedState, yes); updateCycleParameters(); } } void FloaterAO::onCheckRandomize() { - if(mSelectedState) - AOEngine::instance().setRandomize(mSelectedState,mRandomizeCheckBox->getValue().asBoolean()); + if (mSelectedState) + { + AOEngine::instance().setRandomize(mSelectedState, mRandomizeCheckBox->getValue().asBoolean()); + } } void FloaterAO::onChangeCycleTime() { - if(mSelectedState) - AOEngine::instance().setCycleTime(mSelectedState,mCycleTimeSpinner->getValueF32()); + if (mSelectedState) + { + AOEngine::instance().setCycleTime(mSelectedState, mCycleTimeSpinner->getValueF32()); + } } void FloaterAO::onClickPrevious() @@ -667,78 +730,82 @@ void FloaterAO::onClickNext() void FloaterAO::onClickMore() { - LLRect fullSize=gSavedPerAccountSettings.getRect("floater_rect_animation_overrider_full"); - LLRect smallSize=getRect(); + LLRect fullSize = gSavedPerAccountSettings.getRect("floater_rect_animation_overrider_full"); + LLRect smallSize = getRect(); - if(fullSize.getHeight()setVisible(FALSE); mMainInterfacePanel->setVisible(TRUE); setCanResize(TRUE); - gSavedPerAccountSettings.setBOOL("UseFullAOInterface",TRUE); + gSavedPerAccountSettings.setBOOL("UseFullAOInterface", TRUE); - reshape(getRect().getWidth(),fullSize.getHeight()); + reshape(getRect().getWidth(), fullSize.getHeight()); } void FloaterAO::onClickLess() { - LLRect fullSize=getRect(); - LLRect smallSize=mSmallInterfacePanel->getRect(); - smallSize.setLeftTopAndSize(0,0,smallSize.getWidth(),smallSize.getHeight()+getHeaderHeight()); + LLRect fullSize = getRect(); + LLRect smallSize = mSmallInterfacePanel->getRect(); + smallSize.setLeftTopAndSize(0, 0, smallSize.getWidth(), smallSize.getHeight() + getHeaderHeight()); - gSavedPerAccountSettings.setRect("floater_rect_animation_overrider_full",fullSize); + gSavedPerAccountSettings.setRect("floater_rect_animation_overrider_full", fullSize); - mMore=FALSE; + mMore = FALSE; mSmallInterfacePanel->setVisible(TRUE); mMainInterfacePanel->setVisible(FALSE); setCanResize(FALSE); - gSavedPerAccountSettings.setBOOL("UseFullAOInterface",FALSE); + gSavedPerAccountSettings.setBOOL("UseFullAOInterface", FALSE); - reshape(getRect().getWidth(),smallSize.getHeight()); + reshape(getRect().getWidth(), smallSize.getHeight()); // save current size and position - gSavedPerAccountSettings.setRect("floater_rect_animation_overrider_full",fullSize); + gSavedPerAccountSettings.setRect("floater_rect_animation_overrider_full", fullSize); } void FloaterAO::onAnimationChanged(const LLUUID& animation) { LL_DEBUGS("AOEngine") << "Received animation change to " << animation << LL_ENDL; - if(mCurrentBoldItem) + if (mCurrentBoldItem) { - LLScrollListText* column=(LLScrollListText*) mCurrentBoldItem->getColumn(1); + LLScrollListText* column = (LLScrollListText*)mCurrentBoldItem->getColumn(1); column->setFontStyle(LLFontGL::NORMAL); - mCurrentBoldItem=NULL; + mCurrentBoldItem = NULL; } - if(animation.isNull()) + if (animation.isNull()) { return; } // why do we have no LLScrollListCtrl::getItemByUserdata() ? -Zi - std::vector item_list=mAnimationList->getAllData(); + std::vector item_list = mAnimationList->getAllData(); std::vector::const_iterator iter; - for(iter=item_list.begin();iter!=item_list.end();iter++) + for (iter = item_list.begin(); iter != item_list.end(); ++iter) { - LLScrollListItem* item=*iter; - LLUUID* id=(LLUUID*) item->getUserdata(); + LLScrollListItem* item = *iter; + LLUUID* id = (LLUUID*)item->getUserdata(); - if(id==&animation) + if (id == &animation) { - mCurrentBoldItem=item; + mCurrentBoldItem = item; - LLScrollListText* column=(LLScrollListText*) mCurrentBoldItem->getColumn(1); + LLScrollListText* column = (LLScrollListText*)mCurrentBoldItem->getColumn(1); column->setFontStyle(LLFontGL::BOLD); return; @@ -747,48 +814,48 @@ void FloaterAO::onAnimationChanged(const LLUUID& animation) } // virtual -BOOL FloaterAO::handleDragAndDrop(S32 x,S32 y,MASK mask,BOOL drop,EDragAndDropType type,void* data, - EAcceptance* accept,std::string& tooltipMsg) +BOOL FloaterAO::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType type, void* data, + EAcceptance* accept, std::string& tooltipMsg) { // no drag & drop on small interface - if(!mMore) + if (!mMore) { - tooltipMsg=getString("ao_dnd_only_on_full_interface"); - *accept=ACCEPT_NO; + tooltipMsg = getString("ao_dnd_only_on_full_interface"); + *accept = ACCEPT_NO; return TRUE; } - LLInventoryItem* item=(LLInventoryItem*) data; + LLInventoryItem* item = (LLInventoryItem*)data; - if(type==DAD_NOTECARD) + if (type == DAD_NOTECARD) { - if(mImportRunning) + if (mImportRunning) { - *accept=ACCEPT_NO; + *accept = ACCEPT_NO; return TRUE; } - *accept=ACCEPT_YES_SINGLE; - if(item && drop) + *accept = ACCEPT_YES_SINGLE; + if (item && drop) { - if(AOEngine::instance().importNotecard(item)) + if (AOEngine::instance().importNotecard(item)) { reloading(TRUE); mReloadButton->setEnabled(FALSE); - mImportRunning=TRUE; + mImportRunning = TRUE; } } } - else if(type==DAD_ANIMATION) + else if (type == DAD_ANIMATION) { - if(!drop && (!mSelectedSet || !mSelectedState || !mCanDragAndDrop)) + if (!drop && (!mSelectedSet || !mSelectedState || !mCanDragAndDrop)) { - *accept=ACCEPT_NO; + *accept = ACCEPT_NO; return TRUE; } - *accept=ACCEPT_YES_MULTI; - if(item && drop) + *accept = ACCEPT_YES_MULTI; + if (item && drop) { - if(AOEngine::instance().addAnimation(mSelectedSet,mSelectedState,item)) + if (AOEngine::instance().addAnimation(mSelectedSet, mSelectedState, item)) { addAnimation(item->getName()); @@ -799,7 +866,9 @@ BOOL FloaterAO::handleDragAndDrop(S32 x,S32 y,MASK mask,BOOL drop,EDragAndDropTy } } else - *accept=ACCEPT_NO; + { + *accept = ACCEPT_NO; + } return TRUE; } diff --git a/indra/newview/ao.h b/indra/newview/ao.h index fe0aac73a6..0a6813583b 100644 --- a/indra/newview/ao.h +++ b/indra/newview/ao.h @@ -58,8 +58,8 @@ class FloaterAO void updateSetParameters(); void updateAnimationList(); - BOOL handleDragAndDrop(S32 x,S32 y,MASK mask,BOOL drop,EDragAndDropType cargo_type,void* cargo_data, - EAcceptance* accept,std::string& tooltip_msg); + BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void* cargo_data, + EAcceptance* accept, std::string& tooltip_msg); protected: LLScrollListItem* addAnimation(const std::string& name); @@ -100,8 +100,8 @@ class FloaterAO void enableSetControls(BOOL yes); void enableStateControls(BOOL yes); - BOOL newSetCallback(const LLSD& notification,const LLSD& response); - BOOL removeSetCallback(const LLSD& notification,const LLSD& response); + BOOL newSetCallback(const LLSD& notification, const LLSD& response); + BOOL removeSetCallback(const LLSD& notification, const LLSD& response); virtual BOOL tick(); diff --git a/indra/newview/aoengine.cpp b/indra/newview/aoengine.cpp index a1128cd280..3d3afc2a63 100644 --- a/indra/newview/aoengine.cpp +++ b/indra/newview/aoengine.cpp @@ -49,7 +49,7 @@ #define ROOT_AO_FOLDER "#AO" #include -const F32 INVENTORY_POLLING_INTERVAL=5.0f; +const F32 INVENTORY_POLLING_INTERVAL = 5.0f; AOEngine::AOEngine() : LLSingleton(), @@ -117,10 +117,10 @@ void AOEngine::clear( bool aFromTimer ) void AOEngine::stopAllStandVariants() { LL_DEBUGS("AOEngine") << "stopping all STAND variants." << LL_ENDL; - gAgent.sendAnimationRequest(ANIM_AGENT_STAND_1,ANIM_REQUEST_STOP); - gAgent.sendAnimationRequest(ANIM_AGENT_STAND_2,ANIM_REQUEST_STOP); - gAgent.sendAnimationRequest(ANIM_AGENT_STAND_3,ANIM_REQUEST_STOP); - gAgent.sendAnimationRequest(ANIM_AGENT_STAND_4,ANIM_REQUEST_STOP); + gAgent.sendAnimationRequest(ANIM_AGENT_STAND_1, ANIM_REQUEST_STOP); + gAgent.sendAnimationRequest(ANIM_AGENT_STAND_2, ANIM_REQUEST_STOP); + gAgent.sendAnimationRequest(ANIM_AGENT_STAND_3, ANIM_REQUEST_STOP); + gAgent.sendAnimationRequest(ANIM_AGENT_STAND_4, ANIM_REQUEST_STOP); gAgentAvatarp->LLCharacter::stopMotion(ANIM_AGENT_STAND_1); gAgentAvatarp->LLCharacter::stopMotion(ANIM_AGENT_STAND_2); gAgentAvatarp->LLCharacter::stopMotion(ANIM_AGENT_STAND_3); @@ -130,21 +130,21 @@ void AOEngine::stopAllStandVariants() void AOEngine::stopAllSitVariants() { LL_DEBUGS("AOEngine") << "stopping all SIT variants." << LL_ENDL; - gAgent.sendAnimationRequest(ANIM_AGENT_SIT_FEMALE,ANIM_REQUEST_STOP); - gAgent.sendAnimationRequest(ANIM_AGENT_SIT_GENERIC,ANIM_REQUEST_STOP); + gAgent.sendAnimationRequest(ANIM_AGENT_SIT_FEMALE, ANIM_REQUEST_STOP); + gAgent.sendAnimationRequest(ANIM_AGENT_SIT_GENERIC, ANIM_REQUEST_STOP); gAgentAvatarp->LLCharacter::stopMotion(ANIM_AGENT_SIT_FEMALE); gAgentAvatarp->LLCharacter::stopMotion(ANIM_AGENT_SIT_GENERIC); // scripted seats that use ground_sit as animation need special treatment - const LLViewerObject* agentRoot=dynamic_cast(gAgentAvatarp->getRoot()); - if(agentRoot && agentRoot->getID()!=gAgent.getID()) + const LLViewerObject* agentRoot = dynamic_cast(gAgentAvatarp->getRoot()); + if (agentRoot && agentRoot->getID() != gAgentID) { LL_DEBUGS("AOEngine") << "Not stopping ground sit animations while sitting on a prim." << LL_ENDL; return; } - gAgent.sendAnimationRequest(ANIM_AGENT_SIT_GROUND,ANIM_REQUEST_STOP); - gAgent.sendAnimationRequest(ANIM_AGENT_SIT_GROUND_CONSTRAINED,ANIM_REQUEST_STOP); + gAgent.sendAnimationRequest(ANIM_AGENT_SIT_GROUND, ANIM_REQUEST_STOP); + gAgent.sendAnimationRequest(ANIM_AGENT_SIT_GROUND_CONSTRAINED, ANIM_REQUEST_STOP); gAgentAvatarp->LLCharacter::stopMotion(ANIM_AGENT_SIT_GROUND); gAgentAvatarp->LLCharacter::stopMotion(ANIM_AGENT_SIT_GROUND_CONSTRAINED); @@ -152,25 +152,31 @@ void AOEngine::stopAllSitVariants() void AOEngine::setLastMotion(const LLUUID& motion) { - if(motion!=ANIM_AGENT_TYPE) - mLastMotion=motion; + if (motion != ANIM_AGENT_TYPE) + { + mLastMotion = motion; + } } void AOEngine::setLastOverriddenMotion(const LLUUID& motion) { - if(motion!=ANIM_AGENT_TYPE) - mLastOverriddenMotion=motion; + if (motion != ANIM_AGENT_TYPE) + { + mLastOverriddenMotion = motion; + } } BOOL AOEngine::foreignAnimations(const LLUUID& seat) { - for(LLVOAvatar::AnimSourceIterator sourceIterator=gAgentAvatarp->mAnimationSources.begin(); - sourceIterator!=gAgentAvatarp->mAnimationSources.end();sourceIterator++) + for (LLVOAvatar::AnimSourceIterator sourceIterator = gAgentAvatarp->mAnimationSources.begin(); + sourceIterator != gAgentAvatarp->mAnimationSources.end(); ++sourceIterator) { - if(sourceIterator->first!=gAgent.getID()) + if (sourceIterator->first != gAgentID) { - if(seat.isNull() || sourceIterator->first==seat) + if (seat.isNull() || sourceIterator->first == seat) + { return TRUE; + } } } return FALSE; @@ -180,33 +186,47 @@ const LLUUID& AOEngine::mapSwimming(const LLUUID& motion) const { S32 stateNum; - if(motion==ANIM_AGENT_HOVER) - stateNum=AOSet::Floating; - else if(motion==ANIM_AGENT_FLY) - stateNum=AOSet::SwimmingForward; - else if(motion==ANIM_AGENT_HOVER_UP) - stateNum=AOSet::SwimmingUp; - else if(motion==ANIM_AGENT_HOVER_DOWN) - stateNum=AOSet::SwimmingDown; + if (motion == ANIM_AGENT_HOVER) + { + stateNum = AOSet::Floating; + } + else if (motion == ANIM_AGENT_FLY) + { + stateNum = AOSet::SwimmingForward; + } + else if (motion == ANIM_AGENT_HOVER_UP) + { + stateNum = AOSet::SwimmingUp; + } + else if (motion == ANIM_AGENT_HOVER_DOWN) + { + stateNum = AOSet::SwimmingDown; + } else + { return LLUUID::null; + } - AOSet::AOState* state=mCurrentSet->getState(stateNum); + AOSet::AOState* state = mCurrentSet->getState(stateNum); return mCurrentSet->getAnimationForState(state); } void AOEngine::checkBelowWater(BOOL yes) { - if(mUnderWater==yes) + if (mUnderWater == yes) + { return; + } // only restart underwater/above water motion if the overridden motion is the one currently playing - if(mLastMotion!=mLastOverriddenMotion) + if (mLastMotion != mLastOverriddenMotion) + { return; + } - gAgent.sendAnimationRequest(override(mLastOverriddenMotion,FALSE),ANIM_REQUEST_STOP); - mUnderWater=yes; - gAgent.sendAnimationRequest(override(mLastOverriddenMotion,TRUE),ANIM_REQUEST_START); + gAgent.sendAnimationRequest(override(mLastOverriddenMotion, FALSE), ANIM_REQUEST_STOP); + mUnderWater = yes; + gAgent.sendAnimationRequest(override(mLastOverriddenMotion, TRUE), ANIM_REQUEST_START); } void AOEngine::enable(BOOL yes) @@ -220,54 +240,58 @@ void AOEngine::enable(BOOL yes) return; } - AOSet::AOState* state=mCurrentSet->getStateByRemapID(mLastMotion); - if(mEnabled) + AOSet::AOState* state = mCurrentSet->getStateByRemapID(mLastMotion); + if (mEnabled) { - if(state && !state->mAnimations.empty()) + if (state && !state->mAnimations.empty()) { LL_DEBUGS("AOEngine") << "Enabling animation state " << state->mName << LL_ENDL; // do not stop underlying ground sit when re-enabling the AO - if(mLastOverriddenMotion!=ANIM_AGENT_SIT_GROUND_CONSTRAINED) + if (mLastOverriddenMotion != ANIM_AGENT_SIT_GROUND_CONSTRAINED) { - gAgent.sendAnimationRequest(mLastOverriddenMotion,ANIM_REQUEST_STOP); + gAgent.sendAnimationRequest(mLastOverriddenMotion, ANIM_REQUEST_STOP); } - LLUUID animation=override(mLastMotion,TRUE); - if(animation.isNull()) + LLUUID animation = override(mLastMotion, TRUE); + if (animation.isNull()) + { return; + } - if(mLastMotion==ANIM_AGENT_STAND) + if (mLastMotion == ANIM_AGENT_STAND) { stopAllStandVariants(); } - else if(mLastMotion==ANIM_AGENT_WALK) + else if (mLastMotion == ANIM_AGENT_WALK) { LL_DEBUGS("AOEngine") << "Last motion was a WALK, stopping all variants." << LL_ENDL; - gAgent.sendAnimationRequest(ANIM_AGENT_WALK_NEW,ANIM_REQUEST_STOP); - gAgent.sendAnimationRequest(ANIM_AGENT_FEMALE_WALK,ANIM_REQUEST_STOP); - gAgent.sendAnimationRequest(ANIM_AGENT_FEMALE_WALK_NEW,ANIM_REQUEST_STOP); + gAgent.sendAnimationRequest(ANIM_AGENT_WALK_NEW, ANIM_REQUEST_STOP); + gAgent.sendAnimationRequest(ANIM_AGENT_FEMALE_WALK, ANIM_REQUEST_STOP); + gAgent.sendAnimationRequest(ANIM_AGENT_FEMALE_WALK_NEW, ANIM_REQUEST_STOP); gAgentAvatarp->LLCharacter::stopMotion(ANIM_AGENT_WALK_NEW); gAgentAvatarp->LLCharacter::stopMotion(ANIM_AGENT_FEMALE_WALK); gAgentAvatarp->LLCharacter::stopMotion(ANIM_AGENT_FEMALE_WALK_NEW); } - else if(mLastMotion==ANIM_AGENT_RUN) + else if (mLastMotion == ANIM_AGENT_RUN) { LL_DEBUGS("AOEngine") << "Last motion was a RUN, stopping all variants." << LL_ENDL; - gAgent.sendAnimationRequest(ANIM_AGENT_RUN_NEW,ANIM_REQUEST_STOP); - gAgent.sendAnimationRequest(ANIM_AGENT_FEMALE_RUN_NEW,ANIM_REQUEST_STOP); + gAgent.sendAnimationRequest(ANIM_AGENT_RUN_NEW, ANIM_REQUEST_STOP); + gAgent.sendAnimationRequest(ANIM_AGENT_FEMALE_RUN_NEW, ANIM_REQUEST_STOP); gAgentAvatarp->LLCharacter::stopMotion(ANIM_AGENT_RUN_NEW); gAgentAvatarp->LLCharacter::stopMotion(ANIM_AGENT_FEMALE_RUN_NEW); } - else if(mLastMotion==ANIM_AGENT_SIT) + else if (mLastMotion == ANIM_AGENT_SIT) { stopAllSitVariants(); - gAgent.sendAnimationRequest(ANIM_AGENT_SIT_GENERIC,ANIM_REQUEST_START); + gAgent.sendAnimationRequest(ANIM_AGENT_SIT_GENERIC, ANIM_REQUEST_START); } else + { LL_WARNS("AOEngine") << "Unhandled last motion id " << mLastMotion << LL_ENDL; + } - gAgent.sendAnimationRequest(animation,ANIM_REQUEST_START); + gAgent.sendAnimationRequest(animation, ANIM_REQUEST_START); mAnimationChangedSignal(state->mAnimations[state->mCurrentAnimation].mInventoryUUID); } } @@ -275,28 +299,32 @@ void AOEngine::enable(BOOL yes) { mAnimationChangedSignal(LLUUID::null); - gAgent.sendAnimationRequest(ANIM_AGENT_SIT_GENERIC,ANIM_REQUEST_STOP); + gAgent.sendAnimationRequest(ANIM_AGENT_SIT_GENERIC, ANIM_REQUEST_STOP); // stop all overriders, catch leftovers - for(S32 index=0;indexgetState(index); - if(state) + state = mCurrentSet->getState(index); + if (state) { - LLUUID animation=state->mCurrentAnimationID; - if(animation.notNull()) + LLUUID animation = state->mCurrentAnimationID; + if (animation.notNull()) { LL_DEBUGS("AOEngine") << "Stopping leftover animation from state " << state->mName << LL_ENDL; - gAgent.sendAnimationRequest(animation,ANIM_REQUEST_STOP); + gAgent.sendAnimationRequest(animation, ANIM_REQUEST_STOP); gAgentAvatarp->LLCharacter::stopMotion(animation); state->mCurrentAnimationID.setNull(); } } else + { LL_DEBUGS("AOEngine") << "state "<< index <<" returned NULL." << LL_ENDL; + } } - if(!foreignAnimations(LLUUID::null)) - gAgent.sendAnimationRequest(mLastMotion,ANIM_REQUEST_START); + if (!foreignAnimations(LLUUID::null)) + { + gAgent.sendAnimationRequest(mLastMotion, ANIM_REQUEST_START); + } mCurrentSet->stopTimer(); } @@ -304,30 +332,32 @@ void AOEngine::enable(BOOL yes) void AOEngine::setStateCycleTimer(const AOSet::AOState* state) { - F32 timeout=state->mCycleTime; + F32 timeout = state->mCycleTime; LL_DEBUGS("AOEngine") << "Setting cycle timeout for state " << state->mName << " of " << timeout << LL_ENDL; - if(timeout>0.0f) + if (timeout > 0.0f) + { mCurrentSet->startTimer(timeout); + } } -const LLUUID AOEngine::override(const LLUUID& pMotion,BOOL start) +const LLUUID AOEngine::override(const LLUUID& pMotion, BOOL start) { LL_DEBUGS("AOEngine") << "override(" << pMotion << "," << start << ")" << LL_ENDL; LLUUID animation; - LLUUID motion=pMotion; + LLUUID motion = pMotion; - if(!mEnabled) + if (!mEnabled) { - if(start && mCurrentSet) + if (start && mCurrentSet) { - const AOSet::AOState* state=mCurrentSet->getStateByRemapID(motion); - if(state) + const AOSet::AOState* state = mCurrentSet->getStateByRemapID(motion); + if (state) { setLastMotion(motion); LL_DEBUGS("AOEngine") << "(disabled AO) setting last motion id to " << gAnimLibrary.animationName(mLastMotion) << LL_ENDL; - if(!state->mAnimations.empty()) + if (!state->mAnimations.empty()) { setLastOverriddenMotion(motion); LL_DEBUGS("AOEngine") << "(disabled AO) setting last overridden motion id to " << gAnimLibrary.animationName(mLastOverriddenMotion) << LL_ENDL; @@ -337,41 +367,43 @@ const LLUUID AOEngine::override(const LLUUID& pMotion,BOOL start) return animation; } - if(mSets.empty()) + if (mSets.empty()) { LL_DEBUGS("AOEngine") << "No sets loaded. Skipping overrider." << LL_ENDL; return animation; } - if(!mCurrentSet) + if (!mCurrentSet) { LL_DEBUGS("AOEngine") << "No current AO set chosen. Skipping overrider." << LL_ENDL; return animation; } // we don't distinguish between these two - if(motion==ANIM_AGENT_SIT_GROUND) - motion=ANIM_AGENT_SIT_GROUND_CONSTRAINED; + if (motion == ANIM_AGENT_SIT_GROUND) + { + motion = ANIM_AGENT_SIT_GROUND_CONSTRAINED; + } - AOSet::AOState* state=mCurrentSet->getStateByRemapID(motion); - if(!state) + AOSet::AOState* state = mCurrentSet->getStateByRemapID(motion); + if (!state) { LL_DEBUGS("AOEngine") << "No current AO state for motion " << motion << " (" << gAnimLibrary.animationName(motion) << ")." << LL_ENDL; // This part of the code was added to capture an edge case where animations got stuck // However, it seems it isn't needed anymore and breaks other, more important cases. // So we disable this code for now, unless bad things happen and the stuck animations // come back again. -Zi -// if(!gAnimLibrary.animStateToString(motion) && !start) +// if (!gAnimLibrary.animStateToString(motion) && !start) // { -// state=mCurrentSet->getStateByRemapID(mLastOverriddenMotion); -// if(state && state->mCurrentAnimationID==motion) +// state = mCurrentSet->getStateByRemapID(mLastOverriddenMotion); +// if (state && state->mCurrentAnimationID == motion) // { // LL_DEBUGS("AOEngine") << "Stop requested for current overridden animation UUID " << motion << " - Skipping." << LL_ENDL; // } // else // { // LL_DEBUGS("AOEngine") << "Stop requested for unknown UUID " << motion << " - Stopping it just in case." << LL_ENDL; -// gAgent.sendAnimationRequest(motion,ANIM_REQUEST_STOP); +// gAgent.sendAnimationRequest(motion, ANIM_REQUEST_STOP); // gAgentAvatarp->LLCharacter::stopMotion(motion); // } // } @@ -381,14 +413,14 @@ const LLUUID AOEngine::override(const LLUUID& pMotion,BOOL start) mAnimationChangedSignal(LLUUID::null); mCurrentSet->stopTimer(); - if(start) + if (start) { setLastMotion(motion); LL_DEBUGS("AOEngine") << "(enabled AO) setting last motion id to " << gAnimLibrary.animationName(mLastMotion) << LL_ENDL; // Disable start stands in Mouselook - if(mCurrentSet->getMouselookDisable() && - motion==ANIM_AGENT_STAND && + if (mCurrentSet->getMouselookDisable() && + motion == ANIM_AGENT_STAND && mInMouselook) { LL_DEBUGS("AOEngine") << "(enabled AO, mouselook stand stopped) setting last motion id to " << gAnimLibrary.animationName(mLastMotion) << LL_ENDL; @@ -396,97 +428,107 @@ const LLUUID AOEngine::override(const LLUUID& pMotion,BOOL start) } // Do not start override sits if not selected - if(!mCurrentSet->getSitOverride() && motion==ANIM_AGENT_SIT) + if (!mCurrentSet->getSitOverride() && motion == ANIM_AGENT_SIT) { LL_DEBUGS("AOEngine") << "(enabled AO, sit override stopped) setting last motion id to " << gAnimLibrary.animationName(mLastMotion) << LL_ENDL; return animation; } // scripted seats that use ground_sit as animation need special treatment - if(motion==ANIM_AGENT_SIT_GROUND_CONSTRAINED) + if (motion == ANIM_AGENT_SIT_GROUND_CONSTRAINED) { - const LLViewerObject* agentRoot=dynamic_cast(gAgentAvatarp->getRoot()); - if(agentRoot && agentRoot->getID()!=gAgent.getID()) + const LLViewerObject* agentRoot = dynamic_cast(gAgentAvatarp->getRoot()); + if (agentRoot && agentRoot->getID() != gAgentID) { LL_DEBUGS("AOEngine") << "Ground sit animation playing but sitting on a prim - disabling overrider." << LL_ENDL; return animation; } } - if(!state->mAnimations.empty()) + if (!state->mAnimations.empty()) { setLastOverriddenMotion(motion); LL_DEBUGS("AOEngine") << "(enabled AO) setting last overridden motion id to " << gAnimLibrary.animationName(mLastOverriddenMotion) << LL_ENDL; } // do not remember typing as set-wide motion - if(motion!=ANIM_AGENT_TYPE) + if (motion != ANIM_AGENT_TYPE) + { mCurrentSet->setMotion(motion); + } - mUnderWater=gAgentAvatarp->mBelowWater; - if(mUnderWater) - animation=mapSwimming(motion); + mUnderWater = gAgentAvatarp->mBelowWater; + if (mUnderWater) + { + animation = mapSwimming(motion); + } - if(animation.isNull()) - animation=mCurrentSet->getAnimationForState(state); + if (animation.isNull()) + { + animation = mCurrentSet->getAnimationForState(state); + } - if(state->mCurrentAnimationID.notNull()) + if (state->mCurrentAnimationID.notNull()) { LL_DEBUGS("AOEngine") << "Previous animation for state " << gAnimLibrary.animationName(motion) << " was not stopped, but we were asked to start a new one. Killing old animation." << LL_ENDL; - gAgent.sendAnimationRequest(state->mCurrentAnimationID,ANIM_REQUEST_STOP); + gAgent.sendAnimationRequest(state->mCurrentAnimationID, ANIM_REQUEST_STOP); gAgentAvatarp->LLCharacter::stopMotion(state->mCurrentAnimationID); } - state->mCurrentAnimationID=animation; + state->mCurrentAnimationID = animation; LL_DEBUGS("AOEngine") << "overriding " << gAnimLibrary.animationName(motion) << " with " << animation << " in state " << state->mName << " of set " << mCurrentSet->getName() << " (" << mCurrentSet << ")" << LL_ENDL; - if(animation.notNull()) + if (animation.notNull()) { mAnimationChangedSignal(state->mAnimations[state->mCurrentAnimation].mInventoryUUID); } setStateCycleTimer(state); - if(motion==ANIM_AGENT_SIT) + if (motion == ANIM_AGENT_SIT) { // Use ANIM_AGENT_SIT_GENERIC, so we don't create an overrider loop with ANIM_AGENT_SIT // while still having a base sitting pose to cover up cycle points - gAgent.sendAnimationRequest(ANIM_AGENT_SIT_GENERIC,ANIM_REQUEST_START); - if(mCurrentSet->getSmart()) + gAgent.sendAnimationRequest(ANIM_AGENT_SIT_GENERIC, ANIM_REQUEST_START); + if (mCurrentSet->getSmart()) + { mSitCancelTimer.oneShot(); + } } // special treatment for "transient animations" because the viewer needs the Linden animation to know the agent's state - else if(motion==ANIM_AGENT_SIT_GROUND_CONSTRAINED || - motion==ANIM_AGENT_PRE_JUMP || - motion==ANIM_AGENT_STANDUP || - motion==ANIM_AGENT_LAND || - motion==ANIM_AGENT_MEDIUM_LAND) + else if (motion == ANIM_AGENT_SIT_GROUND_CONSTRAINED || + motion == ANIM_AGENT_PRE_JUMP || + motion == ANIM_AGENT_STANDUP || + motion == ANIM_AGENT_LAND || + motion == ANIM_AGENT_MEDIUM_LAND) { - gAgent.sendAnimationRequest(animation,ANIM_REQUEST_START); + gAgent.sendAnimationRequest(animation, ANIM_REQUEST_START); return LLUUID::null; } } else { - animation=state->mCurrentAnimationID; + animation = state->mCurrentAnimationID; state->mCurrentAnimationID.setNull(); // for typing animaiton, just return the stored animation, reset the state timer, and don't memorize anything else - if(motion==ANIM_AGENT_TYPE) + if (motion == ANIM_AGENT_TYPE) { - AOSet::AOState* previousState=mCurrentSet->getStateByRemapID(mLastMotion); - if(previousState) + AOSet::AOState* previousState = mCurrentSet->getStateByRemapID(mLastMotion); + if (previousState) + { setStateCycleTimer(previousState); + } return animation; } - if(motion!=mCurrentSet->getMotion()) + if (motion != mCurrentSet->getMotion()) { LL_WARNS("AOEngine") << "trying to stop-override motion " << gAnimLibrary.animationName(motion) << " but the current set has motion " << gAnimLibrary.animationName(mCurrentSet->getMotion()) << LL_ENDL; @@ -496,13 +538,13 @@ const LLUUID AOEngine::override(const LLUUID& pMotion,BOOL start) mCurrentSet->setMotion(LLUUID::null); // again, special treatment for "transient" animations to make sure our own animation gets stopped properly - if( motion==ANIM_AGENT_SIT_GROUND_CONSTRAINED || - motion==ANIM_AGENT_PRE_JUMP || - motion==ANIM_AGENT_STANDUP || - motion==ANIM_AGENT_LAND || - motion==ANIM_AGENT_MEDIUM_LAND) + if (motion == ANIM_AGENT_SIT_GROUND_CONSTRAINED || + motion == ANIM_AGENT_PRE_JUMP || + motion == ANIM_AGENT_STANDUP || + motion == ANIM_AGENT_LAND || + motion == ANIM_AGENT_MEDIUM_LAND) { - gAgent.sendAnimationRequest(animation,ANIM_REQUEST_STOP); + gAgent.sendAnimationRequest(animation, ANIM_REQUEST_STOP); gAgentAvatarp->LLCharacter::stopMotion(animation); setStateCycleTimer(state); return LLUUID::null; @@ -510,8 +552,10 @@ const LLUUID AOEngine::override(const LLUUID& pMotion,BOOL start) // stop the underlying Linden Lab motion, in case it's still running. // frequently happens with sits, so we keep it only for those currently. - if(mLastMotion==ANIM_AGENT_SIT) + if (mLastMotion == ANIM_AGENT_SIT) + { stopAllSitVariants(); + } LL_DEBUGS("AOEngine") << "stopping cycle timer for motion " << gAnimLibrary.animationName(motion) << " using animation " << animation << @@ -525,19 +569,21 @@ void AOEngine::checkSitCancel() { LLUUID seat; - const LLViewerObject* agentRoot=dynamic_cast(gAgentAvatarp->getRoot()); - if(agentRoot) - seat=agentRoot->getID(); - - if(foreignAnimations(seat)) + const LLViewerObject* agentRoot = dynamic_cast(gAgentAvatarp->getRoot()); + if (agentRoot) { - LLUUID animation=mCurrentSet->getStateByRemapID(ANIM_AGENT_SIT)->mCurrentAnimationID; - if(animation.notNull()) + seat = agentRoot->getID(); + } + + if (foreignAnimations(seat)) + { + LLUUID animation = mCurrentSet->getStateByRemapID(ANIM_AGENT_SIT)->mCurrentAnimationID; + if (animation.notNull()) { LL_DEBUGS("AOEngine") << "Stopping sit animation due to foreign animations running" << LL_ENDL; - gAgent.sendAnimationRequest(animation,ANIM_REQUEST_STOP); + gAgent.sendAnimationRequest(animation, ANIM_REQUEST_STOP); // remove cycle point cover-up - gAgent.sendAnimationRequest(ANIM_AGENT_SIT_GENERIC,ANIM_REQUEST_STOP); + gAgent.sendAnimationRequest(ANIM_AGENT_SIT_GENERIC, ANIM_REQUEST_STOP); gAgentAvatarp->LLCharacter::stopMotion(animation); mSitCancelTimer.stop(); // stop cycle tiemr @@ -548,10 +594,12 @@ void AOEngine::checkSitCancel() void AOEngine::cycleTimeout(const AOSet* set) { - if(!mEnabled) + if (!mEnabled) + { return; + } - if(set!=mCurrentSet) + if (set != mCurrentSet) { LL_WARNS("AOEngine") << "cycleTimeout for set " << set->getName() << " but current set is " << mCurrentSet->getName() << LL_ENDL; return; @@ -562,111 +610,125 @@ void AOEngine::cycleTimeout(const AOSet* set) void AOEngine::cycle(eCycleMode cycleMode) { - if(!mCurrentSet) + if (!mCurrentSet) { LL_DEBUGS("AOEngine") << "cycle without set." << LL_ENDL; return; } - LLUUID motion=mCurrentSet->getMotion(); + LLUUID motion = mCurrentSet->getMotion(); // assume stand if no motion is registered, happens after login when the avatar hasn't moved at all yet // or if the agent has said something in local chat while sitting - if(motion.isNull()) + if (motion.isNull()) { - if(gAgentAvatarp->isSitting()) + if (gAgentAvatarp->isSitting()) { - motion=ANIM_AGENT_SIT; + motion = ANIM_AGENT_SIT; } else { - motion=ANIM_AGENT_STAND; + motion = ANIM_AGENT_STAND; } } // do not cycle if we're sitting and sit-override is off - else if(motion==ANIM_AGENT_SIT && !mCurrentSet->getSitOverride()) + else if (motion == ANIM_AGENT_SIT && !mCurrentSet->getSitOverride()) + { return; + } // do not cycle if we're standing and mouselook stand override is disabled while being in mouselook - else if(motion==ANIM_AGENT_STAND && mCurrentSet->getMouselookDisable() && mInMouselook) + else if (motion == ANIM_AGENT_STAND && mCurrentSet->getMouselookDisable() && mInMouselook) + { return; + } - AOSet::AOState* state=mCurrentSet->getStateByRemapID(motion); - if(!state) + AOSet::AOState* state = mCurrentSet->getStateByRemapID(motion); + if (!state) { LL_DEBUGS("AOEngine") << "cycle without state." << LL_ENDL; return; } - if(!state->mAnimations.size()) + if (!state->mAnimations.size()) { LL_DEBUGS("AOEngine") << "cycle without animations in state." << LL_ENDL; return; } // make sure we disable cycling only for timed cycle, so manual cycling still works, even with cycling switched off - if(!state->mCycle && cycleMode==CycleAny) + if (!state->mCycle && cycleMode == CycleAny) { LL_DEBUGS("AOEngine") << "cycle timeout, but state is set to not cycling." << LL_ENDL; return; } - LLUUID oldAnimation=state->mCurrentAnimationID; + LLUUID oldAnimation = state->mCurrentAnimationID; LLUUID animation; - if(cycleMode==CycleAny) + if (cycleMode == CycleAny) { - animation=mCurrentSet->getAnimationForState(state); + animation = mCurrentSet->getAnimationForState(state); } else { - if(cycleMode==CyclePrevious) + if (cycleMode == CyclePrevious) { - if(state->mCurrentAnimation==0) - state->mCurrentAnimation=state->mAnimations.size()-1; + if (state->mCurrentAnimation == 0) + { + state->mCurrentAnimation = state->mAnimations.size() - 1; + } else + { state->mCurrentAnimation--; + } } - else if(cycleMode==CycleNext) + else if (cycleMode == CycleNext) { state->mCurrentAnimation++; - if(state->mCurrentAnimation==state->mAnimations.size()) - state->mCurrentAnimation=0; + if (state->mCurrentAnimation == state->mAnimations.size()) + { + state->mCurrentAnimation = 0; + } } - animation=state->mAnimations[state->mCurrentAnimation].mAssetUUID; + animation = state->mAnimations[state->mCurrentAnimation].mAssetUUID; } // don't do anything if the animation didn't change - if(animation==oldAnimation) + if (animation == oldAnimation) + { return; + } mAnimationChangedSignal(LLUUID::null); - state->mCurrentAnimationID=animation; - if(animation.notNull()) + state->mCurrentAnimationID = animation; + if (animation.notNull()) { LL_DEBUGS("AOEngine") << "requesting animation start for motion " << gAnimLibrary.animationName(motion) << ": " << animation << LL_ENDL; - gAgent.sendAnimationRequest(animation,ANIM_REQUEST_START); + gAgent.sendAnimationRequest(animation, ANIM_REQUEST_START); mAnimationChangedSignal(state->mAnimations[state->mCurrentAnimation].mInventoryUUID); } else + { LL_DEBUGS("AOEngine") << "overrider came back with NULL animation for motion " << gAnimLibrary.animationName(motion) << "." << LL_ENDL; + } - if(oldAnimation.notNull()) + if (oldAnimation.notNull()) { LL_DEBUGS("AOEngine") << "Cycling state " << state->mName << " - stopping animation " << oldAnimation << LL_ENDL; - gAgent.sendAnimationRequest(oldAnimation,ANIM_REQUEST_STOP); + gAgent.sendAnimationRequest(oldAnimation, ANIM_REQUEST_STOP); gAgentAvatarp->LLCharacter::stopMotion(oldAnimation); } } void AOEngine::updateSortOrder(AOSet::AOState* state) { - for(U32 index=0;indexmAnimations.size();index++) + for (U32 index = 0; index < state->mAnimations.size(); ++index) { - U32 sortOrder=state->mAnimations[index].mSortOrder; + U32 sortOrder = state->mAnimations[index].mSortOrder; - if(sortOrder!=index) + if (sortOrder != index) { std::ostringstream numStr(""); numStr << index; @@ -674,16 +736,15 @@ void AOEngine::updateSortOrder(AOSet::AOState* state) LL_DEBUGS("AOEngine") << "sort order is " << sortOrder << " but index is " << index << ", setting sort order description: " << numStr.str() << LL_ENDL; - state->mAnimations[index].mSortOrder=index; + state->mAnimations[index].mSortOrder = index; - LLViewerInventoryItem* item=gInventory.getItem(state->mAnimations[index].mInventoryUUID); - if(!item) + LLViewerInventoryItem* item = gInventory.getItem(state->mAnimations[index].mInventoryUUID); + if (!item) { LL_WARNS("AOEngine") << "NULL inventory item found while trying to copy " << state->mAnimations[index].mInventoryUUID << LL_ENDL; continue; } - LLPointer newItem= - new LLViewerInventoryItem(item); + LLPointer newItem = new LLViewerInventoryItem(item); newItem->setDescription(numStr.str()); newItem->setComplete(TRUE); @@ -694,54 +755,56 @@ void AOEngine::updateSortOrder(AOSet::AOState* state) } } -LLUUID AOEngine::addSet(const std::string& name,BOOL reload) +LLUUID AOEngine::addSet(const std::string& name, BOOL reload) { - if(mAOFolder.isNull()) + if (mAOFolder.isNull()) { LL_WARNS("AOEngine") << ROOT_AO_FOLDER << " folder not there yet. Requesting recreation." << LL_ENDL; tick(); return LLUUID::null; } - BOOL wasProtected=gSavedPerAccountSettings.getBOOL("ProtectAOFolders"); - gSavedPerAccountSettings.setBOOL("ProtectAOFolders",FALSE); + BOOL wasProtected = gSavedPerAccountSettings.getBOOL("ProtectAOFolders"); + gSavedPerAccountSettings.setBOOL("ProtectAOFolders", FALSE); LL_DEBUGS("AOEngine") << "adding set folder " << name << LL_ENDL; - LLUUID newUUID=gInventory.createNewCategory(mAOFolder,LLFolderType::FT_NONE,name); - gSavedPerAccountSettings.setBOOL("ProtectAOFolders",wasProtected); + LLUUID newUUID = gInventory.createNewCategory(mAOFolder, LLFolderType::FT_NONE, name); + gSavedPerAccountSettings.setBOOL("ProtectAOFolders", wasProtected); - if(reload) + if (reload) + { mTimerCollection.enableReloadTimer(TRUE); + } return newUUID; } -BOOL AOEngine::createAnimationLink(const AOSet* set,AOSet::AOState* state,const LLInventoryItem* item) +BOOL AOEngine::createAnimationLink(const AOSet* set, AOSet::AOState* state, const LLInventoryItem* item) { LL_DEBUGS("AOEngine") << "Asset ID " << item->getAssetUUID() << " inventory id " << item->getUUID() << " category id " << state->mInventoryUUID << LL_ENDL; - if(state->mInventoryUUID.isNull()) + if (state->mInventoryUUID.isNull()) { LL_DEBUGS("AOEngine") << "no " << state->mName << " folder yet. Creating ..." << LL_ENDL; - gInventory.createNewCategory(set->getInventoryUUID(),LLFolderType::FT_NONE,state->mName); + gInventory.createNewCategory(set->getInventoryUUID(), LLFolderType::FT_NONE, state->mName); LL_DEBUGS("AOEngine") << "looking for folder to get UUID ..." << LL_ENDL; LLUUID newStateFolderUUID; LLInventoryModel::item_array_t* items; LLInventoryModel::cat_array_t* cats; - gInventory.getDirectDescendentsOf(set->getInventoryUUID(),cats,items); + gInventory.getDirectDescendentsOf(set->getInventoryUUID(), cats, items); - for(S32 index=0;indexsize();index++) + for (S32 index = 0; index < cats->size(); ++index) { - if(cats->at(index)->getName().compare(state->mName)==0) + if (cats->at(index)->getName().compare(state->mName) == 0) { LL_DEBUGS("AOEngine") << "UUID found!" << LL_ENDL; - newStateFolderUUID=cats->at(index)->getUUID(); - state->mInventoryUUID=newStateFolderUUID; + newStateFolderUUID = cats->at(index)->getUUID(); + state->mInventoryUUID = newStateFolderUUID; break; } } } - if(state->mInventoryUUID.isNull()) + if (state->mInventoryUUID.isNull()) { LL_DEBUGS("AOEngine") << "state inventory UUID not found, failing." << LL_ENDL; return FALSE; @@ -756,56 +819,58 @@ BOOL AOEngine::createAnimationLink(const AOSet* set,AOSet::AOState* state,const return TRUE; } -BOOL AOEngine::addAnimation(const AOSet* set,AOSet::AOState* state,const LLInventoryItem* item,BOOL reload) +BOOL AOEngine::addAnimation(const AOSet* set, AOSet::AOState* state, const LLInventoryItem* item, BOOL reload) { AOSet::AOAnimation anim; - anim.mAssetUUID=item->getAssetUUID(); - anim.mInventoryUUID=item->getUUID(); - anim.mName=item->getName(); - anim.mSortOrder=state->mAnimations.size()+1; + anim.mAssetUUID = item->getAssetUUID(); + anim.mInventoryUUID = item->getUUID(); + anim.mName = item->getName(); + anim.mSortOrder = state->mAnimations.size() + 1; state->mAnimations.push_back(anim); - BOOL wasProtected=gSavedPerAccountSettings.getBOOL("ProtectAOFolders"); - gSavedPerAccountSettings.setBOOL("ProtectAOFolders",FALSE); - createAnimationLink(set,state,item); - gSavedPerAccountSettings.setBOOL("ProtectAOFolders",wasProtected); + BOOL wasProtected = gSavedPerAccountSettings.getBOOL("ProtectAOFolders"); + gSavedPerAccountSettings.setBOOL("ProtectAOFolders", FALSE); + createAnimationLink(set, state, item); + gSavedPerAccountSettings.setBOOL("ProtectAOFolders", wasProtected); - if(reload) + if (reload) + { mTimerCollection.enableReloadTimer(TRUE); + } return TRUE; } BOOL AOEngine::findForeignItems(const LLUUID& uuid) const { - BOOL moved=FALSE; + BOOL moved = FALSE; LLInventoryModel::item_array_t* items; LLInventoryModel::cat_array_t* cats; - gInventory.getDirectDescendentsOf(uuid,cats,items); - for(S32 index=0;indexsize();index++) + gInventory.getDirectDescendentsOf(uuid, cats, items); + for (S32 index = 0; index < cats->size(); ++index) { // recurse into subfolders - if(findForeignItems(cats->at(index)->getUUID())) + if (findForeignItems(cats->at(index)->getUUID())) { - moved=TRUE; + moved = TRUE; } } // count backwards in case we have to remove items - BOOL wasProtected=gSavedPerAccountSettings.getBOOL("ProtectAOFolders"); - gSavedPerAccountSettings.setBOOL("ProtectAOFolders",FALSE); - for(S32 index=items->size()-1;index>=0;index--) + BOOL wasProtected = gSavedPerAccountSettings.getBOOL("ProtectAOFolders"); + gSavedPerAccountSettings.setBOOL("ProtectAOFolders", FALSE); + for (S32 index = items->size() - 1; index >= 0; --index) { - BOOL move=FALSE; + BOOL move = FALSE; - LLPointer item=items->at(index); - if(item->getIsLinkType()) + LLPointer item = items->at(index); + if (item->getIsLinkType()) { - if(item->getInventoryType()!=LLInventoryType::IT_ANIMATION) + if (item->getInventoryType() != LLInventoryType::IT_ANIMATION) { LL_DEBUGS("AOEngine") << item->getName() << " is a link but does not point to an animation." << LL_ENDL; - move=TRUE; + move = TRUE; } else { @@ -815,18 +880,18 @@ BOOL AOEngine::findForeignItems(const LLUUID& uuid) const else { LL_DEBUGS("AOEngine") << item->getName() << " is not a link!" << LL_ENDL; - move=TRUE; + move = TRUE; } - if(move) + if (move) { - moved=TRUE; + moved = TRUE; LLInventoryModel* model = &gInventory; - model->changeItemParent(item,gInventory.findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND),FALSE); + model->changeItemParent(item, gInventory.findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND), FALSE); LL_DEBUGS("AOEngine") << item->getName() << " moved to lost and found!" << LL_ENDL; } } - gSavedPerAccountSettings.setBOOL("ProtectAOFolders",wasProtected); + gSavedPerAccountSettings.setBOOL("ProtectAOFolders", wasProtected); return moved; } @@ -835,11 +900,11 @@ BOOL AOEngine::findForeignItems(const LLUUID& uuid) const void AOEngine::purgeFolder(const LLUUID& uuid) const { // unprotect it - BOOL wasProtected=gSavedPerAccountSettings.getBOOL("ProtectAOFolders"); - gSavedPerAccountSettings.setBOOL("ProtectAOFolders",FALSE); + BOOL wasProtected = gSavedPerAccountSettings.getBOOL("ProtectAOFolders"); + gSavedPerAccountSettings.setBOOL("ProtectAOFolders", FALSE); // move everything that's not an animation link to "lost and found" - if(findForeignItems(uuid)) + if (findForeignItems(uuid)) { LLNotificationsUtil::add("AOForeignItemsFound", LLSD()); } @@ -856,7 +921,7 @@ void AOEngine::purgeFolder(const LLUUID& uuid) const gInventory.notifyObservers(); // protect it - gSavedPerAccountSettings.setBOOL("ProtectAOFolders",wasProtected); + gSavedPerAccountSettings.setBOOL("ProtectAOFolders", wasProtected); } BOOL AOEngine::removeSet(AOSet* set) @@ -867,30 +932,32 @@ BOOL AOEngine::removeSet(AOSet* set) return TRUE; } -BOOL AOEngine::removeAnimation(const AOSet* set,AOSet::AOState* state,S32 index) +BOOL AOEngine::removeAnimation(const AOSet* set, AOSet::AOState* state, S32 index) { - S32 numOfAnimations=state->mAnimations.size(); - if(numOfAnimations==0) + S32 numOfAnimations = state->mAnimations.size(); + if (numOfAnimations == 0) + { return FALSE; + } - LLViewerInventoryItem* item=gInventory.getItem(state->mAnimations[index].mInventoryUUID); + LLViewerInventoryItem* item = gInventory.getItem(state->mAnimations[index].mInventoryUUID); // check if this item is actually an animation link - BOOL move=TRUE; - if(item->getIsLinkType()) + BOOL move = TRUE; + if (item->getIsLinkType()) { - if(item->getInventoryType()==LLInventoryType::IT_ANIMATION) + if (item->getInventoryType() == LLInventoryType::IT_ANIMATION) { // it is an animation link, so mark it to be purged - move=FALSE; + move = FALSE; } } // this item was not an animation link, move it to lost and found - if(move) + if (move) { LLInventoryModel* model = &gInventory; - model->changeItemParent(item,gInventory.findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND),FALSE); + model->changeItemParent(item, gInventory.findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND), FALSE); LLNotificationsUtil::add("AOForeignItemsFound", LLSD()); update(); return FALSE; @@ -901,23 +968,23 @@ BOOL AOEngine::removeAnimation(const AOSet* set,AOSet::AOState* state,S32 index) remove_inventory_object(state->mAnimations[index].mInventoryUUID, NULL); // item->getUUID()); gInventory.notifyObservers(); - state->mAnimations.erase(state->mAnimations.begin()+index); + state->mAnimations.erase(state->mAnimations.begin() + index); - if(state->mAnimations.size()==0) + if (state->mAnimations.size() == 0) { LL_DEBUGS("AOEngine") << "purging folder " << state->mName << " from inventory because it's empty." << LL_ENDL; LLInventoryModel::item_array_t* items; LLInventoryModel::cat_array_t* cats; - gInventory.getDirectDescendentsOf(set->getInventoryUUID(),cats,items); + gInventory.getDirectDescendentsOf(set->getInventoryUUID(), cats, items); - for(S32 index=0;indexsize();index++) + for (S32 index = 0; index < cats->size(); ++index) { std::vector params; - LLStringUtil::getTokens(cats->at(index)->getName(),params,":"); - std::string stateName=params[0]; + LLStringUtil::getTokens(cats->at(index)->getName(), params, ":"); + std::string stateName = params[0]; - if(state->mName.compare(stateName)==0) + if (state->mName.compare(stateName) == 0) { LL_DEBUGS("AOEngine") << "folder found: " << cats->at(index)->getName() << " purging uuid " << cats->at(index)->getUUID() << LL_ENDL; @@ -928,35 +995,41 @@ BOOL AOEngine::removeAnimation(const AOSet* set,AOSet::AOState* state,S32 index) } } else + { updateSortOrder(state); + } return TRUE; } -BOOL AOEngine::swapWithPrevious(AOSet::AOState* state,S32 index) +BOOL AOEngine::swapWithPrevious(AOSet::AOState* state, S32 index) { - S32 numOfAnimations=state->mAnimations.size(); - if(numOfAnimations<2 || index==0) + S32 numOfAnimations = state->mAnimations.size(); + if (numOfAnimations < 2 || index == 0) + { return FALSE; + } - AOSet::AOAnimation tmpAnim=state->mAnimations[index]; - state->mAnimations.erase(state->mAnimations.begin()+index); - state->mAnimations.insert(state->mAnimations.begin()+index-1,tmpAnim); + AOSet::AOAnimation tmpAnim = state->mAnimations[index]; + state->mAnimations.erase(state->mAnimations.begin() + index); + state->mAnimations.insert(state->mAnimations.begin() + index - 1, tmpAnim); updateSortOrder(state); return TRUE; } -BOOL AOEngine::swapWithNext(AOSet::AOState* state,S32 index) +BOOL AOEngine::swapWithNext(AOSet::AOState* state, S32 index) { - S32 numOfAnimations=state->mAnimations.size(); - if(numOfAnimations<2 || index==(numOfAnimations-1)) + S32 numOfAnimations = state->mAnimations.size(); + if (numOfAnimations < 2 || index == (numOfAnimations - 1)) + { return FALSE; + } - AOSet::AOAnimation tmpAnim=state->mAnimations[index]; - state->mAnimations.erase(state->mAnimations.begin()+index); - state->mAnimations.insert(state->mAnimations.begin()+index+1,tmpAnim); + AOSet::AOAnimation tmpAnim = state->mAnimations[index]; + state->mAnimations.erase(state->mAnimations.begin() + index); + state->mAnimations.insert(state->mAnimations.begin() + index + 1, tmpAnim); updateSortOrder(state); @@ -970,50 +1043,52 @@ void AOEngine::reloadStateAnimations(AOSet::AOState* state) state->mAnimations.clear(); - gInventory.getDirectDescendentsOf(state->mInventoryUUID,dummy,items); - for(S32 num=0;numsize();num++) + gInventory.getDirectDescendentsOf(state->mInventoryUUID, dummy, items); + for (S32 num = 0; num < items->size(); ++num) { LL_DEBUGS("AOEngine") << "Found animation link " << items->at(num)->LLInventoryItem::getName() << " desc " << items->at(num)->LLInventoryItem::getDescription() << " asset " << items->at(num)->getAssetUUID() << LL_ENDL; AOSet::AOAnimation anim; - anim.mAssetUUID=items->at(num)->getAssetUUID(); - LLViewerInventoryItem* linkedItem=items->at(num)->getLinkedItem(); - if(linkedItem==0) + anim.mAssetUUID = items->at(num)->getAssetUUID(); + LLViewerInventoryItem* linkedItem = items->at(num)->getLinkedItem(); + if (linkedItem == 0) { LL_WARNS("AOEngine") << "linked item for link " << items->at(num)->LLInventoryItem::getName() << " not found (broken link). Skipping." << LL_ENDL; continue; } - anim.mName=linkedItem->LLInventoryItem::getName(); - anim.mInventoryUUID=items->at(num)->getUUID(); + anim.mName = linkedItem->LLInventoryItem::getName(); + anim.mInventoryUUID = items->at(num)->getUUID(); S32 sortOrder; - if(!LLStringUtil::convertToS32(items->at(num)->LLInventoryItem::getDescription(),sortOrder)) - sortOrder=-1; - anim.mSortOrder=sortOrder; + if (!LLStringUtil::convertToS32(items->at(num)->LLInventoryItem::getDescription(), sortOrder)) + { + sortOrder = -1; + } + anim.mSortOrder = sortOrder; LL_DEBUGS("AOEngine") << "current sort order is " << sortOrder << LL_ENDL; - if(sortOrder==-1) + if (sortOrder == -1) { LL_WARNS("AOEngine") << "sort order was unknown so append to the end of the list" << LL_ENDL; state->mAnimations.push_back(anim); } else { - BOOL inserted=FALSE; - for(U32 index=0;indexmAnimations.size();index++) + BOOL inserted = FALSE; + for (U32 index = 0; index < state->mAnimations.size(); ++index) { - if(state->mAnimations[index].mSortOrder>sortOrder) + if (state->mAnimations[index].mSortOrder > sortOrder) { LL_DEBUGS("AOEngine") << "inserting at index " << index << LL_ENDL; - state->mAnimations.insert(state->mAnimations.begin()+index,anim); - inserted=TRUE; + state->mAnimations.insert(state->mAnimations.begin() + index, anim); + inserted = TRUE; break; } } - if(!inserted) + if (!inserted) { LL_DEBUGS("AOEngine") << "not inserted yet, appending to the list instead" << LL_ENDL; state->mAnimations.push_back(anim); @@ -1027,11 +1102,13 @@ void AOEngine::reloadStateAnimations(AOSet::AOState* state) void AOEngine::update() { - if(mAOFolder.isNull()) + if (mAOFolder.isNull()) + { return; + } // move everything that's not an animation link to "lost and found" - if(findForeignItems(mAOFolder)) + if (findForeignItems(mAOFolder)) { LLNotificationsUtil::add("AOForeignItemsFound", LLSD()); } @@ -1039,78 +1116,88 @@ void AOEngine::update() LLInventoryModel::cat_array_t* categories; LLInventoryModel::item_array_t* items; - BOOL allComplete=TRUE; + BOOL allComplete = TRUE; mTimerCollection.enableSettingsTimer(FALSE); - gInventory.getDirectDescendentsOf(mAOFolder,categories,items); - for(S32 index=0;indexsize();index++) + gInventory.getDirectDescendentsOf(mAOFolder, categories, items); + for (S32 index = 0; index < categories->size(); ++index) { - LLViewerInventoryCategory* currentCategory=categories->at(index); - const std::string& setFolderName=currentCategory->getName(); + LLViewerInventoryCategory* currentCategory = categories->at(index); + const std::string& setFolderName = currentCategory->getName(); - if( setFolderName.empty()) + if (setFolderName.empty()) { LL_WARNS("AOEngine") << "Folder with emtpy name in AO folder" << LL_ENDL; continue; } std::vector params; - LLStringUtil::getTokens(setFolderName,params,":"); + LLStringUtil::getTokens(setFolderName, params, ":"); - AOSet* newSet=getSetByName(params[0]); - if(newSet==0) + AOSet* newSet = getSetByName(params[0]); + if (newSet == 0) { LL_DEBUGS("AOEngine") << "Adding set " << setFolderName << " to AO." << LL_ENDL; - newSet=new AOSet(currentCategory->getUUID()); + newSet = new AOSet(currentCategory->getUUID()); newSet->setName(params[0]); mSets.push_back(newSet); } else { - if(newSet->getComplete()) + if (newSet->getComplete()) { LL_DEBUGS("AOEngine") << "Set " << params[0] << " already complete. Skipping." << LL_ENDL; continue; } LL_DEBUGS("AOEngine") << "Updating set " << setFolderName << " in AO." << LL_ENDL; } - allComplete=FALSE; + allComplete = FALSE; - for(U32 num=1;numsetSitOverride(TRUE); - else if(params[num]=="SM") - newSet->setSmart(TRUE); - else if(params[num]=="DM") - newSet->setMouselookDisable(TRUE); - else if(params[num]=="**") + if (params[num].size() != 2) { - mDefaultSet=newSet; - mCurrentSet=newSet; + LL_WARNS("AOEngine") << "Unknown AO set option " << params[num] << LL_ENDL; + } + else if (params[num] == "SO") + { + newSet->setSitOverride(TRUE); + } + else if (params[num] == "SM") + { + newSet->setSmart(TRUE); + } + else if (params[num] == "DM") + { + newSet->setMouselookDisable(TRUE); + } + else if (params[num] == "**") + { + mDefaultSet = newSet; + mCurrentSet = newSet; } else + { LL_WARNS("AOEngine") << "Unknown AO set option " << params[num] << LL_ENDL; + } } - if(gInventory.isCategoryComplete(currentCategory->getUUID())) + if (gInventory.isCategoryComplete(currentCategory->getUUID())) { LL_DEBUGS("AOEngine") << "Set " << params[0] << " is complete, reading states ..." << LL_ENDL; LLInventoryModel::cat_array_t* stateCategories; - gInventory.getDirectDescendentsOf(currentCategory->getUUID(),stateCategories,items); + gInventory.getDirectDescendentsOf(currentCategory->getUUID(), stateCategories, items); newSet->setComplete(TRUE); - for(S32 index=0;indexsize();index++) + for (S32 index = 0; index < stateCategories->size(); ++index) { std::vector params; - LLStringUtil::getTokens(stateCategories->at(index)->getName(),params,":"); - std::string stateName=params[0]; + LLStringUtil::getTokens(stateCategories->at(index)->getName(), params, ":"); + std::string stateName = params[0]; - AOSet::AOState* state=newSet->getStateByName(stateName); - if(state==NULL) + AOSet::AOState* state = newSet->getStateByName(stateName); + if (state == NULL) { LL_WARNS("AOEngine") << "Unknown state " << stateName << ". Skipping." << LL_ENDL; continue; @@ -1118,32 +1205,34 @@ void AOEngine::update() LL_DEBUGS("AOEngine") << "Reading state " << stateName << LL_ENDL; state->mInventoryUUID=stateCategories->at(index)->getUUID(); - for(U32 num=1;nummCycle=TRUE; + state->mCycle = TRUE; LL_DEBUGS("AOEngine") << "Cycle on" << LL_ENDL; } - else if(params[num]=="RN") + else if (params[num] == "RN") { - state->mRandom=TRUE; + state->mRandom = TRUE; LL_DEBUGS("AOEngine") << "Random on" << LL_ENDL; } - else if(params[num].substr(0,2)=="CT") + else if (params[num].substr(0, 2) == "CT") { - LLStringUtil::convertToS32(params[num].substr(2,params[num].size()-2),state->mCycleTime); + LLStringUtil::convertToS32(params[num].substr(2, params[num].size() - 2), state->mCycleTime); LL_DEBUGS("AOEngine") << "Cycle Time specified:" << state->mCycleTime << LL_ENDL; } else + { LL_WARNS("AOEngine") << "Unknown AO set option " << params[num] << LL_ENDL; + } } - if(!gInventory.isCategoryComplete(state->mInventoryUUID)) + if (!gInventory.isCategoryComplete(state->mInventoryUUID)) { LL_DEBUGS("AOEngine") << "State category " << stateName << " is incomplete, fetching descendents" << LL_ENDL; gInventory.fetchDescendentsOf(state->mInventoryUUID); - allComplete=FALSE; + allComplete = FALSE; newSet->setComplete(FALSE); continue; } @@ -1157,11 +1246,11 @@ void AOEngine::update() } } - if(allComplete) + if (allComplete) { - mEnabled=gSavedPerAccountSettings.getBOOL("UseAO"); + mEnabled = gSavedPerAccountSettings.getBOOL("UseAO"); - if(!mCurrentSet && !mSets.empty()) + if (!mCurrentSet && !mSets.empty()) { LL_DEBUGS("AOEngine") << "No default set defined, choosing the first in the list." << LL_ENDL; selectSet(mSets[0]); @@ -1176,35 +1265,39 @@ void AOEngine::update() } } -void AOEngine::reload( bool aFromTimer ) +void AOEngine::reload(bool aFromTimer) { - BOOL wasEnabled=mEnabled; + BOOL wasEnabled = mEnabled; mTimerCollection.enableReloadTimer(FALSE); - if(wasEnabled) + if (wasEnabled) + { enable(FALSE); + } gAgent.stopCurrentAnimations(); - mLastOverriddenMotion=ANIM_AGENT_STAND; + mLastOverriddenMotion = ANIM_AGENT_STAND; - clear( aFromTimer ); + clear(aFromTimer); mAOFolder.setNull(); mTimerCollection.enableInventoryTimer(TRUE); tick(); - if(wasEnabled) + if (wasEnabled) + { enable(TRUE); + } } AOSet* AOEngine::getSetByName(const std::string& name) const { - AOSet* found=0; - for(U32 index=0;indexgetName().compare(name)==0) + if (mSets[index]->getName().compare(name) == 0) { - found=mSets[index]; + found = mSets[index]; break; } } @@ -1214,7 +1307,9 @@ AOSet* AOEngine::getSetByName(const std::string& name) const const std::string AOEngine::getCurrentSetName() const { if(mCurrentSet) + { return mCurrentSet->getName(); + } return std::string(); } @@ -1225,30 +1320,30 @@ const AOSet* AOEngine::getDefaultSet() const void AOEngine::selectSet(AOSet* set) { - if(mEnabled && mCurrentSet) + if (mEnabled && mCurrentSet) { - AOSet::AOState* state=mCurrentSet->getStateByRemapID(mLastOverriddenMotion); - if(state) + AOSet::AOState* state = mCurrentSet->getStateByRemapID(mLastOverriddenMotion); + if (state) { - gAgent.sendAnimationRequest(state->mCurrentAnimationID,ANIM_REQUEST_STOP); + gAgent.sendAnimationRequest(state->mCurrentAnimationID, ANIM_REQUEST_STOP); state->mCurrentAnimationID.setNull(); mCurrentSet->stopTimer(); } } - mCurrentSet=set; + mCurrentSet = set; - if(mEnabled) + if (mEnabled) { LL_DEBUGS("AOEngine") << "enabling with motion " << gAnimLibrary.animationName(mLastMotion) << LL_ENDL; - gAgent.sendAnimationRequest(override(mLastMotion,TRUE),ANIM_REQUEST_START); + gAgent.sendAnimationRequest(override(mLastMotion, TRUE), ANIM_REQUEST_START); } } AOSet* AOEngine::selectSetByName(const std::string& name) { - AOSet* set=getSetByName(name); - if(set) + AOSet* set = getSetByName(name); + if (set) { selectSet(set); return set; @@ -1264,18 +1359,28 @@ const std::vector AOEngine::getSetList() const void AOEngine::saveSet(const AOSet* set) { - if(!set) + if (!set) + { return; + } std::string setParams=set->getName(); - if(set->getSitOverride()) - setParams+=":SO"; - if(set->getSmart()) - setParams+=":SM"; - if(set->getMouselookDisable()) - setParams+=":DM"; - if(set==mDefaultSet) - setParams+=":**"; + if (set->getSitOverride()) + { + setParams += ":SO"; + } + if (set->getSmart()) + { + setParams += ":SM"; + } + if (set->getMouselookDisable()) + { + setParams += ":DM"; + } + if (set == mDefaultSet) + { + setParams += ":**"; + } /* // This works fine, but LL seems to have added a few helper functions in llinventoryfunctions.h @@ -1288,19 +1393,21 @@ void AOEngine::saveSet(const AOSet* set) gInventory.addChangedMask(LLInventoryObserver::LABEL, cat->getUUID()); gInventory.notifyObservers(); */ - BOOL wasProtected=gSavedPerAccountSettings.getBOOL("ProtectAOFolders"); - gSavedPerAccountSettings.setBOOL("ProtectAOFolders",FALSE); - rename_category(&gInventory,set->getInventoryUUID(),setParams); - gSavedPerAccountSettings.setBOOL("ProtectAOFolders",wasProtected); + BOOL wasProtected = gSavedPerAccountSettings.getBOOL("ProtectAOFolders"); + gSavedPerAccountSettings.setBOOL("ProtectAOFolders", FALSE); + rename_category(&gInventory, set->getInventoryUUID(), setParams); + gSavedPerAccountSettings.setBOOL("ProtectAOFolders", wasProtected); LL_INFOS("AOEngine") << "sending update signal" << LL_ENDL; mUpdatedSignal(); } -BOOL AOEngine::renameSet(AOSet* set,const std::string& name) +BOOL AOEngine::renameSet(AOSet* set, const std::string& name) { - if(name.empty() || name.find(":")!=std::string::npos) + if (name.empty() || name.find(":") != std::string::npos) + { return FALSE; + } set->setName(name); set->setDirty(TRUE); @@ -1309,45 +1416,49 @@ BOOL AOEngine::renameSet(AOSet* set,const std::string& name) void AOEngine::saveState(const AOSet::AOState* state) { - std::string stateParams=state->mName; - F32 time=state->mCycleTime; - if(time>0.0) + std::string stateParams = state->mName; + F32 time = state->mCycleTime; + if (time > 0.0f) { std::ostringstream timeStr; timeStr << ":CT" << state->mCycleTime; - stateParams+=timeStr.str(); + stateParams += timeStr.str(); + } + if (state->mCycle) + { + stateParams += ":CY"; + } + if (state->mRandom) + { + stateParams += ":RN"; } - if(state->mCycle) - stateParams+=":CY"; - if(state->mRandom) - stateParams+=":RN"; - BOOL wasProtected=gSavedPerAccountSettings.getBOOL("ProtectAOFolders"); - gSavedPerAccountSettings.setBOOL("ProtectAOFolders",FALSE); - rename_category(&gInventory,state->mInventoryUUID,stateParams); - gSavedPerAccountSettings.setBOOL("ProtectAOFolders",wasProtected); + BOOL wasProtected = gSavedPerAccountSettings.getBOOL("ProtectAOFolders"); + gSavedPerAccountSettings.setBOOL("ProtectAOFolders", FALSE); + rename_category(&gInventory, state->mInventoryUUID, stateParams); + gSavedPerAccountSettings.setBOOL("ProtectAOFolders", wasProtected); } void AOEngine::saveSettings() { - for(U32 index=0;indexgetDirty()) + AOSet* set = mSets[index]; + if (set->getDirty()) { saveSet(set); LL_INFOS("AOEngine") << "dirty set saved " << set->getName() << LL_ENDL; set->setDirty(FALSE); } - for(S32 stateIndex=0;stateIndexgetState(stateIndex); - if(state->mDirty) + AOSet::AOState* state = set->getState(stateIndex); + if (state->mDirty) { saveState(state); LL_INFOS("AOEngine") << "dirty state saved " << state->mName << LL_ENDL; - state->mDirty=FALSE; + state->mDirty = FALSE; } } } @@ -1355,160 +1466,184 @@ void AOEngine::saveSettings() void AOEngine::inMouselook(BOOL yes) { - if(mInMouselook==yes) - return; - - mInMouselook=yes; - - if(!mCurrentSet) - return; - - if(!mCurrentSet->getMouselookDisable()) - return; - - if(!mEnabled) - return; - - if(mLastMotion!=ANIM_AGENT_STAND) - return; - - if(yes) + if (mInMouselook == yes) { - AOSet::AOState* state=mCurrentSet->getState(AOSet::Standing); - if(!state) - return; + return; + } - LLUUID animation=state->mCurrentAnimationID; - if(animation.notNull()) + mInMouselook = yes; + + if (!mCurrentSet) + { + return; + } + + if (!mCurrentSet->getMouselookDisable()) + { + return; + } + + if (!mEnabled) + { + return; + } + + if (mLastMotion != ANIM_AGENT_STAND) + { + return; + } + + if (yes) + { + AOSet::AOState* state = mCurrentSet->getState(AOSet::Standing); + if (!state) { - gAgent.sendAnimationRequest(animation,ANIM_REQUEST_STOP); + return; + } + + LLUUID animation = state->mCurrentAnimationID; + if (animation.notNull()) + { + gAgent.sendAnimationRequest(animation, ANIM_REQUEST_STOP); gAgentAvatarp->LLCharacter::stopMotion(animation); state->mCurrentAnimationID.setNull(); LL_DEBUGS("AOEngine") << " stopped animation " << animation << " in state " << state->mName << LL_ENDL; } - gAgent.sendAnimationRequest(ANIM_AGENT_STAND,ANIM_REQUEST_START); + gAgent.sendAnimationRequest(ANIM_AGENT_STAND, ANIM_REQUEST_START); } else { stopAllStandVariants(); - gAgent.sendAnimationRequest(override(ANIM_AGENT_STAND,TRUE),ANIM_REQUEST_START); + gAgent.sendAnimationRequest(override(ANIM_AGENT_STAND, TRUE), ANIM_REQUEST_START); } } void AOEngine::setDefaultSet(AOSet* set) { - mDefaultSet=set; - for(U32 index=0;indexsetDirty(TRUE); + } } -void AOEngine::setOverrideSits(AOSet* set,BOOL yes) +void AOEngine::setOverrideSits(AOSet* set, BOOL yes) { set->setSitOverride(yes); set->setDirty(TRUE); - if(mCurrentSet!=set) + if (mCurrentSet != set) + { return; + } - if(mLastMotion!=ANIM_AGENT_SIT) + if (mLastMotion != ANIM_AGENT_SIT) + { return; + } - if(yes) + if (yes) { stopAllSitVariants(); - gAgent.sendAnimationRequest(override(ANIM_AGENT_SIT,TRUE),ANIM_REQUEST_START); + gAgent.sendAnimationRequest(override(ANIM_AGENT_SIT, TRUE), ANIM_REQUEST_START); } else { - AOSet::AOState* state=mCurrentSet->getState(AOSet::Sitting); - if(!state) - return; - - LLUUID animation=state->mCurrentAnimationID; - if(animation.notNull()) + AOSet::AOState* state = mCurrentSet->getState(AOSet::Sitting); + if (!state) { - gAgent.sendAnimationRequest(animation,ANIM_REQUEST_STOP); + return; + } + + LLUUID animation = state->mCurrentAnimationID; + if (animation.notNull()) + { + gAgent.sendAnimationRequest(animation, ANIM_REQUEST_STOP); gAgentAvatarp->LLCharacter::stopMotion(animation); state->mCurrentAnimationID.setNull(); } - gAgent.sendAnimationRequest(ANIM_AGENT_SIT,ANIM_REQUEST_START); + gAgent.sendAnimationRequest(ANIM_AGENT_SIT, ANIM_REQUEST_START); } } -void AOEngine::setSmart(AOSet* set,BOOL yes) +void AOEngine::setSmart(AOSet* set, BOOL yes) { set->setSmart(yes); set->setDirty(TRUE); } -void AOEngine::setDisableStands(AOSet* set,BOOL yes) +void AOEngine::setDisableStands(AOSet* set, BOOL yes) { set->setMouselookDisable(yes); set->setDirty(TRUE); - if(mCurrentSet!=set) + if (mCurrentSet != set) + { return; + } // make sure an update happens if needed - mInMouselook=!gAgentCamera.cameraMouselook(); + mInMouselook = !gAgentCamera.cameraMouselook(); inMouselook(!mInMouselook); } -void AOEngine::setCycle(AOSet::AOState* state,BOOL yes) +void AOEngine::setCycle(AOSet::AOState* state, BOOL yes) { - state->mCycle=yes; - state->mDirty=TRUE; + state->mCycle = yes; + state->mDirty = TRUE; } -void AOEngine::setRandomize(AOSet::AOState* state,BOOL yes) +void AOEngine::setRandomize(AOSet::AOState* state, BOOL yes) { - state->mRandom=yes; - state->mDirty=TRUE; + state->mRandom = yes; + state->mDirty = TRUE; } -void AOEngine::setCycleTime(AOSet::AOState* state,F32 time) +void AOEngine::setCycleTime(AOSet::AOState* state, F32 time) { - state->mCycleTime=time; - state->mDirty=TRUE; + state->mCycleTime = time; + state->mDirty = TRUE; } void AOEngine::tick() { // make sure agent is alive and kicking before doing anything - if ( !isAgentAvatarValid() ) + if (!isAgentAvatarValid()) + { return; + } // - const LLUUID categoryID=gInventory.findCategoryByName(ROOT_FIRESTORM_FOLDER); + const LLUUID categoryID = gInventory.findCategoryByName(ROOT_FIRESTORM_FOLDER); - if(categoryID.isNull()) + if (categoryID.isNull()) { LL_WARNS("AOEngine") << "no " << ROOT_FIRESTORM_FOLDER << " folder yet. Creating ..." << LL_ENDL; - gInventory.createNewCategory(gInventory.getRootFolderID(),LLFolderType::FT_NONE,ROOT_FIRESTORM_FOLDER); + gInventory.createNewCategory(gInventory.getRootFolderID(), LLFolderType::FT_NONE, ROOT_FIRESTORM_FOLDER); mAOFolder.setNull(); } else { LLInventoryModel::cat_array_t* categories; LLInventoryModel::item_array_t* items; - gInventory.getDirectDescendentsOf(categoryID,categories,items); + gInventory.getDirectDescendentsOf(categoryID, categories, items); LL_DEBUGS("AOEngine") << "cat " << categories->size() << " items " << items->size() << LL_ENDL; - for(S32 index=0;indexsize();index++) + for (S32 index = 0; index < categories->size(); ++index) { - const std::string& catName=categories->at(index)->getName(); - if(catName.compare(ROOT_AO_FOLDER)==0) + const std::string& catName = categories->at(index)->getName(); + if (catName.compare(ROOT_AO_FOLDER) == 0) { - mAOFolder=categories->at(index)->getUUID(); + mAOFolder = categories->at(index)->getUUID(); break; } } - if(mAOFolder.isNull()) + if (mAOFolder.isNull()) { LL_WARNS("AOEngine") << "no " << ROOT_AO_FOLDER << " folder yet. Creating ..." << LL_ENDL; - gInventory.createNewCategory(categoryID,LLFolderType::FT_NONE,ROOT_AO_FOLDER); + gInventory.createNewCategory(categoryID, LLFolderType::FT_NONE, ROOT_AO_FOLDER); } else { @@ -1520,33 +1655,33 @@ void AOEngine::tick() BOOL AOEngine::importNotecard(const LLInventoryItem* item) { - if(item) + if (item) { LL_INFOS("AOEngine") << "importing AO notecard: " << item->getName() << LL_ENDL; - if(getSetByName(item->getName())) + if (getSetByName(item->getName())) { LLNotificationsUtil::add("AOImportSetAlreadyExists", LLSD()); return FALSE; } - if(!gAgent.allowOperation(PERM_COPY,item->getPermissions(),GP_OBJECT_MANIPULATE) && !gAgent.isGodlike()) + if (!gAgent.allowOperation(PERM_COPY, item->getPermissions(), GP_OBJECT_MANIPULATE) && !gAgent.isGodlike()) { LLNotificationsUtil::add("AOImportPermissionDenied", LLSD()); return FALSE; } - if(item->getAssetUUID().notNull()) + if (item->getAssetUUID().notNull()) { - mImportSet=new AOSet(item->getParentUUID()); - if(!mImportSet) + mImportSet = new AOSet(item->getParentUUID()); + if (!mImportSet) { LLNotificationsUtil::add("AOImportCreateSetFailed", LLSD()); return FALSE; } mImportSet->setName(item->getName()); - LLUUID* newUUID=new LLUUID(item->getAssetUUID()); - const LLHost sourceSim=LLHost::invalid; + LLUUID* newUUID = new LLUUID(item->getAssetUUID()); + const LLHost sourceSim = LLHost::invalid; gAssetStorage->getInvItemAsset ( @@ -1570,10 +1705,10 @@ BOOL AOEngine::importNotecard(const LLInventoryItem* item) } // static -void AOEngine::onNotecardLoadComplete( LLVFS* vfs,const LLUUID& assetUUID,LLAssetType::EType type, - void* userdata,S32 status,LLExtStat extStatus) +void AOEngine::onNotecardLoadComplete(LLVFS* vfs, const LLUUID& assetUUID, LLAssetType::EType type, + void* userdata, S32 status, LLExtStat extStatus) { - if(status!=LL_ERR_NOERR) + if (status != LL_ERR_NOERR) { // AOImportDownloadFailed LLNotificationsUtil::add("AOImportDownloadFailed", LLSD()); @@ -1583,9 +1718,9 @@ void AOEngine::onNotecardLoadComplete( LLVFS* vfs,const LLUUID& assetUUID,LLAsse } LL_DEBUGS("AOEngine") << "Downloading import notecard complete." << LL_ENDL; - S32 notecardSize=vfs->getSize(assetUUID,type); - char* buffer=new char[notecardSize]; - vfs->getData(assetUUID,type,(U8*) buffer,0,notecardSize); + S32 notecardSize = vfs->getSize(assetUUID, type); + char* buffer = new char[notecardSize]; + vfs->getData(assetUUID, type, (U8*) buffer, 0, notecardSize); AOEngine::instance().parseNotecard(buffer); } @@ -1594,14 +1729,14 @@ void AOEngine::parseNotecard(const char* buffer) { LL_DEBUGS("AOEngine") << "parsing import notecard" << LL_ENDL; - BOOL isValid=FALSE; + BOOL isValid = FALSE; - if(!buffer) + if (!buffer) { LL_WARNS("AOEngine") << "buffer==NULL - aborting import" << LL_ENDL; // NOTE: cleanup is always the same, needs streamlining delete mImportSet; - mImportSet=0; + mImportSet = 0; mUpdatedSignal(); return; } @@ -1610,157 +1745,163 @@ void AOEngine::parseNotecard(const char* buffer) delete buffer; std::vector lines; - LLStringUtil::getTokens(text,lines,"\n"); + LLStringUtil::getTokens(text, lines, "\n"); - S32 found=-1; - for(U32 index=0;indexgetInventoryUUID()); - if(!importCategory) + LLViewerInventoryCategory* importCategory = gInventory.getCategory(mImportSet->getInventoryUUID()); + if (!importCategory) { LLNotificationsUtil::add("AOImportNoFolder", LLSD()); delete mImportSet; - mImportSet=0; + mImportSet = 0; mUpdatedSignal(); return; } - std::map animationMap; + std::map animationMap; LLInventoryModel::cat_array_t* dummy; LLInventoryModel::item_array_t* items; - gInventory.getDirectDescendentsOf(mImportSet->getInventoryUUID(),dummy,items); - for(U32 index=0;indexsize();index++) + gInventory.getDirectDescendentsOf(mImportSet->getInventoryUUID(), dummy, items); + for (U32 index = 0; index < items->size(); ++index) { - animationMap[items->at(index)->getName()]=items->at(index)->getUUID(); + animationMap[items->at(index)->getName()] = items->at(index)->getUUID(); LL_DEBUGS("AOEngine") << "animation " << items->at(index)->getName() << " has inventory UUID " << animationMap[items->at(index)->getName()] << LL_ENDL; } // [ State ]Anim1|Anim2|Anim3 - for(U32 index=found+1;index FIRE-3801; skip comments to reduce spam to local chat. - continue; - - if(line.find("[")!=0) + if (line.empty()) { - LLSD args; - args["LINE"]=(S32) index; - LLNotificationsUtil::add("AOImportNoStatePrefix",args); continue; } - if(line.find("]") == std::string::npos) + if (line[0] == '#') // FIRE-3801; skip comments to reduce spam to local chat. + { + continue; + } + + if (line.find("[") != 0) { LLSD args; - args["LINE"]=(S32) index; - LLNotificationsUtil::add("AOImportNoValidDelimiter",args); + args["LINE"] = (S32)index; + LLNotificationsUtil::add("AOImportNoStatePrefix", args); + continue; + } + + if (line.find("]") == std::string::npos) + { + LLSD args; + args["LINE"] = (S32)index; + LLNotificationsUtil::add("AOImportNoValidDelimiter", args); continue; } U32 endTag = line.find("]"); - std::string stateName=line.substr(1,endTag-1); + std::string stateName = line.substr(1, endTag - 1); LLStringUtil::trim(stateName); - AOSet::AOState* newState=mImportSet->getStateByName(stateName); - if(!newState) + AOSet::AOState* newState = mImportSet->getStateByName(stateName); + if (!newState) { LLSD args; - args["NAME"]=stateName; - LLNotificationsUtil::add("AOImportStateNameNotFound",args); + args["NAME"] = stateName; + LLNotificationsUtil::add("AOImportStateNameNotFound", args); continue; } - std::string animationLine=line.substr(endTag+1); + std::string animationLine = line.substr(endTag + 1); std::vector animationList; - LLStringUtil::getTokens(animationLine,animationList,"|,"); + LLStringUtil::getTokens(animationLine, animationList, "|,"); - for(U32 animIndex=0;animIndexmAnimations.push_back(animation); - isValid=TRUE; + isValid = TRUE; } } - if(!isValid) + if (!isValid) { - LLNotificationsUtil::add("AOImportInvalid",LLSD()); + LLNotificationsUtil::add("AOImportInvalid", LLSD()); // NOTE: cleanup is always the same, needs streamlining delete mImportSet; - mImportSet=0; + mImportSet = NULL; mUpdatedSignal(); return; } mTimerCollection.enableImportTimer(TRUE); - mImportRetryCount=0; + mImportRetryCount = 0; processImport(false); } -void AOEngine::processImport( bool aFromTimer ) +void AOEngine::processImport(bool aFromTimer) { - if(mImportCategory.isNull()) + if (mImportCategory.isNull()) { - mImportCategory=addSet(mImportSet->getName(),FALSE); - if(mImportCategory.isNull()) + mImportCategory = addSet(mImportSet->getName(), FALSE); + if (mImportCategory.isNull()) { mImportRetryCount++; - if(mImportRetryCount==5) + if (mImportRetryCount == 5) { // NOTE: cleanup is the same as at the end of this function. Needs streamlining. mTimerCollection.enableImportTimer(FALSE); delete mImportSet; - mImportSet=0; + mImportSet = NULL; mImportCategory.setNull(); mUpdatedSignal(); LLSD args; - args["NAME"]=mImportSet->getName(); - LLNotificationsUtil::add("AOImportAbortCreateSet",args); + args["NAME"] = mImportSet->getName(); + LLNotificationsUtil::add("AOImportAbortCreateSet", args); } else { LLSD args; - args["NAME"]=mImportSet->getName(); - LLNotificationsUtil::add("AOImportRetryCreateSet",args); + args["NAME"] = mImportSet->getName(); + LLNotificationsUtil::add("AOImportRetryCreateSet", args); } return; } @@ -1768,41 +1909,41 @@ void AOEngine::processImport( bool aFromTimer ) } BOOL allComplete=TRUE; - for(S32 index=0;indexgetState(index); - if(state->mAnimations.size()) + AOSet::AOState* state = mImportSet->getState(index); + if (state->mAnimations.size()) { - allComplete=FALSE; + allComplete = FALSE; LL_DEBUGS("AOEngine") << "state " << state->mName << " still has animations to link." << LL_ENDL; - for(S32 animationIndex=state->mAnimations.size()-1;animationIndex>=0;animationIndex--) + for (S32 animationIndex = state->mAnimations.size() - 1; animationIndex >= 0; --animationIndex) { LL_DEBUGS("AOEngine") << "linking animation " << state->mAnimations[animationIndex].mName << LL_ENDL; - if(createAnimationLink(mImportSet,state,gInventory.getItem(state->mAnimations[animationIndex].mInventoryUUID))) + if (createAnimationLink(mImportSet, state, gInventory.getItem(state->mAnimations[animationIndex].mInventoryUUID))) { LL_DEBUGS("AOEngine") << "link success, size "<< state->mAnimations.size() << ", removing animation " - << (*(state->mAnimations.begin()+animationIndex)).mName << " from import state" << LL_ENDL; - state->mAnimations.erase(state->mAnimations.begin()+animationIndex); + << (*(state->mAnimations.begin() + animationIndex)).mName << " from import state" << LL_ENDL; + state->mAnimations.erase(state->mAnimations.begin() + animationIndex); LL_DEBUGS("AOEngine") << "deleted, size now: " << state->mAnimations.size() << LL_ENDL; } else { LLSD args; - args["NAME"]=state->mAnimations[animationIndex].mName; - LLNotificationsUtil::add("AOImportLinkFailed",args); + args["NAME"] = state->mAnimations[animationIndex].mName; + LLNotificationsUtil::add("AOImportLinkFailed", args); } } } } - if(allComplete) + if (allComplete) { mTimerCollection.enableImportTimer(FALSE); - mOldImportSets.push_back( mImportSet ); // FIRE-3801; Cannot delete here, or LLInstanceTracker gets upset. Just remember and delete mOldImportSets once we can. - mImportSet=0; + mOldImportSets.push_back(mImportSet); // FIRE-3801; Cannot delete here, or LLInstanceTracker gets upset. Just remember and delete mOldImportSets once we can. + mImportSet = NULL; mImportCategory.setNull(); - reload( aFromTimer ); + reload(aFromTimer); } } @@ -1814,23 +1955,23 @@ const LLUUID& AOEngine::getAOFolder() const void AOEngine::onRegionChange() { // do nothing if the AO is off - if(!mEnabled) + if (!mEnabled) { return; } // catch errors without crashing - if(!mCurrentSet) + if (!mCurrentSet) { LL_DEBUGS("AOEngine") << "Current set was NULL" << LL_ENDL; return; } // sitting needs special attention - if(mCurrentSet->getMotion()==ANIM_AGENT_SIT) + if (mCurrentSet->getMotion() == ANIM_AGENT_SIT) { // do nothing if sit overrides was disabled - if(!mCurrentSet->getSitOverride()) + if (!mCurrentSet->getSitOverride()) { return; } @@ -1838,21 +1979,21 @@ void AOEngine::onRegionChange() // do nothing if the last overridden motion wasn't a sit. // happens when sit override is enabled but there were no // sit animations added to the set yet - if(mLastOverriddenMotion!=ANIM_AGENT_SIT) + if (mLastOverriddenMotion != ANIM_AGENT_SIT) { return; } // do nothing if smart sit is enabled because we have no // animation running from the AO - if(mCurrentSet->getSmart()) + if (mCurrentSet->getSmart()) { return; } } // restart current animation on region crossing - gAgent.sendAnimationRequest(mLastMotion,ANIM_REQUEST_START); + gAgent.sendAnimationRequest(mLastMotion, ANIM_REQUEST_START); } // ---------------------------------------------------- @@ -1870,7 +2011,7 @@ AOSitCancelTimer::~AOSitCancelTimer() void AOSitCancelTimer::oneShot() { - mTickCount=0; + mTickCount = 0; mEventTimer.start(); } @@ -1883,15 +2024,17 @@ BOOL AOSitCancelTimer::tick() { mTickCount++; AOEngine::instance().checkSitCancel(); - if(mTickCount==10) + if (mTickCount == 10) + { mEventTimer.stop(); + } return FALSE; } // ---------------------------------------------------- AOTimerCollection::AOTimerCollection() -: LLEventTimer(INVENTORY_POLLING_INTERVAL), +: LLEventTimer(INVENTORY_POLLING_INTERVAL), mInventoryTimer(TRUE), mSettingsTimer(FALSE), mReloadTimer(FALSE), @@ -1906,58 +2049,58 @@ AOTimerCollection::~AOTimerCollection() BOOL AOTimerCollection::tick() { - if(mInventoryTimer) + if (mInventoryTimer) { LL_DEBUGS("AOEngine") << "Inventory timer tick()" << LL_ENDL; AOEngine::instance().tick(); } - if(mSettingsTimer) + if (mSettingsTimer) { LL_DEBUGS("AOEngine") << "Settings timer tick()" << LL_ENDL; AOEngine::instance().saveSettings(); } - if(mReloadTimer) + if (mReloadTimer) { LL_DEBUGS("AOEngine") << "Reload timer tick()" << LL_ENDL; AOEngine::instance().reload(true); } - if(mImportTimer) + if (mImportTimer) { LL_DEBUGS("AOEngine") << "Import timer tick()" << LL_ENDL; AOEngine::instance().processImport(true); } -// always return FALSE or the LLEventTimer will be deleted -> crash + // always return FALSE or the LLEventTimer will be deleted -> crash return FALSE; } void AOTimerCollection::enableInventoryTimer(BOOL yes) { - mInventoryTimer=yes; + mInventoryTimer = yes; updateTimers(); } void AOTimerCollection::enableSettingsTimer(BOOL yes) { - mSettingsTimer=yes; + mSettingsTimer = yes; updateTimers(); } void AOTimerCollection::enableReloadTimer(BOOL yes) { - mReloadTimer=yes; + mReloadTimer = yes; updateTimers(); } void AOTimerCollection::enableImportTimer(BOOL yes) { - mImportTimer=yes; + mImportTimer = yes; updateTimers(); } void AOTimerCollection::updateTimers() { - if(!mInventoryTimer && !mSettingsTimer && !mReloadTimer && !mImportTimer) + if (!mInventoryTimer && !mSettingsTimer && !mReloadTimer && !mImportTimer) { LL_DEBUGS("AOEngine") << "no timer needed, stopping internal timer." << LL_ENDL; mEventTimer.stop(); diff --git a/indra/newview/aoengine.h b/indra/newview/aoengine.h index 904edae163..95699ba696 100644 --- a/indra/newview/aoengine.h +++ b/indra/newview/aoengine.h @@ -102,7 +102,7 @@ class AOEngine }; void enable(BOOL yes); - const LLUUID override(const LLUUID& motion,BOOL start); + const LLUUID override(const LLUUID& motion, BOOL start); void tick(); void update(); void reload(bool); @@ -111,19 +111,19 @@ class AOEngine const LLUUID& getAOFolder() const; - LLUUID addSet(const std::string& name,BOOL reload=TRUE); + LLUUID addSet(const std::string& name, BOOL reload = TRUE); BOOL removeSet(AOSet* set); - BOOL addAnimation(const AOSet* set,AOSet::AOState* state,const LLInventoryItem* item,BOOL reload=TRUE); - BOOL removeAnimation(const AOSet* set,AOSet::AOState* state,S32 index); + BOOL addAnimation(const AOSet* set, AOSet::AOState* state, const LLInventoryItem* item, BOOL reload = TRUE); + BOOL removeAnimation(const AOSet* set, AOSet::AOState* state, S32 index); void checkSitCancel(); void checkBelowWater(BOOL yes); BOOL importNotecard(const LLInventoryItem* item); - void processImport( bool ); + void processImport(bool); - BOOL swapWithPrevious(AOSet::AOState* state,S32 index); - BOOL swapWithNext(AOSet::AOState* state,S32 index); + BOOL swapWithPrevious(AOSet::AOState* state, S32 index); + BOOL swapWithNext(AOSet::AOState* state, S32 index); void cycleTimeout(const AOSet* set); void cycle(eCycleMode cycleMode); @@ -139,15 +139,15 @@ class AOEngine const std::vector getSetList() const; const std::string getCurrentSetName() const; const AOSet* getDefaultSet() const; - BOOL renameSet(AOSet* set,const std::string& name); + BOOL renameSet(AOSet* set, const std::string& name); void setDefaultSet(AOSet* set); - void setOverrideSits(AOSet* set,BOOL yes); - void setSmart(AOSet* set,BOOL yes); - void setDisableStands(AOSet* set,BOOL yes); - void setCycle(AOSet::AOState* set,BOOL yes); - void setRandomize(AOSet::AOState* state,BOOL yes); - void setCycleTime(AOSet::AOState* state,F32 time); + void setOverrideSits(AOSet* set, BOOL yes); + void setSmart(AOSet* set, BOOL yes); + void setDisableStands(AOSet* set, BOOL yes); + void setCycle(AOSet::AOState* set, BOOL yes); + void setRandomize(AOSet::AOState* state, BOOL yes); + void setCycleTime(AOSet::AOState* state, F32 time); void saveSettings(); @@ -180,15 +180,15 @@ class AOEngine void saveSet(const AOSet* set); void saveState(const AOSet::AOState* state); - BOOL createAnimationLink(const AOSet* set,AOSet::AOState* state,const LLInventoryItem* item); + BOOL createAnimationLink(const AOSet* set, AOSet::AOState* state, const LLInventoryItem* item); BOOL findForeignItems(const LLUUID& uuid) const; void purgeFolder(const LLUUID& uuid) const; void onRegionChange(); void onToggleAOControl(); - static void onNotecardLoadComplete( LLVFS* vfs,const LLUUID& assetUUID,LLAssetType::EType type, - void* userdata,S32 status,LLExtStat extStatus); + static void onNotecardLoadComplete(LLVFS* vfs, const LLUUID& assetUUID, LLAssetType::EType type, + void* userdata, S32 status, LLExtStat extStatus); void parseNotecard(const char* buffer); updated_signal_t mUpdatedSignal; diff --git a/indra/newview/aoset.cpp b/indra/newview/aoset.cpp index 02f4eb6e0a..01b64092ea 100644 --- a/indra/newview/aoset.cpp +++ b/indra/newview/aoset.cpp @@ -102,21 +102,21 @@ AOSet::AOSet(const LLUUID inventoryID) ANIM_AGENT_HOVER_DOWN // needs special treatment }; - for(S32 index=0;index stateNameList; - LLStringUtil::getTokens(stateNames[index],stateNameList,"|"); + LLStringUtil::getTokens(stateNames[index], stateNameList, "|"); - mStates[index].mName=stateNameList[0]; // for quick reference - mStates[index].mAlternateNames=stateNameList; // to get all possible names, including mName - mStates[index].mRemapID=stateUUIDs[index]; - mStates[index].mInventoryUUID=LLUUID::null; - mStates[index].mCurrentAnimation=0; - mStates[index].mCurrentAnimationID=LLUUID::null; - mStates[index].mCycle=FALSE; - mStates[index].mRandom=FALSE; - mStates[index].mCycleTime=0.0f; - mStates[index].mDirty=FALSE; + mStates[index].mName = stateNameList[0]; // for quick reference + mStates[index].mAlternateNames = stateNameList; // to get all possible names, including mName + mStates[index].mRemapID = stateUUIDs[index]; + mStates[index].mInventoryUUID = LLUUID::null; + mStates[index].mCurrentAnimation = 0; + mStates[index].mCurrentAnimationID = LLUUID::null; + mStates[index].mCycle = FALSE; + mStates[index].mRandom = FALSE; + mStates[index].mCycleTime = 0.0f; + mStates[index].mDirty = FALSE; mStateNames.push_back(stateNameList[0]); } stopTimer(); @@ -134,12 +134,12 @@ AOSet::AOState* AOSet::getState(S32 eName) AOSet::AOState* AOSet::getStateByName(const std::string& name) { - for(S32 index=0;indexmAlternateNames.size();names++) + AOState* state = &mStates[index]; + for (U32 names = 0; names < state->mAlternateNames.size(); ++names) { - if(state->mAlternateNames[names].compare(name)==0) + if (state->mAlternateNames[names].compare(name) == 0) { return state; } @@ -150,15 +150,15 @@ AOSet::AOState* AOSet::getStateByName(const std::string& name) AOSet::AOState* AOSet::getStateByRemapID(const LLUUID& id) { - LLUUID remap_id=id; - if(remap_id==ANIM_AGENT_SIT_GROUND) + LLUUID remap_id = id; + if (remap_id == ANIM_AGENT_SIT_GROUND) { - remap_id=ANIM_AGENT_SIT_GROUND_CONSTRAINED; + remap_id = ANIM_AGENT_SIT_GROUND_CONSTRAINED; } - for(S32 index=0;indexmAnimations.size(); - if(numOfAnimations) + S32 numOfAnimations = state->mAnimations.size(); + if (numOfAnimations) { - if(state->mCycle) + if (state->mCycle) { - if(state->mRandom) + if (state->mRandom) { - state->mCurrentAnimation=ll_frand()*numOfAnimations; + state->mCurrentAnimation = ll_frand() * numOfAnimations; LL_DEBUGS("AOEngine") << "randomly chosen " << state->mCurrentAnimation << " of " << numOfAnimations << LL_ENDL; } else { state->mCurrentAnimation++; - if(state->mCurrentAnimation>=state->mAnimations.size()) - state->mCurrentAnimation=0; + if (state->mCurrentAnimation >= state->mAnimations.size()) + { + state->mCurrentAnimation = 0; + } LL_DEBUGS("AOEngine") << "cycle " << state->mCurrentAnimation << " of " << numOfAnimations << LL_ENDL; } } return state->mAnimations[state->mCurrentAnimation].mAssetUUID; } else + { LL_DEBUGS("AOEngine") << "animation state has no animations assigned" << LL_ENDL; + } } return LLUUID::null; } @@ -199,7 +203,7 @@ const LLUUID& AOSet::getAnimationForState(AOState* state) const void AOSet::startTimer(F32 timeout) { mEventTimer.stop(); - mPeriod=timeout; + mPeriod = timeout; mEventTimer.start(); LL_DEBUGS("AOEngine") << "Starting state timer for " << getName() << " at " << timeout << LL_ENDL; } @@ -223,7 +227,7 @@ const LLUUID& AOSet::getInventoryUUID() const void AOSet::setInventoryUUID(const LLUUID& inventoryID) { - mInventoryID=inventoryID; + mInventoryID = inventoryID; } const std::string& AOSet::getName() const @@ -243,7 +247,7 @@ BOOL AOSet::getSitOverride() const void AOSet::setSitOverride(BOOL yes) { - mSitOverride=yes; + mSitOverride = yes; } BOOL AOSet::getSmart() const @@ -253,7 +257,7 @@ BOOL AOSet::getSmart() const void AOSet::setSmart(BOOL yes) { - mSmart=yes; + mSmart = yes; } BOOL AOSet::getMouselookDisable() const @@ -263,7 +267,7 @@ BOOL AOSet::getMouselookDisable() const void AOSet::setMouselookDisable(BOOL yes) { - mMouselookDisable=yes; + mMouselookDisable = yes; } BOOL AOSet::getComplete() const @@ -273,7 +277,7 @@ BOOL AOSet::getComplete() const void AOSet::setComplete(BOOL yes) { - mComplete=yes; + mComplete = yes; } BOOL AOSet::getDirty() const @@ -283,12 +287,12 @@ BOOL AOSet::getDirty() const void AOSet::setDirty(BOOL yes) { - mDirty=yes; + mDirty = yes; } void AOSet::setMotion(const LLUUID& motion) { - mCurrentMotion=motion; + mCurrentMotion = motion; } const LLUUID& AOSet::getMotion() const diff --git a/indra/newview/aoset.h b/indra/newview/aoset.h index 71758ec9a6..4d9b17409d 100644 --- a/indra/newview/aoset.h +++ b/indra/newview/aoset.h @@ -37,8 +37,8 @@ class AOSet // keep number and order in sync with list of names in the constructor enum { - Start=0, // convenience, so we don't have to know the name of the first state - Standing=0, + Start = 0, // convenience, so we don't have to know the name of the first state + Standing = 0, Walking, Running, Sitting, diff --git a/indra/newview/dialogstack.cpp b/indra/newview/dialogstack.cpp index 9eacac3a04..82529bcdc7 100644 --- a/indra/newview/dialogstack.cpp +++ b/indra/newview/dialogstack.cpp @@ -64,11 +64,11 @@ void DialogStack::pop(const LLUUID& uuid) const LLUUID& DialogStack::flip(const LLUUID& uuid) { - for (std::list::iterator it=notificationIDs.begin();it!=notificationIDs.end();++it) + for (std::list::iterator it = notificationIDs.begin(); it != notificationIDs.end(); ++it) { - if(*it==uuid) + if (*it == uuid) { - if(it==notificationIDs.begin()) + if (it == notificationIDs.begin()) { return notificationIDs.back(); } diff --git a/indra/newview/fsfloaterim.cpp b/indra/newview/fsfloaterim.cpp index e68450262a..cebc633bcf 100644 --- a/indra/newview/fsfloaterim.cpp +++ b/indra/newview/fsfloaterim.cpp @@ -21,6 +21,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * http://www.firestormviewer.org * $/LicenseInfo$ */ @@ -30,55 +31,48 @@ #include "fsfloaterim.h" -#include "llnotificationsutil.h" - +#include "fschathistory.h" +#include "fscommon.h" +#include "fsdata.h" +#include "fsfloaterimcontainer.h" // to replace separate IM Floaters with multifloater container +#include "fsfloaternearbychat.h" +#include "fspanelimcontrolpanel.h" #include "llagent.h" #include "llappviewer.h" +#include "llautoreplace.h" +#include "llavataractions.h" #include "llavatarnamecache.h" #include "llbutton.h" #include "llchannelmanager.h" +#include "llchatentry.h" +#include "llcheckboxctrl.h" #include "llchiclet.h" #include "llchicletbar.h" #include "llfloaterabout.h" // for sysinfo button -Zi #include "llfloaterreg.h" -#include "fsfloaterimcontainer.h" // to replace separate IM Floaters with multifloater container +#include "llgroupactions.h" #include "llhttpclient.h" #include "llinventoryfunctions.h" +#include "llinventorymodel.h" #include "lllayoutstack.h" -#include "llchatentry.h" #include "lllogchat.h" -#include "fspanelimcontrolpanel.h" -#include "llscreenchannel.h" -#include "llsyswellwindow.h" -#include "lltrans.h" -#include "fschathistory.h" #include "llnotifications.h" +#include "llnotificationsutil.h" +#include "llnotificationtemplate.h" // Viewer version popup +#include "llrootview.h" +#include "llscreenchannel.h" +#include "llspeakers.h" +#include "llsyswellwindow.h" +#include "lltextbox.h" +#include "lltrans.h" +#include "lltransientfloatermgr.h" +#include "llversioninfo.h" +#include "llviewerchat.h" +#include "llviewerregion.h" #include "llviewerwindow.h" #include "llvoicechannel.h" -#include "lltransientfloatermgr.h" -#include "llinventorymodel.h" -#include "llrootview.h" -#include "llspeakers.h" -#include "llviewerchat.h" -#include "llautoreplace.h" -// [RLVa:KB] - Checked: 2010-04-09 (RLVa-1.2.0e) +#include "rlvactions.h" #include "rlvhandler.h" -#include "rlvactions.h" // CHUI merge -// [/RLVa:KB] - -//AO: For moving callbacks from control panel into this class -#include "llavataractions.h" -#include "llgroupactions.h" -//TL: for support group chat prefix -#include "fsdata.h" -#include "llversioninfo.h" -#include "llcheckboxctrl.h" - -#include "llnotificationtemplate.h" // Viewer version popup -#include "fscommon.h" -#include "fsfloaternearbychat.h" -#include "llviewerregion.h" -#include "lltextbox.h" const F32 ME_TYPING_TIMEOUT = 4.0f; const F32 OTHER_TYPING_TIMEOUT = 9.0f; @@ -100,7 +94,6 @@ FSFloaterIM::FSFloaterIM(const LLUUID& session_id) mOtherTyping(false), mTypingTimer(), mTypingTimeoutTimer(), -// mPositioned(false), // dead code -Zi mSessionInitialized(false), mChatLayoutPanel(NULL), mInputPanels(NULL), diff --git a/indra/newview/fsfloaterim.h b/indra/newview/fsfloaterim.h index d2af698838..4c6ef4597a 100644 --- a/indra/newview/fsfloaterim.h +++ b/indra/newview/fsfloaterim.h @@ -21,6 +21,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * http://www.firestormviewer.org * $/LicenseInfo$ */ @@ -34,17 +35,18 @@ #include "lltooldraganddrop.h" #include "lltransientdockablefloater.h" #include "llvoicechannel.h" -#include "lllayoutstack.h" +class FSChatHistory; +class FSPanelChatControlPanel; class LLAvatarName; class LLButton; // support sysinfo button -Zi class LLChatEntry; +class LLInventoryCategory; +class LLInventoryItem; +class LLLayoutPanel; +class LLLayoutStack; class LLTextBox; class LLTextEditor; -class FSPanelChatControlPanel; -class FSChatHistory; -class LLInventoryItem; -class LLInventoryCategory; typedef boost::signals2::signal floater_showed_signal_t; @@ -105,9 +107,6 @@ public: // ## Zi: overridden to fix the IM focus bug - FIRE-3989 etc. BOOL focusFirstItem(BOOL prefer_text_fields = FALSE, BOOL focus_flash = TRUE ); - // called when docked floater's position has been set by chiclet - // void setPositioned(bool b) { mPositioned = b; }; // dead code -Zi - void onVisibilityChange(BOOL new_visibility); void processIMTyping(const LLIMInfo* im_info, BOOL typing); void processAgentListUpdates(const LLSD& body); @@ -250,5 +249,4 @@ private: boost::signals2::connection mAvatarNameCacheConnection; }; - #endif // FS_FLOATERIM_H diff --git a/indra/newview/fsfloaternearbychat.cpp b/indra/newview/fsfloaternearbychat.cpp index 7bd9f7fa42..d371c7bdd8 100644 --- a/indra/newview/fsfloaternearbychat.cpp +++ b/indra/newview/fsfloaternearbychat.cpp @@ -22,6 +22,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * http://www.firestormviewer.org * $/LicenseInfo$ */ @@ -94,9 +95,8 @@ static LLChatTypeTrigger sChatTypeTriggers[] = { FSFloaterNearbyChat::FSFloaterNearbyChat(const LLSD& key) : LLFloater(key) ,mChatHistory(NULL) - ,mInputEditor(NULL) - // Optional muted chat history ,mChatHistoryMuted(NULL) + ,mInputEditor(NULL) ,mChatLayoutPanel(NULL) ,mInputPanels(NULL) ,mChatLayoutPanelHeight(0) @@ -174,8 +174,6 @@ BOOL FSFloaterNearbyChat::postBuild() onChatTypeChanged(); mChatHistory = getChild("chat_history"); - - // Optional muted chat history mChatHistoryMuted = getChild("chat_history_muted"); mUnreadMessagesNotificationPanel = getChild("unread_messages_holder"); @@ -223,22 +221,14 @@ void FSFloaterNearbyChat::addMessage(const LLChat& chat,bool archive,const LLSD } } - // Optional muted chat history tmp_chat.mFromName = chat.mFromName; LLSD chat_args = args; chat_args["use_plain_text_chat_history"] = use_plain_text_chat_history; chat_args["show_time"] = show_timestamps_nearby_chat; chat_args["is_local"] = true; mChatHistoryMuted->appendMessage(chat, chat_args); - // Optional muted chat history if (!chat.mMuted) { - // Optional muted chat history - //tmp_chat.mFromName = chat.mFromName; - //LLSD chat_args = args; - //chat_args["use_plain_text_chat_history"] = use_plain_text_chat_history; - //chat_args["show_timestamps_nearby_chat"] = show_timestamps_nearby_chat; - // <(FS:Ansariel> Optional muted chat history mChatHistory->appendMessage(chat, chat_args); } @@ -251,10 +241,7 @@ void FSFloaterNearbyChat::addMessage(const LLChat& chat,bool archive,const LLSD } } - // Optional muted chat history - //if (args["do_not_log"].asBoolean()) if (args["do_not_log"].asBoolean() || chat.mMuted) - // Optional muted chat history { return; } @@ -479,7 +466,6 @@ void FSFloaterNearbyChat::onOpen(const LLSD& key ) void FSFloaterNearbyChat::clearChatHistory() { mChatHistory->clear(); - // Optional muted chat history mChatHistoryMuted->clear(); } diff --git a/indra/newview/fsfloaternearbychat.h b/indra/newview/fsfloaternearbychat.h index 5b3a64f794..37d27810eb 100644 --- a/indra/newview/fsfloaternearbychat.h +++ b/indra/newview/fsfloaternearbychat.h @@ -22,6 +22,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * http://www.firestormviewer.org * $/LicenseInfo$ */ @@ -30,16 +31,17 @@ #ifndef FS_FLOATERNEARBYCHAT_H #define FS_FLOATERNEARBYCHAT_H -#include "lldockablefloater.h" -#include "llscrollbar.h" +#include "llfloater.h" #include "llviewerchat.h" -class LLResizeBar; -class LLComboBox; class FSChatHistory; +class LLChatEntry; +class LLComboBox; +class LLLayoutStack; +class LLLayoutPanel; +class LLResizeBar; class LLTextBox; -#include "llchatentry.h" -#include "lllayoutstack.h" + class FSFloaterNearbyChat: public LLFloater { @@ -50,7 +52,7 @@ public: BOOL postBuild (); /** @param archive true - to save a message to the chat history log */ - void addMessage (const LLChat& message,bool archive = true, const LLSD &args = LLSD()); + void addMessage (const LLChat& message,bool archive = true, const LLSD &args = LLSD()); void onNearbyChatContextMenuItemClicked(const LLSD& userdata); bool onNearbyChatCheckContextMenuItem(const LLSD& userdata); @@ -116,12 +118,11 @@ protected: static S32 sLastSpecialChatChannel; private: - void onNearbySpeakers (); + void onNearbySpeakers(); private: LLHandle mPopupMenuHandle; FSChatHistory* mChatHistory; - // Optional muted chat history FSChatHistory* mChatHistoryMuted; LLChatEntry* mInputEditor; diff --git a/indra/newview/fspanelprofile.cpp b/indra/newview/fspanelprofile.cpp index 2826870487..9d6a48b288 100644 --- a/indra/newview/fspanelprofile.cpp +++ b/indra/newview/fspanelprofile.cpp @@ -113,16 +113,16 @@ FSPanelProfileTab::~FSPanelProfileTab() void FSPanelProfileTab::setAvatarId(const LLUUID& id) { - if(id.notNull()) + if (id.notNull()) { - if(getAvatarId().notNull()) + if (getAvatarId().notNull()) { - LLAvatarPropertiesProcessor::getInstance()->removeObserver(mAvatarId,this); + LLAvatarPropertiesProcessor::getInstance()->removeObserver(mAvatarId, this); } mAvatarId = id; - LLAvatarPropertiesProcessor::getInstance()->addObserver(getAvatarId(),this); + LLAvatarPropertiesProcessor::getInstance()->addObserver(getAvatarId(), this); - mSelfProfile = (getAvatarId() == gAgent.getID()); + mSelfProfile = (getAvatarId() == gAgentID); } } @@ -254,12 +254,12 @@ BOOL FSPanelProfileSecondLife::postBuild() LLButton* copy_uri_button=findChild("copy_uri_button"); LLButton* copy_name_button=findChild("copy_name_button"); - if(copy_uri_button) + if (copy_uri_button) { copy_uri_button->setCommitCallback(boost::bind(&FSPanelProfileSecondLife::onCopyURI, this)); } - if(copy_name_button) + if (copy_name_button) { copy_name_button->setCommitCallback(boost::bind(&FSPanelProfileSecondLife::onCopyToClipboard, this)); } @@ -349,7 +349,7 @@ void FSPanelProfileSecondLife::updateData() void FSPanelProfileSecondLife::processProperties(void* data, EAvatarProcessorType type) { - if(APT_PROPERTIES == type) + if (APT_PROPERTIES == type) { const LLAvatarData* avatar_data = static_cast(data); if(avatar_data && getAvatarId() == avatar_data->avatar_id) @@ -358,7 +358,7 @@ void FSPanelProfileSecondLife::processProperties(void* data, EAvatarProcessorTyp enableControls(); } } - else if(APT_GROUPS == type) + else if (APT_GROUPS == type) { LLAvatarGroups* avatar_groups = static_cast(data); if(avatar_groups && getAvatarId() == avatar_groups->avatar_id) @@ -408,7 +408,9 @@ void FSPanelProfileSecondLife::processGroupProperties(const LLAvatarGroups* avat { //KC: the group_list ctrl can handle all this for us on our own profile if (getSelfProfile() && !getEmbedded()) + { return; + } // *NOTE dzaporozhan // Group properties may arrive in two callbacks, we need to save them across @@ -417,7 +419,7 @@ void FSPanelProfileSecondLife::processGroupProperties(const LLAvatarGroups* avat LLAvatarGroups::group_list_t::const_iterator it = avatar_groups->group_list.begin(); const LLAvatarGroups::group_list_t::const_iterator it_end = avatar_groups->group_list.end(); - for(; it_end != it; ++it) + for (; it_end != it; ++it) { LLAvatarGroups::LLGroupData group_data = *it; mGroups[group_data.group_name] = group_data.group_id; @@ -450,7 +452,7 @@ void FSPanelProfileSecondLife::fillCommonData(const LLAvatarData* avatar_data) } args["[AGE]"] = LLDateUtil::ageFromDate( avatar_data->born_on, LLDate::now()); - args["[AGEDAYS]"] = LLSD((S32) (LLDate::now().secondsSinceEpoch()-avatar_data->born_on.secondsSinceEpoch())/86400).asString(); + args["[AGEDAYS]"] = LLSD((S32) (LLDate::now().secondsSinceEpoch() - avatar_data->born_on.secondsSinceEpoch()) / 86400).asString(); std::string register_date = getString("RegisterDateFormat", args); getChild("register_date")->setValue(register_date ); mDescriptionEdit->setValue(avatar_data->about_text); @@ -654,9 +656,9 @@ void FSPanelProfileSecondLife::onChange(EStatusType status, const std::string &c void FSPanelProfileSecondLife::setAvatarId(const LLUUID& id) { - if(id.notNull()) + if (id.notNull()) { - if(getAvatarId().notNull()) + if (getAvatarId().notNull()) { LLAvatarTracker::instance().removeParticularFriendObserver(getAvatarId(), this); } @@ -758,9 +760,7 @@ void FSPanelProfileSecondLife::updateButtons() void FSPanelProfileSecondLife::onClickSetName() { - LLAvatarNameCache::get(getAvatarId(), - boost::bind(&FSPanelProfileSecondLife::onAvatarNameCacheSetName, - this, _1, _2)); + LLAvatarNameCache::get(getAvatarId(), boost::bind(&FSPanelProfileSecondLife::onAvatarNameCacheSetName, this, _1, _2)); LLFirstUse::setDisplayName(false); } @@ -844,10 +844,10 @@ BOOL FSPanelProfileWeb::postBuild() void FSPanelProfileWeb::processProperties(void* data, EAvatarProcessorType type) { - if(APT_PROPERTIES == type) + if (APT_PROPERTIES == type) { const LLAvatarData* avatar_data = static_cast(data); - if(avatar_data && getAvatarId() == avatar_data->avatar_id) + if (avatar_data && getAvatarId() == avatar_data->avatar_id) { mURLHome = avatar_data->profile_url; mUrlEdit->setValue(mURLHome); @@ -880,7 +880,7 @@ void FSPanelProfileWeb::updateData() { mWebBrowser->setVisible(TRUE); mPerformanceTimer.start(); - mWebBrowser->navigateTo( mURLWebProfile, "text/html" ); + mWebBrowser->navigateTo(mURLWebProfile, "text/html"); } } } @@ -918,7 +918,9 @@ void FSPanelProfileWeb::onAvatarNameCache(const LLUUID& agent_id, const LLAvatar mWebProfileButton->setEnabled(TRUE); if (getIsLoading()) //if the tab was opened before name was resolved, load the panel now + { updateData(); + } } void FSPanelProfileWeb::onCommitLoad(LLUICtrl* ctrl) @@ -1049,13 +1051,13 @@ BOOL FSPanelProfileInterests::postBuild() mSkillsEditor = getChild("skills_edit"); mLanguagesEditor = getChild("languages_edit"); - for (S32 i=0; i < WANT_CHECKS; ++i) + for (S32 i = 0; i < WANT_CHECKS; ++i) { std::string check_name = llformat("chk%d", i); mWantChecks[i] = getChild(check_name); } - for (S32 i=0; i < SKILL_CHECKS; ++i) + for (S32 i = 0; i < SKILL_CHECKS; ++i) { std::string check_name = llformat("schk%d", i); mSkillChecks[i] = getChild(check_name); @@ -1063,9 +1065,9 @@ BOOL FSPanelProfileInterests::postBuild() //FS:KC - Due to a bug with LLLineEditor, it cannot be disabled from XUI // It won't properly enable from code if it is. - mWantToEditor->setEnabled( FALSE ); - mSkillsEditor->setEnabled( FALSE ); - mLanguagesEditor->setEnabled( FALSE ); + mWantToEditor->setEnabled(FALSE); + mSkillsEditor->setEnabled(FALSE); + mLanguagesEditor->setEnabled(FALSE); return TRUE; } @@ -1073,12 +1075,12 @@ BOOL FSPanelProfileInterests::postBuild() void FSPanelProfileInterests::processProperties(void* data, EAvatarProcessorType type) { - if(APT_INTERESTS_INFO == type) + if (APT_INTERESTS_INFO == type) { const FSInterestsData* interests_data = static_cast(data); if (interests_data && getAvatarId() == interests_data->avatar_id) { - for (S32 i=0; i < WANT_CHECKS; i++) + for (S32 i = 0; i < WANT_CHECKS; ++i) { if (interests_data->want_to_mask & (1<skills_mask & (1<setValue(LLStringUtil::null); mLanguagesEditor->setValue(LLStringUtil::null); - for (S32 i=0; i < WANT_CHECKS; i++) + for (S32 i = 0; i < WANT_CHECKS; ++i) { mWantChecks[i]->setValue(FALSE); } - for (S32 i=0; i < SKILL_CHECKS; i++) + for (S32 i = 0; i < SKILL_CHECKS; ++i) { mSkillChecks[i]->setValue(FALSE); } @@ -1135,7 +1137,7 @@ void FSPanelProfileInterests::apply() FSInterestsData interests_data = FSInterestsData(); interests_data.want_to_mask = 0; - for (S32 i=0; i < WANT_CHECKS; i++) + for (S32 i = 0; i < WANT_CHECKS; ++i) { if (mWantChecks[i]->getValue().asBoolean()) { @@ -1219,14 +1221,14 @@ FSPanelPick::~FSPanelPick() void FSPanelPick::setAvatarId(const LLUUID& avatar_id) { - if(avatar_id.isNull()) + if (avatar_id.isNull()) { return; } FSPanelProfileTab::setAvatarId(avatar_id); // creating new Pick - if(getPickId().isNull()) + if (getPickId().isNull()) { mNewPick = true; @@ -1236,7 +1238,7 @@ void FSPanelPick::setAvatarId(const LLUUID& avatar_id) std::string pick_name, pick_desc, region_name; LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); - if(parcel) + if (parcel) { parcel_id = parcel->getID(); pick_name = parcel->getName(); @@ -1245,7 +1247,7 @@ void FSPanelPick::setAvatarId(const LLUUID& avatar_id) } LLViewerRegion* region = gAgent.getRegion(); - if(region) + if (region) { region_name = region->getName(); } @@ -1318,12 +1320,12 @@ void FSPanelPick::onDescriptionFocusReceived() void FSPanelPick::processProperties(void* data, EAvatarProcessorType type) { - if(APT_PICK_INFO != type) + if (APT_PICK_INFO != type) { return; } LLPickData* pick_info = static_cast(data); - if(!pick_info + if (!pick_info || pick_info->creator_id != getAvatarId() || pick_info->pick_id != getPickId()) { @@ -1423,7 +1425,7 @@ void FSPanelPick::resetDirty() BOOL FSPanelPick::isDirty() const { - if( mNewPick + if (mNewPick || LLPanel::isDirty() || mLocationChanged || mSnapshotCtrl->isDirty() @@ -1450,7 +1452,7 @@ void FSPanelPick::onClickSetLocation() } LLViewerRegion* region = gAgent.getRegion(); - if(region) + if (region) { region_name = region->getName(); } @@ -1680,10 +1682,10 @@ bool FSPanelProfilePicks::callbackDeletePick(const LLSD& notification, const LLS void FSPanelProfilePicks::processProperties(void* data, EAvatarProcessorType type) { - if(APT_PICKS == type) + if (APT_PICKS == type) { LLAvatarPicks* avatar_picks = static_cast(data); - if(avatar_picks && getAvatarId() == avatar_picks->target_id) + if (avatar_picks && getAvatarId() == avatar_picks->target_id) { LLUUID selected_id = LLUUID::null; @@ -1699,7 +1701,7 @@ void FSPanelProfilePicks::processProperties(void* data, EAvatarProcessorType typ mTabContainer->deleteAllTabs(); LLAvatarPicks::picks_list_t::const_iterator it = avatar_picks->picks_list.begin(); - for(; avatar_picks->picks_list.end() != it; ++it) + for (; avatar_picks->picks_list.end() != it; ++it) { LLUUID pick_id = it->first; std::string pick_name = it->second; @@ -1814,10 +1816,10 @@ void FSPanelProfileFirstLife::onOpen(const LLSD& key) void FSPanelProfileFirstLife::processProperties(void* data, EAvatarProcessorType type) { - if(APT_PROPERTIES == type) + if (APT_PROPERTIES == type) { const LLAvatarData* avatar_data = static_cast(data); - if(avatar_data && getAvatarId() == avatar_data->avatar_id) + if (avatar_data && getAvatarId() == avatar_data->avatar_id) { mDescriptionEdit->setValue(avatar_data->fl_about_text); mPicture->setValue(avatar_data->fl_image_id); @@ -1978,12 +1980,18 @@ void FSPanelAvatarNotes::onCommitRights() S32 rights = 0; - if(mOnlineStatus->getValue().asBoolean()) + if (mOnlineStatus->getValue().asBoolean()) + { rights |= LLRelationship::GRANT_ONLINE_STATUS; - if(mMapRights->getValue().asBoolean()) + } + if (mMapRights->getValue().asBoolean()) + { rights |= LLRelationship::GRANT_MAP_LOCATION; - if(mEditObjectRights->getValue().asBoolean()) + } + if (mEditObjectRights->getValue().asBoolean()) + { rights |= LLRelationship::GRANT_MODIFY_OBJECTS; + } bool allow_modify_objects = mEditObjectRights->getValue().asBoolean(); @@ -2003,10 +2011,10 @@ void FSPanelAvatarNotes::onCommitRights() void FSPanelAvatarNotes::processProperties(void* data, EAvatarProcessorType type) { - if(APT_NOTES == type) + if (APT_NOTES == type) { LLAvatarNotes* avatar_notes = static_cast(data); - if(avatar_notes && getAvatarId() == avatar_notes->target_id) + if (avatar_notes && getAvatarId() == avatar_notes->target_id) { mNotesEditor->setValue(avatar_notes->notes); mNotesEditor->setEnabled(TRUE); @@ -2035,7 +2043,7 @@ void FSPanelAvatarNotes::enableCheckboxes(bool enable) FSPanelAvatarNotes::~FSPanelAvatarNotes() { - if(getAvatarId().notNull()) + if (getAvatarId().notNull()) { LLAvatarTracker::instance().removeParticularFriendObserver(getAvatarId(), this); } @@ -2050,9 +2058,9 @@ void FSPanelAvatarNotes::changed(U32 mask) void FSPanelAvatarNotes::setAvatarId(const LLUUID& id) { - if(id.notNull()) + if (id.notNull()) { - if(getAvatarId().notNull()) + if (getAvatarId().notNull()) { LLAvatarTracker::instance().removeParticularFriendObserver(getAvatarId(), this); } @@ -2083,7 +2091,9 @@ void FSPanelProfile::processProperties(void* data, EAvatarProcessorType type) { mTabContainer = getChild("panel_profile_tabs"); if (mTabContainer) + { mTabContainer->setCommitCallback(boost::bind(&FSPanelProfile::onTabChange, this)); + } // Load data on currently opened tab as well onTabChange(); @@ -2180,7 +2190,7 @@ void FSPanelProfile::apply() //KC - Avatar data is spread over 3 different panels // collect data from the last 2 and give to the first to save LLAvatarData data = LLAvatarData(); - data.avatar_id = gAgent.getID(); + data.avatar_id = gAgentID; mPanelFirstlife->apply(&data); mPanelWeb->apply(&data); mPanelSecondlife->apply(&data); diff --git a/indra/newview/fspanelprofileclassifieds.cpp b/indra/newview/fspanelprofileclassifieds.cpp index 156a25a291..5b37b29149 100644 --- a/indra/newview/fspanelprofileclassifieds.cpp +++ b/indra/newview/fspanelprofileclassifieds.cpp @@ -81,7 +81,7 @@ FSPanelClassifieds::FSPanelClassifieds() FSPanelClassifieds::~FSPanelClassifieds() { - if(getAvatarId().notNull()) + if (getAvatarId().notNull()) { LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(),this); } @@ -100,7 +100,7 @@ void* FSPanelClassifieds::create(void* data /* = NULL */) void FSPanelClassifieds::updateData() { // Send Picks request only when we need to, not on every onOpen(during tab switch). - if(isDirty()) + if (isDirty()) { mNoClassifieds = false; @@ -114,16 +114,16 @@ void FSPanelClassifieds::updateData() void FSPanelClassifieds::processProperties(void* data, EAvatarProcessorType type) { - if(APT_CLASSIFIEDS == type) + if (APT_CLASSIFIEDS == type) { LLAvatarClassifieds* c_info = static_cast(data); - if(c_info && getAvatarId() == c_info->target_id) + if (c_info && getAvatarId() == c_info->target_id) { // do not clear classified list in case we will receive two or more data packets. // list has been cleared in updateData(). (fix for EXT-6436) LLAvatarClassifieds::classifieds_list_t::const_iterator it = c_info->classifieds_list.begin(); - for(; c_info->classifieds_list.end() != it; ++it) + for (; c_info->classifieds_list.end() != it; ++it) { LLAvatarClassifieds::classified_data c_data = *it; @@ -155,7 +155,7 @@ void FSPanelClassifieds::processProperties(void* data, EAvatarProcessorType type mNoItemsLabel->setVisible(no_data); if (no_data) { - if(getAvatarId() == gAgentID) + if (getAvatarId() == gAgentID) { mNoItemsLabel->setValue(LLTrans::getString("NoClassifiedsText")); } @@ -213,10 +213,10 @@ BOOL FSPanelClassifieds::postBuild() bool FSPanelClassifieds::isClassifiedPublished(FSClassifiedItem* c_item) { - if(c_item) + if (c_item) { FSPanelClassifiedEdit* panel = mEditClassifiedPanels[c_item->getClassifiedId()]; - if(panel) + if (panel) { return !panel->isNewWithErrors(); } @@ -230,21 +230,21 @@ bool FSPanelClassifieds::isClassifiedPublished(FSClassifiedItem* c_item) void FSPanelClassifieds::onOpen(const LLSD& key) { const LLUUID id(key.asUUID()); - BOOL self = (gAgent.getID() == id); + BOOL self = (gAgentID == id); // only agent can edit her picks getChildView("edit_panel")->setEnabled(self); getChildView("edit_panel")->setVisible( self); // Disable buttons when viewing profile for first time - if(getAvatarId() != id) + if (getAvatarId() != id) { getChildView(XML_BTN_INFO)->setEnabled(FALSE); getChildView(XML_BTN_TELEPORT)->setEnabled(FALSE); getChildView(XML_BTN_SHOW_ON_MAP)->setEnabled(FALSE); } - if(getAvatarId() != id) + if (getAvatarId() != id) { mClassifiedsList->goToTop(); // Set dummy value to make panel dirty and make it reload picks @@ -267,7 +267,6 @@ void FSPanelClassifieds::onClosePanel() void FSPanelClassifieds::onListCommit(const LLFlatListView* f_list) { - updateButtons(); } @@ -275,7 +274,7 @@ void FSPanelClassifieds::onListCommit(const LLFlatListView* f_list) void FSPanelClassifieds::onClickDelete() { LLSD value = mClassifiedsList->getSelectedValue(); - if(value.isDefined()) + if (value.isDefined()) { LLSD args; args["NAME"] = value[CLASSIFIED_NAME]; @@ -315,7 +314,7 @@ void FSPanelClassifieds::onClickTeleport() FSClassifiedItem* c_item = getSelectedClassifiedItem(); LLVector3d pos; - if(c_item) + if (c_item) { pos = c_item->getPosGlobal(); FSPanelClassifiedInfo::sendClickMessage("teleport", false, @@ -335,7 +334,7 @@ void FSPanelClassifieds::onClickMap() FSClassifiedItem* c_item = getSelectedClassifiedItem(); LLVector3d pos; - if(c_item) + if (c_item) { FSPanelClassifiedInfo::sendClickMessage("map", false, c_item->getClassifiedId(), LLUUID::null, pos, LLStringUtil::null); @@ -384,7 +383,7 @@ void FSPanelClassifieds::updateButtons() getChildView(XML_BTN_SHOW_ON_MAP)->setEnabled(has_selected); FSClassifiedItem* c_item = dynamic_cast(mClassifiedsList->getSelectedItem()); - if(c_item) + if (c_item) { getChildView(XML_BTN_INFO)->setEnabled(isClassifiedPublished(c_item)); } @@ -401,7 +400,7 @@ void FSPanelClassifieds::createNewClassified() void FSPanelClassifieds::onClickInfo() { - if(mClassifiedsList->numSelected() > 0) + if (mClassifiedsList->numSelected() > 0) { openClassifiedInfo(); } @@ -410,7 +409,10 @@ void FSPanelClassifieds::onClickInfo() void FSPanelClassifieds::openClassifiedInfo() { LLSD selected_value = mClassifiedsList->getSelectedValue(); - if (selected_value.isUndefined()) return; + if (selected_value.isUndefined()) + { + return; + } FSClassifiedItem* c_item = getSelectedClassifiedItem(); LLSD params; @@ -444,12 +446,12 @@ void FSPanelClassifieds::onPanelPickClose(LLPanel* panel) void FSPanelClassifieds::onPanelClassifiedSave(FSPanelClassifiedEdit* panel) { - if(!panel->canClose()) + if (!panel->canClose()) { return; } - if(panel->isNew()) + if (panel->isNew()) { mEditClassifiedPanels[panel->getClassifiedId()] = panel; @@ -466,7 +468,7 @@ void FSPanelClassifieds::onPanelClassifiedSave(FSPanelClassifiedEdit* panel) c_item->setMouseUpCallback(boost::bind(&FSPanelClassifieds::updateButtons, this)); c_item->childSetAction("info_chevron", boost::bind(&FSPanelClassifieds::onClickInfo, this)); } - else if(panel->isNewWithErrors()) + else if (panel->isNewWithErrors()) { FSClassifiedItem* c_item = dynamic_cast(mClassifiedsList->getSelectedItem()); llassert(c_item); @@ -487,17 +489,16 @@ void FSPanelClassifieds::onPanelClassifiedSave(FSPanelClassifiedEdit* panel) void FSPanelClassifieds::onPanelClassifiedClose(FSPanelClassifiedInfo* panel) { - if(panel->getInfoLoaded() && !panel->isDirty()) + if (panel->getInfoLoaded() && !panel->isDirty()) { std::vector values; mClassifiedsList->getValues(values); - for(size_t n = 0; n < values.size(); ++n) + for (size_t n = 0; n < values.size(); ++n) { LLUUID c_id = values[n][CLASSIFIED_ID].asUUID(); - if(panel->getClassifiedId() == c_id) + if (panel->getClassifiedId() == c_id) { - FSClassifiedItem* c_item = dynamic_cast( - mClassifiedsList->getItemByValue(values[n])); + FSClassifiedItem* c_item = dynamic_cast(mClassifiedsList->getItemByValue(values[n])); llassert(c_item); if (c_item) { @@ -523,7 +524,7 @@ void FSPanelClassifieds::createClassifiedInfoPanel() void FSPanelClassifieds::createClassifiedEditPanel(FSPanelClassifiedEdit** panel) { - if(panel) + if (panel) { FSPanelClassifiedEdit* new_panel = FSPanelClassifiedEdit::create(); new_panel->setExitCallback(boost::bind(&FSPanelClassifieds::onPanelClassifiedClose, this, new_panel)); @@ -557,7 +558,7 @@ FSClassifiedItem *FSPanelClassifieds::findClassifiedById(const LLUUID& classifie std::vector items; mClassifiedsList->getItems(items); FSClassifiedItem* c_item = NULL; - for(std::vector::iterator it = items.begin(); it != items.end(); ++it) + for (std::vector::iterator it = items.begin(); it != items.end(); ++it) { FSClassifiedItem *test_item = dynamic_cast(*it); if (test_item && test_item->getClassifiedId() == classified_id) @@ -591,7 +592,7 @@ void FSPanelClassifieds::editClassified(const LLUUID& classified_id) params["location_text"] = c_item->getLocationText(); FSPanelClassifiedEdit* panel = mEditClassifiedPanels[c_item->getClassifiedId()]; - if(!panel) + if (!panel) { createClassifiedEditPanel(&panel); mEditClassifiedPanels[c_item->getClassifiedId()] = panel; @@ -602,7 +603,7 @@ void FSPanelClassifieds::editClassified(const LLUUID& classified_id) void FSPanelClassifieds::onClickMenuEdit() { - if(getSelectedClassifiedItem()) + if (getSelectedClassifiedItem()) { onPanelClassifiedEdit(); } @@ -613,7 +614,7 @@ bool FSPanelClassifieds::onEnableMenuItem(const LLSD& user_data) std::string param = user_data.asString(); FSClassifiedItem* c_item = dynamic_cast(mClassifiedsList->getSelectedItem()); - if(c_item && "info" == param) + if (c_item && "info" == param) { // dont show Info panel if classified was not created return isClassifiedPublished(c_item); @@ -698,13 +699,13 @@ FSClassifiedItem::~FSClassifiedItem() void FSClassifiedItem::processProperties(void* data, EAvatarProcessorType type) { - if(APT_CLASSIFIED_INFO != type) + if (APT_CLASSIFIED_INFO != type) { return; } LLAvatarClassifiedInfo* c_info = static_cast(data); - if( !c_info || c_info->classified_id != getClassifiedId() ) + if (!c_info || c_info->classified_id != getClassifiedId()) { return; } @@ -731,14 +732,20 @@ BOOL FSClassifiedItem::postBuild() void FSClassifiedItem::setValue(const LLSD& value) { - if (!value.isMap()) return;; - if (!value.has("selected")) return; + if (!value.isMap()) + { + return; + } + if (!value.has("selected")) + { + return; + } getChildView("selected_icon")->setVisible( value["selected"]); } void FSClassifiedItem::fillIn(FSPanelClassifiedEdit* panel) { - if(!panel) + if (!panel) { return; } diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 258f34f913..5092692d0b 100755 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -441,7 +441,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("secondary_inventory", "floater_my_inventory.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("script_recover", "floater_script_recover.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("sound_explorer", "floater_NACL_explore_sounds.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add( "vram_usage", "floater_fs_vram_usage.xml", static_cast( &LLFloaterReg::build< FSFloaterVRAMUsage >) ); + LLFloaterReg::add("vram_usage", "floater_fs_vram_usage.xml", static_cast( &LLFloaterReg::build< FSFloaterVRAMUsage >) ); LLFloaterReg::add("ws_asset_blacklist", "floater_asset_blacklist.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::registerControlVariables(); // Make sure visibility and rect controls get preserved when saving