GCodeViewer -> Fixed z slider in initial preview
This commit is contained in:
parent
c9bd0840b3
commit
cd5d70d5e1
@ -340,8 +340,6 @@ BoundingBoxf3 GLVolume::transformed_convex_hull_bounding_box(const Transform3d &
|
|||||||
bounding_box().transformed(trafo);
|
bounding_box().transformed(trafo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if !ENABLE_GCODE_VIEWER
|
|
||||||
void GLVolume::set_range(double min_z, double max_z)
|
void GLVolume::set_range(double min_z, double max_z)
|
||||||
{
|
{
|
||||||
this->qverts_range.first = 0;
|
this->qverts_range.first = 0;
|
||||||
@ -376,7 +374,6 @@ void GLVolume::set_range(double min_z, double max_z)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // !ENABLE_GCODE_VIEWER
|
|
||||||
|
|
||||||
void GLVolume::render() const
|
void GLVolume::render() const
|
||||||
{
|
{
|
||||||
|
@ -442,9 +442,7 @@ public:
|
|||||||
|
|
||||||
bool empty() const { return this->indexed_vertex_array.empty(); }
|
bool empty() const { return this->indexed_vertex_array.empty(); }
|
||||||
|
|
||||||
#if !ENABLE_GCODE_VIEWER
|
|
||||||
void set_range(double low, double high);
|
void set_range(double low, double high);
|
||||||
#endif // !ENABLE_GCODE_VIEWER
|
|
||||||
|
|
||||||
void render() const;
|
void render() const;
|
||||||
#if !ENABLE_SLOPE_RENDERING
|
#if !ENABLE_SLOPE_RENDERING
|
||||||
@ -562,9 +560,7 @@ public:
|
|||||||
void clear() { for (auto *v : volumes) delete v; volumes.clear(); }
|
void clear() { for (auto *v : volumes) delete v; volumes.clear(); }
|
||||||
|
|
||||||
bool empty() const { return volumes.empty(); }
|
bool empty() const { return volumes.empty(); }
|
||||||
#if !ENABLE_GCODE_VIEWER
|
|
||||||
void set_range(double low, double high) { for (GLVolume *vol : this->volumes) vol->set_range(low, high); }
|
void set_range(double low, double high) { for (GLVolume *vol : this->volumes) vol->set_range(low, high); }
|
||||||
#endif // !ENABLE_GCODE_VIEWER
|
|
||||||
|
|
||||||
void set_print_box(float min_x, float min_y, float min_z, float max_x, float max_y, float max_z) {
|
void set_print_box(float min_x, float min_y, float min_z, float max_x, float max_y, float max_z) {
|
||||||
m_print_box_min[0] = min_x; m_print_box_min[1] = min_y; m_print_box_min[2] = min_z;
|
m_print_box_min[0] = min_x; m_print_box_min[1] = min_y; m_print_box_min[2] = min_z;
|
||||||
|
@ -932,11 +932,7 @@ void GLCanvas3D::LegendTexture::fill_color_print_legend_items( const GLCanvas3D
|
|||||||
std::vector<std::pair<double, double>> cp_values;
|
std::vector<std::pair<double, double>> cp_values;
|
||||||
cp_values.reserve(custom_gcode_per_print_z.size());
|
cp_values.reserve(custom_gcode_per_print_z.size());
|
||||||
|
|
||||||
#if ENABLE_GCODE_VIEWER
|
|
||||||
const std::vector<double>& print_zs = canvas.get_layers_zs();
|
|
||||||
#else
|
|
||||||
std::vector<double> print_zs = canvas.get_current_print_zs(true);
|
std::vector<double> print_zs = canvas.get_current_print_zs(true);
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
|
||||||
for (auto custom_code : custom_gcode_per_print_z)
|
for (auto custom_code : custom_gcode_per_print_z)
|
||||||
{
|
{
|
||||||
if (custom_code.gcode != ColorChangeCode)
|
if (custom_code.gcode != ColorChangeCode)
|
||||||
@ -2327,11 +2323,16 @@ void GLCanvas3D::ensure_on_bed(unsigned int object_idx)
|
|||||||
|
|
||||||
|
|
||||||
#if ENABLE_GCODE_VIEWER
|
#if ENABLE_GCODE_VIEWER
|
||||||
const std::vector<double>& GLCanvas3D::get_layers_zs() const
|
const std::vector<double>& GLCanvas3D::get_gcode_layers_zs() const
|
||||||
{
|
{
|
||||||
return m_gcode_viewer.get_layers_zs();
|
return m_gcode_viewer.get_layers_zs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<double> GLCanvas3D::get_volumes_print_zs(bool active_only) const
|
||||||
|
{
|
||||||
|
return m_volumes.get_current_print_zs(active_only);
|
||||||
|
}
|
||||||
|
|
||||||
void GLCanvas3D::set_gcode_options_visibility_from_flags(unsigned int flags)
|
void GLCanvas3D::set_gcode_options_visibility_from_flags(unsigned int flags)
|
||||||
{
|
{
|
||||||
m_gcode_viewer.set_options_visibility_from_flags(flags);
|
m_gcode_viewer.set_options_visibility_from_flags(flags);
|
||||||
@ -2350,6 +2351,7 @@ void GLCanvas3D::set_toolpath_view_type(GCodeViewer::EViewType type)
|
|||||||
void GLCanvas3D::set_toolpaths_z_range(const std::array<double, 2>& range)
|
void GLCanvas3D::set_toolpaths_z_range(const std::array<double, 2>& range)
|
||||||
{
|
{
|
||||||
m_gcode_viewer.set_layers_z_range(range);
|
m_gcode_viewer.set_layers_z_range(range);
|
||||||
|
m_volumes.set_range(range[0] - 1e-6, range[1] + 1e-6);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
std::vector<double> GLCanvas3D::get_current_print_zs(bool active_only) const
|
std::vector<double> GLCanvas3D::get_current_print_zs(bool active_only) const
|
||||||
|
@ -648,7 +648,8 @@ public:
|
|||||||
#if ENABLE_GCODE_VIEWER
|
#if ENABLE_GCODE_VIEWER
|
||||||
bool is_gcode_legend_enabled() const { return m_gcode_viewer.is_legend_enabled(); }
|
bool is_gcode_legend_enabled() const { return m_gcode_viewer.is_legend_enabled(); }
|
||||||
GCodeViewer::EViewType get_gcode_view_type() const { return m_gcode_viewer.get_view_type(); }
|
GCodeViewer::EViewType get_gcode_view_type() const { return m_gcode_viewer.get_view_type(); }
|
||||||
const std::vector<double>& get_layers_zs() const;
|
const std::vector<double>& get_gcode_layers_zs() const;
|
||||||
|
std::vector<double> get_volumes_print_zs(bool active_only) const;
|
||||||
unsigned int get_gcode_options_visibility_flags() const { return m_gcode_viewer.get_options_visibility_flags(); }
|
unsigned int get_gcode_options_visibility_flags() const { return m_gcode_viewer.get_options_visibility_flags(); }
|
||||||
void set_gcode_options_visibility_from_flags(unsigned int flags);
|
void set_gcode_options_visibility_from_flags(unsigned int flags);
|
||||||
unsigned int get_toolpath_role_visibility_flags() const { return m_gcode_viewer.get_toolpath_role_visibility_flags(); }
|
unsigned int get_toolpath_role_visibility_flags() const { return m_gcode_viewer.get_toolpath_role_visibility_flags(); }
|
||||||
|
@ -1057,6 +1057,10 @@ void Preview::load_print_as_fff(bool keep_z_range)
|
|||||||
|
|
||||||
if (IsShown())
|
if (IsShown())
|
||||||
{
|
{
|
||||||
|
#if ENABLE_GCODE_VIEWER
|
||||||
|
std::vector<double> zs;
|
||||||
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
|
|
||||||
m_canvas->set_selected_extruder(0);
|
m_canvas->set_selected_extruder(0);
|
||||||
if (gcode_preview_data_valid) {
|
if (gcode_preview_data_valid) {
|
||||||
// Load the real G-code preview.
|
// Load the real G-code preview.
|
||||||
@ -1065,6 +1069,7 @@ void Preview::load_print_as_fff(bool keep_z_range)
|
|||||||
m_canvas->refresh_gcode_preview(*m_gcode_result, colors);
|
m_canvas->refresh_gcode_preview(*m_gcode_result, colors);
|
||||||
GetSizer()->Show(m_bottom_toolbar_sizer);
|
GetSizer()->Show(m_bottom_toolbar_sizer);
|
||||||
GetSizer()->Layout();
|
GetSizer()->Layout();
|
||||||
|
zs = m_canvas->get_gcode_layers_zs();
|
||||||
#else
|
#else
|
||||||
m_canvas->load_gcode_preview(*m_gcode_preview_data, colors);
|
m_canvas->load_gcode_preview(*m_gcode_preview_data, colors);
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
@ -1075,14 +1080,13 @@ void Preview::load_print_as_fff(bool keep_z_range)
|
|||||||
#if ENABLE_GCODE_VIEWER
|
#if ENABLE_GCODE_VIEWER
|
||||||
GetSizer()->Hide(m_bottom_toolbar_sizer);
|
GetSizer()->Hide(m_bottom_toolbar_sizer);
|
||||||
GetSizer()->Layout();
|
GetSizer()->Layout();
|
||||||
|
zs = m_canvas->get_volumes_print_zs(true);
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
}
|
}
|
||||||
#if ENABLE_GCODE_VIEWER
|
#if !ENABLE_GCODE_VIEWER
|
||||||
const std::vector<double>& zs = m_canvas->get_layers_zs();
|
|
||||||
#else
|
|
||||||
show_hide_ui_elements(gcode_preview_data_valid ? "full" : "simple");
|
show_hide_ui_elements(gcode_preview_data_valid ? "full" : "simple");
|
||||||
std::vector<double> zs = m_canvas->get_current_print_zs(true);
|
std::vector<double> zs = m_canvas->get_current_print_zs(true);
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
#endif // !ENABLE_GCODE_VIEWER
|
||||||
if (zs.empty()) {
|
if (zs.empty()) {
|
||||||
// all layers filtered out
|
// all layers filtered out
|
||||||
reset_sliders(true);
|
reset_sliders(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user