FIX:update new layout
Change-Id: If57f072621115d99e9f8a94b59dd345a14d882d4 (cherry picked from commit 6b02e2bc5a3d5f92cbcb9303740779213eadeae4)
This commit is contained in:
parent
16dc147d30
commit
afa549d410
|
@ -1,14 +1,14 @@
|
|||
<svg width="30" height="22" viewBox="0 0 30 22" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.02087 4.20131C4.00498 4.20131 3.20131 5.00625 3.20131 5.96954V17.0305C3.20131 17.9938 4.00498 18.7987 5.02087 18.7987H24.9287C25.9446 18.7987 26.7483 17.9938 26.7483 17.0305V5.96954C26.7483 5.00625 25.9446 4.20131 24.9287 4.20131H5.02087ZM2 5.96954C2 4.31864 3.36592 3 5.02087 3H24.9287C26.5837 3 27.9496 4.31864 27.9496 5.96954V17.0305C27.9496 18.6814 26.5837 20 24.9287 20H5.02087C3.36592 20 2 18.6814 2 17.0305V5.96954Z" fill="#6B6B6B"/>
|
||||
<path d="M9.59458 10.4473H5.28906V12.5525H9.59458V10.4473Z" fill="#6B6B6B"/>
|
||||
<path d="M13.897 10.4473H11.7461V12.5525H13.897V10.4473Z" fill="#6B6B6B"/>
|
||||
<path d="M18.2026 10.4473H16.0518V12.5525H18.2026V10.4473Z" fill="#6B6B6B"/>
|
||||
<path d="M16.0532 6.76367H13.9023V8.86894H16.0532V6.76367Z" fill="#6B6B6B"/>
|
||||
<path d="M11.7466 6.76367H9.5957V8.86894H11.7466V6.76367Z" fill="#6B6B6B"/>
|
||||
<path d="M7.4419 6.76367H5.29102V8.86894H7.4419V6.76367Z" fill="#6B6B6B"/>
|
||||
<path d="M20.355 6.76367H18.2041V8.86894H20.355V6.76367Z" fill="#6B6B6B"/>
|
||||
<path d="M22.5093 6.76367V10.4506H20.3584V12.5559H24.6602V11.5051V10.4506V6.76367H22.5093Z" fill="#6B6B6B"/>
|
||||
<path d="M7.43995 14.1348H5.28906V16.24H7.43995V14.1348Z" fill="#6B6B6B"/>
|
||||
<path d="M20.3586 14.1348H9.59668V16.24H20.3586V14.1348Z" fill="#6B6B6B"/>
|
||||
<path d="M24.6587 14.1348H22.5078V16.24H24.6587V14.1348Z" fill="#6B6B6B"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.02092 4.20131C4.00501 4.20131 3.20133 5.00625 3.20133 5.96954V17.0305C3.20133 17.9938 4.00501 18.7987 5.02092 18.7987H24.9291C25.945 18.7987 26.7487 17.9938 26.7487 17.0305V5.96954C26.7487 5.00625 25.945 4.20131 24.9291 4.20131H5.02092ZM2 5.96954C2 4.31864 3.36594 3 5.02092 3H24.9291C26.5841 3 27.95 4.31864 27.95 5.96954V17.0305C27.95 18.6814 26.5841 20 24.9291 20H5.02092C3.36594 20 2 18.6814 2 17.0305V5.96954Z" fill="#00AE42"/>
|
||||
<path d="M9.59541 10.4467H5.28983V12.552H9.59541V10.4467Z" fill="#00AE42"/>
|
||||
<path d="M13.8978 10.4467H11.7469V12.552H13.8978V10.4467Z" fill="#00AE42"/>
|
||||
<path d="M18.203 10.4467H16.0521V12.552H18.203V10.4467Z" fill="#00AE42"/>
|
||||
<path d="M16.0527 6.7626H13.9018V8.86787H16.0527V6.7626Z" fill="#00AE42"/>
|
||||
<path d="M11.7467 6.7626H9.59576V8.86787H11.7467V6.7626Z" fill="#00AE42"/>
|
||||
<path d="M7.44144 6.7626H5.29052V8.86787H7.44144V6.7626Z" fill="#00AE42"/>
|
||||
<path d="M20.3547 6.7626H18.2038V8.86787H20.3547V6.7626Z" fill="#00AE42"/>
|
||||
<path d="M22.509 6.7626V10.4496H20.358V12.5548H24.6599V11.504V10.4496V6.7626H22.509Z" fill="#00AE42"/>
|
||||
<path d="M7.44075 14.1348H5.28983V16.2401H7.44075V14.1348Z" fill="#00AE42"/>
|
||||
<path d="M20.358 14.1348H9.59587V16.2401H20.358V14.1348Z" fill="#00AE42"/>
|
||||
<path d="M24.6593 14.1348H22.5084V16.2401H24.6593V14.1348Z" fill="#00AE42"/>
|
||||
</svg>
|
||||
|
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
@ -45,6 +45,11 @@ bool GLGizmoSeam::on_init()
|
|||
return true;
|
||||
}
|
||||
|
||||
GLGizmoSeam::GLGizmoSeam(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id)
|
||||
: GLGizmoPainterBase(parent, icon_filename, sprite_id), m_current_tool(ImGui::CircleButtonIcon)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
std::string GLGizmoSeam::on_get_name() const
|
||||
|
@ -114,6 +119,48 @@ void GLGizmoSeam::render_triangles(const Selection& selection) const
|
|||
}
|
||||
}
|
||||
|
||||
void GLGizmoSeam::show_tooltip_information(float caption_max, float x, float y)
|
||||
{
|
||||
ImTextureID normal_id = m_parent.get_gizmos_manager().get_icon_texture_id(GLGizmosManager::MENU_ICON_NAME::IC_TOOLBAR_TOOLTIP);
|
||||
ImTextureID hover_id = m_parent.get_gizmos_manager().get_icon_texture_id(GLGizmosManager::MENU_ICON_NAME::IC_TOOLBAR_TOOLTIP_HOVER);
|
||||
|
||||
float font_size = ImGui::GetFontSize();
|
||||
ImVec2 button_size = ImVec2(font_size * 1.8, font_size * 1.3);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0f);
|
||||
ImGui::ImageButton3(normal_id, hover_id, button_size);
|
||||
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::BeginTooltip2(ImVec2(x, y));
|
||||
auto draw_text_with_caption = [this, &caption_max](const wxString &caption, const wxString &text) {
|
||||
m_imgui->text_colored(ImGuiWrapper::COL_ACTIVE, caption);
|
||||
ImGui::SameLine(caption_max);
|
||||
m_imgui->text_colored(ImGuiWrapper::COL_WINDOW_BG, text);
|
||||
};
|
||||
|
||||
for (const auto &t : std::array<std::string, 3>{"enforce", "block", "remove"}) draw_text_with_caption(m_desc.at(t + "_caption"), m_desc.at(t));
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
ImGui::PopStyleVar(1);
|
||||
}
|
||||
|
||||
void GLGizmoSeam::tool_changed(wchar_t old_tool, wchar_t new_tool)
|
||||
{
|
||||
if ((old_tool == ImGui::GapFillIcon && new_tool == ImGui::GapFillIcon) ||
|
||||
(old_tool != ImGui::GapFillIcon && new_tool != ImGui::GapFillIcon))
|
||||
return;
|
||||
|
||||
for (auto& selector_ptr : m_triangle_selectors) {
|
||||
TriangleSelectorPatch* tsp = dynamic_cast<TriangleSelectorPatch*>(selector_ptr.get());
|
||||
tsp->set_filter_state(new_tool == ImGui::GapFillIcon);
|
||||
}
|
||||
}
|
||||
|
||||
static std::string into_u8(const wxString& str)
|
||||
{
|
||||
auto buffer_utf8 = str.utf8_str();
|
||||
return std::string(buffer_utf8.data());
|
||||
}
|
||||
|
||||
void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit)
|
||||
{
|
||||
if (! m_c->selection_info()->model_object())
|
||||
|
@ -123,16 +170,17 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit)
|
|||
y = std::min(y, bottom_limit - approx_height);
|
||||
//BBS: GUI refactor: move gizmo to the right
|
||||
#if BBS_TOOLBAR_ON_TOP
|
||||
m_imgui->set_next_window_pos(x, y, ImGuiCond_Always, 0.0f, 0.0f);
|
||||
GizmoImguiSetNextWIndowPos(x, y, ImGuiCond_Always, 0.0f, 0.0f);
|
||||
#else
|
||||
m_imgui->set_next_window_pos(x, y, ImGuiCond_Always, 1.0f, 0.0f);
|
||||
GizmoImguiSetNextWIndowPos(x, y, ImGuiCond_Always, 1.0f, 0.0f);
|
||||
#endif
|
||||
//m_imgui->set_next_window_pos(x, y, ImGuiCond_Always);
|
||||
|
||||
wchar_t old_tool = m_current_tool;
|
||||
//BBS
|
||||
ImGuiWrapper::push_toolbar_style();
|
||||
|
||||
m_imgui->begin(get_name(), ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse);
|
||||
GizmoImguiBegin(get_name(), ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar);
|
||||
|
||||
// First calculate width of all the texts that are could possibly be shown. We will decide set the dialog width based on that:
|
||||
const float clipping_slider_left = std::max(m_imgui->calc_text_size(m_desc.at("clipping_of_view")).x,
|
||||
|
@ -146,6 +194,7 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit)
|
|||
|
||||
const float button_width = m_imgui->calc_text_size(m_desc.at("remove_all")).x + m_imgui->scaled(1.f);
|
||||
const float minimal_slider_width = m_imgui->scaled(4.f);
|
||||
const float empty_button_width = m_imgui->calc_button_size("").x;
|
||||
|
||||
float caption_max = 0.f;
|
||||
float total_text_max = 0.f;
|
||||
|
@ -155,7 +204,7 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit)
|
|||
}
|
||||
total_text_max += caption_max + m_imgui->scaled(1.f);
|
||||
caption_max += m_imgui->scaled(1.f);
|
||||
|
||||
float slider_width_times = 1.5;
|
||||
const float sliders_left_width = std::max(cursor_size_slider_left, clipping_slider_left);
|
||||
#if ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT
|
||||
const float slider_icon_width = m_imgui->get_slider_icon_size().x;
|
||||
|
@ -167,82 +216,89 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit)
|
|||
window_width = std::max(window_width, button_width);
|
||||
window_width = std::max(window_width, cursor_type_radio_left + cursor_type_radio_sphere + cursor_type_radio_circle);
|
||||
|
||||
auto draw_text_with_caption = [this, &caption_max](const wxString& caption, const wxString& text) {
|
||||
//BBS set text colored to BLUE_LIGHT
|
||||
m_imgui->text_colored(ImGuiWrapper::COL_BLUE_LIGHT, caption);
|
||||
ImGui::SameLine(caption_max);
|
||||
m_imgui->text(text);
|
||||
};
|
||||
|
||||
for (const auto &t : std::array<std::string, 3>{"enforce", "block", "remove"})
|
||||
draw_text_with_caption(m_desc.at(t + "_caption"), m_desc.at(t));
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
const float max_tooltip_width = ImGui::GetFontSize() * 20.0f;
|
||||
|
||||
ImGui::AlignTextToFramePadding();
|
||||
m_imgui->text(m_desc.at("cursor_type"));
|
||||
std::array<wchar_t, 2> tool_icons = { ImGui::CircleButtonIcon, ImGui::SphereButtonIcon};
|
||||
std::array<wxString, 2> tool_tips = { _L("Circle"), _L("Sphere")};
|
||||
for (int i = 0; i < tool_icons.size(); i++) {
|
||||
std::string str_label = std::string("##");
|
||||
std::wstring btn_name = tool_icons[i] + boost::nowide::widen(str_label);
|
||||
|
||||
if (i != 0) ImGui::SameLine((empty_button_width + m_imgui->scaled(1.75f)) * i + m_imgui->scaled(1.3f));
|
||||
|
||||
if (m_current_tool == tool_icons[i]) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.81f, 0.81f, 0.81f, 1.0f)); // r, g, b, a
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.81f, 0.81f, 0.81f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.81f, 0.81f, 0.81f, 1.0f));
|
||||
}
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0);
|
||||
bool btn_clicked = ImGui::Button(into_u8(btn_name).c_str());
|
||||
ImGui::PopStyleVar(1);
|
||||
if (m_current_tool == tool_icons[i])ImGui::PopStyleColor(3);
|
||||
|
||||
if (btn_clicked && m_current_tool != tool_icons[i]) {
|
||||
m_current_tool = tool_icons[i];
|
||||
for (auto& triangle_selector : m_triangle_selectors) {
|
||||
triangle_selector->seed_fill_unselect_all_triangles();
|
||||
triangle_selector->request_update_render_data();
|
||||
}
|
||||
}
|
||||
|
||||
if (ImGui::IsItemHovered()) {
|
||||
m_imgui->tooltip(tool_tips[i], max_tooltip_width);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_current_tool != old_tool)
|
||||
this->tool_changed(old_tool, m_current_tool);
|
||||
|
||||
ImGui::Dummy(ImVec2(0.0f, ImGui::GetFontSize() * 0.1));
|
||||
|
||||
if (m_current_tool == ImGui::CircleButtonIcon) {
|
||||
m_cursor_type = TriangleSelector::CursorType::CIRCLE;
|
||||
m_tool_type = ToolType::BRUSH;
|
||||
} else if (m_current_tool == ImGui::SphereButtonIcon) {
|
||||
m_cursor_type = TriangleSelector::CursorType::SPHERE;
|
||||
m_tool_type = ToolType::BRUSH;
|
||||
}
|
||||
|
||||
ImGui::AlignTextToFramePadding();
|
||||
m_imgui->text(m_desc.at("cursor_size"));
|
||||
ImGui::SameLine(sliders_left_width);
|
||||
#if ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT
|
||||
ImGui::PushItemWidth(window_width - sliders_left_width - slider_icon_width);
|
||||
m_imgui->slider_float("##cursor_radius", &m_cursor_radius, CursorRadiusMin, CursorRadiusMax, "%.2f", 1.0f, true, _L("Alt + Mouse wheel"));
|
||||
#else
|
||||
ImGui::PushItemWidth(window_width - sliders_left_width);
|
||||
m_imgui->slider_float("##cursor_radius", &m_cursor_radius, CursorRadiusMin, CursorRadiusMax, "%.2f");
|
||||
if (ImGui::IsItemHovered())
|
||||
m_imgui->tooltip(_L("Alt + Mouse wheel"), max_tooltip_width);
|
||||
#endif // ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT
|
||||
|
||||
ImGui::PushItemWidth(window_width - sliders_left_width - slider_width_times * slider_icon_width);
|
||||
m_imgui->bbl_slider_float_style("##cursor_radius", &m_cursor_radius, CursorRadiusMin, CursorRadiusMax, "%.2f", 1.0f, true);
|
||||
ImGui::SameLine(window_width - slider_icon_width);
|
||||
ImGui::PushItemWidth(1.5 * slider_icon_width);
|
||||
ImGui::BBLDragFloat("##cursor_radius_input", &m_cursor_radius, 0.05f, 0.0f, 0.0f, "%.2f");
|
||||
|
||||
ImGui::AlignTextToFramePadding();
|
||||
m_imgui->text(m_desc.at("cursor_type"));
|
||||
|
||||
float cursor_type_offset = cursor_type_radio_left + (window_width - cursor_type_radio_left - cursor_type_radio_sphere - cursor_type_radio_circle + m_imgui->scaled(0.5f)) / 2.f;
|
||||
ImGui::SameLine(cursor_type_offset);
|
||||
ImGui::PushItemWidth(cursor_type_radio_sphere);
|
||||
if (m_imgui->radio_button(m_desc["sphere"], m_cursor_type == TriangleSelector::CursorType::SPHERE))
|
||||
m_cursor_type = TriangleSelector::CursorType::SPHERE;
|
||||
|
||||
if (ImGui::IsItemHovered())
|
||||
m_imgui->tooltip(_L("Paints all facets inside, regardless of their orientation."), max_tooltip_width);
|
||||
|
||||
ImGui::SameLine(cursor_type_offset + cursor_type_radio_sphere);
|
||||
ImGui::PushItemWidth(cursor_type_radio_circle);
|
||||
if (m_imgui->radio_button(m_desc["circle"], m_cursor_type == TriangleSelector::CursorType::CIRCLE))
|
||||
m_cursor_type = TriangleSelector::CursorType::CIRCLE;
|
||||
|
||||
if (ImGui::IsItemHovered())
|
||||
m_imgui->tooltip(_L("Ignores facets facing away from the camera."), max_tooltip_width);
|
||||
|
||||
ImGui::Separator();
|
||||
if (m_c->object_clipper()->get_position() == 0.f) {
|
||||
ImGui::AlignTextToFramePadding();
|
||||
m_imgui->text(m_desc.at("clipping_of_view"));
|
||||
}
|
||||
else {
|
||||
if (m_imgui->button(m_desc.at("reset_direction"))) {
|
||||
wxGetApp().CallAfter([this](){
|
||||
m_c->object_clipper()->set_position(-1., false);
|
||||
});
|
||||
}
|
||||
}
|
||||
m_imgui->text(m_desc.at("clipping_of_view"));
|
||||
|
||||
auto clp_dist = float(m_c->object_clipper()->get_position());
|
||||
ImGui::SameLine(sliders_left_width);
|
||||
#if ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT
|
||||
ImGui::PushItemWidth(window_width - sliders_left_width - slider_icon_width);
|
||||
if (m_imgui->slider_float("##clp_dist", &clp_dist, 0.f, 1.f, "%.2f", 1.0f, true, _L("Ctrl + Mouse wheel")))
|
||||
m_c->object_clipper()->set_position(clp_dist, true);
|
||||
#else
|
||||
ImGui::PushItemWidth(window_width - sliders_left_width);
|
||||
if (m_imgui->slider_float("##clp_dist", &clp_dist, 0.f, 1.f, "%.2f"))
|
||||
m_c->object_clipper()->set_position(clp_dist, true);
|
||||
|
||||
if (ImGui::IsItemHovered())
|
||||
m_imgui->tooltip(_L("Ctrl + Mouse wheel"), max_tooltip_width);
|
||||
#endif // ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT
|
||||
ImGui::PushItemWidth(window_width - sliders_left_width - slider_width_times * slider_icon_width);
|
||||
bool slider_clp_dist = m_imgui->bbl_slider_float_style("##clp_dist", &clp_dist, 0.f, 1.f, "%.2f", 1.0f, true);
|
||||
|
||||
ImGui::SameLine(window_width - slider_icon_width);
|
||||
ImGui::PushItemWidth(1.5 * slider_icon_width);
|
||||
bool b_clp_dist_input = ImGui::BBLDragFloat("##clp_dist_input", &clp_dist, 0.05f, 0.0f, 0.0f, "%.2f");
|
||||
if (slider_clp_dist || b_clp_dist_input) { m_c->object_clipper()->set_position(clp_dist, true); }
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(6.0f, 10.0f));
|
||||
float get_cur_y = ImGui::GetContentRegionMax().y + ImGui::GetFrameHeight() + y;
|
||||
show_tooltip_information(caption_max, x, get_cur_y);
|
||||
|
||||
float f_scale =m_parent.get_gizmos_manager().get_layout_scale();
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(6.0f, 4.0f * f_scale));
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
if (m_imgui->button(m_desc.at("remove_all"))) {
|
||||
Plater::TakeSnapshot snapshot(wxGetApp().plater(), "Reset selection", UndoRedo::SnapshotType::GizmoAction);
|
||||
ModelObject *mo = m_c->selection_info()->model_object();
|
||||
|
@ -257,14 +313,13 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit)
|
|||
update_model_object();
|
||||
m_parent.set_as_dirty();
|
||||
}
|
||||
|
||||
m_imgui->end();
|
||||
ImGui::PopStyleVar(2);
|
||||
GizmoImguiEnd();
|
||||
|
||||
//BBS
|
||||
ImGuiWrapper::pop_toolbar_style();
|
||||
}
|
||||
|
||||
|
||||
//BBS: remove const
|
||||
void GLGizmoSeam::update_model_object()
|
||||
{
|
||||
|
|
|
@ -8,17 +8,21 @@ namespace Slic3r::GUI {
|
|||
class GLGizmoSeam : public GLGizmoPainterBase
|
||||
{
|
||||
public:
|
||||
GLGizmoSeam(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id)
|
||||
: GLGizmoPainterBase(parent, icon_filename, sprite_id) {}
|
||||
GLGizmoSeam(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id);
|
||||
|
||||
void render_painter_gizmo() const override;
|
||||
|
||||
protected:
|
||||
wchar_t m_current_tool = 0;
|
||||
void on_render_input_window(float x, float y, float bottom_limit) override;
|
||||
std::string on_get_name() const override;
|
||||
PainterGizmoType get_painter_type() const override;
|
||||
|
||||
void render_triangles(const Selection& selection) const override;
|
||||
void render_triangles(const Selection &selection) const override;
|
||||
|
||||
void show_tooltip_information(float caption_max, float x, float y);
|
||||
|
||||
void tool_changed(wchar_t old_tool, wchar_t new_tool);
|
||||
|
||||
wxString handle_snapshot_action_name(bool shift_down, Button button_down) const override;
|
||||
|
||||
|
|
Loading…
Reference in New Issue