From 24e212359f1edc496b2673bdba45f8d4fa9f7eea Mon Sep 17 00:00:00 2001 From: ziree Date: Wed, 7 May 2014 00:54:20 +0200 Subject: [PATCH] Added displaying the currently playing AO animation in bold in the AO list. FIRE-2302 --- indra/newview/ao.cpp | 43 ++++++++++++++++++++++++++++++++++++++ indra/newview/ao.h | 3 +++ indra/newview/aoengine.cpp | 21 +++++++++++++++---- indra/newview/aoengine.h | 12 ++++++++++- 4 files changed, 74 insertions(+), 5 deletions(-) diff --git a/indra/newview/ao.cpp b/indra/newview/ao.cpp index 89a8085d8f..30e0940366 100644 --- a/indra/newview/ao.cpp +++ b/indra/newview/ao.cpp @@ -46,6 +46,7 @@ FloaterAO::FloaterAO(const LLSD& key) mSelectedState(0), mCanDragAndDrop(FALSE), mImportRunning(FALSE), + mCurrentBoldItem(NULL), mMore(TRUE) { mEventTimer.stop(); @@ -134,6 +135,7 @@ void FloaterAO::updateList() mSetSelectorSmall->clear(); mAnimationList->deleteAllItems(); + mCurrentBoldItem=NULL; reloading(FALSE); if(mSetList.empty()) @@ -235,6 +237,7 @@ BOOL FloaterAO::postBuild() updateSmart(); AOEngine::instance().setReloadCallback(boost::bind(&FloaterAO::updateList,this)); + AOEngine::instance().setAnimationChangedCallback(boost::bind(&FloaterAO::onAnimationChanged,this,_1)); onChangeAnimationSelection(); mMainInterfacePanel->setVisible(TRUE); @@ -386,6 +389,7 @@ LLScrollListItem* FloaterAO::addAnimation(const std::string& name) void FloaterAO::onSelectState() { mAnimationList->deleteAllItems(); + mCurrentBoldItem=NULL; mAnimationList->setCommentText(getString("ao_no_animations_loaded")); mAnimationList->setEnabled(FALSE); @@ -490,6 +494,7 @@ BOOL FloaterAO::removeSetCallback(const LLSD& notification,const LLSD& response) mSetSelector->clear(); mSetSelectorSmall->clear(); mAnimationList->deleteAllItems(); + mCurrentBoldItem=NULL; return TRUE; } } @@ -608,6 +613,7 @@ void FloaterAO::onClickTrash() AOEngine::instance().removeAnimation(mSelectedSet,mSelectedState,mAnimationList->getItemIndex(list[index])); mAnimationList->deleteSelectedItems(); + mCurrentBoldItem=NULL; } void FloaterAO::updateCycleParameters() @@ -694,6 +700,43 @@ void FloaterAO::onClickLess() 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) + { + LLScrollListText* column=(LLScrollListText*) mCurrentBoldItem->getColumn(1); + column->setFontStyle(LLFontGL::NORMAL); + + mCurrentBoldItem=NULL; + } + + if(animation.isNull()) + { + return; + } + + // why do we have no LLScrollListCtrl::getItemByUserdata() ? -Zi + std::vector item_list=mAnimationList->getAllData(); + std::vector::const_iterator iter; + for(iter=item_list.begin();iter!=item_list.end();iter++) + { + LLScrollListItem* item=*iter; + LLUUID* id=(LLUUID*) item->getUserdata(); + + if(id==&animation) + { + mCurrentBoldItem=item; + + LLScrollListText* column=(LLScrollListText*) mCurrentBoldItem->getColumn(1); + column->setFontStyle(LLFontGL::BOLD); + + return; + } + } +} + // virtual BOOL FloaterAO::handleDragAndDrop(S32 x,S32 y,MASK mask,BOOL drop,EDragAndDropType type,void* data, EAcceptance* accept,std::string& tooltipMsg) diff --git a/indra/newview/ao.h b/indra/newview/ao.h index d6aee33d37..fe0aac73a6 100644 --- a/indra/newview/ao.h +++ b/indra/newview/ao.h @@ -90,6 +90,8 @@ class FloaterAO void onClickMore(); void onClickLess(); + void onAnimationChanged(const LLUUID& animation); + void reloading(BOOL yes); void updateSmart(); @@ -124,6 +126,7 @@ class FloaterAO LLComboBox* mStateSelector; LLScrollListCtrl* mAnimationList; + LLScrollListItem* mCurrentBoldItem; LLButton* mMoveUpButton; LLButton* mMoveDownButton; LLButton* mTrashButton; diff --git a/indra/newview/aoengine.cpp b/indra/newview/aoengine.cpp index a0061b7e88..39f1120084 100644 --- a/indra/newview/aoengine.cpp +++ b/indra/newview/aoengine.cpp @@ -249,10 +249,13 @@ void AOEngine::enable(BOOL yes) LL_WARNS("AOEngine") << "Unhandled last motion id " << mLastMotion << LL_ENDL; gAgent.sendAnimationRequest(animation,ANIM_REQUEST_START); + mAnimationChangedSignal(state->mAnimations[state->mCurrentAnimation].mInventoryUUID); } } else { + mAnimationChangedSignal(LLUUID::null); + gAgent.sendAnimationRequest(ANIM_AGENT_SIT_GENERIC,ANIM_REQUEST_STOP); // stop all overriders, catch leftovers for(S32 index=0;indexstopTimer(); if(start) { @@ -413,6 +418,11 @@ const LLUUID AOEngine::override(const LLUUID& pMotion,BOOL start) << " of set " << mCurrentSet->getName() << " (" << mCurrentSet << ")" << LL_ENDL; + if(animation.notNull()) + { + mAnimationChangedSignal(state->mAnimations[state->mCurrentAnimation].mInventoryUUID); + } + setStateCycleTimer(state); if(motion==ANIM_AGENT_SIT) @@ -591,16 +601,19 @@ void AOEngine::cycle(eCycleMode cycleMode) if(animation==oldAnimation) return; + mAnimationChangedSignal(LLUUID::null); + state->mCurrentAnimationID=animation; - if(!animation.isNull()) + if(animation.notNull()) { LL_DEBUGS("AOEngine") << "requesting animation start for motion " << gAnimLibrary.animationName(motion) << ": " << animation << LL_ENDL; 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.isNull()) + if(oldAnimation.notNull()) { LL_DEBUGS("AOEngine") << "Cycling state " << state->mName << " - stopping animation " << oldAnimation << LL_ENDL; gAgent.sendAnimationRequest(oldAnimation,ANIM_REQUEST_STOP); @@ -1323,7 +1336,7 @@ void AOEngine::inMouselook(BOOL yes) return; LLUUID animation=state->mCurrentAnimationID; - if(!animation.isNull()) + if(animation.notNull()) { gAgent.sendAnimationRequest(animation,ANIM_REQUEST_STOP); gAgentAvatarp->LLCharacter::stopMotion(animation); @@ -1369,7 +1382,7 @@ void AOEngine::setOverrideSits(AOSet* set,BOOL yes) return; LLUUID animation=state->mCurrentAnimationID; - if(!animation.isNull()) + if(animation.notNull()) { gAgent.sendAnimationRequest(animation,ANIM_REQUEST_STOP); gAgentAvatarp->LLCharacter::stopMotion(animation); diff --git a/indra/newview/aoengine.h b/indra/newview/aoengine.h index 58fb806ff4..05b653a0d6 100644 --- a/indra/newview/aoengine.h +++ b/indra/newview/aoengine.h @@ -153,7 +153,16 @@ class AOEngine void saveSettings(); typedef boost::signals2::signal updated_signal_t; - boost::signals2::connection setReloadCallback(const updated_signal_t::slot_type& cb) { return mUpdatedSignal.connect(cb); }; + boost::signals2::connection setReloadCallback(const updated_signal_t::slot_type& cb) + { + return mUpdatedSignal.connect(cb); + }; + + typedef boost::signals2::signal animation_changed_signal_t; + boost::signals2::connection setAnimationChangedCallback(const animation_changed_signal_t::slot_type& cb) + { + return mAnimationChangedSignal.connect(cb); + }; protected: void init(); @@ -184,6 +193,7 @@ class AOEngine void parseNotecard(const char* buffer); updated_signal_t mUpdatedSignal; + animation_changed_signal_t mAnimationChangedSignal; AOTimerCollection mTimerCollection; AOSitCancelTimer mSitCancelTimer;