summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/settings.xml11
-rw-r--r--indra/newview/llagent.cpp2
-rw-r--r--indra/newview/llappviewer.cpp7
-rw-r--r--indra/newview/llfloaterjoystick.cpp17
-rw-r--r--indra/newview/llfloaterpreference.cpp51
-rw-r--r--indra/newview/llfloaterpreference.h4
-rw-r--r--indra/newview/llviewerjoystick.cpp27
-rw-r--r--indra/newview/llviewerjoystick.h16
-rw-r--r--indra/newview/llviewermenu.cpp50
-rw-r--r--indra/newview/skins/default/xui/en/menu_viewer.xml23
-rw-r--r--indra/newview/tests/llviewerhelputil_test.cpp2
11 files changed, 161 insertions, 49 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 2e520037b3..2057ddaa0d 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -2612,6 +2612,17 @@
<key>Value</key>
<integer>1</integer>
</map>
+ <key>GameControl</key>
+ <map>
+ <key>Comment</key>
+ <string>Enable GameControl feature</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>0</integer>
+ </map>
<key>GameControlToServer</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 63c84b91cf..53929051da 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -5000,7 +5000,7 @@ static S32 g_deltaFrame { 0 };
void LLAgent::applyExternalActionFlags()
{
- if (! LLGameControl::willControlAvatar())
+ if (! LLGameControl::isEnabled() || ! LLGameControl::willControlAvatar())
{
return;
}
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index dcd2a2f98d..c99f7365ab 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -4811,6 +4811,7 @@ void LLAppViewer::idle()
send_agent_update(false);
+ // Some GameControl stuff needs to be executed even when the feature is not enabled
// Note: we process game_control before sending AgentUpdate
// because it may translate to control flags that control avatar motion.
LLGameControl::processEvents(gFocusMgr.getAppHasFocus());
@@ -4832,7 +4833,11 @@ void LLAppViewer::idle()
sendGameControlInput();
}
- gAgent.setExternalActionFlags(action_flags);
+ // This GameControl stuff should NOT be executed when it isn't enabled
+ if (LLGameControl::isEnabled())
+ {
+ gAgent.setExternalActionFlags(action_flags);
+ }
// When appropriate, update agent location to the simulator.
F32 agent_update_time = agent_update_timer.getElapsedTimeF32();
diff --git a/indra/newview/llfloaterjoystick.cpp b/indra/newview/llfloaterjoystick.cpp
index 1f7f97aad5..4736e30036 100644
--- a/indra/newview/llfloaterjoystick.cpp
+++ b/indra/newview/llfloaterjoystick.cpp
@@ -44,6 +44,7 @@
#include "llwindow.h"
#include "llcheckboxctrl.h"
#include "llcombobox.h"
+#include "llgamecontrol.h"
#if LL_WINDOWS && !LL_MESA_HEADLESS
// Require DirectInput version 8
@@ -78,8 +79,12 @@ BOOL CALLBACK di8_list_devices_callback(LPCDIDEVICEINSTANCE device_instance_ptr,
// Capable of detecting devices like Oculus Rift
if (device_instance_ptr && pvRef)
{
+ // We always include the device if it is from 3DConnexion, otherwise
+ // if the GameControl feature is enabled then we perfer to route other devices to it.
std::string product_name = utf16str_to_utf8str(llutf16string(device_instance_ptr->tszProductName));
- if (LLViewerJoystick::is3DConnexionDevice(product_name))
+ bool include_device = LLViewerJoystick::is3DConnexionDevice(product_name) || !LLGameControl::isEnabled();
+
+ if (include_device)
{
S32 size = sizeof(GUID);
LLSD::Binary data; //just an std::vector
@@ -306,11 +311,13 @@ void LLFloaterJoystick::refreshListOfDevices()
#if LL_WINDOWS && !LL_MESA_HEADLESS
LL_WARNS() << "NDOF connected to device without using SL provided handle" << LL_ENDL;
#endif
- // This feature used to support various gamepad devices however
- // going forward we will restrict it to 3DConnexion devices (SpaceMouse, etc)
- // and will handle gamepads with the GameControl feature.
+ // We always include the device if it is from 3DConnexion, otherwise we only
+ // support the device in this context when GameControl feature is disabled.
std::string desc = LLViewerJoystick::getInstance()->getDescription();
- if (LLViewerJoystick::is3DConnexionDevice(desc))
+ bool include_device = LLViewerJoystick::is3DConnexionDevice(desc) ||
+ (!LLGameControl::isEnabled() && !desc.empty());
+
+ if (include_device)
{
LLSD value = LLSD::Integer(1); // value for selection
addDevice(desc, value);
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index 2aa54eef57..3c4eab0282 100644
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -3284,7 +3284,7 @@ bool LLPanelPreferenceGameControl::initCombobox(LLScrollListItem* item, LLScroll
}
combobox->setValue(value);
- combobox->setVisible(TRUE);
+ combobox->setVisible(true);
combobox->showList();
gSelectedGrid = grid;
@@ -3404,7 +3404,7 @@ void LLPanelPreferenceGameControl::onAxisOptionsSelect()
mNumericValueEditor->setMaxValue(LLGameControl::MAX_AXIS_OFFSET);
mNumericValueEditor->setValue(deviceOptions.getAxisOptions()[row_index].mOffset);
}
- mNumericValueEditor->setVisible(TRUE);
+ mNumericValueEditor->setVisible(true);
}
initCombobox(row, mAxisOptions);
@@ -3437,13 +3437,15 @@ void LLPanelPreferenceGameControl::onCommitNumericValue()
}
}
-BOOL LLPanelPreferenceGameControl::postBuild()
+bool LLPanelPreferenceGameControl::postBuild()
{
// Above the tab container
+ mCheckEnableGameControl = getChild<LLCheckBoxCtrl>("enable_game_control");
mCheckGameControlToServer = getChild<LLCheckBoxCtrl>("game_control_to_server");
mCheckGameControlToAgent = getChild<LLCheckBoxCtrl>("game_control_to_agent");
mCheckAgentToGameControl = getChild<LLCheckBoxCtrl>("agent_to_game_control");
+ mCheckEnableGameControl->setCommitCallback([this](LLUICtrl*, const LLSD&) { updateEnable(); });
mCheckGameControlToAgent->setCommitCallback([this](LLUICtrl*, const LLSD&) { updateActionTableState(); });
mCheckAgentToGameControl->setCommitCallback([this](LLUICtrl*, const LLSD&) { updateActionTableState(); });
@@ -3513,13 +3515,14 @@ BOOL LLPanelPreferenceGameControl::postBuild()
mAxisOptions->setRect(rect);
mAxisOptions->updateLayout();
- return TRUE;
+ return true;
}
// Update all UI control values from real objects
// This function is called before floater is shown
void LLPanelPreferenceGameControl::onOpen(const LLSD& key)
{
+ mCheckEnableGameControl->setValue(LLGameControl::isEnabled());
mCheckGameControlToServer->setValue(LLGameControl::getSendToServer());
mCheckGameControlToAgent->setValue(LLGameControl::getControlAgent());
mCheckAgentToGameControl->setValue(LLGameControl::getTranslateAgentActions());
@@ -3549,6 +3552,8 @@ void LLPanelPreferenceGameControl::onOpen(const LLSD& key)
mCheckShowAllDevices->setValue(false);
populateDeviceTitle();
+
+ updateEnable();
}
void LLPanelPreferenceGameControl::populateActionTableRows(const std::string& filename)
@@ -3855,10 +3860,10 @@ void LLPanelPreferenceGameControl::clearSelectionState()
gSelectedGrid = nullptr;
gSelectedItem = nullptr;
gSelectedCell = nullptr;
- mNumericValueEditor->setVisible(FALSE);
- mAnalogChannelSelector->setVisible(FALSE);
- mBinaryChannelSelector->setVisible(FALSE);
- mAxisSelector->setVisible(FALSE);
+ mNumericValueEditor->setVisible(false);
+ mAnalogChannelSelector->setVisible(false);
+ mBinaryChannelSelector->setVisible(false);
+ mAxisSelector->setVisible(false);
}
void LLPanelPreferenceGameControl::addActionTableSeparator()
@@ -3875,15 +3880,39 @@ void LLPanelPreferenceGameControl::addActionTableSeparator()
mActionTable->addRow(separator_params, EAddPosition::ADD_BOTTOM);
}
+void LLPanelPreferenceGameControl::updateEnable()
+{
+ bool enabled = mCheckEnableGameControl->get();
+ LLGameControl::setEnabled(enabled);
+
+ mCheckGameControlToServer->setEnabled(enabled);
+ mCheckGameControlToAgent->setEnabled(enabled);
+ mCheckAgentToGameControl->setEnabled(enabled);
+
+ mActionTable->setEnabled(enabled);
+ mAxisOptions->setEnabled(enabled);
+ mAxisMappings->setEnabled(enabled);
+ mButtonMappings->setEnabled(enabled);
+ mDeviceList->setEnabled(enabled);
+
+ if (!enabled)
+ {
+ //mActionTable->deselectAllItems();
+ mAnalogChannelSelector->setVisible(false);
+ mBinaryChannelSelector->setVisible(false);
+ clearSelectionState();
+ }
+}
+
void LLPanelPreferenceGameControl::updateActionTableState()
{
// Enable the table if at least one of the GameControl<-->Agent options is enabled
- bool enable_table = mCheckGameControlToAgent->get() || mCheckAgentToGameControl->get();
+ bool enable_table = LLGameControl::isEnabled() && (mCheckGameControlToAgent->get() || mCheckAgentToGameControl->get());
mActionTable->deselectAllItems();
mActionTable->setEnabled(enable_table);
- mAnalogChannelSelector->setVisible(FALSE);
- mBinaryChannelSelector->setVisible(FALSE);
+ mAnalogChannelSelector->setVisible(false);
+ mBinaryChannelSelector->setVisible(false);
}
void LLPanelPreferenceGameControl::onResetToDefaults()
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
diff --git a/indra/newview/llviewerjoystick.cpp b/indra/newview/llviewerjoystick.cpp
index 42238da418..416f6a476a 100644
--- a/indra/newview/llviewerjoystick.cpp
+++ b/indra/newview/llviewerjoystick.cpp
@@ -41,6 +41,7 @@
#include "llagent.h"
#include "llagentcamera.h"
#include "llfocusmgr.h"
+#include "llgamecontrol.h"
#if LL_WINDOWS && !LL_MESA_HEADLESS
// Require DirectInput version 8
@@ -148,12 +149,18 @@ BOOL CALLBACK di8_devices_callback(LPCDIDEVICEINSTANCE device_instance_ptr, LPVO
LLSD guid = LLViewerJoystick::getInstance()->getDeviceUUID();
- bool init_device = LLViewerJoystick::is3DConnexionDevice(product_name);
- if (init_device && guid.isBinary())
+ bool init_device = false;
+ if (guid.isBinary())
{
std::vector<U8> bin_bucket = guid.asBinary();
init_device = memcmp(&bin_bucket[0], &device_instance_ptr->guidInstance, sizeof(GUID)) == 0;
}
+ else
+ {
+ // It might be better to init space navigator here, but if system doesn't has one,
+ // ndof will pick a random device, it is simpler to pick first device now to have an id
+ init_device = true;
+ }
if (init_device)
{
@@ -283,6 +290,7 @@ NDOF_HotPlugResult LLViewerJoystick::HotPlugAddCallback(NDOF_Device *dev)
ndof_dump(stderr, dev);
joystick->mNdofDev = dev;
joystick->mDriverState = JDS_INITIALIZED;
+ joystick->mDeviceIs3DConnexion = is3DConnexionDevice(joystick->mNdofDev->product);
res = NDOF_KEEP_HOTPLUGGED;
}
joystick->updateEnabled(true);
@@ -308,18 +316,11 @@ void LLViewerJoystick::HotPlugRemovalCallback(NDOF_Device *dev)
// -----------------------------------------------------------------------------
LLViewerJoystick::LLViewerJoystick()
-: mDriverState(JDS_UNINITIALIZED),
- mNdofDev(NULL),
- mResetFlag(false),
- mCameraUpdated(true),
- mOverrideCamera(false),
- mJoystickRun(0)
{
for (int i = 0; i < 6; i++)
{
mAxes[i] = sDelta[i] = sLastDelta[i] = 0.0f;
}
-
memset(mBtn, 0, sizeof(mBtn));
// factor in bandwidth? bandwidth = gViewerStats->mKBitStat
@@ -398,6 +399,7 @@ void LLViewerJoystick::init(bool autoenable)
else
{
mDriverState = JDS_INITIALIZED;
+ mDeviceIs3DConnexion = is3DConnexionDevice(mNdofDev->product);
}
}
#endif
@@ -494,6 +496,7 @@ void LLViewerJoystick::initDevice(LLSD &guid)
else
{
mDriverState = JDS_INITIALIZED;
+ mDeviceIs3DConnexion = is3DConnexionDevice(mNdofDev->product);
}
}
#endif
@@ -578,6 +581,7 @@ bool LLViewerJoystick::initDevice(void * preffered_device /* LPDIRECTINPUTDEVICE
else
{
mDriverState = JDS_INITIALIZED;
+ mDeviceIs3DConnexion = is3DConnexionDevice(mNdofDev->product);
return true;
}
#endif
@@ -593,6 +597,7 @@ void LLViewerJoystick::terminate()
ndof_libcleanup(); // frees alocated memory in mNdofDev
mDriverState = JDS_UNINITIALIZED;
mNdofDev = NULL;
+ mDeviceIs3DConnexion = false;
LL_INFOS("Joystick") << "Terminated connection with NDOF device." << LL_ENDL;
}
#endif
@@ -1344,7 +1349,9 @@ bool LLViewerJoystick::toggleFlycam()
void LLViewerJoystick::scanJoystick()
{
- if (mDriverState != JDS_INITIALIZED || !gSavedSettings.getBOOL("JoystickEnabled"))
+ if (mDriverState != JDS_INITIALIZED
+ || !gSavedSettings.getBOOL("JoystickEnabled")
+ || (!mDeviceIs3DConnexion && LLGameControl::isEnabled()))
{
return;
}
diff --git a/indra/newview/llviewerjoystick.h b/indra/newview/llviewerjoystick.h
index b4fe3877f4..aaf9abb437 100644
--- a/indra/newview/llviewerjoystick.h
+++ b/indra/newview/llviewerjoystick.h
@@ -102,19 +102,21 @@ protected:
private:
F32 mAxes[6];
long mBtn[16];
- EJoystickDriverState mDriverState;
- NDOF_Device *mNdofDev;
- bool mResetFlag;
- F32 mPerfScale;
- bool mCameraUpdated;
- bool mOverrideCamera;
- U32 mJoystickRun;
+ EJoystickDriverState mDriverState { JDS_UNINITIALIZED };
+ NDOF_Device *mNdofDev { nullptr };
// Windows: _GUID as U8 binary map
// MacOS: long as an U8 binary map
// Else: integer 1 for no device/ndof's default device
LLSD mLastDeviceUUID;
+ F32 mPerfScale;
+ U32 mJoystickRun { 0 };
+ bool mResetFlag { false };
+ bool mCameraUpdated { true };
+ bool mOverrideCamera { false };
+ bool mDeviceIs3DConnexion { false };
+
static F32 sLastDelta[7];
static F32 sDelta[7];
};
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 2d94b4da9f..a6614542b8 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -52,6 +52,7 @@
#include "llagentui.h"
#include "llagentwearables.h"
#include "llagentpilot.h"
+#include "llavataractions.h"
#include "llcompilequeue.h"
#include "llconsole.h"
#include "lldebugview.h"
@@ -79,9 +80,9 @@
#include "llfloaterworldmap.h"
#include "llfloaterbuildoptions.h"
#include "fsyspath.h"
-#include "llavataractions.h"
-#include "lllandmarkactions.h"
+#include "llgamecontrol.h"
#include "llgroupmgr.h"
+#include "lllandmarkactions.h"
#include "lltooltip.h"
#include "lltoolface.h"
#include "llhints.h"
@@ -943,17 +944,45 @@ class LLAdvancedToggleFeature : public view_listener_t
class LLAdvancedCheckFeature : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
-{
- U32 feature = feature_from_string( userdata.asString() );
- bool new_value = false;
+ {
+ U32 feature = feature_from_string( userdata.asString() );
+ bool new_value = false;
+
+ if ( feature != 0 )
+ {
+ new_value = LLPipeline::toggleRenderDebugFeatureControl( feature );
+ }
+
+ return new_value;
+ }
+};
- if ( feature != 0 )
+class LLAdvancedToggleExperiment : public view_listener_t
+{
+ bool handleEvent(const LLSD& userdata)
{
- new_value = LLPipeline::toggleRenderDebugFeatureControl( feature );
+ std::string feature = userdata.asString();
+ if (feature == "GameControl")
+ {
+ LLGameControl::setEnabled(! LLGameControl::isEnabled());
+ return true;
+ }
+ return false;
}
+};
- return new_value;
-}
+class LLAdvancedCheckExperiment : public view_listener_t
+{
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool value = false;
+ std::string feature = userdata.asString();
+ if (feature == "GameControl")
+ {
+ value = LLGameControl::isEnabled();
+ }
+ return value;
+ }
};
class LLAdvancedCheckDisplayTextureDensity : public view_listener_t
@@ -9729,6 +9758,9 @@ void initialize_menus()
view_listener_t::addMenu(new LLAdvancedToggleFeature(), "Advanced.ToggleFeature");
view_listener_t::addMenu(new LLAdvancedCheckFeature(), "Advanced.CheckFeature");
+ view_listener_t::addMenu(new LLAdvancedToggleExperiment(), "Advanced.ToggleExperiment");
+ view_listener_t::addMenu(new LLAdvancedCheckExperiment(), "Advanced.CheckExperiment");
+
view_listener_t::addMenu(new LLAdvancedCheckDisplayTextureDensity(), "Advanced.CheckDisplayTextureDensity");
view_listener_t::addMenu(new LLAdvancedSetDisplayTextureDensity(), "Advanced.SetDisplayTextureDensity");
diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index ec2dffb5e5..f6946f5304 100644
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -19,7 +19,7 @@
label="Inventory..."
name="Inventory"
shortcut="control|I"
- visible="true">
+ visible="true">
<menu_item_check.on_check
function="Floater.Visible"
parameter="inventory" />
@@ -734,8 +734,7 @@
function="Floater.Show"
parameter="snapshot" />
</menu_item_call>
-
-<menu_item_call
+ <menu_item_call
label="360 snapshot"
name="Capture 360"
shortcut="control|alt|shift|s">
@@ -2344,7 +2343,7 @@ function="World.EnvPreset"
function="Advanced.ToggleFeature"
parameter="flexible" />
</menu_item_check>
- </menu>
+ </menu>
<menu_item_check
label="Use Plugin Read Thread"
name="Use Plugin Read Thread">
@@ -2465,6 +2464,22 @@ function="World.EnvPreset"
<menu_item_separator/>
+ <menu
+ create_jump_keys="true"
+ label="Experimental Features"
+ name="Experimental Features"
+ tear_off="true">
+ <menu_item_check
+ label="GameControl"
+ name="ToggleGameControl">
+ <menu_item_check.on_check
+ function="Advanced.CheckExperiment"
+ parameter="GameControl" />
+ <menu_item_check.on_click
+ function="Advanced.ToggleExperiment"
+ parameter="GameControl" />
+ </menu_item_check>
+ </menu>
<menu_item_call
label="Show Debug Settings"
name="Debug Settings">
diff --git a/indra/newview/tests/llviewerhelputil_test.cpp b/indra/newview/tests/llviewerhelputil_test.cpp
index 9ee6625bf1..9a7a5be09f 100644
--- a/indra/newview/tests/llviewerhelputil_test.cpp
+++ b/indra/newview/tests/llviewerhelputil_test.cpp
@@ -79,6 +79,8 @@ bool LLAgent::isGodlike() const { return false; }
LLAgent gAgent;
+LLFlycam::LLFlycam() { }
+
std::string LLWeb::expandURLSubstitutions(const std::string &url,
const LLSD &default_subs)
{