Refactor a lot of stuff...

master
Ansariel 2025-11-26 00:42:33 +01:00
parent 2411d626a6
commit 35ad36ec8d
14 changed files with 175 additions and 185 deletions

View File

@ -271,7 +271,7 @@ void FSFloaterContacts::onOpen(const LLSD& key)
LLFloater::onOpen(key);
}
void FSFloaterContacts::openTab(const std::string& name)
void FSFloaterContacts::openTab(std::string_view name)
{
if (name == "friends")
{
@ -291,8 +291,7 @@ void FSFloaterContacts::openTab(const std::string& name)
return;
}
FSFloaterIMContainer* floater_container = dynamic_cast<FSFloaterIMContainer*>(getHost());
if (floater_container)
if (auto floater_container = dynamic_cast<FSFloaterIMContainer*>(getHost()))
{
floater_container->setVisible(true);
floater_container->showFloater(this);
@ -391,7 +390,7 @@ void FSFloaterContacts::onAvatarPicked(const uuid_vec_t& ids, const std::vector<
{
if (!names.empty() && !ids.empty())
{
LLAvatarActions::requestFriendshipDialog(ids[0], names[0].getCompleteName());
LLAvatarActions::requestFriendshipDialog(ids.front(), names.front().getCompleteName());
}
}
@ -405,8 +404,7 @@ void FSFloaterContacts::onAddFriendWizButtonClicked(LLUICtrl* ctrl)
picker->setOkBtnEnableCb(boost::bind(&FSFloaterContacts::isItemsFreeOfFriends, this, _1));
}
LLFloater* root_floater = gFloaterView->getParentFloater(this);
if (root_floater)
if (auto root_floater = gFloaterView->getParentFloater(this))
{
root_floater->addDependentFloater(picker);
}
@ -474,7 +472,7 @@ std::string FSFloaterContacts::getActiveTabName() const
return mTabContainer->getCurrentPanel()->getName();
}
LLPanel* FSFloaterContacts::getPanelByName(const std::string& panel_name)
LLPanel* FSFloaterContacts::getPanelByName(std::string_view panel_name)
{
return mTabContainer->getPanelByName(panel_name);
}
@ -518,10 +516,9 @@ void FSFloaterContacts::getCurrentItemIDs(uuid_vec_t& selected_uuids) const
void FSFloaterContacts::getCurrentFriendItemIDs(uuid_vec_t& selected_uuids) const
{
listitem_vec_t selected = mFriendsList->getAllSelected();
for (listitem_vec_t::iterator itr = selected.begin(); itr != selected.end(); ++itr)
for (auto list_item : mFriendsList->getAllSelected())
{
selected_uuids.push_back((*itr)->getUUID());
selected_uuids.push_back(list_item->getUUID());
}
}
@ -786,7 +783,7 @@ void FSFloaterContacts::refreshRightsChangeList()
bool can_offer_teleport = num_selected >= 1;
bool selected_friends_online = true;
const LLRelationship* friend_status = NULL;
const LLRelationship* friend_status = nullptr;
for (const auto& id : friends)
{
friend_status = LLAvatarTracker::instance().getBuddyInfo(id);
@ -1064,8 +1061,8 @@ void FSFloaterContacts::sendRightsGrant(rights_map_t& ids)
// setup message header
msg->newMessageFast(_PREHASH_GrantUserRights);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUID(_PREHASH_AgentID, gAgent.getID());
msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID());
msg->addUUID(_PREHASH_AgentID, gAgentID);
msg->addUUID(_PREHASH_SessionID, gAgentSessionID);
for (const auto& [id, rights] : ids)
{
@ -1078,7 +1075,7 @@ void FSFloaterContacts::sendRightsGrant(rights_map_t& ids)
gAgent.sendReliableMessage();
}
void FSFloaterContacts::childShowTab(const std::string& id, const std::string& tabname)
void FSFloaterContacts::childShowTab(std::string_view id, std::string_view tabname)
{
if (LLTabContainer* child = findChild<LLTabContainer>(id))
{

View File

@ -63,8 +63,8 @@ public:
static FSFloaterContacts* getInstance();
static FSFloaterContacts* findInstance();
void openTab(const std::string& name);
LLPanel* getPanelByName(const std::string& panel_name);
void openTab(std::string_view name);
LLPanel* getPanelByName(std::string_view panel_name);
void sortFriendList();
void onDisplayNameChanged();
@ -189,7 +189,7 @@ private:
std::string mFriendFilterSubString{ LLStringUtil::null };
std::string mFriendFilterSubStringOrig{ LLStringUtil::null };
void childShowTab(const std::string& id, const std::string& tabname);
void childShowTab(std::string_view id, std::string_view tabname);
void updateRlvRestrictions(ERlvBehaviour behavior);
boost::signals2::connection mRlvBehaviorCallbackConnection{};

View File

@ -300,7 +300,7 @@ void FSFloaterPoser::markSelectedJointsToHighlight()
return;
auto selectedJoints = getUiSelectedPoserJoints();
if (selectedJoints.size() < 1)
if (selectedJoints.empty())
return;
std::string jointName = selectedJoints[0]->jointName();
@ -682,7 +682,7 @@ bool FSFloaterPoser::savePoseToXml(LLVOAvatar* avatar, const std::string& poseFi
void FSFloaterPoser::onClickToggleSelectedBoneEnabled()
{
auto selectedJoints = getUiSelectedPoserJoints();
if (selectedJoints.size() < 1)
if (selectedJoints.empty())
return;
LLVOAvatar *avatar = getUiSelectedAvatar();
@ -706,7 +706,7 @@ void FSFloaterPoser::onClickToggleSelectedBoneEnabled()
void FSFloaterPoser::onClickFlipSelectedJoints()
{
auto selectedJoints = getUiSelectedPoserJoints();
if (selectedJoints.size() < 1)
if (selectedJoints.empty())
return;
LLVOAvatar *avatar = getUiSelectedAvatar();
@ -765,7 +765,7 @@ void FSFloaterPoser::onClickFlipPose()
void FSFloaterPoser::onClickRecaptureSelectedBones()
{
auto selectedJoints = getUiSelectedPoserJoints();
if (selectedJoints.size() < 1)
if (selectedJoints.empty())
return;
LLVOAvatar *avatar = getUiSelectedAvatar();
@ -795,9 +795,9 @@ void FSFloaterPoser::onClickRecaptureSelectedBones()
enableOrDisableRedoAndUndoButton();
}
void FSFloaterPoser::updatePosedBones(const std::string& jointName, const LLQuaternion rotation, const LLVector3 position, const LLVector3 scale)
void FSFloaterPoser::updatePosedBones(const std::string& jointName, const LLQuaternion& rotation, const LLVector3& position, const LLVector3& scale)
{
LLVOAvatar *avatar = getUiSelectedAvatar();
LLVOAvatar* avatar = getUiSelectedAvatar();
if (!avatar)
return;
@ -828,7 +828,7 @@ void FSFloaterPoser::updatePosedBones(const std::string& jointName, const LLQuat
LLQuaternion FSFloaterPoser::getManipGimbalRotation(const std::string& jointName)
{
LLVOAvatar *avatar = getUiSelectedAvatar();
LLVOAvatar* avatar = getUiSelectedAvatar();
if (!avatar)
return LLQuaternion();
@ -1431,7 +1431,7 @@ void FSFloaterPoser::onPoseStartStop()
onAvatarSelect();
}
bool FSFloaterPoser::couldAnimateAvatar(LLVOAvatar *avatar) const
bool FSFloaterPoser::couldAnimateAvatar(LLVOAvatar* avatar) const
{
if (!avatar || avatar->isDead())
return false;
@ -1441,7 +1441,7 @@ bool FSFloaterPoser::couldAnimateAvatar(LLVOAvatar *avatar) const
return true;
}
bool FSFloaterPoser::havePermissionToAnimateAvatar(LLVOAvatar *avatar) const
bool FSFloaterPoser::havePermissionToAnimateAvatar(LLVOAvatar* avatar) const
{
if (!avatar || avatar->isDead())
return false;
@ -1462,7 +1462,7 @@ bool FSFloaterPoser::havePermissionToAnimateAvatar(LLVOAvatar *avatar) const
return false;
}
bool FSFloaterPoser::havePermissionToAnimateOtherAvatar(LLVOAvatar *avatar) const
bool FSFloaterPoser::havePermissionToAnimateOtherAvatar(LLVOAvatar* avatar) const
{
if (!avatar || avatar->isDead())
return false;
@ -1566,13 +1566,13 @@ void FSFloaterPoser::addHeaderRowToScrollList(const std::string& jointName, LLSc
return;
LLScrollListItem *hdrRow = bodyJointsScrollList->addElement(headerRow);
hdrRow->setEnabled(FALSE);
hdrRow->setEnabled(false);
}
LLSD FSFloaterPoser::createRowForJoint(const std::string& jointName, bool isHeaderRow)
{
if (jointName.empty())
return NULL;
return {};
std::string headerValue = "";
if (isHeaderRow)
@ -1583,7 +1583,7 @@ LLSD FSFloaterPoser::createRowForJoint(const std::string& jointName, bool isHead
if (hasString(parameterName))
jointValue = getString(parameterName);
else
return NULL;
return {};
LLSD row;
row["columns"][COL_ICON]["column"] = "icon";
@ -1649,8 +1649,7 @@ void FSFloaterPoser::onToggleRotationFrameButton(const LLUICtrl* toggleButton)
if (!toggleButton)
return;
bool buttonDown = toggleButton->getValue().asBoolean();
if (buttonDown)
if (bool buttonDown = toggleButton->getValue().asBoolean())
{
mBtnAvatarFrame->setValue(toggleButton == mBtnAvatarFrame);
mBtnScreenFrame->setValue(toggleButton == mBtnScreenFrame);
@ -1671,7 +1670,7 @@ void FSFloaterPoser::onUndoLastChange()
return;
auto selectedJoints = getUiSelectedPoserJoints();
if (selectedJoints.size() < 1)
if (selectedJoints.empty())
return;
for (auto item : selectedJoints)
@ -1702,7 +1701,7 @@ void FSFloaterPoser::onSetAvatarToTpose()
enableOrDisableRedoAndUndoButton();
}
void FSFloaterPoser::onResetJoint(const LLSD data)
void FSFloaterPoser::onResetJoint(const LLSD& data)
{
int resetType = data.asInteger();
@ -1714,7 +1713,7 @@ void FSFloaterPoser::onResetJoint(const LLSD data)
return;
auto selectedJoints = getUiSelectedPoserJoints();
if (selectedJoints.size() < 1)
if (selectedJoints.empty())
return;
for (auto item : selectedJoints)
@ -1744,7 +1743,7 @@ void FSFloaterPoser::onRedoLastChange()
return;
auto selectedJoints = getUiSelectedPoserJoints();
if (selectedJoints.size() < 1)
if (selectedJoints.empty())
return;
for (auto item : selectedJoints)
@ -1776,7 +1775,7 @@ void FSFloaterPoser::enableOrDisableRedoAndUndoButton()
return;
auto selectedJoints = getUiSelectedPoserJoints();
if (selectedJoints.size() < 1)
if (selectedJoints.empty())
return;
bool shouldEnableRedoButton = false;
@ -1867,7 +1866,7 @@ void FSFloaterPoser::selectJointByName(const std::string& jointName)
LL_WARNS() << "Joint not found: " << jointName << LL_ENDL;
}
LLScrollListCtrl* FSFloaterPoser::getScrollListForTab(LLPanel * tabPanel) const
LLScrollListCtrl* FSFloaterPoser::getScrollListForTab(LLPanel* tabPanel) const
{
if (tabPanel == mPositionRotationPnl)
{
@ -1929,8 +1928,7 @@ std::vector<FSPoserAnimator::FSPoserJoint*> FSFloaterPoser::getUiSelectedPoserJo
for (auto item : scrollList->getAllSelected())
{
auto* userData = static_cast<FSPoserAnimator::FSPoserJoint*>(item->getUserdata());
if (userData)
if (auto* userData = static_cast<FSPoserAnimator::FSPoserJoint*>(item->getUserdata()))
{
joints.push_back(userData);
}
@ -1941,7 +1939,7 @@ std::vector<FSPoserAnimator::FSPoserJoint*> FSFloaterPoser::getUiSelectedPoserJo
return joints;
}
void FSFloaterPoser::updateManipWithFirstSelectedJoint(std::vector<FSPoserAnimator::FSPoserJoint*> joints) const
void FSFloaterPoser::updateManipWithFirstSelectedJoint(const std::vector<FSPoserAnimator::FSPoserJoint*>& joints) const
{
auto avatarp = getUiSelectedAvatar();
if (!avatarp)
@ -2320,7 +2318,7 @@ LLVector3 FSFloaterPoser::getRotationOfFirstSelectedJoint() const
{
LLVector3 rotation;
auto selectedJoints = getUiSelectedPoserJoints();
if (selectedJoints.size() < 1)
if (selectedJoints.empty())
return rotation;
LLVOAvatar *avatar = getUiSelectedAvatar();
@ -2342,7 +2340,7 @@ LLVector3 FSFloaterPoser::getPositionOfFirstSelectedJoint() const
{
LLVector3 position;
auto selectedJoints = getUiSelectedPoserJoints();
if (selectedJoints.size() < 1)
if (selectedJoints.empty())
return position;
LLVOAvatar *avatar = getUiSelectedAvatar();
@ -2360,7 +2358,7 @@ LLVector3 FSFloaterPoser::getScaleOfFirstSelectedJoint() const
{
LLVector3 scale;
auto selectedJoints = getUiSelectedPoserJoints();
if (selectedJoints.size() < 1)
if (selectedJoints.empty())
return scale;
LLVOAvatar *avatar = getUiSelectedAvatar();
@ -2586,13 +2584,13 @@ void FSFloaterPoser::onAvatarsRefresh()
iconObjectName = getString("icon_object");
// Add non-Animesh avatars
for (LLCharacter *character : LLCharacter::sInstances)
for (LLCharacter* character : LLCharacter::sInstances)
{
LLUUID uuid = character->getID();
if (std::find(avatarsToAddToList.begin(), avatarsToAddToList.end(), uuid) == avatarsToAddToList.end())
continue;
LLVOAvatar *avatar = dynamic_cast<LLVOAvatar *>(character);
LLVOAvatar* avatar = dynamic_cast<LLVOAvatar*>(character);
if (!couldAnimateAvatar(avatar))
continue;
@ -2603,8 +2601,7 @@ void FSFloaterPoser::onAvatarsRefresh()
if (!LLAvatarNameCache::get(uuid, &av_name))
continue;
bool isMuted = LLMuteList::getInstance()->isMuted(uuid);
if (isMuted)
if (LLMuteList::getInstance()->isMuted(uuid))
continue;
if (!avatar->isSelf())
@ -2630,7 +2627,7 @@ void FSFloaterPoser::onAvatarsRefresh()
if (std::find(avatarsToAddToList.begin(), avatarsToAddToList.end(), uuid) == avatarsToAddToList.end())
continue;
LLControlAvatar *avatar = dynamic_cast<LLControlAvatar *>(character);
LLControlAvatar* avatar = dynamic_cast<LLControlAvatar* >(character);
if (!couldAnimateAvatar(avatar))
continue;
@ -2674,15 +2671,15 @@ std::string FSFloaterPoser::getIconNameForAvatar(LLVOAvatar* avatar)
std::string FSFloaterPoser::getControlAvatarName(const LLControlAvatar* avatar)
{
if (!avatar)
return "";
return {};
const LLVOVolume* rootVolume = avatar->mRootVolp;
const LLViewerObject* rootEditObject = (rootVolume) ? rootVolume->getRootEdit() : NULL;
const LLViewerObject* rootEditObject = rootVolume ? rootVolume->getRootEdit() : nullptr;
if (!rootEditObject)
return "";
return {};
const LLViewerInventoryItem* attachedItem =
(rootEditObject->isAttachment()) ? gInventory.getItem(rootEditObject->getAttachmentItemID()) : NULL;
(rootEditObject->isAttachment()) ? gInventory.getItem(rootEditObject->getAttachmentItemID()) : nullptr;
if (attachedItem)
return attachedItem->getName();
@ -2690,7 +2687,7 @@ std::string FSFloaterPoser::getControlAvatarName(const LLControlAvatar* avatar)
if (rootEditObject->permYouOwner())
return avatar->getFullname();
return "";
return {};
}
void FSFloaterPoser::refreshTextHighlightingOnAvatarScrollList()
@ -2707,9 +2704,9 @@ void FSFloaterPoser::refreshTextHighlightingOnAvatarScrollList()
((LLScrollListText*)listItem->getColumn(COL_ICON))->setValue(getIconNameForAvatar(listAvatar));
if (mPoserAnimator.isPosingAvatar(listAvatar))
((LLScrollListText *) listItem->getColumn(COL_NAME))->setFontStyle(LLFontGL::BOLD);
((LLScrollListText*)listItem->getColumn(COL_NAME))->setFontStyle(LLFontGL::BOLD);
else
((LLScrollListText *) listItem->getColumn(COL_NAME))->setFontStyle(LLFontGL::NORMAL);
((LLScrollListText*)listItem->getColumn(COL_NAME))->setFontStyle(LLFontGL::NORMAL);
}
}
@ -2742,29 +2739,29 @@ void FSFloaterPoser::addBoldToScrollList(LLScrollListCtrl* list, LLVOAvatar* ava
for (auto listItem : list->getAllData())
{
FSPoserAnimator::FSPoserJoint *poserJoint = static_cast<FSPoserAnimator::FSPoserJoint *>(listItem->getUserdata());
FSPoserAnimator::FSPoserJoint* poserJoint = static_cast<FSPoserAnimator::FSPoserJoint*>(listItem->getUserdata());
if (!poserJoint)
continue;
((LLScrollListText*)listItem->getColumn(COL_ICON))->setValue(getScrollListIconForJoint(avatar, *poserJoint));
if (mPoserAnimator.isPosingAvatarJoint(avatar, *poserJoint))
((LLScrollListText *) listItem->getColumn(COL_NAME))->setFontStyle(LLFontGL::BOLD);
((LLScrollListText*)listItem->getColumn(COL_NAME))->setFontStyle(LLFontGL::BOLD);
else
((LLScrollListText *) listItem->getColumn(COL_NAME))->setFontStyle(LLFontGL::NORMAL);
((LLScrollListText*)listItem->getColumn(COL_NAME))->setFontStyle(LLFontGL::NORMAL);
}
}
std::string FSFloaterPoser::getScrollListIconForJoint(LLVOAvatar* avatar, FSPoserAnimator::FSPoserJoint joint)
{
if (!avatar)
return "";
return {};
if (mPoserAnimator.getRotationIsWorldLocked(avatar, joint))
return tryGetString("icon_rotation_is_world_locked");
if (!getSavingToBvh())
return "";
return {};
if (joint.boneType() == COL_VOLUMES)
return tryGetString("icon_rotation_does_not_export");
@ -2783,7 +2780,7 @@ std::string FSFloaterPoser::getScrollListIconForJoint(LLVOAvatar* avatar, FSPose
std::string FSFloaterPoser::tryGetString(std::string_view name)
{
if (name.empty())
return "";
return {};
return hasString(name) ? getString(name) : "";
}
@ -2810,8 +2807,7 @@ bool FSFloaterPoser::savePoseToBvh(LLVOAvatar* avatar, const std::string& poseFi
std::string fullSavePath =
gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, POSE_SAVE_SUBDIRECTORY, poseFileName + POSE_EXTERNAL_FORMAT_FILE_EXT);
llofstream file;
file.open(fullSavePath.c_str());
llofstream file(fullSavePath.c_str());
if (!file.is_open())
{
LL_WARNS("Poser") << "Unable to save pose!" << LL_ENDL;
@ -2908,7 +2904,7 @@ void FSFloaterPoser::writeBvhFragment(llofstream* fileStream, LLVOAvatar* avatar
{
for (size_t index = 0; index != numberOfBvhChildNodes; ++index)
{
auto nextJoint = mPoserAnimator.getPoserJointByName(joint->bvhChildren()[index]);
auto nextJoint = mPoserAnimator.getPoserJointByName(joint->bvhChildren().at(index));
writeBvhFragment(fileStream, avatar, nextJoint, tabStops + 1);
}
}
@ -2943,7 +2939,7 @@ void FSFloaterPoser::writeFirstFrameOfBvhMotion(llofstream* fileStream, const FS
size_t numberOfBvhChildNodes = joint->bvhChildren().size();
for (size_t index = 0; index != numberOfBvhChildNodes; ++index)
{
auto nextJoint = mPoserAnimator.getPoserJointByName(joint->bvhChildren()[index]);
auto nextJoint = mPoserAnimator.getPoserJointByName(joint->bvhChildren().at(index));
writeFirstFrameOfBvhMotion(fileStream, nextJoint);
}
}
@ -2972,15 +2968,15 @@ void FSFloaterPoser::writeBvhMotion(llofstream* fileStream, LLVOAvatar* avatar,
size_t numberOfBvhChildNodes = joint->bvhChildren().size();
for (size_t index = 0; index != numberOfBvhChildNodes; ++index)
{
auto nextJoint = mPoserAnimator.getPoserJointByName(joint->bvhChildren()[index]);
auto nextJoint = mPoserAnimator.getPoserJointByName(joint->bvhChildren().at(index));
writeBvhMotion(fileStream, avatar, nextJoint);
}
}
std::string FSFloaterPoser::positionToString(const LLVector3& val)
{
const float metresToInches = 39.37008f;
return std::to_string(metresToInches * val[VY]) + " " + std::to_string(metresToInches * val[VZ]) + " " + std::to_string(metresToInches * val[VX]);
constexpr F32 metersToInches = 39.37008f;
return std::to_string(metersToInches * val[VY]) + " " + std::to_string(metersToInches * val[VZ]) + " " + std::to_string(metersToInches * val[VX]);
}
std::string FSFloaterPoser::rotationToString(const LLVector3& val)
@ -3047,7 +3043,7 @@ S32 FSFloaterPoser::getBvhJointNegation(const std::string& jointName) const
return result;
}
bool FSFloaterPoser::getSavingToBvh()
bool FSFloaterPoser::getSavingToBvh() const
{
return gSavedSettings.getBOOL(POSER_SAVEEXTERNALFORMAT_SAVE_KEY);
}
@ -3061,7 +3057,7 @@ void FSFloaterPoser::onClickSavingToBvh()
void FSFloaterPoser::onClickLockWorldRotBtn()
{
auto selectedJoints = getUiSelectedPoserJoints();
if (selectedJoints.size() < 1)
if (selectedJoints.empty())
return;
LLVOAvatar* avatar = getUiSelectedAvatar();

View File

@ -81,7 +81,7 @@ class FSFloaterPoser : public LLFloater, public LLEditMenuHandler
friend class LLFloaterReg;
FSFloaterPoser(const LLSD &key);
public:
void updatePosedBones(const std::string& jointName, const LLQuaternion rotation, const LLVector3 position, const LLVector3 scale);
void updatePosedBones(const std::string& jointName, const LLQuaternion& rotation, const LLVector3& position, const LLVector3& scale);
LLQuaternion getManipGimbalRotation(const std::string& jointName);
void selectJointByName(const std::string& jointName);
void undo() override { onUndoLastChange(); };
@ -143,7 +143,7 @@ public:
/// Updates the visual with the first selected joint from the supplied collection, if any.
/// </summary>
/// <param name="joints">The collection of selected joints.</param>
void updateManipWithFirstSelectedJoint(std::vector<FSPoserAnimator::FSPoserJoint*> joints) const;
void updateManipWithFirstSelectedJoint(const std::vector<FSPoserAnimator::FSPoserJoint*>& joints) const;
/// <summary>
/// Gets a detectable avatar by its UUID.
@ -229,7 +229,7 @@ public:
LLVector3 getPositionOfFirstSelectedJoint() const;
LLVector3 getScaleOfFirstSelectedJoint() const;
LLScrollListCtrl* getScrollListForTab(LLPanel * tabPanel) const;
LLScrollListCtrl* getScrollListForTab(LLPanel* tabPanel) const;
// Pose load/save
void createUserPoseDirectoryIfNeeded();
void onToggleLoadSavePanel();
@ -268,7 +268,7 @@ public:
void setRotationChangeButtons(bool mirror, bool sympathetic);
void onUndoLastChange();
void onRedoLastChange();
void onResetJoint(const LLSD data);
void onResetJoint(const LLSD& data);
void onSetAvatarToTpose();
void onPoseStartStop();
void onTrackballChanged();
@ -422,7 +422,7 @@ public:
/// Gets whether the pose should also write a BVH file when saved.
/// </summary>
/// <returns>True if the user wants to additionally save a BVH file, otherwise false.</returns>
bool getSavingToBvh();
bool getSavingToBvh() const;
/// <summary>
/// Writes the current pose in BVH-format to the supplied stream.

View File

@ -25,7 +25,6 @@
*/
#include <deque>
#include <boost/algorithm/string.hpp>
#include "fsposingmotion.h"
#include "llcharacter.h"
@ -54,14 +53,14 @@ FSJointPose::FSJointPose(LLJoint* joint, U32 usage, bool isCollisionVolume)
void FSJointPose::setPublicPosition(const LLVector3& pos)
{
addStateToUndo(FSJointState(mCurrentState));
addStateToUndo(mCurrentState);
mCurrentState.mPosition.set(pos);
mCurrentState.mLastChangeWasRotational = false;
}
void FSJointPose::setPublicRotation(bool zeroBase, const LLQuaternion& rot)
{
addStateToUndo(FSJointState(mCurrentState));
addStateToUndo(mCurrentState);
if (zeroBase)
zeroBaseRotation(true);
@ -74,7 +73,7 @@ void FSJointPose::setPublicRotation(bool zeroBase, const LLQuaternion& rot)
void FSJointPose::setPublicScale(const LLVector3& scale)
{
addStateToUndo(FSJointState(mCurrentState));
addStateToUndo(mCurrentState);
mCurrentState.mScale.set(scale);
mCurrentState.mLastChangeWasRotational = false;
}
@ -82,29 +81,30 @@ void FSJointPose::setPublicScale(const LLVector3& scale)
bool FSJointPose::undoLastChange()
{
bool changeType = mCurrentState.mLastChangeWasRotational;
mCurrentState = undoLastStateChange(FSJointState(mCurrentState));
mCurrentState = undoLastStateChange(mCurrentState);
return changeType;
}
void FSJointPose::redoLastChange()
{
mCurrentState = redoLastStateChange(FSJointState(mCurrentState));
mCurrentState = redoLastStateChange(mCurrentState);
}
void FSJointPose::resetJoint()
{
addStateToUndo(FSJointState(mCurrentState));
addStateToUndo(mCurrentState);
mCurrentState.resetJoint();
mCurrentState.mLastChangeWasRotational = true;
}
void FSJointPose::addStateToUndo(FSJointState stateToAddToUndo)
void FSJointPose::addStateToUndo(const FSJointState& stateToAddToUndo)
{
mModifiedThisSession = true;
auto timeIntervalSinceLastChange = std::chrono::system_clock::now() - mTimeLastUpdatedCurrentState;
mTimeLastUpdatedCurrentState = std::chrono::system_clock::now();
auto now = std::chrono::system_clock::now();
auto timeIntervalSinceLastChange = now - mTimeLastUpdatedCurrentState;
mTimeLastUpdatedCurrentState = now;
if (timeIntervalSinceLastChange < UndoUpdateInterval)
return;
@ -124,7 +124,7 @@ void FSJointPose::addStateToUndo(FSJointState stateToAddToUndo)
mLastSetJointStates.pop_back();
}
FSJointPose::FSJointState FSJointPose::undoLastStateChange(FSJointState thingToSet)
FSJointPose::FSJointState FSJointPose::undoLastStateChange(const FSJointState& thingToSet)
{
if (mLastSetJointStates.empty())
return thingToSet;
@ -138,7 +138,7 @@ FSJointPose::FSJointState FSJointPose::undoLastStateChange(FSJointState thingToS
return mLastSetJointStates.at(mUndoneJointStatesIndex);
}
FSJointPose::FSJointState FSJointPose::redoLastStateChange(FSJointState thingToSet)
FSJointPose::FSJointState FSJointPose::redoLastStateChange(const FSJointState& thingToSet)
{
if (mLastSetJointStates.empty())
return thingToSet;
@ -160,37 +160,37 @@ void FSJointPose::recaptureJoint()
if (!joint)
return;
addStateToUndo(FSJointState(mCurrentState));
addStateToUndo(mCurrentState);
if (mIsCollisionVolume)
{
mCurrentState.mPosition.set(LLVector3::zero);
mCurrentState.mScale.set(LLVector3::zero);
mCurrentState.mPosition.clear();
mCurrentState.mScale.clear();
}
mCurrentState = FSJointState(joint);
mCurrentState.mLastChangeWasRotational = true;
}
LLQuaternion FSJointPose::updateJointAsDelta(bool zeroBase, const LLQuaternion rotation, const LLVector3 position, const LLVector3 scale)
LLQuaternion FSJointPose::updateJointAsDelta(bool zeroBase, const LLQuaternion& rotation, const LLVector3& position, const LLVector3& scale)
{
addStateToUndo(FSJointState(mCurrentState));
addStateToUndo(mCurrentState);
mCurrentState.mLastChangeWasRotational = true;
return mCurrentState.updateFromJointProperties(zeroBase, rotation, position, scale);
}
void FSJointPose::setBaseRotation(LLQuaternion rotation, LLJoint::JointPriority priority)
void FSJointPose::setBaseRotation(const LLQuaternion& rotation, LLJoint::JointPriority priority)
{
mCurrentState.resetBaseRotation(rotation, priority);
}
void FSJointPose::setBasePosition(LLVector3 position, LLJoint::JointPriority priority)
void FSJointPose::setBasePosition(const LLVector3& position, LLJoint::JointPriority priority)
{
mCurrentState.resetBasePosition(position, priority);
}
void FSJointPose::setBaseScale(LLVector3 scale, LLJoint::JointPriority priority)
void FSJointPose::setBaseScale(const LLVector3& scale, LLJoint::JointPriority priority)
{
mCurrentState.resetBaseScale(scale, priority);
}

View File

@ -179,28 +179,28 @@ class FSJointPose
/// <param name="position">The position of the supplied joint.</param>
/// <param name="scale">The scale of the supplied joint.</param>
/// <returns>The rotation of the public difference between before and after recapture.</returns>
LLQuaternion updateJointAsDelta(bool zeroBase, const LLQuaternion rotation, const LLVector3 position, const LLVector3 scale);
LLQuaternion updateJointAsDelta(bool zeroBase, const LLQuaternion& rotation, const LLVector3& position, const LLVector3& scale);
/// <summary>
/// Sets the base rotation to the supplied rotation if the supplied priority is appropriate.
/// </summary>
/// <param name="rotation">The base rotation to set; zero is ignored.</param>
/// <param name="priority">The priority of the base rotation; only priority equal or higher than any prior sets have any effect.</param>
void setBaseRotation(LLQuaternion rotation, LLJoint::JointPriority priority);
void setBaseRotation(const LLQuaternion& rotation, LLJoint::JointPriority priority);
/// <summary>
/// Sets the base position to the supplied position if the supplied priority is appropriate.
/// </summary>
/// <param name="position">The base position to set; zero is ignored.</param>
/// <param name="priority">The priority of the base rotation; only priority equal or higher than any prior sets have any effect.</param>
void setBasePosition(LLVector3 position, LLJoint::JointPriority priority);
void setBasePosition(const LLVector3& position, LLJoint::JointPriority priority);
/// <summary>
/// Sets the base scale to the supplied scale if the supplied priority is appropriate.
/// </summary>
/// <param name="scale">The base scale to set; zero is ignored.</param>
/// <param name="priority">The priority of the base rotation; only priority equal or higher than any prior sets have any effect.</param>
void setBaseScale(LLVector3 scale, LLJoint::JointPriority priority);
void setBaseScale(const LLVector3& scale, LLJoint::JointPriority priority);
/// <summary>
/// Sets the priority of the bone to the supplied value.
@ -477,9 +477,9 @@ class FSJointPose
FSJointState mCurrentState;
void addStateToUndo(FSJointState stateToAddToUndo);
FSJointState undoLastStateChange(FSJointState currentState);
FSJointState redoLastStateChange(FSJointState currentState);
void addStateToUndo(const FSJointState& stateToAddToUndo);
FSJointState undoLastStateChange(const FSJointState& currentState);
FSJointState redoLastStateChange(const FSJointState& currentState);
};
#endif // FS_JOINTPPOSE_H

View File

@ -505,7 +505,7 @@ void FSManipRotateJoint::renderRingPass(const RingRenderParams& params, float ra
// If an extra rotation is specified, apply it.
if (params.extraRotateAngle != 0.f)
{
gGL.rotatef(params.extraRotateAngle, params.extraRotateAxis.mV[0], params.extraRotateAxis.mV[1], params.extraRotateAxis.mV[2]);
gGL.rotatef(params.extraRotateAngle, params.extraRotateAxis.mV[VX], params.extraRotateAxis.mV[VY], params.extraRotateAxis.mV[VZ]);
}
// Get the appropriate scale value from mManipulatorScales.
float scaleVal = 1.f;
@ -878,7 +878,7 @@ void FSManipRotateJoint::renderNameXYZ(const LLQuaternion& rot)
S32 vertical_offset = window_center_y - VERTICAL_OFFSET;
LLVector3 euler_angles;
rot.getEulerAngles(&euler_angles.mV[0], &euler_angles.mV[1], &euler_angles.mV[2]);
rot.getEulerAngles(&euler_angles.mV[VX], &euler_angles.mV[VY], &euler_angles.mV[VZ]);
euler_angles *= RAD_TO_DEG;
for (S32 i = 0; i < 3; ++i)
{
@ -1011,7 +1011,7 @@ bool FSManipRotateJoint::handleMouseDownOnPart(S32 x, S32 y, MASK mask)
if (!isAvatarJointSafeToUse())
return false;
auto* poser = dynamic_cast<FSFloaterPoser*>(LLFloaterReg::findInstance("fs_poser"));
auto* poser = LLFloaterReg::findTypedInstance<FSFloaterPoser>("fs_poser");
if (!poser)
return false;
@ -1463,7 +1463,7 @@ void FSManipRotateJoint::drag(S32 x, S32 y)
break;
}
auto* poser = dynamic_cast<FSFloaterPoser*>(LLFloaterReg::findInstance("fs_poser"));
auto* poser = LLFloaterReg::findTypedInstance<FSFloaterPoser>("fs_poser");
if (poser && mJoint)
poser->updatePosedBones(mJoint->getName(), delta_send, LLVector3::zero, LLVector3::zero);
}

View File

@ -463,8 +463,8 @@ void FSPoserAnimator::recaptureJoint(LLVOAvatar* avatar, const FSPoserJoint& joi
}
void FSPoserAnimator::updateJointFromManip(LLVOAvatar* avatar, const FSPoserJoint* joint, bool resetBaseRotationToZero,
E_BoneDeflectionStyles style, E_PoserReferenceFrame frame, const LLQuaternion rotation,
const LLVector3 position, const LLVector3 scale)
E_BoneDeflectionStyles style, E_PoserReferenceFrame frame, const LLQuaternion& rotation,
const LLVector3& position, const LLVector3& scale)
{
if (!isAvatarSafeToUse(avatar))
return;
@ -848,7 +848,7 @@ LLQuaternion FSPoserAnimator::translateRotationToQuaternion(LLVOAvatar* avatar,
return rot_quat;
}
LLQuaternion FSPoserAnimator::changeToRotationFrame(LLVOAvatar* avatar, LLQuaternion rotation, E_PoserReferenceFrame frame, FSJointPose* joint)
LLQuaternion FSPoserAnimator::changeToRotationFrame(LLVOAvatar* avatar, const LLQuaternion& rotation, E_PoserReferenceFrame frame, FSJointPose* joint)
{
if (!joint || !avatar)
return rotation;
@ -1187,7 +1187,7 @@ const FSPoserAnimator::FSPoserJoint* FSPoserAnimator::getPoserJointByName(const
return nullptr;
}
const FSPoserAnimator::FSPoserJoint* FSPoserAnimator::getPoserJointByNumber(LLVOAvatar* avatar, const int jointNumber) const
const FSPoserAnimator::FSPoserJoint* FSPoserAnimator::getPoserJointByNumber(LLVOAvatar* avatar, const S32 jointNumber) const
{
if (!avatar)
return nullptr;
@ -1203,7 +1203,7 @@ const FSPoserAnimator::FSPoserJoint* FSPoserAnimator::getPoserJointByNumber(LLVO
return getPoserJointByName(parentJoint->jointName());
}
bool FSPoserAnimator::tryGetJointNumber(LLVOAvatar* avatar, const FSPoserJoint &poserJoint, int &jointNumber)
bool FSPoserAnimator::tryGetJointNumber(LLVOAvatar* avatar, const FSPoserJoint &poserJoint, S32& jointNumber)
{
if (!avatar)
return false;
@ -1244,7 +1244,7 @@ bool FSPoserAnimator::tryPosingAvatar(LLVOAvatar* avatar)
return false;
}
void FSPoserAnimator::updatePosingState(LLVOAvatar* avatar, std::vector<FSPoserAnimator::FSPoserJoint*> jointsRecaptured)
void FSPoserAnimator::updatePosingState(LLVOAvatar* avatar, const std::vector<FSPoserAnimator::FSPoserJoint*>& jointsRecaptured)
{
if (!avatar)
return;
@ -1253,7 +1253,7 @@ void FSPoserAnimator::updatePosingState(LLVOAvatar* avatar, std::vector<FSPoserA
if (!posingMotion)
return;
std::vector<int> jointNumbersRecaptured;
std::vector<S32> jointNumbersRecaptured;
for (auto item : jointsRecaptured)
{
auto poserJoint = posingMotion->getJointPoseByJointName(item->jointName());
@ -1266,7 +1266,7 @@ void FSPoserAnimator::updatePosingState(LLVOAvatar* avatar, std::vector<FSPoserA
mPosingState.updateMotionStates(avatar, posingMotion, jointNumbersRecaptured);
}
void FSPoserAnimator::stopPosingAvatar(LLVOAvatar *avatar)
void FSPoserAnimator::stopPosingAvatar(LLVOAvatar* avatar)
{
if (!avatar || avatar->isDead())
return;
@ -1330,7 +1330,7 @@ bool FSPoserAnimator::isAvatarSafeToUse(LLVOAvatar* avatar) const
return true;
}
int FSPoserAnimator::getChildJointDepth(const FSPoserJoint* joint, int depth) const
int FSPoserAnimator::getChildJointDepth(const FSPoserJoint* joint, S32 depth) const
{
size_t numberOfBvhChildNodes = joint->bvhChildren().size();
if (numberOfBvhChildNodes < 1)
@ -1340,7 +1340,7 @@ int FSPoserAnimator::getChildJointDepth(const FSPoserJoint* joint, int depth) co
for (size_t index = 0; index != numberOfBvhChildNodes; ++index)
{
auto nextJoint = getPoserJointByName(joint->bvhChildren()[index]);
auto nextJoint = getPoserJointByName(joint->bvhChildren().at(index));
if (!nextJoint)
continue;
@ -1364,7 +1364,7 @@ void FSPoserAnimator::deRotateWorldLockedDescendants(const FSPoserJoint* joint,
for (size_t index = 0; index != numberOfBvhChildNodes; ++index)
{
auto nextJoint = getPoserJointByName(joint->bvhChildren()[index]);
auto nextJoint = getPoserJointByName(joint->bvhChildren().at(index));
if (!nextJoint)
continue;
@ -1395,7 +1395,7 @@ void FSPoserAnimator::deRotateJointOrFirstLockedChild(const FSPoserJoint* joint,
for (size_t index = 0; index != numberOfBvhChildNodes; ++index)
{
auto nextJoint = getPoserJointByName(joint->bvhChildren()[index]);
auto nextJoint = getPoserJointByName(joint->bvhChildren().at(index));
if (!nextJoint)
continue;
@ -1411,7 +1411,7 @@ void FSPoserAnimator::undoOrRedoWorldLockedDescendants(const FSPoserJoint& joint
for (size_t index = 0; index != numberOfBvhChildNodes; ++index)
{
auto nextJoint = getPoserJointByName(joint.bvhChildren()[index]);
auto nextJoint = getPoserJointByName(joint.bvhChildren().at(index));
if (!nextJoint)
continue;
@ -1444,7 +1444,7 @@ void FSPoserAnimator::undoOrRedoJointOrFirstLockedChild(const FSPoserJoint& join
for (size_t index = 0; index != numberOfBvhChildNodes; ++index)
{
auto nextJoint = getPoserJointByName(joint.bvhChildren()[index]);
auto nextJoint = getPoserJointByName(joint.bvhChildren().at(index));
if (!nextJoint)
continue;

View File

@ -401,14 +401,14 @@ public:
/// </summary>
/// <param name="jointNumber">The name of the joint to match.</param>
/// <returns>The matching joint if found, otherwise nullptr</returns>
const FSPoserJoint* getPoserJointByNumber(LLVOAvatar* avatar, const int jointNumber) const;
const FSPoserJoint* getPoserJointByNumber(LLVOAvatar* avatar, const S32 jointNumber) const;
/// <summary>
/// Get a PoserJoint by its LLJoint number.
/// </summary>
/// <param name="jointNumber">The name of the joint to match.</param>
/// <returns>The matching joint if found, otherwise nullptr</returns>
bool tryGetJointNumber(LLVOAvatar* avatar, const FSPoserJoint &poserJoint, int &jointNumber);
bool tryGetJointNumber(LLVOAvatar* avatar, const FSPoserJoint &poserJoint, S32& jointNumber);
/// <summary>
/// Tries to start posing the supplied avatar.
@ -614,7 +614,7 @@ public:
/// <param name="position">The position of the supplied joint.</param>
/// <param name="scale">The scale of the supplied joint.</param>
void updateJointFromManip(LLVOAvatar* avatar, const FSPoserJoint* joint, bool resetBaseRotationToZero, E_BoneDeflectionStyles style,
E_PoserReferenceFrame frame, const LLQuaternion rotation, const LLVector3 position, const LLVector3 scale);
E_PoserReferenceFrame frame, const LLQuaternion& rotation, const LLVector3& position, const LLVector3& scale);
/// <summary>
/// Sets all of the joint rotations of the supplied avatar to zero.
@ -780,7 +780,7 @@ public:
/// </summary>
/// <param name="avatar">The avatar whose pose state is to be recapture.</param>
/// <param name="jointsRecaptured">The joints which were recaptured.</param>
void updatePosingState(LLVOAvatar* avatar, std::vector<FSPoserAnimator::FSPoserJoint*> jointsRecaptured);
void updatePosingState(LLVOAvatar* avatar, const std::vector<FSPoserAnimator::FSPoserJoint*>& jointsRecaptured);
/// <summary>
/// Traverses the joints and applies reversals to the base rotations if needed.
@ -845,7 +845,7 @@ public:
/// <param name="joint">The joint to determine the depth for.</param>
/// <param name="depth">The depth of the supplied joint.</param>
/// <returns>The number of generations of descendents the joint has, if none, then zero.</returns>
int getChildJointDepth(const FSPoserJoint* joint, int depth) const;
int getChildJointDepth(const FSPoserJoint* joint, S32 depth) const;
/// <summary>
/// Derotates the first world-locked child joint to the supplied joint.
@ -898,7 +898,7 @@ public:
/// This method imposes a framing upon the supplied rotation, meaning user input is considered as relative to something like
/// 'the world', 'avatar pelvis' or the position of the camera relative to the joint.
/// </remarks>
LLQuaternion changeToRotationFrame(LLVOAvatar* avatar, LLQuaternion rotation, E_PoserReferenceFrame frame, FSJointPose* joint);
LLQuaternion changeToRotationFrame(LLVOAvatar* avatar, const LLQuaternion& rotation, E_PoserReferenceFrame frame, FSJointPose* joint);
/// <summary>
/// Maps the avatar's ID to the animation registered to them.

View File

@ -30,13 +30,13 @@ void FSPoseState::captureMotionStates(LLVOAvatar* avatar)
}
}
void FSPoseState::updateMotionStates(LLVOAvatar* avatar, FSPosingMotion* posingMotion, std::vector<S32> jointNumbersRecaptured)
void FSPoseState::updateMotionStates(LLVOAvatar* avatar, FSPosingMotion* posingMotion, const std::vector<S32>& jointNumbersRecaptured)
{
if (!avatar || !posingMotion)
return;
sCaptureOrder[avatar->getID()]++;
int animNumber = 0;
S32 animNumber = 0;
// if an animation for avatar is a subset of jointNumbersRecaptured, delete it
// this happens on second/subsequent recaptures; the first recapture is no longer needed
@ -96,7 +96,7 @@ void FSPoseState::writeMotionStates(LLVOAvatar* avatar, bool ignoreOwnership, LL
if (!avatar)
return;
int animNumber = 0;
S32 animNumber = 0;
for (auto it = sMotionStates[avatar->getID()].begin(); it != sMotionStates[avatar->getID()].end(); ++it)
{
if (!ignoreOwnership && !it->gAgentOwnsPose)
@ -178,7 +178,7 @@ bool FSPoseState::applyMotionStatesToPosingMotion(LLVOAvatar* avatar, FSPosingMo
std::sort(sMotionStates[avatar->getID()].begin(), sMotionStates[avatar->getID()].end(), compareByCaptureOrder());
int lastCaptureOrder = 0;
S32 lastCaptureOrder = 0;
bool needPriorityReset = false;
for (auto it = sMotionStates[avatar->getID()].begin(); it != sMotionStates[avatar->getID()].end(); it++)
{
@ -211,7 +211,7 @@ bool FSPoseState::applyMotionStatesToPosingMotion(LLVOAvatar* avatar, FSPosingMo
return allMotionsApplied;
}
void FSPoseState::resetPriorityForCaptureOrder(LLVOAvatar* avatar, FSPosingMotion* posingMotion, int captureOrder)
void FSPoseState::resetPriorityForCaptureOrder(LLVOAvatar* avatar, FSPosingMotion* posingMotion, S32 captureOrder)
{
for (auto it = sMotionStates[avatar->getID()].begin(); it != sMotionStates[avatar->getID()].end(); it++)
{
@ -319,9 +319,9 @@ bool FSPoseState::motionIdIsFromPrimAgentOwnsAgentIsSittingOn(LLVOAvatar* avatar
bool FSPoseState::vector2IsSubsetOfVector1(std::vector<S32> newRecapture, std::vector<S32> oldRecapture)
{
if (newRecapture.size() < 1)
if (newRecapture.empty())
return false;
if (oldRecapture.size() < 1)
if (oldRecapture.empty())
return false;
if (newRecapture.size() < oldRecapture.size())
@ -334,10 +334,10 @@ bool FSPoseState::vector2IsSubsetOfVector1(std::vector<S32> newRecapture, std::v
return true;
}
std::string FSPoseState::encodeVectorToString(std::vector<S32> vector)
std::string FSPoseState::encodeVectorToString(const std::vector<S32>& vector)
{
std::string encoded = "";
if (vector.size() < 1)
if (vector.empty())
return encoded;
for (S32 numberToEncode : vector)
@ -371,7 +371,7 @@ std::string FSPoseState::encodeVectorToString(std::vector<S32> vector)
return encoded;
}
std::vector<S32> FSPoseState::decodeStringToVector(std::string vector)
std::vector<S32> FSPoseState::decodeStringToVector(std::string_view vector)
{
std::vector<S32> decoded;
if (vector.empty())

View File

@ -49,7 +49,7 @@ public:
/// <param name="avatar">The avatar whose animations are to be captured.</param>
/// <param name="posingMotion">The posing motion.</param>
/// <param name="jointNamesRecaptured">The names of the joints being recaptured.</param>
void updateMotionStates(LLVOAvatar* avatar, FSPosingMotion* posingMotion, std::vector<S32> jointNamesRecaptured);
void updateMotionStates(LLVOAvatar* avatar, FSPosingMotion* posingMotion, const std::vector<S32>& jointNamesRecaptured);
/// <summary>
/// Removes all current animation states for the supplied avatar.
@ -125,12 +125,12 @@ private:
/// <summary>
/// Represents 'capture layers: how the user layers animations 'on top of' others.
/// </summary>
int captureOrder = 0;
S32 captureOrder = 0;
/// <summary>
/// Represents in-layer order of capture.
/// </summary>
int inLayerOrder = 0;
S32 inLayerOrder = 0;
/// <summary>
/// When reloading, and if not-empty, the bone-numbers this motionId should affect.
@ -144,7 +144,7 @@ private:
/// <param name="avatar">The avatar being posed by the motion.</param>
/// <param name="posingMotion">The posing motion.</param>
/// <param name="captureOrder">The order of the capture.</param>
void resetPriorityForCaptureOrder(LLVOAvatar* avatar, FSPosingMotion* posingMotion, int captureOrder);
void resetPriorityForCaptureOrder(LLVOAvatar* avatar, FSPosingMotion* posingMotion, S32 captureOrder);
/// <summary>
/// Gets whether gAgentID owns, and thus can save information about the supplied motionId.
@ -197,8 +197,8 @@ private:
/// <remarks>
/// Collab-safe means ASCII-printable chars, and delimiter usage does not conflict with Collab's delimiter.
/// </remarks>
std::string encodeVectorToString(std::vector<S32> vector);
std::vector<S32> decodeStringToVector(std::string vector);
std::string encodeVectorToString(const std::vector<S32>& vector);
std::vector<S32> decodeStringToVector(std::string_view vector);
struct compareByCaptureOrder
{
@ -213,8 +213,8 @@ private:
}
};
static std::map <LLUUID, std::vector<fsMotionState>> sMotionStates;
static std::map<LLUUID, int> sCaptureOrder;
static std::map<LLUUID, std::vector<fsMotionState>> sMotionStates;
static std::map<LLUUID, S32> sCaptureOrder;
static std::map<LLUUID, bool> sMotionStatesOwnedByMe;
};

View File

@ -36,7 +36,7 @@ FSPosingMotion::FSPosingMotion(const LLUUID& id) : LLKeyframeMotion(id)
mJointMotionList = &dummyMotionList;
}
LLMotion::LLMotionInitStatus FSPosingMotion::onInitialize(LLCharacter *character)
LLMotion::LLMotionInitStatus FSPosingMotion::onInitialize(LLCharacter* character)
{
if (!character)
return STATUS_FAILURE;
@ -184,7 +184,7 @@ void FSPosingMotion::removeJointFromState(LLJoint* joint)
void FSPosingMotion::setJointState(LLJoint* joint, U32 state)
{
if (mJointPoses.size() < 1)
if (mJointPoses.empty())
return;
if (!joint)
return;
@ -208,7 +208,7 @@ void FSPosingMotion::setJointState(LLJoint* joint, U32 state)
FSJointPose* FSPosingMotion::getJointPoseByJointName(const std::string& name)
{
if (name.empty() || mJointPoses.size() < 1)
if (name.empty() || mJointPoses.empty())
return nullptr;
for (auto poserJoint_iter = mJointPoses.begin(); poserJoint_iter != mJointPoses.end(); ++poserJoint_iter)
@ -222,9 +222,9 @@ FSJointPose* FSPosingMotion::getJointPoseByJointName(const std::string& name)
return nullptr;
}
FSJointPose* FSPosingMotion::getJointPoseByJointNumber(const S32& number)
FSJointPose* FSPosingMotion::getJointPoseByJointNumber(const S32 number)
{
if (mJointPoses.size() < 1)
if (mJointPoses.empty())
return nullptr;
if (number < 0)
return nullptr;
@ -242,13 +242,13 @@ FSJointPose* FSPosingMotion::getJointPoseByJointNumber(const S32& number)
bool FSPosingMotion::currentlyPosingJoint(LLJoint* joint)
{
if (mJointPoses.size() < 1)
if (mJointPoses.empty())
return false;
if (!joint)
return false;
LLPose* pose = this->getPose();
LLPose* pose = getPose();
if (!pose)
return false;
@ -288,7 +288,7 @@ void FSPosingMotion::setJointBvhLock(FSJointPose* joint, bool lockInBvh)
joint->zeroBaseRotation(lockInBvh);
}
bool FSPosingMotion::loadOtherMotionToBaseOfThisMotion(LLKeyframeMotion* motionToLoad, F32 timeToLoadAt, std::vector<S32> selectedJointNumbers)
bool FSPosingMotion::loadOtherMotionToBaseOfThisMotion(LLKeyframeMotion* motionToLoad, F32 timeToLoadAt, const std::vector<S32>& selectedJointNumbers)
{
FSPosingMotion* motionToLoadAsFsPosingMotion = static_cast<FSPosingMotion*>(motionToLoad);
if (!motionToLoadAsFsPosingMotion)
@ -357,7 +357,7 @@ void FSPosingMotion::getJointStateAtTime(std::string jointPoseName, F32 timeToLo
}
}
bool FSPosingMotion::otherMotionAnimatesJoints(LLKeyframeMotion* motionToQuery, std::vector<S32> recapturedJointNumbers)
bool FSPosingMotion::otherMotionAnimatesJoints(LLKeyframeMotion* motionToQuery, const std::vector<S32>& recapturedJointNumbers)
{
FSPosingMotion* motionToLoadAsFsPosingMotion = static_cast<FSPosingMotion*>(motionToQuery);
if (!motionToLoadAsFsPosingMotion)
@ -367,7 +367,7 @@ bool FSPosingMotion::otherMotionAnimatesJoints(LLKeyframeMotion* motionToQuery,
}
// Do not try to access FSPosingMotion state; you are a LLKeyframeMotion cast as a FSPosingMotion, NOT an FSPosingMotion.
bool FSPosingMotion::motionAnimatesJoints(std::vector<int> recapturedJointNumbers)
bool FSPosingMotion::motionAnimatesJoints(const std::vector<S32>& recapturedJointNumbers)
{
if (mJointMotionList == nullptr)
return false;
@ -387,7 +387,7 @@ bool FSPosingMotion::motionAnimatesJoints(std::vector<int> recapturedJointNumber
return false;
}
void FSPosingMotion::resetBonePriority(std::vector<S32> boneNumbersToReset)
void FSPosingMotion::resetBonePriority(const std::vector<S32>& boneNumbersToReset)
{
for (S32 boneNumber : boneNumbersToReset)
{
@ -399,7 +399,7 @@ void FSPosingMotion::resetBonePriority(std::vector<S32> boneNumbersToReset)
}
}
bool FSPosingMotion::vectorsNotQuiteEqual(LLVector3 v1, LLVector3 v2) const
bool FSPosingMotion::vectorsNotQuiteEqual(const LLVector3& v1, const LLVector3& v2) const
{
if (vectorAxesAlmostEqual(v1.mV[VX], v2.mV[VX]) &&
vectorAxesAlmostEqual(v1.mV[VY], v2.mV[VY]) &&

View File

@ -68,7 +68,7 @@ public:
// run-time (post constructor) initialization,
// called after parameters have been set
// must return true to indicate success and be available for activation
virtual LLMotionInitStatus onInitialize(LLCharacter *character);
virtual LLMotionInitStatus onInitialize(LLCharacter* character);
// called when a motion is activated
// must return TRUE to indicate success, or else
@ -113,7 +113,7 @@ public:
/// </summary>
/// <param name="number">The number of the joint to get the pose for.</param>
/// <returns>The matching joint pose, if found, otherwise null.</returns>
FSJointPose* getJointPoseByJointNumber(const S32& number);
FSJointPose* getJointPoseByJointNumber(const S32 number);
/// <summary>
/// Gets the motion identity for this animation.
@ -148,7 +148,7 @@ public:
/// <param name="timeToLoadAt">The play-time the animation should be advanced to derive the correct joint state.</param>
/// <param name="selectedJointNumbers">If only some of the joints should be animated by this motion, number them here.</param>
/// <returns></returns>
bool loadOtherMotionToBaseOfThisMotion(LLKeyframeMotion* motionToLoad, F32 timeToLoadAt, std::vector<S32> selectedJointNumbers);
bool loadOtherMotionToBaseOfThisMotion(LLKeyframeMotion* motionToLoad, F32 timeToLoadAt, const std::vector<S32>& selectedJointNumbers);
/// <summary>
/// Tries to get the rotation, position and scale for the supplied joint name at the supplied time.
@ -172,7 +172,7 @@ public:
/// Resets the bone priority to zero for the joints named in the supplied string.
/// </summary>
/// <param name="boneNumbersToReset">The vector containing bone numbers.</param>
void resetBonePriority(std::vector<S32> boneNumbersToReset);
void resetBonePriority(const std::vector<S32>& boneNumbersToReset);
/// <summary>
/// Queries whether the supplied motion animates any of the joints named in the supplied string.
@ -180,7 +180,7 @@ public:
/// <param name="motionToQuery">The motion to query.</param>
/// <param name="recapturedJointNumbers">A string containing all of the joint numbers.</param>
/// <returns>True if the motion animates any of the bones named, otherwise false.</returns>
bool otherMotionAnimatesJoints(LLKeyframeMotion* motionToQuery, std::vector<S32> recapturedJointNumbers);
bool otherMotionAnimatesJoints(LLKeyframeMotion* motionToQuery, const std::vector<S32>& recapturedJointNumbers);
/// <summary>
/// Queries whether the this motion animates any of the joints named in the supplied string.
@ -191,7 +191,7 @@ public:
/// The most significant thing this method does is provide access to protected properties of an LLPosingMotion.
/// Thus its most common usage would be to access those properties for an arbitrary animation.
/// </remarks>
bool motionAnimatesJoints(std::vector<S32> recapturedJointNumbers);
bool motionAnimatesJoints(const std::vector<S32>& recapturedJointNumbers);
private:
/// <summary>
@ -274,7 +274,7 @@ private:
/// <param name="v1">The first vector to compare.</param>
/// <param name="v2">The sceond vector to compare.</param>
/// <returns>true if the vectors are "close enough", otherwise false.</returns>
bool vectorsNotQuiteEqual(LLVector3 v1, LLVector3 v2) const;
bool vectorsNotQuiteEqual(const LLVector3& v1, const LLVector3& v2) const;
/// <summary>
/// Determines if two quaternions are near enough to equal.

View File

@ -191,8 +191,8 @@ LLAvatarList::LLAvatarList(const Params& p)
, mRlvCheckShowNames(false)
// [/RLVa:KB]
, mShowVoiceVolume(p.show_voice_volume)
, mShowUsername((bool)gSavedSettings.getBOOL("NameTagShowUsernames"))
, mShowDisplayName((bool)gSavedSettings.getBOOL("UseDisplayNames"))
, mShowUsername(gSavedSettings.getBOOL("NameTagShowUsernames"))
, mShowDisplayName(gSavedSettings.getBOOL("UseDisplayNames"))
{
setCommitOnSelectionChange(true);
@ -219,13 +219,13 @@ LLAvatarList::LLAvatarList(const Params& p)
void LLAvatarList::handleDisplayNamesOptionChanged()
{
// <FS:Ansariel> FIRE-1089: Set the proper name options for the AvatarListItem before we update the list.
mShowUsername = (bool)gSavedSettings.getBOOL("NameTagShowUsernames");
mShowDisplayName = (bool)gSavedSettings.getBOOL("UseDisplayNames");
mShowUsername = gSavedSettings.getBOOL("NameTagShowUsernames");
mShowDisplayName = gSavedSettings.getBOOL("UseDisplayNames");
std::vector<LLPanel*> items;
getItems(items);
for( std::vector<LLPanel*>::const_iterator it = items.begin(); it != items.end(); it++)
for (auto panel : items)
{
LLAvatarListItem* item = static_cast<LLAvatarListItem*>(*it);
LLAvatarListItem* item = static_cast<LLAvatarListItem*>(panel);
item->showUsername(mShowUsername, false);
item->showDisplayName(mShowDisplayName, false);
}
@ -265,9 +265,9 @@ void LLAvatarList::updateRlvRestrictions(ERlvBehaviour behavior, ERlvParamType t
{
std::vector<LLPanel*> items;
getItems(items);
for (std::vector<LLPanel*>::const_iterator it = items.begin(); it != items.end(); it++)
for (auto panel : items)
{
LLAvatarListItem* item = static_cast<LLAvatarListItem*>(*it);
LLAvatarListItem* item = static_cast<LLAvatarListItem*>(panel);
item->updateRlvRestrictions();
}
}
@ -559,11 +559,11 @@ S32 LLAvatarList::notifyParent(const LLSD& info)
return 1;
}
// [SL:KB] - Patch: UI-AvatarListDndShare | Checked: 2011-06-19 (Catznip-2.6.0c) | Added: Catznip-2.6.0c
else if ( (info.has("select")) && (info["select"].isUUID()) )
else if (info.has("select") && info["select"].isUUID())
{
const LLSD& sdValue = getSelectedValue();
const LLUUID idItem = info["select"].asUUID();
if ( (!sdValue.isDefined()) || ((sdValue.isUUID()) && (sdValue.asUUID() != idItem)) )
if (!sdValue.isDefined() || (sdValue.isUUID() && sdValue.asUUID() != idItem))
{
resetSelection();
selectItemByUUID(info["select"].asUUID());
@ -731,21 +731,18 @@ void LLAvatarList::onItemClicked(LLUICtrl* ctrl, S32 x, S32 y, MASK mask)
// static
std::string LLAvatarList::getNameForDisplay(const LLUUID& avatar_id, const LLAvatarName& av_name, bool show_displayname, bool show_username, bool force_use_complete_name, bool rlv_check_shownames)
{
bool fRlvCanShowName = (!rlv_check_shownames) || (RlvActions::canShowName(RlvActions::SNC_DEFAULT, avatar_id));
const bool fRlvCanShowName = (!rlv_check_shownames) || (RlvActions::canShowName(RlvActions::SNC_DEFAULT, avatar_id));
if (show_displayname && !show_username)
{
return ( (fRlvCanShowName) ? av_name.getDisplayName() : RlvStrings::getAnonym(av_name) );
return (fRlvCanShowName ? av_name.getDisplayName() : RlvStrings::getAnonym(av_name));
}
else if (!show_displayname && show_username)
{
return ( (fRlvCanShowName) ? av_name.getUserName() : RlvStrings::getAnonym(av_name) );
return (fRlvCanShowName ? av_name.getUserName() : RlvStrings::getAnonym(av_name));
}
else
{
// <FS:Zi> fix People / Friends showing [ user.name ] instead of (user.name)
// return ( (fRlvCanShowName) ? av_name.getCompleteName(false, force_use_complete_name) : RlvStrings::getAnonym(av_name) );
return ( (fRlvCanShowName) ? av_name.getCompleteName(true, force_use_complete_name) : RlvStrings::getAnonym(av_name) );
// </FS:Zi>
return (fRlvCanShowName ? av_name.getCompleteName(true, force_use_complete_name) : RlvStrings::getAnonym(av_name));
}
}
// </FS:Ansariel>