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

Classes

class  CreateFontStyleImagesJob
 Create texture with name of styles written by its style NOTE: Access to glyph cache is possible only from job. More...
class  DataBase
 Base data hold data for create emboss shape. More...
struct  DataCreateVolume
 Hold neccessary data to create ModelVolume in job Volume is created on the surface of existing volume in object. NOTE: EmbossDataBase::font_file doesn't have to be valid !!! More...
struct  DataUpdate
 Hold neccessary data to update embossed text object in job. More...
class  UpdateJob
 Update text shape in existing text volume Predict that there is only one runnig(not canceled) instance of it. More...
struct  SurfaceVolumeData
struct  UpdateSurfaceVolumeData
 Hold neccessary data to update embossed text object in job. More...
class  UpdateSurfaceVolumeJob
 Update text volume to use surface from object. More...
struct  CreateVolumeParams
 shorten params for start_crate_volume functions More...
class  StyleManager
 Manage Emboss text styles Cache actual state of style. More...

Typedefs

using DataBasePtr = std::unique_ptr<DataBase>

Functions

SurfaceVolumeData::ModelSources create_volume_sources (const ModelVolume &volume)
 Copied triangles from object to be able create mesh for cut surface from.
bool start_create_volume (CreateVolumeParams &input, DataBasePtr data, const Vec2d &mouse_pos)
 Create new volume on position of mouse cursor.
bool start_create_volume_without_position (CreateVolumeParams &input, DataBasePtr data)
 Same as previous function but without mouse position Need to suggest position or put near the selection.
bool start_update_volume (DataUpdate &&data, const ModelVolume &volume, const Selection &selection, RaycastManager &raycaster)
 Start job for update embossed volume.

Class Documentation

◆ Slic3r::GUI::Emboss::CreateVolumeParams

struct Slic3r::GUI::Emboss::CreateVolumeParams

shorten params for start_crate_volume functions

Collaboration diagram for Slic3r::GUI::Emboss::CreateVolumeParams:
Class Members
optional< float > angle = {}
const BuildVolume & build_volume
const Camera & camera
GLCanvas3D & canvas
optional< float > distance = {}
unsigned char gizmo
const GLVolume * gl_volume
RaycastManager & raycaster
ModelVolumeType volume_type
Worker & worker

Typedef Documentation

◆ DataBasePtr

using Slic3r::GUI::Emboss::DataBasePtr = std::unique_ptr<DataBase>

Function Documentation

◆ create_volume_sources()

SurfaceVolumeData::ModelSources Slic3r::GUI::Emboss::create_volume_sources ( const ModelVolume & volume)

Copied triangles from object to be able create mesh for cut surface from.

Parameters
volumeDefine embossed volume
Returns
Source data for cut surface from
593{
594 const ModelVolumePtrs &volumes = text_volume.get_object()->volumes;
595 // no other volume in object
596 if (volumes.size() <= 1)
597 return {};
598 return ::create_sources(volumes, text_volume.id().id);
599}
std::vector< ModelVolume * > ModelVolumePtrs
Definition Model.hpp:139

References Slic3r::ModelVolume::get_object(), Slic3r::ObjectBase::id(), Slic3r::ObjectID::id, and Slic3r::ModelObject::volumes.

Referenced by start_update_volume().

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

◆ start_create_volume()

bool Slic3r::GUI::Emboss::start_create_volume ( CreateVolumeParams & input,
DataBasePtr data,
const Vec2d & mouse_pos )

Create new volume on position of mouse cursor.

Parameters
plater_ptrcanvas + camera + bed shape +
dataShape of emboss
volume_typeNew created volume type
raycasterKnows object in scene
gizmoDefine which gizmo open on the success - enum GLGizmosManager::EType
mouse_posDefine position where to create volume
distanceWanted additionl move in Z(emboss) direction of new created volume
angleWanted additionl rotation around Z of new created volume
Returns
True on success otherwise False
602{
603 if (data == nullptr)
604 return false;
605 if (!check(input))
606 return false;
607
608 if (input.gl_volume == nullptr)
609 // object is not under mouse position soo create object on plater
610 return ::start_create_object_job(input, std::move(data), mouse_pos);
611
612 bool try_no_coor = true;
613 return ::start_create_volume_on_surface_job(input, std::move(data), mouse_pos, try_no_coor);
614}
const GLVolume * gl_volume
Definition EmbossJob.hpp:228

References Slic3r::GUI::Emboss::CreateVolumeParams::gl_volume.

Referenced by Slic3r::GUI::GLGizmoEmboss::create_volume(), Slic3r::GUI::GLGizmoSVG::create_volume(), and Slic3r::GUI::GLGizmoSVG::create_volume().

Here is the caller graph for this function:

◆ start_create_volume_without_position()

bool Slic3r::GUI::Emboss::start_create_volume_without_position ( CreateVolumeParams & input,
DataBasePtr data )

Same as previous function but without mouse position Need to suggest position or put near the selection.

617{
618 assert(data != nullptr);
619 if (data == nullptr)
620 return false;
621 if (!check(input))
622 return false;
623
624 // select position by camera position and view direction
625 const Selection &selection = input.canvas.get_selection();
626 int object_idx = selection.get_object_idx();
627
628 Size s = input.canvas.get_canvas_size();
629 Vec2d screen_center(s.get_width() / 2., s.get_height() / 2.);
630 const ModelObjectPtrs &objects = selection.get_model()->objects;
631
632 // No selected object so create new object
633 if (selection.is_empty() || object_idx < 0 ||
634 static_cast<size_t>(object_idx) >= objects.size())
635 // create Object on center of screen
636 // when ray throw center of screen not hit bed it create object on center of bed
637 return ::start_create_object_job(input, std::move(data), screen_center);
638
639 // create volume inside of selected object
640 Vec2d coor;
641 const Camera &camera = wxGetApp().plater()->get_camera();
642 input.gl_volume = ::find_closest(selection, screen_center, camera, objects, &coor);
643 if (input.gl_volume == nullptr)
644 return ::start_create_object_job(input, std::move(data), screen_center);
645
646 bool try_no_coor = false;
647 return ::start_create_volume_on_surface_job(input, std::move(data), coor, try_no_coor);
648}
Size get_canvas_size() const
Definition GLCanvas3D.cpp:5596
const Selection & get_selection() const
Definition GLCanvas3D.hpp:1028
Definition Selection.hpp:47
int get_object_idx() const
Definition Selection.cpp:962
Model * get_model() const
Definition Selection.hpp:219
bool is_empty() const
Definition Selection.hpp:272
Definition GLCanvas3D.hpp:110
int get_height() const
Definition GLCanvas3D.hpp:122
int get_width() const
Definition GLCanvas3D.hpp:119
ModelObjectPtrs objects
Definition Model.hpp:1702
GLCanvas3D & canvas
Definition EmbossJob.hpp:207
std::vector< ModelObject * > ModelObjectPtrs
Definition CutUtils.hpp:13
Eigen::Matrix< double, 2, 1, Eigen::DontAlign > Vec2d
Definition Point.hpp:67
Definition Camera.hpp:26

References Slic3r::GUI::Emboss::CreateVolumeParams::canvas, Slic3r::GUI::GLCanvas3D::get_canvas_size(), Slic3r::GUI::Size::get_height(), Slic3r::GUI::Selection::get_model(), Slic3r::GUI::Selection::get_object_idx(), Slic3r::GUI::GLCanvas3D::get_selection(), Slic3r::GUI::Size::get_width(), Slic3r::GUI::Emboss::CreateVolumeParams::gl_volume, Slic3r::GUI::Selection::is_empty(), and Slic3r::Model::objects.

Referenced by Slic3r::GUI::GLGizmoEmboss::create_volume(), Slic3r::GUI::GLGizmoSVG::create_volume(), Slic3r::GUI::GLGizmoSVG::create_volume(), and anonymous_namespace{EmbossJob.cpp}::start_create_volume_on_surface_job().

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

◆ start_update_volume()

bool Slic3r::GUI::Emboss::start_update_volume ( DataUpdate && data,
const ModelVolume & volume,
const Selection & selection,
RaycastManager & raycaster )

Start job for update embossed volume.

Parameters
datadefine update data
volumeVolume to be updated
selectionKeep model and gl_volumes - when start use surface volume must be selected
raycasterCould cast ray to scene
Returns
True when start job otherwise false
672{
673 assert(data.volume_id == volume.id());
674
675 // check cutting from source mesh
676 bool &use_surface = data.base->shape.projection.use_surface;
677 if (use_surface && volume.is_the_only_one_part())
678 use_surface = false;
679
680 std::unique_ptr<Job> job = nullptr;
681 if (use_surface) {
682 // Model to cut surface from.
684 if (sources.empty())
685 return false;
686
687 Transform3d volume_tr = volume.get_matrix();
688 const std::optional<Transform3d> &fix_3mf = volume.emboss_shape->fix_3mf_tr;
689 if (fix_3mf.has_value())
690 volume_tr = volume_tr * fix_3mf->inverse();
691
692 // when it is new applying of use surface than move origin onto surfaca
693 if (!volume.emboss_shape->projection.use_surface) {
694 auto offset = calc_surface_offset(selection, raycaster);
695 if (offset.has_value())
696 volume_tr *= Eigen::Translation<double, 3>(*offset);
697 }
698
699 UpdateSurfaceVolumeData surface_data{std::move(data), {volume_tr, std::move(sources)}};
700 job = std::make_unique<UpdateSurfaceVolumeJob>(std::move(surface_data));
701 } else {
702 job = std::make_unique<UpdateJob>(std::move(data));
703 }
704
705#ifndef EXECUTE_UPDATE_ON_MAIN_THREAD
706 auto &worker = wxGetApp().plater()->get_ui_job_worker();
707 return queue_job(worker, std::move(job));
708#else
709 // Run Job on main thread (blocking) - ONLY DEBUG
710 return execute_job(std::move(job));
711#endif // EXECUTE_UPDATE_ON_MAIN_THREAD
712}
EmbossShape shape
Definition EmbossJob.hpp:86
const Transform3d & get_matrix() const
Definition Model.hpp:1139
bool is_the_only_one_part() const
Definition Model.cpp:2128
std::optional< EmbossShape > emboss_shape
Definition Model.hpp:1019
ObjectID id() const
Definition ObjectID.hpp:69
SurfaceVolumeData::ModelSources create_volume_sources(const ModelVolume &text_volume)
Copied triangles from object to be able create mesh for cut surface from.
Definition EmbossJob.cpp:592
std::optional< Vec3d > calc_surface_offset(const Selection &selection, RaycastManager &raycast_manager)
Calculate translation of volume onto surface of model.
Definition SurfaceDrag.cpp:140
bool queue_job(Worker &w, ProcessFn fn, FinishFn finishfn)
Definition Worker.hpp:62
Eigen::Transform< double, 3, Eigen::Affine, Eigen::DontAlign > Transform3d
Definition Point.hpp:96
Slic3r::Polygons offset(const Slic3r::Polygon &polygon, const float delta, JoinType joinType, double miterLimit)
Definition ClipperUtils.cpp:582
bool use_surface
Definition EmbossShape.hpp:27
EmbossProjection projection
Definition EmbossShape.hpp:80
DataBasePtr base
Definition EmbossJob.hpp:113
ObjectID volume_id
Definition EmbossJob.hpp:116
std::vector< ModelSource > ModelSources
Definition EmbossJob.hpp:171
Hold neccessary data to update embossed text object in job.
Definition EmbossJob.hpp:178

References Slic3r::GUI::calc_surface_offset(), create_volume_sources(), Slic3r::ModelVolume::emboss_shape, Slic3r::ModelVolume::get_matrix(), Slic3r::ObjectBase::id(), Slic3r::ModelVolume::is_the_only_one_part(), Slic3r::offset(), and Slic3r::GUI::queue_job().

Referenced by Slic3r::GUI::GLGizmoEmboss::process(), Slic3r::GUI::GLGizmoSVG::process(), and Slic3r::GUI::GLGizmoEmboss::re_emboss().

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