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); LLFloater::onOpen(key);
} }
void FSFloaterContacts::openTab(const std::string& name) void FSFloaterContacts::openTab(std::string_view name)
{ {
if (name == "friends") if (name == "friends")
{ {
@ -291,8 +291,7 @@ void FSFloaterContacts::openTab(const std::string& name)
return; return;
} }
FSFloaterIMContainer* floater_container = dynamic_cast<FSFloaterIMContainer*>(getHost()); if (auto floater_container = dynamic_cast<FSFloaterIMContainer*>(getHost()))
if (floater_container)
{ {
floater_container->setVisible(true); floater_container->setVisible(true);
floater_container->showFloater(this); floater_container->showFloater(this);
@ -391,7 +390,7 @@ void FSFloaterContacts::onAvatarPicked(const uuid_vec_t& ids, const std::vector<
{ {
if (!names.empty() && !ids.empty()) 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)); picker->setOkBtnEnableCb(boost::bind(&FSFloaterContacts::isItemsFreeOfFriends, this, _1));
} }
LLFloater* root_floater = gFloaterView->getParentFloater(this); if (auto root_floater = gFloaterView->getParentFloater(this))
if (root_floater)
{ {
root_floater->addDependentFloater(picker); root_floater->addDependentFloater(picker);
} }
@ -474,7 +472,7 @@ std::string FSFloaterContacts::getActiveTabName() const
return mTabContainer->getCurrentPanel()->getName(); 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); 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 void FSFloaterContacts::getCurrentFriendItemIDs(uuid_vec_t& selected_uuids) const
{ {
listitem_vec_t selected = mFriendsList->getAllSelected(); for (auto list_item : mFriendsList->getAllSelected())
for (listitem_vec_t::iterator itr = selected.begin(); itr != selected.end(); ++itr)
{ {
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 can_offer_teleport = num_selected >= 1;
bool selected_friends_online = true; bool selected_friends_online = true;
const LLRelationship* friend_status = NULL; const LLRelationship* friend_status = nullptr;
for (const auto& id : friends) for (const auto& id : friends)
{ {
friend_status = LLAvatarTracker::instance().getBuddyInfo(id); friend_status = LLAvatarTracker::instance().getBuddyInfo(id);
@ -1064,8 +1061,8 @@ void FSFloaterContacts::sendRightsGrant(rights_map_t& ids)
// setup message header // setup message header
msg->newMessageFast(_PREHASH_GrantUserRights); msg->newMessageFast(_PREHASH_GrantUserRights);
msg->nextBlockFast(_PREHASH_AgentData); msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUID(_PREHASH_AgentID, gAgent.getID()); msg->addUUID(_PREHASH_AgentID, gAgentID);
msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); msg->addUUID(_PREHASH_SessionID, gAgentSessionID);
for (const auto& [id, rights] : ids) for (const auto& [id, rights] : ids)
{ {
@ -1078,7 +1075,7 @@ void FSFloaterContacts::sendRightsGrant(rights_map_t& ids)
gAgent.sendReliableMessage(); 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)) if (LLTabContainer* child = findChild<LLTabContainer>(id))
{ {

View File

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

View File

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

View File

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

View File

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

View File

@ -179,28 +179,28 @@ class FSJointPose
/// <param name="position">The position of the supplied joint.</param> /// <param name="position">The position of the supplied joint.</param>
/// <param name="scale">The scale 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> /// <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> /// <summary>
/// Sets the base rotation to the supplied rotation if the supplied priority is appropriate. /// Sets the base rotation to the supplied rotation if the supplied priority is appropriate.
/// </summary> /// </summary>
/// <param name="rotation">The base rotation to set; zero is ignored.</param> /// <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> /// <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> /// <summary>
/// Sets the base position to the supplied position if the supplied priority is appropriate. /// Sets the base position to the supplied position if the supplied priority is appropriate.
/// </summary> /// </summary>
/// <param name="position">The base position to set; zero is ignored.</param> /// <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> /// <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> /// <summary>
/// Sets the base scale to the supplied scale if the supplied priority is appropriate. /// Sets the base scale to the supplied scale if the supplied priority is appropriate.
/// </summary> /// </summary>
/// <param name="scale">The base scale to set; zero is ignored.</param> /// <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> /// <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> /// <summary>
/// Sets the priority of the bone to the supplied value. /// Sets the priority of the bone to the supplied value.
@ -455,7 +455,7 @@ class FSJointPose
}; };
private: private:
std::string mJointName = ""; // expected to be a match to LLJoint.getName() for a joint implementation. std::string mJointName = ""; // expected to be a match to LLJoint.getName() for a joint implementation.
LLPointer<LLJointState> mJointState{ nullptr }; LLPointer<LLJointState> mJointState{ nullptr };
/// <summary> /// <summary>
@ -477,9 +477,9 @@ class FSJointPose
FSJointState mCurrentState; FSJointState mCurrentState;
void addStateToUndo(FSJointState stateToAddToUndo); void addStateToUndo(const FSJointState& stateToAddToUndo);
FSJointState undoLastStateChange(FSJointState currentState); FSJointState undoLastStateChange(const FSJointState& currentState);
FSJointState redoLastStateChange(FSJointState currentState); FSJointState redoLastStateChange(const FSJointState& currentState);
}; };
#endif // FS_JOINTPPOSE_H #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 an extra rotation is specified, apply it.
if (params.extraRotateAngle != 0.f) 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. // Get the appropriate scale value from mManipulatorScales.
float scaleVal = 1.f; float scaleVal = 1.f;
@ -878,7 +878,7 @@ void FSManipRotateJoint::renderNameXYZ(const LLQuaternion& rot)
S32 vertical_offset = window_center_y - VERTICAL_OFFSET; S32 vertical_offset = window_center_y - VERTICAL_OFFSET;
LLVector3 euler_angles; 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; euler_angles *= RAD_TO_DEG;
for (S32 i = 0; i < 3; ++i) for (S32 i = 0; i < 3; ++i)
{ {
@ -1011,7 +1011,7 @@ bool FSManipRotateJoint::handleMouseDownOnPart(S32 x, S32 y, MASK mask)
if (!isAvatarJointSafeToUse()) if (!isAvatarJointSafeToUse())
return false; return false;
auto* poser = dynamic_cast<FSFloaterPoser*>(LLFloaterReg::findInstance("fs_poser")); auto* poser = LLFloaterReg::findTypedInstance<FSFloaterPoser>("fs_poser");
if (!poser) if (!poser)
return false; return false;
@ -1463,7 +1463,7 @@ void FSManipRotateJoint::drag(S32 x, S32 y)
break; break;
} }
auto* poser = dynamic_cast<FSFloaterPoser*>(LLFloaterReg::findInstance("fs_poser")); auto* poser = LLFloaterReg::findTypedInstance<FSFloaterPoser>("fs_poser");
if (poser && mJoint) if (poser && mJoint)
poser->updatePosedBones(mJoint->getName(), delta_send, LLVector3::zero, LLVector3::zero); 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, void FSPoserAnimator::updateJointFromManip(LLVOAvatar* avatar, const FSPoserJoint* joint, bool resetBaseRotationToZero,
E_BoneDeflectionStyles style, E_PoserReferenceFrame frame, const LLQuaternion rotation, E_BoneDeflectionStyles style, E_PoserReferenceFrame frame, const LLQuaternion& rotation,
const LLVector3 position, const LLVector3 scale) const LLVector3& position, const LLVector3& scale)
{ {
if (!isAvatarSafeToUse(avatar)) if (!isAvatarSafeToUse(avatar))
return; return;
@ -848,7 +848,7 @@ LLQuaternion FSPoserAnimator::translateRotationToQuaternion(LLVOAvatar* avatar,
return rot_quat; 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) if (!joint || !avatar)
return rotation; return rotation;
@ -1187,7 +1187,7 @@ const FSPoserAnimator::FSPoserJoint* FSPoserAnimator::getPoserJointByName(const
return nullptr; 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) if (!avatar)
return nullptr; return nullptr;
@ -1203,7 +1203,7 @@ const FSPoserAnimator::FSPoserJoint* FSPoserAnimator::getPoserJointByNumber(LLVO
return getPoserJointByName(parentJoint->jointName()); 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) if (!avatar)
return false; return false;
@ -1244,7 +1244,7 @@ bool FSPoserAnimator::tryPosingAvatar(LLVOAvatar* avatar)
return false; 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) if (!avatar)
return; return;
@ -1253,7 +1253,7 @@ void FSPoserAnimator::updatePosingState(LLVOAvatar* avatar, std::vector<FSPoserA
if (!posingMotion) if (!posingMotion)
return; return;
std::vector<int> jointNumbersRecaptured; std::vector<S32> jointNumbersRecaptured;
for (auto item : jointsRecaptured) for (auto item : jointsRecaptured)
{ {
auto poserJoint = posingMotion->getJointPoseByJointName(item->jointName()); auto poserJoint = posingMotion->getJointPoseByJointName(item->jointName());
@ -1266,7 +1266,7 @@ void FSPoserAnimator::updatePosingState(LLVOAvatar* avatar, std::vector<FSPoserA
mPosingState.updateMotionStates(avatar, posingMotion, jointNumbersRecaptured); mPosingState.updateMotionStates(avatar, posingMotion, jointNumbersRecaptured);
} }
void FSPoserAnimator::stopPosingAvatar(LLVOAvatar *avatar) void FSPoserAnimator::stopPosingAvatar(LLVOAvatar* avatar)
{ {
if (!avatar || avatar->isDead()) if (!avatar || avatar->isDead())
return; return;
@ -1330,7 +1330,7 @@ bool FSPoserAnimator::isAvatarSafeToUse(LLVOAvatar* avatar) const
return true; 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(); size_t numberOfBvhChildNodes = joint->bvhChildren().size();
if (numberOfBvhChildNodes < 1) if (numberOfBvhChildNodes < 1)
@ -1340,7 +1340,7 @@ int FSPoserAnimator::getChildJointDepth(const FSPoserJoint* joint, int depth) co
for (size_t index = 0; index != numberOfBvhChildNodes; ++index) for (size_t index = 0; index != numberOfBvhChildNodes; ++index)
{ {
auto nextJoint = getPoserJointByName(joint->bvhChildren()[index]); auto nextJoint = getPoserJointByName(joint->bvhChildren().at(index));
if (!nextJoint) if (!nextJoint)
continue; continue;
@ -1364,7 +1364,7 @@ void FSPoserAnimator::deRotateWorldLockedDescendants(const FSPoserJoint* joint,
for (size_t index = 0; index != numberOfBvhChildNodes; ++index) for (size_t index = 0; index != numberOfBvhChildNodes; ++index)
{ {
auto nextJoint = getPoserJointByName(joint->bvhChildren()[index]); auto nextJoint = getPoserJointByName(joint->bvhChildren().at(index));
if (!nextJoint) if (!nextJoint)
continue; continue;
@ -1395,7 +1395,7 @@ void FSPoserAnimator::deRotateJointOrFirstLockedChild(const FSPoserJoint* joint,
for (size_t index = 0; index != numberOfBvhChildNodes; ++index) for (size_t index = 0; index != numberOfBvhChildNodes; ++index)
{ {
auto nextJoint = getPoserJointByName(joint->bvhChildren()[index]); auto nextJoint = getPoserJointByName(joint->bvhChildren().at(index));
if (!nextJoint) if (!nextJoint)
continue; continue;
@ -1411,7 +1411,7 @@ void FSPoserAnimator::undoOrRedoWorldLockedDescendants(const FSPoserJoint& joint
for (size_t index = 0; index != numberOfBvhChildNodes; ++index) for (size_t index = 0; index != numberOfBvhChildNodes; ++index)
{ {
auto nextJoint = getPoserJointByName(joint.bvhChildren()[index]); auto nextJoint = getPoserJointByName(joint.bvhChildren().at(index));
if (!nextJoint) if (!nextJoint)
continue; continue;
@ -1444,7 +1444,7 @@ void FSPoserAnimator::undoOrRedoJointOrFirstLockedChild(const FSPoserJoint& join
for (size_t index = 0; index != numberOfBvhChildNodes; ++index) for (size_t index = 0; index != numberOfBvhChildNodes; ++index)
{ {
auto nextJoint = getPoserJointByName(joint.bvhChildren()[index]); auto nextJoint = getPoserJointByName(joint.bvhChildren().at(index));
if (!nextJoint) if (!nextJoint)
continue; continue;

View File

@ -401,14 +401,14 @@ public:
/// </summary> /// </summary>
/// <param name="jointNumber">The name of the joint to match.</param> /// <param name="jointNumber">The name of the joint to match.</param>
/// <returns>The matching joint if found, otherwise nullptr</returns> /// <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> /// <summary>
/// Get a PoserJoint by its LLJoint number. /// Get a PoserJoint by its LLJoint number.
/// </summary> /// </summary>
/// <param name="jointNumber">The name of the joint to match.</param> /// <param name="jointNumber">The name of the joint to match.</param>
/// <returns>The matching joint if found, otherwise nullptr</returns> /// <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> /// <summary>
/// Tries to start posing the supplied avatar. /// Tries to start posing the supplied avatar.
@ -614,7 +614,7 @@ public:
/// <param name="position">The position of the supplied joint.</param> /// <param name="position">The position of the supplied joint.</param>
/// <param name="scale">The scale 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, 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> /// <summary>
/// Sets all of the joint rotations of the supplied avatar to zero. /// Sets all of the joint rotations of the supplied avatar to zero.
@ -780,7 +780,7 @@ public:
/// </summary> /// </summary>
/// <param name="avatar">The avatar whose pose state is to be recapture.</param> /// <param name="avatar">The avatar whose pose state is to be recapture.</param>
/// <param name="jointsRecaptured">The joints which were recaptured.</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> /// <summary>
/// Traverses the joints and applies reversals to the base rotations if needed. /// 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="joint">The joint to determine the depth for.</param>
/// <param name="depth">The depth of the supplied joint.</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> /// <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> /// <summary>
/// Derotates the first world-locked child joint to the supplied joint. /// 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 /// 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. /// 'the world', 'avatar pelvis' or the position of the camera relative to the joint.
/// </remarks> /// </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> /// <summary>
/// Maps the avatar's ID to the animation registered to them. /// 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) if (!avatar || !posingMotion)
return; return;
sCaptureOrder[avatar->getID()]++; sCaptureOrder[avatar->getID()]++;
int animNumber = 0; S32 animNumber = 0;
// if an animation for avatar is a subset of jointNumbersRecaptured, delete it // 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 // 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) if (!avatar)
return; return;
int animNumber = 0; S32 animNumber = 0;
for (auto it = sMotionStates[avatar->getID()].begin(); it != sMotionStates[avatar->getID()].end(); ++it) for (auto it = sMotionStates[avatar->getID()].begin(); it != sMotionStates[avatar->getID()].end(); ++it)
{ {
if (!ignoreOwnership && !it->gAgentOwnsPose) 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()); std::sort(sMotionStates[avatar->getID()].begin(), sMotionStates[avatar->getID()].end(), compareByCaptureOrder());
int lastCaptureOrder = 0; S32 lastCaptureOrder = 0;
bool needPriorityReset = false; bool needPriorityReset = false;
for (auto it = sMotionStates[avatar->getID()].begin(); it != sMotionStates[avatar->getID()].end(); it++) 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; 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++) 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) bool FSPoseState::vector2IsSubsetOfVector1(std::vector<S32> newRecapture, std::vector<S32> oldRecapture)
{ {
if (newRecapture.size() < 1) if (newRecapture.empty())
return false; return false;
if (oldRecapture.size() < 1) if (oldRecapture.empty())
return false; return false;
if (newRecapture.size() < oldRecapture.size()) if (newRecapture.size() < oldRecapture.size())
@ -334,10 +334,10 @@ bool FSPoseState::vector2IsSubsetOfVector1(std::vector<S32> newRecapture, std::v
return true; return true;
} }
std::string FSPoseState::encodeVectorToString(std::vector<S32> vector) std::string FSPoseState::encodeVectorToString(const std::vector<S32>& vector)
{ {
std::string encoded = ""; std::string encoded = "";
if (vector.size() < 1) if (vector.empty())
return encoded; return encoded;
for (S32 numberToEncode : vector) for (S32 numberToEncode : vector)
@ -371,7 +371,7 @@ std::string FSPoseState::encodeVectorToString(std::vector<S32> vector)
return encoded; return encoded;
} }
std::vector<S32> FSPoseState::decodeStringToVector(std::string vector) std::vector<S32> FSPoseState::decodeStringToVector(std::string_view vector)
{ {
std::vector<S32> decoded; std::vector<S32> decoded;
if (vector.empty()) if (vector.empty())

View File

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

View File

@ -36,7 +36,7 @@ FSPosingMotion::FSPosingMotion(const LLUUID& id) : LLKeyframeMotion(id)
mJointMotionList = &dummyMotionList; mJointMotionList = &dummyMotionList;
} }
LLMotion::LLMotionInitStatus FSPosingMotion::onInitialize(LLCharacter *character) LLMotion::LLMotionInitStatus FSPosingMotion::onInitialize(LLCharacter* character)
{ {
if (!character) if (!character)
return STATUS_FAILURE; return STATUS_FAILURE;
@ -184,7 +184,7 @@ void FSPosingMotion::removeJointFromState(LLJoint* joint)
void FSPosingMotion::setJointState(LLJoint* joint, U32 state) void FSPosingMotion::setJointState(LLJoint* joint, U32 state)
{ {
if (mJointPoses.size() < 1) if (mJointPoses.empty())
return; return;
if (!joint) if (!joint)
return; return;
@ -208,7 +208,7 @@ void FSPosingMotion::setJointState(LLJoint* joint, U32 state)
FSJointPose* FSPosingMotion::getJointPoseByJointName(const std::string& name) FSJointPose* FSPosingMotion::getJointPoseByJointName(const std::string& name)
{ {
if (name.empty() || mJointPoses.size() < 1) if (name.empty() || mJointPoses.empty())
return nullptr; return nullptr;
for (auto poserJoint_iter = mJointPoses.begin(); poserJoint_iter != mJointPoses.end(); ++poserJoint_iter) 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; return nullptr;
} }
FSJointPose* FSPosingMotion::getJointPoseByJointNumber(const S32& number) FSJointPose* FSPosingMotion::getJointPoseByJointNumber(const S32 number)
{ {
if (mJointPoses.size() < 1) if (mJointPoses.empty())
return nullptr; return nullptr;
if (number < 0) if (number < 0)
return nullptr; return nullptr;
@ -242,13 +242,13 @@ FSJointPose* FSPosingMotion::getJointPoseByJointNumber(const S32& number)
bool FSPosingMotion::currentlyPosingJoint(LLJoint* joint) bool FSPosingMotion::currentlyPosingJoint(LLJoint* joint)
{ {
if (mJointPoses.size() < 1) if (mJointPoses.empty())
return false; return false;
if (!joint) if (!joint)
return false; return false;
LLPose* pose = this->getPose(); LLPose* pose = getPose();
if (!pose) if (!pose)
return false; return false;
@ -288,7 +288,7 @@ void FSPosingMotion::setJointBvhLock(FSJointPose* joint, bool lockInBvh)
joint->zeroBaseRotation(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); FSPosingMotion* motionToLoadAsFsPosingMotion = static_cast<FSPosingMotion*>(motionToLoad);
if (!motionToLoadAsFsPosingMotion) 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); FSPosingMotion* motionToLoadAsFsPosingMotion = static_cast<FSPosingMotion*>(motionToQuery);
if (!motionToLoadAsFsPosingMotion) 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. // 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) if (mJointMotionList == nullptr)
return false; return false;
@ -387,7 +387,7 @@ bool FSPosingMotion::motionAnimatesJoints(std::vector<int> recapturedJointNumber
return false; return false;
} }
void FSPosingMotion::resetBonePriority(std::vector<S32> boneNumbersToReset) void FSPosingMotion::resetBonePriority(const std::vector<S32>& boneNumbersToReset)
{ {
for (S32 boneNumber : 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]) && if (vectorAxesAlmostEqual(v1.mV[VX], v2.mV[VX]) &&
vectorAxesAlmostEqual(v1.mV[VY], v2.mV[VY]) && vectorAxesAlmostEqual(v1.mV[VY], v2.mV[VY]) &&

View File

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

View File

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