mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 07:27:41 -06:00
FIX: switch dark mode bug
1.selected tool item in support,seam,mmu will be invalid after swich dark mode 2.add reset direction button in mmu 3.if don't switch dark mode in prepare page,toolbar doesn't change color Change-Id: Ibaaaee5c0cc03f66682f5eb0daafcd143b9d9edc
This commit is contained in:
parent
14417bf176
commit
cfafbc812f
7 changed files with 118 additions and 73 deletions
|
@ -1243,6 +1243,25 @@ bool GLCanvas3D::init()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GLCanvas3D::on_change_toolbar_color_mode() {
|
||||||
|
// reset svg
|
||||||
|
_init_toolbars();
|
||||||
|
m_gizmos.init();
|
||||||
|
// re-generate icon texture
|
||||||
|
m_separator_toolbar.set_icon_dirty();
|
||||||
|
_render_separator_toolbar_right();
|
||||||
|
m_separator_toolbar.set_icon_dirty();
|
||||||
|
_render_separator_toolbar_left();
|
||||||
|
m_main_toolbar.set_icon_dirty();
|
||||||
|
_render_main_toolbar();
|
||||||
|
wxGetApp().plater()->get_collapse_toolbar().set_icon_dirty();
|
||||||
|
_render_collapse_toolbar();
|
||||||
|
m_assemble_view_toolbar.set_icon_dirty();
|
||||||
|
_render_assemble_view_toolbar();
|
||||||
|
m_gizmos.set_icon_dirty();
|
||||||
|
m_gizmos.render_overlay();
|
||||||
|
}
|
||||||
|
|
||||||
void GLCanvas3D::set_as_dirty()
|
void GLCanvas3D::set_as_dirty()
|
||||||
{
|
{
|
||||||
m_dirty = true;
|
m_dirty = true;
|
||||||
|
@ -3973,8 +3992,6 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
||||||
//BBS do not limit rotate in assemble view
|
//BBS do not limit rotate in assemble view
|
||||||
camera.rotate_local_with_target(Vec3d(rot.y(), rot.x(), 0.), rotate_target);
|
camera.rotate_local_with_target(Vec3d(rot.y(), rot.x(), 0.), rotate_target);
|
||||||
//camera.rotate_on_sphere_with_target(rot.x(), rot.y(), false, rotate_target);
|
//camera.rotate_on_sphere_with_target(rot.x(), rot.y(), false, rotate_target);
|
||||||
auto clp_dist = m_gizmos.m_assemble_view_data->model_objects_clipper()->get_position();
|
|
||||||
m_gizmos.m_assemble_view_data->model_objects_clipper()->set_position(clp_dist, true);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#ifdef SUPPORT_FEEE_CAMERA
|
#ifdef SUPPORT_FEEE_CAMERA
|
||||||
|
@ -6699,33 +6716,11 @@ void GLCanvas3D::_render_overlays()
|
||||||
m_gizmos.set_overlay_icon_size(gizmo_size);
|
m_gizmos.set_overlay_icon_size(gizmo_size);
|
||||||
#endif // ENABLE_RETINA_GL
|
#endif // ENABLE_RETINA_GL
|
||||||
|
|
||||||
static bool last_dark_mode_tatus = wxGetApp().app_config->get("dark_color_mode") == "1";
|
|
||||||
bool dark_mode_status = wxGetApp().app_config->get("dark_color_mode") == "1";
|
|
||||||
if (dark_mode_status != last_dark_mode_tatus) {
|
|
||||||
last_dark_mode_tatus = dark_mode_status;
|
|
||||||
// reset svg
|
|
||||||
_init_toolbars();
|
|
||||||
m_gizmos.init();
|
|
||||||
// re-generate icon texture
|
|
||||||
m_separator_toolbar.set_icon_dirty();
|
|
||||||
_render_separator_toolbar_right();
|
|
||||||
m_separator_toolbar.set_icon_dirty();
|
|
||||||
_render_separator_toolbar_left();
|
|
||||||
m_main_toolbar.set_icon_dirty();
|
|
||||||
_render_main_toolbar();
|
|
||||||
wxGetApp().plater()->get_collapse_toolbar().set_icon_dirty();
|
|
||||||
_render_collapse_toolbar();
|
|
||||||
m_assemble_view_toolbar.set_icon_dirty();
|
|
||||||
_render_assemble_view_toolbar();
|
|
||||||
m_gizmos.set_icon_dirty();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
_render_separator_toolbar_right();
|
_render_separator_toolbar_right();
|
||||||
_render_separator_toolbar_left();
|
_render_separator_toolbar_left();
|
||||||
_render_main_toolbar();
|
_render_main_toolbar();
|
||||||
_render_collapse_toolbar();
|
_render_collapse_toolbar();
|
||||||
_render_assemble_view_toolbar();
|
_render_assemble_view_toolbar();
|
||||||
}
|
|
||||||
//BBS: GUI refactor: GLToolbar
|
//BBS: GUI refactor: GLToolbar
|
||||||
_render_imgui_select_plate_toolbar();
|
_render_imgui_select_plate_toolbar();
|
||||||
_render_return_toolbar();
|
_render_return_toolbar();
|
||||||
|
@ -7428,7 +7423,8 @@ void GLCanvas3D::_render_assemble_control() const
|
||||||
auto canvas_h = float(get_canvas_size().get_height());
|
auto canvas_h = float(get_canvas_size().get_height());
|
||||||
|
|
||||||
const float text_padding = 7.0f;
|
const float text_padding = 7.0f;
|
||||||
const float text_size_x = std::max(imgui->calc_text_size(_L("Explosion Ratio")).x, imgui->calc_text_size(_L("Section View")).x);
|
const float text_size_x = std::max(imgui->calc_text_size(_L("Reset direction")).x + 2 * ImGui::GetStyle().FramePadding.x,
|
||||||
|
std::max(imgui->calc_text_size(_L("Explosion Ratio")).x, imgui->calc_text_size(_L("Section View")).x));
|
||||||
const float slider_width = 75.0f;
|
const float slider_width = 75.0f;
|
||||||
const float value_size = imgui->calc_text_size("3.00").x + text_padding * 2;
|
const float value_size = imgui->calc_text_size("3.00").x + text_padding * 2;
|
||||||
const float item_spacing = imgui->get_item_spacing().x;
|
const float item_spacing = imgui->get_item_spacing().x;
|
||||||
|
@ -7440,7 +7436,8 @@ void GLCanvas3D::_render_assemble_control() const
|
||||||
ImGui::AlignTextToFramePadding();
|
ImGui::AlignTextToFramePadding();
|
||||||
|
|
||||||
{
|
{
|
||||||
if (m_gizmos.m_assemble_view_data->model_objects_clipper()->get_position() == 0.f) {
|
float clp_dist = m_gizmos.m_assemble_view_data->model_objects_clipper()->get_position();
|
||||||
|
if (clp_dist == 0.f) {
|
||||||
ImGui::AlignTextToFramePadding();
|
ImGui::AlignTextToFramePadding();
|
||||||
imgui->text(_L("Section View"));
|
imgui->text(_L("Section View"));
|
||||||
}
|
}
|
||||||
|
@ -7454,7 +7451,6 @@ void GLCanvas3D::_render_assemble_control() const
|
||||||
|
|
||||||
ImGui::SameLine(window_padding.x + text_size_x + item_spacing);
|
ImGui::SameLine(window_padding.x + text_size_x + item_spacing);
|
||||||
ImGui::PushItemWidth(slider_width);
|
ImGui::PushItemWidth(slider_width);
|
||||||
auto clp_dist = float(m_gizmos.m_assemble_view_data->model_objects_clipper()->get_position());
|
|
||||||
bool view_slider_changed = imgui->bbl_slider_float_style("##clp_dist", &clp_dist, 0.f, 1.f, "%.2f", 1.0f, true);
|
bool view_slider_changed = imgui->bbl_slider_float_style("##clp_dist", &clp_dist, 0.f, 1.f, "%.2f", 1.0f, true);
|
||||||
|
|
||||||
ImGui::SameLine(window_padding.x + text_size_x + slider_width + item_spacing * 2);
|
ImGui::SameLine(window_padding.x + text_size_x + slider_width + item_spacing * 2);
|
||||||
|
|
|
@ -701,6 +701,7 @@ public:
|
||||||
bool init();
|
bool init();
|
||||||
void post_event(wxEvent &&event);
|
void post_event(wxEvent &&event);
|
||||||
|
|
||||||
|
void on_change_toolbar_color_mode();
|
||||||
void set_as_dirty();
|
void set_as_dirty();
|
||||||
void requires_check_outside_state() { m_requires_check_outside_state = true; }
|
void requires_check_outside_state() { m_requires_check_outside_state = true; }
|
||||||
|
|
||||||
|
|
|
@ -94,9 +94,16 @@ bool View3D::init(wxWindow* parent, Bed3D& bed, Model* model, DynamicPrintConfig
|
||||||
|
|
||||||
void View3D::set_as_dirty()
|
void View3D::set_as_dirty()
|
||||||
{
|
{
|
||||||
if (m_canvas != nullptr)
|
if (m_canvas != nullptr) {
|
||||||
|
static bool last_dark_mode_tatus = wxGetApp().app_config->get("dark_color_mode") == "1";
|
||||||
|
bool dark_mode_status = wxGetApp().app_config->get("dark_color_mode") == "1";
|
||||||
|
if (dark_mode_status != last_dark_mode_tatus) {
|
||||||
|
last_dark_mode_tatus = dark_mode_status;
|
||||||
|
m_canvas->on_change_toolbar_color_mode();
|
||||||
|
}
|
||||||
m_canvas->set_as_dirty();
|
m_canvas->set_as_dirty();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void View3D::bed_shape_changed()
|
void View3D::bed_shape_changed()
|
||||||
{
|
{
|
||||||
|
|
|
@ -248,21 +248,23 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l
|
||||||
|
|
||||||
ImGui::AlignTextToFramePadding();
|
ImGui::AlignTextToFramePadding();
|
||||||
m_imgui->text(m_desc.at("tool_type"));
|
m_imgui->text(m_desc.at("tool_type"));
|
||||||
|
std::array<wchar_t, 4> tool_ids = { ImGui::CircleButtonIcon, ImGui::SphereButtonIcon, ImGui::FillButtonIcon, ImGui::GapFillIcon };
|
||||||
bool dark_mode = wxGetApp().app_config->get("dark_color_mode") == "1";
|
bool dark_mode = wxGetApp().app_config->get("dark_color_mode") == "1";
|
||||||
std::array<wchar_t, 4> tool_icons;
|
std::array<wchar_t, 4> icons;
|
||||||
if (dark_mode)
|
if (dark_mode)
|
||||||
tool_icons = { ImGui::CircleButtonDarkIcon, ImGui::SphereButtonDarkIcon, ImGui::FillButtonDarkIcon, ImGui::GapFillDarkIcon };
|
icons = { ImGui::CircleButtonDarkIcon, ImGui::SphereButtonDarkIcon, ImGui::FillButtonDarkIcon, ImGui::GapFillDarkIcon };
|
||||||
else
|
else
|
||||||
tool_icons = { ImGui::CircleButtonIcon, ImGui::SphereButtonIcon, ImGui::FillButtonIcon, ImGui::GapFillIcon };
|
icons = { ImGui::CircleButtonIcon, ImGui::SphereButtonIcon, ImGui::FillButtonIcon, ImGui::GapFillIcon };
|
||||||
|
|
||||||
std::array<wxString, 4> tool_tips = { _L("Circle"), _L("Sphere"), _L("Fill"), _L("Gap Fill") };
|
std::array<wxString, 4> tool_tips = { _L("Circle"), _L("Sphere"), _L("Fill"), _L("Gap Fill") };
|
||||||
for (int i = 0; i < tool_icons.size(); i++) {
|
for (int i = 0; i < tool_ids.size(); i++) {
|
||||||
std::string str_label = std::string("##");
|
std::string str_label = std::string("##");
|
||||||
std::wstring btn_name = tool_icons[i] + boost::nowide::widen(str_label);
|
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));
|
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::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0);
|
||||||
if (m_current_tool == tool_icons[i]) {
|
if (m_current_tool == tool_ids[i]) {
|
||||||
ImGui::PushStyleColor(ImGuiCol_Button, dark_mode ? ImVec4(43 / 255.0f, 64 / 255.0f, 54 / 255.0f, 1.00f) : ImVec4(0.86f, 0.99f, 0.91f, 1.00f)); // r, g, b, a
|
ImGui::PushStyleColor(ImGuiCol_Button, dark_mode ? ImVec4(43 / 255.0f, 64 / 255.0f, 54 / 255.0f, 1.00f) : ImVec4(0.86f, 0.99f, 0.91f, 1.00f)); // r, g, b, a
|
||||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, dark_mode ? ImVec4(43 / 255.0f, 64 / 255.0f, 54 / 255.0f, 1.00f) : ImVec4(0.86f, 0.99f, 0.91f, 1.00f));
|
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, dark_mode ? ImVec4(43 / 255.0f, 64 / 255.0f, 54 / 255.0f, 1.00f) : ImVec4(0.86f, 0.99f, 0.91f, 1.00f));
|
||||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, dark_mode ? ImVec4(43 / 255.0f, 64 / 255.0f, 54 / 255.0f, 1.00f) : ImVec4(0.86f, 0.99f, 0.91f, 1.00f));
|
ImGui::PushStyleColor(ImGuiCol_ButtonActive, dark_mode ? ImVec4(43 / 255.0f, 64 / 255.0f, 54 / 255.0f, 1.00f) : ImVec4(0.86f, 0.99f, 0.91f, 1.00f));
|
||||||
|
@ -271,15 +273,15 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 1.0);
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 1.0);
|
||||||
}
|
}
|
||||||
bool btn_clicked = ImGui::Button(into_u8(btn_name).c_str());
|
bool btn_clicked = ImGui::Button(into_u8(btn_name).c_str());
|
||||||
if (m_current_tool == tool_icons[i])
|
if (m_current_tool == tool_ids[i])
|
||||||
{
|
{
|
||||||
ImGui::PopStyleColor(4);
|
ImGui::PopStyleColor(4);
|
||||||
ImGui::PopStyleVar(2);
|
ImGui::PopStyleVar(2);
|
||||||
}
|
}
|
||||||
ImGui::PopStyleVar(1);
|
ImGui::PopStyleVar(1);
|
||||||
|
|
||||||
if (btn_clicked && m_current_tool != tool_icons[i]) {
|
if (btn_clicked && m_current_tool != tool_ids[i]) {
|
||||||
m_current_tool = tool_icons[i];
|
m_current_tool = tool_ids[i];
|
||||||
for (auto& triangle_selector : m_triangle_selectors) {
|
for (auto& triangle_selector : m_triangle_selectors) {
|
||||||
triangle_selector->seed_fill_unselect_all_triangles();
|
triangle_selector->seed_fill_unselect_all_triangles();
|
||||||
triangle_selector->request_update_render_data();
|
triangle_selector->request_update_render_data();
|
||||||
|
|
|
@ -99,6 +99,7 @@ bool GLGizmoMmuSegmentation::on_init()
|
||||||
|
|
||||||
m_desc["clipping_of_view_caption"] = _L("Alt + Mouse wheel");
|
m_desc["clipping_of_view_caption"] = _L("Alt + Mouse wheel");
|
||||||
m_desc["clipping_of_view"] = _L("Section view");
|
m_desc["clipping_of_view"] = _L("Section view");
|
||||||
|
m_desc["reset_direction"] = _L("Reset direction");
|
||||||
m_desc["cursor_size_caption"] = _L("Ctrl + Mouse wheel");
|
m_desc["cursor_size_caption"] = _L("Ctrl + Mouse wheel");
|
||||||
m_desc["cursor_size"] = _L("Pen size");
|
m_desc["cursor_size"] = _L("Pen size");
|
||||||
m_desc["cursor_type"] = _L("Pen shape");
|
m_desc["cursor_type"] = _L("Pen shape");
|
||||||
|
@ -356,7 +357,8 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
|
||||||
|
|
||||||
// First calculate width of all the texts that are could possibly be shown. We will decide set the dialog width based on that:
|
// 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 space_size = m_imgui->get_style_scaling() * 8;
|
const float space_size = m_imgui->get_style_scaling() * 8;
|
||||||
const float clipping_slider_left = m_imgui->calc_text_size(m_desc.at("clipping_of_view")).x + m_imgui->scaled(1.5f);
|
const float clipping_slider_left = std::max(m_imgui->calc_text_size(m_desc.at("clipping_of_view")).x + m_imgui->scaled(1.5f),
|
||||||
|
m_imgui->calc_text_size(m_desc.at("reset_direction")).x + m_imgui->scaled(1.5f) + ImGui::GetStyle().FramePadding.x * 2);
|
||||||
const float cursor_slider_left = m_imgui->calc_text_size(m_desc.at("cursor_size")).x + m_imgui->scaled(1.5f);
|
const float cursor_slider_left = m_imgui->calc_text_size(m_desc.at("cursor_size")).x + m_imgui->scaled(1.5f);
|
||||||
const float smart_fill_slider_left = m_imgui->calc_text_size(m_desc.at("smart_fill_angle")).x + m_imgui->scaled(1.5f);
|
const float smart_fill_slider_left = m_imgui->calc_text_size(m_desc.at("smart_fill_angle")).x + m_imgui->scaled(1.5f);
|
||||||
const float edge_detect_slider_left = m_imgui->calc_text_size(m_desc.at("edge_detection")).x + m_imgui->scaled(1.f);
|
const float edge_detect_slider_left = m_imgui->calc_text_size(m_desc.at("edge_detection")).x + m_imgui->scaled(1.f);
|
||||||
|
@ -464,20 +466,22 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
|
||||||
|
|
||||||
m_imgui->text(m_desc.at("tool_type"));
|
m_imgui->text(m_desc.at("tool_type"));
|
||||||
|
|
||||||
|
std::array<wchar_t, 6> tool_ids;
|
||||||
|
tool_ids = { ImGui::CircleButtonIcon, ImGui::SphereButtonIcon, ImGui::TriangleButtonIcon, ImGui::HeightRangeIcon, ImGui::FillButtonIcon, ImGui::GapFillIcon };
|
||||||
bool dark_mode = wxGetApp().app_config->get("dark_color_mode") == "1";
|
bool dark_mode = wxGetApp().app_config->get("dark_color_mode") == "1";
|
||||||
std::array<wchar_t, 6> tool_icons;
|
std::array<wchar_t, 6> icons;
|
||||||
if (dark_mode)
|
if (dark_mode)
|
||||||
tool_icons = { ImGui::CircleButtonDarkIcon, ImGui::SphereButtonDarkIcon, ImGui::TriangleButtonDarkIcon, ImGui::HeightRangeDarkIcon, ImGui::FillButtonDarkIcon, ImGui::GapFillDarkIcon };
|
icons = { ImGui::CircleButtonDarkIcon, ImGui::SphereButtonDarkIcon, ImGui::TriangleButtonDarkIcon, ImGui::HeightRangeDarkIcon, ImGui::FillButtonDarkIcon, ImGui::GapFillDarkIcon };
|
||||||
else
|
else
|
||||||
tool_icons = { ImGui::CircleButtonIcon, ImGui::SphereButtonIcon, ImGui::TriangleButtonIcon, ImGui::HeightRangeIcon, ImGui::FillButtonIcon, ImGui::GapFillIcon };
|
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") };
|
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_icons.size(); i++) {
|
for (int i = 0; i < tool_ids.size(); i++) {
|
||||||
std::string str_label = std::string("");
|
std::string str_label = std::string("");
|
||||||
std::wstring btn_name = tool_icons[i] + boost::nowide::widen(str_label);
|
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));
|
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::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0);
|
||||||
if (m_current_tool == tool_icons[i]) {
|
if (m_current_tool == tool_ids[i]) {
|
||||||
ImGui::PushStyleColor(ImGuiCol_Button, dark_mode ? ImVec4(43 / 255.0f, 64 / 255.0f, 54 / 255.0f, 1.00f) : ImVec4(0.86f, 0.99f, 0.91f, 1.00f)); // r, g, b, a
|
ImGui::PushStyleColor(ImGuiCol_Button, dark_mode ? ImVec4(43 / 255.0f, 64 / 255.0f, 54 / 255.0f, 1.00f) : ImVec4(0.86f, 0.99f, 0.91f, 1.00f)); // r, g, b, a
|
||||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, dark_mode ? ImVec4(43 / 255.0f, 64 / 255.0f, 54 / 255.0f, 1.00f) : ImVec4(0.86f, 0.99f, 0.91f, 1.00f));
|
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, dark_mode ? ImVec4(43 / 255.0f, 64 / 255.0f, 54 / 255.0f, 1.00f) : ImVec4(0.86f, 0.99f, 0.91f, 1.00f));
|
||||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, dark_mode ? ImVec4(43 / 255.0f, 64 / 255.0f, 54 / 255.0f, 1.00f) : ImVec4(0.86f, 0.99f, 0.91f, 1.00f));
|
ImGui::PushStyleColor(ImGuiCol_ButtonActive, dark_mode ? ImVec4(43 / 255.0f, 64 / 255.0f, 54 / 255.0f, 1.00f) : ImVec4(0.86f, 0.99f, 0.91f, 1.00f));
|
||||||
|
@ -486,15 +490,15 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 1.0);
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 1.0);
|
||||||
}
|
}
|
||||||
bool btn_clicked = ImGui::Button(into_u8(btn_name).c_str());
|
bool btn_clicked = ImGui::Button(into_u8(btn_name).c_str());
|
||||||
if (m_current_tool == tool_icons[i])
|
if (m_current_tool == tool_ids[i])
|
||||||
{
|
{
|
||||||
ImGui::PopStyleColor(4);
|
ImGui::PopStyleColor(4);
|
||||||
ImGui::PopStyleVar(2);
|
ImGui::PopStyleVar(2);
|
||||||
}
|
}
|
||||||
ImGui::PopStyleVar(1);
|
ImGui::PopStyleVar(1);
|
||||||
|
|
||||||
if (btn_clicked && m_current_tool != tool_icons[i]) {
|
if (btn_clicked && m_current_tool != tool_ids[i]) {
|
||||||
m_current_tool = tool_icons[i];
|
m_current_tool = tool_ids[i];
|
||||||
for (auto &triangle_selector : m_triangle_selectors) {
|
for (auto &triangle_selector : m_triangle_selectors) {
|
||||||
triangle_selector->seed_fill_unselect_all_triangles();
|
triangle_selector->seed_fill_unselect_all_triangles();
|
||||||
triangle_selector->request_update_render_data();
|
triangle_selector->request_update_render_data();
|
||||||
|
@ -528,9 +532,17 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
|
||||||
ImGui::BBLDragFloat("##cursor_radius_input", &m_cursor_radius, 0.05f, 0.0f, 0.0f, "%.2f");
|
ImGui::BBLDragFloat("##cursor_radius_input", &m_cursor_radius, 0.05f, 0.0f, 0.0f, "%.2f");
|
||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
if (m_c->object_clipper()->get_position() == 0.f) {
|
||||||
ImGui::AlignTextToFramePadding();
|
ImGui::AlignTextToFramePadding();
|
||||||
m_imgui->text(m_desc.at("clipping_of_view"));
|
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);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
auto clp_dist = float(m_c->object_clipper()->get_position());
|
auto clp_dist = float(m_c->object_clipper()->get_position());
|
||||||
ImGui::SameLine(circle_max_width);
|
ImGui::SameLine(circle_max_width);
|
||||||
|
@ -546,8 +558,17 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
|
||||||
m_cursor_type = TriangleSelector::CursorType::POINTER;
|
m_cursor_type = TriangleSelector::CursorType::POINTER;
|
||||||
m_tool_type = ToolType::BRUSH;
|
m_tool_type = ToolType::BRUSH;
|
||||||
|
|
||||||
|
if (m_c->object_clipper()->get_position() == 0.f) {
|
||||||
ImGui::AlignTextToFramePadding();
|
ImGui::AlignTextToFramePadding();
|
||||||
m_imgui->text(m_desc.at("clipping_of_view"));
|
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);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
auto clp_dist = float(m_c->object_clipper()->get_position());
|
auto clp_dist = float(m_c->object_clipper()->get_position());
|
||||||
ImGui::SameLine(clipping_slider_left);
|
ImGui::SameLine(clipping_slider_left);
|
||||||
|
@ -584,9 +605,17 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
|
||||||
m_smart_fill_angle = -1.f;
|
m_smart_fill_angle = -1.f;
|
||||||
}
|
}
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
if (m_c->object_clipper()->get_position() == 0.f) {
|
||||||
ImGui::AlignTextToFramePadding();
|
ImGui::AlignTextToFramePadding();
|
||||||
m_imgui->text(m_desc.at("clipping_of_view"));
|
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);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
auto clp_dist = float(m_c->object_clipper()->get_position());
|
auto clp_dist = float(m_c->object_clipper()->get_position());
|
||||||
ImGui::SameLine(sliders_left_width);
|
ImGui::SameLine(sliders_left_width);
|
||||||
|
@ -612,9 +641,17 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
|
||||||
ImGui::BBLDragFloat("##cursor_height_input", &m_cursor_height, 0.05f, 0.0f, 0.0f, "%.2f");
|
ImGui::BBLDragFloat("##cursor_height_input", &m_cursor_height, 0.05f, 0.0f, 0.0f, "%.2f");
|
||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
if (m_c->object_clipper()->get_position() == 0.f) {
|
||||||
ImGui::AlignTextToFramePadding();
|
ImGui::AlignTextToFramePadding();
|
||||||
m_imgui->text(m_desc.at("clipping_of_view"));
|
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);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
auto clp_dist = float(m_c->object_clipper()->get_position());
|
auto clp_dist = float(m_c->object_clipper()->get_position());
|
||||||
ImGui::SameLine(height_max_width);
|
ImGui::SameLine(height_max_width);
|
||||||
|
|
|
@ -207,20 +207,21 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit)
|
||||||
|
|
||||||
ImGui::AlignTextToFramePadding();
|
ImGui::AlignTextToFramePadding();
|
||||||
m_imgui->text(m_desc.at("cursor_type"));
|
m_imgui->text(m_desc.at("cursor_type"));
|
||||||
|
std::array<wchar_t, 2> tool_ids = { ImGui::CircleButtonIcon, ImGui::SphereButtonIcon };
|
||||||
bool dark_mode = wxGetApp().app_config->get("dark_color_mode") == "1";
|
bool dark_mode = wxGetApp().app_config->get("dark_color_mode") == "1";
|
||||||
std::array<wchar_t, 2> tool_icons;
|
std::array<wchar_t, 2> icons;
|
||||||
if (dark_mode)
|
if (dark_mode)
|
||||||
tool_icons = { ImGui::CircleButtonDarkIcon, ImGui::SphereButtonDarkIcon};
|
icons = { ImGui::CircleButtonDarkIcon, ImGui::SphereButtonDarkIcon};
|
||||||
else
|
else
|
||||||
tool_icons = { ImGui::CircleButtonIcon, ImGui::SphereButtonIcon};
|
icons = { ImGui::CircleButtonIcon, ImGui::SphereButtonIcon };
|
||||||
std::array<wxString, 2> tool_tips = { _L("Circle"), _L("Sphere")};
|
std::array<wxString, 2> tool_tips = { _L("Circle"), _L("Sphere")};
|
||||||
for (int i = 0; i < tool_icons.size(); i++) {
|
for (int i = 0; i < tool_ids.size(); i++) {
|
||||||
std::string str_label = std::string("##");
|
std::string str_label = std::string("##");
|
||||||
std::wstring btn_name = tool_icons[i] + boost::nowide::widen(str_label);
|
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));
|
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::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0);
|
||||||
if (m_current_tool == tool_icons[i]) {
|
if (m_current_tool == tool_ids[i]) {
|
||||||
ImGui::PushStyleColor(ImGuiCol_Button, dark_mode ? ImVec4(43 / 255.0f, 64 / 255.0f, 54 / 255.0f, 1.00f) : ImVec4(0.86f, 0.99f, 0.91f, 1.00f)); // r, g, b, a
|
ImGui::PushStyleColor(ImGuiCol_Button, dark_mode ? ImVec4(43 / 255.0f, 64 / 255.0f, 54 / 255.0f, 1.00f) : ImVec4(0.86f, 0.99f, 0.91f, 1.00f)); // r, g, b, a
|
||||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, dark_mode ? ImVec4(43 / 255.0f, 64 / 255.0f, 54 / 255.0f, 1.00f) : ImVec4(0.86f, 0.99f, 0.91f, 1.00f));
|
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, dark_mode ? ImVec4(43 / 255.0f, 64 / 255.0f, 54 / 255.0f, 1.00f) : ImVec4(0.86f, 0.99f, 0.91f, 1.00f));
|
||||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, dark_mode ? ImVec4(43 / 255.0f, 64 / 255.0f, 54 / 255.0f, 1.00f) : ImVec4(0.86f, 0.99f, 0.91f, 1.00f));
|
ImGui::PushStyleColor(ImGuiCol_ButtonActive, dark_mode ? ImVec4(43 / 255.0f, 64 / 255.0f, 54 / 255.0f, 1.00f) : ImVec4(0.86f, 0.99f, 0.91f, 1.00f));
|
||||||
|
@ -229,14 +230,14 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit)
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 1.0);
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 1.0);
|
||||||
}
|
}
|
||||||
bool btn_clicked = ImGui::Button(into_u8(btn_name).c_str());
|
bool btn_clicked = ImGui::Button(into_u8(btn_name).c_str());
|
||||||
if (m_current_tool == tool_icons[i])
|
if (m_current_tool == tool_ids[i])
|
||||||
{
|
{
|
||||||
ImGui::PopStyleColor(4);
|
ImGui::PopStyleColor(4);
|
||||||
ImGui::PopStyleVar(2);
|
ImGui::PopStyleVar(2);
|
||||||
}
|
}
|
||||||
ImGui::PopStyleVar(1);
|
ImGui::PopStyleVar(1);
|
||||||
if (btn_clicked && m_current_tool != tool_icons[i]) {
|
if (btn_clicked && m_current_tool != tool_ids[i]) {
|
||||||
m_current_tool = tool_icons[i];
|
m_current_tool = tool_ids[i];
|
||||||
for (auto& triangle_selector : m_triangle_selectors) {
|
for (auto& triangle_selector : m_triangle_selectors) {
|
||||||
triangle_selector->seed_fill_unselect_all_triangles();
|
triangle_selector->seed_fill_unselect_all_triangles();
|
||||||
triangle_selector->request_update_render_data();
|
triangle_selector->request_update_render_data();
|
||||||
|
|
|
@ -157,6 +157,7 @@ bool GLGizmosManager::init()
|
||||||
//m_gizmos.emplace_back(new GLGizmoHollow(m_parent, "hollow.svg", sprite_id++));
|
//m_gizmos.emplace_back(new GLGizmoHollow(m_parent, "hollow.svg", sprite_id++));
|
||||||
|
|
||||||
m_common_gizmos_data.reset(new CommonGizmosDataPool(&m_parent));
|
m_common_gizmos_data.reset(new CommonGizmosDataPool(&m_parent));
|
||||||
|
if(!m_assemble_view_data)
|
||||||
m_assemble_view_data.reset(new AssembleViewDataPool(&m_parent));
|
m_assemble_view_data.reset(new AssembleViewDataPool(&m_parent));
|
||||||
|
|
||||||
for (auto& gizmo : m_gizmos) {
|
for (auto& gizmo : m_gizmos) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue