Added option to turn animation cycling off altogether, so only manual cycling changes the animation for a state.
parent
378447194b
commit
91c0ad6d08
|
|
@ -146,6 +146,7 @@ BOOL FloaterAO::postBuild()
|
|||
mMoveUpButton=aoPanel->getChild<LLButton>("ao_move_up");
|
||||
mMoveDownButton=aoPanel->getChild<LLButton>("ao_move_down");
|
||||
mTrashButton=aoPanel->getChild<LLButton>("ao_trash");
|
||||
mCycleCheckBox=aoPanel->getChild<LLCheckBoxCtrl>("ao_cycle");
|
||||
mRandomizeCheckBox=aoPanel->getChild<LLCheckBoxCtrl>("ao_randomize");
|
||||
mCycleTimeTextLabel=aoPanel->getChild<LLTextBox>("ao_cycle_time_seconds_label");
|
||||
mCycleTimeSpinner=aoPanel->getChild<LLSpinCtrl>("ao_cycle_time");
|
||||
|
|
@ -173,6 +174,7 @@ BOOL FloaterAO::postBuild()
|
|||
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));
|
||||
|
||||
|
|
@ -205,9 +207,15 @@ void FloaterAO::enableStateControls(BOOL yes)
|
|||
{
|
||||
mStateSelector->setEnabled(yes);
|
||||
mAnimationList->setEnabled(yes);
|
||||
mRandomizeCheckBox->setEnabled(yes);
|
||||
mCycleTimeTextLabel->setEnabled(yes);
|
||||
mCycleTimeSpinner->setEnabled(yes);
|
||||
mCycleCheckBox->setEnabled(yes);
|
||||
if(yes)
|
||||
updateCycleParameters();
|
||||
else
|
||||
{
|
||||
mRandomizeCheckBox->setEnabled(yes);
|
||||
mCycleTimeTextLabel->setEnabled(yes);
|
||||
mCycleTimeSpinner->setEnabled(yes);
|
||||
}
|
||||
mPreviousButton->setEnabled(yes);
|
||||
mNextButton->setEnabled(yes);
|
||||
mCanDragAndDrop=yes;
|
||||
|
|
@ -285,8 +293,11 @@ void FloaterAO::onSelectState()
|
|||
item->setUserdata(&mSelectedState->mAnimations[index].mInventoryUUID);
|
||||
}
|
||||
|
||||
mCycleCheckBox->setValue(mSelectedState->mCycle);
|
||||
mRandomizeCheckBox->setValue(mSelectedState->mRandom);
|
||||
mCycleTimeSpinner->setValue(mSelectedState->mCycleTime);
|
||||
|
||||
updateCycleParameters();
|
||||
}
|
||||
|
||||
void FloaterAO::onClickReload()
|
||||
|
|
@ -470,6 +481,24 @@ void FloaterAO::onClickTrash()
|
|||
mAnimationList->deleteSelectedItems();
|
||||
}
|
||||
|
||||
void FloaterAO::updateCycleParameters()
|
||||
{
|
||||
BOOL yes=mCycleCheckBox->getValue().asBoolean();
|
||||
mRandomizeCheckBox->setEnabled(yes);
|
||||
mCycleTimeTextLabel->setEnabled(yes);
|
||||
mCycleTimeSpinner->setEnabled(yes);
|
||||
}
|
||||
|
||||
void FloaterAO::onCheckCycle()
|
||||
{
|
||||
if(mSelectedState)
|
||||
{
|
||||
BOOL yes=mCycleCheckBox->getValue().asBoolean();
|
||||
AOEngine::instance().setCycle(mSelectedState,yes);
|
||||
updateCycleParameters();
|
||||
}
|
||||
}
|
||||
|
||||
void FloaterAO::onCheckRandomize()
|
||||
{
|
||||
if(mSelectedState)
|
||||
|
|
|
|||
|
|
@ -75,12 +75,14 @@ class FloaterAO
|
|||
void onClickMoveUp();
|
||||
void onClickMoveDown();
|
||||
void onClickTrash();
|
||||
void onCheckCycle();
|
||||
void onCheckRandomize();
|
||||
void onChangeCycleTime();
|
||||
void onClickPrevious();
|
||||
void onClickNext();
|
||||
|
||||
void updateSmart();
|
||||
void updateCycleParameters();
|
||||
|
||||
void enableSetControls(BOOL yes);
|
||||
void enableStateControls(BOOL yes);
|
||||
|
|
@ -106,6 +108,7 @@ class FloaterAO
|
|||
LLButton* mMoveUpButton;
|
||||
LLButton* mMoveDownButton;
|
||||
LLButton* mTrashButton;
|
||||
LLCheckBoxCtrl* mCycleCheckBox;
|
||||
LLCheckBoxCtrl* mRandomizeCheckBox;
|
||||
LLTextBox* mCycleTimeTextLabel;
|
||||
LLSpinCtrl* mCycleTimeSpinner;
|
||||
|
|
|
|||
|
|
@ -806,7 +806,12 @@ void AOEngine::update()
|
|||
state->mInventoryUUID=stateCategories->get(index)->getUUID();
|
||||
for(S32 num=1;num<params.size();num++)
|
||||
{
|
||||
if(params[num]=="RN")
|
||||
if(params[num]=="CY")
|
||||
{
|
||||
state->mCycle=TRUE;
|
||||
lldebugs << "Cycle on" << llendl;
|
||||
}
|
||||
else if(params[num]=="RN")
|
||||
{
|
||||
state->mRandom=TRUE;
|
||||
lldebugs << "Random on" << llendl;
|
||||
|
|
@ -976,6 +981,8 @@ void AOEngine::saveState(const AOSet::AOState* state)
|
|||
timeStr << ":CT" << state->mCycleTime;
|
||||
stateParams+=timeStr.str();
|
||||
}
|
||||
if(state->mCycle)
|
||||
stateParams+=":CY";
|
||||
if(state->mRandom)
|
||||
stateParams+=":RN";
|
||||
|
||||
|
|
@ -1103,6 +1110,12 @@ void AOEngine::setDisableStands(AOSet* set,BOOL yes)
|
|||
inMouselook(!mInMouselook);
|
||||
}
|
||||
|
||||
void AOEngine::setCycle(AOSet::AOState* state,BOOL yes)
|
||||
{
|
||||
state->mCycle=yes;
|
||||
state->mDirty=TRUE;
|
||||
}
|
||||
|
||||
void AOEngine::setRandomize(AOSet::AOState* state,BOOL yes)
|
||||
{
|
||||
state->mRandom=yes;
|
||||
|
|
|
|||
|
|
@ -137,6 +137,7 @@ class AOEngine
|
|||
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);
|
||||
|
||||
|
|
|
|||
|
|
@ -106,8 +106,9 @@ AOSet::AOSet(const LLUUID inventoryID)
|
|||
mStates[index].mRemapID=stateUUIDs[index];
|
||||
mStates[index].mInventoryUUID=LLUUID::null;
|
||||
mStates[index].mCurrentAnimationID=LLUUID::null;
|
||||
mStates[index].mCycleTime=0.0f;
|
||||
mStates[index].mCycle=FALSE;
|
||||
mStates[index].mRandom=FALSE;
|
||||
mStates[index].mCycleTime=0.0f;
|
||||
mStates[index].mDirty=FALSE;
|
||||
mStateNames.push_back(stateNames[index]);
|
||||
}
|
||||
|
|
@ -155,24 +156,27 @@ LLUUID AOSet::getAnimationForState(AOState* state)
|
|||
S32 numOfAnimations=state->mAnimations.size();
|
||||
if(numOfAnimations)
|
||||
{
|
||||
if(state->mRandom)
|
||||
if(state->mCycle)
|
||||
{
|
||||
state->mCurrentAnimation=ll_frand()*numOfAnimations;
|
||||
lldebugs << "randomly chosen " << state->mCurrentAnimation << " of " << numOfAnimations << llendl;
|
||||
}
|
||||
else
|
||||
{
|
||||
state->mCurrentAnimation++;
|
||||
if(state->mCurrentAnimation>=state->mAnimations.size())
|
||||
state->mCurrentAnimation=0;
|
||||
lldebugs << "cycle " << state->mCurrentAnimation << " of " << numOfAnimations << llendl;
|
||||
if(state->mRandom)
|
||||
{
|
||||
state->mCurrentAnimation=ll_frand()*numOfAnimations;
|
||||
lldebugs << "randomly chosen " << state->mCurrentAnimation << " of " << numOfAnimations << llendl;
|
||||
}
|
||||
else
|
||||
{
|
||||
state->mCurrentAnimation++;
|
||||
if(state->mCurrentAnimation>=state->mAnimations.size())
|
||||
state->mCurrentAnimation=0;
|
||||
lldebugs << "cycle " << state->mCurrentAnimation << " of " << numOfAnimations << llendl;
|
||||
}
|
||||
}
|
||||
return state->mAnimations[state->mCurrentAnimation].mAssetUUID;
|
||||
}
|
||||
else
|
||||
lldebugs << "animation state has no animations assigned" << llendl;
|
||||
}
|
||||
return LLUUID();
|
||||
return LLUUID::null;
|
||||
}
|
||||
|
||||
void AOSet::startTimer(F32 timeout)
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ class AOSet
|
|||
{
|
||||
std::string mName;
|
||||
LLUUID mRemapID;
|
||||
BOOL mCycle;
|
||||
BOOL mRandom;
|
||||
S32 mCycleTime;
|
||||
std::vector<AOAnimation> mAnimations;
|
||||
|
|
|
|||
|
|
@ -169,12 +169,22 @@
|
|||
layout="topleft" />
|
||||
</panel>
|
||||
|
||||
<check_box
|
||||
name="ao_cycle"
|
||||
label="Cycle"
|
||||
tool_tip="Play a different animation from the list every time the animation state is called.."
|
||||
left="0"
|
||||
top_pad="4"
|
||||
width="55"
|
||||
height="16"
|
||||
follows="left|bottom"
|
||||
layout="topleft" />
|
||||
|
||||
<check_box
|
||||
name="ao_randomize"
|
||||
label="Randomize order"
|
||||
tool_tip="Randomize order of animations in cycle mode."
|
||||
left="0"
|
||||
top_pad="4"
|
||||
left_pad="4"
|
||||
width="100"
|
||||
height="16"
|
||||
follows="left|bottom"
|
||||
|
|
@ -183,6 +193,7 @@
|
|||
<text
|
||||
name="ao_cycle_time_seconds_label"
|
||||
value="Cycle time (seconds):"
|
||||
left="0"
|
||||
top_pad="4"
|
||||
width="120"
|
||||
follows="left|right|bottom"
|
||||
|
|
|
|||
Loading…
Reference in New Issue