mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-10 07:15:08 -06:00
Merge branch 'master' of https://github.com/Prusa3d/Slic3r
This commit is contained in:
commit
094e3cb565
17 changed files with 315 additions and 103 deletions
|
@ -33,6 +33,7 @@ if(PNG_FOUND AND NOT RASTERIZER_FORCE_BUILTIN_LIBPNG)
|
|||
else()
|
||||
set(ZLIB_LIBRARY "")
|
||||
message(WARNING "Using builtin libpng. This can cause crashes on some platforms.")
|
||||
set(SKIP_INSTALL_ALL 1) # Prevent png+zlib from creating install targets
|
||||
add_subdirectory(png/zlib)
|
||||
set(ZLIB_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/png/zlib ${CMAKE_CURRENT_BINARY_DIR}/png/zlib)
|
||||
include_directories(${ZLIB_INCLUDE_DIR})
|
||||
|
@ -188,3 +189,15 @@ else ()
|
|||
VERBATIM
|
||||
)
|
||||
endif()
|
||||
|
||||
# Slic3r binary install target
|
||||
if (WIN32)
|
||||
install(TARGETS slic3r RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}")
|
||||
if (MSVC)
|
||||
install(TARGETS slic3r_app_gui RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}")
|
||||
install(TARGETS slic3r_app_console RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}")
|
||||
install(TARGETS slic3r_app_noconsole RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}")
|
||||
endif ()
|
||||
else ()
|
||||
install(TARGETS slic3r RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
endif ()
|
||||
|
|
|
@ -218,7 +218,7 @@ public:
|
|||
|
||||
const T& get_at(size_t i) const { return const_cast<ConfigOptionVector<T>*>(this)->get_at(i); }
|
||||
|
||||
// Resize this vector by duplicating the last value.
|
||||
// Resize this vector by duplicating the /*last*/first value.
|
||||
// If the current vector is empty, the default value is used instead.
|
||||
void resize(size_t n, const ConfigOption *opt_default = nullptr) override
|
||||
{
|
||||
|
@ -238,7 +238,7 @@ public:
|
|||
this->values.resize(n, static_cast<const ConfigOptionVector<T>*>(opt_default)->values.front());
|
||||
} else {
|
||||
// Resize by duplicating the last value.
|
||||
this->values.resize(n, this->values.back());
|
||||
this->values.resize(n, this->values./*back*/front());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
2
src/platform/unix/fhs.hpp.in
Normal file
2
src/platform/unix/fhs.hpp.in
Normal file
|
@ -0,0 +1,2 @@
|
|||
#cmakedefine SLIC3R_FHS @SLIC3R_FHS@
|
||||
#define SLIC3R_FHS_RESOURCES "@SLIC3R_FHS_RESOURCES@"
|
|
@ -22,6 +22,8 @@
|
|||
#include <boost/nowide/cenv.hpp>
|
||||
#include <boost/nowide/iostream.hpp>
|
||||
|
||||
#include "unix/fhs.hpp" // Generated by CMake from ../platform/unix/fhs.hpp.in
|
||||
|
||||
#include "libslic3r/libslic3r.h"
|
||||
#include "libslic3r/Config.hpp"
|
||||
#include "libslic3r/Geometry.hpp"
|
||||
|
@ -77,6 +79,10 @@ int main(int argc, char **argv)
|
|||
// The resources are packed to 'resources'
|
||||
// Path from Slic3r binary to resources:
|
||||
boost::filesystem::path path_resources = path_to_binary.parent_path() / "resources";
|
||||
#elif defined SLIC3R_FHS
|
||||
// The application is packaged according to the Linux Filesystem Hierarchy Standard
|
||||
// Resources are set to the 'Architecture-independent (shared) data', typically /usr/share or /usr/local/share
|
||||
boost::filesystem::path path_resources = SLIC3R_FHS_RESOURCES;
|
||||
#else
|
||||
// The application is packed in the .tar.bz archive (or in AppImage) as 'bin/slic3r',
|
||||
// The resources are packed to 'resources'
|
||||
|
|
|
@ -474,6 +474,7 @@ void Choice::BUILD() {
|
|||
if (temp->GetWindowStyle() != wxCB_READONLY) {
|
||||
temp->Bind(wxEVT_KILL_FOCUS, ([this](wxEvent& e) {
|
||||
e.Skip();
|
||||
if (m_opt.type == coStrings) return;
|
||||
double old_val = !m_value.empty() ? boost::any_cast<double>(m_value) : -99999;
|
||||
if (is_defined_input_value<wxComboBox>(window, m_opt.type)) {
|
||||
if (fabs(old_val - boost::any_cast<double>(get_value())) <= 0.0001)
|
||||
|
@ -692,7 +693,7 @@ boost::any& Choice::get_value()
|
|||
}
|
||||
else if (m_opt.gui_type == "f_enum_open") {
|
||||
const int ret_enum = static_cast<wxComboBox*>(window)->GetSelection();
|
||||
if (ret_enum < 0 || m_opt.enum_values.empty())
|
||||
if (ret_enum < 0 || m_opt.enum_values.empty() || m_opt.type == coStrings)
|
||||
get_value_by_opt_type(ret_str);
|
||||
else
|
||||
m_value = atof(m_opt.enum_values[ret_enum].c_str());
|
||||
|
|
|
@ -3979,6 +3979,12 @@ BoundingBoxf3 GLCanvas3D::scene_bounding_box() const
|
|||
{
|
||||
BoundingBoxf3 bb = volumes_bounding_box();
|
||||
bb.merge(m_bed.get_bounding_box());
|
||||
if (m_config != nullptr)
|
||||
{
|
||||
double h = m_config->opt_float("max_print_height");
|
||||
bb.min(2) = std::min(bb.min(2), -h);
|
||||
bb.max(2) = std::max(bb.max(2), h);
|
||||
}
|
||||
return bb;
|
||||
}
|
||||
|
||||
|
@ -4939,8 +4945,9 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||
|
||||
if (evt.Entering())
|
||||
{
|
||||
#if defined(__WXMSW__) || defined(__linux__)
|
||||
// On Windows and Linux needs focus in order to catch key events
|
||||
//#if defined(__WXMSW__) || defined(__linux__)
|
||||
// // On Windows and Linux needs focus in order to catch key events
|
||||
// Set focus in order to remove it from sidebar fields
|
||||
if (m_canvas != nullptr) {
|
||||
// Only set focus, if the top level window of this canvas is active.
|
||||
auto p = dynamic_cast<wxWindow*>(evt.GetEventObject());
|
||||
|
@ -4952,7 +4959,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||
}
|
||||
|
||||
m_mouse.set_start_position_2D_as_invalid();
|
||||
#endif
|
||||
//#endif
|
||||
}
|
||||
else if (evt.Leaving())
|
||||
{
|
||||
|
|
|
@ -154,13 +154,15 @@ void change_opt_value(DynamicPrintConfig& config, const t_config_option_key& opt
|
|||
}
|
||||
else if (config.def()->get(opt_key)->gui_flags.compare("serialized") == 0) {
|
||||
std::string str = boost::any_cast<std::string>(value);
|
||||
if (str.back() == ';') str.pop_back();
|
||||
// Split a string to multiple strings by a semi - colon.This is the old way of storing multi - string values.
|
||||
// Currently used for the post_process config value only.
|
||||
std::vector<std::string> values;
|
||||
boost::split(values, str, boost::is_any_of(";"));
|
||||
if (values.size() == 1 && values[0] == "")
|
||||
values.resize(0);//break;
|
||||
std::vector<std::string> values {};
|
||||
if (!str.empty()) {
|
||||
if (str.back() == ';') str.pop_back();
|
||||
// Split a string to multiple strings by a semi - colon.This is the old way of storing multi - string values.
|
||||
// Currently used for the post_process config value only.
|
||||
boost::split(values, str, boost::is_any_of(";"));
|
||||
if (values.size() == 1 && values[0] == "")
|
||||
values.resize(0);
|
||||
}
|
||||
config.option<ConfigOptionStrings>(opt_key)->values = values;
|
||||
}
|
||||
else{
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
#include <wx/stdpaths.h>
|
||||
#include <wx/imagpng.h>
|
||||
|
@ -15,6 +14,7 @@
|
|||
#include <wx/filedlg.h>
|
||||
#include <wx/dir.h>
|
||||
#include <wx/wupdlock.h>
|
||||
#include <wx/filefn.h>
|
||||
|
||||
#include "libslic3r/Utils.hpp"
|
||||
#include "libslic3r/Model.hpp"
|
||||
|
@ -83,6 +83,11 @@ GUI_App::GUI_App()
|
|||
|
||||
bool GUI_App::OnInit()
|
||||
{
|
||||
// Verify resources path
|
||||
const wxString resources_dir = from_u8(Slic3r::resources_dir());
|
||||
wxCHECK_MSG(wxDirExists(resources_dir), false,
|
||||
wxString::Format("Resources path does not exist or is not a directory: %s", resources_dir));
|
||||
|
||||
#if ENABLE_IMGUI
|
||||
wxCHECK_MSG(m_imgui->init(), false, "Failed to initialize ImGui");
|
||||
#endif // ENABLE_IMGUI
|
||||
|
|
|
@ -244,15 +244,13 @@ void ObjectManipulation::update_settings_value(const GLCanvas3D::Selection& sele
|
|||
if ((0 <= obj_idx) && (obj_idx < (int)wxGetApp().model_objects()->size()))
|
||||
{
|
||||
bool changed_box = false;
|
||||
if ((m_cache.object_idx != obj_idx) || (m_cache.instance_idx != instance_idx))
|
||||
if (!m_cache.instance.matches_object(obj_idx))
|
||||
{
|
||||
m_cache.object_idx = obj_idx;
|
||||
m_cache.instance_idx = instance_idx;
|
||||
m_cache.instance_box_size = (*wxGetApp().model_objects())[obj_idx]->raw_mesh().bounding_box().size();
|
||||
m_cache.instance.set(obj_idx, instance_idx, (*wxGetApp().model_objects())[obj_idx]->raw_mesh().bounding_box().size());
|
||||
changed_box = true;
|
||||
}
|
||||
if (changed_box || !m_cache.scale.isApprox(100.0 * m_new_scale) || !m_cache.rotation.isApprox(m_new_rotation))
|
||||
m_new_size = volume->get_instance_transformation().get_matrix(true, true) * m_cache.instance_box_size;
|
||||
if (changed_box || !m_cache.instance.matches_instance(instance_idx) || !m_cache.scale.isApprox(100.0 * m_new_scale))
|
||||
m_new_size = volume->get_instance_transformation().get_matrix(true, true) * m_cache.instance.box_size;
|
||||
}
|
||||
else
|
||||
// this should never happen
|
||||
|
@ -270,8 +268,7 @@ void ObjectManipulation::update_settings_value(const GLCanvas3D::Selection& sele
|
|||
else if (selection.is_single_full_object())
|
||||
{
|
||||
#if ENABLE_IMPROVED_SIDEBAR_OBJECTS_MANIPULATION
|
||||
m_cache.object_idx = -1;
|
||||
m_cache.instance_idx = -1;
|
||||
m_cache.instance.reset();
|
||||
#endif // ENABLE_IMPROVED_SIDEBAR_OBJECTS_MANIPULATION
|
||||
|
||||
const BoundingBoxf3& box = selection.get_bounding_box();
|
||||
|
@ -286,8 +283,7 @@ void ObjectManipulation::update_settings_value(const GLCanvas3D::Selection& sele
|
|||
else if (selection.is_single_modifier() || selection.is_single_volume())
|
||||
{
|
||||
#if ENABLE_IMPROVED_SIDEBAR_OBJECTS_MANIPULATION
|
||||
m_cache.object_idx = -1;
|
||||
m_cache.instance_idx = -1;
|
||||
m_cache.instance.reset();
|
||||
#endif // ENABLE_IMPROVED_SIDEBAR_OBJECTS_MANIPULATION
|
||||
|
||||
// the selection contains a single volume
|
||||
|
@ -433,8 +429,7 @@ void ObjectManipulation::reset_settings_value()
|
|||
m_new_size = Vec3d::Zero();
|
||||
m_new_enabled = false;
|
||||
#if ENABLE_IMPROVED_SIDEBAR_OBJECTS_MANIPULATION
|
||||
m_cache.object_idx = -1;
|
||||
m_cache.instance_idx = -1;
|
||||
m_cache.instance.reset();
|
||||
#endif // ENABLE_IMPROVED_SIDEBAR_OBJECTS_MANIPULATION
|
||||
#if !ENABLE_IMPROVED_SIDEBAR_OBJECTS_MANIPULATION
|
||||
m_dirty = true;
|
||||
|
@ -514,6 +509,9 @@ void ObjectManipulation::change_scale_value(const Vec3d& scale)
|
|||
canvas->do_scale();
|
||||
|
||||
#if ENABLE_IMPROVED_SIDEBAR_OBJECTS_MANIPULATION
|
||||
if (!m_cache.scale.isApprox(scale))
|
||||
m_cache.instance.instance_idx = -1;
|
||||
|
||||
m_cache.scale = scale;
|
||||
#endif // ENABLE_IMPROVED_SIDEBAR_OBJECTS_MANIPULATION
|
||||
}
|
||||
|
|
|
@ -26,16 +26,25 @@ class ObjectManipulation : public OG_Settings
|
|||
std::string rotate_label_string;
|
||||
std::string scale_label_string;
|
||||
|
||||
int object_idx;
|
||||
int instance_idx;
|
||||
struct Instance
|
||||
{
|
||||
int object_idx;
|
||||
int instance_idx;
|
||||
Vec3d box_size;
|
||||
|
||||
Vec3d instance_box_size;
|
||||
Instance() { reset(); }
|
||||
void reset() { this->object_idx = -1; this->instance_idx = -1; this->box_size = Vec3d::Zero(); }
|
||||
void set(int object_idx, int instance_idx, const Vec3d& box_size) { this->object_idx = object_idx; this->instance_idx = instance_idx; this->box_size = box_size; }
|
||||
bool matches(int object_idx, int instance_idx) const { return (this->object_idx == object_idx) && (this->instance_idx == instance_idx); }
|
||||
bool matches_object(int object_idx) const { return (this->object_idx == object_idx); }
|
||||
bool matches_instance(int instance_idx) const { return (this->instance_idx == instance_idx); }
|
||||
};
|
||||
|
||||
Instance instance;
|
||||
|
||||
Cache() : position(Vec3d(DBL_MAX, DBL_MAX, DBL_MAX)) , rotation(Vec3d(DBL_MAX, DBL_MAX, DBL_MAX))
|
||||
, scale(Vec3d(DBL_MAX, DBL_MAX, DBL_MAX)) , size(Vec3d(DBL_MAX, DBL_MAX, DBL_MAX))
|
||||
, move_label_string("") , rotate_label_string("") , scale_label_string("")
|
||||
, object_idx(-1)
|
||||
, instance_idx(-1)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1053,7 +1053,7 @@ std::vector<std::string> PresetCollection::dirty_options(const Preset *edited, c
|
|||
std::vector<std::string> changed;
|
||||
if (edited != nullptr && reference != nullptr) {
|
||||
changed = deep_compare ?
|
||||
deep_diff(reference->config, edited->config) :
|
||||
deep_diff(edited->config, reference->config) :
|
||||
reference->config.diff(edited->config);
|
||||
// The "compatible_printers" option key is handled differently from the others:
|
||||
// It is not mandatory. If the key is missing, it means it is compatible with any printer.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue