FIRE-34747: Tidy up and add UI cues to own work

master
Angeldark Raymaker 2024-11-12 18:41:44 +00:00
parent aad003c9b6
commit 572cea48fc
4 changed files with 77 additions and 7 deletions

View File

@ -158,6 +158,11 @@ bool FSFloaterPoser::postBuild()
if (gSavedSettings.getBOOL(POSER_ADVANCEDWINDOWSTATE_SAVE_KEY))
mToggleAdvancedPanelBtn->setValue(true);
mStopPosingOnCloseCbx = getChild<LLCheckBoxCtrl>("stop_posing_on_close_checkbox");
if (gSavedSettings.getBOOL(POSER_STOPPOSINGWHENCLOSED_SAVE_KEY))
mAlsoSaveBvhCbx->set(true);
mTrackpadSensitivitySlider = getChild<LLSliderCtrl>("trackpad_sensitivity_slider");
mTrackpadSensitivitySlider->setValue(gSavedSettings.getF32(POSER_TRACKPAD_SENSITIVITY_SAVE_KEY));
@ -227,6 +232,9 @@ void FSFloaterPoser::onClose(bool app_quitting)
if (mToggleAdvancedPanelBtn)
gSavedSettings.setBOOL(POSER_ADVANCEDWINDOWSTATE_SAVE_KEY, mToggleAdvancedPanelBtn->getValue().asBoolean());
if (mStopPosingOnCloseCbx)
gSavedSettings.setBOOL(POSER_STOPPOSINGWHENCLOSED_SAVE_KEY, mStopPosingOnCloseCbx->getValue().asBoolean());
if (gSavedSettings.getBOOL(POSER_STOPPOSINGWHENCLOSED_SAVE_KEY))
stopPosingSelf();
@ -655,7 +663,7 @@ void FSFloaterPoser::onClickLoadHandPose(bool isRightHand)
continue;
vec3.setValue(control_map["rotation"]);
mPoserAnimator.setJointRotation(avatar, poserJoint, vec3, NONE, SWAP_NOTHING, NEGATE_NOTHING);
mPoserAnimator.loadJointRotation(avatar, poserJoint, true, vec3);
}
}
}
@ -996,8 +1004,8 @@ LLSD FSFloaterPoser::createRowForJoint(const std::string& jointName, bool isHead
return NULL;
std::string headerValue = "";
if (hasString("icon_category") && hasString("icon_bone"))
headerValue = isHeaderRow ? getString("icon_category") : getString("icon_bone");
if (isHeaderRow && hasString("icon_category"))
headerValue = getString("icon_category");
std::string jointValue = jointName;
std::string parameterName = (isHeaderRow ? XML_LIST_HEADER_STRING_PREFIX : XML_LIST_TITLE_STRING_PREFIX) + jointName;
@ -1154,6 +1162,7 @@ void FSFloaterPoser::onSetAvatarToTpose()
setSavePosesButtonText(false);
mPoserAnimator.setAllAvatarStartingRotationsToZero(avatar);
refreshTextHighlightingOnAllScrollLists();
}
void FSFloaterPoser::onResetPosition()
@ -1718,6 +1727,7 @@ void FSFloaterPoser::setSelectedJointsRotation(F32 yawInRadians, F32 pitchInRadi
E_BoneDeflectionStyles defl = getUiSelectedBoneDeflectionStyle();
LLVector3 vec3 = LLVector3(yawInRadians, pitchInRadians, rollInRadians);
auto selectedJoints = getUiSelectedPoserJoints();
bool savingToBvh = getSavingToBvh();
for (auto item : selectedJoints)
{
@ -1736,8 +1746,11 @@ void FSFloaterPoser::setSelectedJointsRotation(F32 yawInRadians, F32 pitchInRadi
}
mPoserAnimator.setJointRotation(avatar, item, vec3, defl, getJointTranslation(item->jointName()),
getJointNegation(item->jointName()));
getJointNegation(item->jointName()), savingToBvh);
}
if (savingToBvh)
refreshTextHighlightingOnAllScrollLists();
}
void FSFloaterPoser::setSelectedJointsScale(F32 x, F32 y, F32 z)
@ -2089,15 +2102,37 @@ void FSFloaterPoser::addBoldToScrollList(LLScrollListCtrl* list, LLVOAvatar* ava
if (!list)
return;
std::string iconValue = "";
bool considerBvh = getSavingToBvh();
if (considerBvh && hasString("icon_will_save_to_bvh"))
iconValue = getString("icon_will_save_to_bvh");
for (auto listItem : list->getAllData())
{
FSPoserAnimator::FSPoserJoint *userData = static_cast<FSPoserAnimator::FSPoserJoint *>(listItem->getUserdata());
if (!userData)
continue;
if (considerBvh)
{
if (mPoserAnimator.baseRotationIsZero(avatar, *userData))
((LLScrollListText*) listItem->getColumn(COL_ICON))->setValue(iconValue);
else
((LLScrollListText*) listItem->getColumn(COL_ICON))->setValue("");
}
if (mPoserAnimator.isPosingAvatarJoint(avatar, *userData))
((LLScrollListText *) listItem->getColumn(COL_NAME))->setFontStyle(LLFontGL::BOLD);
else
((LLScrollListText *) listItem->getColumn(COL_NAME))->setFontStyle(LLFontGL::NORMAL);
}
}
bool FSFloaterPoser::getSavingToBvh()
{
if (!mAlsoSaveBvhCbx)
return false;
return mAlsoSaveBvhCbx->getValue().asBoolean();
}

View File

@ -399,6 +399,7 @@ class FSFloaterPoser : public LLFloater
LLPanel* mMiscJointsPnl{ nullptr };
LLPanel* mCollisionVolumesPnl{ nullptr };
LLPanel* mPosesLoadSavePnl{ nullptr };
LLCheckBoxCtrl* mStopPosingOnCloseCbx{ nullptr };
};
#endif

View File

@ -407,6 +407,22 @@ void FSPoserAnimator::setJointPosition(LLVOAvatar* avatar, const FSPoserJoint* j
}
}
bool FSPoserAnimator::baseRotationIsZero(LLVOAvatar* avatar, const FSPoserJoint& joint) const
{
if (!isAvatarSafeToUse(avatar))
return false;
FSPosingMotion* posingMotion = getPosingMotion(avatar);
if (!posingMotion)
return false;
FSJointPose* jointPose = posingMotion->getJointPoseByJointName(joint.jointName());
if (!jointPose)
return false;
return jointPose->isBaseRotationZero();
}
bool FSPoserAnimator::allBaseRotationsAreZero(LLVOAvatar* avatar) const
{
if (!isAvatarSafeToUse(avatar))
@ -469,8 +485,8 @@ LLVector3 FSPoserAnimator::getJointRotation(LLVOAvatar* avatar, const FSPoserJoi
return translateRotationFromQuaternion(translation, negation, jointPose->getRotationDelta());
}
void FSPoserAnimator::setJointRotation(LLVOAvatar* avatar, const FSPoserJoint* joint, const LLVector3& rotation, E_BoneDeflectionStyles style,
E_BoneAxisTranslation translation, S32 negation)
void FSPoserAnimator::setJointRotation(LLVOAvatar* avatar, const FSPoserJoint* joint, const LLVector3& rotation, E_BoneDeflectionStyles style, E_BoneAxisTranslation translation, S32 negation,
bool resetBaseRotationToZero)
{
if (!isAvatarSafeToUse(avatar))
return;
@ -485,6 +501,9 @@ void FSPoserAnimator::setJointRotation(LLVOAvatar* avatar, const FSPoserJoint* j
if (!jointPose)
return;
if (resetBaseRotationToZero)
jointPose->zeroBaseRotation();
LLQuaternion rot_quat = translateRotationToQuaternion(translation, negation, rotation);
switch (style)
{
@ -507,6 +526,9 @@ void FSPoserAnimator::setJointRotation(LLVOAvatar* avatar, const FSPoserJoint* j
if (!oppositeJointPose)
return;
if (resetBaseRotationToZero)
oppositeJointPose->zeroBaseRotation();
LLQuaternion inv_quat;
switch (style)
{

View File

@ -451,8 +451,9 @@ public:
/// <param name="style">Any ancilliary action to be taken with the change to be made.</param>
/// <param name="translation">The axial translation form the supplied joint.</param>
/// <param name="negation">The style of negation to apply to the set.</param>
/// <param name="resetBaseRotationToZero">Whether to set the base rotation to zero on setting the rotation.</param>
void setJointRotation(LLVOAvatar* avatar, const FSPoserJoint* joint, const LLVector3& rotation, E_BoneDeflectionStyles style,
E_BoneAxisTranslation translation, S32 negation);
E_BoneAxisTranslation translation, S32 negation, bool resetBaseRotationToZero);
/// <summary>
/// Gets the scale of a joint for the supplied avatar.
@ -499,6 +500,17 @@ public:
/// <param name="avatar">The avatar whose joint rotations should be set to zero.</param>
void setAllAvatarStartingRotationsToZero(LLVOAvatar* avatar);
/// <summary>
/// Determines if the kind of save to perform should be a 'delta' save, or a complete save.
/// </summary>
/// <param name="avatar">The avatar whose pose-rotations are being considered for saving.</param>
/// <returns>True if the save should save only 'deltas' to the rotation, otherwise false.</returns>
/// <remarks>
/// A save of the rotation 'deltas' facilitates a user saving their changes to an existing animation.
/// Thus the save represents 'nothing other than the changes the user made', to some other pose which they may have limited rights to.
/// </remarks>
bool baseRotationIsZero(LLVOAvatar* avatar, const FSPoserJoint& joint) const;
/// <summary>
/// Determines if the kind of save to perform should be a 'delta' save, or a complete save.
/// </summary>