Hidden imgui debug dialog for new visualization in preview

This commit is contained in:
enricoturri1966 2023-10-30 12:09:13 +01:00 committed by Lukas Matena
parent 7ee937857b
commit 72d5116744
6 changed files with 17 additions and 22 deletions

View File

@ -61,6 +61,7 @@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
#define ENABLE_NEW_GCODE_VIEWER 1 #define ENABLE_NEW_GCODE_VIEWER 1
#define ENABLE_NEW_GCODE_VIEWER_DEBUG (0 && ENABLE_NEW_GCODE_VIEWER)
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
#endif // _prusaslicer_technologies_h_ #endif // _prusaslicer_technologies_h_

View File

@ -1221,7 +1221,7 @@ void GCodeViewer::render()
#endif // ENABLE_GCODE_VIEWER_STATISTICS #endif // ENABLE_GCODE_VIEWER_STATISTICS
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
#if ENABLE_NEW_GCODE_VIEWER #if ENABLE_NEW_GCODE_VIEWER_DEBUG
if (m_use_gcode_viewer_2) { if (m_use_gcode_viewer_2) {
ImGuiWrapper& imgui = *Slic3r::GUI::wxGetApp().imgui(); ImGuiWrapper& imgui = *Slic3r::GUI::wxGetApp().imgui();
imgui.begin(std::string("LibVGCode Viewer Controller"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse); imgui.begin(std::string("LibVGCode Viewer Controller"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse);
@ -1252,7 +1252,7 @@ void GCodeViewer::render()
imgui.end(); imgui.end();
} }
#endif // ENABLE_NEW_GCODE_VIEWER #endif // ENABLE_NEW_GCODE_VIEWER_DEBUG
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
} }

View File

@ -115,13 +115,12 @@ unsigned int ColorRange::get_count() const
return m_count; return m_count;
} }
//################################################################################################################################ #if ENABLE_NEW_GCODE_VIEWER_DEBUG
// Debug
const std::array<float, 2>& ColorRange::get_range() const const std::array<float, 2>& ColorRange::get_range() const
{ {
return m_range; return m_range;
} }
//################################################################################################################################ #endif // ENABLE_NEW_GCODE_VIEWER_DEBUG
} // namespace libvgcode } // namespace libvgcode

View File

@ -34,10 +34,9 @@ public:
Color get_color_at(float value) const; Color get_color_at(float value) const;
unsigned int get_count() const; unsigned int get_count() const;
//################################################################################################################################ #if ENABLE_NEW_GCODE_VIEWER_DEBUG
// Debug
const std::array<float, 2>& get_range() const; const std::array<float, 2>& get_range() const;
//################################################################################################################################ #endif // ENABLE_NEW_GCODE_VIEWER_DEBUG
private: private:
EType m_type{ EType::Linear }; EType m_type{ EType::Linear };

View File

@ -779,13 +779,12 @@ void Toolpaths::update_enabled_entities()
m_enabled_segments_count = enabled_segments.size(); m_enabled_segments_count = enabled_segments.size();
m_enabled_options_count = enabled_options.size(); m_enabled_options_count = enabled_options.size();
//################################################################################################################################ #if ENABLE_NEW_GCODE_VIEWER_DEBUG
// Debug
m_enabled_segments_range = (m_enabled_segments_count > 0) ? m_enabled_segments_range = (m_enabled_segments_count > 0) ?
std::make_pair((uint32_t)enabled_segments.front(), (uint32_t)enabled_segments.back()) : std::make_pair((uint32_t)0, (uint32_t)0); std::make_pair((uint32_t)enabled_segments.front(), (uint32_t)enabled_segments.back()) : std::make_pair((uint32_t)0, (uint32_t)0);
m_enabled_options_range = (m_enabled_options_count > 0) ? m_enabled_options_range = (m_enabled_options_count > 0) ?
std::make_pair((uint32_t)enabled_options.front(), (uint32_t)enabled_options.back()) : std::make_pair((uint32_t)0, (uint32_t)0); std::make_pair((uint32_t)enabled_options.front(), (uint32_t)enabled_options.back()) : std::make_pair((uint32_t)0, (uint32_t)0);
//################################################################################################################################ #endif // ENABLE_NEW_GCODE_VIEWER_DEBUG
// update gpu buffer for enabled segments // update gpu buffer for enabled segments
assert(m_enabled_segments_buf_id > 0); assert(m_enabled_segments_buf_id > 0);
@ -859,10 +858,9 @@ void Toolpaths::render(const Mat4x4f& view_matrix, const Mat4x4f& projection_mat
if (m_settings.options_visibility.at(EOptionType::CenterOfGravity)) if (m_settings.options_visibility.at(EOptionType::CenterOfGravity))
render_cog_marker(view_matrix, projection_matrix); render_cog_marker(view_matrix, projection_matrix);
//################################################################################################################################ #if ENABLE_NEW_GCODE_VIEWER_DEBUG
// Debug
render_debug_window(); render_debug_window();
//################################################################################################################################ #endif // ENABLE_NEW_GCODE_VIEWER_DEBUG
} }
EViewType Toolpaths::get_view_type() const EViewType Toolpaths::get_view_type() const
@ -1463,8 +1461,7 @@ void Toolpaths::render_tool_marker(const Mat4x4f& view_matrix, const Mat4x4f& pr
glsafe(glUseProgram(curr_shader)); glsafe(glUseProgram(curr_shader));
} }
//################################################################################################################################ #if ENABLE_NEW_GCODE_VIEWER_DEBUG
// Debug
void Toolpaths::render_debug_window() void Toolpaths::render_debug_window()
{ {
Slic3r::GUI::ImGuiWrapper& imgui = *Slic3r::GUI::wxGetApp().imgui(); Slic3r::GUI::ImGuiWrapper& imgui = *Slic3r::GUI::wxGetApp().imgui();
@ -1627,7 +1624,7 @@ void Toolpaths::render_debug_window()
} }
imgui.end(); imgui.end();
} }
//################################################################################################################################ #endif // ENABLE_NEW_GCODE_VIEWER_DEBUG
} // namespace libvgcode } // namespace libvgcode

View File

@ -157,11 +157,10 @@ private:
// //
std::vector<PathVertex> m_vertices; std::vector<PathVertex> m_vertices;
std::vector<uint32_t> m_vertices_map; std::vector<uint32_t> m_vertices_map;
//################################################################################################################################ #if ENABLE_NEW_GCODE_VIEWER_DEBUG
// Debug
std::pair<uint32_t, uint32_t> m_enabled_segments_range{ 0, 0 }; std::pair<uint32_t, uint32_t> m_enabled_segments_range{ 0, 0 };
std::pair<uint32_t, uint32_t> m_enabled_options_range{ 0, 0 }; std::pair<uint32_t, uint32_t> m_enabled_options_range{ 0, 0 };
//################################################################################################################################ #endif // ENABLE_NEW_GCODE_VIEWER_DEBUG
// //
// Member variables used for toolpaths visibiliity // Member variables used for toolpaths visibiliity
@ -266,10 +265,10 @@ private:
void render_cog_marker(const Mat4x4f& view_matrix, const Mat4x4f& projection_matrix); void render_cog_marker(const Mat4x4f& view_matrix, const Mat4x4f& projection_matrix);
void render_tool_marker(const Mat4x4f& view_matrix, const Mat4x4f& projection_matrix); void render_tool_marker(const Mat4x4f& view_matrix, const Mat4x4f& projection_matrix);
//################################################################################################################################ #if ENABLE_NEW_GCODE_VIEWER_DEBUG
// Debug // Debug
void render_debug_window(); void render_debug_window();
//################################################################################################################################ #endif // ENABLE_NEW_GCODE_VIEWER_DEBUG
}; };
} // namespace libvgcode } // namespace libvgcode