FIX: Colored filament is not matched against.
github: #2190 Colored filament is not matched against the same color in AMS slot. Signed-off-by: Kunlong Ma <kunlong.ma@bambulab.com> Change-Id: Id4588fc9c8115a46881e2f5d198d79fe831f4371
This commit is contained in:
parent
ece959dcca
commit
36562eece0
|
@ -1462,7 +1462,7 @@ void ColorPickerPopup::on_custom_clr_picker(wxMouseEvent& event)
|
||||||
m_clrData->GetColour().Red(),
|
m_clrData->GetColour().Red(),
|
||||||
m_clrData->GetColour().Green(),
|
m_clrData->GetColour().Green(),
|
||||||
m_clrData->GetColour().Blue(),
|
m_clrData->GetColour().Blue(),
|
||||||
254
|
255
|
||||||
);
|
);
|
||||||
|
|
||||||
if (picker_color.Alpha() == 0) {
|
if (picker_color.Alpha() == 0) {
|
||||||
|
|
|
@ -140,14 +140,11 @@ void MaterialItem::render(wxDC &dc)
|
||||||
|
|
||||||
auto mcolor = m_material_coloul;
|
auto mcolor = m_material_coloul;
|
||||||
auto acolor = m_ams_coloul;
|
auto acolor = m_ams_coloul;
|
||||||
|
change_the_opacity(acolor);
|
||||||
if (!IsEnabled()) {
|
if (!IsEnabled()) {
|
||||||
mcolor = wxColour(0x90, 0x90, 0x90);
|
mcolor = wxColour(0x90, 0x90, 0x90);
|
||||||
acolor = wxColour(0x90, 0x90, 0x90);
|
acolor = wxColour(0x90, 0x90, 0x90);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
mcolor = m_material_coloul;
|
|
||||||
acolor = m_ams_coloul;
|
|
||||||
}
|
|
||||||
|
|
||||||
// materials name
|
// materials name
|
||||||
dc.SetFont(::Label::Body_13);
|
dc.SetFont(::Label::Body_13);
|
||||||
|
@ -185,6 +182,7 @@ void MaterialItem::doRender(wxDC &dc)
|
||||||
{
|
{
|
||||||
auto mcolor = m_material_coloul;
|
auto mcolor = m_material_coloul;
|
||||||
auto acolor = m_ams_coloul;
|
auto acolor = m_ams_coloul;
|
||||||
|
change_the_opacity(acolor);
|
||||||
|
|
||||||
if (mcolor.Alpha() == 0 || acolor.Alpha() == 0) {
|
if (mcolor.Alpha() == 0 || acolor.Alpha() == 0) {
|
||||||
dc.DrawBitmap(m_transparent_mitem.bmp(), FromDIP(1), FromDIP(1));
|
dc.DrawBitmap(m_transparent_mitem.bmp(), FromDIP(1), FromDIP(1));
|
||||||
|
@ -194,10 +192,6 @@ void MaterialItem::doRender(wxDC &dc)
|
||||||
mcolor = wxColour(0x90, 0x90, 0x90);
|
mcolor = wxColour(0x90, 0x90, 0x90);
|
||||||
acolor = wxColour(0x90, 0x90, 0x90);
|
acolor = wxColour(0x90, 0x90, 0x90);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
mcolor = m_material_coloul;
|
|
||||||
acolor = m_ams_coloul;
|
|
||||||
}
|
|
||||||
|
|
||||||
//top
|
//top
|
||||||
dc.SetPen(*wxTRANSPARENT_PEN);
|
dc.SetPen(*wxTRANSPARENT_PEN);
|
||||||
|
@ -518,7 +512,7 @@ void AmsMapingPopup::add_ams_mapping(std::vector<TrayData> tray_data, wxWindow*
|
||||||
m_mapping_item_list.push_back(m_mapping_item);
|
m_mapping_item_list.push_back(m_mapping_item);
|
||||||
|
|
||||||
if (tray_data[i].type == NORMAL) {
|
if (tray_data[i].type == NORMAL) {
|
||||||
if (is_match_material(tray_data[i].filament_type)) {
|
if (is_match_material(tray_data[i].filament_type)) {
|
||||||
m_mapping_item->set_data(tray_data[i].colour, tray_data[i].name, tray_data[i]);
|
m_mapping_item->set_data(tray_data[i].colour, tray_data[i].name, tray_data[i]);
|
||||||
} else {
|
} else {
|
||||||
m_mapping_item->set_data(wxColour(0xEE,0xEE,0xEE), tray_data[i].name, tray_data[i], true);
|
m_mapping_item->set_data(wxColour(0xEE,0xEE,0xEE), tray_data[i].name, tray_data[i], true);
|
||||||
|
@ -673,10 +667,13 @@ void MappingItem::set_data(wxColour colour, wxString name, TrayData data, bool u
|
||||||
|
|
||||||
void MappingItem::doRender(wxDC &dc)
|
void MappingItem::doRender(wxDC &dc)
|
||||||
{
|
{
|
||||||
dc.SetPen(m_coloul);
|
wxColour color = m_coloul;
|
||||||
dc.SetBrush(wxBrush(m_coloul));
|
change_the_opacity(color);
|
||||||
|
|
||||||
if (m_coloul.Alpha() == 0) {
|
dc.SetPen(color);
|
||||||
|
dc.SetBrush(wxBrush(color));
|
||||||
|
|
||||||
|
if (color.Alpha() == 0) {
|
||||||
dc.DrawBitmap( m_transparent_mapping_item.bmp(), 0, (GetSize().y - MAPPING_ITEM_REAL_SIZE.y) / 2);
|
dc.DrawBitmap( m_transparent_mapping_item.bmp(), 0, (GetSize().y - MAPPING_ITEM_REAL_SIZE.y) / 2);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -5677,4 +5677,10 @@ std::string DeviceManager::load_gcode(std::string type_str, std::string gcode_fi
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void change_the_opacity(wxColour& colour)
|
||||||
|
{
|
||||||
|
if (colour.Alpha() == 255) {
|
||||||
|
colour = wxColour(colour.Red(), colour.Green(), colour.Blue(), 254);
|
||||||
|
}
|
||||||
|
}
|
||||||
} // namespace Slic3r
|
} // namespace Slic3r
|
||||||
|
|
|
@ -1034,6 +1034,8 @@ public:
|
||||||
static std::string load_gcode(std::string type_str, std::string gcode_file);
|
static std::string load_gcode(std::string type_str, std::string gcode_file);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// change the opacity
|
||||||
|
void change_the_opacity(wxColour& colour);
|
||||||
} // namespace Slic3r
|
} // namespace Slic3r
|
||||||
|
|
||||||
#endif // slic3r_DeviceManager_hpp_
|
#endif // slic3r_DeviceManager_hpp_
|
||||||
|
|
|
@ -756,6 +756,8 @@ void AMSLib::render(wxDC &dc)
|
||||||
void AMSLib::render_extra_text(wxDC& dc)
|
void AMSLib::render_extra_text(wxDC& dc)
|
||||||
{
|
{
|
||||||
auto tmp_lib_colour = m_info.material_colour;
|
auto tmp_lib_colour = m_info.material_colour;
|
||||||
|
|
||||||
|
change_the_opacity(tmp_lib_colour);
|
||||||
auto temp_text_colour = AMS_CONTROL_GRAY800;
|
auto temp_text_colour = AMS_CONTROL_GRAY800;
|
||||||
|
|
||||||
if (tmp_lib_colour.GetLuminance() < 0.6) {
|
if (tmp_lib_colour.GetLuminance() < 0.6) {
|
||||||
|
@ -843,6 +845,8 @@ void AMSLib::render_generic_text(wxDC &dc)
|
||||||
}
|
}
|
||||||
|
|
||||||
auto tmp_lib_colour = m_info.material_colour;
|
auto tmp_lib_colour = m_info.material_colour;
|
||||||
|
change_the_opacity(tmp_lib_colour);
|
||||||
|
|
||||||
auto temp_text_colour = AMS_CONTROL_GRAY800;
|
auto temp_text_colour = AMS_CONTROL_GRAY800;
|
||||||
|
|
||||||
if (tmp_lib_colour.GetLuminance() < 0.6) {
|
if (tmp_lib_colour.GetLuminance() < 0.6) {
|
||||||
|
@ -977,6 +981,8 @@ void AMSLib::render_extra_lib(wxDC& dc)
|
||||||
|
|
||||||
|
|
||||||
auto tmp_lib_colour = m_info.material_colour;
|
auto tmp_lib_colour = m_info.material_colour;
|
||||||
|
change_the_opacity(tmp_lib_colour);
|
||||||
|
|
||||||
auto temp_bitmap_third = m_bitmap_editable_light;
|
auto temp_bitmap_third = m_bitmap_editable_light;
|
||||||
auto temp_bitmap_brand = m_bitmap_readonly_light;
|
auto temp_bitmap_brand = m_bitmap_readonly_light;
|
||||||
|
|
||||||
|
@ -1078,6 +1084,8 @@ void AMSLib::render_generic_lib(wxDC &dc)
|
||||||
{
|
{
|
||||||
wxSize size = GetSize();
|
wxSize size = GetSize();
|
||||||
auto tmp_lib_colour = m_info.material_colour;
|
auto tmp_lib_colour = m_info.material_colour;
|
||||||
|
change_the_opacity(tmp_lib_colour);
|
||||||
|
|
||||||
auto temp_bitmap_third = m_bitmap_editable_light;
|
auto temp_bitmap_third = m_bitmap_editable_light;
|
||||||
auto temp_bitmap_brand = m_bitmap_readonly_light;
|
auto temp_bitmap_brand = m_bitmap_readonly_light;
|
||||||
|
|
||||||
|
@ -1741,7 +1749,9 @@ void AMSItem::doRender(wxDC &dc)
|
||||||
dc.SetPen(wxPen(*wxTRANSPARENT_PEN));
|
dc.SetPen(wxPen(*wxTRANSPARENT_PEN));
|
||||||
|
|
||||||
if (wxWindow::IsEnabled()) {
|
if (wxWindow::IsEnabled()) {
|
||||||
dc.SetBrush(wxBrush(iter->material_colour));
|
wxColour color = iter->material_colour;
|
||||||
|
change_the_opacity(color);
|
||||||
|
dc.SetBrush(wxBrush(color));
|
||||||
} else {
|
} else {
|
||||||
dc.SetBrush(AMS_CONTROL_DISABLE_COLOUR);
|
dc.SetBrush(AMS_CONTROL_DISABLE_COLOUR);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue