Add option in the CTRL-M dialog to invert axes (#1928)

Some people prefer their axes inverted when using a spacemouse.
This this, you can invert any set of axes you want.
This commit is contained in:
Stephen Hurd 2023-08-26 23:29:46 -04:00 committed by GitHub
parent 012f113eae
commit 17811c997b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 108 additions and 5 deletions

View file

@ -1052,7 +1052,7 @@ void AppConfig::set_recent_projects(const std::vector<std::string>& recent_proje
}
void AppConfig::set_mouse_device(const std::string& name, double translation_speed, double translation_deadzone,
float rotation_speed, float rotation_deadzone, double zoom_speed, bool swap_yz)
float rotation_speed, float rotation_deadzone, double zoom_speed, bool swap_yz, bool invert_x, bool invert_y, bool invert_z, bool invert_yaw, bool invert_pitch, bool invert_roll)
{
std::string key = std::string("mouse_device:") + name;
auto it = m_storage.find(key);
@ -1066,6 +1066,12 @@ void AppConfig::set_mouse_device(const std::string& name, double translation_spe
it->second["rotation_deadzone"] = float_to_string_decimal_point(rotation_deadzone);
it->second["zoom_speed"] = float_to_string_decimal_point(zoom_speed);
it->second["swap_yz"] = swap_yz ? "1" : "0";
it->second["invert_x"] = invert_x ? "1" : "0";
it->second["invert_y"] = invert_y ? "1" : "0";
it->second["invert_z"] = invert_z ? "1" : "0";
it->second["invert_yaw"] = invert_yaw ? "1" : "0";
it->second["invert_pitch"] = invert_pitch ? "1" : "0";
it->second["invert_roll"] = invert_roll ? "1" : "0";
}
std::vector<std::string> AppConfig::get_mouse_device_names() const

View file

@ -256,7 +256,7 @@ public:
std::vector<std::string> get_recent_projects() const;
void set_recent_projects(const std::vector<std::string>& recent_projects);
void set_mouse_device(const std::string& name, double translation_speed, double translation_deadzone, float rotation_speed, float rotation_deadzone, double zoom_speed, bool swap_yz);
void set_mouse_device(const std::string& name, double translation_speed, double translation_deadzone, float rotation_speed, float rotation_deadzone, double zoom_speed, bool swap_yz, bool invert_x, bool invert_y, bool invert_z, bool invert_yaw, bool invert_pitch, bool invert_roll);
std::vector<std::string> get_mouse_device_names() const;
bool get_mouse_device_translation_speed(const std::string& name, double& speed) const
{ return get_3dmouse_device_numeric_value(name, "translation_speed", speed); }
@ -270,6 +270,18 @@ public:
{ return get_3dmouse_device_numeric_value(name, "zoom_speed", speed); }
bool get_mouse_device_swap_yz(const std::string& name, bool& swap) const
{ return get_3dmouse_device_numeric_value(name, "swap_yz", swap); }
bool get_mouse_device_invert_x(const std::string& name, bool& invert) const
{ return get_3dmouse_device_numeric_value(name, "invert_x", invert); }
bool get_mouse_device_invert_y(const std::string& name, bool& invert) const
{ return get_3dmouse_device_numeric_value(name, "invert_y", invert); }
bool get_mouse_device_invert_z(const std::string& name, bool& invert) const
{ return get_3dmouse_device_numeric_value(name, "invert_z", invert); }
bool get_mouse_device_invert_yaw(const std::string& name, bool& invert) const
{ return get_3dmouse_device_numeric_value(name, "invert_yaw", invert); }
bool get_mouse_device_invert_pitch(const std::string& name, bool& invert) const
{ return get_3dmouse_device_numeric_value(name, "invert_pitch", invert); }
bool get_mouse_device_invert_roll(const std::string& name, bool& invert) const
{ return get_3dmouse_device_numeric_value(name, "invert_roll", invert); }
static const std::string SECTION_FILAMENTS;
static const std::string SECTION_MATERIALS;