FIX:fix bug for the base color of the color modification
after matching the untreated material jira:STUDIO-10062 Change-Id: I699fd843600182bc87b224eee488e752b64ca0b4 (cherry picked from commit 29b0be89eb5190bd83d783bf173f14950aef738d)
This commit is contained in:
@@ -34,7 +34,8 @@ const int LEFT_OFFSET = 2;
|
||||
{
|
||||
m_arraw_bitmap_gray = ScalableBitmap(this, "drop_down2", FromDIP(8));
|
||||
m_arraw_bitmap_white = ScalableBitmap(this, "topbar_dropdown", 12);
|
||||
m_transparent_mitem = ScalableBitmap(this, "transparent_material_item", FromDIP(50));
|
||||
m_transparent_mitem = ScalableBitmap(this, "transparent_material_up", FromDIP(16));
|
||||
m_filament_wheel_transparent = ScalableBitmap(this, "filament_transparent", FromDIP(20));//wxGetApp().dark_mode() ? "filament_dark_transparent"
|
||||
//m_ams_wheel_mitem = ScalableBitmap(this, "ams_wheel", FromDIP(25));
|
||||
m_ams_wheel_mitem = ScalableBitmap(this, "ams_wheel_narrow", 25);
|
||||
m_ams_not_match = ScalableBitmap(this, "filament_not_mactch", 25);
|
||||
@@ -206,7 +207,7 @@ void MaterialItem::doRender(wxDC& dc)
|
||||
auto acolor = m_ams_coloul;
|
||||
change_the_opacity(acolor);
|
||||
|
||||
if (mcolor.Alpha() == 0 || acolor.Alpha() == 0) {
|
||||
if (mcolor.Alpha() == 0) {
|
||||
dc.DrawBitmap(m_transparent_mitem.bmp(), FromDIP(1), FromDIP(1));
|
||||
}
|
||||
|
||||
@@ -315,7 +316,11 @@ void MaterialItem::doRender(wxDC& dc)
|
||||
wheel_left += m_ams_wheel_mitem.GetBmpSize().x;
|
||||
dc.DrawBitmap(m_ams_not_match.bmp(), (size.x - m_ams_not_match.GetBmpWidth()) / 2 - FromDIP(LEFT_OFFSET), wheel_top);
|
||||
} else {
|
||||
dc.DrawBitmap(m_ams_wheel_mitem.bmp(), wheel_left - FromDIP(LEFT_OFFSET), wheel_top);
|
||||
if (mcolor.Alpha() == 0) {
|
||||
dc.DrawBitmap(m_filament_wheel_transparent.bmp(), wheel_left - FromDIP(LEFT_OFFSET), wheel_top);
|
||||
} else {
|
||||
dc.DrawBitmap(m_ams_wheel_mitem.bmp(), wheel_left - FromDIP(LEFT_OFFSET), wheel_top);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -406,8 +411,8 @@ void MaterialSyncItem::doRender(wxDC &dc)
|
||||
auto acolor = m_ams_coloul;
|
||||
change_the_opacity(acolor);
|
||||
|
||||
if (mcolor.Alpha() == 0 || acolor.Alpha() == 0) {
|
||||
dc.DrawBitmap(m_transparent_mitem.bmp(), FromDIP(1), FromDIP(1));
|
||||
if (mcolor.Alpha() == 0) {
|
||||
dc.DrawBitmap(m_transparent_mitem.bmp(), FromDIP(0), FromDIP(0));
|
||||
}
|
||||
|
||||
if (!IsEnabled()) {
|
||||
@@ -503,7 +508,11 @@ void MaterialSyncItem::doRender(wxDC &dc)
|
||||
auto wheel_left = (GetSize().x / 2 - m_ams_wheel_mitem.GetBmpSize().x) / 2 + FromDIP(2);
|
||||
auto wheel_top = ((float) GetSize().y * 0.6 - m_ams_wheel_mitem.GetBmpSize().y) / 2 + (float) GetSize().y * 0.4;
|
||||
if (m_match) {// different with parent
|
||||
dc.DrawBitmap(m_ams_wheel_mitem.bmp(), wheel_left - FromDIP(LEFT_OFFSET), wheel_top);
|
||||
if (mcolor.Alpha() == 0) {
|
||||
dc.DrawBitmap(m_filament_wheel_transparent.bmp(), wheel_left - FromDIP(LEFT_OFFSET), wheel_top);
|
||||
} else {
|
||||
dc.DrawBitmap(m_ams_wheel_mitem.bmp(), wheel_left - FromDIP(LEFT_OFFSET), wheel_top);
|
||||
}
|
||||
}
|
||||
//not draw m_ams_not_match
|
||||
}
|
||||
|
||||
@@ -89,6 +89,7 @@ public:
|
||||
ScalableBitmap m_arraw_bitmap_gray;
|
||||
ScalableBitmap m_arraw_bitmap_white;
|
||||
ScalableBitmap m_transparent_mitem;
|
||||
ScalableBitmap m_filament_wheel_transparent;
|
||||
ScalableBitmap m_ams_wheel_mitem;
|
||||
ScalableBitmap m_ams_not_match;
|
||||
|
||||
|
||||
@@ -205,6 +205,15 @@ void BaseTransparentDPIFrame::call_start_gradual_disappearance()//for ok or canc
|
||||
start_gradual_disappearance();
|
||||
}
|
||||
|
||||
void BaseTransparentDPIFrame::restart() {
|
||||
m_display_stage = 0;
|
||||
m_enter_window_valid = true;
|
||||
SetTransparent(m_init_transparent);
|
||||
if (m_refresh_timer) {
|
||||
clear_timer_count();
|
||||
m_refresh_timer->Start(ANIMATION_REFRESH_INTERVAL);
|
||||
}
|
||||
}
|
||||
void BaseTransparentDPIFrame::start_gradual_disappearance()
|
||||
{
|
||||
clear_timer_count();
|
||||
|
||||
@@ -39,6 +39,7 @@ public:
|
||||
virtual void on_timer(wxTimerEvent &event);
|
||||
void set_target_pos_and_gradual_disappearance(wxPoint pos);
|
||||
void call_start_gradual_disappearance();
|
||||
void restart();
|
||||
|
||||
protected:
|
||||
Button *m_button_ok = nullptr;
|
||||
|
||||
@@ -2909,9 +2909,10 @@ void Sidebar::sync_ams_list(bool is_from_big_sync_btn)
|
||||
if (m_sna_dialog) {
|
||||
m_sna_dialog->on_hide();
|
||||
}
|
||||
m_fna_dialog.reset();
|
||||
m_fna_dialog->update_info(temp_fsa_info);
|
||||
} else {
|
||||
m_fna_dialog = std::make_shared<FinishSyncAmsDialog>(temp_fsa_info);
|
||||
}
|
||||
m_fna_dialog = std::make_shared<FinishSyncAmsDialog>(temp_fsa_info);
|
||||
m_fna_dialog->on_show();
|
||||
}
|
||||
|
||||
@@ -3037,9 +3038,10 @@ void Sidebar::pop_sync_nozzle_and_ams_ialog() {
|
||||
if (m_fna_dialog) {
|
||||
m_fna_dialog->on_hide();
|
||||
}
|
||||
m_sna_dialog.reset();
|
||||
m_sna_dialog->update_info(temp_na_info);
|
||||
} else {
|
||||
m_sna_dialog = std::make_shared<SyncNozzleAndAmsDialog>(temp_na_info);
|
||||
}
|
||||
m_sna_dialog = std::make_shared<SyncNozzleAndAmsDialog>(temp_na_info);
|
||||
m_sna_dialog->on_show();
|
||||
}
|
||||
|
||||
|
||||
@@ -165,6 +165,7 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
|
||||
m_thumbnailPanel->SetMinSize(wxSize(FromDIP(198), FromDIP(198)));
|
||||
m_thumbnailPanel->SetMaxSize(wxSize(FromDIP(198), FromDIP(198)));
|
||||
m_thumbnailPanel->SetBackgroundColour(*wxWHITE);
|
||||
m_thumbnailPanel->SetToolTip(_L("If the transparency of the mapping changes, this thumbnail is for reference only."));
|
||||
m_sizer_thumbnail->Add(m_thumbnailPanel, 0, wxALIGN_CENTER, 0);
|
||||
m_panel_image->SetSizer(m_sizer_thumbnail);
|
||||
m_panel_image->Layout();
|
||||
@@ -4038,7 +4039,7 @@ void SelectMachineDialog::change_default_normal(int old_filament_id, wxColour te
|
||||
wxColour temp_ams_color_in_loop = m_cur_colors_in_thumbnail[filament_id];
|
||||
wxColour ams_color = adjust_color_for_render(temp_ams_color_in_loop);
|
||||
//change color
|
||||
new_px[3] = origin_px[3]; // alpha
|
||||
new_px[3] = ams_color.Alpha(); //origin_px[3]; // alpha
|
||||
int origin_rgb = origin_px[0] + origin_px[1] + origin_px[2];
|
||||
int no_light_px_rgb = no_light_px[0] + no_light_px[1] + no_light_px[2];
|
||||
unsigned char i = 0;
|
||||
|
||||
@@ -233,6 +233,7 @@ void SyncAmsInfoDialog::set_default_normal(const ThumbnailData &data)
|
||||
image.SetAlpha((int) c, (int) r, px[3]);
|
||||
}
|
||||
}
|
||||
//image.SaveFile("E:/preview.png", wxBITMAP_TYPE_PNG);
|
||||
image = image.Rescale(FromDIP(RIGHT_THUMBNAIL_SIZE_WIDTH), FromDIP(RIGHT_THUMBNAIL_SIZE_WIDTH));
|
||||
m_right_image_button->SetBitmap(image);
|
||||
auto extruders = wxGetApp().plater()->get_partplate_list().get_plate(m_specify_plate_idx)->get_extruders();
|
||||
@@ -459,15 +460,23 @@ void SyncAmsInfoDialog::update_more_setting(bool layout)
|
||||
|
||||
void SyncAmsInfoDialog::init_bitmaps()
|
||||
{
|
||||
m_swipe_left_bmp_normal = ScalableBitmap(this, "previous_item", m_bmp_pix_cont);
|
||||
m_swipe_left_bmp_hover = ScalableBitmap(this, "previous_item_hover", m_bmp_pix_cont);
|
||||
m_swipe_left_bmp_disable = ScalableBitmap(this, "previous_item_disable", m_bmp_pix_cont);
|
||||
m_swipe_right_bmp_normal = ScalableBitmap(this, "next_item", m_bmp_pix_cont);
|
||||
m_swipe_right_bmp_hover = ScalableBitmap(this, "next_item_hover", m_bmp_pix_cont);
|
||||
m_swipe_right_bmp_disable = ScalableBitmap(this, "next_item_disable", m_bmp_pix_cont);
|
||||
if (wxGetApp().dark_mode()) {
|
||||
m_swipe_left_bmp_normal = ScalableBitmap(this, "previous_item", m_bmp_pix_cont);
|
||||
m_swipe_left_bmp_hover = ScalableBitmap(this, "previous_item_disable", m_bmp_pix_cont);
|
||||
m_swipe_left_bmp_disable = ScalableBitmap(this, "previous_item_dark_disable", m_bmp_pix_cont);
|
||||
m_swipe_right_bmp_normal = ScalableBitmap(this, "next_item", m_bmp_pix_cont);
|
||||
m_swipe_right_bmp_hover = ScalableBitmap(this, "next_item_disable", m_bmp_pix_cont);
|
||||
m_swipe_right_bmp_disable = ScalableBitmap(this, "next_item_dark_disable", m_bmp_pix_cont);
|
||||
} else {
|
||||
m_swipe_left_bmp_normal = ScalableBitmap(this, "previous_item", m_bmp_pix_cont);
|
||||
m_swipe_left_bmp_hover = ScalableBitmap(this, "previous_item_hover", m_bmp_pix_cont);
|
||||
m_swipe_left_bmp_disable = ScalableBitmap(this, "previous_item_disable", m_bmp_pix_cont);
|
||||
m_swipe_right_bmp_normal = ScalableBitmap(this, "next_item", m_bmp_pix_cont);
|
||||
m_swipe_right_bmp_hover = ScalableBitmap(this, "next_item_hover", m_bmp_pix_cont);
|
||||
m_swipe_right_bmp_disable = ScalableBitmap(this, "next_item_disable", m_bmp_pix_cont);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SyncAmsInfoDialog::add_two_image_control()
|
||||
{// thumbnail
|
||||
m_two_thumbnail_panel = new StaticBox(this);
|
||||
@@ -515,6 +524,7 @@ void SyncAmsInfoDialog::add_two_image_control()
|
||||
wxSize(FromDIP(RIGHT_THUMBNAIL_SIZE_WIDTH), FromDIP(RIGHT_THUMBNAIL_SIZE_WIDTH)),
|
||||
wxBORDER_NONE | wxBU_AUTODRAW);
|
||||
m_right_image_button->SetBackgroundColour(wxGetApp().dark_mode() ? wxColour(61, 61, 61, 0) : wxColour(238, 238, 238, 0));
|
||||
m_right_image_button->SetToolTip(_L("If the transparency of the mapping changes, this thumbnail is for reference only."));
|
||||
m_right_sizer_thumbnail = create_sizer_thumbnail(m_right_image_button, false);
|
||||
m_two_image_panel_sizer->Add(m_right_sizer_thumbnail, FromDIP(0), wxALIGN_LEFT | wxEXPAND | wxRIGHT | wxTOP | wxBOTTOM, FromDIP(8));
|
||||
m_two_image_panel->SetSizer(m_two_image_panel_sizer);
|
||||
@@ -4147,7 +4157,7 @@ void SyncAmsInfoDialog::change_default_normal(int old_filament_id, wxColour temp
|
||||
wxColour temp_ams_color_in_loop = m_cur_colors_in_thumbnail[filament_id];
|
||||
wxColour ams_color = adjust_color_for_render(temp_ams_color_in_loop);
|
||||
// change color
|
||||
new_px[3] = origin_px[3]; // alpha
|
||||
new_px[3] = ams_color.Alpha(); //origin_px[3]; // alpha
|
||||
int origin_rgb = origin_px[0] + origin_px[1] + origin_px[2];
|
||||
int no_light_px_rgb = no_light_px[0] + no_light_px[1] + no_light_px[2];
|
||||
unsigned char i = 0;
|
||||
@@ -4310,6 +4320,12 @@ void SyncNozzleAndAmsDialog::deal_cancel()
|
||||
call_start_gradual_disappearance();
|
||||
}
|
||||
|
||||
void SyncNozzleAndAmsDialog::update_info(InputInfo &info) {
|
||||
m_input_info = info;
|
||||
restart();
|
||||
SetPosition(m_input_info.dialog_pos);
|
||||
}
|
||||
|
||||
FinishSyncAmsDialog::FinishSyncAmsDialog(InputInfo &input_info)
|
||||
: BaseTransparentDPIFrame(static_cast<wxWindow *>(wxGetApp().mainframe),
|
||||
300,
|
||||
@@ -4331,4 +4347,11 @@ void FinishSyncAmsDialog::deal_ok() {
|
||||
call_start_gradual_disappearance();
|
||||
}
|
||||
|
||||
void FinishSyncAmsDialog::update_info(InputInfo &info)
|
||||
{
|
||||
m_input_info = info;
|
||||
restart();
|
||||
SetPosition(m_input_info.dialog_pos);
|
||||
}
|
||||
|
||||
}} // namespace Slic3r
|
||||
@@ -366,6 +366,8 @@ public:
|
||||
~SyncNozzleAndAmsDialog() override;
|
||||
void deal_ok() override;
|
||||
void deal_cancel() override;
|
||||
void update_info(InputInfo& info);
|
||||
|
||||
private:
|
||||
InputInfo& m_input_info;
|
||||
};
|
||||
@@ -381,6 +383,8 @@ public:
|
||||
FinishSyncAmsDialog(InputInfo &input_info);
|
||||
~FinishSyncAmsDialog() override;
|
||||
void deal_ok();
|
||||
void update_info(InputInfo &info);
|
||||
|
||||
private:
|
||||
InputInfo& m_input_info;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user