Skip to content

[TF2] Add the ability to right-click (or use X button) on Loadout item panels to immediately preview them without having to go through item selection #1304

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

FlaminSarge
Copy link
Contributor

@FlaminSarge FlaminSarge commented May 23, 2025

Description

This reuses the existing MouseRight handling on ItemModelPanel to be able to set m_iCurrentSlotIndex and call UpdateModelPanels() on the playermodelpanel when rightclicking any of the items. Also works for taunts.

Demonstration: https://youtu.be/Hs8lJkTGUDw

@FlaminSarge FlaminSarge changed the title Add the ability to right-click (or use X button) on Loadout item panels to immediately preview them without having to go through item selection [TF2] Add the ability to right-click (or use X button) on Loadout item panels to immediately preview them without having to go through item selection May 23, 2025
…m panels to immediately preview them without having to go through item selection
@@ -686,6 +686,14 @@ void CClassLoadoutPanel::OnKeyCodePressed( vgui::KeyCode code )
OnCommand( VarArgs("change%d", nSelected ) );
}
}
else if ( nButtonCode == KEY_XBUTTON_X || nButtonCode == STEAMCONTROLLER_X )
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to the previous "enter" case, this could use a keyboard shortcut; anyone have any suggestions?

@FlaminSarge FlaminSarge marked this pull request as ready for review May 23, 2025 11:12
if ( m_iCurrentSlotIndex != iSlot )
{
m_iCurrentSlotIndex = iSlot;
UpdateModelPanels();
Copy link
Contributor Author

@FlaminSarge FlaminSarge May 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think UpdateModelPanels() resets the camera, so I'm considering swapping it out for HoldItemInSlot(), looking for feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant