FIX:allow some case to modify distance
Code fallback:reload scene in 3D view GLVolume::explosion_ratio = 1.0 hide "Edit to scale" icon Jira:STUDIO-6727 Change-Id: Ib7079077f5b39930891869af618b93861f3aa178
This commit is contained in:
parent
7f5b464988
commit
4cb8bac4e2
|
@ -1293,6 +1293,31 @@ MeasurementResult get_measurement(const SurfaceFeature &a, const SurfaceFeature
|
|||
return result;
|
||||
}
|
||||
|
||||
bool can_set_xyz_distance(const SurfaceFeature &a, const SurfaceFeature &b) {
|
||||
const bool swap = int(a.get_type()) > int(b.get_type());
|
||||
const SurfaceFeature &f1 = swap ? b : a;
|
||||
const SurfaceFeature &f2 = swap ? a : b;
|
||||
if (f1.get_type() == SurfaceFeatureType::Point){
|
||||
if (f2.get_type() == SurfaceFeatureType::Point) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (f1.get_type() == SurfaceFeatureType::Circle) {
|
||||
if (f2.get_type() == SurfaceFeatureType::Circle) {
|
||||
return true;
|
||||
}
|
||||
else if (f2.get_type() == SurfaceFeatureType::Plane) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (f1.get_type() == SurfaceFeatureType::Plane) {
|
||||
if (f2.get_type() == SurfaceFeatureType::Plane) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
AssemblyAction get_assembly_action(const SurfaceFeature& a, const SurfaceFeature& b)
|
||||
{
|
||||
AssemblyAction action;
|
||||
|
|
|
@ -185,6 +185,7 @@ struct MeasurementResult {
|
|||
|
||||
// Returns distance/angle between two SurfaceFeatures.
|
||||
MeasurementResult get_measurement(const SurfaceFeature& a, const SurfaceFeature& b,bool deal_circle_result =false);
|
||||
bool can_set_xyz_distance(const SurfaceFeature &a, const SurfaceFeature &b);
|
||||
|
||||
struct AssemblyAction
|
||||
{
|
||||
|
|
|
@ -7928,6 +7928,7 @@ void GLCanvas3D::_render_return_toolbar()
|
|||
wxPostEvent(m_canvas, SimpleEvent(EVT_GLVIEWTOOLBAR_3D));
|
||||
const_cast<GLGizmosManager *>(&m_gizmos)->reset_all_states();
|
||||
wxGetApp().plater()->get_view3D_canvas3D()->get_gizmos_manager().reset_all_states();
|
||||
GLVolume::explosion_ratio = 1.0;//in 3D view GLVolume::explosion_ratio = 1.0
|
||||
wxGetApp().plater()->get_view3D_canvas3D()->reload_scene(true);
|
||||
{
|
||||
GLCanvas3D * view_3d = wxGetApp().plater()->get_view3D_canvas3D();
|
||||
|
|
|
@ -1320,10 +1320,9 @@ void GLGizmoMeasure::render_dimensioning()
|
|||
ImGuiWrapper::to_ImU32({1.0f, 1.0f, 1.0f, 0.5f}));
|
||||
ImGui::SetCursorScreenPos({ pos.x + style.FramePadding.x, pos.y });
|
||||
m_imgui->text(txt);
|
||||
if (m_hit_different_volumes.size() < 2) {
|
||||
if (m_hit_different_volumes.size() < 2 && wxGetApp().plater()->canvas3D()->get_canvas_type() == GLCanvas3D::ECanvasType::CanvasView3D) {
|
||||
ImGui::SameLine();
|
||||
if (m_imgui->image_button(ImGui::SliderFloatEditBtnIcon, _L("Edit to scale")) &&
|
||||
wxGetApp().plater()->canvas3D()->get_canvas_type() == GLCanvas3D::ECanvasType::CanvasView3D) {
|
||||
if (m_imgui->image_button(ImGui::SliderFloatEditBtnIcon, _L("Edit to scale"))) {
|
||||
m_editing_distance = true;
|
||||
edit_value = curr_value;
|
||||
m_imgui->requires_extra_frame();
|
||||
|
@ -1987,6 +1986,7 @@ void GLGizmoMeasure::on_render_input_window(float x, float y, float bottom_limit
|
|||
auto add_edit_distance_xyz_box = [this, &input_size_max, &same_model_object, ¤t_active_id](Vec3d &distance) {
|
||||
m_imgui->disabled_begin(m_hit_different_volumes.size() == 1);
|
||||
{
|
||||
m_imgui->disabled_begin(!m_can_set_xyz_distance);
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableSetColumnIndex(0);
|
||||
m_imgui->text_colored(ImGuiWrapper::COL_RED, "X:");
|
||||
|
@ -1999,8 +1999,9 @@ void GLGizmoMeasure::on_render_input_window(float x, float y, float bottom_limit
|
|||
m_imgui->text_colored(ImGuiWrapper::COL_GREEN, "Y:");
|
||||
ImGui::TableSetColumnIndex(1);
|
||||
ImGui::BBLInputDouble("##measure_distance_y", &m_buffered_distance[1], 0.0f, 0.0f, "%.2f");
|
||||
m_imgui->disabled_end();
|
||||
|
||||
m_imgui->disabled_begin(!same_model_object);
|
||||
m_imgui->disabled_begin(!(same_model_object && m_can_set_xyz_distance));
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableSetColumnIndex(0);
|
||||
m_imgui->text_colored(ImGuiWrapper::COL_BLUE, "Z:");
|
||||
|
@ -2212,10 +2213,11 @@ void GLGizmoMeasure::update_measurement_result()
|
|||
if (!m_selected_features.first.feature.has_value()) {
|
||||
m_measurement_result = Measure::MeasurementResult();
|
||||
m_assembly_action = Measure::AssemblyAction();
|
||||
}
|
||||
}
|
||||
else if (m_selected_features.second.feature.has_value()) {
|
||||
m_measurement_result = Measure::get_measurement(*m_selected_features.first.feature, *m_selected_features.second.feature, true);
|
||||
m_assembly_action = Measure::get_assembly_action(*m_selected_features.first.feature, *m_selected_features.second.feature);
|
||||
m_can_set_xyz_distance = Measure::can_set_xyz_distance(*m_selected_features.first.feature, *m_selected_features.second.feature);
|
||||
//update buffer
|
||||
const Measure::MeasurementResult &measure = m_measurement_result;
|
||||
m_distance = Vec3d::Zero();
|
||||
|
|
|
@ -149,7 +149,7 @@ class GLGizmoMeasure : public GLGizmoBase
|
|||
bool m_set_center_coincidence{false};
|
||||
bool m_editing_distance{ false };
|
||||
bool m_is_editing_distance_first_frame{ true };
|
||||
|
||||
bool m_can_set_xyz_distance{false};
|
||||
void update_if_needed();
|
||||
|
||||
void disable_scene_raycasters();
|
||||
|
|
|
@ -3165,13 +3165,11 @@ void Plater::priv::update(unsigned int flags)
|
|||
// Update the SLAPrint from the current Model, so that the reload_scene()
|
||||
// pulls the correct data.
|
||||
update_status = this->update_background_process(false, flags & (unsigned int)UpdateParams::POSTPONE_VALIDATION_ERROR_MESSAGE);
|
||||
//BBS reload_scene
|
||||
if (wxGetApp().plater() && wxGetApp().plater()->canvas3D()->get_canvas_type() == GLCanvas3D::ECanvasType::CanvasAssembleView) { // BBS assemble view
|
||||
this->assemble_view->reload_scene(false, flags);
|
||||
} else {
|
||||
this->view3D->reload_scene(false, flags & (unsigned int) UpdateParams::FORCE_FULL_SCREEN_REFRESH);
|
||||
this->preview->reload_print();
|
||||
}
|
||||
// BBS TODO reload_scene
|
||||
this->view3D->reload_scene(false, flags & (unsigned int) UpdateParams::FORCE_FULL_SCREEN_REFRESH);
|
||||
this->preview->reload_print();
|
||||
// BBS assemble view
|
||||
this->assemble_view->reload_scene(false, flags);
|
||||
|
||||
if (current_panel && q->is_preview_shown()) {
|
||||
q->force_update_all_plate_thumbnails();
|
||||
|
|
Loading…
Reference in New Issue