Merge branch 'main' into dev/cut-keep-paint

This commit is contained in:
Noisyfox
2026-05-07 08:49:57 +08:00
committed by GitHub
64 changed files with 5425 additions and 566 deletions

View File

@@ -881,9 +881,13 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co
// Show noise type specific options with the same logic
NoiseType fuzzy_skin_noise_type = config->opt_enum<NoiseType>("fuzzy_skin_noise_type");
toggle_line("fuzzy_skin_scale", fuzzy_skin_noise_type != NoiseType::Classic && has_fuzzy_skin);
toggle_line("fuzzy_skin_octaves", fuzzy_skin_noise_type != NoiseType::Classic && fuzzy_skin_noise_type != NoiseType::Voronoi && has_fuzzy_skin);
toggle_line("fuzzy_skin_persistence", (fuzzy_skin_noise_type == NoiseType::Perlin || fuzzy_skin_noise_type == NoiseType::Billow) && has_fuzzy_skin);
const bool is_ripple = fuzzy_skin_noise_type == NoiseType::Ripple;
toggle_line("fuzzy_skin_scale", fuzzy_skin_noise_type != NoiseType::Classic && has_fuzzy_skin && !is_ripple);
toggle_line("fuzzy_skin_octaves", fuzzy_skin_noise_type != NoiseType::Classic && fuzzy_skin_noise_type != NoiseType::Voronoi && has_fuzzy_skin && !is_ripple);
toggle_line("fuzzy_skin_persistence", (fuzzy_skin_noise_type == NoiseType::Perlin || fuzzy_skin_noise_type == NoiseType::Billow) && has_fuzzy_skin && !is_ripple);
toggle_line("fuzzy_skin_ripples_per_layer", is_ripple && has_fuzzy_skin);
toggle_line("fuzzy_skin_ripple_offset", is_ripple && has_fuzzy_skin);
toggle_line("fuzzy_skin_layers_between_ripple_offset", is_ripple && has_fuzzy_skin);
bool have_arachne = config->opt_enum<PerimeterGeneratorType>("wall_generator") == PerimeterGeneratorType::Arachne;
for (auto el : {"wall_transition_length", "wall_transition_filter_deviation", "wall_transition_angle", "min_feature_size", "min_length_factor",

View File

@@ -516,13 +516,15 @@ void GCodeViewer::SequentialView::Marker::render_position_window(const libvgcode
}
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding , 3.f * m_scale);
ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(.5f, .5f));
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding , ImVec2(2.f, 2.f) * m_scale);
ImGui::PushStyleColor(ImGuiCol_Button , ImVec4(0, 0, 0, 0));
ImGui::PushStyleColor(ImGuiCol_ButtonHovered , ImVec4(84 / 255.f, 84 / 255.f, 90 / 255.f, 1.f));
ImGui::PushStyleColor(ImGuiCol_ButtonActive , ImVec4(84 / 255.f, 84 / 255.f, 90 / 255.f, 1.f));
const float main_wnd_height = ImGui::GetWindowHeight();
if (ImGui::Button(into_u8(properties_shown ? ImGui::UnfoldButtonIcon : ImGui::FoldButtonIcon).c_str(), ImVec2(24.f, 24.f) * m_scale)) {
// ORCA use glyph based button for fixing button sizes changing depends on used font size on platform
const wchar_t foldIcon = properties_shown ? ImGui::UnfoldButtonIcon : ImGui::FoldButtonIcon;
if (imgui.glyph_button(foldIcon, ImVec2(16.f, 16.f) * m_scale)) {
properties_shown = !properties_shown;
static float main_wnd_height_temp = ImGui::GetWindowHeight();
static float first_click = true;
@@ -537,7 +539,8 @@ void GCodeViewer::SequentialView::Marker::render_position_window(const libvgcode
ImGui::SameLine();
ImGui::SetCursorPosY(ImGui::GetCursorPosY() - ImGui::GetStyle().FramePadding.y); // aligns button with next group
if(!properties_shown)
ImGui::SetCursorPosY(ImGui::GetCursorPosY() - ImGui::GetStyle().FramePadding.y); // aligns button with next group
ImGui::BeginGroup(); // group contents to make information area more compact
@@ -3327,29 +3330,26 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
ImGui::Dummy({ window_padding, window_padding });
ImGui::Dummy({ window_padding, window_padding });
ImGui::SameLine(window_padding * 2); // ORCA Ignores item spacing to get perfect window margins since since this part uses dummies for window padding
std::wstring btn_name;
if (m_fold)
btn_name = ImGui::UnfoldButtonIcon;
else
btn_name = ImGui::FoldButtonIcon;
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(84 / 255.f, 84 / 255.f, 90 / 255.f, 1.f));
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(84 / 255.f, 84 / 255.f, 90 / 255.f, 1.f));
float calc_padding = (ImGui::GetFrameHeight() - 16 * m_scale) / 2; // ORCA calculated padding for 16x16 icon
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(calc_padding, calc_padding)); // ORCA Center icon with frame padding
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0f * m_scale); // ORCA Match button style with combo box
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding , ImVec2(2.f, 2.f) * m_scale);
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0f * m_scale); // ORCA Match button style with combo box
float button_width = 16 * m_scale + calc_padding * 2; // ORCA match buttons height with combo box
if (ImGui::Button(into_u8(btn_name).c_str(), ImVec2(button_width, button_width))) {
// ORCA use glyph based button for fixing button sizes changing depends on used font size on platform
const wchar_t foldIcon = m_fold ? ImGui::UnfoldButtonIcon : ImGui::FoldButtonIcon;
if (imgui.glyph_button(foldIcon, ImVec2(16.f, 16.f) * m_scale)) {
m_fold = !m_fold;
}
ImGui::SameLine();
const wchar_t gCodeToggle = ImGui::gCodeButtonIcon;
if (ImGui::Button(into_u8(gCodeToggle).c_str(), ImVec2(button_width, button_width))) {
if (imgui.glyph_button(gCodeToggle, ImVec2(16.f, 16.f) * m_scale)) {
wxGetApp().toggle_show_gcode_window();
wxGetApp().plater()->get_current_canvas3D()->post_event(SimpleEvent(wxEVT_PAINT));
}
ImGui::PopStyleColor(3);
ImGui::PopStyleVar(2);

View File

@@ -276,8 +276,8 @@ bool is_associate_files(std::wstring extend)
class SplashScreen : public wxSplashScreen
{
public:
SplashScreen(const wxBitmap& bitmap, long splashStyle, int milliseconds, wxPoint pos = wxDefaultPosition)
: wxSplashScreen(bitmap, splashStyle, milliseconds, static_cast<wxWindow*>(wxGetApp().mainframe), wxID_ANY, wxDefaultPosition, wxDefaultSize,
SplashScreen(wxPoint pos = wxDefaultPosition)
: wxSplashScreen(wxBitmap(FromDIP(wxSize(480,480),nullptr)), wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_TIMEOUT, 1500, nullptr, wxID_ANY, wxDefaultPosition, wxDefaultSize,
#ifdef __APPLE__
wxBORDER_NONE | wxFRAME_NO_TASKBAR | wxSTAY_ON_TOP
#else
@@ -285,51 +285,53 @@ public:
#endif // !__APPLE__
)
{
int init_dpi = get_dpi_for_window(this);
this->SetPosition(pos);
this->CenterOnScreen();
int new_dpi = get_dpi_for_window(this);
m_scale = (float)(new_dpi) / (float)(init_dpi);
scale_font(m_font_version, 1.65f); // only scale this one since it hasnt a preloaded font like Label::Body_24;
m_main_bitmap = bitmap;
m_bg_color = StateColor::darkModeColorFor(wxColour("#FFFFFF"));
m_fg_color = StateColor::darkModeColorFor(wxColour("#6B6A6A"));
bool dark_mode = m_fg_color != wxColour("#6B6A6A");
wxSize sz = m_window->GetClientSize();
BitmapCache bmp_cache;
m_logo_bmp = *bmp_cache.load_svg(dark_mode ? "splash_logo_dark" : "splash_logo", sz.GetWidth(), sz.GetHeight());
scale_bitmap(m_main_bitmap, m_scale);
m_window->Bind(wxEVT_PAINT, &SplashScreen::OnPaint, this);
m_window->Refresh();
m_window->Update();
}
// init constant texts and scale fonts
m_constant_text.init(Label::Body_16);
void OnPaint(wxPaintEvent& evt)
{
wxPaintDC dc(m_window);
wxSize c_sz = m_window->GetClientSize();
// ORCA scale all fonts with monitor scale
scale_font(m_constant_text.version_font, m_scale * 2);
scale_font(m_constant_text.based_on_font, m_scale * 1.5f);
scale_font(m_constant_text.credits_font, m_scale * 2);
dc.SetBackground(wxBrush(m_bg_color));
dc.Clear();
if (m_logo_bmp.IsOk())
dc.DrawBitmap(m_logo_bmp, 0, 0, true);
// this font will be used for the action string
m_action_font = m_constant_text.credits_font;
wxRect rc = wxRect(0, 0, c_sz.GetWidth(), 0);
dc.SetTextForeground(m_fg_color);
// draw logo and constant info text
Decorate(m_main_bitmap);
wxGetApp().UpdateFrameDarkUI(this);
dc.SetFont(m_font_version);
rc.y = c_sz.GetHeight() * 0.72;
rc.height = dc.GetTextExtent(m_text_version).GetHeight();
dc.DrawLabel(m_text_version, rc, wxALIGN_CENTER);
dc.SetFont(m_font_action);
rc.y = c_sz.GetHeight() * 0.88;
rc.height = dc.GetTextExtent(m_text_action).GetHeight();
dc.DrawLabel(m_text_action, rc, wxALIGN_CENTER);
}
void SetText(const wxString& text)
{
set_bitmap(m_main_bitmap);
if (!text.empty()) {
wxBitmap bitmap(m_main_bitmap);
wxMemoryDC memDC;
memDC.SelectObject(bitmap);
memDC.SetFont(m_action_font);
memDC.SetTextForeground(StateColor::darkModeColorFor(wxColour(144, 144, 144)));
int width = bitmap.GetWidth();
int text_height = memDC.GetTextExtent(text).GetHeight();
int text_width = memDC.GetTextExtent(text).GetWidth();
wxRect text_rect(wxPoint(0, m_action_line_y_position), wxPoint(width, m_action_line_y_position + text_height));
memDC.DrawLabel(text, text_rect, wxALIGN_CENTER);
memDC.SelectObject(wxNullBitmap);
set_bitmap(bitmap);
m_text_action = text;
m_window->Refresh();
m_window->Update();
#ifdef __WXOSX__
// without this code splash screen wouldn't be updated under OSX
wxYield();
@@ -337,77 +339,6 @@ public:
}
}
void Decorate(wxBitmap& bmp)
{
if (!bmp.IsOk())
return;
bool is_dark = wxGetApp().app_config->get("dark_color_mode") == "1";
// use a memory DC to draw directly onto the bitmap
wxMemoryDC memDc(bmp);
int width = bmp.GetWidth();
int height = bmp.GetHeight();
// Logo
BitmapCache bmp_cache;
wxBitmap logo_bmp = *bmp_cache.load_svg(is_dark ? "splash_logo_dark" : "splash_logo", width, height); // use with full width & height
memDc.DrawBitmap(logo_bmp, 0, 0, true);
// Version
memDc.SetFont(m_constant_text.version_font);
memDc.SetTextForeground(StateColor::darkModeColorFor(wxColor(134, 134, 134)));
wxSize version_ext = memDc.GetTextExtent(m_constant_text.version);
wxRect version_rect(
wxPoint(0, int(height * 0.70)),
wxPoint(width, int(height * 0.70) + version_ext.GetHeight())
);
memDc.DrawLabel(m_constant_text.version, version_rect, wxALIGN_CENTER);
// Dynamic Text
m_action_line_y_position = int(height * 0.83);
}
static wxBitmap MakeBitmap()
{
int width = FromDIP(480, nullptr);
int height = FromDIP(480, nullptr);
wxImage image(width, height);
wxBitmap new_bmp(image);
wxMemoryDC memDC;
memDC.SelectObject(new_bmp);
memDC.SetBrush(StateColor::darkModeColorFor(*wxWHITE));
memDC.DrawRectangle(-1, -1, width + 2, height + 2);
memDC.DrawBitmap(new_bmp, 0, 0, true);
return new_bmp;
}
void set_bitmap(wxBitmap& bmp)
{
m_window->SetBitmap(bmp);
m_window->Refresh();
m_window->Update();
}
void scale_bitmap(wxBitmap& bmp, float scale)
{
if (scale == 1.0)
return;
wxImage image = bmp.ConvertToImage();
if (!image.IsOk() || image.GetWidth() == 0 || image.GetHeight() == 0)
return;
int width = int(scale * image.GetWidth());
int height = int(scale * image.GetHeight());
image.Rescale(width, height, wxIMAGE_QUALITY_BILINEAR);
bmp = wxBitmap(std::move(image));
}
void scale_font(wxFont& font, float scale)
{
#ifdef __WXMSW__
@@ -425,47 +356,16 @@ public:
#endif //__WXMSW__
}
private:
wxStaticText* m_staticText_slicer_name;
wxStaticText* m_staticText_slicer_version;
wxStaticBitmap* m_bitmap;
wxStaticText* m_staticText_loading;
wxBitmap m_logo_bmp;
wxColour m_fg_color;
wxColour m_bg_color;
wxBitmap m_main_bitmap;
wxFont m_action_font;
int m_action_line_y_position;
float m_scale {1.0};
wxString m_text_version = GUI_App::format_display_version();
wxString m_text_action = _L("Loading configuration") + dots;
struct ConstantText
{
wxString title;
wxString version;
wxString credits;
wxFont title_font;
wxFont version_font;
wxFont credits_font;
wxFont based_on_font;
void init(wxFont init_font)
{
// title
//title = wxGetApp().is_editor() ? SLIC3R_APP_FULL_NAME : GCODEVIEWER_APP_NAME;
// dynamically get the version to display
version = GUI_App::format_display_version();
// credits infornation
credits = "";
//title_font = Label::Head_16;
version_font = Label::Body_13;
based_on_font = Label::Body_8;
credits_font = Label::Body_8;
}
}
m_constant_text;
wxFont m_font_version = Label::Body_16;
wxFont m_font_action = Label::Body_16;
};
#ifdef __linux__
@@ -2844,9 +2744,6 @@ bool GUI_App::on_init_inner()
SplashScreen * scrn = nullptr;
if (app_config->get("show_splash_screen") == "true") {
// make a bitmap with dark grey banner on the left side
//BBS make BBL splash screen bitmap
wxBitmap bmp = SplashScreen::MakeBitmap();
// Detect position (display) to show the splash screen
// Now this position is equal to the mainframe position
wxPoint splashscreen_pos = wxDefaultPosition;
@@ -2858,9 +2755,9 @@ bool GUI_App::on_init_inner()
BOOST_LOG_TRIVIAL(info) << "begin to show the splash screen...";
//BBS use BBL splashScreen
scrn = new SplashScreen(bmp, wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_TIMEOUT, 1500, splashscreen_pos);
scrn = new SplashScreen(splashscreen_pos);
wxYield();
scrn->SetText(_L("Loading configuration")+ dots);
//scrn->SetText(_L("Loading configuration")+ dots);
}
BOOST_LOG_TRIVIAL(info) << "loading systen presets...";

View File

@@ -191,6 +191,12 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l
if (! m_c->selection_info()->model_object())
return;
float scale = m_parent.get_scale();
#ifdef WIN32
int dpi = get_dpi_for_window(wxGetApp().GetTopWindow());
scale *= (float) dpi / (float) DPI_DEFAULT;
#endif // WIN32
// BBS
wchar_t old_tool = m_current_tool;
@@ -258,30 +264,24 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l
std::array<wxString, 4> tool_tips = { _L("Circle"), _L("Sphere"), _L("Fill"), _L("Gap Fill") };
for (int i = 0; i < tool_ids.size(); i++) {
std::string str_label = std::string("##");
std::wstring btn_name = icons[i] + boost::nowide::widen(str_label);
//std::string str_label = std::string("##");
//std::wstring btn_name = 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));
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0);
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.f, 0.f, 0.f, 0.f)); // ORCA Removes button background on dark mode
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.f, 1.f, 1.f, 1.f)); // ORCA: Fixes icon rendered without colors while using Light theme
if (m_current_tool == tool_ids[i]) {
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.f, 0.59f, 0.53f, 0.25f)); // ORCA use orca color for selected tool / brush
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.f, 0.59f, 0.53f, 0.25f)); // ORCA use orca color for selected tool / brush
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.f, 0.59f, 0.53f, 0.30f)); // ORCA use orca color for selected tool / brush
ImGui::PushStyleColor(ImGuiCol_Border, ImGuiWrapper::COL_ORCA); // ORCA use orca color for border on selected tool / brush
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0);
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 1.0);
}
bool btn_clicked = ImGui::Button(into_u8(btn_name).c_str());
if (m_current_tool == tool_ids[i])
{
ImGui::PopStyleColor(4);
ImGui::PopStyleVar(2);
}
ImGui::PopStyleColor(2);
ImGui::PopStyleVar(1);
bool is_active = m_current_tool == tool_ids[i];
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.f);
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding , 3.f * scale);
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding , ImVec2(4.f * scale, 4.f * scale));
ImGui::PushStyleColor(ImGuiCol_Text , ImVec4(1,1,1,1)); // ORCA Fixes icon rendered without colors while using Light theme
ImGui::PushStyleColor(ImGuiCol_Button , is_active ? ImVec4(0.f, .59f, .53f, .25f) : ImVec4(0,0,0,0)); // ORCA
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, is_active ? ImVec4(0.f, .59f, .53f, .25f) : ImVec4(.6f,.6f,.6f,.2f)); // ORCA
ImGui::PushStyleColor(ImGuiCol_ButtonActive , is_active ? ImVec4(0.f, .59f, .53f, .30f) : ImVec4(0,0,0,0)); // ORCA
ImGui::PushStyleColor(ImGuiCol_Border , is_active ? ImGuiWrapper::COL_ORCA : ImVec4(0,0,0,0)); // ORCA
ImGui::PushStyleColor(ImGuiCol_BorderActive , is_active ? ImGuiWrapper::COL_ORCA : ImVec4(0,0,0,0)); // ORCA matched color for fixing flicker on click
bool btn_clicked = m_imgui->glyph_button(icons[i], ImVec2(16.f * scale, 16.f * scale)); // ORCA glyph_button for fixing unequal paddings
ImGui::PopStyleColor(6);
ImGui::PopStyleVar(3);
if (btn_clicked && m_current_tool != tool_ids[i]) {
m_current_tool = tool_ids[i];

View File

@@ -117,6 +117,12 @@ void GLGizmoFuzzySkin::on_render_input_window(float x, float y, float bottom_lim
if (!mo)
return;
float scale = m_parent.get_scale();
#ifdef WIN32
int dpi = get_dpi_for_window(wxGetApp().GetTopWindow());
scale *= (float) dpi / (float) DPI_DEFAULT;
#endif // WIN32
const DynamicPrintConfig &obj_cfg = mo->config.get();
const float approx_height = m_imgui->scaled(22.f);
@@ -192,29 +198,24 @@ void GLGizmoFuzzySkin::on_render_input_window(float x, float y, float bottom_lim
icons = { ImGui::CircleButtonIcon, ImGui::SphereButtonIcon, ImGui::TriangleButtonIcon, ImGui::FillButtonIcon };
std::array<wxString, 4> tool_tips = { _L("Circle"), _L("Sphere"), _L("Triangle"), _L("Fill") };
for (int i = 0; i < tool_ids.size(); i++) {
std::string str_label = std::string("");
std::wstring btn_name = icons[i] + boost::nowide::widen(str_label);
//std::string str_label = std::string("");
//std::wstring btn_name = 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.5f));
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0);
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.f, 0.f, 0.f, 0.f)); // ORCA Removes button background on dark mode
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.f, 1.f, 1.f, 1.f)); // ORCA Fixes icon rendered without colors while using Light theme
if (m_current_tool == tool_ids[i]) {
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.f, 0.59f, 0.53f, 0.25f)); // ORCA use orca color for selected tool / brush
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.f, 0.59f, 0.53f, 0.25f)); // ORCA use orca color for selected tool / brush
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.f, 0.59f, 0.53f, 0.30f)); // ORCA use orca color for selected tool / brush
ImGui::PushStyleColor(ImGuiCol_Border, ImGuiWrapper::COL_ORCA); // ORCA use orca color for border on selected tool / brush
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0);
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 1.0);
}
bool btn_clicked = ImGui::Button(into_u8(btn_name).c_str());
if (m_current_tool == tool_ids[i])
{
ImGui::PopStyleColor(4);
ImGui::PopStyleVar(2);
}
ImGui::PopStyleColor(2);
ImGui::PopStyleVar(1);
bool is_active = m_current_tool == tool_ids[i];
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.f);
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding , 3.f * scale);
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding , ImVec2(4.f * scale, 4.f * scale));
ImGui::PushStyleColor(ImGuiCol_Text , ImVec4(1,1,1,1)); // ORCA Fixes icon rendered without colors while using Light theme
ImGui::PushStyleColor(ImGuiCol_Button , is_active ? ImVec4(0.f, .59f, .53f, .25f) : ImVec4(0,0,0,0)); // ORCA
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, is_active ? ImVec4(0.f, .59f, .53f, .25f) : ImVec4(.6f,.6f,.6f,.2f)); // ORCA
ImGui::PushStyleColor(ImGuiCol_ButtonActive , is_active ? ImVec4(0.f, .59f, .53f, .30f) : ImVec4(0,0,0,0)); // ORCA
ImGui::PushStyleColor(ImGuiCol_Border , is_active ? ImGuiWrapper::COL_ORCA : ImVec4(0,0,0,0)); // ORCA
ImGui::PushStyleColor(ImGuiCol_BorderActive , is_active ? ImGuiWrapper::COL_ORCA : ImVec4(0,0,0,0)); // ORCA matched color for fixing flicker on click
bool btn_clicked = m_imgui->glyph_button(icons[i], ImVec2(16.f * scale, 16.f * scale)); // ORCA glyph_button for fixing unequal paddings
ImGui::PopStyleColor(6);
ImGui::PopStyleVar(3);
if (btn_clicked && m_current_tool != tool_ids[i]) {
m_current_tool = tool_ids[i];

View File

@@ -115,9 +115,9 @@ bool GLGizmoMmuSegmentation::on_init()
m_desc["smart_fill_angle"] = _L("Smart fill angle");
m_desc["height_range"] = _L("Height range");
m_desc["toggle_wireframe"] = _L("Toggle Wireframe");
m_desc["perform_remap"] = _L("Remap filaments");
m_desc["perform_remap"] = _u8L("Remap filaments");
m_desc["remap"] = _L("Remap");
m_desc["cancel_remap"] = _L("Cancel");
m_desc["remap_reset"] = _L("Reset");
std::pair<wxString, wxString> paint_shortcut = {_L("Left mouse button"), m_desc["paint"]};
std::pair<wxString, wxString> erase_shortcut = {shift + _L("Left mouse button"), m_desc["erase"]};
@@ -304,10 +304,56 @@ void GLGizmoMmuSegmentation::render_tooltip_button(float x, float y)
GLGizmoUtils::render_tooltip_button(m_imgui, m_parent, get_shortcuts(), x, y);
}
// ORCA
bool GLGizmoMmuSegmentation::draw_color_button(int idx, std::string id_str, const ColorRGBA& color, ColorRGBA& map_color, bool active, float scale)
{
ImDrawList* draw_list = ImGui::GetWindowDrawList();
std::string label_id = std::to_string(idx) + id_str + std::to_string(idx);
ImVec2 pos = ImGui::GetCursorScreenPos();
ImVec2 size = ImVec2(27.f * scale, 27.f * scale);
ImVec4 color_vec = ImGuiWrapper::to_ImVec4(color);
ImU32 br_color = ImGui::ColorConvertFloat4ToU32(active ? ImGuiWrapper::COL_ORCA : m_is_dark_mode ? ImVec4(.35f, .35f, .35f, 1) : ImVec4(.85f, .85f, .85f, 1));
bool dark_tone = (0.299f * color.r() + 0.587f * color.g() + 0.114f * color.b()) < 0.51f; // matching values used by wxWidgets with clr.GetLuminance() < 0.51
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0);
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding , 7.f * scale);
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding , ImVec2(0, 0));
ImGui::PushStyleColor(ImGuiCol_Text , dark_tone ? ImVec4(1,1,1,1) : ImVec4(0,0,0,1));
ImGui::PushStyleColor(ImGuiCol_Button , color_vec);
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, color_vec);
ImGui::PushStyleColor(ImGuiCol_ButtonActive , color_vec);
bool clicked = ImGui::Button(label_id.c_str(), size);
ImGui::PopStyleVar(3);
ImGui::PopStyleColor(4);
auto drawBorder = [&](float d, float r, float t, ImU32 col) {
draw_list->AddRect({pos.x + d * scale, pos.y + d * scale}, {pos.x + size.x - d * scale , pos.y + size.y - d * scale}, col, r * scale, 0, t * scale);
};
drawBorder(1.5f, 3.f, 4.f, ImGui::ColorConvertFloat4ToU32(ImGui::GetStyleColorVec4(ImGuiCol_WindowBg)));
if(active)
drawBorder(.5f, 4.f , 2.f, br_color);
else
drawBorder(3.f, 2.5f, 1.f, br_color);
if (color != map_color){ // show mapped color as bubble if mapped
ImVec2 center = {pos.x + size.x - 3.f * scale, pos.y + 3.f * scale};
draw_list->AddCircleFilled(center, 6.f * scale, br_color, 16); // outer border for better visibility
draw_list->AddCircleFilled(center, 5.f * scale, ImGuiWrapper::to_ImU32(map_color), 16);
}
return clicked;
};
void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bottom_limit)
{
if (!m_c->selection_info()->model_object()) return;
float scale = m_parent.get_scale();
#ifdef WIN32
int dpi = get_dpi_for_window(wxGetApp().GetTopWindow());
scale *= (float) dpi / (float) DPI_DEFAULT;
#endif // WIN32
const float approx_height = m_imgui->scaled(22.0f);
y = std::min(y, bottom_limit - approx_height);
GizmoImguiSetNextWIndowPos(x, y, ImGuiCond_Always);
@@ -363,69 +409,67 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
const float drag_left_width = ImGui::GetStyle().WindowPadding.x + sliders_width - space_size;
const float max_tooltip_width = ImGui::GetFontSize() * 20.0f;
ImDrawList * draw_list = ImGui::GetWindowDrawList();
ImVec2 pos = ImGui::GetCursorScreenPos();
static float color_button_high = 25.0;
draw_list->AddRectFilled({pos.x - 10.0f, pos.y - 7.0f}, {pos.x + window_width + ImGui::GetFrameHeight(), pos.y + color_button_high}, ImGui::GetColorU32(ImGuiCol_FrameBgActive, 1.0f), 5.0f);
float color_button = ImGui::GetCursorPos().y;
m_imgui->text(m_desc.at("filaments"));
float start_pos_x = ImGui::GetCursorPos().x;
const ImVec2 max_label_size = ImGui::CalcTextSize("99", NULL, true);
const float item_spacing = m_imgui->scaled(0.8f);
size_t n_extruder_colors = std::min((size_t)EnforcerBlockerType::ExtruderMax, m_extruders_colors.size());
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(7.f * scale, 7.f * scale));
ImGui::PushStyleVar(ImGuiStyleVar_IndentSpacing, 0); // removes extra space on tree node indentation
for (int extruder_idx = 0; extruder_idx < n_extruder_colors; extruder_idx++) {
const ColorRGBA &extruder_color = m_extruders_colors[extruder_idx];
ImVec4 color_vec = ImGuiWrapper::to_ImVec4(extruder_color);
std::string color_label = std::string("##extruder color ") + std::to_string(extruder_idx);
std::string item_text = std::to_string(extruder_idx + 1);
const ImVec2 label_size = ImGui::CalcTextSize(item_text.c_str(), NULL, true);
const ImVec2 button_size(max_label_size.x + m_imgui->scaled(0.5f),0.f);
if (extruder_idx % max_filament_items_per_line != 0)
ImGui::SameLine();
float button_offset = start_pos_x;
if (extruder_idx % max_filament_items_per_line != 0) {
button_offset += filament_item_width * (extruder_idx % max_filament_items_per_line);
ImGui::SameLine(button_offset);
if (draw_color_button(
extruder_idx + 1, // idx
"###extruder_color_", // button_id
m_extruders_colors[extruder_idx], // color
m_extruders_colors[extruder_idx], // mapped_color (not used in here)
m_selected_extruder_idx == extruder_idx, // is_active
scale
)){
m_selected_extruder_idx = extruder_idx;
}
// draw filament background
ImGuiColorEditFlags flags = ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel | ImGuiColorEditFlags_NoPicker | ImGuiColorEditFlags_NoTooltip;
if (m_selected_extruder_idx != extruder_idx) flags |= ImGuiColorEditFlags_NoBorder;
#ifdef __APPLE__
ImGui::PushStyleColor(ImGuiCol_FrameBg, ImGuiWrapper::COL_ORCA); // ORCA use orca color for selected filament border
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0f);
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0);
bool color_picked = ImGui::ColorButton(color_label.c_str(), color_vec, flags, button_size);
ImGui::PopStyleVar(2);
ImGui::PopStyleColor(1);
#else
ImGui::PushStyleColor(ImGuiCol_FrameBg, ImGuiWrapper::COL_ORCA); // ORCA use orca color for selected filament border
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0);
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 2.0);
bool color_picked = ImGui::ColorButton(color_label.c_str(), color_vec, flags, button_size);
ImGui::PopStyleVar(2);
ImGui::PopStyleColor(1);
#endif
color_button_high = ImGui::GetCursorPos().y - color_button - 2.0;
if (color_picked) { m_selected_extruder_idx = extruder_idx; }
if (extruder_idx < 16 && ImGui::IsItemHovered()) m_imgui->tooltip(_L("Shortcut Key ") + std::to_string(extruder_idx + 1), max_tooltip_width);
// draw filament id
float gray = 0.299 * extruder_color.r() + 0.587 * extruder_color.g() + 0.114 * extruder_color.b();
ImGui::SameLine(button_offset + (button_size.x - label_size.x) / 2.f);
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, {10.0,15.0});
if (gray * 255.f < 80.f)
ImGui::TextColored(ImVec4(1.0f, 1.0f, 1.0f, 1.0f), "%s", item_text.c_str());
else
ImGui::TextColored(ImVec4(0.0f, 0.0f, 0.0f, 1.0f), "%s", item_text.c_str());
ImGui::PopStyleVar();
}
//ImGui::NewLine();
// ORCA: Remap filaments section (Border only, Title in border).
// Styled as a panel for visual grouping.
if (ImGui::TreeNodeEx(m_desc.at("perform_remap").c_str(), ImGuiTreeNodeFlags_SpanAvailWidth | ImGuiTreeNodeFlags_FramePadding)){
render_filament_remap_ui(window_width, max_tooltip_width, scale);
bool has_mapping = false;
for (size_t i = 0; i < m_extruder_remap.size(); ++i){
if(m_extruder_remap[i] != i){
has_mapping = true;
break;
}
}
ImGui::Dummy(ImVec2(0,0));
// ORCA: Add Remap and Cancel buttons (outside the panel)
m_imgui->disabled_begin(!has_mapping); // disable when no mapping
if (m_imgui->button(m_desc.at("remap"))) {
this->remap_filament_assignments();
// Reset mapping to identity after apply
for (size_t i = 0; i < m_extruder_remap.size(); ++i) m_extruder_remap[i] = i;
}
m_imgui->disabled_end(/*m_is_unknown_font*/);
if (has_mapping){ // show only when it has mapping
ImGui::SameLine();
if (m_imgui->button(m_desc.at("remap_reset"))) {
// Reset mapping to identity
for (size_t i = 0; i < m_extruder_remap.size(); ++i) m_extruder_remap[i] = i;
}
}
//ImGui::Dummy(ImVec2(0.0f, 3.f * scale));
ImGui::TreePop();
}
ImGui::PopStyleVar(2); // IndentSpacing ItemSpacing
ImGui::Dummy(ImVec2(0.0f, ImGui::GetFontSize() * 0.1));
m_imgui->text(m_desc.at("tool_type"));
@@ -439,29 +483,24 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
icons = { ImGui::CircleButtonIcon, ImGui::SphereButtonIcon, ImGui::TriangleButtonIcon, ImGui::HeightRangeIcon, ImGui::FillButtonIcon, ImGui::GapFillIcon };
std::array<wxString, 6> tool_tips = { _L("Circle"), _L("Sphere"), _L("Triangle"), _L("Height Range"), _L("Fill"), _L("Gap Fill") };
for (int i = 0; i < tool_ids.size(); i++) {
std::string str_label = std::string("");
std::wstring btn_name = icons[i] + boost::nowide::widen(str_label);
//std::string str_label = std::string("");
//std::wstring btn_name = 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.5f));
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0);
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.f, 0.f, 0.f, 0.f)); // ORCA Removes button background on dark mode
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.f, 1.f, 1.f, 1.f)); // ORCA Fixes icon rendered without colors while using Light theme
if (m_current_tool == tool_ids[i]) {
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.f, 0.59f, 0.53f, 0.25f)); // ORCA use orca color for selected tool / brush
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.f, 0.59f, 0.53f, 0.25f)); // ORCA use orca color for selected tool / brush
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.f, 0.59f, 0.53f, 0.30f)); // ORCA use orca color for selected tool / brush
ImGui::PushStyleColor(ImGuiCol_Border, ImGuiWrapper::COL_ORCA); // ORCA use orca color for border on selected tool / brush
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0);
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 1.0);
}
bool btn_clicked = ImGui::Button(into_u8(btn_name).c_str());
if (m_current_tool == tool_ids[i])
{
ImGui::PopStyleColor(4);
ImGui::PopStyleVar(2);
}
ImGui::PopStyleColor(2);
ImGui::PopStyleVar(1);
bool is_active = m_current_tool == tool_ids[i];
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.f);
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding , 3.f * scale);
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding , ImVec2(4.f * scale, 4.f * scale));
ImGui::PushStyleColor(ImGuiCol_Text , ImVec4(1,1,1,1)); // ORCA Fixes icon rendered without colors while using Light theme
ImGui::PushStyleColor(ImGuiCol_Button , is_active ? ImVec4(0.f, .59f, .53f, .25f) : ImVec4(0,0,0,0)); // ORCA
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, is_active ? ImVec4(0.f, .59f, .53f, .25f) : ImVec4(.6f,.6f,.6f,.2f)); // ORCA
ImGui::PushStyleColor(ImGuiCol_ButtonActive , is_active ? ImVec4(0.f, .59f, .53f, .30f) : ImVec4(0,0,0,0)); // ORCA
ImGui::PushStyleColor(ImGuiCol_Border , is_active ? ImGuiWrapper::COL_ORCA : ImVec4(0,0,0,0)); // ORCA
ImGui::PushStyleColor(ImGuiCol_BorderActive , is_active ? ImGuiWrapper::COL_ORCA : ImVec4(0,0,0,0)); // ORCA matched color for fixing flicker on click
bool btn_clicked = m_imgui->glyph_button(icons[i], ImVec2(16.f * scale, 16.f * scale)); // ORCA glyph_button for fixing unequal paddings
ImGui::PopStyleColor(6);
ImGui::PopStyleVar(3);
if (btn_clicked && m_current_tool != tool_ids[i]) {
m_current_tool = tool_ids[i];
@@ -598,60 +637,6 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
m_c->object_clipper()->set_position_by_ratio(clp_dist, true);
}
ImGui::Separator();
// ORCA: Remap filaments section (Border only, Title in border).
// Styled as a panel for visual grouping.
if (m_imgui->button(m_desc.at("perform_remap"))) {
m_show_remap_panel = !m_show_remap_panel;
}
if (m_show_remap_panel)
{
ImGui::Spacing();
ImDrawList* draw_list = ImGui::GetWindowDrawList();
std::string title = into_u8(m_desc.at("perform_remap"));
float available_width = ImGui::GetContentRegionAvail().x;
// ORCA: Draw Background filled (consistent with Filaments section)
// Use static to remember height from previous frame so we can draw it behind.
static float remap_panel_high = 40.0f;
ImVec2 p_bg_min = ImGui::GetCursorScreenPos();
// Adjust background position: slight negative offset to align with padding, width fills available
// height from static variable.
draw_list->AddRectFilled({p_bg_min.x - 10.0f, p_bg_min.y - 7.0f}, {p_bg_min.x + available_width + ImGui::GetFrameHeight(), p_bg_min.y + remap_panel_high}, ImGui::GetColorU32(ImGuiCol_FrameBgActive, 1.0f), 5.0f);
float start_y = ImGui::GetCursorPos().y;
// ORCA: Title as simple text - Removed as per request (redundant with button)
// m_imgui->text(title);
ImGui::BeginGroup();
// ORCA: Reduce vertical spacing within this group
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(m_imgui->scaled(0.4f), m_imgui->scaled(0.2f)));
render_filament_remap_ui(window_width, max_tooltip_width);
ImGui::PopStyleVar();
ImGui::EndGroup();
// ORCA: Update height for next frame fill
remap_panel_high = ImGui::GetCursorPos().y - start_y;
// ORCA: Add Remap and Cancel buttons (outside the panel)
ImGui::Spacing();
if (m_imgui->button(m_desc.at("remap"))) {
this->remap_filament_assignments();
// Reset mapping to identity after apply
for (size_t i = 0; i < m_extruder_remap.size(); ++i) m_extruder_remap[i] = i;
}
ImGui::SameLine();
if (m_imgui->button(m_desc.at("cancel_remap"))) {
// Reset mapping to identity
for (size_t i = 0; i < m_extruder_remap.size(); ++i) m_extruder_remap[i] = i;
}
}
ImGui::Separator();
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(6.0f, 10.0f));
@@ -1000,180 +985,85 @@ void GLGizmoMmuSegmentation::update_used_filaments()
}
}
void GLGizmoMmuSegmentation::render_filament_remap_ui(float window_width, float max_tooltip_width)
void GLGizmoMmuSegmentation::render_filament_remap_ui(float window_width, float max_tooltip_width, float scale)
{
size_t n_extr = std::min((size_t)EnforcerBlockerType::ExtruderMax, m_extruders_colors.size());
const ImVec2 max_label_size = ImGui::CalcTextSize("99", NULL, true);
const ImVec2 button_size(max_label_size.x + m_imgui->scaled(0.5f), 0.f);
int displayed_count = 0;
const int max_per_line = 8;
// ORCA: Use m_used_filaments to show only relevant source filaments
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(7.f * scale, 7.f * scale));
for (size_t src : m_used_filaments) {
if (src >= n_extr) continue;
const ColorRGBA &src_col = m_extruders_colors[src]; // keep for text contrast
const ColorRGBA &dst_col = m_extruders_colors[m_extruder_remap[src]];
// ORCA: Button now shows the SOURCE color (per maintainer request)
// This keeps the UI stable until "Remap" is clicked.
ImVec4 col_vec = ImGuiWrapper::to_ImVec4(src_col);
if (displayed_count > 0 && (displayed_count % max_per_line != 0))
ImGui::SameLine();
std::string btn_id = "##remap_src_" + std::to_string(src);
std::string pop_id = "popup_" + std::to_string(src);
ImGuiColorEditFlags flags = ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_NoInputs |
ImGuiColorEditFlags_NoLabel | ImGuiColorEditFlags_NoPicker |
ImGuiColorEditFlags_NoTooltip;
// ORCA: Show border ONLY if the popup is open (visual feedback for active selection)
// Decoupled from m_selected_extruder_idx to prevent unwanted selection highlights.
if (!ImGui::IsPopupOpen(pop_id.c_str()))
flags |= ImGuiColorEditFlags_NoBorder;
#ifdef __APPLE__
ImGui::PushStyleColor(ImGuiCol_FrameBg, ImGuiWrapper::COL_ORCA);
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0f);
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0);
bool clicked = ImGui::ColorButton(btn_id.c_str(), col_vec, flags, button_size);
ImGui::PopStyleVar(2);
ImGui::PopStyleColor(1);
#else
ImGui::PushStyleColor(ImGuiCol_FrameBg, ImGuiWrapper::COL_ORCA);
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0);
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 2.0);
bool clicked = ImGui::ColorButton(btn_id.c_str(), col_vec, flags, button_size);
ImGui::PopStyleVar(2);
ImGui::PopStyleColor(1);
#endif
// overlay destination number with proper contrast calculation
// ORCA: Text still shows DESTINATION index, but contrast is against SOURCE color now.
std::string dst_txt = std::to_string(m_extruder_remap[src] + 1);
float gray = 0.299f * src_col.r() + 0.587f * src_col.g() + 0.114f * src_col.b();
ImVec2 txt_sz = ImGui::CalcTextSize(dst_txt.c_str());
ImVec2 pos = ImGui::GetItemRectMin();
ImVec2 size = ImGui::GetItemRectSize();
if (gray * 255.f < 80.f)
ImGui::GetWindowDrawList()->AddText(
ImVec2(pos.x + (size.x - txt_sz.x) * 0.5f, pos.y + (size.y - txt_sz.y) * 0.5f),
IM_COL32(255,255,255,255), dst_txt.c_str());
else
ImGui::GetWindowDrawList()->AddText(
ImVec2(pos.x + (size.x - txt_sz.x) * 0.5f, pos.y + (size.y - txt_sz.y) * 0.5f),
IM_COL32(0,0,0,255), dst_txt.c_str());
bool src_clicked = draw_color_button(
(int)src + 1, // idx
"###remap_src_", // button_id
m_extruders_colors[src], // color
m_extruders_colors[m_extruder_remap[src]], // mapped_color (shows bubble if not matches with Color)
ImGui::IsPopupOpen(pop_id.c_str()), // is_active
scale
);
// ORCA: Show NEW color as a small triangle in the corner if remapped
if (src != m_extruder_remap[src]) {
float s = m_imgui->scaled(0.55f);
float offset = m_imgui->scaled(0.15f); // Inset to avoid rounded corner clipping
ImVec2 p = ImVec2(pos.x + offset, pos.y + offset);
// Contrast outline: White for dark backgrounds, Black for light backgrounds
// Use dst_col (new color) for outline contrast check? Or src_col?
// Usually outline is around the triangle (dst_col).
float dst_gray = 0.299f * dst_col.r() + 0.587f * dst_col.g() + 0.114f * dst_col.b();
ImU32 outline_col = (dst_gray * 255.f < 80.f) ? IM_COL32(255, 255, 255, 180) : IM_COL32(0, 0, 0, 180);
ImDrawList* draw_list = ImGui::GetWindowDrawList();
draw_list->AddTriangleFilled(
p,
ImVec2(p.x + s, p.y),
ImVec2(p.x, p.y + s),
ImGuiWrapper::to_ImU32(dst_col));
// ORCA: Add a thin outline for better contrast when colors are similar
draw_list->AddTriangle(
p,
ImVec2(p.x + s, p.y),
ImVec2(p.x, p.y + s),
outline_col,
0.5f);
}
// popup with possible destinations
if (clicked) {
if (src_clicked) {
// Calculate popup position centered below the current button
ImVec2 button_pos = ImGui::GetItemRectMin();
ImVec2 button_size = ImGui::GetItemRectSize();
ImVec2 popup_pos(button_pos.x + button_size.x * 0.5f, button_pos.y + button_size.y);
// Set popup styling BEFORE opening popup
// Ensure popup is within the main viewport bounds
int dst_count = (int)std::min(n_extr, (size_t)max_per_line);
float est_popup_w = button_size.x * dst_count
+ ImGui::GetStyle().ItemSpacing.x * (dst_count - 1)
+ ImGui::GetStyle().WindowPadding.x * 2.f;
ImGuiViewport* vp = ImGui::GetMainViewport();
float right_limit = vp->WorkPos.x + vp->WorkSize.x - est_popup_w * 0.5f; // pivot is 0.5 so subtract half
float centered_x = button_pos.x + button_size.x * 0.5f; // pivot 0.5 just needs center x
ImVec2 popup_pos(std::min(centered_x, right_limit), button_pos.y + button_size.y);
ImGui::SetNextWindowPos(popup_pos, ImGuiCond_Appearing, ImVec2(0.5f, -0.1f));
ImGui::SetNextWindowBgAlpha(1.0f); // Ensure full opacity
ImGui::OpenPopup(pop_id.c_str());
}
if (ImGui::IsItemHovered() && src != m_extruder_remap[src]) // show tooltip if it has mapping info
m_imgui->tooltip(std::to_string(src + 1) + " >> " + std::to_string(m_extruder_remap[src] + 1), max_tooltip_width);
// Apply popup styling before BeginPopup using standard Orca colors
ImGui::PushStyleVar(ImGuiStyleVar_PopupRounding, 4.0f);
ImGui::PushStyleVar(ImGuiStyleVar_PopupBorderSize, 1.0f);
// ORCA: Use FrameBgActive for consistency and to ensure visibility of white filaments
ImGui::PushStyleColor(ImGuiCol_PopupBg, ImGui::GetStyleColorVec4(ImGuiCol_FrameBgActive));
ImGui::PushStyleColor(ImGuiCol_Border, m_is_dark_mode ? ImVec4(0.5f, 0.5f, 0.5f, 1.0f) : ImVec4(0.6f, 0.6f, 0.6f, 1.0f));
ImGui::PushStyleVar(ImGuiStyleVar_PopupRounding , 8.0f * scale);
ImGui::PushStyleVar(ImGuiStyleVar_PopupBorderSize, 2.0f * scale); // thicker & colored border to prevent mixing with main window. Current ImGui version not supports shadows
ImGui::PushStyleColor(ImGuiCol_PopupBg, ImGui::GetStyleColorVec4(ImGuiCol_WindowBg));
ImGui::PushStyleColor(ImGuiCol_Border , ImGui::ColorConvertFloat4ToU32(ImGuiWrapper::COL_ORCA));
if (ImGui::BeginPopup(pop_id.c_str())) {
m_imgui->text(_L("To:"));
for (int dst = 0; dst < (int)n_extr; ++dst) {
const ColorRGBA &dst_col_popup = m_extruders_colors[dst];
ImVec4 dst_vec = ImGuiWrapper::to_ImVec4(dst_col_popup);
if (dst > 0 && (dst % max_per_line != 0))
ImGui::SameLine();
std::string dst_btn = "##dst_" + std::to_string(src) + "_" + std::to_string(dst);
// Apply same styling to destination buttons
ImGuiColorEditFlags dst_flags = ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_NoInputs |
ImGuiColorEditFlags_NoLabel | ImGuiColorEditFlags_NoPicker |
ImGuiColorEditFlags_NoTooltip;
// Show border for currently selected destination filament
if (m_extruder_remap[src] != dst) dst_flags |= ImGuiColorEditFlags_NoBorder;
#ifdef __APPLE__
ImGui::PushStyleColor(ImGuiCol_FrameBg, ImGuiWrapper::COL_ORCA);
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0f);
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0);
bool dst_clicked = ImGui::ColorButton(dst_btn.c_str(), dst_vec, dst_flags, button_size);
ImGui::PopStyleVar(2);
ImGui::PopStyleColor(1);
#else
ImGui::PushStyleColor(ImGuiCol_FrameBg, ImGuiWrapper::COL_ORCA);
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0);
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 2.0);
bool dst_clicked = ImGui::ColorButton(dst_btn.c_str(), dst_vec, dst_flags, button_size);
ImGui::PopStyleVar(2);
ImGui::PopStyleColor(1);
#endif
// overlay destination number on popup buttons
std::string dst_num_txt = std::to_string(dst + 1);
float dst_gray = 0.299f * dst_col_popup.r() + 0.587f * dst_col_popup.g() + 0.114f * dst_col_popup.b();
ImVec2 dst_txt_sz = ImGui::CalcTextSize(dst_num_txt.c_str());
ImVec2 dst_pos = ImGui::GetItemRectMin();
ImVec2 dst_size = ImGui::GetItemRectSize();
if (dst_gray * 255.f < 80.f)
ImGui::GetWindowDrawList()->AddText(
ImVec2(dst_pos.x + (dst_size.x - dst_txt_sz.x) * 0.5f, dst_pos.y + (dst_size.y - dst_txt_sz.y) * 0.5f),
IM_COL32(255,255,255,255), dst_num_txt.c_str());
else
ImGui::GetWindowDrawList()->AddText(
ImVec2(dst_pos.x + (dst_size.x - dst_txt_sz.x) * 0.5f, dst_pos.y + (dst_size.y - dst_txt_sz.y) * 0.5f),
IM_COL32(0,0,0,255), dst_num_txt.c_str());
if (dst_clicked)
{
bool dst_clicked = draw_color_button(
dst + 1, // idx
"###remap_dst_", // button_id
m_extruders_colors[dst], // color
m_extruders_colors[dst], // mapped_color (non fuctional in here)
m_extruder_remap[src] == dst, // is_active
scale
);
if (dst_clicked) {
m_extruder_remap[src] = dst;
// update the source button color immediately
ImGui::CloseCurrentPopup();
}
}
ImGui::Dummy(ImVec2(0.0f, 2.f * scale));
ImGui::EndPopup();
}
@@ -1183,6 +1073,7 @@ void GLGizmoMmuSegmentation::render_filament_remap_ui(float window_width, float
displayed_count++;
}
ImGui::PopStyleVar(1); // ItemSpacing
}
void GLGizmoMmuSegmentation::remap_filament_assignments()

View File

@@ -114,7 +114,6 @@ protected:
bool m_detect_geometry_edge = true;
// Filament remap feature
bool m_show_remap_panel = false;
std::vector<size_t> m_extruder_remap; // index → target extruder index
// ORCA: Cache used filaments to filter UI
std::set<size_t> m_used_filaments; // Set of used filament indices (cached)
@@ -136,13 +135,16 @@ private:
void init_model_triangle_selectors();
// ORCA
bool draw_color_button(int idx, std::string id_str, const ColorRGBA& color, ColorRGBA& map_color, bool active, float scale);
// BBS
void update_triangle_selectors_colors();
void init_extruders_data();
// Filament remapping methods
void remap_filament_assignments();
void render_filament_remap_ui(float window_width, float max_tooltip_width);
void render_filament_remap_ui(float window_width, float max_tooltip_width, float scale);
// ORCA: Helper to update the cache of used filaments
void update_used_filaments();

View File

@@ -121,6 +121,12 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit)
if (! m_c->selection_info()->model_object())
return;
float scale = m_parent.get_scale();
#ifdef WIN32
int dpi = get_dpi_for_window(wxGetApp().GetTopWindow());
scale *= (float) dpi / (float) DPI_DEFAULT;
#endif // WIN32
const float approx_height = m_imgui->scaled(12.5f);
y = std::min(y, bottom_limit - approx_height);
//BBS: GUI refactor: move gizmo to the right
@@ -170,29 +176,25 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit)
icons = { ImGui::CircleButtonIcon, ImGui::SphereButtonIcon };
std::array<wxString, 2> tool_tips = { _L("Circle"), _L("Sphere")};
for (int i = 0; i < tool_ids.size(); i++) {
std::string str_label = std::string("##");
std::wstring btn_name = icons[i] + boost::nowide::widen(str_label);
//std::string str_label = std::string("##");
//std::wstring btn_name = 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));
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0);
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.f, 0.f, 0.f, 0.f)); // ORCA Removes button background on dark mode
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.f, 1.f, 1.f, 1.f)); // ORCA: Fixes icon rendered without colors while using Light theme
if (m_current_tool == tool_ids[i]) {
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.f, 0.59f, 0.53f, 0.25f)); // ORCA use orca color for selected tool / brush
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.f, 0.59f, 0.53f, 0.25f)); // ORCA use orca color for selected tool / brush
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.f, 0.59f, 0.53f, 0.30f)); // ORCA use orca color for selected tool / brush
ImGui::PushStyleColor(ImGuiCol_Border, ImGuiWrapper::COL_ORCA); // ORCA use orca color for border on selected tool / brush
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0);
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 1.0);
}
bool btn_clicked = ImGui::Button(into_u8(btn_name).c_str());
if (m_current_tool == tool_ids[i])
{
ImGui::PopStyleColor(4);
ImGui::PopStyleVar(2);
}
ImGui::PopStyleColor(2);
ImGui::PopStyleVar(1);
bool is_active = m_current_tool == tool_ids[i];
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.f);
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding , 3.f * scale);
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding , ImVec2(4.f * scale, 4.f * scale));
ImGui::PushStyleColor(ImGuiCol_Text , ImVec4(1,1,1,1)); // ORCA Fixes icon rendered without colors while using Light theme
ImGui::PushStyleColor(ImGuiCol_Button , is_active ? ImVec4(0.f, .59f, .53f, .25f) : ImVec4(0,0,0,0)); // ORCA
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, is_active ? ImVec4(0.f, .59f, .53f, .25f) : ImVec4(.6f,.6f,.6f,.2f)); // ORCA
ImGui::PushStyleColor(ImGuiCol_ButtonActive , is_active ? ImVec4(0.f, .59f, .53f, .30f) : ImVec4(0,0,0,0)); // ORCA
ImGui::PushStyleColor(ImGuiCol_Border , is_active ? ImGuiWrapper::COL_ORCA : ImVec4(0,0,0,0)); // ORCA
ImGui::PushStyleColor(ImGuiCol_BorderActive , is_active ? ImGuiWrapper::COL_ORCA : ImVec4(0,0,0,0)); // ORCA matched color for fixing flicker on click
bool btn_clicked = m_imgui->glyph_button(icons[i], ImVec2(16.f * scale, 16.f * scale)); // ORCA glyph_button for fixing unequal paddings
ImGui::PopStyleColor(6);
ImGui::PopStyleVar(3);
if (btn_clicked && m_current_tool != tool_ids[i]) {
m_current_tool = tool_ids[i];
for (auto& triangle_selector : m_triangle_selectors) {

View File

@@ -908,6 +908,54 @@ bool ImGuiWrapper::button(const wxString& label, const ImVec2 &size, bool enable
return (enable) ? res : false;
}
// ORCA Glyph based button for correctly rendering icon size based Glyph
// excludes spacings after Glyph and centers icon properly
// compared to image_button this supports styling
bool ImGuiWrapper::glyph_button(wchar_t icon_char, ImVec2 icon_size)
{
ImDrawList* draw_list = ImGui::GetWindowDrawList();
ImFont* font = ImGui::GetFont();
ImGuiStyle& style = ImGui::GetStyle();
ImVec2 padding = style.FramePadding;
float border_w = style.FrameBorderSize;
float rounding = style.FrameRounding;
std::string icon_str = into_u8(icon_char);
const char* icon = icon_str.c_str();
float width = icon_size.x + (padding.x + border_w) * 2.f;
float height = icon_size.y + (padding.y + border_w) * 2.f;
ImVec2 rc_min = ImGui::GetCursorScreenPos();
ImVec2 rc_max = ImVec2(rc_min.x + width, rc_min.y + height);
ImGui::Dummy(ImVec2(width, height));
ImGuiCol bg_color = ImGuiCol_Button;
ImGuiCol border_color = ImGuiCol_Border;
bool clicked = false;
if (ImGui::IsMouseHoveringRect(rc_min, rc_max)) {
bg_color = ImGuiCol_ButtonHovered;
if (ImGui::IsMouseClicked(ImGuiMouseButton_Left)) {
bg_color = ImGuiCol_ButtonActive;
border_color = ImGuiCol_BorderShadow;
clicked = true;
}
}
draw_list->AddRectFilled(rc_min, rc_max, ImGui::GetColorU32(bg_color), rounding);
if (border_w > 0.f)
draw_list->AddRect(rc_min, rc_max, ImGui::GetColorU32(border_color), rounding, 0, border_w);
ImVec2 text_pos = ImVec2(
rc_min.x + (width - font->FontSize) * .5f,
rc_min.y + (height - font->FontSize) * .5f
);
draw_list->AddText(font, font->FontSize, text_pos, ImGui::GetColorU32(ImGuiCol_Text), icon);
return clicked;
}
bool ImGuiWrapper::radio_button(const wxString &label, bool active)
{
auto label_utf8 = into_u8(label);

View File

@@ -133,6 +133,7 @@ public:
bool bbl_button(const wxString &label, const wxString& tooltip = {});
bool button(const wxString& label, float width, float height);
bool button(const wxString& label, const ImVec2 &size, bool enable); // default size = ImVec2(0.f, 0.f)
bool glyph_button(wchar_t icon_char, ImVec2 icon_size); // ORCA
bool radio_button(const wxString &label, bool active);
static ImVec4 to_ImVec4(const ColorRGB &color);
bool input_double(const std::string &label, const double &value, const std::string &format = "%.3f");

View File

@@ -1355,16 +1355,16 @@ void PlaterPresetComboBox::update()
bool unsupported = group == "Unsupported presets";
for (auto it : list) {
// ORCA add sorting support for vendor / type for user presets
auto groupName2 = groupName == "by_bundle" ? (preset_bundle_names[it->first].empty() ? _L("Unspecified") : preset_bundle_names[it->first])
: groupName == "by_type" ? (preset_filament_types[it->first].empty() ? _L("Unspecified") : preset_filament_types[it->first])
: groupName == "by_vendor" ? (preset_filament_vendors[it->first].empty() ? _L("Unspecified") : preset_filament_vendors[it->first])
auto groupName2 = groupName == "by_bundle" ? (preset_bundle_names[it->first].empty() ? _L("Unspecified") : from_u8(preset_bundle_names[it->first]))
: groupName == "by_type" ? (preset_filament_types[it->first].empty() ? _L("Unspecified") : from_u8(preset_filament_types[it->first]))
: groupName == "by_vendor" ? (preset_filament_vendors[it->first].empty() ? _L("Unspecified") : from_u8(preset_filament_vendors[it->first]))
: groupByGroup ? groupName
: preset_filament_vendors[it->first];
: from_u8(preset_filament_vendors[it->first]);
int index = groupName == "by_bundle"
? Append(preset_aliases[it->first], *it->second,
? Append(from_u8(preset_aliases[it->first]), *it->second,
from_u8(preset_bundle_ids[it->first]), groupName2, nullptr,
unsupported ? DD_ITEM_STYLE_DISABLED : 0)
: Append(preset_aliases[it->first], *it->second, groupName2, nullptr,
: Append(from_u8(preset_aliases[it->first]), *it->second, groupName2, nullptr,
unsupported ? DD_ITEM_STYLE_DISABLED : 0);
SetItemAlias(index, it->first);
if (unsupported)
@@ -1380,7 +1380,7 @@ void PlaterPresetComboBox::update()
}
} else {
for (std::map<wxString, wxBitmap *>::const_iterator it = presets.begin(); it != presets.end(); ++it) {
int index = Append(preset_aliases[it->first], *it->second);
int index = Append(from_u8(preset_aliases[it->first]), *it->second);
SetItemAlias(index, it->first);
SetItemTooltip(index, preset_descriptions[it->first]);
if (group == "System presets")
@@ -1767,10 +1767,10 @@ void TabPresetComboBox::update()
// Get bundle name for grouping
wxString bundle_name = _L("Unspecified");
if (preset_bundle_names.count(it->first) > 0 && !preset_bundle_names[it->first].empty()) {
bundle_name = preset_bundle_names[it->first];
bundle_name = from_u8(preset_bundle_names[it->first]);
}
// Use Append with group parameter for sub-dropdown grouping
int item_id = Append(preset_aliases[it->first], *it->second.first, from_u8(preset_bundle_ids[it->first]), bundle_name);
int item_id = Append(from_u8(preset_aliases[it->first]), *it->second.first, from_u8(preset_bundle_ids[it->first]), bundle_name);
SetItemAlias(item_id, it->first);
SetItemTooltip(item_id, preset_descriptions[it->first]);
bool is_enabled = it->second.second;

View File

@@ -2303,7 +2303,7 @@ void TabPrint::build()
optgroup->append_single_option_line("xy_hole_compensation", "quality_settings_precision#x-y-compensation");
optgroup->append_single_option_line("xy_contour_compensation", "quality_settings_precision#x-y-compensation");
optgroup->append_single_option_line("elefant_foot_compensation", "quality_settings_precision#elephant-foot-compensation");
optgroup->append_single_option_line("elefant_foot_layers_density", "quality_settings_precision#elephant-foot-compensation");
optgroup->append_single_option_line("elefant_foot_layers_density", "quality_settings_precision#elephant-foot-compensation-density");
optgroup->append_single_option_line("elefant_foot_compensation_layers", "quality_settings_precision#elephant-foot-compensation");
optgroup->append_single_option_line("precise_outer_wall", "quality_settings_precision#precise-wall");
optgroup->append_single_option_line("precise_z_height", "quality_settings_precision#precise-z-height");
@@ -2330,16 +2330,16 @@ void TabPrint::build()
optgroup = page->new_optgroup(L("Wall generator"), L"param_wall_generator");
optgroup->append_single_option_line("wall_generator", "quality_settings_wall_generator");
optgroup->append_single_option_line("wall_transition_angle", "quality_settings_wall_generator#arachne");
optgroup->append_single_option_line("wall_transition_filter_deviation", "quality_settings_wall_generator#arachne");
optgroup->append_single_option_line("wall_transition_length", "quality_settings_wall_generator#arachne");
optgroup->append_single_option_line("wall_distribution_count", "quality_settings_wall_generator#arachne");
optgroup->append_single_option_line("initial_layer_min_bead_width", "quality_settings_wall_generator#arachne");
optgroup->append_single_option_line("min_bead_width", "quality_settings_wall_generator#arachne");
optgroup->append_single_option_line("min_feature_size", "quality_settings_wall_generator#arachne");
optgroup->append_single_option_line("min_length_factor", "quality_settings_wall_generator#arachne");
optgroup->append_single_option_line("wall_maximum_resolution", "quality_settings_wall_generator#arachne");
optgroup->append_single_option_line("wall_maximum_deviation", "quality_settings_wall_generator#arachne");
optgroup->append_single_option_line("wall_transition_angle", "quality_settings_wall_generator#wall-transitioning-threshhold-angle");
optgroup->append_single_option_line("wall_transition_filter_deviation", "quality_settings_wall_generator#wall-transitioning-filter-margin");
optgroup->append_single_option_line("wall_transition_length", "quality_settings_wall_generator#wall-transitioning-length");
optgroup->append_single_option_line("wall_distribution_count", "quality_settings_wall_generator#wall-distribution-count");
optgroup->append_single_option_line("initial_layer_min_bead_width", "quality_settings_wall_generator#first-layer-minimum-wall-width");
optgroup->append_single_option_line("min_bead_width", "quality_settings_wall_generator#minimum-wall-width");
optgroup->append_single_option_line("min_feature_size", "quality_settings_wall_generator#minimum-feature-size");
optgroup->append_single_option_line("min_length_factor", "quality_settings_wall_generator#minimum-wall-length");
optgroup->append_single_option_line("wall_maximum_resolution", "quality_settings_wall_generator#maximum-wall-resolution");
optgroup->append_single_option_line("wall_maximum_deviation", "quality_settings_wall_generator#maximum-wall-deviation");
optgroup = page->new_optgroup(L("Walls and surfaces"), L"param_wall_surface");
optgroup->append_single_option_line("wall_sequence", "quality_settings_wall_and_surfaces#walls-printing-order");
@@ -2677,6 +2677,9 @@ void TabPrint::build()
optgroup->append_single_option_line("fuzzy_skin_scale", "others_settings_fuzzy_skin#skin-feature-size");
optgroup->append_single_option_line("fuzzy_skin_octaves", "others_settings_fuzzy_skin#skin-noise-octaves");
optgroup->append_single_option_line("fuzzy_skin_persistence", "others_settings_fuzzy_skin#skin-noise-persistence");
optgroup->append_single_option_line("fuzzy_skin_ripples_per_layer", "others_settings_fuzzy_skin#ripples-per-layer");
optgroup->append_single_option_line("fuzzy_skin_ripple_offset", "others_settings_fuzzy_skin#ripple-offset");
optgroup->append_single_option_line("fuzzy_skin_layers_between_ripple_offset", "others_settings_fuzzy_skin#layers-between-ripple-offset");
optgroup->append_single_option_line("fuzzy_skin_first_layer", "others_settings_fuzzy_skin#apply-fuzzy-skin-to-first-layer");
optgroup = page->new_optgroup(L("G-code output"), L"param_gcode");