Merge branch 'master' of https://github.com/prusa3d/Slic3r into objects_centering
This commit is contained in:
commit
cef761e6b6
4 changed files with 34 additions and 2 deletions
|
@ -2466,11 +2466,13 @@ void GLGizmoCut::on_render_input_window(float x, float y, const GLCanvas3D::Sele
|
||||||
m_imgui->checkbox(_(L("Keep lower part")), m_keep_lower);
|
m_imgui->checkbox(_(L("Keep lower part")), m_keep_lower);
|
||||||
m_imgui->checkbox(_(L("Rotate lower part upwards")), m_rotate_lower);
|
m_imgui->checkbox(_(L("Rotate lower part upwards")), m_rotate_lower);
|
||||||
|
|
||||||
|
m_imgui->disabled_begin(!m_keep_upper && !m_keep_lower);
|
||||||
const bool cut_clicked = m_imgui->button(_(L("Perform cut")));
|
const bool cut_clicked = m_imgui->button(_(L("Perform cut")));
|
||||||
|
m_imgui->disabled_end();
|
||||||
|
|
||||||
m_imgui->end();
|
m_imgui->end();
|
||||||
|
|
||||||
if (cut_clicked) {
|
if (cut_clicked && (m_keep_upper || m_keep_lower)) {
|
||||||
perform_cut(selection);
|
perform_cut(selection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
|
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
|
|
||||||
|
#include <imgui/imgui_internal.h>
|
||||||
|
|
||||||
#include "libslic3r/libslic3r.h"
|
#include "libslic3r/libslic3r.h"
|
||||||
#include "libslic3r/Utils.hpp"
|
#include "libslic3r/Utils.hpp"
|
||||||
#include "GUI.hpp"
|
#include "GUI.hpp"
|
||||||
|
@ -23,6 +25,7 @@ namespace GUI {
|
||||||
ImGuiWrapper::ImGuiWrapper()
|
ImGuiWrapper::ImGuiWrapper()
|
||||||
: m_font_texture(0)
|
: m_font_texture(0)
|
||||||
, m_mouse_buttons(0)
|
, m_mouse_buttons(0)
|
||||||
|
, m_disabled(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,6 +157,26 @@ void ImGuiWrapper::text(const wxString &label)
|
||||||
ImGui::Text(label_utf8.c_str(), NULL);
|
ImGui::Text(label_utf8.c_str(), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ImGuiWrapper::disabled_begin(bool disabled)
|
||||||
|
{
|
||||||
|
wxCHECK_RET(!m_disabled, "ImGUI: Unbalanced disabled_begin() call");
|
||||||
|
|
||||||
|
if (disabled) {
|
||||||
|
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
|
||||||
|
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
|
||||||
|
m_disabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImGuiWrapper::disabled_end()
|
||||||
|
{
|
||||||
|
if (m_disabled) {
|
||||||
|
ImGui::PopItemFlag();
|
||||||
|
ImGui::PopStyleVar();
|
||||||
|
m_disabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool ImGuiWrapper::want_mouse() const
|
bool ImGuiWrapper::want_mouse() const
|
||||||
{
|
{
|
||||||
return ImGui::GetIO().WantCaptureMouse;
|
return ImGui::GetIO().WantCaptureMouse;
|
||||||
|
|
|
@ -21,8 +21,8 @@ class ImGuiWrapper
|
||||||
|
|
||||||
FontsMap m_fonts;
|
FontsMap m_fonts;
|
||||||
unsigned m_font_texture;
|
unsigned m_font_texture;
|
||||||
|
|
||||||
unsigned m_mouse_buttons;
|
unsigned m_mouse_buttons;
|
||||||
|
bool m_disabled;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ImGuiWrapper();
|
ImGuiWrapper();
|
||||||
|
@ -50,6 +50,9 @@ public:
|
||||||
bool checkbox(const wxString &label, bool &value);
|
bool checkbox(const wxString &label, bool &value);
|
||||||
void text(const wxString &label);
|
void text(const wxString &label);
|
||||||
|
|
||||||
|
void disabled_begin(bool disabled);
|
||||||
|
void disabled_end();
|
||||||
|
|
||||||
bool want_mouse() const;
|
bool want_mouse() const;
|
||||||
bool want_keyboard() const;
|
bool want_keyboard() const;
|
||||||
bool want_text_input() const;
|
bool want_text_input() const;
|
||||||
|
|
|
@ -2804,6 +2804,10 @@ void Plater::cut(size_t obj_idx, size_t instance_idx, coordf_t z, bool keep_uppe
|
||||||
|
|
||||||
wxCHECK_RET(instance_idx < object->instances.size(), "instance_idx out of bounds");
|
wxCHECK_RET(instance_idx < object->instances.size(), "instance_idx out of bounds");
|
||||||
|
|
||||||
|
if (!keep_upper && !keep_lower) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const auto new_objects = object->cut(instance_idx, z, keep_upper, keep_lower, rotate_lower);
|
const auto new_objects = object->cut(instance_idx, z, keep_upper, keep_lower, rotate_lower);
|
||||||
|
|
||||||
remove(obj_idx);
|
remove(obj_idx);
|
||||||
|
|
Loading…
Reference in a new issue