mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-17 09:05:53 +08:00
Icons for part type
This commit is contained in:
parent
10f07d8810
commit
8f14b5395f
@ -1487,25 +1487,44 @@ void GLGizmoEmboss::draw_model_type()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ImGui::RadioButton("modifier", type == modifier) && !is_last_solid_part)
|
|
||||||
new_type = modifier;
|
ImGui::Text("%s :", _u8L("Type").c_str());
|
||||||
if(is_last_solid_part && ImGui::IsItemHovered())
|
ImGui::SameLine(75);
|
||||||
ImGui::SetTooltip("%s", _u8L("You can't change a type of the last solid part of the object.").c_str());
|
if (type == part) {
|
||||||
|
draw_icon(IconType::part, IconState::hovered);
|
||||||
|
} else {
|
||||||
|
if (draw_button(IconType::part)) new_type = part;
|
||||||
|
if (ImGui::IsItemHovered())
|
||||||
|
ImGui::SetTooltip("%s", _u8L("Click to change text into object part.").c_str());
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::RadioButton("negative", type == negative) && !is_last_solid_part)
|
if (type == negative) {
|
||||||
new_type = negative;
|
draw_icon(IconType::negative, IconState::hovered);
|
||||||
if(is_last_solid_part && ImGui::IsItemHovered())
|
} else {
|
||||||
ImGui::SetTooltip("%s", _u8L("You can't change a type of the last solid part of the object.").c_str());
|
if (draw_button(IconType::negative, is_last_solid_part))
|
||||||
|
new_type = negative;
|
||||||
|
if(ImGui::IsItemHovered()){
|
||||||
|
if(is_last_solid_part)
|
||||||
|
ImGui::SetTooltip("%s", _u8L("You can't change a type of the last solid part of the object.").c_str());
|
||||||
|
else if (type != negative)
|
||||||
|
ImGui::SetTooltip("%s", _u8L("Click to change part type into negative volume.").c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::RadioButton("part", type == part))
|
if (type == modifier) {
|
||||||
new_type = part;
|
draw_icon(IconType::modifier, IconState::hovered);
|
||||||
|
} else {
|
||||||
ImGui::SameLine();
|
if(draw_button(IconType::modifier, is_last_solid_part))
|
||||||
m_imgui->disabled_begin(true);
|
new_type = modifier;
|
||||||
ImGui::RadioButton("baked in", false);
|
if (ImGui::IsItemHovered()) {
|
||||||
m_imgui->disabled_end();
|
if(is_last_solid_part)
|
||||||
|
ImGui::SetTooltip("%s", _u8L("You can't change a type of the last solid part of the object.").c_str());
|
||||||
|
else if (type != modifier)
|
||||||
|
ImGui::SetTooltip("%s", _u8L("Click to change part type into modifier.").c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (m_volume != nullptr && new_type.has_value() && !is_last_solid_part) {
|
if (m_volume != nullptr && new_type.has_value() && !is_last_solid_part) {
|
||||||
GUI_App &app = wxGetApp();
|
GUI_App &app = wxGetApp();
|
||||||
@ -2540,8 +2559,11 @@ void GLGizmoEmboss::init_icons()
|
|||||||
"make_bold.svg",
|
"make_bold.svg",
|
||||||
"make_unbold.svg",
|
"make_unbold.svg",
|
||||||
"search.svg",
|
"search.svg",
|
||||||
"open.svg",
|
"open.svg",
|
||||||
"revert_all_.svg"
|
"revert_all_.svg",
|
||||||
|
"add_text_part.svg",
|
||||||
|
"add_text_negative.svg",
|
||||||
|
"add_text_modifier.svg"
|
||||||
};
|
};
|
||||||
assert(filenames.size() == static_cast<size_t>(IconType::_count));
|
assert(filenames.size() == static_cast<size_t>(IconType::_count));
|
||||||
std::string path = resources_dir() + "/icons/";
|
std::string path = resources_dir() + "/icons/";
|
||||||
@ -2566,7 +2588,7 @@ void GLGizmoEmboss::init_icons()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLGizmoEmboss::draw_icon(IconType icon, IconState state)
|
void GLGizmoEmboss::draw_icon(IconType icon, IconState state, ImVec2 size)
|
||||||
{
|
{
|
||||||
// canot draw count
|
// canot draw count
|
||||||
assert(icon != IconType::_count);
|
assert(icon != IconType::_count);
|
||||||
@ -2590,8 +2612,11 @@ void GLGizmoEmboss::draw_icon(IconType icon, IconState state)
|
|||||||
start_y / (float) tex_height);
|
start_y / (float) tex_height);
|
||||||
ImVec2 uv1((start_x + icon_width) / (float) tex_width,
|
ImVec2 uv1((start_x + icon_width) / (float) tex_width,
|
||||||
(start_y + icon_width) / (float) tex_height);
|
(start_y + icon_width) / (float) tex_height);
|
||||||
|
|
||||||
|
if (size.x < 1 || size.y < 1)
|
||||||
|
size = ImVec2(m_gui_cfg->icon_width, m_gui_cfg->icon_width);
|
||||||
|
|
||||||
ImGui::Image(tex_id, ImVec2(icon_width, icon_width), uv0, uv1);
|
ImGui::Image(tex_id, size, uv0, uv1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLGizmoEmboss::draw_transparent_icon()
|
void GLGizmoEmboss::draw_transparent_icon()
|
||||||
|
@ -264,10 +264,15 @@ private:
|
|||||||
system_selector,
|
system_selector,
|
||||||
open_file,
|
open_file,
|
||||||
revert_all,
|
revert_all,
|
||||||
_count /* automatic calc of icon size */
|
// VolumeType icons
|
||||||
|
part,
|
||||||
|
negative,
|
||||||
|
modifier,
|
||||||
|
// automatic calc of icon's count
|
||||||
|
_count
|
||||||
};
|
};
|
||||||
enum class IconState: unsigned { activable = 0, hovered /*1*/, disabled /*2*/};
|
enum class IconState: unsigned { activable = 0, hovered /*1*/, disabled /*2*/};
|
||||||
void draw_icon(IconType icon, IconState state);
|
void draw_icon(IconType icon, IconState state, ImVec2 size = ImVec2(0,0));
|
||||||
void draw_transparent_icon();
|
void draw_transparent_icon();
|
||||||
bool draw_clickable(IconType icon, IconState state, IconType hover_icon, IconState hover_state);
|
bool draw_clickable(IconType icon, IconState state, IconType hover_icon, IconState hover_state);
|
||||||
bool draw_button(IconType icon, bool disable = false);
|
bool draw_button(IconType icon, bool disable = false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user