ENH:upgrade tips for gizmo tool

Jira: STUDIO-6167
Change-Id: I3890bff060c1a507ea3a3831930d24301ab19dc6
This commit is contained in:
zhou.xu 2024-02-04 14:13:21 +08:00 committed by Lane.Wei
parent f5b8cadc8c
commit 3e0d5f7a30
10 changed files with 49 additions and 9 deletions

View File

@ -6234,6 +6234,8 @@ bool GLCanvas3D::_init_main_toolbar()
item.name = "splitobjects"; item.name = "splitobjects";
item.icon_filename = m_is_dark ? "split_objects_dark.svg" : "split_objects.svg"; item.icon_filename = m_is_dark ? "split_objects_dark.svg" : "split_objects.svg";
item.tooltip = _utf8(L("Split to objects")); item.tooltip = _utf8(L("Split to objects"));
item.additional_tooltip = _u8L("Please select single object\n.") +
_u8L("And it is valid when there are at least two parts in object or stl has at least two meshes.");
item.sprite_id++; item.sprite_id++;
item.left.render_callback = nullptr; item.left.render_callback = nullptr;
item.left.action_callback = [this]() { item.left.action_callback = [this]() {
@ -6252,6 +6254,8 @@ bool GLCanvas3D::_init_main_toolbar()
item.name = "splitvolumes"; item.name = "splitvolumes";
item.icon_filename = m_is_dark ? "split_parts_dark.svg" : "split_parts.svg"; item.icon_filename = m_is_dark ? "split_parts_dark.svg" : "split_parts.svg";
item.tooltip = _utf8(L("Split to parts")); item.tooltip = _utf8(L("Split to parts"));
item.additional_tooltip = _u8L("Please select single object\n.") +
_u8L("And it is valid when importing an stl with at least two meshes.");
item.sprite_id++; item.sprite_id++;
item.left.action_callback = [this]() { item.left.action_callback = [this]() {
if (m_canvas != nullptr) { if (m_canvas != nullptr) {
@ -6268,6 +6272,7 @@ bool GLCanvas3D::_init_main_toolbar()
item.name = "layersediting"; item.name = "layersediting";
item.icon_filename = m_is_dark ? "toolbar_variable_layer_height_dark.svg" : "toolbar_variable_layer_height.svg"; item.icon_filename = m_is_dark ? "toolbar_variable_layer_height_dark.svg" : "toolbar_variable_layer_height.svg";
item.tooltip = _utf8(L("Variable layer height")); item.tooltip = _utf8(L("Variable layer height"));
item.additional_tooltip = _u8L("Please select single object.");
item.sprite_id++; item.sprite_id++;
item.left.action_callback = [this]() { item.left.action_callback = [this]() {
if (m_canvas != nullptr) { if (m_canvas != nullptr) {

View File

@ -528,11 +528,11 @@ std::string GLToolbar::get_tooltip() const
if (item->is_hovered()) if (item->is_hovered())
{ {
tooltip = item->get_tooltip(); tooltip = item->get_tooltip();
if (!item->is_pressed()) if (!item->is_enabled())
{ {
const std::string& additional_tooltip = item->get_additional_tooltip(); const std::string& additional_tooltip = item->get_additional_tooltip();
if (!additional_tooltip.empty()) if (!additional_tooltip.empty())
tooltip += "\n" + additional_tooltip; tooltip += ":\n" + additional_tooltip;
break; break;
} }

View File

@ -445,7 +445,11 @@ bool GLGizmoAdvancedCut::on_init()
std::string GLGizmoAdvancedCut::on_get_name() const std::string GLGizmoAdvancedCut::on_get_name() const
{ {
return (_(L("Cut"))).ToUTF8().data(); if (!on_is_activable() && m_state == EState::Off) {
return _u8L("Cut") + _u8L(":\n") + _u8L("Please select single object.");
} else {
return _u8L("Cut");
}
} }
void GLGizmoAdvancedCut::on_load(cereal::BinaryInputArchive &ar) void GLGizmoAdvancedCut::on_load(cereal::BinaryInputArchive &ar)

View File

@ -72,7 +72,11 @@ void GLGizmoFdmSupports::on_opening()
std::string GLGizmoFdmSupports::on_get_name() const std::string GLGizmoFdmSupports::on_get_name() const
{ {
return _u8L("Supports Painting"); if (!on_is_activable() && m_state == EState::Off) {
return _u8L("Supports Painting") + _u8L(":\n") + _u8L("Please select single object.");
} else {
return _u8L("Supports Painting");
}
} }
bool GLGizmoFdmSupports::on_init() bool GLGizmoFdmSupports::on_init()

View File

@ -39,7 +39,11 @@ CommonGizmosDataID GLGizmoFlatten::on_get_requirements() const
std::string GLGizmoFlatten::on_get_name() const std::string GLGizmoFlatten::on_get_name() const
{ {
return _u8L("Lay on face"); if (!on_is_activable() && m_state == EState::Off) {
return _u8L("Lay on face") + _u8L(":\n") + _u8L("Please select single object.");
} else {
return _u8L("Lay on face");
}
} }
bool GLGizmoFlatten::on_is_activable() const bool GLGizmoFlatten::on_is_activable() const

View File

@ -93,6 +93,13 @@ bool GLGizmoMeshBoolean::on_init()
std::string GLGizmoMeshBoolean::on_get_name() const std::string GLGizmoMeshBoolean::on_get_name() const
{ {
if (!on_is_activable() && m_state == EState::Off) {
if (!m_parent.get_selection().is_single_full_instance()) {
return _u8L("Mesh Boolean") + _u8L(":\n") + _u8L("Please right click to assembly these objects.");
} else if (m_parent.get_selection().get_volume_idxs().size() <= 1){
return _u8L("Mesh Boolean") + _u8L(":\n") + _u8L("Please add at least one more object and select them together,\nthen right click to assembly these objects.");
}
}
return _u8L("Mesh Boolean"); return _u8L("Mesh Boolean");
} }

View File

@ -43,7 +43,11 @@ void GLGizmoMmuSegmentation::on_shutdown()
std::string GLGizmoMmuSegmentation::on_get_name() const std::string GLGizmoMmuSegmentation::on_get_name() const
{ {
return _u8L("Color Painting"); if (!on_is_activable() && m_state == EState::Off) {
return _u8L("Color Painting") + _u8L(":\n") + _u8L("Please select single object.");
} else {
return _u8L("Color Painting");
}
} }
bool GLGizmoMmuSegmentation::on_is_selectable() const bool GLGizmoMmuSegmentation::on_is_selectable() const

View File

@ -57,7 +57,11 @@ GLGizmoSeam::GLGizmoSeam(GLCanvas3D& parent, const std::string& icon_filename, u
std::string GLGizmoSeam::on_get_name() const std::string GLGizmoSeam::on_get_name() const
{ {
return _u8L("Seam painting"); if (!on_is_activable() && m_state == EState::Off) {
return _u8L("Seam painting") + _u8L(":\nPlease select single object.");
} else {
return _u8L("Seam painting");
}
} }

View File

@ -138,7 +138,11 @@ void GLGizmoSimplify::add_simplify_suggestion_notification(
std::string GLGizmoSimplify::on_get_name() const std::string GLGizmoSimplify::on_get_name() const
{ {
return _u8L("Simplify"); if (!on_is_activable()) {
return _u8L("Simplify") + _u8L(":\n") + _u8L("Please select single object.");
} else {
return _u8L("Simplify");
}
} }
void GLGizmoSimplify::on_render_input_window(float x, float y, float bottom_limit) void GLGizmoSimplify::on_render_input_window(float x, float y, float bottom_limit)

View File

@ -355,7 +355,11 @@ CommonGizmosDataID GLGizmoText::on_get_requirements() const
std::string GLGizmoText::on_get_name() const std::string GLGizmoText::on_get_name() const
{ {
return _u8L("Text shape"); if (!on_is_activable() && m_state == EState::Off) {
return _u8L("Text shape") + _u8L(":\n") + _u8L("Please select single object.");
} else {
return _u8L("Text shape");
}
} }
bool GLGizmoText::on_is_activable() const bool GLGizmoText::on_is_activable() const