Fixed conflicts after merge with master

This commit is contained in:
enricoturri1966 2021-07-22 11:46:00 +02:00
commit 5c6810d0bc
38 changed files with 31 additions and 782 deletions

View file

@ -23,9 +23,7 @@
#include "libslic3r/Format/STL.hpp"
#include "libslic3r/Utils.hpp"
#include "libslic3r/AppConfig.hpp"
#if DISABLE_ALLOW_NEGATIVE_Z_FOR_SLA
#include "libslic3r/PresetBundle.hpp"
#endif // DISABLE_ALLOW_NEGATIVE_Z_FOR_SLA
#include <stdio.h>
#include <stdlib.h>
@ -456,16 +454,10 @@ void GLVolume::set_render_color(const std::array<float, 4>& rgba)
void GLVolume::set_render_color()
{
#if ENABLE_ALLOW_NEGATIVE_Z
bool outside = is_outside || is_below_printbed();
#endif // ENABLE_ALLOW_NEGATIVE_Z
if (force_native_color || force_neutral_color) {
#if ENABLE_ALLOW_NEGATIVE_Z
if (outside && shader_outside_printer_detection_enabled)
#else
if (is_outside && shader_outside_printer_detection_enabled)
#endif // ENABLE_ALLOW_NEGATIVE_Z
set_render_color(OUTSIDE_COLOR);
else {
if (force_native_color)
@ -480,18 +472,10 @@ void GLVolume::set_render_color()
else if (hover == HS_Deselect)
set_render_color(HOVER_DESELECT_COLOR);
else if (selected)
#if ENABLE_ALLOW_NEGATIVE_Z
set_render_color(outside ? SELECTED_OUTSIDE_COLOR : SELECTED_COLOR);
#else
set_render_color(is_outside ? SELECTED_OUTSIDE_COLOR : SELECTED_COLOR);
#endif // ENABLE_ALLOW_NEGATIVE_Z
else if (disabled)
set_render_color(DISABLED_COLOR);
#if ENABLE_ALLOW_NEGATIVE_Z
else if (outside && shader_outside_printer_detection_enabled)
#else
else if (is_outside && shader_outside_printer_detection_enabled)
#endif // ENABLE_ALLOW_NEGATIVE_Z
set_render_color(OUTSIDE_COLOR);
else
set_render_color(color);
@ -634,14 +618,9 @@ void GLVolume::render() const
bool GLVolume::is_sla_support() const { return this->composite_id.volume_id == -int(slaposSupportTree); }
bool GLVolume::is_sla_pad() const { return this->composite_id.volume_id == -int(slaposPad); }
#if ENABLE_ALLOW_NEGATIVE_Z
bool GLVolume::is_sinking() const
{
#if DISABLE_ALLOW_NEGATIVE_Z_FOR_SLA
if (is_modifier || GUI::wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() == ptSLA)
#else
if (is_modifier)
#endif // DISABLE_ALLOW_NEGATIVE_Z_FOR_SLA
return false;
const BoundingBoxf3& box = transformed_convex_hull_bounding_box();
return box.min.z() < SINKING_Z_THRESHOLD && box.max.z() >= SINKING_Z_THRESHOLD;
@ -668,7 +647,6 @@ void GLVolume::render_sinking_contours()
m_sinking_contours.render();
}
#endif // ENABLE_SINKING_CONTOURS
#endif // ENABLE_ALLOW_NEGATIVE_Z
std::vector<int> GLVolumeCollection::load_object(
const ModelObject *model_object,

View file

@ -484,7 +484,6 @@ public:
bool is_sla_support() const;
bool is_sla_pad() const;
#if ENABLE_ALLOW_NEGATIVE_Z
bool is_sinking() const;
bool is_below_printbed() const;
#if ENABLE_SINKING_CONTOURS
@ -492,7 +491,6 @@ public:
void update_sinking_contours_color();
void render_sinking_contours();
#endif // ENABLE_SINKING_CONTOURS
#endif // ENABLE_ALLOW_NEGATIVE_Z
// Return an estimate of the memory consumed by this class.
size_t cpu_memory_used() const {

View file

@ -155,19 +155,15 @@ void BackgroundSlicingProcess::process_fff()
if (! m_export_path.empty()) {
wxQueueEvent(GUI::wxGetApp().mainframe->m_plater, new wxCommandEvent(m_event_export_began_id));
#if ENABLE_GCODE_WINDOW
// let the gcode window to unmap the temporary .gcode file (m_temp_output_path)
// because the scripts may want to modify it
GUI::wxGetApp().plater()->stop_mapping_gcode_window();
#endif // ENABLE_GCODE_WINDOW
m_print->set_status(95, _utf8(L("Running post-processing scripts")));
run_post_process_scripts(m_temp_output_path, m_fff_print->full_print_config());
#if ENABLE_GCODE_WINDOW
// let the gcode window to reload and remap the temporary .gcode file (m_temp_output_path)
GUI::wxGetApp().plater()->start_mapping_gcode_window();
#endif // ENABLE_GCODE_WINDOW
//FIXME localize the messages
// Perform the final post-processing of the export path by applying the print statistics over the file name.

View file

@ -739,16 +739,11 @@ wxString Control::get_label(int tick, LabelType label_type/* = ltHeightWithLayer
return size_t(it - m_layers_values.begin());
};
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
if (m_draw_mode == dmSequentialGCodeView) {
return (Slic3r::GUI::get_app_config()->get("seq_top_gcode_indices") == "1") ?
wxString::Format("%lu", static_cast<unsigned long>(m_alternate_values[value])) :
wxString::Format("%lu", static_cast<unsigned long>(m_values[value]));
}
#else
if (m_draw_mode == dmSequentialGCodeView)
return wxString::Format("%lu", static_cast<unsigned long>(m_values[value]));
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
else {
if (label_type == ltEstimatedTime) {
if (m_is_wipe_tower) {
@ -2180,7 +2175,6 @@ static std::string get_custom_code(const std::string& code_in, double height)
wxTextEntryDialogStyle | wxTE_MULTILINE);
upgrade_text_entry_dialog(&dlg);
#if ENABLE_VALIDATE_CUSTOM_GCODE
bool valid = true;
std::string value;
do {
@ -2191,12 +2185,6 @@ static std::string get_custom_code(const std::string& code_in, double height)
valid = GUI::Tab::validate_custom_gcode("Custom G-code", value);
} while (!valid);
return value;
#else
if (dlg.ShowModal() != wxID_OK)
return "";
return into_u8(dlg.GetValue());
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
}
static std::string get_pause_print_msg(const std::string& msg_in, double height)

View file

@ -223,9 +223,7 @@ public:
void SetKoefForLabels(const double koef) { m_label_koef = koef; }
void SetSliderValues(const std::vector<double>& values);
void ChangeOneLayerLock();
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
void SetSliderAlternateValues(const std::vector<double>& values) { m_alternate_values = values; }
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
Info GetTicksValues() const;
void SetTicksValues(const Info &custom_gcode_per_print_z);
@ -409,9 +407,7 @@ private:
std::vector<std::string> m_extruder_colors;
std::string m_print_obj_idxs;
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
std::vector<double> m_alternate_values;
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
// control's view variables
wxCoord SLIDER_MARGIN; // margin around slider

View file

@ -23,9 +23,7 @@
#include <GL/glew.h>
#include <boost/log/trivial.hpp>
#if ENABLE_GCODE_WINDOW
#include <boost/algorithm/string/split.hpp>
#endif // ENABLE_GCODE_WINDOW
#include <boost/nowide/cstdio.hpp>
#include <boost/nowide/fstream.hpp>
#include <wx/progdlg.h>
@ -269,7 +267,6 @@ void GCodeViewer::SequentialView::Marker::render() const
ImGui::PopStyleVar();
}
#if ENABLE_GCODE_WINDOW
void GCodeViewer::SequentialView::GCodeWindow::load_gcode()
{
if (m_filename.empty())
@ -487,7 +484,6 @@ void GCodeViewer::SequentialView::render(float legend_height) const
bottom -= wxGetApp().plater()->get_view_toolbar().get_height();
gcode_window.render(legend_height, bottom, static_cast<uint64_t>(gcode_ids[current.last]));
}
#endif // ENABLE_GCODE_WINDOW
const std::vector<GCodeViewer::Color> GCodeViewer::Extrusion_Role_Colors {{
{ 0.75f, 0.75f, 0.75f }, // erNone
@ -599,10 +595,8 @@ void GCodeViewer::load(const GCodeProcessor::Result& gcode_result, const Print&
// release gpu memory, if used
reset();
#if ENABLE_GCODE_WINDOW
m_sequential_view.gcode_window.set_filename(gcode_result.filename);
m_sequential_view.gcode_window.load_gcode();
#endif // ENABLE_GCODE_WINDOW
load_toolpaths(gcode_result);
@ -761,9 +755,7 @@ void GCodeViewer::reset()
m_layers_z_range = { 0, 0 };
m_roles = std::vector<ExtrusionRole>();
m_print_statistics.reset();
#if ENABLE_GCODE_WINDOW
m_sequential_view.gcode_window.reset();
#endif // ENABLE_GCODE_WINDOW
#if ENABLE_GCODE_VIEWER_STATISTICS
m_statistics.reset_all();
#endif // ENABLE_GCODE_VIEWER_STATISTICS
@ -832,20 +824,12 @@ void GCodeViewer::render() const
glsafe(::glEnable(GL_DEPTH_TEST));
render_toolpaths();
render_shells();
#if ENABLE_GCODE_WINDOW
float legend_height = 0.0f;
render_legend(legend_height);
#else
render_legend();
#endif // ENABLE_GCODE_WINDOW
SequentialView* sequential_view = const_cast<SequentialView*>(&m_sequential_view);
if (sequential_view->current.last != sequential_view->endpoints.last) {
sequential_view->marker.set_world_position(sequential_view->current_position);
#if ENABLE_GCODE_WINDOW
sequential_view->render(legend_height);
#else
sequential_view->marker.render();
#endif // ENABLE_GCODE_WINDOW
}
#if ENABLE_GCODE_VIEWER_STATISTICS
render_statistics();
@ -1122,7 +1106,6 @@ void GCodeViewer::export_toolpaths_to_obj(const char* filename) const
fclose(fp);
}
#if ENABLE_GCODE_WINDOW
void GCodeViewer::start_mapping_gcode_window()
{
m_sequential_view.gcode_window.load_gcode();
@ -1132,7 +1115,6 @@ void GCodeViewer::stop_mapping_gcode_window()
{
m_sequential_view.gcode_window.stop_mapping_file();
}
#endif // ENABLE_GCODE_WINDOW
void GCodeViewer::load_toolpaths(const GCodeProcessor::Result& gcode_result)
{
@ -1443,12 +1425,10 @@ void GCodeViewer::load_toolpaths(const GCodeProcessor::Result& gcode_result)
m_max_bounding_box = m_paths_bounding_box;
m_max_bounding_box.merge(m_paths_bounding_box.max + m_sequential_view.marker.get_bounding_box().size()[2] * Vec3d::UnitZ());
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
m_sequential_view.gcode_ids.clear();
for (const GCodeProcessor::MoveVertex& move : gcode_result.moves) {
m_sequential_view.gcode_ids.push_back(move.gcode_id);
}
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
std::vector<MultiVertexBuffer> vertices(m_buffers.size());
std::vector<MultiIndexBuffer> indices(m_buffers.size());
@ -2594,11 +2574,7 @@ void GCodeViewer::render_shells() const
// glsafe(::glDepthMask(GL_TRUE));
}
#if ENABLE_GCODE_WINDOW
void GCodeViewer::render_legend(float& legend_height) const
#else
void GCodeViewer::render_legend() const
#endif // ENABLE_GCODE_WINDOW
{
if (!m_legend_enabled)
return;
@ -3476,9 +3452,7 @@ void GCodeViewer::render_legend() const
}
}
#if ENABLE_GCODE_WINDOW
legend_height = ImGui::GetCurrentWindow()->Size.y;
#endif // ENABLE_GCODE_WINDOW
imgui.end();
ImGui::PopStyleVar();

View file

@ -5,9 +5,7 @@
#include "libslic3r/GCode/GCodeProcessor.hpp"
#include "GLModel.hpp"
#if ENABLE_GCODE_WINDOW
#include <boost/iostreams/device/mapped_file.hpp>
#endif // ENABLE_GCODE_WINDOW
#include <cstdint>
#include <float.h>
@ -520,7 +518,6 @@ public:
void render() const;
};
#if ENABLE_GCODE_WINDOW
class GCodeWindow
{
struct Line
@ -557,7 +554,6 @@ public:
void stop_mapping_file();
};
#endif // ENABLE_GCODE_WINDOW
struct Endpoints
{
@ -571,16 +567,10 @@ public:
Endpoints last_current;
Vec3f current_position{ Vec3f::Zero() };
Marker marker;
#if ENABLE_GCODE_WINDOW
GCodeWindow gcode_window;
#endif // ENABLE_GCODE_WINDOW
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
std::vector<unsigned int> gcode_ids;
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
#if ENABLE_GCODE_WINDOW
void render(float legend_height) const;
#endif // ENABLE_GCODE_WINDOW
};
enum class EViewType : unsigned char
@ -673,11 +663,9 @@ public:
void export_toolpaths_to_obj(const char* filename) const;
#if ENABLE_GCODE_WINDOW
void start_mapping_gcode_window();
void stop_mapping_gcode_window();
void toggle_gcode_window_visibility() { m_sequential_view.gcode_window.toggle_visibility(); }
#endif // ENABLE_GCODE_WINDOW
private:
void load_toolpaths(const GCodeProcessor::Result& gcode_result);
@ -685,11 +673,7 @@ private:
void refresh_render_paths(bool keep_sequential_current_first, bool keep_sequential_current_last) const;
void render_toolpaths() const;
void render_shells() const;
#if ENABLE_GCODE_WINDOW
void render_legend(float& legend_height) const;
#else
void render_legend() const;
#endif // ENABLE_GCODE_WINDOW
#if ENABLE_GCODE_VIEWER_STATISTICS
void render_statistics() const;
#endif // ENABLE_GCODE_VIEWER_STATISTICS

View file

@ -169,17 +169,10 @@ void GLCanvas3D::LayersEditing::set_config(const DynamicPrintConfig* config)
void GLCanvas3D::LayersEditing::select_object(const Model &model, int object_id)
{
const ModelObject *model_object_new = (object_id >= 0) ? model.objects[object_id] : nullptr;
#if ENABLE_ALLOW_NEGATIVE_Z
// Maximum height of an object changes when the object gets rotated or scaled.
// Changing maximum height of an object will invalidate the layer heigth editing profile.
// m_model_object->bounding_box() is cached, therefore it is cheap even if this method is called frequently.
const float new_max_z = (model_object_new == nullptr) ? 0.0f : static_cast<float>(model_object_new->bounding_box().max.z());
#else
// Maximum height of an object changes when the object gets rotated or scaled.
// Changing maximum height of an object will invalidate the layer heigth editing profile.
// m_model_object->raw_bounding_box() is cached, therefore it is cheap even if this method is called frequently.
float new_max_z = (model_object_new == nullptr) ? 0.f : model_object_new->raw_bounding_box().size().z();
#endif // ENABLE_ALLOW_NEGATIVE_Z
if (m_model_object != model_object_new || this->last_object_id != object_id || m_object_max_z != new_max_z ||
(model_object_new != nullptr && m_model_object->id() != model_object_new->id())) {
m_layer_height_profile.clear();
@ -1119,7 +1112,6 @@ int GLCanvas3D::check_volumes_outside_state() const
return (int)state;
}
#if ENABLE_GCODE_WINDOW
void GLCanvas3D::start_mapping_gcode_window()
{
m_gcode_viewer.start_mapping_gcode_window();
@ -1129,7 +1121,6 @@ void GLCanvas3D::stop_mapping_gcode_window()
{
m_gcode_viewer.stop_mapping_gcode_window();
}
#endif // ENABLE_GCODE_WINDOW
void GLCanvas3D::toggle_sla_auxiliaries_visibility(bool visible, const ModelObject* mo, int instance_idx)
{
@ -2425,10 +2416,8 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
case 'a': { post_event(SimpleEvent(EVT_GLCANVAS_ARRANGE)); break; }
case 'B':
case 'b': { zoom_to_bed(); break; }
#if ENABLE_GCODE_WINDOW
case 'C':
case 'c': { m_gcode_viewer.toggle_gcode_window_visibility(); m_dirty = true; request_extra_frame(); break; }
#endif // ENABLE_GCODE_WINDOW
case 'E':
case 'e': { m_labels.show(!m_labels.is_shown()); m_dirty = true; break; }
case 'G':
@ -3411,37 +3400,21 @@ void GLCanvas3D::do_move(const std::string& snapshot_type)
wipe_tower_origin = v->get_volume_offset();
}
#if ENABLE_ALLOW_NEGATIVE_Z
// Fixes flying instances
#else
// Fixes sinking/flying instances
#endif // ENABLE_ALLOW_NEGATIVE_Z
for (const std::pair<int, int>& i : done) {
ModelObject* m = m_model->objects[i.first];
#if ENABLE_ALLOW_NEGATIVE_Z
const double shift_z = m->get_instance_min_z(i.second);
#if DISABLE_ALLOW_NEGATIVE_Z_FOR_SLA
if (current_printer_technology() == ptSLA || shift_z > SINKING_Z_THRESHOLD) {
#else
if (shift_z > 0.0) {
#endif // DISABLE_ALLOW_NEGATIVE_Z_FOR_SLA
const Vec3d shift(0.0, 0.0, -shift_z);
#else
const Vec3d shift(0.0, 0.0, -m->get_instance_min_z(i.second));
#endif // ENABLE_ALLOW_NEGATIVE_Z
m_selection.translate(i.first, i.second, shift);
m->translate_instance(i.second, shift);
#if ENABLE_ALLOW_NEGATIVE_Z
m_selection.translate(i.first, i.second, shift);
m->translate_instance(i.second, shift);
}
#endif // ENABLE_ALLOW_NEGATIVE_Z
}
#if ENABLE_ALLOW_NEGATIVE_Z
// if the selection is not valid to allow for layer editing after the move, we need to turn off the tool if it is running
// similar to void Plater::priv::selection_changed()
if (!wxGetApp().plater()->can_layers_editing() && is_layers_editing_enabled())
post_event(SimpleEvent(EVT_GLTOOLBAR_LAYERSEDITING));
#endif // ENABLE_ALLOW_NEGATIVE_Z
if (object_moved)
post_event(SimpleEvent(EVT_GLCANVAS_INSTANCE_MOVED));
@ -3462,7 +3435,6 @@ void GLCanvas3D::do_rotate(const std::string& snapshot_type)
if (!snapshot_type.empty())
wxGetApp().plater()->take_snapshot(_(snapshot_type));
#if ENABLE_ALLOW_NEGATIVE_Z
// stores current min_z of instances
std::map<std::pair<int, int>, double> min_zs;
if (!snapshot_type.empty()) {
@ -3473,7 +3445,6 @@ void GLCanvas3D::do_rotate(const std::string& snapshot_type)
}
}
}
#endif // ENABLE_ALLOW_NEGATIVE_Z
std::set<std::pair<int, int>> done; // keeps track of modified instances
@ -3511,19 +3482,13 @@ void GLCanvas3D::do_rotate(const std::string& snapshot_type)
// Fixes sinking/flying instances
for (const std::pair<int, int>& i : done) {
ModelObject* m = m_model->objects[i.first];
#if ENABLE_ALLOW_NEGATIVE_Z
double shift_z = m->get_instance_min_z(i.second);
// leave sinking instances as sinking
if (min_zs.empty() || min_zs.find({ i.first, i.second })->second >= SINKING_Z_THRESHOLD || shift_z > SINKING_Z_THRESHOLD) {
Vec3d shift(0.0, 0.0, -shift_z);
#else
Vec3d shift(0.0, 0.0, -m->get_instance_min_z(i.second));
#endif // ENABLE_ALLOW_NEGATIVE_Z
m_selection.translate(i.first, i.second, shift);
m->translate_instance(i.second, shift);
#if ENABLE_ALLOW_NEGATIVE_Z
}
#endif // ENABLE_ALLOW_NEGATIVE_Z
}
if (!done.empty())
@ -3540,7 +3505,6 @@ void GLCanvas3D::do_scale(const std::string& snapshot_type)
if (!snapshot_type.empty())
wxGetApp().plater()->take_snapshot(_(snapshot_type));
#if ENABLE_ALLOW_NEGATIVE_Z
// stores current min_z of instances
std::map<std::pair<int, int>, double> min_zs;
if (!snapshot_type.empty()) {
@ -3551,7 +3515,6 @@ void GLCanvas3D::do_scale(const std::string& snapshot_type)
}
}
}
#endif // ENABLE_ALLOW_NEGATIVE_Z
std::set<std::pair<int, int>> done; // keeps track of modified instances
@ -3586,19 +3549,13 @@ void GLCanvas3D::do_scale(const std::string& snapshot_type)
// Fixes sinking/flying instances
for (const std::pair<int, int>& i : done) {
ModelObject* m = m_model->objects[i.first];
#if ENABLE_ALLOW_NEGATIVE_Z
double shift_z = m->get_instance_min_z(i.second);
// leave sinking instances as sinking
if (min_zs.empty() || min_zs.find({ i.first, i.second })->second >= SINKING_Z_THRESHOLD || shift_z > SINKING_Z_THRESHOLD) {
Vec3d shift(0.0, 0.0, -shift_z);
#else
Vec3d shift(0.0, 0.0, -m->get_instance_min_z(i.second));
#endif // ENABLE_ALLOW_NEGATIVE_Z
m_selection.translate(i.first, i.second, shift);
m->translate_instance(i.second, shift);
#if ENABLE_ALLOW_NEGATIVE_Z
m_selection.translate(i.first, i.second, shift);
m->translate_instance(i.second, shift);
}
#endif // ENABLE_ALLOW_NEGATIVE_Z
}
if (!done.empty())
@ -4903,6 +4860,7 @@ void GLCanvas3D::_rectangular_selection_picking_pass()
glsafe(::glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));
_render_volumes_for_picking();
_render_bed_for_picking(!wxGetApp().plater()->get_camera().is_looking_downward());
if (m_multisample_allowed)
glsafe(::glEnable(GL_MULTISAMPLE));
@ -4921,7 +4879,10 @@ void GLCanvas3D::_rectangular_selection_picking_pass()
std::array<GLubyte, 4> data;
// Only non-interpolated colors are valid, those have their lowest three bits zeroed.
bool valid() const { return picking_checksum_alpha_channel(data[0], data[1], data[2]) == data[3]; }
int id() const { return data[0] + (data[1] << 8) + (data[2] << 16); }
// we reserve color = (0,0,0) for occluders (as the printbed)
// volumes' id are shifted by 1
// see: _render_volumes_for_picking()
int id() const { return data[0] + (data[1] << 8) + (data[2] << 16) - 1; }
};
std::vector<Pixel> frame(px_count);

View file

@ -544,10 +544,8 @@ public:
const GCodeViewer::SequentialView& get_gcode_sequential_view() const { return m_gcode_viewer.get_sequential_view(); }
void update_gcode_sequential_view_current(unsigned int first, unsigned int last) { m_gcode_viewer.update_sequential_view_current(first, last); }
#if ENABLE_GCODE_WINDOW
void start_mapping_gcode_window();
void stop_mapping_gcode_window();
#endif // ENABLE_GCODE_WINDOW
void toggle_sla_auxiliaries_visibility(bool visible, const ModelObject* mo = nullptr, int instance_idx = -1);
void toggle_model_objects_visibility(bool visible, const ModelObject* mo = nullptr, int instance_idx = -1);

View file

@ -1908,11 +1908,7 @@ void GUI_App::add_config_menu(wxMenuBar *menu)
PreferencesDialog dlg(mainframe);
dlg.ShowModal();
app_layout_changed = dlg.settings_layout_changed();
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
if (dlg.seq_top_layer_only_changed() || dlg.seq_seq_top_gcode_indices_changed())
#else
if (dlg.seq_top_layer_only_changed())
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
this->plater_->refresh_print();
if (dlg.recreate_GUI()) {

View file

@ -30,28 +30,9 @@ const double ObjectManipulation::mm_to_in = 0.0393700787;
// volume in world coordinate system.
static double get_volume_min_z(const GLVolume& volume)
{
#if ENABLE_ALLOW_NEGATIVE_Z
return volume.transformed_convex_hull_bounding_box().min.z();
#else
const Transform3f& world_matrix = volume.world_matrix().cast<float>();
// need to get the ModelVolume pointer
const ModelObject* mo = wxGetApp().model().objects[volume.composite_id.object_id];
const ModelVolume* mv = mo->volumes[volume.composite_id.volume_id];
const TriangleMesh& hull = mv->get_convex_hull();
float min_z = std::numeric_limits<float>::max();
for (const stl_facet& facet : hull.stl.facet_start) {
for (int i = 0; i < 3; ++i)
min_z = std::min(min_z, Vec3f::UnitZ().dot(world_matrix * facet.vertex[i]));
}
return min_z;
#endif // ENABLE_ALLOW_NEGATIVE_Z
}
static choice_ctrl* create_word_local_combo(wxWindow *parent)
{
wxSize size(15 * wxGetApp().em_unit(), -1);
@ -358,7 +339,6 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent) :
change_position_value(1, diff.y());
change_position_value(2, diff.z());
}
#if ENABLE_ALLOW_NEGATIVE_Z
else if (selection.is_single_full_instance()) {
const ModelObjectPtrs& objects = wxGetApp().model().objects;
const int idx = selection.get_object_idx();
@ -371,7 +351,6 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent) :
}
}
}
#endif // ENABLE_ALLOW_NEGATIVE_Z
});
editors_grid_sizer->Add(m_drop_to_bed_button);
@ -702,10 +681,7 @@ void ObjectManipulation::update_reset_buttons_visibility()
if (selection.is_single_full_instance()) {
rotation = volume->get_instance_rotation();
scale = volume->get_instance_scaling_factor();
#if ENABLE_ALLOW_NEGATIVE_Z
min_z = wxGetApp().model().objects[volume->composite_id.object_id]->bounding_box().min.z();
#endif // ENABLE_ALLOW_NEGATIVE_Z
}
else {
rotation = volume->get_volume_rotation();
@ -714,11 +690,7 @@ void ObjectManipulation::update_reset_buttons_visibility()
}
show_rotation = !rotation.isApprox(Vec3d::Zero());
show_scale = !scale.isApprox(Vec3d::Ones());
#if ENABLE_ALLOW_NEGATIVE_Z
show_drop_to_bed = std::abs(min_z) > SINKING_Z_THRESHOLD;
#else
show_drop_to_bed = (std::abs(min_z) > EPSILON);
#endif // ENABLE_ALLOW_NEGATIVE_Z
}
wxGetApp().CallAfter([this, show_rotation, show_scale, show_drop_to_bed] {

View file

@ -834,25 +834,17 @@ void Preview::update_moves_slider()
return;
std::vector<double> values(view.endpoints.last - view.endpoints.first + 1);
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
std::vector<double> alternate_values(view.endpoints.last - view.endpoints.first + 1);
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
unsigned int count = 0;
for (unsigned int i = view.endpoints.first; i <= view.endpoints.last; ++i) {
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
values[count] = static_cast<double>(i + 1);
if (view.gcode_ids[i] > 0)
alternate_values[count] = static_cast<double>(view.gcode_ids[i]);
++count;
#else
values[count++] = static_cast<double>(i + 1);
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
}
m_moves_slider->SetSliderValues(values);
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
m_moves_slider->SetSliderAlternateValues(alternate_values);
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
m_moves_slider->SetMaxValue(view.endpoints.last - view.endpoints.first);
m_moves_slider->SetSelectionSpan(view.current.first - view.endpoints.first, view.current.last - view.endpoints.first);
}

View file

@ -219,9 +219,7 @@ static void add_default_image(wxImageList* img_list, bool is_system)
static fs::path get_dir(bool sys_dir)
{
if (sys_dir)
return fs::absolute(fs::path(sys_shapes_dir())).make_preferred();
return fs::absolute(fs::path(data_dir()) / "shapes").make_preferred();
return fs::absolute(fs::path(sys_dir ? sys_shapes_dir() : custom_shapes_dir())).make_preferred();
}
static std::string get_dir_path(bool sys_dir)
@ -255,11 +253,7 @@ static void generate_thumbnail_from_stl(const std::string& filename)
assert(model.objects[0]->instances.size() == 1);
model.objects[0]->center_around_origin(false);
#if ENABLE_ALLOW_NEGATIVE_Z
model.objects[0]->ensure_on_bed(false);
#else
model.objects[0]->ensure_on_bed();
#endif // ENABLE_ALLOW_NEGATIVE_Z
const Vec3d bed_center_3d = wxGetApp().plater()->get_bed().get_bounding_box(false).center();
const Vec2d bed_center_2d = { bed_center_3d.x(), bed_center_3d.y()};

View file

@ -368,8 +368,6 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
ImGui::PopTextWrapPos();
ImGui::EndTooltip();
}
// Manually inserted values aren't clamped by ImGui. Zero cursor size results in a crash.
m_cursor_radius = std::clamp(m_cursor_radius, CursorRadiusMin, CursorRadiusMax);
ImGui::Separator();
@ -435,6 +433,8 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
ImGui::PopTextWrapPos();
ImGui::EndTooltip();
}
// Manually inserted values aren't clamped by ImGui. Zero cursor size results in a crash.
m_cursor_radius = std::clamp(m_cursor_radius, CursorRadiusMin, CursorRadiusMax);
m_imgui->checkbox(_L("Split triangles"), m_triangle_splitting_enabled);

View file

@ -221,9 +221,7 @@ void KBShortcutsDialog::fill_shortcuts()
{ "D", L("Horizontal slider - Move active thumb Right") },
{ "X", L("On/Off one layer mode of the vertical slider") },
{ "L", L("Show/Hide Legend and Estimated printing time") },
#if ENABLE_GCODE_WINDOW
{ "C", L("Show/Hide G-code window") },
#endif // ENABLE_GCODE_WINDOW
};
m_full_shortcuts.push_back({ { _L("Preview"), "" }, preview_shortcuts });

View file

@ -675,14 +675,12 @@ void MainFrame::init_tabpanel()
#else
m_tabpanel->Bind(wxEVT_NOTEBOOK_PAGE_CHANGED, [this](wxBookCtrlEvent& e) {
#endif
#if ENABLE_VALIDATE_CUSTOM_GCODE
if (int old_selection = e.GetOldSelection();
old_selection != wxNOT_FOUND && old_selection < static_cast<int>(m_tabpanel->GetPageCount())) {
Tab* old_tab = dynamic_cast<Tab*>(m_tabpanel->GetPage(old_selection));
if (old_tab)
old_tab->validate_custom_gcodes();
}
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
wxWindow* panel = m_tabpanel->GetCurrentPage();
Tab* tab = dynamic_cast<Tab*>(panel);

View file

@ -1650,11 +1650,8 @@ struct Plater::priv
BoundingBox scaled_bed_shape_bb() const;
std::vector<size_t> load_files(const std::vector<fs::path>& input_files, bool load_model, bool load_config, bool used_inches = false);
#if ENABLE_ALLOW_NEGATIVE_Z
std::vector<size_t> load_model_objects(const ModelObjectPtrs& model_objects, bool allow_negative_z = false);
#else
std::vector<size_t> load_model_objects(const ModelObjectPtrs &model_objects);
#endif // ENABLE_ALLOW_NEGATIVE_Z
wxString get_export_file(GUI::FileType file_type);
const Selection& get_selection() const;
@ -2417,19 +2414,11 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
return obj_idxs;
}
#if ENABLE_ALLOW_NEGATIVE_Z
for (ModelObject* model_object : model.objects) {
if (!type_3mf && !type_zip_amf)
model_object->center_around_origin(false);
model_object->ensure_on_bed(is_project_file);
}
#else
for (ModelObject* model_object : model.objects) {
if (!type_3mf && !type_zip_amf)
model_object->center_around_origin(false);
model_object->ensure_on_bed();
}
#endif // ENABLE_ALLOW_NEGATIVE_Z
// check multi-part object adding for the SLA-printing
if (printer_technology == ptSLA) {
@ -2443,11 +2432,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
}
if (one_by_one) {
#if ENABLE_ALLOW_NEGATIVE_Z
auto loaded_idxs = load_model_objects(model.objects, is_project_file);
#else
auto loaded_idxs = load_model_objects(model.objects);
#endif // ENABLE_ALLOW_NEGATIVE_Z
obj_idxs.insert(obj_idxs.end(), loaded_idxs.begin(), loaded_idxs.end());
} else {
// This must be an .stl or .obj file, which may contain a maximum of one volume.
@ -2500,11 +2485,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
// #define AUTOPLACEMENT_ON_LOAD
#if ENABLE_ALLOW_NEGATIVE_Z
std::vector<size_t> Plater::priv::load_model_objects(const ModelObjectPtrs& model_objects, bool allow_negative_z)
#else
std::vector<size_t> Plater::priv::load_model_objects(const ModelObjectPtrs &model_objects)
#endif // ENABLE_ALLOW_NEGATIVE_Z
{
const BoundingBoxf bed_shape = bed_shape_bb();
const Vec3d bed_size = Slic3r::to_3d(bed_shape.size().cast<double>(), 1.0) - 2.0 * Vec3d::Ones();
@ -2582,11 +2563,7 @@ std::vector<size_t> Plater::priv::load_model_objects(const ModelObjectPtrs &mode
}
#endif // ENABLE_MODIFIED_DOWNSCALE_ON_LOAD_OBJECTS_TOO_BIG
#if ENABLE_ALLOW_NEGATIVE_Z
object->ensure_on_bed(allow_negative_z);
#else
object->ensure_on_bed();
#endif // ENABLE_ALLOW_NEGATIVE_Z
}
#ifdef AUTOPLACEMENT_ON_LOAD
@ -3247,9 +3224,7 @@ void Plater::priv::replace_with_stl()
ModelObject* old_model_object = model.objects[object_idx];
ModelVolume* old_volume = old_model_object->volumes[volume_idx];
#if ENABLE_ALLOW_NEGATIVE_Z
bool sinking = old_model_object->bounding_box().min.z() < SINKING_Z_THRESHOLD;
#endif // ENABLE_ALLOW_NEGATIVE_Z
ModelObject* new_model_object = new_model.objects[0];
old_model_object->add_volume(*new_model_object->volumes[0]);
@ -3269,9 +3244,7 @@ void Plater::priv::replace_with_stl()
new_volume->mmu_segmentation_facets.assign(old_volume->mmu_segmentation_facets);
std::swap(old_model_object->volumes[volume_idx], old_model_object->volumes.back());
old_model_object->delete_volume(old_model_object->volumes.size() - 1);
#if ENABLE_ALLOW_NEGATIVE_Z
if (!sinking)
#endif // ENABLE_ALLOW_NEGATIVE_Z
old_model_object->ensure_on_bed();
old_model_object->sort_volumes(wxGetApp().app_config->get("order_volumes") == "1");
@ -3422,9 +3395,7 @@ void Plater::priv::reload_from_disk()
ModelObject* old_model_object = model.objects[sel_v.object_idx];
ModelVolume* old_volume = old_model_object->volumes[sel_v.volume_idx];
#if ENABLE_ALLOW_NEGATIVE_Z
bool sinking = old_model_object->bounding_box().min.z() < SINKING_Z_THRESHOLD;
#endif // ENABLE_ALLOW_NEGATIVE_Z
bool has_source = !old_volume->source.input_file.empty() && boost::algorithm::iequals(fs::path(old_volume->source.input_file).filename().string(), fs::path(path).filename().string());
bool has_name = !old_volume->name.empty() && boost::algorithm::iequals(old_volume->name, fs::path(path).filename().string());
@ -3481,9 +3452,7 @@ void Plater::priv::reload_from_disk()
new_volume->mmu_segmentation_facets.assign(old_volume->mmu_segmentation_facets);
std::swap(old_model_object->volumes[sel_v.volume_idx], old_model_object->volumes.back());
old_model_object->delete_volume(old_model_object->volumes.size() - 1);
#if ENABLE_ALLOW_NEGATIVE_Z
if (!sinking)
#endif // ENABLE_ALLOW_NEGATIVE_Z
old_model_object->ensure_on_bed();
old_model_object->sort_volumes(wxGetApp().app_config->get("order_volumes") == "1");
@ -4277,12 +4246,8 @@ bool Plater::priv::layers_height_allowed() const
return false;
int obj_idx = get_selected_object_idx();
#if ENABLE_ALLOW_NEGATIVE_Z
return 0 <= obj_idx && obj_idx < (int)model.objects.size() && model.objects[obj_idx]->bounding_box().max.z() > SINKING_Z_THRESHOLD &&
config->opt_bool("variable_layer_height") && view3D->is_layers_editing_allowed();
#else
return 0 <= obj_idx && obj_idx < (int)model.objects.size() && config->opt_bool("variable_layer_height") && view3D->is_layers_editing_allowed();
#endif // ENABLE_ALLOW_NEGATIVE_Z
}
bool Plater::priv::can_mirror() const
@ -6177,7 +6142,6 @@ BoundingBoxf Plater::bed_shape_bb() const
return p->bed_shape_bb();
}
#if ENABLE_GCODE_WINDOW
void Plater::start_mapping_gcode_window()
{
p->preview->get_canvas3d()->start_mapping_gcode_window();
@ -6187,7 +6151,6 @@ void Plater::stop_mapping_gcode_window()
{
p->preview->get_canvas3d()->stop_mapping_gcode_window();
}
#endif // ENABLE_GCODE_WINDOW
void Plater::arrange()
{
@ -6226,13 +6189,11 @@ bool Plater::set_printer_technology(PrinterTechnology printer_technology)
//FIXME for SLA synchronize
//p->background_process.apply(Model)!
#if DISABLE_ALLOW_NEGATIVE_Z_FOR_SLA
if (printer_technology == ptSLA) {
for (ModelObject* model_object : p->model.objects) {
model_object->ensure_on_bed();
}
}
#endif // DISABLE_ALLOW_NEGATIVE_Z_FOR_SLA
p->label_btn_export = printer_technology == ptFFF ? L("Export G-code") : L("Export");
p->label_btn_send = printer_technology == ptFFF ? L("Send G-code") : L("Send to printer");
@ -6253,15 +6214,7 @@ void Plater::changed_object(int obj_idx)
return;
// recenter and re - align to Z = 0
auto model_object = p->model.objects[obj_idx];
#if ENABLE_ALLOW_NEGATIVE_Z
#if DISABLE_ALLOW_NEGATIVE_Z_FOR_SLA
model_object->ensure_on_bed(this->p->printer_technology != ptSLA);
#else
model_object->ensure_on_bed(true);
#endif // DISABLE_ALLOW_NEGATIVE_Z_FOR_SLA
#else
model_object->ensure_on_bed();
#endif // ENABLE_ALLOW_NEGATIVE_Z
if (this->p->printer_technology == ptSLA) {
// Update the SLAPrint from the current Model, so that the reload_scene()
// pulls the correct data, update the 3D scene.
@ -6280,17 +6233,11 @@ void Plater::changed_objects(const std::vector<size_t>& object_idxs)
return;
for (size_t obj_idx : object_idxs) {
#if ENABLE_ALLOW_NEGATIVE_Z
if (obj_idx < p->model.objects.size()) {
if (p->model.objects[obj_idx]->bounding_box().min.z() >= SINKING_Z_THRESHOLD)
// re - align to Z = 0
p->model.objects[obj_idx]->ensure_on_bed();
}
#else
if (obj_idx < p->model.objects.size())
// recenter and re - align to Z = 0
p->model.objects[obj_idx]->ensure_on_bed();
#endif // ENABLE_ALLOW_NEGATIVE_Z
}
if (this->p->printer_technology == ptSLA) {
// Update the SLAPrint from the current Model, so that the reload_scene()

View file

@ -285,10 +285,8 @@ public:
GLCanvas3D* get_current_canvas3D();
BoundingBoxf bed_shape_bb() const;
#if ENABLE_GCODE_WINDOW
void start_mapping_gcode_window();
void stop_mapping_gcode_window();
#endif // ENABLE_GCODE_WINDOW
void arrange();
void find_new_position(const ModelInstancePtrs &instances);

View file

@ -292,7 +292,6 @@ void PreferencesDialog::build()
option = Option(def, "seq_top_layer_only");
m_optgroup_gui->append_single_option_line(option);
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
def.label = L("Sequential slider shows gcode line numbers");
def.type = coBool;
def.tooltip = L("If enabled, the sequential slider, in preview, shows the gcode lines numbers."
@ -300,7 +299,6 @@ void PreferencesDialog::build()
def.set_default_value(new ConfigOptionBool{ app_config->get("seq_top_gcode_indices") == "1" });
option = Option(def, "seq_top_gcode_indices");
m_optgroup_gui->append_single_option_line(option);
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
if (is_editor) {
def.label = L("Show sidebar collapse/expand button");
@ -438,11 +436,9 @@ void PreferencesDialog::accept(wxEvent&)
if (auto it = m_values.find("seq_top_layer_only"); it != m_values.end())
m_seq_top_layer_only_changed = app_config->get("seq_top_layer_only") != it->second;
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
m_seq_top_gcode_indices_changed = false;
if (auto it = m_values.find("seq_top_gcode_indices"); it != m_values.end())
m_seq_top_gcode_indices_changed = app_config->get("seq_top_gcode_indices") != it->second;
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
m_settings_layout_changed = false;
for (const std::string& key : { "old_settings_layout_mode",

View file

@ -29,9 +29,7 @@ class PreferencesDialog : public DPIDialog
bool isOSX {false};
bool m_settings_layout_changed {false};
bool m_seq_top_layer_only_changed{ false };
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
bool m_seq_top_gcode_indices_changed{ false };
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
bool m_recreate_GUI{false};
public:
@ -40,12 +38,10 @@ public:
bool settings_layout_changed() const { return m_settings_layout_changed; }
bool seq_top_layer_only_changed() const { return m_seq_top_layer_only_changed; }
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
bool seq_seq_top_gcode_indices_changed() const { return m_seq_top_gcode_indices_changed; }
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
bool recreate_GUI() const { return m_recreate_GUI; }
void build();
void accept(wxEvent&);
void build();
void accept(wxEvent&);
protected:
void on_dpi_changed(const wxRect &suggested_rect) override;

View file

@ -13,9 +13,7 @@
#include "libslic3r/LocalesUtils.hpp"
#include "libslic3r/Model.hpp"
#if DISABLE_ALLOW_NEGATIVE_Z_FOR_SLA
#include "libslic3r/PresetBundle.hpp"
#endif // DISABLE_ALLOW_NEGATIVE_Z_FOR_SLA
#include <GL/glew.h>
@ -850,21 +848,13 @@ void Selection::scale(const Vec3d& scale, TransformationType transformation_type
if (!m_valid)
return;
#if ENABLE_ALLOW_NEGATIVE_Z
bool is_any_volume_sinking = false;
#if DISABLE_ALLOW_NEGATIVE_Z_FOR_SLA
bool is_sla = wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() == ptSLA;
#endif // DISABLE_ALLOW_NEGATIVE_Z_FOR_SLA
#endif // ENABLE_ALLOW_NEGATIVE_Z
for (unsigned int i : m_list) {
GLVolume &v = *(*m_volumes)[i];
#if ENABLE_ALLOW_NEGATIVE_Z
#if DISABLE_ALLOW_NEGATIVE_Z_FOR_SLA
if (!is_sla)
#endif // DISABLE_ALLOW_NEGATIVE_Z_FOR_SLA
is_any_volume_sinking |= !v.is_modifier && std::find(m_cache.sinking_volumes.begin(), m_cache.sinking_volumes.end(), i) != m_cache.sinking_volumes.end();
#endif // ENABLE_ALLOW_NEGATIVE_Z
if (is_single_full_instance()) {
if (transformation_type.relative()) {
Transform3d m = Geometry::assemble_transform(Vec3d::Zero(), Vec3d::Zero(), scale);
@ -923,10 +913,8 @@ void Selection::scale(const Vec3d& scale, TransformationType transformation_type
synchronize_unselected_volumes();
#endif // !DISABLE_INSTANCES_SYNCH
#if ENABLE_ALLOW_NEGATIVE_Z
if (!is_any_volume_sinking)
ensure_on_bed();
#endif // ENABLE_ALLOW_NEGATIVE_Z
this->set_bounding_boxes_dirty();
}
@ -1675,16 +1663,12 @@ void Selection::update_type()
void Selection::set_caches()
{
m_cache.volumes_data.clear();
#if ENABLE_ALLOW_NEGATIVE_Z
m_cache.sinking_volumes.clear();
#endif // ENABLE_ALLOW_NEGATIVE_Z
for (unsigned int i = 0; i < (unsigned int)m_volumes->size(); ++i) {
const GLVolume& v = *(*m_volumes)[i];
m_cache.volumes_data.emplace(i, VolumeCache(v.get_volume_transformation(), v.get_instance_transformation()));
#if ENABLE_ALLOW_NEGATIVE_Z
if (v.is_sinking())
m_cache.sinking_volumes.push_back(i);
#endif // ENABLE_ALLOW_NEGATIVE_Z
}
m_cache.dragging_center = get_bounding_box().center();
}
@ -2089,21 +2073,12 @@ void Selection::synchronize_unselected_instances(SyncRotationType sync_rotation_
assert(is_rotation_xy_synchronized(m_cache.volumes_data[i].get_instance_rotation(), m_cache.volumes_data[j].get_instance_rotation()));
switch (sync_rotation_type) {
case SYNC_ROTATION_NONE: {
#if ENABLE_ALLOW_NEGATIVE_Z
// z only rotation -> synch instance z
// The X,Y rotations should be synchronized from start to end of the rotation.
assert(is_rotation_xy_synchronized(rotation, v->get_instance_rotation()));
#if DISABLE_ALLOW_NEGATIVE_Z_FOR_SLA
if (wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() != ptSLA)
#endif // DISABLE_ALLOW_NEGATIVE_Z_FOR_SLA
v->set_instance_offset(Z, volume->get_instance_offset().z());
break;
#else
// z only rotation -> keep instance z
// The X,Y rotations should be synchronized from start to end of the rotation.
assert(is_rotation_xy_synchronized(rotation, v->get_instance_rotation()));
break;
#endif // ENABLE_ALLOW_NEGATIVE_Z
}
case SYNC_ROTATION_FULL:
// rotation comes from place on face -> force given z

View file

@ -186,10 +186,8 @@ private:
// to a set of indices of ModelVolume instances in ModelObject::instances
// Here the index means a position inside the respective std::vector, not ObjectID.
ObjectIdxsToInstanceIdxsMap content;
#if ENABLE_ALLOW_NEGATIVE_Z
// List of ids of the volumes which are sinking when starting dragging
std::vector<unsigned int> sinking_volumes;
#endif // ENABLE_ALLOW_NEGATIVE_Z
};
// Volumes owned by GLCanvas3D.

View file

@ -5,9 +5,7 @@
#include "libslic3r/PresetBundle.hpp"
#include "libslic3r/Utils.hpp"
#include "libslic3r/Model.hpp"
#if ENABLE_VALIDATE_CUSTOM_GCODE
#include "libslic3r/GCode/GCodeProcessor.hpp"
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
#include "slic3r/Utils/Http.hpp"
#include "slic3r/Utils/PrintHost.hpp"
@ -1744,7 +1742,6 @@ void TabPrint::clear_pages()
m_top_bottom_shell_thickness_explanation = nullptr;
}
#if ENABLE_VALIDATE_CUSTOM_GCODE
bool Tab::validate_custom_gcode(const wxString& title, const std::string& gcode)
{
std::vector<std::string> tags;
@ -1770,7 +1767,6 @@ static void validate_custom_gcode_cb(Tab* tab, ConfigOptionsGroupShp opt_group,
tab->update_dirty();
tab->on_value_change(opt_key, value);
}
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
void TabFilament::add_filament_overrides_page()
{
@ -1996,11 +1992,9 @@ void TabFilament::build()
page = add_options_page(L("Custom G-code"), "cog");
optgroup = page->new_optgroup(L("Start G-code"), 0);
#if ENABLE_VALIDATE_CUSTOM_GCODE
optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) {
validate_custom_gcode_cb(this, optgroup, opt_key, value);
};
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
option = optgroup->get_option("start_filament_gcode");
option.opt.full_width = true;
option.opt.is_code = true;
@ -2008,11 +2002,9 @@ void TabFilament::build()
optgroup->append_single_option_line(option);
optgroup = page->new_optgroup(L("End G-code"), 0);
#if ENABLE_VALIDATE_CUSTOM_GCODE
optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) {
validate_custom_gcode_cb(this, optgroup, opt_key, value);
};
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
option = optgroup->get_option("end_filament_gcode");
option.opt.full_width = true;
option.opt.is_code = true;
@ -2323,11 +2315,9 @@ void TabPrinter::build_fff()
const int notes_field_height = 25; // 250
page = add_options_page(L("Custom G-code"), "cog");
optgroup = page->new_optgroup(L("Start G-code"), 0);
#if ENABLE_VALIDATE_CUSTOM_GCODE
optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) {
validate_custom_gcode_cb(this, optgroup, opt_key, value);
};
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
option = optgroup->get_option("start_gcode");
option.opt.full_width = true;
option.opt.is_code = true;
@ -2335,11 +2325,9 @@ void TabPrinter::build_fff()
optgroup->append_single_option_line(option);
optgroup = page->new_optgroup(L("End G-code"), 0);
#if ENABLE_VALIDATE_CUSTOM_GCODE
optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) {
validate_custom_gcode_cb(this, optgroup, opt_key, value);
};
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
option = optgroup->get_option("end_gcode");
option.opt.full_width = true;
option.opt.is_code = true;
@ -2347,11 +2335,9 @@ void TabPrinter::build_fff()
optgroup->append_single_option_line(option);
optgroup = page->new_optgroup(L("Before layer change G-code"), 0);
#if ENABLE_VALIDATE_CUSTOM_GCODE
optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) {
validate_custom_gcode_cb(this, optgroup, opt_key, value);
};
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
option = optgroup->get_option("before_layer_gcode");
option.opt.full_width = true;
option.opt.is_code = true;
@ -2359,11 +2345,9 @@ void TabPrinter::build_fff()
optgroup->append_single_option_line(option);
optgroup = page->new_optgroup(L("After layer change G-code"), 0);
#if ENABLE_VALIDATE_CUSTOM_GCODE
optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) {
validate_custom_gcode_cb(this, optgroup, opt_key, value);
};
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
option = optgroup->get_option("layer_gcode");
option.opt.full_width = true;
option.opt.is_code = true;
@ -2371,11 +2355,9 @@ void TabPrinter::build_fff()
optgroup->append_single_option_line(option);
optgroup = page->new_optgroup(L("Tool change G-code"), 0);
#if ENABLE_VALIDATE_CUSTOM_GCODE
optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) {
validate_custom_gcode_cb(this, optgroup, opt_key, value);
};
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
option = optgroup->get_option("toolchange_gcode");
option.opt.full_width = true;
option.opt.is_code = true;
@ -2383,11 +2365,9 @@ void TabPrinter::build_fff()
optgroup->append_single_option_line(option);
optgroup = page->new_optgroup(L("Between objects G-code (for sequential printing)"), 0);
#if ENABLE_VALIDATE_CUSTOM_GCODE
optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) {
validate_custom_gcode_cb(this, optgroup, opt_key, value);
};
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
option = optgroup->get_option("between_objects_gcode");
option.opt.full_width = true;
option.opt.is_code = true;
@ -2395,33 +2375,27 @@ void TabPrinter::build_fff()
optgroup->append_single_option_line(option);
optgroup = page->new_optgroup(L("Color Change G-code"), 0);
#if ENABLE_VALIDATE_CUSTOM_GCODE
optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) {
validate_custom_gcode_cb(this, optgroup, opt_key, value);
};
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
option = optgroup->get_option("color_change_gcode");
option.opt.is_code = true;
option.opt.height = gcode_field_height;//150;
optgroup->append_single_option_line(option);
optgroup = page->new_optgroup(L("Pause Print G-code"), 0);
#if ENABLE_VALIDATE_CUSTOM_GCODE
optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) {
validate_custom_gcode_cb(this, optgroup, opt_key, value);
};
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
option = optgroup->get_option("pause_print_gcode");
option.opt.is_code = true;
option.opt.height = gcode_field_height;//150;
optgroup->append_single_option_line(option);
optgroup = page->new_optgroup(L("Template Custom G-code"), 0);
#if ENABLE_VALIDATE_CUSTOM_GCODE
optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) {
validate_custom_gcode_cb(this, optgroup, opt_key, value);
};
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
option = optgroup->get_option("template_custom_gcode");
option.opt.is_code = true;
option.opt.height = gcode_field_height;//150;
@ -3904,7 +3878,6 @@ void TabPrinter::apply_extruder_cnt_from_cache()
}
}
#if ENABLE_VALIDATE_CUSTOM_GCODE
bool Tab::validate_custom_gcodes()
{
if (m_type != Preset::TYPE_FILAMENT &&
@ -3930,7 +3903,6 @@ bool Tab::validate_custom_gcodes()
}
return valid;
}
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
void TabPrinter::update_machine_limits_description(const MachineLimitsUsage usage)
{
@ -4157,7 +4129,6 @@ ConfigOptionsGroupShp Page::new_optgroup(const wxString& title, int noncommon_la
return optgroup;
}
#if ENABLE_VALIDATE_CUSTOM_GCODE
const ConfigOptionsGroupShp Page::get_optgroup(const wxString& title) const
{
for (ConfigOptionsGroupShp optgroup : m_optgroups) {
@ -4167,7 +4138,6 @@ const ConfigOptionsGroupShp Page::get_optgroup(const wxString& title) const
return nullptr;
}
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
void TabSLAMaterial::build()
{

View file

@ -79,9 +79,7 @@ public:
Field* get_field(const t_config_option_key& opt_key, int opt_index = -1) const;
bool set_value(const t_config_option_key& opt_key, const boost::any& value);
ConfigOptionsGroupShp new_optgroup(const wxString& title, int noncommon_label_width = -1);
#if ENABLE_VALIDATE_CUSTOM_GCODE
const ConfigOptionsGroupShp get_optgroup(const wxString& title) const;
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
bool set_item_colour(const wxColour *clr) {
if (m_item_color != clr) {
@ -357,11 +355,9 @@ public:
const std::map<wxString, std::string>& get_category_icon_map() { return m_category_icon; }
#if ENABLE_VALIDATE_CUSTOM_GCODE
static bool validate_custom_gcode(const wxString& title, const std::string& gcode);
bool validate_custom_gcodes();
bool validate_custom_gcodes_was_shown { false };
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
bool validate_custom_gcodes_was_shown{ false };
protected:
void create_line_with_widget(ConfigOptionsGroup* optgroup, const std::string& opt_key, const wxString& path, widget_t widget);