diff --git a/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp b/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp index 5e68577c47..0c7664bc26 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp @@ -474,13 +474,8 @@ bool GLGizmoEmboss::process() data.text_configuration = create_configuration(); data.volume_name = create_volume_name(); data.volume_ptr = m_volume; + data.object_idx = m_parent.get_selection().get_object_idx(); - const Selection &selection = m_parent.get_selection(); - if (!selection.is_empty() && selection.get_object_idx() >= 0) { - int object_idx = selection.get_object_idx(); - Model &model = wxGetApp().plater()->model(); - data.object_ptr = model.objects[object_idx]; - } m_job->restart(data); return true; diff --git a/src/slic3r/GUI/Jobs/EmbossJob.cpp b/src/slic3r/GUI/Jobs/EmbossJob.cpp index fe731710ae..07baae11ce 100644 --- a/src/slic3r/GUI/Jobs/EmbossJob.cpp +++ b/src/slic3r/GUI/Jobs/EmbossJob.cpp @@ -91,8 +91,8 @@ void EmbossJob::finalize() { plater->take_snapshot(_L("Emboss text") + ": " + name); ModelVolume *volume = m_data->volume_ptr; if (volume == nullptr) { - // decide to add as volume or new object - if (m_data->object_ptr == nullptr) { + // decide to add as volume or new object + if (m_data->object_idx < 0) { // create new object app.obj_list()->load_mesh_object(tm, name, true, &m_data->text_configuration); app.mainframe->update_title(); @@ -106,8 +106,9 @@ void EmbossJob::finalize() { return; } else { // create new volume inside of object - ModelObject *obj = m_data->object_ptr; - volume = obj->add_volume(std::move(tm)); + Model & model = wxGetApp().plater()->model(); + ModelObject *obj = model.objects[m_data->object_idx]; + volume = obj->add_volume(std::move(tm)); // set a default extruder value, since user can't add it manually volume->config.set_key_value("extruder", new ConfigOptionInt(0)); @@ -134,9 +135,6 @@ void EmbossJob::finalize() { // Job promiss to refresh is not working canvas->reload_scene(true); - - // set data to model - Job::finalize(); } void EmbossJob::select_volume(ModelVolume *volume) diff --git a/src/slic3r/GUI/Jobs/EmbossJob.hpp b/src/slic3r/GUI/Jobs/EmbossJob.hpp index f217b419af..1a363e8a95 100644 --- a/src/slic3r/GUI/Jobs/EmbossJob.hpp +++ b/src/slic3r/GUI/Jobs/EmbossJob.hpp @@ -22,13 +22,16 @@ class EmbossJob : protected Job public: struct Data { + // Pointer on Data of font(glyoh shapes) std::shared_ptr font; + // font item is not used for create object TextConfiguration text_configuration; + // new volume name created from text std::string volume_name; - // when nulltrp new volume will be created + // when volume_ptr == nullptr than new volume will be created ModelVolume *volume_ptr; - // when nullptr volume is created in new object - ModelObject *object_ptr; + // when volume_ptr == nullptr && object_idx < 0 than new object will be created + int object_idx; }; EmbossJob(); void restart(const Data &data);