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.icon_filename = m_is_dark ? "split_objects_dark.svg" : "split_objects.svg";
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.left.render_callback = nullptr;
item.left.action_callback = [this]() {
@ -6252,6 +6254,8 @@ bool GLCanvas3D::_init_main_toolbar()
item.name = "splitvolumes";
item.icon_filename = m_is_dark ? "split_parts_dark.svg" : "split_parts.svg";
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.left.action_callback = [this]() {
if (m_canvas != nullptr) {
@ -6268,6 +6272,7 @@ bool GLCanvas3D::_init_main_toolbar()
item.name = "layersediting";
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.additional_tooltip = _u8L("Please select single object.");
item.sprite_id++;
item.left.action_callback = [this]() {
if (m_canvas != nullptr) {

View File

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

View File

@ -445,7 +445,11 @@ bool GLGizmoAdvancedCut::on_init()
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)

View File

@ -72,8 +72,12 @@ void GLGizmoFdmSupports::on_opening()
std::string GLGizmoFdmSupports::on_get_name() const
{
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()
{

View File

@ -39,8 +39,12 @@ CommonGizmosDataID GLGizmoFlatten::on_get_requirements() const
std::string GLGizmoFlatten::on_get_name() const
{
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
{

View File

@ -93,6 +93,13 @@ bool GLGizmoMeshBoolean::on_init()
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");
}

View File

@ -43,8 +43,12 @@ void GLGizmoMmuSegmentation::on_shutdown()
std::string GLGizmoMmuSegmentation::on_get_name() const
{
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
{

View File

@ -57,8 +57,12 @@ GLGizmoSeam::GLGizmoSeam(GLCanvas3D& parent, const std::string& icon_filename, u
std::string GLGizmoSeam::on_get_name() const
{
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,8 +138,12 @@ void GLGizmoSimplify::add_simplify_suggestion_notification(
std::string GLGizmoSimplify::on_get_name() const
{
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)
{

View File

@ -355,8 +355,12 @@ CommonGizmosDataID GLGizmoText::on_get_requirements() const
std::string GLGizmoText::on_get_name() const
{
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
{