Duplicate Current Plate With Objects (Second PR) (#6710)

* Added `duplicate plate` feature.

This the initial commit and this still needs work.

* [#2025] Fixed the SEGFAULT, apparently an icon id=6 needed to be updated to id=7 as we have one more plate icon.
[#2025] Removed the `printf` statements.

* [#2025] Plate duplication is now fully implemented.

* [#2025] Updated icons for plate duplicate funcctionality.

* [#2025] Added toolbar icon fro "Duplicate Current Plate" action.

* [#2025] Revert changes for `toolbar_add_plate_dark.svg`.

* [#2025] Removed the `BBS` label in the code that is not written by BBS.

* [#2025] Updated `.gitignore` to ignore VSCode workspace file.

* [#2025] Fixed the instances not transforming in global space when the plate is duplicated.

* [#2025] Removed the Duplicate Plate action from the plate actions and the toolbar.

* [#2025] Added the `Duplicate Current Plate` functionality to the `Edit` menu.

* [#2025] Addressed review comments.

* [#2025] Addressed review comments.

* [#2025] Removed unused icons related to the previously introduced "Duplicate Plate" functionality.
This commit is contained in:
Erkan Ozgur Yilmaz 2024-09-10 16:43:41 +01:00 committed by GitHub
parent d87734ebfa
commit 2b4cd6577b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 71 additions and 9 deletions

View file

@ -2951,19 +2951,19 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
view3D_canvas->Bind(EVT_GLCANVAS_PLATE_RIGHT_CLICK, &priv::on_plate_right_click, this);
view3D_canvas->Bind(EVT_GLCANVAS_REMOVE_OBJECT, [q](SimpleEvent&) { q->remove_selected(); });
view3D_canvas->Bind(EVT_GLCANVAS_ARRANGE, [this](SimpleEvent& evt) {
//BBS arrage from EVT set default state.
//BBS arrange from EVT set default state.
this->q->set_prepare_state(Job::PREPARE_STATE_DEFAULT);
this->q->arrange(); });
view3D_canvas->Bind(EVT_GLCANVAS_ARRANGE_PARTPLATE, [this](SimpleEvent& evt) {
//BBS arrage from EVT set default state.
//BBS arrange from EVT set default state.
this->q->set_prepare_state(Job::PREPARE_STATE_MENU);
this->q->arrange(); });
view3D_canvas->Bind(EVT_GLCANVAS_ORIENT, [this](SimpleEvent& evt) {
//BBS oriant from EVT set default state.
//BBS orient from EVT set default state.
this->q->set_prepare_state(Job::PREPARE_STATE_DEFAULT);
this->q->orient(); });
view3D_canvas->Bind(EVT_GLCANVAS_ORIENT_PARTPLATE, [this](SimpleEvent& evt) {
//BBS oriant from EVT set default state.
//BBS orient from EVT set default state.
this->q->set_prepare_state(Job::PREPARE_STATE_MENU);
this->q->orient(); });
//BBS
@ -3002,11 +3002,11 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
view3D_canvas->Bind(EVT_GLTOOLBAR_ADD_PLATE, &priv::on_action_add_plate, this);
view3D_canvas->Bind(EVT_GLTOOLBAR_DEL_PLATE, &priv::on_action_del_plate, this);
view3D_canvas->Bind(EVT_GLTOOLBAR_ORIENT, [this](SimpleEvent&) {
//BBS arrage from EVT set default state.
//BBS arrange from EVT set default state.
this->q->set_prepare_state(Job::PREPARE_STATE_DEFAULT);
this->q->orient(); });
view3D_canvas->Bind(EVT_GLTOOLBAR_ARRANGE, [this](SimpleEvent&) {
//BBS arrage from EVT set default state.
//BBS arrange from EVT set default state.
this->q->set_prepare_state(Job::PREPARE_STATE_DEFAULT);
this->q->arrange();
});
@ -13997,6 +13997,19 @@ int Plater::select_plate_by_hover_id(int hover_id, bool right_click, bool isModi
return ret;
}
int Plater::duplicate_plate(int plate_index)
{
int index = plate_index, ret;
if (plate_index == -1)
index = p->partplate_list.get_curr_plate_index();
ret = p->partplate_list.duplicate_plate(index);
//need to call update
update();
return ret;
}
//BBS: delete the plate, index= -1 means the current plate
int Plater::delete_plate(int plate_index)
{