OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::Emboss::UpdateJob Class Reference

Update text shape in existing text volume Predict that there is only one runnig(not canceled) instance of it. More...

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/Jobs/EmbossJob.hpp>

Inheritance diagram for Slic3r::GUI::Emboss::UpdateJob:
Collaboration diagram for Slic3r::GUI::Emboss::UpdateJob:

Public Types

enum  JobPrepareState { PREPARE_STATE_DEFAULT = 0 , PREPARE_STATE_MENU = 1 }

Public Member Functions

 UpdateJob (DataUpdate &&input)
 Update Volume.
void process (Ctl &ctl) override
 Create new embossed volume by m_input data and store to m_result.
void finalize (bool canceled, std::exception_ptr &eptr) override
 Update volume - change object_id.

Static Public Member Functions

static void update_volume (ModelVolume *volume, TriangleMesh &&mesh, const DataBase &base)
 Update text volume.

Private Attributes

DataUpdate m_input
TriangleMesh m_result

Detailed Description

Update text shape in existing text volume Predict that there is only one runnig(not canceled) instance of it.

Member Enumeration Documentation

◆ JobPrepareState

Enumerator
PREPARE_STATE_DEFAULT 
PREPARE_STATE_MENU 
22 {
25 };
@ PREPARE_STATE_MENU
Definition Job.hpp:24
@ PREPARE_STATE_DEFAULT
Definition Job.hpp:23

Constructor & Destructor Documentation

◆ UpdateJob()

UpdateJob::UpdateJob ( DataUpdate && input)
explicit

Update Volume.

427: m_input(std::move(input)){ assert(check(m_input, true)); }
DataUpdate m_input
Definition EmbossJob.hpp:128
bool check(ModelVolumeType volume_type)
Definition GLGizmoEmboss.cpp:515

References m_input.

Member Function Documentation

◆ finalize()

void UpdateJob::finalize ( bool canceled,
std::exception_ptr & eptr )
overridevirtual

Update volume - change object_id.

Parameters
canceledWas process canceled. NOTE: Be carefull it doesn't care about time between finished process and started finalize part.

unused

Reimplemented from Slic3r::GUI::Job.

442{
443 if (!::finalize(canceled, eptr, *m_input.base))
444 return;
445 ::update_volume(std::move(m_result), m_input);
446}
TriangleMesh m_result
Definition EmbossJob.hpp:129
static void update_volume(ModelVolume *volume, TriangleMesh &&mesh, const DataBase &base)
Update text volume.
Definition EmbossJob.cpp:448
void finalize(bool canceled, std::exception_ptr &eptr) override
Update volume - change object_id.
Definition EmbossJob.cpp:441

References finalize(), m_input, m_result, and update_volume().

Referenced by finalize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ process()

void UpdateJob::process ( Ctl & ctl)
overridevirtual

Create new embossed volume by m_input data and store to m_result.

Parameters
ctlControl containing cancel flag

Implements Slic3r::GUI::Job.

430{
431 if (!check(m_input))
432 throw JobException(_u8L("Bad input data for EmbossUpdateJob."));
433
434 auto was_canceled = ::was_canceled(ctl, *m_input.base);
435 m_result = ::try_create_mesh(*m_input.base, was_canceled);
436 if (was_canceled()) return;
437 if (m_result.its.empty())
438 throw JobException(_u8L("Created text volume is empty. Change text or font."));
439}
auto was_canceled(const Job::Ctl &ctl, const DataBase &base)
Definition EmbossJob.cpp:292
#define _u8L(s)
Definition I18N.hpp:11

References _u8L, m_input, and m_result.

◆ update_volume()

void UpdateJob::update_volume ( ModelVolume * volume,
TriangleMesh && mesh,
const DataBase & base )
static

Update text volume.

Parameters
volumeVolume to be updated
meshNew Triangle mesh for volume
baseData to write into volume
449{
450 // check inputs
451 bool is_valid_input = volume != nullptr && !mesh.empty() && !base.volume_name.empty();
452 assert(is_valid_input);
453 if (!is_valid_input)
454 return;
455
456 // update volume
457 volume->set_mesh(std::move(mesh));
458 volume->set_new_unique_id();
459 volume->calculate_convex_hull();
460
461 GUI_App &app = wxGetApp(); // may be move to input
462
463 if (volume->name != base.volume_name) {
464 // write data from base into volume
465 base.write(*volume);
466
467 const ObjectList *obj_list = app.obj_list();
468 if (obj_list != nullptr)
469 update_name_in_list(*obj_list, *volume);
470 } else {
471 // write data from base into volume
472 base.write(*volume);
473 }
474
475 ModelObject *object = volume->get_object();
476 assert(object != nullptr);
477 if (object == nullptr)
478 return;
479
480 Plater *plater = app.plater();
483 plater->changed_object(*object);
484}
virtual void write(ModelVolume &volume) const
Write data how to reconstruct shape to volume.
Definition EmbossJob.cpp:302
std::string volume_name
Definition EmbossJob.hpp:79
ObjectList * obj_list()
Definition GUI_App.cpp:9699
Plater * plater()
Definition GUI_App.cpp:9709
void changed_object(ModelObject &object)
Definition Plater.cpp:22227
PrinterTechnology printer_technology() const
Definition Plater.cpp:22155
void calculate_convex_hull()
Definition Model.cpp:2811
ModelObject * get_object() const
Definition Model.hpp:1022
void set_mesh(const TriangleMesh &mesh)
Definition Model.hpp:894
std::string name
Definition Model.hpp:834
void set_new_unique_id()
Definition Model.hpp:1142
bool empty() const
Definition TriangleMesh.hpp:146
static ObjectList * obj_list()
Definition GUI_Factories.cpp:405
static Plater * plater()
Definition GUI_Factories.cpp:400
@ ObjectList
Definition Shortcuts.hpp:21
@ Plater
Definition Shortcuts.hpp:21
void reproject_points_and_holes(ModelObject *object)
Definition ReprojectPointsOnMesh.hpp:30
@ ptSLA
Definition Config.hpp:233
void update_name_in_list(const ObjectList &object_list, const ModelVolume &volume)
Update name in right panel.
Definition EmbossJob.cpp:1020

References Slic3r::ModelVolume::calculate_convex_hull(), Slic3r::ModelVolume::get_object(), Slic3r::ModelVolume::name, Slic3r::GUI::GUI_App::obj_list(), Slic3r::GUI::obj_list(), Slic3r::GUI::GUI_App::plater(), Slic3r::GUI::plater(), Slic3r::ptSLA, Slic3r::sla::reproject_points_and_holes(), Slic3r::ModelVolume::set_mesh(), Slic3r::ModelVolume::set_new_unique_id(), Slic3r::GUI::Emboss::DataBase::volume_name, and Slic3r::GUI::Emboss::DataBase::write().

Referenced by finalize(), and anonymous_namespace{EmbossJob.cpp}::update_volume().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_input

DataUpdate Slic3r::GUI::Emboss::UpdateJob::m_input
private

Referenced by UpdateJob(), finalize(), and process().

◆ m_result

TriangleMesh Slic3r::GUI::Emboss::UpdateJob::m_result
private

Referenced by finalize(), and process().


The documentation for this class was generated from the following files:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/Jobs/EmbossJob.hpp
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/Jobs/EmbossJob.cpp