Skip to content

Commit

Permalink
some fixes, began to create an orca reader
Browse files Browse the repository at this point in the history
  • Loading branch information
supermerill committed Jan 26, 2024
2 parents c62503c + 35ab0ce commit 1cc1395
Show file tree
Hide file tree
Showing 74 changed files with 27,908 additions and 195 deletions.
2 changes: 1 addition & 1 deletion resources/profiles
Submodule profiles updated 2 files
+2 −0 Basic.idx
+11 −14 Basic.ini
19 changes: 16 additions & 3 deletions src/libslic3r/AppConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,9 @@ void AppConfig::set_defaults()
if (get("check_blacklisted_library").empty())
set("check_blacklisted_library", "1");
#endif // _WIN32

if (get("compress_png_texture").empty())
set("compress_png_texture", "1");
//disable by default if amd graphic card detected, but can't know before the opengl is launched
//if (get("compress_png_texture").empty())
//set("compress_png_texture", (m_hardware&hGpuAmd) == hGpuAmd ? "0" : "1");

// remove old 'use_legacy_opengl' parameter from this config, if present
if (!get("use_legacy_opengl").empty())
Expand Down Expand Up @@ -458,7 +458,11 @@ void AppConfig::set_defaults()
set("use_rich_tooltip", "0");

if (get("hide_slice_tooltip").empty())
#ifdef _WIN32
set("hide_slice_tooltip", "1");
#else
set("hide_slice_tooltip", "0");
#endif // _WIN32

if (get("show_layer_height_doubleslider").empty())
set("show_layer_height_doubleslider", "1");
Expand Down Expand Up @@ -614,6 +618,15 @@ void AppConfig::set_defaults()
erase("", "object_settings_size");
}

void AppConfig::set_hardware_type(HardwareType hard) {
this->m_hardware = hard;
// Set default that depends on hardware type

//disable by default if amd graphic card detected, but can't know before the opengl is launched
if (get("compress_png_texture").empty() && (m_hardware&hHasGpu) != 0)
set("compress_png_texture", (m_hardware&hGpuAmd) == hGpuAmd ? "0" : "1");
}

void AppConfig::init_ui_layout() {
boost::filesystem::path resources_dir_path = boost::filesystem::path(resources_dir()) / "ui_layout";
if (!boost::filesystem::is_directory(resources_dir_path)) {
Expand Down
27 changes: 26 additions & 1 deletion src/libslic3r/AppConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,25 @@ class AppConfig
Highlight,
};

enum HardwareType : uint8_t
{
//first 4 bits for cpu
hHasCpu = uint8_t(0x0F),
hCpuIntel = 1,
hCpuAmd = 2,
hCpuApple = 3,
hCpuArmGeneric = 4,
hCpuOther = 5,
//last 4 bits for gpu
hHasGpu = uint8_t(0xF0),
hGpuIntel = 1 << 4,
hGpuAmd = 2 << 4,
hGpuApple = 3 << 4,
hGpuArmGeneric = 4 << 4,
hGpuOther = 5 << 4,
hGpuNvidia = 6 << 4,
};

struct ConfigFileInfo {
bool correct_checksum{ false };
bool contains_null{ false };
Expand Down Expand Up @@ -190,12 +209,16 @@ class AppConfig
LayoutEntry get_ui_layout();
std::vector<LayoutEntry> get_ui_layouts() { return m_ui_layout; }

//tags
// Tags
std::vector<Tag> tags() { return m_tags; }

// splashscreen
std::string splashscreen(bool is_editor);

// Hardware
HardwareType hardware() { return m_hardware; }
void set_hardware_type(HardwareType hard);

// Returns true if the user's data directory comes from before Slic3r 1.40.0 (no updating)
bool legacy_datadir() const { return m_legacy_datadir; }
void set_legacy_datadir(bool value) { m_legacy_datadir = value; }
Expand Down Expand Up @@ -281,6 +304,8 @@ class AppConfig
std::vector<Tag> m_tags;
//splashscreen
std::pair<std::string,std::string> m_default_splashscreen;
// hardware type
HardwareType m_hardware;
};

} // namespace Slic3r
Expand Down
2 changes: 2 additions & 0 deletions src/libslic3r/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ add_library(libslic3r STATIC
Format/3mf.hpp
Format/AMF.cpp
Format/AMF.hpp
Format/BBConfig.cpp
Format/BBConfig.hpp
Format/OBJ.cpp
Format/OBJ.hpp
Format/objparser.cpp
Expand Down
6 changes: 3 additions & 3 deletions src/libslic3r/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ std::string escape_strings_cstyle(const std::vector<std::string> &strs)
bool should_quote = strs.size() == 1 && str.empty();
for (size_t i = 0; i < str.size(); ++ i) {
char c = str[i];
if (c == ' ' || c == ';' || c == '\t' || c == '\\' || c == '"' || c == '\r' || c == '\n') {
if (c == ' ' || c == ';' || c == ',' || c == '\t' || c == '\\' || c == '"' || c == '\r' || c == '\n') {
should_quote = true;
break;
}
Expand Down Expand Up @@ -212,7 +212,7 @@ bool unescape_strings_cstyle(const std::string &str, std::vector<std::string> &o
} else {
for (; i < str.size(); ++ i) {
c = str[i];
if (c == ';')
if (c == ';' || c == ',')
break;
buf.push_back(c);
}
Expand All @@ -229,7 +229,7 @@ bool unescape_strings_cstyle(const std::string &str, std::vector<std::string> &o
return true;
c = str[i];
}
if (c != ';')
if (c != ';' && c != ',')
return false;
if (++ i == str.size()) {
// Emit one additional empty string.
Expand Down
4 changes: 2 additions & 2 deletions src/libslic3r/Fill/Fill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -697,8 +697,8 @@ void Layer::make_fills(FillAdaptive::Octree* adaptive_fill_octree, FillAdaptive:
for(auto &t : temp) real_surface += t.area();
assert(compute_volume.volume < unscaled(unscaled(surface_fill.surface.area())) * surface_fill.params.layer_height + EPSILON);
double area = unscaled(unscaled(real_surface));
assert(compute_volume.volume < area * surface_fill.params.layer_height * 1.001);
assert(compute_volume.volume > area * surface_fill.params.layer_height * 0.999 || area < std::max(1.,surface_fill.params.config->solid_infill_below_area.value));
assert(compute_volume.volume <= area * surface_fill.params.layer_height * 1.001);
assert(compute_volume.volume >= area * surface_fill.params.layer_height * 0.999 || area < std::max(1.,surface_fill.params.config->solid_infill_below_area.value));
}
#endif
}
Expand Down
Loading

0 comments on commit 1cc1395

Please sign in to comment.