Added displaying the currently playing AO animation in bold in the AO list. FIRE-2302

ziree 2014-05-07 00:54:20 +02:00
parent 50eb0e7a1f
commit 24e212359f
4 changed files with 74 additions and 5 deletions

View File

@ -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<LLScrollListItem*> item_list=mAnimationList->getAllData();
std::vector<LLScrollListItem*>::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)

View File

@ -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;

View File

@ -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;index<AOSet::AOSTATES_MAX;index++)
@ -356,6 +359,8 @@ const LLUUID AOEngine::override(const LLUUID& pMotion,BOOL start)
return animation;
}
mAnimationChangedSignal(LLUUID::null);
mCurrentSet->stopTimer();
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);

View File

@ -153,7 +153,16 @@ class AOEngine
void saveSettings();
typedef boost::signals2::signal<void ()> 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<void (const LLUUID&)> 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;