This commit is contained in:
bubnikv 2020-01-02 16:40:46 +01:00
commit c74ba012e2
5 changed files with 80 additions and 9 deletions

View file

@ -87,6 +87,7 @@ const char* V3_ATTR = "v3";
const char* OBJECTID_ATTR = "objectid";
const char* TRANSFORM_ATTR = "transform";
const char* PRINTABLE_ATTR = "printable";
const char* INSTANCESCOUNT_ATTR = "instances_count";
const char* KEY_ATTR = "key";
const char* VALUE_ATTR = "value";
@ -1613,6 +1614,9 @@ namespace Slic3r {
return false;
}
// Added because of github #3435, currently not used by PrusaSlicer
int instances_count_id = get_attribute_value_int(attributes, num_attributes, INSTANCESCOUNT_ATTR);
m_objects_metadata.insert(IdToMetadataMap::value_type(object_id, ObjectMetadata()));
m_curr_config.object_id = object_id;
return true;
@ -2495,7 +2499,8 @@ namespace Slic3r {
const ModelObject* obj = obj_metadata.second.object;
if (obj != nullptr)
{
stream << " <" << OBJECT_TAG << " id=\"" << obj_metadata.first << "\">\n";
// Output of instances count added because of github #3435, currently not used by PrusaSlicer
stream << " <" << OBJECT_TAG << " " << ID_ATTR << "=\"" << obj_metadata.first << "\" " << INSTANCESCOUNT_ATTR << "=\"" << obj->instances.size() << "\">\n";
// stores object's name
if (!obj->name.empty())

View file

@ -1605,7 +1605,27 @@ void ConfigWizard::priv::on_3rdparty_install(const VendorProfile *vendor, bool i
load_pages();
}
bool ConfigWizard::priv::check_material_config(Technology technology)
bool ConfigWizard::priv::on_bnt_finish()
{
/* When Filaments or Sla Materials pages are activated,
* materials for this pages are automaticaly updated and presets are reloaded.
*
* But, if _Finish_ button was clicked without activation of those pages
* (for example, just some printers were added/deleted),
* than last changes wouldn't be updated for filaments/materials.
* SO, do that before close of Wizard
*/
update_materials(T_ANY);
if (any_fff_selected)
page_filaments->reload_presets();
if (any_sla_selected)
page_sla_materials->reload_presets();
// check, that there is selected at least one filament/material
return check_materials_in_config(T_ANY);
}
bool ConfigWizard::priv::check_materials_in_config(Technology technology)
{
const auto exist_preset = [this](const std::string& section, const Materials& materials)
{
@ -1899,16 +1919,15 @@ ConfigWizard::ConfigWizard(wxWindow *parent)
// check, that there is selected at least one filament/material
ConfigWizardPage* active_page = this->p->index->active_page();
if ( (active_page == p->page_filaments || active_page == p->page_sla_materials)
&& !p->check_material_config(dynamic_cast<PageMaterials*>(active_page)->materials->technology))
&& !p->check_materials_in_config(dynamic_cast<PageMaterials*>(active_page)->materials->technology))
return;
this->p->index->go_next();
});
p->btn_finish->Bind(wxEVT_BUTTON, [this](const wxCommandEvent &)
{
if (!p->check_material_config(T_ANY))
return;
this->EndModal(wxID_OK);
if (p->on_bnt_finish())
this->EndModal(wxID_OK);
});
p->btn_sel_all->Bind(wxEVT_BUTTON, [this](const wxCommandEvent &) {

View file

@ -489,7 +489,8 @@ struct ConfigWizard::priv
void on_printer_pick(PagePrinters *page, const PrinterPickerEvent &evt);
void on_3rdparty_install(const VendorProfile *vendor, bool install);
bool check_material_config(Technology technology);
bool on_bnt_finish();
bool check_materials_in_config(Technology technology);
void apply_config(AppConfig *app_config, PresetBundle *preset_bundle, const PresetUpdater *updater);
// #ys_FIXME_alise
void update_presets_in_config(const std::string& section, const std::string& alias_key, bool add);

View file

@ -311,11 +311,11 @@ void Mouse3DController::render_settings_dialog(unsigned int canvas_width, unsign
ImGui::PopStyleColor();
float translation_scale = (float)m_state.get_translation_scale() / State::DefaultTranslationScale;
if (imgui.slider_float(_(L("Translation")) + "##1", &translation_scale, 0.5f, 2.0f, "%.1f"))
if (imgui.slider_float(_(L("Translation")) + "##1", &translation_scale, 0.5f, 5.0f, "%.1f"))
m_state.set_translation_scale(State::DefaultTranslationScale * (double)translation_scale);
float rotation_scale = m_state.get_rotation_scale() / State::DefaultRotationScale;
if (imgui.slider_float(_(L("Rotation")) + "##1", &rotation_scale, 0.5f, 2.0f, "%.1f"))
if (imgui.slider_float(_(L("Rotation")) + "##1", &rotation_scale, 0.5f, 5.0f, "%.1f"))
m_state.set_rotation_scale(State::DefaultRotationScale * rotation_scale);
ImGui::Separator();