This commit is contained in:
bubnikv 2019-01-03 16:37:03 +01:00
commit 206f16f374
6 changed files with 18 additions and 3 deletions

View file

@ -719,12 +719,13 @@ ModelInstance* ModelObject::add_instance(const ModelInstance &other)
return i; return i;
} }
ModelInstance* ModelObject::add_instance(const Vec3d &offset, const Vec3d &scaling_factor, const Vec3d &rotation) ModelInstance* ModelObject::add_instance(const Vec3d &offset, const Vec3d &scaling_factor, const Vec3d &rotation, const Vec3d &mirror)
{ {
auto *instance = add_instance(); auto *instance = add_instance();
instance->set_offset(offset); instance->set_offset(offset);
instance->set_scaling_factor(scaling_factor); instance->set_scaling_factor(scaling_factor);
instance->set_rotation(rotation); instance->set_rotation(rotation);
instance->set_mirror(mirror);
return instance; return instance;
} }

View file

@ -200,7 +200,7 @@ public:
ModelInstance* add_instance(); ModelInstance* add_instance();
ModelInstance* add_instance(const ModelInstance &instance); ModelInstance* add_instance(const ModelInstance &instance);
ModelInstance* add_instance(const Vec3d &offset, const Vec3d &scaling_factor, const Vec3d &rotation); ModelInstance* add_instance(const Vec3d &offset, const Vec3d &scaling_factor, const Vec3d &rotation, const Vec3d &mirror);
void delete_instance(size_t idx); void delete_instance(size_t idx);
void delete_last_instance(); void delete_last_instance();
void clear_instances(); void clear_instances();

View file

@ -3118,6 +3118,13 @@ CLIConfigDef::CLIConfigDef()
const CLIConfigDef cli_config_def; const CLIConfigDef cli_config_def;
DynamicPrintAndCLIConfig::PrintAndCLIConfigDef DynamicPrintAndCLIConfig::s_def; DynamicPrintAndCLIConfig::PrintAndCLIConfigDef DynamicPrintAndCLIConfig::s_def;
void DynamicPrintAndCLIConfig::handle_legacy(t_config_option_key &opt_key, std::string &value) const
{
if (cli_config_def.options.find(opt_key) == cli_config_def.options.end()) {
PrintConfigDef::handle_legacy(opt_key, value);
}
}
std::ostream& print_cli_options(std::ostream& out) std::ostream& print_cli_options(std::ostream& out)
{ {
for (const auto& opt : cli_config_def.options) { for (const auto& opt : cli_config_def.options) {

View file

@ -1171,6 +1171,12 @@ public:
const ConfigDef* def() const override { return &s_def; } const ConfigDef* def() const override { return &s_def; }
t_config_option_keys keys() const override { return s_def.keys(); } t_config_option_keys keys() const override { return s_def.keys(); }
// Verify whether the opt_key has not been obsoleted or renamed.
// Both opt_key and value may be modified by handle_legacy().
// If the opt_key is no more valid in this version of Slic3r, opt_key is cleared by handle_legacy().
// handle_legacy() is called internally by set_deserialize().
void handle_legacy(t_config_option_key &opt_key, std::string &value) const override;
private: private:
class PrintAndCLIConfigDef : public ConfigDef class PrintAndCLIConfigDef : public ConfigDef
{ {

View file

@ -4896,6 +4896,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
} }
m_mouse.set_start_position_2D_as_invalid(); m_mouse.set_start_position_2D_as_invalid();
m_mouse.set_start_position_3D_as_invalid();
#endif #endif
} }
else if (evt.Leaving()) else if (evt.Leaving())

View file

@ -2628,7 +2628,7 @@ void Plater::increase_instances(size_t num)
float offset = 10.0; float offset = 10.0;
for (size_t i = 0; i < num; i++, offset += 10.0) { for (size_t i = 0; i < num; i++, offset += 10.0) {
Vec3d offset_vec = model_instance->get_offset() + Vec3d(offset, offset, 0.0); Vec3d offset_vec = model_instance->get_offset() + Vec3d(offset, offset, 0.0);
model_object->add_instance(offset_vec, model_instance->get_scaling_factor(), model_instance->get_rotation()); model_object->add_instance(offset_vec, model_instance->get_scaling_factor(), model_instance->get_rotation(), model_instance->get_mirror());
// p->print.get_object(obj_idx)->add_copy(Slic3r::to_2d(offset_vec)); // p->print.get_object(obj_idx)->add_copy(Slic3r::to_2d(offset_vec));
} }