More possible crash fixes in internal AO plus additional refactoring

master
Ansariel 2020-10-25 14:00:40 +01:00
parent 8d1b6e0f3f
commit 2a997d6edc
7 changed files with 451 additions and 445 deletions

View File

@ -39,14 +39,14 @@
#include "utilitybar.h"
FloaterAO::FloaterAO(const LLSD& key)
: LLTransientDockableFloater(NULL, true, key), LLEventTimer(10.f),
: LLTransientDockableFloater(nullptr, true, key), LLEventTimer(10.f),
mSetList(0),
mSelectedSet(0),
mSelectedState(0),
mCanDragAndDrop(FALSE),
mImportRunning(FALSE),
mCurrentBoldItem(NULL),
mMore(TRUE)
mCanDragAndDrop(false),
mImportRunning(false),
mCurrentBoldItem(nullptr),
mMore(true)
{
mEventTimer.stop();
}
@ -55,9 +55,9 @@ FloaterAO::~FloaterAO()
{
}
void FloaterAO::reloading(BOOL yes)
void FloaterAO::reloading(bool reload)
{
if (yes)
if (reload)
{
mEventTimer.start();
}
@ -66,9 +66,9 @@ void FloaterAO::reloading(BOOL yes)
mEventTimer.stop();
}
mReloadCoverPanel->setVisible(yes);
enableSetControls(!yes);
enableStateControls(!yes);
mReloadCoverPanel->setVisible(reload);
enableSetControls(!reload);
enableStateControls(!reload);
}
BOOL FloaterAO::tick()
@ -84,7 +84,7 @@ void FloaterAO::updateSetParameters()
mOverrideSitsCheckBox->setValue(mSelectedSet->getSitOverride());
mOverrideSitsCheckBoxSmall->setValue(mSelectedSet->getSitOverride());
mSmartCheckBox->setValue(mSelectedSet->getSmart());
mDisableMouselookCheckBox->setValue(mSelectedSet->getMouselookDisable());
mDisableMouselookCheckBox->setValue(mSelectedSet->getMouselookStandDisable());
BOOL isDefault = (mSelectedSet == AOEngine::instance().getDefaultSet());
mDefaultCheckBox->setValue(isDefault);
mDefaultCheckBox->setEnabled(!isDefault);
@ -112,7 +112,7 @@ void FloaterAO::updateAnimationList()
mStateSelector->add(stateName, state, ADD_BOTTOM, TRUE);
}
enableStateControls(TRUE);
enableStateControls(true);
if (currentStateSelected == -1)
{
@ -129,7 +129,7 @@ void FloaterAO::updateAnimationList()
void FloaterAO::updateList()
{
mReloadButton->setEnabled(TRUE);
mImportRunning = FALSE;
mImportRunning = false;
// Lambda provides simple Alpha sorting, note this is case sensitive.
auto sortRuleLambda = [](const AOSet* s1, const AOSet* s2) -> bool
@ -137,7 +137,7 @@ void FloaterAO::updateList()
return s1->getName() < s2->getName();
};
mSetList=AOEngine::instance().getSetList();
mSetList = AOEngine::instance().getSetList();
std::sort(mSetList.begin(), mSetList.end(), sortRuleLambda);
// remember currently selected animation set name
@ -149,8 +149,8 @@ void FloaterAO::updateList()
mSetSelectorSmall->clear();
mAnimationList->deleteAllItems();
mCurrentBoldItem = NULL;
reloading(FALSE);
mCurrentBoldItem = nullptr;
reloading(false);
if (mSetList.empty())
{
@ -292,43 +292,43 @@ BOOL FloaterAO::postBuild()
return LLDockableFloater::postBuild();
}
void FloaterAO::enableSetControls(BOOL yes)
void FloaterAO::enableSetControls(BOOL enable)
{
mSetSelector->setEnabled(yes);
mSetSelectorSmall->setEnabled(yes);
mActivateSetButton->setEnabled(yes);
mRemoveButton->setEnabled(yes);
mDefaultCheckBox->setEnabled(yes && (mSelectedSet != AOEngine::instance().getDefaultSet()));
mOverrideSitsCheckBox->setEnabled(yes);
mOverrideSitsCheckBoxSmall->setEnabled(yes);
mDisableMouselookCheckBox->setEnabled(yes);
mSetSelector->setEnabled(enable);
mSetSelectorSmall->setEnabled(enable);
mActivateSetButton->setEnabled(enable);
mRemoveButton->setEnabled(enable);
mDefaultCheckBox->setEnabled(enable && (mSelectedSet != AOEngine::instance().getDefaultSet()));
mOverrideSitsCheckBox->setEnabled(enable);
mOverrideSitsCheckBoxSmall->setEnabled(enable);
mDisableMouselookCheckBox->setEnabled(enable);
if (!yes)
if (!enable)
{
enableStateControls(yes);
enableStateControls(enable);
}
}
void FloaterAO::enableStateControls(BOOL yes)
void FloaterAO::enableStateControls(BOOL enable)
{
mStateSelector->setEnabled(yes);
mAnimationList->setEnabled(yes);
mCycleCheckBox->setEnabled(yes);
if (yes)
mStateSelector->setEnabled(enable);
mAnimationList->setEnabled(enable);
mCycleCheckBox->setEnabled(enable);
if (enable)
{
updateCycleParameters();
}
else
{
mRandomizeCheckBox->setEnabled(yes);
mCycleTimeTextLabel->setEnabled(yes);
mCycleTimeSpinner->setEnabled(yes);
mRandomizeCheckBox->setEnabled(enable);
mCycleTimeTextLabel->setEnabled(enable);
mCycleTimeSpinner->setEnabled(enable);
}
mPreviousButton->setEnabled(yes);
mPreviousButtonSmall->setEnabled(yes);
mNextButton->setEnabled(yes);
mNextButtonSmall->setEnabled(yes);
mCanDragAndDrop = yes;
mPreviousButton->setEnabled(enable);
mPreviousButtonSmall->setEnabled(enable);
mNextButton->setEnabled(enable);
mNextButtonSmall->setEnabled(enable);
mCanDragAndDrop = enable;
}
void FloaterAO::onOpen(const LLSD& key)
@ -440,7 +440,7 @@ LLScrollListItem* FloaterAO::addAnimation(const std::string& name)
void FloaterAO::onSelectState()
{
mAnimationList->deleteAllItems();
mCurrentBoldItem = NULL;
mCurrentBoldItem = nullptr;
mAnimationList->setCommentText(getString("ao_no_animations_loaded"));
mAnimationList->setEnabled(FALSE);
@ -482,10 +482,10 @@ void FloaterAO::onSelectState()
void FloaterAO::onClickReload()
{
reloading(TRUE);
reloading(true);
mSelectedSet = 0;
mSelectedState = 0;
mSelectedSet = nullptr;
mSelectedState = nullptr;
AOEngine::instance().reload(false);
updateList();
@ -496,7 +496,7 @@ void FloaterAO::onClickAdd()
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);
@ -507,7 +507,7 @@ BOOL FloaterAO::newSetCallback(const LLSD& notification, const LLSD& response)
if (newSetName.empty())
{
return FALSE;
return false;
}
else if (
!LLTextValidate::validateASCIIPrintableNoPipe(new_set_name.getWString()) || // only allow ASCII
@ -516,18 +516,18 @@ BOOL FloaterAO::newSetCallback(const LLSD& notification, const LLSD& response)
LLSD args;
args["AO_SET_NAME"] = newSetName;
LLNotificationsUtil::add("NewAOCantContainNonASCII", args);
return FALSE;
return false;
}
if (option == 0)
{
if (AOEngine::instance().addSet(newSetName).notNull())
{
reloading(TRUE);
return TRUE;
reloading(true);
return true;
}
}
return FALSE;
return false;
}
void FloaterAO::onClickRemove()
@ -542,7 +542,7 @@ void FloaterAO::onClickRemove()
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)
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
@ -550,7 +550,7 @@ BOOL FloaterAO::removeSetCallback(const LLSD& notification, const LLSD& response
{
if (AOEngine::instance().removeSet(mSelectedSet))
{
reloading(TRUE);
reloading(true);
// to prevent snapping back to deleted set
mSetSelector->removeall();
mSetSelectorSmall->removeall();
@ -558,11 +558,11 @@ BOOL FloaterAO::removeSetCallback(const LLSD& notification, const LLSD& response
mSetSelector->clear();
mSetSelectorSmall->clear();
mAnimationList->deleteAllItems();
mCurrentBoldItem = NULL;
return TRUE;
mCurrentBoldItem = nullptr;
return true;
}
}
return FALSE;
return false;
}
void FloaterAO::onCheckDefault()
@ -606,7 +606,7 @@ void FloaterAO::onCheckDisableStands()
{
if (mSelectedSet)
{
AOEngine::instance().setDisableStands(mSelectedSet, mDisableMouselookCheckBox->getValue().asBoolean());
AOEngine::instance().setDisableMouselookStands(mSelectedSet, mDisableMouselookCheckBox->getValue().asBoolean());
}
}
@ -698,7 +698,7 @@ void FloaterAO::onClickTrash()
}
std::vector<LLScrollListItem*> list = mAnimationList->getAllSelected();
if (list.size() == 0)
if (list.empty())
{
return;
}
@ -709,23 +709,23 @@ void FloaterAO::onClickTrash()
}
mAnimationList->deleteSelectedItems();
mCurrentBoldItem = NULL;
mCurrentBoldItem = nullptr;
}
void FloaterAO::updateCycleParameters()
{
BOOL yes = mCycleCheckBox->getValue().asBoolean();
mRandomizeCheckBox->setEnabled(yes);
mCycleTimeTextLabel->setEnabled(yes);
mCycleTimeSpinner->setEnabled(yes);
BOOL enabled = mCycleCheckBox->getValue().asBoolean();
mRandomizeCheckBox->setEnabled(enabled);
mCycleTimeTextLabel->setEnabled(enabled);
mCycleTimeSpinner->setEnabled(enabled);
}
void FloaterAO::onCheckCycle()
{
if (mSelectedState)
{
BOOL yes = mCycleCheckBox->getValue().asBoolean();
AOEngine::instance().setCycle(mSelectedState, yes);
bool cycle = mCycleCheckBox->getValue().asBoolean();
AOEngine::instance().setCycle(mSelectedState, cycle);
updateCycleParameters();
}
}
@ -770,7 +770,7 @@ void FloaterAO::onClickMore()
fullSize.setOriginAndSize(fullSize.mLeft, fullSize.mBottom, getRect().getWidth(), fullSize.getHeight());
}
mMore = TRUE;
mMore = true;
mSmallInterfacePanel->setVisible(FALSE);
mMainInterfacePanel->setVisible(TRUE);
@ -789,7 +789,7 @@ void FloaterAO::onClickLess()
gSavedPerAccountSettings.setRect("floater_rect_animation_overrider_full", fullSize);
mMore = FALSE;
mMore = false;
mSmallInterfacePanel->setVisible(TRUE);
mMainInterfacePanel->setVisible(FALSE);
@ -812,7 +812,7 @@ void FloaterAO::onAnimationChanged(const LLUUID& animation)
LLScrollListText* column = (LLScrollListText*)mCurrentBoldItem->getColumn(1);
column->setFontStyle(LLFontGL::NORMAL);
mCurrentBoldItem = NULL;
mCurrentBoldItem = nullptr;
}
if (animation.isNull())
@ -888,7 +888,7 @@ BOOL FloaterAO::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDr
// TODO: this would be the right thing to do, but it blocks multi drop
// before final release this must be resolved
reloading(TRUE);
reloading(true);
}
}
}

View File

@ -92,16 +92,16 @@ class FloaterAO
void onAnimationChanged(const LLUUID& animation);
void reloading(BOOL yes);
void reloading(bool reload);
void updateSmart();
void updateCycleParameters();
void enableSetControls(BOOL yes);
void enableStateControls(BOOL yes);
void enableSetControls(BOOL enable);
void enableStateControls(BOOL enable);
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();
@ -151,9 +151,9 @@ class FloaterAO
LLButton* mNextButtonSmall;
LLCheckBoxCtrl* mOverrideSitsCheckBoxSmall;
BOOL mCanDragAndDrop;
BOOL mImportRunning;
BOOL mMore;
bool mCanDragAndDrop;
bool mImportRunning;
bool mMore;
};
#endif // AO_H

File diff suppressed because it is too large Load Diff

View File

@ -25,17 +25,13 @@
#ifndef AOENGINE_H
#define AOENGINE_H
#include <boost/signals2.hpp>
#include "aoset.h"
#include "llassettype.h"
#include "lleventtimer.h"
#include "llsingleton.h"
// NaCl - feex
#include "llextendedstatus.h"
// NaCl End
#include "llsingleton.h"
#include <boost/signals2.hpp>
class AOTimerCollection
: public LLEventTimer
@ -46,18 +42,18 @@ class AOTimerCollection
virtual BOOL tick();
void enableInventoryTimer(BOOL yes);
void enableSettingsTimer(BOOL yes);
void enableReloadTimer(BOOL yes);
void enableImportTimer(BOOL yes);
void enableInventoryTimer(bool enable);
void enableSettingsTimer(bool enable);
void enableReloadTimer(bool enable);
void enableImportTimer(bool enable);
protected:
void updateTimers();
BOOL mInventoryTimer;
BOOL mSettingsTimer;
BOOL mReloadTimer;
BOOL mImportTimer;
bool mInventoryTimer;
bool mSettingsTimer;
bool mReloadTimer;
bool mImportTimer;
};
// ----------------------------------------------------
@ -98,35 +94,35 @@ class AOEngine
CyclePrevious
};
void enable(BOOL yes);
void enable_stands(BOOL yes);
const LLUUID override(const LLUUID& motion, BOOL start);
void enable(bool enable);
void enableStands(bool enable_stands);
const LLUUID override(const LLUUID& motion, bool start);
void tick();
void update();
void reload(bool);
void reloadStateAnimations(AOSet::AOState* state);
void clear( bool );
void clear(bool from_timer);
const LLUUID& getAOFolder() const;
LLUUID addSet(const std::string& name, BOOL reload = TRUE);
BOOL removeSet(AOSet* set);
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);
void checkBelowWater(bool check_underwater);
BOOL importNotecard(const LLInventoryItem* item);
void processImport(bool);
bool importNotecard(const LLInventoryItem* item);
void processImport(bool from_timer);
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);
void inMouselook(BOOL yes);
void inMouselook(bool mouselook);
void selectSet(AOSet* set);
AOSet* selectSetByName(const std::string& name);
AOSet* getSetByName(const std::string& name) const;
@ -137,14 +133,14 @@ class AOEngine
const std::vector<AOSet*> 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 setOverrideSits(AOSet* set, bool override_sit);
void setSmart(AOSet* set, bool smart);
void setDisableMouselookStands(AOSet* set, bool disabled);
void setCycle(AOSet::AOState* set, bool cycle);
void setRandomize(AOSet::AOState* state, bool randomize);
void setCycleTime(AOSet::AOState* state, F32 time);
void saveSettings();
@ -197,10 +193,10 @@ class AOEngine
AOTimerCollection mTimerCollection;
AOSitCancelTimer mSitCancelTimer;
BOOL mEnabled;
BOOL mEnabledStands;
BOOL mInMouselook;
BOOL mUnderWater;
bool mEnabled;
bool mEnabledStands;
bool mInMouselook;
bool mUnderWater;
LLUUID mAOFolder;
LLUUID mLastMotion;

View File

@ -32,11 +32,11 @@ AOSet::AOSet(const LLUUID inventoryID)
: LLEventTimer(10000.0f),
mInventoryID(inventoryID),
mName("** New AO Set **"),
mSitOverride(FALSE),
mSmart(FALSE),
mMouselookDisable(FALSE),
mComplete(FALSE),
mDirty(FALSE),
mSitOverride(false),
mSmart(false),
mMouselookStandDisable(false),
mComplete(false),
mDirty(false),
mCurrentMotion(LLUUID())
{
LL_DEBUGS("AOEngine") << "Creating new AO set: " << this << LL_ENDL;
@ -113,10 +113,10 @@ AOSet::AOSet(const LLUUID inventoryID)
mStates[index].mInventoryUUID = LLUUID::null;
mStates[index].mCurrentAnimation = 0;
mStates[index].mCurrentAnimationID = LLUUID::null;
mStates[index].mCycle = FALSE;
mStates[index].mRandom = FALSE;
mStates[index].mCycle = false;
mStates[index].mRandom = false;
mStates[index].mCycleTime = 0.0f;
mStates[index].mDirty = FALSE;
mStates[index].mDirty = false;
mStateNames.push_back(stateNameList[0]);
}
stopTimer();
@ -145,7 +145,7 @@ AOSet::AOState* AOSet::getStateByName(const std::string& name)
}
}
}
return NULL;
return nullptr;
}
AOSet::AOState* AOSet::getStateByRemapID(const LLUUID& id)
@ -163,7 +163,7 @@ AOSet::AOState* AOSet::getStateByRemapID(const LLUUID& id)
return &mStates[index];
}
}
return NULL;
return nullptr;
}
const LLUUID& AOSet::getAnimationForState(AOState* state) const
@ -240,54 +240,54 @@ void AOSet::setName(const std::string& name)
mName=name;
}
BOOL AOSet::getSitOverride() const
bool AOSet::getSitOverride() const
{
return mSitOverride;
}
void AOSet::setSitOverride(BOOL yes)
void AOSet::setSitOverride(bool override_sit)
{
mSitOverride = yes;
mSitOverride = override_sit;
}
BOOL AOSet::getSmart() const
bool AOSet::getSmart() const
{
return mSmart;
}
void AOSet::setSmart(BOOL yes)
void AOSet::setSmart(bool smart)
{
mSmart = yes;
mSmart = smart;
}
BOOL AOSet::getMouselookDisable() const
bool AOSet::getMouselookStandDisable() const
{
return mMouselookDisable;
return mMouselookStandDisable;
}
void AOSet::setMouselookDisable(BOOL yes)
void AOSet::setMouselookStandDisable(bool disable)
{
mMouselookDisable = yes;
mMouselookStandDisable = disable;
}
BOOL AOSet::getComplete() const
bool AOSet::getComplete() const
{
return mComplete;
}
void AOSet::setComplete(BOOL yes)
void AOSet::setComplete(bool complete)
{
mComplete = yes;
mComplete = complete;
}
BOOL AOSet::getDirty() const
bool AOSet::getDirty() const
{
return mDirty;
}
void AOSet::setDirty(BOOL yes)
void AOSet::setDirty(bool dirty)
{
mDirty = yes;
mDirty = dirty;
}
void AOSet::setMotion(const LLUUID& motion)

View File

@ -79,14 +79,14 @@ class AOSet
std::string mName;
std::vector<std::string> mAlternateNames;
LLUUID mRemapID;
BOOL mCycle;
BOOL mRandom;
bool mCycle;
bool mRandom;
S32 mCycleTime;
std::vector<AOAnimation> mAnimations;
U32 mCurrentAnimation;
LLUUID mCurrentAnimationID;
LLUUID mInventoryUUID;
BOOL mDirty;
bool mDirty;
};
const LLUUID& getInventoryUUID() const;
@ -95,23 +95,23 @@ class AOSet
const std::string& getName() const;
void setName(const std::string& name);
BOOL getSitOverride() const;
void setSitOverride(BOOL yes);
bool getSitOverride() const;
void setSitOverride(bool override_sit);
BOOL getSmart() const;
void setSmart(BOOL yes);
bool getSmart() const;
void setSmart(bool smart);
BOOL getMouselookDisable() const;
void setMouselookDisable(BOOL yes);
bool getMouselookStandDisable() const;
void setMouselookStandDisable(bool disable);
BOOL getComplete() const;
void setComplete(BOOL yes);
bool getComplete() const;
void setComplete(bool complete);
const LLUUID& getMotion() const;
void setMotion(const LLUUID& motion);
BOOL getDirty() const;
void setDirty(BOOL yes);
bool getDirty() const;
void setDirty(bool dirty);
AOState* getState(S32 eName);
AOState* getStateByName(const std::string& name);
@ -128,12 +128,12 @@ class AOSet
LLUUID mInventoryID;
std::string mName;
BOOL mSitOverride;
BOOL mSmart;
BOOL mMouselookDisable;
BOOL mComplete;
bool mSitOverride;
bool mSmart;
bool mMouselookStandDisable;
bool mComplete;
LLUUID mCurrentMotion;
BOOL mDirty;
bool mDirty;
AOState mStates[AOSTATES_MAX];
};

View File

@ -6601,7 +6601,7 @@ BOOL LLVOAvatar::startMotion(const LLUUID& id, F32 time_offset)
LLUUID remap_id;
if (isSelf())
{
remap_id = AOEngine::getInstance()->override(id, TRUE);
remap_id = AOEngine::getInstance()->override(id, true);
if (remap_id.isNull())
{
remap_id = remapMotionID(id);
@ -6647,7 +6647,7 @@ BOOL LLVOAvatar::stopMotion(const LLUUID& id, BOOL stop_immediate)
LLUUID remap_id;
if (isSelf())
{
remap_id = AOEngine::getInstance()->override(id, FALSE);
remap_id = AOEngine::getInstance()->override(id, false);
if (remap_id.isNull())
{
remap_id = remapMotionID(id);