Skip to content

Commit

Permalink
fixes: linux&mac memory error, wipe, add speed comments
Browse files Browse the repository at this point in the history
  • Loading branch information
supermerill committed May 28, 2024
2 parents 57a9bdb + f579644 commit a9f5842
Show file tree
Hide file tree
Showing 41 changed files with 551 additions and 298 deletions.
17 changes: 13 additions & 4 deletions BuildLinux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,16 @@ then
exit 0
fi

# mkdir build
if [ ! -d "build" ]
if [[ -n "$FOUND_GTK3" ]]
then
mkdir build
echo "Found GTK3"
else
if [[ -n "$FOUND_GTK2" ]]
then
echo "Found GTK2"
fi
fi


if [[ -n "$UPDATE_LIB" ]]
then
echo -n -e "Updating linux ...\n"
Expand Down Expand Up @@ -118,6 +121,12 @@ echo "[2/9] Changing date in version..."
}
echo "done"

# mkdir build
if [ ! -d "build" ]
then
mkdir build
fi

# mkdir in deps
if [ ! -d "deps/build" ]
then
Expand Down
4 changes: 2 additions & 2 deletions create_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ def get_version():
print("gtk2 appimage: " +str(resp));
z = zipfile.ZipFile(io.BytesIO(resp.content));
z.extractall(release_path);
os.rename(release_path+"/"+program_name+"_ubu64.AppImage", release_path+"/"+program_name+"-ubuntu_18.04-gtk2-" + version + ".AppImage");
os.rename(release_path+"/"+program_name+"_ubu64.AppImage", release_path+"/"+program_name+"-ubuntu_20.04-gtk2-" + version + ".AppImage");
if entry["name"] == "rc-"+program_name+"-gtk3.AppImage" and not found_linux_appimage_gtk3:
found_linux_appimage_gtk3 = True;
print("ask for: "+entry["archive_download_url"]);
resp = requests.get(entry["archive_download_url"], headers={'Authorization': 'token ' + github_auth_token,}, allow_redirects=True);
print("gtk3 appimage: " +str(resp));
z = zipfile.ZipFile(io.BytesIO(resp.content));
z.extractall(release_path);
os.rename(release_path+"/"+program_name+"_ubu64.AppImage", release_path+"/"+program_name+"-ubuntu_18.04-" + version + ".AppImage");
os.rename(release_path+"/"+program_name+"_ubu64.AppImage", release_path+"/"+program_name+"-ubuntu_20.04-" + version + ".AppImage");
if entry["name"] == "rc_linux_gtk3.tar" and not found_linux:
found_linux = True;
print("ask for: "+entry["archive_download_url"]);
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,5 @@ else ()
install(TARGETS Slic3r RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")

# Install the symlink for gcodeviewer
install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink slic3r ${GCODEVIEWER_APP_CMD} WORKING_DIRECTORY \$ENV{DESTDIR}/${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR})")
install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${SLIC3R_APP_CMD} ${GCODEVIEWER_APP_CMD} WORKING_DIRECTORY \$ENV{DESTDIR}/${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR})")
endif ()
9 changes: 5 additions & 4 deletions src/libslic3r/AppConfig.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#include "libslic3r/libslic3r.h"
#include "libslic3r/Utils.hpp"
#include "AppConfig.hpp"

#include "libslic3r.h"
#include "format.hpp"
#include "Exception.hpp"
#include "I18N.hpp"
#include "LocalesUtils.hpp"
#include "Thread.hpp"
#include "format.hpp"
#include "Utils.hpp"

#include <utility>
#include <vector>
Expand All @@ -13,7 +15,6 @@
#include <boost/algorithm/string/predicate.hpp>
#include <boost/filesystem/directory.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/format/format_fwd.hpp>
#include <boost/locale.hpp>
#include <boost/log/trivial.hpp>
Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/AppConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <string>

#include <boost/algorithm/string/trim_all.hpp>
#include <boost/filesystem/path.hpp>

#include "libslic3r/Config.hpp"
#include "libslic3r/Semver.hpp"
Expand Down
24 changes: 12 additions & 12 deletions src/libslic3r/Config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -820,9 +820,9 @@ class ConfigOptionFloatsTempl : public ConfigOptionVector<double>
return false;
return true;
} else {
return idx < values.size() ? (std::isnan(this->values[idx]) || NIL_VALUE() == this->values[idx]) :
values.empty() ? (std::isnan(this->default_value) || NIL_VALUE() == this->default_value) :
(std::isnan(this->values.front()) || NIL_VALUE() == this->values.front());
return idx < int32_t(values.size()) ? (std::isnan(this->values[idx]) || NIL_VALUE() == this->values[idx]) :
values.empty() ? (std::isnan(this->default_value) || NIL_VALUE() == this->default_value) :
(std::isnan(this->values.front()) || NIL_VALUE() == this->values.front());
}
}
double get_float(size_t idx = 0) const override { return get_at(idx); }
Expand Down Expand Up @@ -1004,9 +1004,9 @@ class ConfigOptionIntsTempl : public ConfigOptionVector<int32_t>
return false;
return true;
} else {
return idx < values.size() ? NIL_VALUE() == this->values[idx] :
values.empty() ? NIL_VALUE() == this->default_value :
NIL_VALUE() == this->values.front();
return idx < int32_t(values.size()) ? NIL_VALUE() == this->values[idx] :
values.empty() ? NIL_VALUE() == this->default_value :
NIL_VALUE() == this->values.front();
}
}
int32_t get_int(size_t idx = 0) const override { return get_at(idx); }
Expand Down Expand Up @@ -1349,9 +1349,9 @@ class ConfigOptionFloatsOrPercentsTempl : public ConfigOptionVector<FloatOrPerce
return false;
return true;
} else {
return idx < values.size() ? (std::isnan(this->values[idx].value) || NIL_VALUE() == this->values[idx]) :
values.empty() ? (std::isnan(this->default_value.value) || NIL_VALUE() == this->default_value) :
(std::isnan(this->values.front().value) || NIL_VALUE() == this->values.front());
return idx < int32_t(values.size()) ? (std::isnan(this->values[idx].value) || NIL_VALUE() == this->values[idx]) :
values.empty() ? (std::isnan(this->default_value.value) || NIL_VALUE() == this->default_value) :
(std::isnan(this->values.front().value) || NIL_VALUE() == this->values.front());
}
}
double get_abs_value(size_t i, double ratio_over) const {
Expand Down Expand Up @@ -1718,9 +1718,9 @@ class ConfigOptionBoolsTempl : public ConfigOptionVector<unsigned char>
return false;
return true;
} else {
return idx < values.size() ? NIL_VALUE() == this->values[idx] :
values.empty() ? NIL_VALUE() == this->default_value :
NIL_VALUE() == this->values.front();
return idx < int32_t(values.size()) ? NIL_VALUE() == this->values[idx] :
values.empty() ? NIL_VALUE() == this->default_value :
NIL_VALUE() == this->values.front();
}
}
bool get_bool(size_t idx = 0) const override { return ConfigOptionVector<unsigned char>::get_at(idx) != 0; }
Expand Down
8 changes: 8 additions & 0 deletions src/libslic3r/ExtrusionEntity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "ExtrusionEntityCollection.hpp"
#include "ExPolygonCollection.hpp"
#include "ClipperUtils.hpp"
#include "Config.hpp"
#include "Extruder.hpp"
#include "Flow.hpp"
#include <cmath>
Expand Down Expand Up @@ -592,6 +593,13 @@ bool HasRoleVisitor::search(const ExtrusionEntitiesPtr &entities, HasRoleVisitor
return visitor.found;
}

void SimplifyVisitor::use(ExtrusionPath& path) {
path.simplify(m_scaled_resolution, m_use_arc_fitting, scale_d(m_arc_fitting_tolearance->get_abs_value(path.width)));
}
void SimplifyVisitor::use(ExtrusionPath3D& path3D) {
path3D.simplify(m_scaled_resolution, m_use_arc_fitting, scale_d(m_arc_fitting_tolearance->get_abs_value(path3D.width)));
}

//class ExtrusionTreeVisitor : ExtrusionVisitor {
//public:
// //virtual void use(ExtrusionEntity &entity) { assert(false); };
Expand Down
9 changes: 3 additions & 6 deletions src/libslic3r/ExtrusionEntity.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -637,18 +637,15 @@ struct HasThisRoleVisitor : public HasRoleVisitor{


//call simplify for all paths.
class ConfigOptionFloatOrPercent;
class SimplifyVisitor : public ExtrusionVisitorRecursive {
bool m_use_arc_fitting;
coordf_t m_scaled_resolution;
const ConfigOptionFloatOrPercent* m_arc_fitting_tolearance;
public:
SimplifyVisitor(coordf_t scaled_resolution, bool use_arc_fitting, const ConfigOptionFloatOrPercent* arc_fitting_tolearance) : m_scaled_resolution(scaled_resolution), m_use_arc_fitting(use_arc_fitting), m_arc_fitting_tolearance(arc_fitting_tolearance){}
virtual void use(ExtrusionPath& path) override {
path.simplify(m_scaled_resolution, m_use_arc_fitting, scale_d(m_arc_fitting_tolearance->get_abs_value(path.width)));
}
virtual void use(ExtrusionPath3D& path3D) override {
path3D.simplify(m_scaled_resolution, m_use_arc_fitting, scale_d(m_arc_fitting_tolearance->get_abs_value(path3D.width)));
}
virtual void use(ExtrusionPath& path) override;
virtual void use(ExtrusionPath3D& path3D) override;
};
class GetPathsVisitor : public ExtrusionVisitorRecursive {
public:
Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/Flow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <assert.h>

#include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string/replace.hpp>

// Mark string for localization and translate.
#define L(s) Slic3r::I18N::translate(s)
Expand Down
5 changes: 5 additions & 0 deletions src/libslic3r/Format/BBConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
#include <map>
#include <string>

#include <boost/algorithm/string/replace.hpp>
#include <boost/log/trivial.hpp>
#include <boost/property_tree/ini_parser.hpp>
#include <boost/property_tree/ptree.hpp>

namespace Slic3r {

namespace BBConfiguration {
Expand Down
6 changes: 6 additions & 0 deletions src/libslic3r/Format/BBConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,25 @@

#include "miniz_extension.hpp"


#include <map>

#ifdef __APPLE__
#include <boost/filesystem.hpp>
#include <boost/nowide/fstream.hpp>
typedef boost::filesystem::path std_path;
typedef boost::nowide::ifstream std_ifstream;
#define GET_STD_PATH_FOR_IFSTREAM(PARAM) PARAM.string()
#else
#include <filesystem>
#include <fstream>
typedef std::filesystem::path std_path;
typedef std::ifstream std_ifstream;
#define GET_STD_PATH_FOR_IFSTREAM(PARAM) PARAM
#endif

namespace Slic3r {
struct ConfigSubstitutionContext;
class DynamicPrintConfig;
class Model;
class ModelConfigObject;
Expand Down
13 changes: 7 additions & 6 deletions src/libslic3r/Format/bbs_3mf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@


#include <limits>
#include <mutex>
#include <stdexcept>
#include <iomanip>

#include <boost/assign.hpp>
#include <boost/bimap.hpp>

#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/predicate.hpp>
Expand All @@ -47,6 +47,7 @@

namespace pt = boost::property_tree;

#include <tbb/parallel_for.h>
#include <tbb/parallel_reduce.h>

#include <expat.h>
Expand Down Expand Up @@ -721,11 +722,11 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
// Base class with error messages management
class _BBS_3MF_Base
{
mutable boost::mutex mutex;
mutable std::mutex mutex_error;
mutable std::vector<std::string> m_errors;

protected:
void add_error(const std::string& error) const { boost::unique_lock l(mutex); m_errors.push_back(error); }
void add_error(const std::string& error) const { std::lock_guard l(mutex_error); m_errors.push_back(error); }
void clear_errors() { m_errors.clear(); }

public:
Expand Down Expand Up @@ -1770,15 +1771,15 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
}

bool object_load_result = true;
boost::mutex mutex;
std::mutex mutex_load;
tbb::parallel_for(
tbb::blocked_range<size_t>(0, m_object_importers.size()),
[this, &mutex, &object_load_result](const tbb::blocked_range<size_t>& importer_range) {
[this, &mutex_load, &object_load_result](const tbb::blocked_range<size_t>& importer_range) {
CNumericLocalesSetter locales_setter;
for (size_t object_index = importer_range.begin(); object_index < importer_range.end(); ++ object_index) {
bool result = m_object_importers[object_index]->extract_object_model();
{
boost::unique_lock l(mutex);
std::lock_guard l(mutex_load);
object_load_result &= result;
}
}
Expand Down
Loading

0 comments on commit a9f5842

Please sign in to comment.