Add undo/redo keyboard accelerator support to poser

master
Beq 2025-03-13 12:46:56 +00:00
parent 4130e9a416
commit eecf28896e
4 changed files with 24 additions and 5 deletions

View File

@ -239,6 +239,19 @@ void FSFloaterPoser::onOpen(const LLSD& key)
LLFloater::onOpen(key);
}
void FSFloaterPoser::onFocusReceived()
{
LLEditMenuHandler::gEditMenuHandler = this;
}
void FSFloaterPoser::onFocusLost()
{
if( LLEditMenuHandler::gEditMenuHandler == this )
{
LLEditMenuHandler::gEditMenuHandler = nullptr;
}
}
void FSFloaterPoser::enableVisualManipulators()
{
if (LLToolMgr::getInstance()->getCurrentToolset() != gCameraToolset)

View File

@ -74,18 +74,23 @@ typedef enum E_Columns
/// A class containing the UI fiddling for the Poser Floater.
/// Please don't do LLJoint stuff here, fsposingmotion (the LLMotion derivative) is the class for that.
/// </summary>
class FSFloaterPoser : public LLFloater
class FSFloaterPoser : public LLFloater, public LLEditMenuHandler
{
friend class LLFloaterReg;
FSFloaterPoser(const LLSD &key);
public:
void updatePosedBones();
void selectJointByName(const std::string& jointName);
void undo() override { onUndoLastChange(); };
bool canUndo() const override { return true; }
void redo() override { onRedoLastChange(); };
bool canRedo() const override { return true; }
private:
bool postBuild() override;
void onOpen(const LLSD& key) override;
void onClose(bool app_quitting) override;
void onFocusReceived() override;
void onFocusLost() override;
/// <summary>
/// Refreshes the supplied pose list from the supplued subdirectory.
/// </summary>

View File

@ -932,14 +932,15 @@ bool FSManipRotateJoint::handleMouseDown(S32 x, S32 y, MASK mask)
*/
bool FSManipRotateJoint::handleMouseDownOnPart(S32 x, S32 y, MASK mask)
{
auto * poser = dynamic_cast<FSFloaterPoser*>(LLFloaterReg::findInstance("fs_poser"));
// Determine which ring (axis) is under the mouse, also highlights selectable joints.
highlightManipulators(x, y);
// For joint manipulation, require both a valid joint and avatar.
if (!mJoint || !mAvatar)
if (!mJoint || !mAvatar || !poser)
{
return false;
}
poser->setFocus(true);
S32 hit_part = mHighlightedPart;
// Save the joints current world rotation as the basis for the drag.

View File

@ -937,7 +937,7 @@ width="430">
tool_tip="Toggle the visual manipulators on and off"
height="50"
width="50"
left="2"
left="5"
bottom_delta="5"
>
<button.commit_callback