Tech ENABLE_SHOW_TOOLPATHS_COG set as default

This commit is contained in:
enricoturri1966 2022-07-27 15:52:40 +02:00
parent 253b24e298
commit 5cf71bb094
10 changed files with 0 additions and 36 deletions

View file

@ -63,8 +63,6 @@
#define ENABLE_SHOW_NON_MANIFOLD_EDGES (1 && ENABLE_2_5_0_ALPHA1)
// Enable rework of Reload from disk command
#define ENABLE_RELOAD_FROM_DISK_REWORK (1 && ENABLE_2_5_0_ALPHA1)
// Enable showing toolpaths center of gravity
#define ENABLE_SHOW_TOOLPATHS_COG (1 && ENABLE_2_5_0_ALPHA1)
// Enable recalculating toolpaths when switching to/from volumetric rate visualization
#define ENABLE_VOLUMETRIC_RATE_TOOLPATHS_RECALC (1 && ENABLE_2_5_0_ALPHA1)
// Enable editing volumes transformation in world coordinates and instances in local coordinates

View file

@ -184,7 +184,6 @@ void GCodeViewer::TBuffer::add_path(const GCodeProcessorResult::MoveVertex& move
move.volumetric_rate(), move.extruder_id, move.cp_color_id, { { endpoint, endpoint } } });
}
#if ENABLE_SHOW_TOOLPATHS_COG
void GCodeViewer::COG::render()
{
if (!m_visible)
@ -256,7 +255,6 @@ void GCodeViewer::COG::render()
//imgui.end();
//ImGui::PopStyleVar();
}
#endif // ENABLE_SHOW_TOOLPATHS_COG
#if ENABLE_PREVIEW_LAYER_TIME
float GCodeViewer::Extrusions::Range::step_size(EType type) const
@ -1098,9 +1096,7 @@ unsigned int GCodeViewer::get_options_visibility_flags() const
flags = set_flag(flags, static_cast<unsigned int>(Preview::OptionType::ColorChanges), is_toolpath_move_type_visible(EMoveType::Color_change));
flags = set_flag(flags, static_cast<unsigned int>(Preview::OptionType::PausePrints), is_toolpath_move_type_visible(EMoveType::Pause_Print));
flags = set_flag(flags, static_cast<unsigned int>(Preview::OptionType::CustomGCodes), is_toolpath_move_type_visible(EMoveType::Custom_GCode));
#if ENABLE_SHOW_TOOLPATHS_COG
flags = set_flag(flags, static_cast<unsigned int>(Preview::OptionType::CenterOfGravity), m_cog.is_visible());
#endif // ENABLE_SHOW_TOOLPATHS_COG
flags = set_flag(flags, static_cast<unsigned int>(Preview::OptionType::Shells), m_shells.visible);
flags = set_flag(flags, static_cast<unsigned int>(Preview::OptionType::ToolMarker), m_sequential_view.marker.is_visible());
#if !ENABLE_PREVIEW_LAYOUT
@ -1124,9 +1120,7 @@ void GCodeViewer::set_options_visibility_from_flags(unsigned int flags)
set_toolpath_move_type_visible(EMoveType::Color_change, is_flag_set(static_cast<unsigned int>(Preview::OptionType::ColorChanges)));
set_toolpath_move_type_visible(EMoveType::Pause_Print, is_flag_set(static_cast<unsigned int>(Preview::OptionType::PausePrints)));
set_toolpath_move_type_visible(EMoveType::Custom_GCode, is_flag_set(static_cast<unsigned int>(Preview::OptionType::CustomGCodes)));
#if ENABLE_SHOW_TOOLPATHS_COG
m_cog.set_visible(is_flag_set(static_cast<unsigned int>(Preview::OptionType::CenterOfGravity)));
#endif // ENABLE_SHOW_TOOLPATHS_COG
m_shells.visible = is_flag_set(static_cast<unsigned int>(Preview::OptionType::Shells));
m_sequential_view.marker.set_visible(is_flag_set(static_cast<unsigned int>(Preview::OptionType::ToolMarker)));
#if !ENABLE_PREVIEW_LAYOUT
@ -1714,9 +1708,7 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result)
if (wxGetApp().is_editor())
m_contained_in_bed = wxGetApp().plater()->build_volume().all_paths_inside(gcode_result, m_paths_bounding_box);
#if ENABLE_SHOW_TOOLPATHS_COG
m_cog.reset();
#endif // ENABLE_SHOW_TOOLPATHS_COG
m_sequential_view.gcode_ids.clear();
for (size_t i = 0; i < gcode_result.moves.size(); ++i) {
@ -1752,7 +1744,6 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result)
const GCodeProcessorResult::MoveVertex& prev = gcode_result.moves[i - 1];
#if ENABLE_SHOW_TOOLPATHS_COG
if (curr.type == EMoveType::Extrude &&
curr.extrusion_role != erSkirt &&
curr.extrusion_role != erSupportMaterial &&
@ -1764,7 +1755,6 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result)
const Vec3d prev_pos = prev.position.cast<double>();
m_cog.add_segment(curr_pos, prev_pos, curr.mm3_per_mm * (curr_pos - prev_pos).norm());
}
#endif // ENABLE_SHOW_TOOLPATHS_COG
// update progress dialog
++progress_count;
@ -4557,7 +4547,6 @@ void GCodeViewer::render_legend(float& legend_height)
#endif // ENABLE_LEGEND_TOOLBAR_ICONS
});
ImGui::SameLine();
#if ENABLE_SHOW_TOOLPATHS_COG
#if ENABLE_LEGEND_TOOLBAR_ICONS
toggle_button(Preview::OptionType::CenterOfGravity, _u8L("Center of gravity"), [image_icon](ImGuiWindow& window, const ImVec2& pos, float size) {
image_icon(window, pos, size, ImGui::LegendCOG);
@ -4585,7 +4574,6 @@ void GCodeViewer::render_legend(float& legend_height)
});
#endif // ENABLE_LEGEND_TOOLBAR_ICONS
ImGui::SameLine();
#endif // ENABLE_SHOW_TOOLPATHS_COG
if (!wxGetApp().is_gcode_viewer()) {
#if ENABLE_LEGEND_TOOLBAR_ICONS
toggle_button(Preview::OptionType::Shells, _u8L("Shells"), [image_icon](ImGuiWindow& window, const ImVec2& pos, float size) {

View file

@ -387,7 +387,6 @@ class GCodeViewer
bool visible{ false };
};
#if ENABLE_SHOW_TOOLPATHS_COG
// helper to render center of gravity
class COG
{
@ -431,7 +430,6 @@ class GCodeViewer
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
}
};
#endif // ENABLE_SHOW_TOOLPATHS_COG
// helper to render extrusion paths
struct Extrusions
@ -791,9 +789,7 @@ private:
Extrusions m_extrusions;
SequentialView m_sequential_view;
Shells m_shells;
#if ENABLE_SHOW_TOOLPATHS_COG
COG m_cog;
#endif // ENABLE_SHOW_TOOLPATHS_COG
EViewType m_view_type{ EViewType::FeatureType };
bool m_legend_enabled{ true };
#if ENABLE_PREVIEW_LAYOUT
@ -842,9 +838,7 @@ public:
void reset();
void render();
#if ENABLE_SHOW_TOOLPATHS_COG
void render_cog() { m_cog.render(); }
#endif // ENABLE_SHOW_TOOLPATHS_COG
bool has_data() const { return !m_roles.empty(); }
bool can_export_toolpaths() const;

View file

@ -1696,10 +1696,8 @@ void GLCanvas3D::render()
#if ENABLE_RENDER_SELECTION_CENTER
_render_selection_center();
#endif // ENABLE_RENDER_SELECTION_CENTER
#if ENABLE_SHOW_TOOLPATHS_COG
if (!m_main_toolbar.is_enabled())
_render_gcode_cog();
#endif // ENABLE_SHOW_TOOLPATHS_COG
// we need to set the mouse's scene position here because the depth buffer
// could be invalidated by the following gizmo render methods
@ -6061,12 +6059,10 @@ void GLCanvas3D::_render_gcode()
m_gcode_viewer.render();
}
#if ENABLE_SHOW_TOOLPATHS_COG
void GLCanvas3D::_render_gcode_cog()
{
m_gcode_viewer.render_cog();
}
#endif // ENABLE_SHOW_TOOLPATHS_COG
void GLCanvas3D::_render_selection()
{

View file

@ -1004,9 +1004,7 @@ private:
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
void _render_objects(GLVolumeCollection::ERenderType type);
void _render_gcode();
#if ENABLE_SHOW_TOOLPATHS_COG
void _render_gcode_cog();
#endif // ENABLE_SHOW_TOOLPATHS_COG
void _render_selection();
void _render_sequential_clearance();
#if ENABLE_RENDER_SELECTION_CENTER

View file

@ -2107,7 +2107,6 @@ GLModel::Geometry diamond(unsigned int resolution)
}
#if ENABLE_LEGACY_OPENGL_REMOVAL
#if ENABLE_SHOW_TOOLPATHS_COG
GLModel::Geometry smooth_sphere(unsigned int resolution, float radius)
{
resolution = std::max<unsigned int>(4, resolution);
@ -2170,7 +2169,6 @@ GLModel::Geometry smooth_sphere(unsigned int resolution, float radius)
return data;
}
#endif // ENABLE_SHOW_TOOLPATHS_COG
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
} // namespace GUI

View file

@ -347,11 +347,9 @@ namespace GUI {
GLModel::Geometry diamond(unsigned int resolution);
#if ENABLE_LEGACY_OPENGL_REMOVAL
#if ENABLE_SHOW_TOOLPATHS_COG
// create a sphere with the given resolution and smooth normals
// the origin of the sphere is in its center
GLModel::Geometry smooth_sphere(unsigned int resolution, float radius);
#endif // ENABLE_SHOW_TOOLPATHS_COG
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
} // namespace GUI

View file

@ -54,14 +54,12 @@ std::pair<bool, std::string> GLShadersManager::init()
valid &= append_shader("dashed_thick_lines", { prefix + "dashed_thick_lines.vs", prefix + "dashed_thick_lines.fs", prefix + "dashed_thick_lines.gs" });
#endif // ENABLE_GL_CORE_PROFILE
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
#if ENABLE_SHOW_TOOLPATHS_COG
// used to render toolpaths center of gravity
#if ENABLE_LEGACY_OPENGL_REMOVAL
valid &= append_shader("toolpaths_cog", { prefix + "toolpaths_cog.vs", prefix + "toolpaths_cog.fs" });
#else
valid &= append_shader("toolpaths_cog", { "toolpaths_cog.vs", "toolpaths_cog.fs" });
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
#endif // ENABLE_SHOW_TOOLPATHS_COG
#if ENABLE_LEGACY_OPENGL_REMOVAL
// used to render bed axes and model, selection hints, gcode sequential view marker model, preview shells, options in gcode preview
valid &= append_shader("gouraud_light", { prefix + "gouraud_light.vs", prefix + "gouraud_light.fs" });

View file

@ -126,9 +126,7 @@ public:
ColorChanges,
PausePrints,
CustomGCodes,
#if ENABLE_SHOW_TOOLPATHS_COG
CenterOfGravity,
#endif // ENABLE_SHOW_TOOLPATHS_COG
Shells,
ToolMarker,
#if !ENABLE_PREVIEW_LAYOUT

View file

@ -67,9 +67,7 @@ static const std::map<const wchar_t, std::string> font_icons = {
{ImGui::LegendColorChanges , "legend_colorchanges" },
{ImGui::LegendPausePrints , "legend_pauseprints" },
{ImGui::LegendCustomGCodes , "legend_customgcodes" },
#if ENABLE_SHOW_TOOLPATHS_COG
{ImGui::LegendCOG , "legend_cog" },
#endif // ENABLE_SHOW_TOOLPATHS_COG
{ImGui::LegendShells , "legend_shells" },
{ImGui::LegendToolMarker , "legend_toolmarker" },
#endif // ENABLE_LEGEND_TOOLBAR_ICONS