ENH:set the warning text to yellow in gizmos

jira: none
Change-Id: Iaf71528f5f877452dee579ce1c827f5eaa93e4c4
This commit is contained in:
zhou.xu 2024-04-24 11:45:43 +08:00 committed by Lane.Wei
parent dc0df83393
commit 06be80bcd0
8 changed files with 37 additions and 15 deletions

View File

@ -64,7 +64,8 @@ public:
static const ColorRGB REDISH() { return { 1.0f, 0.5f, 0.5f }; }
static const ColorRGB YELLOW() { return { 1.0f, 1.0f, 0.0f }; }
static const ColorRGB WHITE() { return { 1.0f, 1.0f, 1.0f }; }
static const ColorRGB ORCA() { return {0.0f, 150.f / 255.0f, 136.0f / 255}; }
static const ColorRGB ORCA() { return {0.0f, 150.f / 255.0f, 136.0f / 255}; }
static const ColorRGB WARNING() { return {241.0f / 255, 117.f / 255.0f, 78.0f / 255}; }
static const ColorRGB X() { return { 0.75f, 0.0f, 0.0f }; }
static const ColorRGB Y() { return { 0.0f, 0.75f, 0.0f }; }

View File

@ -948,7 +948,7 @@ void MenuFactory::append_menu_items_convert_unit(wxMenu* menu)
void MenuFactory::append_menu_item_merge_to_multipart_object(wxMenu* menu)
{
append_menu_item(menu, wxID_ANY, _L("Combinate"), _L("Assemble the selected objects to an object with multiple parts"),
append_menu_item(menu, wxID_ANY, _L("Merge"), _L("Assemble the selected objects to an object with multiple parts"),
[](wxCommandEvent&) { obj_list()->merge(true); }, "", menu,
[]() { return obj_list()->can_merge_to_multipart_object(); }, m_parent);
}
@ -956,7 +956,7 @@ void MenuFactory::append_menu_item_merge_to_multipart_object(wxMenu* menu)
void MenuFactory::append_menu_item_merge_to_single_object(wxMenu* menu)
{
menu->AppendSeparator();
append_menu_item(menu, wxID_ANY, _L("Combinate"), _L("Assemble the selected objects to an object with single part"),
append_menu_item(menu, wxID_ANY, _L("Merge"), _L("Assemble the selected objects to an object with single part"),
[](wxCommandEvent&) { obj_list()->merge(false); }, "", menu,
[]() { return obj_list()->can_merge_to_single_object(); }, m_parent);
}

View File

@ -2270,10 +2270,11 @@ void GLGizmoAdvancedCut::render_input_window_warning() const
(m_info_stats.outside_bb == 1 ? _L("connector is out of object") : _L("connectors is out of object"));
if (m_info_stats.is_overlap)
out += "\n - " + _L("Some connectors are overlapped");
m_imgui->text(out);
m_imgui->warning_text(out);
}
if (!m_keep_upper && !m_keep_lower) {
m_imgui->warning_text(/*wxString(ImGui::WarningMarkerSmall)*/ _L("Warning") + ": " + _L("Invalid state. \nNo one part is selected to keep after cut"));
}
if (!m_keep_upper && !m_keep_lower)
m_imgui->text(/*wxString(ImGui::WarningMarkerSmall)*/_L("Warning") + ": " + _L("Invalid state. \nNo one part is selected to keep after cut"));
}
bool GLGizmoAdvancedCut::render_reset_button(const std::string &label_id, const std::string &tooltip) const

View File

@ -131,7 +131,8 @@ void GLGizmoAssembly::render_input_window_warning(bool same_model_object)
if (wxGetApp().plater()->canvas3D()->get_canvas_type() == GLCanvas3D::ECanvasType::CanvasView3D) {
if (m_hit_different_volumes.size() == 2) {
if (same_model_object == false) {
m_imgui->text(_L("Warning") + ": " + _L("Due to ensuer_on_bed, assembly between \ndifferent objects may not be correct in 3D view.\n It is recommended to assemble them together."));
m_imgui->warning_text(_L("Warning") + ": " +
_L("It is recommended to assemble the objects first,\nbecause the objects is restriced to bed \nand only parts can be lifted."));
}
}
}

View File

@ -1867,14 +1867,14 @@ void GLGizmoMeasure::show_selection_ui()
if (m_selected_wrong_feature_waring_tip) {
if (m_measure_mode == EMeasureMode::ONLY_ASSEMBLY) {
if (m_assembly_mode == AssemblyMode::FACE_FACE) {
m_imgui->text(_L("Warning:please select Plane's feature."));
m_imgui->warning_text(_L("Warning:please select Plane's feature."));
} else if (m_assembly_mode == AssemblyMode::POINT_POINT) {
m_imgui->text(_L("Warning:please select Point's or Circle's feature."));
m_imgui->warning_text(_L("Warning:please select Point's or Circle's feature."));
}
}
}
if (m_measure_mode == EMeasureMode::ONLY_ASSEMBLY && m_hit_different_volumes.size() == 1) {
m_imgui->text(_L("Warning:please select two different mesh."));
m_imgui->warning_text(_L("Warning:please select two different mesh."));
}
}

View File

@ -398,7 +398,7 @@ void GLGizmoMeshBoolean::on_render_input_window(float x, float y, float bottom_l
void GLGizmoMeshBoolean::render_input_window_warning(const std::string &text) {
if (text.size() > 0) {
m_imgui->text(_L("Warning") + ": " + _L(text));
m_imgui->warning_text(_L("Warning") + ": " + _L(text));
}
}

View File

@ -811,12 +811,15 @@ ImFontAtlasCustomRect *ImGuiWrapper::GetTextureCustomRect(const wchar_t &tex_id)
return (item != m_custom_glyph_rects_ids.end()) ? ImGui::GetIO().Fonts->GetCustomRectByIndex(m_custom_glyph_rects_ids[tex_id]) : nullptr;
}
ImU32 ImGuiWrapper::to_ImU32(const ColorRGBA &color)
{
return ImGui::GetColorU32({color.r(), color.g(), color.b(), color.a()});
ImU32 ImGuiWrapper::to_ImU32(const ColorRGBA &color)
{
return ImGui::GetColorU32({color.r(), color.g(), color.b(), color.a()}); }
ImVec4 ImGuiWrapper::to_ImVec4(const ColorRGB &color) {
return {color.r(), color.g(), color.b(), 1.0};
}
ImVec4 ImGuiWrapper::to_ImVec4(const ColorRGBA &color) {
ImVec4 ImGuiWrapper::to_ImVec4(const ColorRGBA &color) {
return {color.r(), color.g(), color.b(), color.a()};
}
@ -988,6 +991,19 @@ void ImGuiWrapper::text(const wxString &label)
this->text(label_utf8.c_str());
}
void ImGuiWrapper::warning_text(const char *label)
{
ImGui::PushStyleColor(ImGuiCol_Text, ImGuiWrapper::to_ImVec4(ColorRGB::WARNING()));
this->text(label);
ImGui::PopStyleColor();
}
void ImGuiWrapper::warning_text(const wxString &all_text)
{
auto label_utf8 = into_u8(all_text);
warning_text(label_utf8.c_str());
}
void ImGuiWrapper::text_colored(const ImVec4& color, const char* label)
{
ImGui::TextColored(color, "%s", label);

View File

@ -119,6 +119,7 @@ public:
bool radio_button(const wxString &label, bool active);
static ImU32 to_ImU32(const ColorRGBA &color);
static ImVec4 to_ImVec4(const ColorRGB &color);
static ImVec4 to_ImVec4(const ColorRGBA &color);
static ColorRGBA from_ImU32(const ImU32 &color);
static ColorRGBA from_ImVec4(const ImVec4 &color);
@ -142,6 +143,8 @@ public:
void text(const char *label);
void text(const std::string &label);
void text(const wxString &label);
void warning_text(const char *all_text);
void warning_text(const wxString &all_text);
void text_colored(const ImVec4& color, const char* label);
void text_colored(const ImVec4& color, const std::string& label);
void text_colored(const ImVec4& color, const wxString& label);