Merge branch 'master' of https://github.com/Prusa3d/PrusaSlicer
This commit is contained in:
commit
972b7d2d6b
8 changed files with 44 additions and 12 deletions
|
@ -4,6 +4,8 @@
|
||||||
#include "../GCode.hpp"
|
#include "../GCode.hpp"
|
||||||
#include "../Geometry.hpp"
|
#include "../Geometry.hpp"
|
||||||
|
|
||||||
|
#include "../I18N.hpp"
|
||||||
|
|
||||||
#include "3mf.hpp"
|
#include "3mf.hpp"
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
@ -202,6 +204,11 @@ bool is_valid_object_type(const std::string& type)
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
|
//! macro used to mark string used at localization,
|
||||||
|
//! return same string
|
||||||
|
#define L(s) (s)
|
||||||
|
#define _(s) Slic3r::I18N::translate(s)
|
||||||
|
|
||||||
// Base class with error messages management
|
// Base class with error messages management
|
||||||
class _3MF_Base
|
class _3MF_Base
|
||||||
{
|
{
|
||||||
|
@ -1416,7 +1423,7 @@ namespace Slic3r {
|
||||||
|
|
||||||
if (m_check_version && (m_version > VERSION_3MF))
|
if (m_check_version && (m_version > VERSION_3MF))
|
||||||
{
|
{
|
||||||
std::string msg = "The selected 3mf file has been saved with a newer version of " + std::string(SLIC3R_APP_NAME) + " and is not compatibile.";
|
std::string msg = _(L("The selected 3mf file has been saved with a newer version of " + std::string(SLIC3R_APP_NAME) + " and is not compatibile."));
|
||||||
throw std::runtime_error(msg.c_str());
|
throw std::runtime_error(msg.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
#include "../GCode.hpp"
|
#include "../GCode.hpp"
|
||||||
#include "../PrintConfig.hpp"
|
#include "../PrintConfig.hpp"
|
||||||
#include "../Utils.hpp"
|
#include "../Utils.hpp"
|
||||||
|
#include "../I18N.hpp"
|
||||||
|
|
||||||
#include "AMF.hpp"
|
#include "AMF.hpp"
|
||||||
|
|
||||||
#include <boost/filesystem/operations.hpp>
|
#include <boost/filesystem/operations.hpp>
|
||||||
|
@ -42,6 +44,11 @@ const char* SLIC3R_CONFIG_TYPE = "slic3rpe_config";
|
||||||
namespace Slic3r
|
namespace Slic3r
|
||||||
{
|
{
|
||||||
|
|
||||||
|
//! macro used to mark string used at localization,
|
||||||
|
//! return same string
|
||||||
|
#define L(s) (s)
|
||||||
|
#define _(s) Slic3r::I18N::translate(s)
|
||||||
|
|
||||||
struct AMFParserContext
|
struct AMFParserContext
|
||||||
{
|
{
|
||||||
AMFParserContext(XML_Parser parser, DynamicPrintConfig* config, Model* model) :
|
AMFParserContext(XML_Parser parser, DynamicPrintConfig* config, Model* model) :
|
||||||
|
@ -803,7 +810,7 @@ bool extract_model_from_archive(mz_zip_archive& archive, const mz_zip_archive_fi
|
||||||
|
|
||||||
if (check_version && (ctx.m_version > VERSION_AMF))
|
if (check_version && (ctx.m_version > VERSION_AMF))
|
||||||
{
|
{
|
||||||
std::string msg = "The selected amf file has been saved with a newer version of " + std::string(SLIC3R_APP_NAME) + " and is not compatibile.";
|
std::string msg = _(L("The selected amf file has been saved with a newer version of " + std::string(SLIC3R_APP_NAME) + " and is not compatibile."));
|
||||||
throw std::runtime_error(msg.c_str());
|
throw std::runtime_error(msg.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2264,12 +2264,7 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_gizmos.on_char(evt))
|
if (m_gizmos.on_char(evt))
|
||||||
{
|
|
||||||
// FIXME: Without the following call to render(), the gimgui dialogs are not shown the first time the user tries to open them using the keyboard shortcuts
|
|
||||||
// (it looks like as if 2 render calls are needed before they show up)
|
|
||||||
render();
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
//#ifdef __APPLE__
|
//#ifdef __APPLE__
|
||||||
// ctrlMask |= wxMOD_RAW_CONTROL;
|
// ctrlMask |= wxMOD_RAW_CONTROL;
|
||||||
|
|
|
@ -175,6 +175,9 @@ void ObjectSettings::update_config_values(DynamicPrintConfig* config)
|
||||||
const auto printer_technology = wxGetApp().plater()->printer_technology();
|
const auto printer_technology = wxGetApp().plater()->printer_technology();
|
||||||
const bool is_object_settings = objects_model->GetItemType(objects_model->GetParent(item)) == itObject;
|
const bool is_object_settings = objects_model->GetItemType(objects_model->GetParent(item)) == itObject;
|
||||||
|
|
||||||
|
if (!item || !objects_model->IsSettingsItem(item) || !config)
|
||||||
|
return;
|
||||||
|
|
||||||
// update config values according to configuration hierarchy
|
// update config values according to configuration hierarchy
|
||||||
DynamicPrintConfig main_config = printer_technology == ptFFF ?
|
DynamicPrintConfig main_config = printer_technology == ptFFF ?
|
||||||
wxGetApp().preset_bundle->prints.get_edited_preset().config :
|
wxGetApp().preset_bundle->prints.get_edited_preset().config :
|
||||||
|
|
|
@ -145,6 +145,7 @@ GLGizmoBase::GLGizmoBase(GLCanvas3D& parent, const std::string& icon_filename, u
|
||||||
, m_hover_id(-1)
|
, m_hover_id(-1)
|
||||||
, m_dragging(false)
|
, m_dragging(false)
|
||||||
, m_imgui(wxGetApp().imgui())
|
, m_imgui(wxGetApp().imgui())
|
||||||
|
, m_first_input_window_render(true)
|
||||||
{
|
{
|
||||||
::memcpy((void*)m_base_color, (const void*)DEFAULT_BASE_COLOR, 4 * sizeof(float));
|
::memcpy((void*)m_base_color, (const void*)DEFAULT_BASE_COLOR, 4 * sizeof(float));
|
||||||
::memcpy((void*)m_drag_color, (const void*)DEFAULT_DRAG_COLOR, 4 * sizeof(float));
|
::memcpy((void*)m_drag_color, (const void*)DEFAULT_DRAG_COLOR, 4 * sizeof(float));
|
||||||
|
@ -273,6 +274,18 @@ std::string GLGizmoBase::format(float value, unsigned int decimals) const
|
||||||
return Slic3r::string_printf("%.*f", decimals, value);
|
return Slic3r::string_printf("%.*f", decimals, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GLGizmoBase::render_input_window(float x, float y, float bottom_limit)
|
||||||
|
{
|
||||||
|
on_render_input_window(x, y, bottom_limit);
|
||||||
|
if (m_first_input_window_render)
|
||||||
|
{
|
||||||
|
// for some reason, the imgui dialogs are not shown on screen in the 1st frame where they are rendered, but show up only with the 2nd rendered frame
|
||||||
|
// so, we forces another frame rendering the first time the imgui window is shown
|
||||||
|
m_parent.set_as_dirty();
|
||||||
|
m_first_input_window_render = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Produce an alpha channel checksum for the red green blue components. The alpha channel may then be used to verify, whether the rgb components
|
// Produce an alpha channel checksum for the red green blue components. The alpha channel may then be used to verify, whether the rgb components
|
||||||
// were not interpolated by alpha blending or multi sampling.
|
// were not interpolated by alpha blending or multi sampling.
|
||||||
unsigned char picking_checksum_alpha_channel(unsigned char red, unsigned char green, unsigned char blue)
|
unsigned char picking_checksum_alpha_channel(unsigned char red, unsigned char green, unsigned char blue)
|
||||||
|
|
|
@ -99,6 +99,7 @@ protected:
|
||||||
float m_highlight_color[4];
|
float m_highlight_color[4];
|
||||||
mutable std::vector<Grabber> m_grabbers;
|
mutable std::vector<Grabber> m_grabbers;
|
||||||
ImGuiWrapper* m_imgui;
|
ImGuiWrapper* m_imgui;
|
||||||
|
bool m_first_input_window_render;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GLGizmoBase(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id);
|
GLGizmoBase(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id);
|
||||||
|
@ -144,7 +145,7 @@ public:
|
||||||
|
|
||||||
void render() const { on_render(); }
|
void render() const { on_render(); }
|
||||||
void render_for_picking() const { on_render_for_picking(); }
|
void render_for_picking() const { on_render_for_picking(); }
|
||||||
void render_input_window(float x, float y, float bottom_limit) { on_render_input_window(x, y, bottom_limit); }
|
void render_input_window(float x, float y, float bottom_limit);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool on_init() = 0;
|
virtual bool on_init() = 0;
|
||||||
|
|
|
@ -141,6 +141,7 @@ void GLGizmoCut::on_render_input_window(float x, float y, float bottom_limit)
|
||||||
m_imgui->set_next_window_pos(x, y, ImGuiCond_Always);
|
m_imgui->set_next_window_pos(x, y, ImGuiCond_Always);
|
||||||
|
|
||||||
m_imgui->set_next_window_bg_alpha(0.5f);
|
m_imgui->set_next_window_bg_alpha(0.5f);
|
||||||
|
|
||||||
m_imgui->begin(_(L("Cut")), ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse);
|
m_imgui->begin(_(L("Cut")), ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse);
|
||||||
|
|
||||||
ImGui::PushItemWidth(m_imgui->scaled(5.0f));
|
ImGui::PushItemWidth(m_imgui->scaled(5.0f));
|
||||||
|
|
|
@ -1487,11 +1487,16 @@ void PresetBundle::update_platter_filament_ui(unsigned int idx_extruder, GUI::Pr
|
||||||
* and scale them in respect to em_unit value
|
* and scale them in respect to em_unit value
|
||||||
*/
|
*/
|
||||||
const float scale_f = ui->em_unit() * 0.1f;
|
const float scale_f = ui->em_unit() * 0.1f;
|
||||||
const int icon_height = 16 * scale_f + 0.5f;
|
|
||||||
const int normal_icon_width = 16 * scale_f + 0.5f;
|
// To avoid the errors of number rounding for different combination of monitor configuration,
|
||||||
|
// let use scaled 8px, as a smallest icon unit
|
||||||
|
const int icon_unit = 8 * scale_f + 0.5f;
|
||||||
|
const int icon_height = 2 * icon_unit; //16 * scale_f + 0.5f;
|
||||||
|
const int normal_icon_width = 2 * icon_unit; //16 * scale_f + 0.5f;
|
||||||
|
const int thin_icon_width = icon_unit; //8 * scale_f + 0.5f;
|
||||||
|
const int wide_icon_width = 3 * icon_unit; //24 * scale_f + 0.5f;
|
||||||
|
|
||||||
const int space_icon_width = 2 * scale_f + 0.5f;
|
const int space_icon_width = 2 * scale_f + 0.5f;
|
||||||
const int wide_icon_width = 24 * scale_f + 0.5f;
|
|
||||||
const int thin_icon_width = 8 * scale_f + 0.5f;
|
|
||||||
|
|
||||||
for (int i = this->filaments().front().is_visible ? 0 : 1; i < int(this->filaments().size()); ++i) {
|
for (int i = this->filaments().front().is_visible ? 0 : 1; i < int(this->filaments().size()); ++i) {
|
||||||
const Preset &preset = this->filaments.preset(i);
|
const Preset &preset = this->filaments.preset(i);
|
||||||
|
|
Loading…
Reference in a new issue