From ed6ecca2a45e52d9be1d91107b9643b5ecdfb8bf Mon Sep 17 00:00:00 2001 From: Leviathan Linden Date: Thu, 16 Nov 2023 13:53:37 -0800 Subject: avatar_motion-->GameControl translation and flycam --- indra/newview/llfloaterpreference.h | 104 +++++++++++++++++++++++++++--------- 1 file changed, 79 insertions(+), 25 deletions(-) (limited to 'indra/newview/llfloaterpreference.h') diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index 40806c22fc..22421f296c 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -36,6 +36,7 @@ #include "llfloater.h" #include "llavatarpropertiesprocessor.h" #include "llconversationlog.h" +#include "llgamecontroltranslator.h" #include "llsearcheditor.h" #include "llsetkeybinddialog.h" #include "llkeyconflict.h" @@ -51,6 +52,7 @@ class LLScrollListCell; class LLSliderCtrl; class LLSD; class LLTextBox; +class LLPanelPreferenceGameControl; namespace ll { @@ -80,12 +82,12 @@ public: void apply(); void cancel(const std::vector settings_to_skip = {}); - /*virtual*/ void draw(); - /*virtual*/ bool postBuild(); - /*virtual*/ void onOpen(const LLSD& key); - /*virtual*/ void onClose(bool app_quitting); - /*virtual*/ void changed(); - /*virtual*/ void changed(const LLUUID& session_id, U32 mask) {}; + virtual void draw() override; + virtual bool postBuild() override; + virtual void onOpen(const LLSD& key) override; + virtual void onClose(bool app_quitting) override; + virtual void changed() override; + virtual void changed(const LLUUID& session_id, U32 mask) override {}; // static data update, called from message handler static void updateUserInfo(const std::string& visibility); @@ -99,8 +101,7 @@ public: // update Show Favorites checkbox static void updateShowFavoritesCheckbox(bool val); - void processProperties( void* pData, EAvatarProcessorType type ); - void saveAvatarProperties( void ); + void processProperties( void* pData, EAvatarProcessorType type ) override; static void saveAvatarPropertiesCoro(const std::string url, bool allow_publish); void selectPrivacyPanel(); void selectChatPanel(); @@ -251,7 +252,7 @@ class LLPanelPreference : public LLPanel { public: LLPanelPreference(); - /*virtual*/ bool postBuild(); + virtual bool postBuild() override; virtual ~LLPanelPreference(); @@ -297,14 +298,16 @@ private: class LLPanelPreferenceGraphics : public LLPanelPreference { public: - bool postBuild(); - void draw(); - void cancel(const std::vector settings_to_skip = {}); - void saveSettings(); + bool postBuild() override; + void draw() override; + void cancel(const std::vector settings_to_skip = {}) override; + void saveSettings() override; void resetDirtyChilds(); - void setHardwareDefaults(); + void setHardwareDefaults() override; void setPresetText(); + static const std::string getPresetsPath(); + protected: bool hasDirtyChilds(); @@ -320,11 +323,11 @@ public: LLPanelPreferenceControls(); virtual ~LLPanelPreferenceControls(); - bool postBuild(); + bool postBuild() override; - void apply(); - void cancel(const std::vector settings_to_skip = {}); - void saveSettings(); + void apply() override; + void cancel(const std::vector settings_to_skip = {}) override; + void saveSettings() override; void resetDirtyChilds(); void onListCommit(); @@ -340,9 +343,9 @@ public: void updateAndApply(); // from interface - /*virtual*/ bool onSetKeyBind(EMouseClickType click, KEY key, MASK mask, bool all_modes); - /*virtual*/ void onDefaultKeyBind(bool all_modes); - /*virtual*/ void onCancelKeyBind(); + bool onSetKeyBind(EMouseClickType click, KEY key, MASK mask, bool all_modes) override; + void onDefaultKeyBind(bool all_modes) override; + void onCancelKeyBind() override; private: // reloads settings, discards current changes, updates table @@ -367,6 +370,57 @@ private: S32 mEditingMode; }; +class LLPanelPreferenceGameControl : public LLPanelPreference +{ +public: + + enum InputType + { + TYPE_AXIS, + TYPE_BUTTON, + TYPE_NONE + }; + + LLPanelPreferenceGameControl(); + ~LLPanelPreferenceGameControl(); + + void apply() override; + void loadDefaults(); + void loadSettings(); + void saveSettings() override; + void updateEnabledState(); + + void onClickGameControlToServer(LLUICtrl* ctrl); + // "Agent" in this context means either Avatar or Flycam + void onClickGameControlToAgent(LLUICtrl* ctrl); + void onClickAgentToGameControl(LLUICtrl* ctrl); + void onActionSelect(); + void onCommitInputChannel(); + + static bool isWaitingForInputChannel(); + static void applyGameControlInput(const LLGameControl::InputChannel& channel); +protected: + bool postBuild() override; + + void populateActionTable(); + void populateColumns(); + void populateRows(const std::string& filename); + +private: + void clearSelectionState(); + void addTableSeparator(); + void updateTable(); + LOG_CLASS(LLPanelPreferenceGameControl); + + LLCheckBoxCtrl *mCheckGameControlToServer; // send game_control data to server + LLCheckBoxCtrl *mCheckGameControlToAgent; // use game_control data to move avatar + LLCheckBoxCtrl *mCheckAgentToGameControl; // translate external avatar actions to game_control data + + LLScrollListCtrl* mActionTable; + LLComboBox* mChannelSelector; + LLGameControlTranslator mActionTranslator; +}; + class LLAvatarComplexityControls { public: @@ -391,13 +445,13 @@ public: void cancel(); protected: - bool postBuild(); - void onOpen(const LLSD& key); - void onClose(bool app_quitting); + bool postBuild() override; + void onOpen(const LLSD& key) override; + void onClose(bool app_quitting) override; void saveSettings(); void onBtnOk(); void onBtnCancel(); - void onClickCloseBtn(bool app_quitting = false); + void onClickCloseBtn(bool app_quitting = false) override; void onChangeSocksSettings(); -- cgit v1.2.3 From 2daf175650cdda7cc8f820b6cb17b1475496e7ac Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Wed, 8 May 2024 23:32:58 +0200 Subject: Add GameControl UI for per device settings --- indra/newview/llfloaterpreference.h | 103 +++++++++++++++++++++++++++--------- 1 file changed, 79 insertions(+), 24 deletions(-) (limited to 'indra/newview/llfloaterpreference.h') diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index 22421f296c..810bb7d6ac 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -36,10 +36,13 @@ #include "llfloater.h" #include "llavatarpropertiesprocessor.h" #include "llconversationlog.h" -#include "llgamecontroltranslator.h" +#include "llgamecontrol.h" +#include "llkeyconflict.h" +#include "llscrolllistcell.h" +#include "llscrolllistctrl.h" #include "llsearcheditor.h" #include "llsetkeybinddialog.h" -#include "llkeyconflict.h" +#include "llspinctrl.h" class LLConversationLogObserver; class LLPanelPreference; @@ -102,6 +105,7 @@ public: static void updateShowFavoritesCheckbox(bool val); void processProperties( void* pData, EAvatarProcessorType type ) override; + void saveAvatarProperties( void ); static void saveAvatarPropertiesCoro(const std::string url, bool allow_publish); void selectPrivacyPanel(); void selectChatPanel(); @@ -306,8 +310,6 @@ public: void setHardwareDefaults() override; void setPresetText(); - static const std::string getPresetsPath(); - protected: bool hasDirtyChilds(); @@ -372,6 +374,7 @@ private: class LLPanelPreferenceGameControl : public LLPanelPreference { + LOG_CLASS(LLPanelPreferenceGameControl); public: enum InputType @@ -384,41 +387,93 @@ public: LLPanelPreferenceGameControl(); ~LLPanelPreferenceGameControl(); - void apply() override; - void loadDefaults(); - void loadSettings(); + void onOpen(const LLSD& key) override; void saveSettings() override; - void updateEnabledState(); - void onClickGameControlToServer(LLUICtrl* ctrl); - // "Agent" in this context means either Avatar or Flycam - void onClickGameControlToAgent(LLUICtrl* ctrl); - void onClickAgentToGameControl(LLUICtrl* ctrl); - void onActionSelect(); - void onCommitInputChannel(); + void onGridSelect(LLUICtrl* ctrl); + void onCommitInputChannel(LLUICtrl* ctrl); + + void onAxisOptionsSelect(); + void onCommitNumericValue(); static bool isWaitingForInputChannel(); - static void applyGameControlInput(const LLGameControl::InputChannel& channel); + static void applyGameControlInput(); + protected: bool postBuild() override; - void populateActionTable(); - void populateColumns(); - void populateRows(const std::string& filename); + void populateActionTableRows(const std::string& filename); + void populateActionTableCells(); + static bool parseXmlFile(LLScrollListCtrl::Contents& contents, + const std::string& filename, const std::string& what); + + void populateDeviceTitle(); + void populateDeviceSettings(const std::string& guid); + void populateOptionsTableRows(); + void populateOptionsTableCells(); + void populateMappingTableRows(LLScrollListCtrl* target, + const LLComboBox* source, size_t row_count); + void populateMappingTableCells(LLScrollListCtrl* target, + const std::vector& mappings, const LLComboBox* source); + LLGameControl::Options& getSelectedDeviceOptions(); + + static std::string getChannelLabel(const std::string& channelName, + const std::vector& items); + static void setNumericLabel(LLScrollListCell* cell, S32 value); + static void fitInRect(LLUICtrl* ctrl, LLScrollListCtrl* grid, S32 row_index, S32 col_index); private: + bool initCombobox(LLScrollListItem* item, LLScrollListCtrl* grid); void clearSelectionState(); - void addTableSeparator(); - void updateTable(); - LOG_CLASS(LLPanelPreferenceGameControl); - + void addActionTableSeparator(); + void updateActionTableState(); + void onResetToDefaults(); + void resetChannelMappingsToDefaults(); + void resetAxisOptionsToDefaults(); + void resetAxisMappingsToDefaults(); + void resetButtonMappingsToDefaults(); + + // Above the tab container LLCheckBoxCtrl *mCheckGameControlToServer; // send game_control data to server LLCheckBoxCtrl *mCheckGameControlToAgent; // use game_control data to move avatar LLCheckBoxCtrl *mCheckAgentToGameControl; // translate external avatar actions to game_control data + // 1st tab "Channel mappings" + LLPanel* mTabChannelMappings; LLScrollListCtrl* mActionTable; - LLComboBox* mChannelSelector; - LLGameControlTranslator mActionTranslator; + + // 2nd tab "Device settings" + LLPanel* mTabDeviceSettings; + LLTextBox* mNoDeviceMessage; + LLTextBox* mDevicePrompt; + LLTextBox* mSingleDevice; + LLComboBox* mDeviceList; + LLCheckBoxCtrl* mCheckShowAllDevices; + LLPanel* mPanelDeviceSettings; + LLPanel* mTabAxisOptions; + LLScrollListCtrl* mAxisOptions; + LLPanel* mTabAxisMappings; + LLScrollListCtrl* mAxisMappings; + LLPanel* mTabButtonMappings; + LLScrollListCtrl* mButtonMappings; + + LLButton* mResetToDefaults; + + // Numeric value editor + LLSpinCtrl* mNumericValueEditor; + + // Channel selectors + LLComboBox* mAnalogChannelSelector; + LLComboBox* mBinaryChannelSelector; + LLComboBox* mAxisSelector; + + struct DeviceOptions + { + std::string name, settings; + LLGameControl::Options options; + }; + std::map mDeviceOptions; + std::string mSelectedDeviceGUID; }; class LLAvatarComplexityControls -- cgit v1.2.3 From 9c986bef6704ac07112e18dc82b870acf1847e41 Mon Sep 17 00:00:00 2001 From: leviathan Date: Thu, 27 Jun 2024 00:18:42 -0700 Subject: put GameControl behind a feature flag --- indra/newview/llfloaterpreference.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloaterpreference.h') diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index 810bb7d6ac..1a498c035e 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -172,7 +172,7 @@ public: void setPersonalInfo(const std::string& visibility); void refreshEnabledState(); void onCommitWindowedMode(); - void refresh(); // Refresh enable/disable + void refresh() override; // Refresh enable/disable // if the quality radio buttons are changed void onChangeQuality(const LLSD& data); @@ -426,6 +426,7 @@ private: bool initCombobox(LLScrollListItem* item, LLScrollListCtrl* grid); void clearSelectionState(); void addActionTableSeparator(); + void updateEnable(); void updateActionTableState(); void onResetToDefaults(); void resetChannelMappingsToDefaults(); @@ -434,6 +435,7 @@ private: void resetButtonMappingsToDefaults(); // Above the tab container + LLCheckBoxCtrl *mCheckEnableGameControl; LLCheckBoxCtrl *mCheckGameControlToServer; // send game_control data to server LLCheckBoxCtrl *mCheckGameControlToAgent; // use game_control data to move avatar LLCheckBoxCtrl *mCheckAgentToGameControl; // translate external avatar actions to game_control data -- cgit v1.2.3 From 59ed92522f7b72731911825a831bab559f0c1c8b Mon Sep 17 00:00:00 2001 From: leviathan Date: Wed, 17 Jul 2024 15:25:22 -0700 Subject: even more correct GameControl feature-flag switch --- indra/newview/llfloaterpreference.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'indra/newview/llfloaterpreference.h') diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index 1a498c035e..b3872958ac 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -92,6 +92,8 @@ public: virtual void changed() override; virtual void changed(const LLUUID& session_id, U32 mask) override {}; + static void refreshInstance(); + // static data update, called from message handler static void updateUserInfo(const std::string& visibility); @@ -201,6 +203,7 @@ public: void buildPopupLists(); static void refreshSkin(void* data); void selectPanel(const LLSD& name); + void setPanelVisibility(const LLSD& name, bool visible); void saveGraphicsPreset(std::string& preset); void setRecommendedSettings(); @@ -327,6 +330,8 @@ public: bool postBuild() override; + void refresh() override; + void apply() override; void cancel(const std::vector settings_to_skip = {}) override; void saveSettings() override; @@ -349,6 +354,9 @@ public: void onDefaultKeyBind(bool all_modes) override; void onCancelKeyBind() override; + // Cleans content and then adds content from xml files according to current mEditingMode + void populateControlTable(); + private: // reloads settings, discards current changes, updates table void regenerateControls(); @@ -358,9 +366,6 @@ private: bool addControlTableRows(const std::string &filename); void addControlTableSeparator(); - // Cleans content and then adds content from xml files according to current mEditingMode - void populateControlTable(); - // Updates keybindings from storage to table void updateTable(); @@ -435,7 +440,6 @@ private: void resetButtonMappingsToDefaults(); // Above the tab container - LLCheckBoxCtrl *mCheckEnableGameControl; LLCheckBoxCtrl *mCheckGameControlToServer; // send game_control data to server LLCheckBoxCtrl *mCheckGameControlToAgent; // use game_control data to move avatar LLCheckBoxCtrl *mCheckAgentToGameControl; // translate external avatar actions to game_control data -- cgit v1.2.3 From 8213a0fb6b3149042d6833c8f0c4a3c1bfdc8bc9 Mon Sep 17 00:00:00 2001 From: leviathan Date: Tue, 27 Aug 2024 16:18:57 -0700 Subject: more correct application of GameControl prefs --- indra/newview/llfloaterpreference.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'indra/newview/llfloaterpreference.h') diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index b3872958ac..57eaa193a3 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -389,12 +389,19 @@ public: TYPE_NONE }; + static void updateDeviceList(); + LLPanelPreferenceGameControl(); ~LLPanelPreferenceGameControl(); void onOpen(const LLSD& key) override; + + // This function squirrels away the current values of the controls so that + // cancel() can restore them. void saveSettings() override; + void updateDeviceListInternal(); + void onGridSelect(LLUICtrl* ctrl); void onCommitInputChannel(LLUICtrl* ctrl); -- cgit v1.2.3 From 0617923ae7f450ece7288f8a73446c45a8ed32db Mon Sep 17 00:00:00 2001 From: leviathan Date: Tue, 3 Sep 2024 15:38:35 -0700 Subject: remove crashy LLSD ctor used by GameControl --- indra/newview/llfloaterpreference.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/llfloaterpreference.h') diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index 57eaa193a3..33d1cb0c87 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -447,9 +447,9 @@ private: void resetButtonMappingsToDefaults(); // Above the tab container - LLCheckBoxCtrl *mCheckGameControlToServer; // send game_control data to server - LLCheckBoxCtrl *mCheckGameControlToAgent; // use game_control data to move avatar - LLCheckBoxCtrl *mCheckAgentToGameControl; // translate external avatar actions to game_control data + LLCheckBoxCtrl* mCheckGameControlToServer; // send game_control data to server + LLCheckBoxCtrl* mCheckGameControlToAgent; // use game_control data to move avatar + LLCheckBoxCtrl* mCheckAgentToGameControl; // translate external avatar actions to game_control data // 1st tab "Channel mappings" LLPanel* mTabChannelMappings; -- cgit v1.2.3 From ea650ac073aeb03ab99b88c41f51ce636ce37982 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Thu, 3 Oct 2024 12:08:26 -0700 Subject: fix GameControl save settings, fix linux build --- indra/newview/llfloaterpreference.h | 48 ++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'indra/newview/llfloaterpreference.h') diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index 33d1cb0c87..e06e758e3a 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -447,38 +447,38 @@ private: void resetButtonMappingsToDefaults(); // Above the tab container - LLCheckBoxCtrl* mCheckGameControlToServer; // send game_control data to server - LLCheckBoxCtrl* mCheckGameControlToAgent; // use game_control data to move avatar - LLCheckBoxCtrl* mCheckAgentToGameControl; // translate external avatar actions to game_control data + LLCheckBoxCtrl* mCheckGameControlToServer { nullptr }; // send game_control data to server + LLCheckBoxCtrl* mCheckGameControlToAgent { nullptr }; // use game_control data to move avatar + LLCheckBoxCtrl* mCheckAgentToGameControl { nullptr }; // translate external avatar actions to game_control data // 1st tab "Channel mappings" - LLPanel* mTabChannelMappings; - LLScrollListCtrl* mActionTable; + LLPanel* mTabChannelMappings { nullptr }; + LLScrollListCtrl* mActionTable { nullptr }; // 2nd tab "Device settings" - LLPanel* mTabDeviceSettings; - LLTextBox* mNoDeviceMessage; - LLTextBox* mDevicePrompt; - LLTextBox* mSingleDevice; - LLComboBox* mDeviceList; - LLCheckBoxCtrl* mCheckShowAllDevices; - LLPanel* mPanelDeviceSettings; - LLPanel* mTabAxisOptions; - LLScrollListCtrl* mAxisOptions; - LLPanel* mTabAxisMappings; - LLScrollListCtrl* mAxisMappings; - LLPanel* mTabButtonMappings; - LLScrollListCtrl* mButtonMappings; - - LLButton* mResetToDefaults; + LLPanel* mTabDeviceSettings { nullptr }; + LLTextBox* mNoDeviceMessage { nullptr }; + LLTextBox* mDevicePrompt { nullptr }; + LLTextBox* mSingleDevice { nullptr }; + LLComboBox* mDeviceList { nullptr }; + LLCheckBoxCtrl* mCheckShowAllDevices { nullptr }; + LLPanel* mPanelDeviceSettings { nullptr }; + LLPanel* mTabAxisOptions { nullptr }; + LLScrollListCtrl* mAxisOptions { nullptr }; + LLPanel* mTabAxisMappings { nullptr }; + LLScrollListCtrl* mAxisMappings { nullptr }; + LLPanel* mTabButtonMappings { nullptr }; + LLScrollListCtrl* mButtonMappings { nullptr }; + + LLButton* mResetToDefaults { nullptr }; // Numeric value editor - LLSpinCtrl* mNumericValueEditor; + LLSpinCtrl* mNumericValueEditor { nullptr }; // Channel selectors - LLComboBox* mAnalogChannelSelector; - LLComboBox* mBinaryChannelSelector; - LLComboBox* mAxisSelector; + LLComboBox* mAnalogChannelSelector { nullptr }; + LLComboBox* mBinaryChannelSelector { nullptr }; + LLComboBox* mAxisSelector { nullptr }; struct DeviceOptions { -- cgit v1.2.3