Code cleanup

This commit is contained in:
Enrico Turri 2019-05-24 15:22:27 +02:00
parent 734d946912
commit bf9740188a
8 changed files with 0 additions and 31 deletions

View file

@ -46,7 +46,4 @@
#define ENABLE_SVG_ICONS (1 && ENABLE_1_42_0_ALPHA8 && ENABLE_TEXTURES_FROM_SVG)
// Enable scale object to fit print volume
#define ENABLE_SCALE_TO_FIT_PRINT_VOLUME 1
#endif // _technologies_h_

View file

@ -1284,13 +1284,11 @@ void ObjectList::append_menu_item_delete(wxMenu* menu)
[this](wxCommandEvent&) { remove(); }, "", menu);
}
#if ENABLE_SCALE_TO_FIT_PRINT_VOLUME
void ObjectList::append_menu_item_scale_selection_to_fit_print_volume(wxMenu* menu)
{
append_menu_item(menu, wxID_ANY, _(L("Scale to print volume")), _(L("Scale the selected object to fit the print volume")),
[this](wxCommandEvent&) { wxGetApp().plater()->scale_selection_to_fit_print_volume(); }, "", menu);
}
#endif // ENABLE_SCALE_TO_FIT_PRINT_VOLUME
void ObjectList::create_object_popupmenu(wxMenu *menu)
{
@ -1300,9 +1298,7 @@ void ObjectList::create_object_popupmenu(wxMenu *menu)
append_menu_item_export_stl(menu);
append_menu_item_fix_through_netfabb(menu);
#if ENABLE_SCALE_TO_FIT_PRINT_VOLUME
append_menu_item_scale_selection_to_fit_print_volume(menu);
#endif // ENABLE_SCALE_TO_FIT_PRINT_VOLUME
// Split object to parts
m_menu_item_split = append_menu_item_split(menu);

View file

@ -207,9 +207,7 @@ public:
void append_menu_item_export_stl(wxMenu* menu) const ;
void append_menu_item_change_extruder(wxMenu* menu) const;
void append_menu_item_delete(wxMenu* menu);
#if ENABLE_SCALE_TO_FIT_PRINT_VOLUME
void append_menu_item_scale_selection_to_fit_print_volume(wxMenu* menu);
#endif // ENABLE_SCALE_TO_FIT_PRINT_VOLUME
void create_object_popupmenu(wxMenu *menu);
void create_sla_object_popupmenu(wxMenu*menu);
void create_part_popupmenu(wxMenu*menu);

View file

@ -847,7 +847,6 @@ bool GLGizmosManager::on_char(wxKeyEvent& evt, GLCanvas3D& canvas)
break;
}
#if ENABLE_SCALE_TO_FIT_PRINT_VOLUME
case 'F':
case 'f':
{
@ -861,7 +860,6 @@ bool GLGizmosManager::on_char(wxKeyEvent& evt, GLCanvas3D& canvas)
break;
}
#endif // ENABLE_SCALE_TO_FIT_PRINT_VOLUME
}
}

View file

@ -1302,9 +1302,7 @@ struct Plater::priv
void sla_optimize_rotation();
void split_object();
void split_volume();
#if ENABLE_SCALE_TO_FIT_PRINT_VOLUME
void scale_selection_to_fit_print_volume();
#endif // ENABLE_SCALE_TO_FIT_PRINT_VOLUME
bool background_processing_enabled() const { return this->get_config("background_processing") == "1"; }
void update_print_volume_state();
void schedule_background_process();
@ -2367,12 +2365,10 @@ void Plater::priv::split_volume()
wxGetApp().obj_list()->split();
}
#if ENABLE_SCALE_TO_FIT_PRINT_VOLUME
void Plater::priv::scale_selection_to_fit_print_volume()
{
this->view3D->get_canvas3d()->get_selection().scale_to_fit_print_volume(*config);
}
#endif // ENABLE_SCALE_TO_FIT_PRINT_VOLUME
void Plater::priv::schedule_background_process()
{
@ -3036,9 +3032,7 @@ bool Plater::priv::init_common_menu(wxMenu* menu, const bool is_part/* = false*/
sidebar->obj_list()->append_menu_item_fix_through_netfabb(menu);
#if ENABLE_SCALE_TO_FIT_PRINT_VOLUME
sidebar->obj_list()->append_menu_item_scale_selection_to_fit_print_volume(menu);
#endif // ENABLE_SCALE_TO_FIT_PRINT_VOLUME
wxMenu* mirror_menu = new wxMenu();
if (mirror_menu == nullptr)
@ -3479,12 +3473,10 @@ bool Plater::is_selection_empty() const
return p->get_selection().is_empty() || p->get_selection().is_wipe_tower();
}
#if ENABLE_SCALE_TO_FIT_PRINT_VOLUME
void Plater::scale_selection_to_fit_print_volume()
{
p->scale_selection_to_fit_print_volume();
}
#endif // ENABLE_SCALE_TO_FIT_PRINT_VOLUME
void Plater::cut(size_t obj_idx, size_t instance_idx, coordf_t z, bool keep_upper, bool keep_lower, bool rotate_lower)
{

View file

@ -162,9 +162,7 @@ public:
void decrease_instances(size_t num = 1);
void set_number_of_copies(/*size_t num*/);
bool is_selection_empty() const;
#if ENABLE_SCALE_TO_FIT_PRINT_VOLUME
void scale_selection_to_fit_print_volume();
#endif // ENABLE_SCALE_TO_FIT_PRINT_VOLUME
void cut(size_t obj_idx, size_t instance_idx, coordf_t z, bool keep_upper = true, bool keep_lower = true, bool rotate_lower = false);

View file

@ -662,7 +662,6 @@ void Selection::scale(const Vec3d& scale, TransformationType transformation_type
{
GLVolume &volume = *(*m_volumes)[i];
if (is_single_full_instance()) {
#if ENABLE_SCALE_TO_FIT_PRINT_VOLUME
if (transformation_type.relative())
{
Transform3d m = Geometry::assemble_transform(Vec3d::Zero(), Vec3d::Zero(), scale);
@ -676,9 +675,6 @@ void Selection::scale(const Vec3d& scale, TransformationType transformation_type
}
else
{
#else
assert(transformation_type.absolute());
#endif // ENABLE_SCALE_TO_FIT_PRINT_VOLUME
if (transformation_type.world() && (std::abs(scale.x() - scale.y()) > EPSILON || std::abs(scale.x() - scale.z()) > EPSILON)) {
// Non-uniform scaling. Transform the scaling factors into the local coordinate system.
// This is only possible, if the instance rotation is mulitples of ninety degrees.
@ -687,9 +683,7 @@ void Selection::scale(const Vec3d& scale, TransformationType transformation_type
}
else
volume.set_instance_scaling_factor(scale);
#if ENABLE_SCALE_TO_FIT_PRINT_VOLUME
}
#endif // ENABLE_SCALE_TO_FIT_PRINT_VOLUME
}
else if (is_single_volume() || is_single_modifier())
volume.set_volume_scaling_factor(scale);
@ -733,7 +727,6 @@ void Selection::scale(const Vec3d& scale, TransformationType transformation_type
this->set_bounding_boxes_dirty();
}
#if ENABLE_SCALE_TO_FIT_PRINT_VOLUME
void Selection::scale_to_fit_print_volume(const DynamicPrintConfig& config)
{
if (is_empty() || (m_mode == Volume))
@ -776,7 +769,6 @@ void Selection::scale_to_fit_print_volume(const DynamicPrintConfig& config)
}
}
}
#endif // ENABLE_SCALE_TO_FIT_PRINT_VOLUME
void Selection::mirror(Axis axis)
{

View file

@ -287,9 +287,7 @@ public:
void rotate(const Vec3d& rotation, TransformationType transformation_type);
void flattening_rotate(const Vec3d& normal);
void scale(const Vec3d& scale, TransformationType transformation_type);
#if ENABLE_SCALE_TO_FIT_PRINT_VOLUME
void scale_to_fit_print_volume(const DynamicPrintConfig& config);
#endif // ENABLE_SCALE_TO_FIT_PRINT_VOLUME
void mirror(Axis axis);
void translate(unsigned int object_idx, const Vec3d& displacement);