mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-01 06:22:03 +08:00
Set colors of selected parts in respect to theirs types
This commit is contained in:
parent
1f45df071c
commit
fbc7c73cfb
@ -221,6 +221,10 @@ const std::array<ColorRGBA, 4> GLVolume::MODEL_COLOR = { {
|
|||||||
{ 0.5f, 1.0f, 0.5f, 1.0f },
|
{ 0.5f, 1.0f, 0.5f, 1.0f },
|
||||||
{ 0.5f, 0.5f, 1.0f, 1.0f }
|
{ 0.5f, 0.5f, 1.0f, 1.0f }
|
||||||
} };
|
} };
|
||||||
|
const ColorRGBA GLVolume::NEGATIVE_VOLUME_COLOR = { 0.2f, 0.2f, 0.2f, 0.5f };
|
||||||
|
const ColorRGBA GLVolume::PARAMETER_MODIFIER_COLOR = { 1.0, 1.0f, 0.2f, 0.5f };
|
||||||
|
const ColorRGBA GLVolume::SUPPORT_BLOCKER_COLOR = { 1.0f, 0.2f, 0.2f, 0.5f };
|
||||||
|
const ColorRGBA GLVolume::SUPPORT_ENFORCER_COLOR = { 0.2f, 0.2f, 1.0f, 0.5f };
|
||||||
|
|
||||||
GLVolume::GLVolume(float r, float g, float b, float a)
|
GLVolume::GLVolume(float r, float g, float b, float a)
|
||||||
: m_sla_shift_z(0.0)
|
: m_sla_shift_z(0.0)
|
||||||
@ -264,12 +268,15 @@ void GLVolume::set_render_color(bool force_transparent)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (hover == HS_Select)
|
if (hover == HS_Deselect)
|
||||||
set_render_color(HOVER_SELECT_COLOR);
|
|
||||||
else if (hover == HS_Deselect)
|
|
||||||
set_render_color(HOVER_DESELECT_COLOR);
|
set_render_color(HOVER_DESELECT_COLOR);
|
||||||
else if (selected)
|
else if (hover == HS_Select || selected) {
|
||||||
set_render_color(outside ? SELECTED_OUTSIDE_COLOR : SELECTED_COLOR);
|
const ColorRGBA rc = outside ? SELECTED_OUTSIDE_COLOR : SELECTED_COLOR;
|
||||||
|
if (color == NEGATIVE_VOLUME_COLOR || color == PARAMETER_MODIFIER_COLOR || color == SUPPORT_BLOCKER_COLOR || color == SUPPORT_ENFORCER_COLOR)
|
||||||
|
set_render_color(ColorRGBA(rc.r() * color.r(), rc.g() * color.g(), rc.b() * color.b(), rc.a() * color.a()));
|
||||||
|
else
|
||||||
|
set_render_color(rc);
|
||||||
|
}
|
||||||
else if (disabled)
|
else if (disabled)
|
||||||
set_render_color(DISABLED_COLOR);
|
set_render_color(DISABLED_COLOR);
|
||||||
else if (outside && shader_outside_printer_detection_enabled)
|
else if (outside && shader_outside_printer_detection_enabled)
|
||||||
@ -289,16 +296,13 @@ ColorRGBA color_from_model_volume(const ModelVolume& model_volume)
|
|||||||
{
|
{
|
||||||
ColorRGBA color;
|
ColorRGBA color;
|
||||||
if (model_volume.is_negative_volume())
|
if (model_volume.is_negative_volume())
|
||||||
color = { 0.2f, 0.2f, 0.2f, 1.0f };
|
color = GLVolume::NEGATIVE_VOLUME_COLOR;
|
||||||
else if (model_volume.is_modifier())
|
else if (model_volume.is_modifier())
|
||||||
color = { 1.0, 1.0f, 0.2f, 1.0f };
|
color = GLVolume::PARAMETER_MODIFIER_COLOR;
|
||||||
else if (model_volume.is_support_blocker())
|
else if (model_volume.is_support_blocker())
|
||||||
color = { 1.0f, 0.2f, 0.2f, 1.0f };
|
color = GLVolume::SUPPORT_BLOCKER_COLOR;
|
||||||
else if (model_volume.is_support_enforcer())
|
else if (model_volume.is_support_enforcer())
|
||||||
color = { 0.2f, 0.2f, 1.0f, 1.0f };
|
color = GLVolume::SUPPORT_ENFORCER_COLOR;
|
||||||
|
|
||||||
if (!model_volume.is_model_part())
|
|
||||||
color.a(0.5f);
|
|
||||||
|
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
@ -70,6 +70,10 @@ public:
|
|||||||
static const ColorRGBA SLA_PAD_COLOR;
|
static const ColorRGBA SLA_PAD_COLOR;
|
||||||
static const ColorRGBA NEUTRAL_COLOR;
|
static const ColorRGBA NEUTRAL_COLOR;
|
||||||
static const std::array<ColorRGBA, 4> MODEL_COLOR;
|
static const std::array<ColorRGBA, 4> MODEL_COLOR;
|
||||||
|
static const ColorRGBA NEGATIVE_VOLUME_COLOR;
|
||||||
|
static const ColorRGBA PARAMETER_MODIFIER_COLOR;
|
||||||
|
static const ColorRGBA SUPPORT_BLOCKER_COLOR;
|
||||||
|
static const ColorRGBA SUPPORT_ENFORCER_COLOR;
|
||||||
|
|
||||||
enum EHoverState : unsigned char
|
enum EHoverState : unsigned char
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user