Ensure that the Coordinate System selected in the sidebar panel is always one supported by the current selection
This commit is contained in:
parent
9141835b76
commit
e3aff0383c
@ -34,6 +34,8 @@
|
||||
#define ENABLE_GLMODEL_STATISTICS 0
|
||||
// Shows an imgui dialog containing the matrices of the selected volumes
|
||||
#define ENABLE_MATRICES_DEBUG 0
|
||||
// Shows an imgui dialog containing data from class ObjectManipulation
|
||||
#define ENABLE_OBJECT_MANIPULATION_DEBUG 0
|
||||
|
||||
|
||||
// Enable rendering of objects using environment map
|
||||
@ -41,18 +43,19 @@
|
||||
// Enable smoothing of objects normals
|
||||
#define ENABLE_SMOOTH_NORMALS 0
|
||||
|
||||
|
||||
//====================
|
||||
// 2.6.0.alpha1 techs
|
||||
//====================
|
||||
#define ENABLE_2_6_0_ALPHA1 1
|
||||
|
||||
// Enable OpenGL ES
|
||||
#define ENABLE_OPENGL_ES 0
|
||||
// Enable OpenGL core profile context (tested against Mesa 20.1.8 on Windows)
|
||||
#define ENABLE_GL_CORE_PROFILE (1 && !ENABLE_OPENGL_ES)
|
||||
// Enable OpenGL debug messages using debug context
|
||||
#define ENABLE_OPENGL_DEBUG_OPTION (1 && ENABLE_GL_CORE_PROFILE)
|
||||
|
||||
|
||||
//====================
|
||||
// 2.6.0.alpha1 techs
|
||||
//====================
|
||||
#define ENABLE_2_6_0_ALPHA1 1
|
||||
|
||||
// Enable alternative version of file_wildcards()
|
||||
#define ENABLE_ALTERNATIVE_FILE_WILDCARDS_GENERATOR (1 && ENABLE_2_6_0_ALPHA1)
|
||||
|
||||
|
@ -1639,6 +1639,9 @@ void GLCanvas3D::render()
|
||||
#if ENABLE_GLMODEL_STATISTICS
|
||||
GLModel::render_statistics();
|
||||
#endif // ENABLE_GLMODEL_STATISTICS
|
||||
#if ENABLE_OBJECT_MANIPULATION_DEBUG
|
||||
wxGetApp().obj_manipul()->render_debug_window();
|
||||
#endif // ENABLE_OBJECT_MANIPULATION_DEBUG
|
||||
|
||||
std::string tooltip;
|
||||
|
||||
|
@ -2668,6 +2668,8 @@ void ObjectList::part_selection_changed()
|
||||
bool disable_ss_manipulation {false};
|
||||
bool disable_ununiform_scale {false};
|
||||
|
||||
ECoordinatesType coordinates_type = wxGetApp().obj_manipul()->get_coordinates_type();
|
||||
|
||||
const auto item = GetSelection();
|
||||
|
||||
GLGizmosManager& gizmos_mgr = wxGetApp().plater()->canvas3D()->get_gizmos_manager();
|
||||
@ -2684,6 +2686,7 @@ void ObjectList::part_selection_changed()
|
||||
|
||||
if (selection.is_single_full_object()) {
|
||||
og_name = _L("Object manipulation");
|
||||
coordinates_type = ECoordinatesType::World;
|
||||
update_and_show_manipulations = true;
|
||||
|
||||
obj_idx = selection.get_object_idx();
|
||||
@ -2693,6 +2696,7 @@ void ObjectList::part_selection_changed()
|
||||
}
|
||||
else {
|
||||
og_name = _L("Group manipulation");
|
||||
coordinates_type = ECoordinatesType::World;
|
||||
|
||||
// don't show manipulation panel for case of all Object's parts selection
|
||||
update_and_show_manipulations = !selection.is_single_full_instance();
|
||||
@ -2748,6 +2752,8 @@ void ObjectList::part_selection_changed()
|
||||
|| type == itInfo) {
|
||||
og_name = _L("Object manipulation");
|
||||
m_config = &object->config;
|
||||
if (!scene_selection().is_single_full_instance() || coordinates_type > ECoordinatesType::Instance)
|
||||
coordinates_type = ECoordinatesType::World;
|
||||
update_and_show_manipulations = true;
|
||||
|
||||
if (type == itInfo) {
|
||||
@ -2825,6 +2831,8 @@ void ObjectList::part_selection_changed()
|
||||
|
||||
if (update_and_show_manipulations) {
|
||||
wxGetApp().obj_manipul()->get_og()->set_name(" " + og_name + " ");
|
||||
if (wxGetApp().obj_manipul()->get_coordinates_type() != coordinates_type)
|
||||
wxGetApp().obj_manipul()->set_coordinates_type(coordinates_type);
|
||||
|
||||
if (item) {
|
||||
wxGetApp().obj_manipul()->update_item_name(m_objects_model->GetName(item));
|
||||
|
@ -482,6 +482,8 @@ void ObjectManipulation::Show(const bool show)
|
||||
}
|
||||
|
||||
if (show) {
|
||||
ECoordinatesType coordinates_type = m_coordinates_type;
|
||||
|
||||
// Show the "World Coordinates" / "Local Coordintes" Combo in Advanced / Expert mode only.
|
||||
const Selection& selection = wxGetApp().plater()->canvas3D()->get_selection();
|
||||
bool show_world_local_combo = wxGetApp().get_mode() != comSimple && (selection.is_single_full_instance() || selection.is_single_volume_or_modifier());
|
||||
@ -491,15 +493,12 @@ void ObjectManipulation::Show(const bool show)
|
||||
#else
|
||||
m_word_local_combo->Insert(coordinate_type_str(ECoordinatesType::Local), wxNullBitmap, 2);
|
||||
#endif // __linux__
|
||||
m_word_local_combo->Select((int)ECoordinatesType::World);
|
||||
this->set_coordinates_type(m_word_local_combo->GetString(m_word_local_combo->GetSelection()));
|
||||
}
|
||||
else if (selection.is_single_full_instance() && m_word_local_combo->GetCount() > 2) {
|
||||
m_word_local_combo->Delete(2);
|
||||
m_word_local_combo->Select((int)ECoordinatesType::World);
|
||||
this->set_coordinates_type(m_word_local_combo->GetString(m_word_local_combo->GetSelection()));
|
||||
if (coordinates_type > ECoordinatesType::Instance)
|
||||
coordinates_type = ECoordinatesType::World;
|
||||
}
|
||||
|
||||
m_word_local_combo->Show(show_world_local_combo);
|
||||
m_empty_str->Show(!show_world_local_combo);
|
||||
}
|
||||
@ -742,9 +741,6 @@ void ObjectManipulation::update_if_dirty()
|
||||
m_lock_bnt->SetToolTip(wxEmptyString);
|
||||
m_lock_bnt->enable();
|
||||
|
||||
if (m_word_local_combo->GetSelection() != (int)m_coordinates_type)
|
||||
m_word_local_combo->SetSelection((int)m_coordinates_type);
|
||||
|
||||
if (m_new_enabled)
|
||||
m_og->enable();
|
||||
else
|
||||
@ -858,6 +854,19 @@ wxString ObjectManipulation::coordinate_type_str(ECoordinatesType type)
|
||||
}
|
||||
}
|
||||
|
||||
#if ENABLE_OBJECT_MANIPULATION_DEBUG
|
||||
void ObjectManipulation::render_debug_window()
|
||||
{
|
||||
ImGuiWrapper& imgui = *wxGetApp().imgui();
|
||||
// ImGui::SetNextWindowCollapsed(true, ImGuiCond_Once);
|
||||
imgui.begin(std::string("ObjectManipulation"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize);
|
||||
imgui.text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, "Coordinates type");
|
||||
ImGui::SameLine();
|
||||
imgui.text(coordinate_type_str(m_coordinates_type));
|
||||
imgui.end();
|
||||
}
|
||||
#endif // ENABLE_OBJECT_MANIPULATION_DEBUG
|
||||
|
||||
void ObjectManipulation::reset_settings_value()
|
||||
{
|
||||
m_new_position = Vec3d::Zero();
|
||||
@ -1084,6 +1093,7 @@ void ObjectManipulation::set_coordinates_type(ECoordinatesType type)
|
||||
return;
|
||||
|
||||
m_coordinates_type = type;
|
||||
m_word_local_combo->SetSelection((int)m_coordinates_type);
|
||||
this->UpdateAndShow(true);
|
||||
GLCanvas3D* canvas = wxGetApp().plater()->canvas3D();
|
||||
canvas->get_gizmos_manager().update_data();
|
||||
@ -1093,10 +1103,6 @@ void ObjectManipulation::set_coordinates_type(ECoordinatesType type)
|
||||
|
||||
ECoordinatesType ObjectManipulation::get_coordinates_type() const
|
||||
{
|
||||
const wxString og_name = get_og()->get_name();
|
||||
if (og_name.Contains(_L("Group manipulation")))
|
||||
return ECoordinatesType::World;
|
||||
|
||||
return m_coordinates_type;
|
||||
}
|
||||
|
||||
@ -1151,13 +1157,12 @@ void ObjectManipulation::sys_color_changed()
|
||||
|
||||
void ObjectManipulation::set_coordinates_type(const wxString& type_string)
|
||||
{
|
||||
ECoordinatesType type = ECoordinatesType::World;
|
||||
if (type_string == coordinate_type_str(ECoordinatesType::Instance))
|
||||
type = ECoordinatesType::Instance;
|
||||
this->set_coordinates_type(ECoordinatesType::Instance);
|
||||
else if (type_string == coordinate_type_str(ECoordinatesType::Local))
|
||||
type = ECoordinatesType::Local;
|
||||
|
||||
this->set_coordinates_type(type);
|
||||
this->set_coordinates_type(ECoordinatesType::Local);
|
||||
else
|
||||
this->set_coordinates_type(ECoordinatesType::World);
|
||||
}
|
||||
|
||||
static const char axes[] = { 'x', 'y', 'z' };
|
||||
|
@ -213,6 +213,10 @@ public:
|
||||
|
||||
static wxString coordinate_type_str(ECoordinatesType type);
|
||||
|
||||
#if ENABLE_OBJECT_MANIPULATION_DEBUG
|
||||
void render_debug_window();
|
||||
#endif // ENABLE_OBJECT_MANIPULATION_DEBUG
|
||||
|
||||
private:
|
||||
void reset_settings_value();
|
||||
void update_settings_value(const Selection& selection);
|
||||
|
Loading…
Reference in New Issue
Block a user