mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 08:47:52 -06:00
Mirror component of transformations set as default
This commit is contained in:
parent
da37094a09
commit
00222226ed
15 changed files with 10 additions and 246 deletions
|
@ -932,9 +932,7 @@ private:
|
|||
bool layers_height_allowed() const;
|
||||
bool can_delete_all() const;
|
||||
bool can_arrange() const;
|
||||
#if ENABLE_MIRROR
|
||||
bool can_mirror() const;
|
||||
#endif // ENABLE_MIRROR
|
||||
#endif // ENABLE_EXTENDED_SELECTION
|
||||
};
|
||||
|
||||
|
@ -1617,38 +1615,9 @@ void Plater::priv::rotate()
|
|||
|
||||
void Plater::priv::mirror(Axis axis)
|
||||
{
|
||||
#if ENABLE_MIRROR
|
||||
#if ENABLE_EXTENDED_SELECTION
|
||||
_3DScene::mirror_selection(canvas3D, axis);
|
||||
#endif // ENABLE_EXTENDED_SELECTION
|
||||
#else
|
||||
#if ENABLE_EXTENDED_SELECTION
|
||||
int obj_idx = get_selected_object_idx();
|
||||
if (obj_idx == -1)
|
||||
return;
|
||||
|
||||
ModelObject* model_object = model.objects[obj_idx];
|
||||
ModelInstance* model_instance = model_object->instances.front();
|
||||
#else
|
||||
const auto obj_idx = selected_object();
|
||||
if (! obj_idx) { return; }
|
||||
|
||||
auto *model_object = model.objects[*obj_idx];
|
||||
auto *model_instance = model_object->instances[0];
|
||||
#endif // ENABLE_EXTENDED_SELECTION
|
||||
|
||||
// XXX: ?
|
||||
// # apply Z rotation before mirroring
|
||||
// if ($model_instance->rotation != 0) {
|
||||
// $model_object->rotate($model_instance->rotation, Slic3r::Pointf3->new(0, 0, 1));
|
||||
// $_->set_rotation(0) for @{ $model_object->instances };
|
||||
// }
|
||||
|
||||
model_object->mirror(axis);
|
||||
|
||||
selection_changed();
|
||||
update();
|
||||
#endif // ENABLE_MIRROR
|
||||
}
|
||||
|
||||
#if !ENABLE_EXTENDED_SELECTION
|
||||
|
@ -2109,7 +2078,6 @@ bool Plater::priv::init_object_menu()
|
|||
|
||||
object_menu.AppendSeparator();
|
||||
|
||||
#if ENABLE_MIRROR
|
||||
wxMenu* mirror_menu = new wxMenu();
|
||||
if (mirror_menu == nullptr)
|
||||
return false;
|
||||
|
@ -2122,7 +2090,6 @@ bool Plater::priv::init_object_menu()
|
|||
[this](wxCommandEvent&) { mirror(Z); }, "bullet_blue.png", &object_menu);
|
||||
|
||||
wxMenuItem* item_mirror = append_submenu(&object_menu, mirror_menu, wxID_ANY, _(L("Mirror")), _(L("Mirror the selected object")));
|
||||
#endif // ENABLE_MIRROR
|
||||
|
||||
wxMenu* split_menu = new wxMenu();
|
||||
if (split_menu == nullptr)
|
||||
|
@ -2139,9 +2106,7 @@ bool Plater::priv::init_object_menu()
|
|||
// ui updates needs to be binded to the parent panel
|
||||
if (q != nullptr)
|
||||
{
|
||||
#if ENABLE_MIRROR
|
||||
q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_mirror()); }, item_mirror->GetId());
|
||||
#endif // ENABLE_MIRROR
|
||||
q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_delete_object()); }, item_delete->GetId());
|
||||
q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_increase_instances()); }, item_increase->GetId());
|
||||
q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_decrease_instances()); }, item_decrease->GetId());
|
||||
|
@ -2208,12 +2173,10 @@ bool Plater::priv::can_arrange() const
|
|||
return !model.objects.empty();
|
||||
}
|
||||
|
||||
#if ENABLE_MIRROR
|
||||
bool Plater::priv::can_mirror() const
|
||||
{
|
||||
return get_selection().is_from_single_instance();
|
||||
}
|
||||
#endif // ENABLE_MIRROR
|
||||
#endif // ENABLE_EXTENDED_SELECTION
|
||||
|
||||
// Plater / Public
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue