mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-19 19:33:47 +00:00
FIX: Correct auto-calc of flush value and default color picker selection
jira: STUDIO-13718, STUDIO-13666 Change-Id: I5dd08d3ed46423ba6b3c6cb4c022cfc36f46c620 (cherry picked from commit 173a6ee070d6b5e1ac445f0ebdc4c2fdd145e253)
This commit is contained in:
@@ -826,15 +826,6 @@ PlaterPresetComboBox::PlaterPresetComboBox(wxWindow *parent, Preset::Type preset
|
|||||||
clr_picker->SetBackgroundColour(StateColor::darkModeColorFor(*wxWHITE));
|
clr_picker->SetBackgroundColour(StateColor::darkModeColorFor(*wxWHITE));
|
||||||
clr_picker->SetToolTip(_L("Click to select filament color"));
|
clr_picker->SetToolTip(_L("Click to select filament color"));
|
||||||
clr_picker->Bind(wxEVT_BUTTON, [this](wxCommandEvent& e) {
|
clr_picker->Bind(wxEVT_BUTTON, [this](wxCommandEvent& e) {
|
||||||
m_clrData.SetColour(clr_picker->GetBackgroundColour());
|
|
||||||
m_clrData.SetChooseFull(true);
|
|
||||||
m_clrData.SetChooseAlpha(false);
|
|
||||||
|
|
||||||
std::vector<std::string> colors = wxGetApp().app_config->get_custom_color_from_config();
|
|
||||||
for (int i = 0; i < colors.size(); i++) {
|
|
||||||
m_clrData.SetCustomColour(i, string_to_wxColor(colors[i]));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if it's an official filament
|
// Check if it's an official filament
|
||||||
auto fila_type = Preset::remove_suffix_modified(GetValue().ToUTF8().data());
|
auto fila_type = Preset::remove_suffix_modified(GetValue().ToUTF8().data());
|
||||||
bool is_official = boost::algorithm::starts_with(fila_type, "Bambu");
|
bool is_official = boost::algorithm::starts_with(fila_type, "Bambu");
|
||||||
@@ -877,6 +868,9 @@ PlaterPresetComboBox::PlaterPresetComboBox(wxWindow *parent, Preset::Type preset
|
|||||||
} else {
|
} else {
|
||||||
show_default_color_picker();
|
show_default_color_picker();
|
||||||
}
|
}
|
||||||
|
wxCommandEvent *evt = new wxCommandEvent(EVT_FILAMENT_COLOR_CHANGED);
|
||||||
|
evt->SetInt(m_filament_idx);
|
||||||
|
wxQueueEvent(wxGetApp().plater(), evt);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -1431,10 +1425,20 @@ FilamentColor PlaterPresetComboBox::get_cur_color_info()
|
|||||||
|
|
||||||
void PlaterPresetComboBox::show_default_color_picker()
|
void PlaterPresetComboBox::show_default_color_picker()
|
||||||
{
|
{
|
||||||
|
DynamicPrintConfig* cfg = &wxGetApp().preset_bundle->project_config;
|
||||||
|
auto colors = static_cast<ConfigOptionStrings*>(cfg->option("filament_colour")->clone());
|
||||||
|
wxColour current_clr(colors->values[m_filament_idx]);
|
||||||
|
if (!current_clr.IsOk())
|
||||||
|
current_clr = wxColour(0, 0, 0); // Don't set alfa to transparence
|
||||||
|
|
||||||
|
m_clrData.SetColour(current_clr);
|
||||||
|
|
||||||
wxColourData data = show_sys_picker_dialog(this, m_clrData);
|
wxColourData data = show_sys_picker_dialog(this, m_clrData);
|
||||||
std::vector<std::string> color = {data.GetColour().GetAsString(wxC2S_HTML_SYNTAX).ToStdString()};
|
if (m_clrData.GetColour() != data.GetColour()) {
|
||||||
m_clrData.SetColour(data.GetColour());
|
std::vector<std::string> color = {data.GetColour().GetAsString(wxC2S_HTML_SYNTAX).ToStdString()};
|
||||||
sync_colour_config(color, false);
|
m_clrData.SetColour(data.GetColour());
|
||||||
|
sync_colour_config(color, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlaterPresetComboBox::sync_colour_config(const std::vector<std::string> &clrs, bool is_gradient)
|
void PlaterPresetComboBox::sync_colour_config(const std::vector<std::string> &clrs, bool is_gradient)
|
||||||
@@ -1471,10 +1475,6 @@ void PlaterPresetComboBox::sync_colour_config(const std::vector<std::string> &cl
|
|||||||
update(); // refresh the preset combobox with new config
|
update(); // refresh the preset combobox with new config
|
||||||
|
|
||||||
wxGetApp().plater()->on_config_change(cfg_new);
|
wxGetApp().plater()->on_config_change(cfg_new);
|
||||||
|
|
||||||
wxCommandEvent *evt = new wxCommandEvent(EVT_CALI_TRAY_CHANGED);
|
|
||||||
evt->SetInt(m_filament_idx);
|
|
||||||
wxQueueEvent(wxGetApp().plater(), evt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------
|
// ---------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user