diff options
| author | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2026-08-13 00:27:39 +0300 |
|---|---|---|
| committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2026-08-13 18:18:49 +0300 |
| commit | dcff8c97ea5448f0acaff76fa0a74a89889be678 (patch) | |
| tree | 5a01b8c3a19e14c68031d4e05969ec315f5b1882 | |
| parent | 655402192f9ef58650e6b6f9a01f5748747aa263 (diff) | |
#6127 Ensure Agent command scope is global
| -rw-r--r-- | indra/newview/llavataractions.cpp | 11 | ||||
| -rw-r--r-- | indra/newview/llavataractions.h | 6 | ||||
| -rw-r--r-- | indra/newview/llviewermenu.cpp | 43 |
3 files changed, 37 insertions, 23 deletions
diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index c95e98982d..b6d59a4a39 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -337,6 +337,17 @@ void LLAvatarActions::showProfile(const LLUUID& avatar_id) } } +bool LLAvatarActions::myProfileVisible() +{ + LLFloater* floaterp = getProfileFloater(gAgentID); + return floaterp && floaterp->isInVisibleChain(); +} + +bool LLAvatarActions::myPicksTabVisible() +{ + return myProfileVisible() && isPickTabSelected(gAgentID); +} + // static void LLAvatarActions::showPicks(const LLUUID& avatar_id) { diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h index 1f5a42ed22..90f1e96fb7 100644 --- a/indra/newview/llavataractions.h +++ b/indra/newview/llavataractions.h @@ -109,6 +109,12 @@ public: static LLFloater* getProfileFloater(const LLUUID& avatar_id); /** + * Profile helpers. + */ + static bool myProfileVisible(); + static bool myPicksTabVisible(); + + /** * Show avatar on world map. */ static void showOnMap(const LLUUID& id); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 72ad47be89..a8eee07729 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -4052,17 +4052,6 @@ void handle_avatar_eject(const LLSD& avatar_id) } } -bool my_profile_visible() -{ - LLFloater* floaterp = LLAvatarActions::getProfileFloater(gAgentID); - return floaterp && floaterp->isInVisibleChain(); -} - -bool picks_tab_visible() -{ - return my_profile_visible() && LLAvatarActions::isPickTabSelected(gAgentID); -} - bool enable_freeze_eject(const LLSD& avatar_id) { // Use avatar_id if available, otherwise default to right-click avatar @@ -6749,7 +6738,7 @@ class LLAvatarTogglePicks : public view_listener_t instance->setFocus(true); LLAvatarActions::showPicks(gAgent.getID()); } - else if (picks_tab_visible()) + else if (LLAvatarActions::myPicksTabVisible()) { instance->closeFloater(); } @@ -9792,6 +9781,23 @@ void show_topinfobar_context_menu(LLView* ctrl, S32 x, S32 y) LLMenuGL::showPopup(ctrl, show_topbarinfo_context_menu, x, y); } +static void register_agent_ui_callbacks() +{ + // These functions are used by menu and commands, they need to persist for the lifetime of the application + // Note: executes before LLToolBar::createButton and before menu builds + LLUICtrl::EnableCallbackRegistry::Registrar& global_enable = LLUICtrl::EnableCallbackRegistry::defaultRegistrar(); + LLUICtrl::CommitCallbackRegistry::Registrar& global_commit = LLUICtrl::CommitCallbackRegistry::defaultRegistrar(); + global_commit.add("Agent.toggleFlying", boost::bind(&LLAgent::toggleFlying)); + global_enable.add("Agent.enableFlyLand", boost::bind(&enable_fly_land)); + global_commit.add("Agent.PressMicrophone", boost::bind(&LLAgent::pressMicrophone, _2)); + global_commit.add("Agent.ReleaseMicrophone", boost::bind(&LLAgent::releaseMicrophone, _2)); + global_commit.add("Agent.ToggleMicrophone", boost::bind(&LLAgent::toggleMicrophone, _2)); + global_enable.add("Agent.IsMicrophoneOn", boost::bind(&LLAgent::isMicrophoneOn, _2)); + global_enable.add("Agent.IsActionAllowed", boost::bind(&LLAgent::isActionAllowed, _2)); + global_enable.add("Avatar.IsMyProfileOpen", boost::bind(&LLAvatarActions::myProfileVisible)); + global_enable.add("Avatar.IsPicksTabOpen", boost::bind(&LLAvatarActions::myPicksTabVisible)); +} + void initialize_edit_menu() { view_listener_t::addMenu(new LLEditUndo(), "Edit.Undo"); @@ -9849,6 +9855,8 @@ void initialize_menus() bool mMult; }; + register_agent_ui_callbacks(); + LLUICtrl::EnableCallbackRegistry::Registrar& enable = LLUICtrl::EnableCallbackRegistry::currentRegistrar(); LLUICtrl::CommitCallbackRegistry::Registrar& commit = LLUICtrl::CommitCallbackRegistry::currentRegistrar(); @@ -9864,15 +9872,6 @@ void initialize_menus() enable.add("Conversation.IsConversationLoggingAllowed", boost::bind(&LLFloaterIMContainer::isConversationLoggingAllowed)); - // Agent - commit.add("Agent.toggleFlying", boost::bind(&LLAgent::toggleFlying)); - enable.add("Agent.enableFlyLand", boost::bind(&enable_fly_land)); - commit.add("Agent.PressMicrophone", boost::bind(&LLAgent::pressMicrophone, _2)); - commit.add("Agent.ReleaseMicrophone", boost::bind(&LLAgent::releaseMicrophone, _2)); - commit.add("Agent.ToggleMicrophone", boost::bind(&LLAgent::toggleMicrophone, _2)); - enable.add("Agent.IsMicrophoneOn", boost::bind(&LLAgent::isMicrophoneOn, _2)); - enable.add("Agent.IsActionAllowed", boost::bind(&LLAgent::isActionAllowed, _2)); - // File menu init_menu_file(); @@ -10237,8 +10236,6 @@ void initialize_menus() view_listener_t::addMenu(new LLAvatarResetSkeletonAndAnimations(), "Avatar.ResetSkeletonAndAnimations"); view_listener_t::addMenu(new LLAvatarResetSelfSkeleton(), "Avatar.ResetSelfSkeleton"); view_listener_t::addMenu(new LLAvatarResetSelfSkeletonAndAnimations(), "Avatar.ResetSelfSkeletonAndAnimations"); - enable.add("Avatar.IsMyProfileOpen", boost::bind(&my_profile_visible)); - enable.add("Avatar.IsPicksTabOpen", boost::bind(&picks_tab_visible)); commit.add("Avatar.OpenMarketplace", boost::bind(&LLWeb::loadURLExternal, gSavedSettings.getString("MarketplaceURL"))); |
