Skip to content

Commit

Permalink
Revert "Fix Compile Warnings (#5963)"
Browse files Browse the repository at this point in the history
This reverts commit b83e16d.

Found regressions like auto orientation didn't work anymore after this change, revert it
  • Loading branch information
SoftFever committed Aug 11, 2024
1 parent 0286c36 commit 7082e94
Show file tree
Hide file tree
Showing 184 changed files with 1,092 additions and 462 deletions.
2 changes: 1 addition & 1 deletion src/BaseException.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ void CBaseException::ShowExceptionInformation()

OutputString(_T("Exception Flag :0x%x "), m_pEp->ExceptionRecord->ExceptionFlags);
OutputString(_T("NumberParameters :%ld \n"), m_pEp->ExceptionRecord->NumberParameters);
for (unsigned int i = 0; i < m_pEp->ExceptionRecord->NumberParameters; i++)
for (int i = 0; i < m_pEp->ExceptionRecord->NumberParameters; i++)
{
OutputString(_T("Param %d :0x%x \n"), i, m_pEp->ExceptionRecord->ExceptionInformation[i]);
}
Expand Down
29 changes: 19 additions & 10 deletions src/OrcaSlicer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1190,8 +1190,9 @@ int CLI::run(int argc, char **argv)
//BBS: add plate data related logic
PlateDataPtrs plate_data_src;
std::vector<plate_obj_size_info_t> plate_obj_size_infos;
int arrange_option;
int plate_to_slice = 0, filament_count = 0, duplicate_count = 0, real_duplicate_count = 0;
bool first_file = true, is_bbl_3mf = false, need_arrange = true, up_config_to_date = false, normative_check = true, duplicate_single_object = false, use_first_fila_as_default = false, minimum_save = false, enable_timelapse = false;
bool first_file = true, is_bbl_3mf = false, need_arrange = true, has_thumbnails = false, up_config_to_date = false, normative_check = true, duplicate_single_object = false, use_first_fila_as_default = false, minimum_save = false, enable_timelapse = false;
bool allow_rotations = true, skip_modified_gcodes = false, avoid_extrusion_cali_region = false, skip_useless_pick = false, allow_newer_file = false;
Semver file_version;
std::map<size_t, bool> orients_requirement;
Expand Down Expand Up @@ -1545,7 +1546,7 @@ int CLI::run(int argc, char **argv)
{
ModelObject* object = model.objects[obj_index];

for (int clone_index = 1; clone_index < clone_count; clone_index++)
for (unsigned int clone_index = 1; clone_index < clone_count; clone_index++)
{
ModelObject* newObj = model.add_object(*object);
newObj->name = object->name +"_"+ std::to_string(clone_index+1);
Expand Down Expand Up @@ -1618,7 +1619,7 @@ int CLI::run(int argc, char **argv)
}
}
catch (std::exception& e) {
boost::nowide::cerr << "construct_assemble_list: " << e.what() << std::endl;
boost::nowide::cerr << construct_assemble_list << ": " << e.what() << std::endl;
record_exit_reson(outfile_dir, CLI_DATA_FILE_ERROR, 0, cli_errors[CLI_DATA_FILE_ERROR], sliced_info);
flush_and_exit(CLI_DATA_FILE_ERROR);
}
Expand Down Expand Up @@ -2102,7 +2103,7 @@ int CLI::run(int argc, char **argv)
record_exit_reson(outfile_dir, CLI_INVALID_PARAMS, 0, cli_errors[CLI_INVALID_PARAMS], sliced_info);
flush_and_exit(CLI_INVALID_PARAMS);
}
for (int index = 0; index < filament_count; index ++)
for (unsigned int index = 0; index < filament_count; index ++)
{
std::string file = uptodate_filaments[index];
DynamicPrintConfig config;
Expand Down Expand Up @@ -2219,7 +2220,7 @@ int CLI::run(int argc, char **argv)
}

//upwards check
bool process_compatible = false, /* machine_upwards = false, */ machine_switch = false;
bool process_compatible = false, machine_upwards = false, machine_switch = false;
BOOST_LOG_TRIVIAL(info) << boost::format("current printer %1%, new printer %2%, current process %3%, new process %4%")%current_printer_name %new_printer_name %current_process_name %new_process_name;
BOOST_LOG_TRIVIAL(info) << boost::format("current printer inherits %1%, new printer inherits %2%, current process inherits %3%, new process inherits %4%")
%current_printer_system_name %new_printer_system_name %current_process_system_name %new_process_system_name;
Expand Down Expand Up @@ -2289,7 +2290,7 @@ int CLI::run(int argc, char **argv)
for (int index = 0; index < upward_compatible_printers.size(); index++) {
if (upward_compatible_printers[index] == new_printer_system_name) {
process_compatible = true;
// machine_upwards = true;
machine_upwards = true;
BOOST_LOG_TRIVIAL(info) << boost::format("new printer is upward_compatible");
break;
}
Expand Down Expand Up @@ -2899,8 +2900,7 @@ int CLI::run(int argc, char **argv)
for (auto& model : m_models)
for (ModelObject* o : model.objects)
{
/* ModelObject* new_object = */
m.add_object(*o);
ModelObject* new_object = m.add_object(*o);
//BOOST_LOG_TRIVIAL(info) << "object "<<o->name <<", id :" << o->id().id << "\n";
//orients_requirement.emplace(new_object->id().id, orients_requirement[o->id().id]);
//orients_requirement.erase(o->id().id);
Expand Down Expand Up @@ -3343,6 +3343,7 @@ int CLI::run(int argc, char **argv)
BOOST_LOG_TRIVIAL(info) << boost::format("downward_check: all failed, size %1%")%downward_check_size;
break;
}
Slic3r::GUI::PartPlate* cur_plate = (Slic3r::GUI::PartPlate *)partplate_list.get_plate(index);
Vec3d size = plate_obj_size_infos[index].obj_bbox.size();

for (int index2 = 0; index2 < downward_check_size; index2 ++)
Expand Down Expand Up @@ -3392,6 +3393,7 @@ int CLI::run(int argc, char **argv)
}

// Loop through transform options.
bool user_center_specified = false;
Points beds = get_bed_shape(m_print_config);
ArrangeParams arrange_cfg;

Expand All @@ -3415,6 +3417,7 @@ int CLI::run(int argc, char **argv)
ModelObject* new_object = m.add_object();
new_object->name = _u8L("Assembly");
new_object->add_instance();
int idx = 0;
for (auto& model : m_models)
for (ModelObject* o : model.objects) {
for (auto volume : o->volumes) {
Expand Down Expand Up @@ -3516,6 +3519,7 @@ int CLI::run(int argc, char **argv)
}
}
} else if (opt_key == "center") {
user_center_specified = true;
for (auto &model : m_models) {
model.add_default_instances();
// this affects instances:
Expand Down Expand Up @@ -3815,6 +3819,7 @@ int CLI::run(int argc, char **argv)
{
//do arrange for plate
ArrangePolygons selected, unselected;
Model& model = m_models[0];
arrange_cfg = ArrangeParams(); // reset all params
get_print_sequence(cur_plate, m_print_config, arrange_cfg.is_seq_print);

Expand All @@ -3840,6 +3845,7 @@ int CLI::run(int argc, char **argv)
if (!arrange_cfg.is_seq_print && assemble_plate.filaments_count > 1)
{
//prepare the wipe tower
int plate_count = partplate_list.get_plate_count();

auto printer_structure_opt = m_print_config.option<ConfigOptionEnum<PrinterStructure>>("printer_structure");
const float tower_brim_width = m_print_config.option<ConfigOptionFloat>("prime_tower_width", true)->value;
Expand Down Expand Up @@ -4225,6 +4231,7 @@ int CLI::run(int argc, char **argv)
//float depth = v * (filaments_cnt - 1) / (layer_height * w);

Vec3d wipe_tower_size = cur_plate->estimate_wipe_tower_size(m_print_config, w, v, filaments_cnt);
Vec3d plate_origin = cur_plate->get_origin();
int plate_width, plate_depth, plate_height;
partplate_list.get_plate_size(plate_width, plate_depth, plate_height);
float depth = wipe_tower_size(1);
Expand Down Expand Up @@ -4603,7 +4610,7 @@ int CLI::run(int argc, char **argv)
}

// loop through action options
bool export_to_3mf = false, load_slicedata = false, export_slicedata = false;
bool export_to_3mf = false, load_slicedata = false, export_slicedata = false, export_slicedata_error = false;
bool no_check = false;
std::string export_3mf_file, load_slice_data_dir, export_slice_data_dir, export_stls_dir;
std::vector<ThumbnailData*> calibration_thumbnails;
Expand Down Expand Up @@ -5092,6 +5099,7 @@ int CLI::run(int argc, char **argv)
int ret = print->export_cached_data(plate_dir, with_space);
if (ret) {
BOOST_LOG_TRIVIAL(error) << "plate "<< index+1<< ": export Slicing data error, ret=" << ret;
export_slicedata_error = true;
if (fs::exists(plate_dir))
fs::remove_all(plate_dir);
record_exit_reson(outfile_dir, ret, index+1, cli_errors[ret], sliced_info);
Expand Down Expand Up @@ -5218,7 +5226,8 @@ int CLI::run(int argc, char **argv)
bool need_regenerate_top_thumbnail = oriented_or_arranged || regenerate_thumbnails;
bool need_create_thumbnail_group = false, need_create_no_light_group = false, need_create_top_group = false;

// get color for platedata
// get type and color for platedata
auto* filament_types = dynamic_cast<const ConfigOptionStrings*>(m_print_config.option("filament_type"));
const ConfigOptionStrings* filament_color = dynamic_cast<const ConfigOptionStrings *>(m_print_config.option("filament_colour"));
auto* filament_id = dynamic_cast<const ConfigOptionStrings*>(m_print_config.option("filament_ids"));
const ConfigOptionFloats* nozzle_diameter_option = dynamic_cast<const ConfigOptionFloats *>(m_print_config.option("nozzle_diameter"));
Expand Down
2 changes: 1 addition & 1 deletion src/admesh/connect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ struct HashTableEdges {
// This is a match. Record result in neighbors list.
match_neighbors(edge, *link->next);
// Delete the matched edge from the list.
// HashEdge *temp = link->next;
HashEdge *temp = link->next;
link->next = link->next->next;
// pool.destroy(temp);
#ifndef NDEBUG
Expand Down
2 changes: 1 addition & 1 deletion src/admesh/normals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ void stl_fix_normal_directions(stl_file *stl)
norm_sw[facet_num] = 1; // Record this one as being fixed.
++ checked;
}
// stl_normal *temp = head->next; // Delete this facet from the list.
stl_normal *temp = head->next; // Delete this facet from the list.
head->next = head->next->next;
// pool.destroy(temp);
} else { // If we ran out of facets to fix: All of the facets in this part have been fixed.
Expand Down
10 changes: 8 additions & 2 deletions src/imgui/imgui_widgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -768,9 +768,11 @@ bool ImGui::BBLButtonEx(const char* label, const ImVec2& size_arg, ImGuiButtonFl
bool hovered, held;
bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags);

bool b_hover = false;
if (hovered)
{
PushStyleColor(ImGuiCol_Text,GetColorU32(ImGuiCol_CheckMark));
b_hover = true;
}

// Render
Expand Down Expand Up @@ -4165,6 +4167,8 @@ bool ImGui::BBLInputScalar(const char *label, ImGuiDataType data_type, void *p_d
const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y * 2.0f));
// Tabbing or CTRL-clicking on Drag turns it into an InputText
const bool hovered = ItemHoverable(frame_bb, id);
// We are only allowed to access the state if we are already the active widget.
ImGuiInputTextState *state = GetInputTextState(id);

bool push_color_count = 0;
if (hovered || g.ActiveId == id) {
Expand Down Expand Up @@ -6294,9 +6298,9 @@ bool ImGui::ColorButton(const char* desc_id, const ImVec4& col, ImGuiColorEditFl
RenderFrameBorder(bb.Min, bb.Max, rounding);
else
#ifdef __APPLE__
window->DrawList->AddRect(bb.Min - ImVec2(3, 3), bb.Max + ImVec2(3, 3), GetColorU32(ImGuiCol_FrameBg), rounding * 2,0,4.0f);; // Color button are often in need of some sort of border
window->DrawList->AddRect(bb.Min - ImVec2(3, 3), bb.Max + ImVec2(3, 3), GetColorU32(ImGuiCol_FrameBg), rounding * 2,NULL,4.0f);; // Color button are often in need of some sort of border
#else
window->DrawList->AddRect(bb.Min - ImVec2(2, 2), bb.Max + ImVec2(2, 2), GetColorU32(ImGuiCol_FrameBg), rounding * 2,0,3.0f); // Color button are often in need of some sort of border
window->DrawList->AddRect(bb.Min - ImVec2(2, 2), bb.Max + ImVec2(2, 2), GetColorU32(ImGuiCol_FrameBg), rounding * 2,NULL,3.0f); // Color button are often in need of some sort of border
#endif
}

Expand Down Expand Up @@ -7093,6 +7097,7 @@ bool ImGui::BBLImageSelectable(ImTextureID user_texture_id, const ImVec2& size_a

// Text stays at the submission position, but bounding box may be extended on both sides
const float arrow_size = (flags & ImGuiComboFlags_NoArrowButton) ? 0.0f : GetFrameHeight();
const ImVec2 text_min = ImVec2(pos.x + arrow_size, pos.y);
const ImVec2 text_max(min_x + size.x, pos.y + size.y);

// Selectables are meant to be tightly packed together with no click-gap, so we extend their box to cover spacing between selectable.
Expand Down Expand Up @@ -7204,6 +7209,7 @@ bool ImGui::BBLImageSelectable(ImTextureID user_texture_id, const ImVec2& size_a
if (flags & ImGuiSelectableFlags_Disabled) PushStyleColor(ImGuiCol_Text, style.Colors[ImGuiCol_TextDisabled]);

// Render
const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
ImVec2 p_min = bb.Min + ImVec2(style.ItemInnerSpacing.x, (bb.Max.y - bb.Min.y - font_size.y) / 2);
ImVec2 p_max = p_min + font_size;
window->DrawList->AddImage(user_texture_id, p_min, p_max, uv0, uv1, selected || (held && hovered) ? GetColorU32(ImVec4(1.f, 1.f, 1.f, 1.f)) : GetColorU32(tint_col));
Expand Down
2 changes: 2 additions & 0 deletions src/imguizmo/ImGuizmo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2807,6 +2807,7 @@ namespace IMGUIZMO_NAMESPACE
{
static bool isDraging = false;
static bool isClicking = false;
static bool isInside = false;
static vec_t interpolationUp;
static vec_t interpolationDir;
static int interpolationFrames = 0;
Expand Down Expand Up @@ -3054,6 +3055,7 @@ namespace IMGUIZMO_NAMESPACE
LookAt(&newEye.x, &camTarget.x, &newUp.x, view);
viewUpdated = true;
}
isInside = gContext.mbMouseOver && ImRect(position, position + size).Contains(io.MousePos);

if (io.MouseDown[0] && (fabsf(io.MouseDelta[0]) || fabsf(io.MouseDelta[1])) && isClicking)
{
Expand Down
1 change: 1 addition & 0 deletions src/libnest2d/include/libnest2d/geometry_traits_nfp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ inline TPoint<RawShape> referenceVertex(const RawShape& sh)
template<class RawBox, class RawShape, class Ratio = double> inline NfpResult<RawShape> nfpInnerRectBed(const RawBox &bed, const RawShape &other)
{
using Vertex = TPoint<RawShape>;
using Edge = _Segment<Vertex>;
namespace sl = shapelike;

auto sbox = sl::boundingBox(other);
Expand Down
1 change: 1 addition & 0 deletions src/libnest2d/include/libnest2d/placers/nfpplacer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1119,6 +1119,7 @@ class _NofitPolyPlacer: public PlacerBoilerplate<_NofitPolyPlacer<RawShape, TBin
for (const Item& item : items_) {
if (!item.is_virt_object) { extruders.insert(item.extrude_ids.begin(), item.extrude_ids.end()); }
}
bool need_wipe_tower = extruders.size() > 1;

std::vector<RawShape> objs,excludes;
for (const Item &item : items_) {
Expand Down
2 changes: 2 additions & 0 deletions src/libslic3r/AppConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
#include <boost/nowide/cenv.hpp>
#include <boost/nowide/fstream.hpp>
#include <boost/property_tree/ini_parser.hpp>
#include <boost/property_tree/ptree_fwd.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/format/format_fwd.hpp>
#include <boost/log/trivial.hpp>
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_generators.hpp>
Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/Arachne/BeadingStrategy/BeadingStrategy.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//Copyright (c) 2022 Ultimaker B.V.
//CuraEngine is released under the terms of the AGPLv3 or higher.

#include <cassert>

#include "BeadingStrategy.hpp"
#include "Point.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "RedistributeBeadingStrategy.hpp"
#include "OuterWallInsetBeadingStrategy.hpp"

#include <limits>
#include <boost/log/trivial.hpp>

namespace Slic3r::Arachne
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "RedistributeBeadingStrategy.hpp"

#include <algorithm>
#include <numeric>

namespace Slic3r::Arachne
Expand Down
3 changes: 2 additions & 1 deletion src/libslic3r/Arachne/SkeletalTrapezoidation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1595,6 +1595,7 @@ SkeletalTrapezoidation::edge_t* SkeletalTrapezoidation::getQuadMaxRedgeTo(edge_t

void SkeletalTrapezoidation::propagateBeadingsUpward(std::vector<edge_t*>& upward_quad_mids, ptr_vector_t<BeadingPropagation>& node_beadings)
{
const auto _central_filter_dist = central_filter_dist();
for (auto upward_quad_mids_it = upward_quad_mids.rbegin(); upward_quad_mids_it != upward_quad_mids.rend(); ++upward_quad_mids_it)
{
edge_t* upward_edge = *upward_quad_mids_it;
Expand All @@ -1611,7 +1612,7 @@ void SkeletalTrapezoidation::propagateBeadingsUpward(std::vector<edge_t*>& upwar
{ // Only propagate to places where there is place
continue;
}
assert((upward_edge->from->data.distance_to_boundary != upward_edge->to->data.distance_to_boundary || shorter_then(upward_edge->to->p - upward_edge->from->p, central_filter_dist())) && "zero difference R edges should always be central");
assert((upward_edge->from->data.distance_to_boundary != upward_edge->to->data.distance_to_boundary || shorter_then(upward_edge->to->p - upward_edge->from->p, _central_filter_dist)) && "zero difference R edges should always be central");
coord_t length = (upward_edge->to->p - upward_edge->from->p).cast<int64_t>().norm();
BeadingPropagation upper_beading = lower_beading;
upper_beading.dist_to_bottom_source += length;
Expand Down
3 changes: 3 additions & 0 deletions src/libslic3r/Arachne/SkeletalTrapezoidationGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

#include <boost/log/trivial.hpp>

#include "utils/linearAlg2D.hpp"
#include "../Line.hpp"

namespace Slic3r::Arachne
{

Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/Arachne/utils/ExtrusionLine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <algorithm>

#include "ExtrusionLine.hpp"
#include "linearAlg2D.hpp"
#include "../../VariableWidth.hpp"

namespace Slic3r::Arachne
Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/Arachne/utils/SquareGrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
//CuraEngine is released under the terms of the AGPLv3 or higher.

#include "SquareGrid.hpp"
#include "../../Point.hpp"

using namespace Slic3r::Arachne;

Expand Down
12 changes: 10 additions & 2 deletions src/libslic3r/Arrange.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,26 +199,34 @@ void update_selected_items_axis_align(ArrangePolygons& selected, const DynamicPr
}

if (std::abs(a00) > EPSILON) {
double db1_2, db1_6, db1_12, db1_24;
double m00, m10, m01, m20, m11, m02;
double db1_2, db1_6, db1_12, db1_24, db1_20, db1_60;
double m00, m10, m01, m20, m11, m02, m30, m21, m12, m03;
if (a00 > 0) {
db1_2 = 0.5;
db1_6 = 0.16666666666666666666666666666667;
db1_12 = 0.083333333333333333333333333333333;
db1_24 = 0.041666666666666666666666666666667;
db1_20 = 0.05;
db1_60 = 0.016666666666666666666666666666667;
}
else {
db1_2 = -0.5;
db1_6 = -0.16666666666666666666666666666667;
db1_12 = -0.083333333333333333333333333333333;
db1_24 = -0.041666666666666666666666666666667;
db1_20 = -0.05;
db1_60 = -0.016666666666666666666666666666667;
}
m00 = a00 * db1_2;
m10 = a10 * db1_6;
m01 = a01 * db1_6;
m20 = a20 * db1_12;
m11 = a11 * db1_24;
m02 = a02 * db1_12;
m30 = a30 * db1_20;
m21 = a21 * db1_60;
m12 = a12 * db1_60;
m03 = a03 * db1_20;

double cx = m10 / m00;
double cy = m01 / m00;
Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/BlacklistedLibraryCheck.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "BlacklistedLibraryCheck.hpp"

#include <cstdio>
#include <boost/nowide/convert.hpp>

#ifdef WIN32
Expand Down
Loading

0 comments on commit 7082e94

Please sign in to comment.