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

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/Gizmos/GLGizmoAssembly.hpp>

Inheritance diagram for Slic3r::GUI::GLGizmoAssembly:
Collaboration diagram for Slic3r::GUI::GLGizmoAssembly:

Public Types

enum class  EGrabberExtension {
  None = 0 , PosX = 1 << 0 , NegX = 1 << 1 , PosY = 1 << 2 ,
  NegY = 1 << 3 , PosZ = 1 << 4 , NegZ = 1 << 5
}
enum  EState { Off , On , Num_States }

Public Member Functions

 GLGizmoAssembly (GLCanvas3D &parent, const std::string &icon_filename, unsigned int sprite_id)
bool wants_enter_leave_snapshots () const override
 Apply rotation on select plane.
std::string get_gizmo_entering_text () const override
std::string get_gizmo_leaving_text () const override
bool on_mouse (const wxMouseEvent &mouse_event) override
 Apply rotation on select plane.
void data_changed (bool is_serializing) override
 Is called when data (Selection) is changed.
virtual bool gizmo_event (SLAGizmoEventType action, const Vec2d &mouse_position, bool shift_down, bool alt_down, bool control_down)
bool init ()
void load (cereal::BinaryInputArchive &ar)
void save (cereal::BinaryOutputArchive &ar) const
std::string get_name (bool include_shortcut=true) const
EState get_state () const
void set_state (EState state)
std::optional< Shortcut > shortcut () const
const std::string & get_icon_filename () const
void set_icon_filename (const std::string &filename)
bool is_activable () const
bool is_selectable () const
CommonGizmosDataID get_requirements () const
virtual std::string get_action_snapshot_name () const
void set_common_data_pool (CommonGizmosDataPool *ptr)
virtual bool apply_clipping_plane ()
unsigned int get_sprite_id () const
int get_hover_id () const
void set_hover_id (int id)
bool is_dragging () const
bool update_items_state ()
void render ()
void render_input_window (float x, float y, float bottom_limit)
virtual void on_change_color_mode (bool is_dark)
virtual std::string get_tooltip () const
 Mouse tooltip text.
int get_count ()
std::string get_gizmo_name ()
void register_raycasters_for_picking ()
void unregister_raycasters_for_picking ()
virtual bool is_in_editing_mode () const
virtual bool is_selection_rectangle_dragging () const

Static Public Member Functions

static void update_render_colors ()
static void load_render_colors ()

Static Public Attributes

static const unsigned int BASE_ID = 255 * 255 * 254
static const unsigned int GRABBER_ELEMENTS_MAX_COUNT = 7
static float INV_ZOOM = 1.0f
static ColorRGBA DEFAULT_BASE_COLOR = { 0.625f, 0.625f, 0.625f, 1.0f }
static ColorRGBA DEFAULT_DRAG_COLOR = { 1.0f, 1.0f, 1.0f, 1.0f }
static ColorRGBA DEFAULT_HIGHLIGHT_COLOR = {1.0f, 0.38f, 0.0f, 1.0f}
static std::array< ColorRGBA, 3 > AXES_COLOR
static std::array< ColorRGBA, 3 > AXES_HOVER_COLOR
static ColorRGBA CONSTRAINED_COLOR = {0.5f, 0.5f, 0.5f, 1.0f}
static ColorRGBA FLATTEN_COLOR = {0.96f, 0.93f, 0.93f, 0.5f}
static ColorRGBA FLATTEN_HOVER_COLOR = {1.0f, 1.0f, 1.0f, 0.75f}
static ColorRGBA GRABBER_NORMAL_COL = {1.0f, 1.0f, 1.0f, 1.0f}
static ColorRGBA GRABBER_HOVER_COL = {0.863f, 0.125f, 0.063f, 1.0f}
static ColorRGBA GRABBER_UNIFORM_COL = {0, 1.0, 1.0, 1.0f}
static ColorRGBA GRABBER_UNIFORM_HOVER_COL = {0, 0.7, 0.7, 1.0f}

Protected Types

enum  GripperType {
  UNDEFINE , POINT , EDGE , CIRCLE ,
  CIRCLE_1 , CIRCLE_2 , PLANE , PLANE_1 ,
  PLANE_2 , SPHERE_1 , SPHERE_2
}
enum class  EMode : unsigned char { FeatureSelection , PointSelection }
using PickRaycaster = SceneRaycasterItem

Protected Member Functions

bool on_init () override
std::string on_get_name () const override
bool on_is_activable () const override
virtual void on_render_input_window (float x, float y, float bottom_limit) override
void render_input_window_warning (bool same_model_object) override
bool render_assembly_mode_combo (double label_width, float item_width)
void switch_to_mode (AssemblyMode new_mode)
void init_circle_glmodel (GripperType gripper_type, const Measure::SurfaceFeature &feature, CircleGLModel &circle_gl_model, float inv_zoom)
void init_plane_glmodel (GripperType gripper_type, const Measure::SurfaceFeature &feature, PlaneGLModel &plane_gl_model)
void update_if_needed ()
void disable_scene_raycasters ()
void restore_scene_raycasters_state ()
void render_dimensioning ()
void render_dimensioning_if_scene_reused ()
bool render_follows_cursor () const override
void on_render () override
void on_set_state () override
void show_selection_ui ()
void show_distance_xyz_ui ()
void show_face_face_assembly_common ()
void show_face_face_assembly_senior ()
void init_render_input_window ()
void remove_selected_sphere_raycaster (int id)
void update_measurement_result ()
void reset_all_pick ()
void reset_gripper_pick (GripperType id, bool is_all=false)
void register_single_mesh_pick ()
std::string format_double (double value)
std::string format_vec3 (const Vec3d &v)
std::string surface_feature_type_as_string (Measure::SurfaceFeatureType type)
std::string point_on_feature_type_as_string (Measure::SurfaceFeatureType type, int hover_id)
std::string center_on_feature_type_as_string (Measure::SurfaceFeatureType type)
bool is_feature_with_center (const Measure::SurfaceFeature &feature)
Vec3d get_feature_offset (const Measure::SurfaceFeature &feature)
void reset_all_feature ()
void reset_feature1_render ()
void reset_feature2_render ()
void reset_feature1 ()
void reset_feature2 ()
bool is_two_volume_in_same_model_object ()
Measure::Measuring * get_measuring_of_mesh (GLVolume *v, Transform3d &tran)
void update_world_plane_features (Measure::Measuring *cur_measuring, Measure::SurfaceFeature &feautre)
void update_feature_by_tran (Measure::SurfaceFeature &feature)
void set_distance (bool same_model_object, const Vec3d &displacement, bool take_shot=true)
void set_to_parallel (bool same_model_object, bool take_shot=true, bool is_anti_parallel=false)
void set_to_reverse_rotation (bool same_model_object, int feature_index)
void set_to_around_center_of_faces (bool same_model_object, float rotate_degree)
void set_to_center_coincidence (bool same_model_object)
void set_parallel_distance (bool same_model_object, float dist)
bool is_pick_meet_assembly_mode (const SelectedFeatures::Item &item)
bool render_combo (const std::string &label, const std::vector< std::string > &lines, int &selection_idx, float label_width, float item_width)
void render_cross_mark (const Vec3f &target, bool is_single=false)
virtual void on_load (cereal::BinaryInputArchive &ar)
virtual void on_save (cereal::BinaryOutputArchive &ar) const
virtual void on_set_hover_id ()
virtual bool on_is_selectable () const
virtual CommonGizmosDataID on_get_requirements () const
virtual void on_enable_grabber (unsigned int id)
virtual void on_disable_grabber (unsigned int id)
virtual void on_start_dragging ()
virtual void on_stop_dragging ()
virtual void on_dragging (const UpdateData &data)
bool GizmoImguiBegin (const std::string &name, int flags)
void GizmoImguiEnd ()
void GizmoImguiSetNextWIndowPos (float &x, float y, int flag, float pivot_x=0.0f, float pivot_y=0.0f)
void GizmoImguiSetNextWIndowPos (float &x, float y, float w, float h, int flag, float pivot_x=0.0f, float pivot_y=0.0f)
void register_grabbers_for_picking ()
void unregister_grabbers_for_picking ()
virtual void on_register_raycasters_for_picking ()
virtual void on_unregister_raycasters_for_picking ()
void render_grabbers (const BoundingBoxf3 &box) const
void render_grabbers (float size) const
void render_grabbers (size_t first, size_t last, float size, bool force_hover) const
std::string format (float value, unsigned int decimals) const
void set_dirty ()
bool use_grabbers (const wxMouseEvent &mouse_event)
 function which Set up m_dragging and call functions on_start_dragging / on_dragging / on_stop_dragging
void do_stop_dragging (bool perform_mouse_cleanup)

Protected Attributes

EMode m_mode { EMode::FeatureSelection }
Measure::MeasurementResult m_measurement_result
Measure::AssemblyAction m_assembly_action
std::map< GLVolume *, std::shared_ptr< Measure::Measuring > > m_mesh_measure_map
std::shared_ptr< Measure::Measuring > m_curr_measuring {nullptr}
PickingModel m_sphere
PickingModel m_cylinder
CircleGLModel m_curr_circle
CircleGLModel m_feature_circle_first
CircleGLModel m_feature_circle_second
PlaneGLModel m_curr_plane
PlaneGLModel m_feature_plane_first
PlaneGLModel m_feature_plane_second
Dimensioning m_dimensioning
std::map< GLVolume *, std::shared_ptr< PickRaycaster > > m_mesh_raycaster_map
std::map< GripperType, std::shared_ptr< PickRaycaster > > m_gripper_id_raycast_map
std::vector< GLVolume * > m_hit_different_volumes
std::vector< GLVolume * > m_hit_order_volumes
GLVolume * m_last_hit_volume
unsigned int m_last_active_item_imgui {0}
Vec3d m_buffered_distance
Vec3d m_distance
double m_buffered_parallel_distance {0}
double m_buffered_around_center {0}
std::optional< Measure::SurfaceFeature > m_curr_feature
std::optional< Vec3d > m_curr_point_on_feature_position
float m_last_inv_zoom { 0.0f }
std::optional< Measure::SurfaceFeature > m_last_circle_feature
int m_last_plane_idx { -1 }
bool m_mouse_left_down { false }
bool m_mouse_left_down_mesh_deal {false}
KeyAutoRepeatFilter m_shift_kar_filter
SelectedFeatures m_selected_features
int m_pending_scale { 0 }
bool m_set_center_coincidence {false}
bool m_editing_distance { false }
bool m_is_editing_distance_first_frame { true }
bool m_can_set_xyz_distance {false}
bool m_rendered_this_frame { false }
std::vector< std::pair< wxString, wxString > > m_shortcuts
bool m_show_reset_first_tip {false}
bool m_selected_wrong_feature_waring_tip {false}
EMeasureMode m_measure_mode {EMeasureMode::ONLY_MEASURE}
AssemblyMode m_assembly_mode {AssemblyMode::FACE_FACE}
bool m_flip_volume_2 {false}
float m_space_size
float m_input_size_max
bool m_use_inches
bool m_only_select_plane {false}
std::string m_units
bool m_same_model_object
unsigned int m_current_active_imgui_id
GLCanvas3D & m_parent
int m_group_id
EState m_state
std::optional< Shortcut > m_shortcut
std::string m_icon_filename
unsigned int m_sprite_id
int m_hover_id { -1 }
bool m_dragging { false }
std::vector< Grabber > m_grabbers
ImGuiWrapper * m_imgui
bool m_first_input_window_render { true }
CommonGizmosDataPool * m_c { nullptr }
bool m_is_dark_mode = false
float last_input_window_width = 0

Private Attributes

bool m_dirty { false }
int count = 0

Detailed Description

Member Typedef Documentation

◆ PickRaycaster

Member Enumeration Documentation

◆ EGrabberExtension

enum class Slic3r::GUI::GLGizmoBase::EGrabberExtension
stronginherited
Enumerator
None 
PosX 
NegX 
PosY 
NegY 
PosZ 
NegZ 
74 {
75 None = 0,
76 PosX = 1 << 0,
77 NegX = 1 << 1,
78 PosY = 1 << 2,
79 NegY = 1 << 3,
80 PosZ = 1 << 4,
81 NegZ = 1 << 5,
82 };
@ PosX
Definition PrintConfig.hpp:350
@ NegY
Definition PrintConfig.hpp:351
@ NegX
Definition PrintConfig.hpp:351
@ PosY
Definition PrintConfig.hpp:350
@ NegZ
Definition PrintConfig.hpp:351
@ PosZ
Definition PrintConfig.hpp:350
@ None
Definition SketchEngine.hpp:180

◆ EMode

enum class Slic3r::GUI::GLGizmoMeasure::EMode : unsigned char
strongprotectedinherited
Enumerator
FeatureSelection 
PointSelection 
109 {
110 FeatureSelection,
111 PointSelection
112 };

◆ EState

Enumerator
Off 
On 
Num_States 
126 {
127 Off,
128 On,
130 };
@ On
Definition GLGizmoBase.hpp:128
@ Num_States
Definition GLGizmoBase.hpp:129
@ Off
Definition GLGizmoBase.hpp:127

◆ GripperType

Enumerator
UNDEFINE 
POINT 
EDGE 
CIRCLE 
CIRCLE_1 
CIRCLE_2 
PLANE 
PLANE_1 
PLANE_2 
SPHERE_1 
SPHERE_2 
94 {
96 POINT,
97 EDGE,
98 CIRCLE,
100 CIRCLE_2,
101 PLANE,
102 PLANE_1,
103 PLANE_2,
104 SPHERE_1,
105 SPHERE_2,
106 };
@ CIRCLE_1
Definition GLGizmoMeasure.hpp:99
@ PLANE_1
Definition GLGizmoMeasure.hpp:102
@ CIRCLE_2
Definition GLGizmoMeasure.hpp:100
@ SPHERE_1
Definition GLGizmoMeasure.hpp:104
@ POINT
Definition GLGizmoMeasure.hpp:96
@ PLANE_2
Definition GLGizmoMeasure.hpp:103
@ SPHERE_2
Definition GLGizmoMeasure.hpp:105
@ PLANE
Definition GLGizmoMeasure.hpp:101
@ EDGE
Definition GLGizmoMeasure.hpp:97
@ CIRCLE
Definition GLGizmoMeasure.hpp:98
@ UNDEFINE
Definition GLGizmoMeasure.hpp:95

Constructor & Destructor Documentation

◆ GLGizmoAssembly()

Slic3r::GUI::GLGizmoAssembly::GLGizmoAssembly ( GLCanvas3D & parent,
const std::string & icon_filename,
unsigned int sprite_id )
34 :
35 GLGizmoMeasure(parent, icon_filename, sprite_id)
36{
38}
GLGizmoMeasure(GLCanvas3D &parent, const std::string &icon_filename, unsigned int sprite_id)
Definition GLGizmoMeasure.cpp:231
EMeasureMode m_measure_mode
Definition GLGizmoMeasure.hpp:330
@ ONLY_ASSEMBLY
Definition GLGizmoMeasure.hpp:35

References Slic3r::GUI::GLGizmoMeasure::GLGizmoMeasure(), Slic3r::GUI::GLGizmoMeasure::m_measure_mode, and Slic3r::GUI::ONLY_ASSEMBLY.

Here is the call graph for this function:

Member Function Documentation

◆ apply_clipping_plane()

virtual bool Slic3r::GUI::GLGizmoBase::apply_clipping_plane ( )
inlinevirtualinherited
195{ return true; }

Referenced by Slic3r::GUI::GLCanvas3D::_render_objects(), and Slic3r::GUI::GLCanvas3D::get_raycaster_clipping_plane().

Here is the caller graph for this function:

◆ center_on_feature_type_as_string()

std::string Slic3r::GUI::GLGizmoMeasure::center_on_feature_type_as_string ( Measure::SurfaceFeatureType type)
protectedinherited
112{
113 std::string ret;
114 switch (type) {
115 case Measure::SurfaceFeatureType::Edge: { ret = _u8L("Center of edge"); break; }
116 case Measure::SurfaceFeatureType::Circle: { ret = _u8L("Center of circle"); break; }
117 default: { assert(false); break; }
118 }
119 return ret;
120}
@ Circle
Definition Measure.hpp:27
@ Edge
Definition Measure.hpp:26
#define _u8L(s)
Definition I18N.hpp:11

References _u8L, Slic3r::Measure::Circle, and Slic3r::Measure::Edge.

Referenced by show_selection_ui().

Here is the caller graph for this function:

◆ data_changed()

void Slic3r::GUI::GLGizmoMeasure::data_changed ( bool is_serializing)
overridevirtualinherited

Is called when data (Selection) is changed.

Reimplemented from Slic3r::GUI::GLGizmoBase.

439{
440 wxBusyCursor wait;
441
442 if (m_pending_scale > 0) {
447 }
448 else {
449 m_parent.toggle_selected_volume_visibility(true);
454 }
455 m_last_inv_zoom = 0.0f;
456 m_last_plane_idx = -1;
457 m_editing_distance = false;
459}
GLCanvas3D & m_parent
Definition GLGizmoBase.hpp:143
void update_if_needed()
Definition GLGizmoMeasure.cpp:1167
bool m_editing_distance
Definition GLGizmoMeasure.hpp:236
float m_last_inv_zoom
Definition GLGizmoMeasure.hpp:224
void reset_all_pick()
Definition GLGizmoMeasure.cpp:2317
int m_last_plane_idx
Definition GLGizmoMeasure.hpp:226
void register_single_mesh_pick()
Definition GLGizmoMeasure.cpp:2341
bool m_is_editing_distance_first_frame
Definition GLGizmoMeasure.hpp:237
void update_measurement_result()
Definition GLGizmoMeasure.cpp:2287
void reset_all_feature()
Definition GLGizmoMeasure.cpp:2371
int m_pending_scale
Definition GLGizmoMeasure.hpp:234

References m_editing_distance, m_is_editing_distance_first_frame, m_last_inv_zoom, m_last_plane_idx, Slic3r::GUI::GLGizmoBase::m_parent, m_pending_scale, register_single_mesh_pick(), reset_all_feature(), reset_all_pick(), update_if_needed(), and update_measurement_result().

Here is the call graph for this function:

◆ disable_scene_raycasters()

void Slic3r::GUI::GLGizmoMeasure::disable_scene_raycasters ( )
protectedinherited
1201{
1202 for(auto iter:m_gripper_id_raycast_map)
1203 {
1204 iter.second->set_active(false);
1205 }
1206}
std::map< GripperType, std::shared_ptr< PickRaycaster > > m_gripper_id_raycast_map
Definition GLGizmoMeasure.hpp:208

References m_gripper_id_raycast_map.

Referenced by gizmo_event().

Here is the caller graph for this function:

◆ do_stop_dragging()

void Slic3r::GUI::GLGizmoBase::do_stop_dragging ( bool perform_mouse_cleanup)
protectedinherited
494{
495 for (auto& grabber : m_grabbers) grabber.dragging = false;
496 m_dragging = false;
497
498 // NOTE: This should be part of GLCanvas3D
499 // Reset hover_id when leave window
500 if (perform_mouse_cleanup) m_parent.mouse_up_cleanup();
501
503
504 // There is prediction that after draggign, data are changed
505 // Data are updated twice also by canvas3D::reload_scene.
506 // Should be fixed.
507 m_parent.get_gizmos_manager().update_data();
508
509 wxGetApp().obj_manipul()->set_dirty();
510
511 // Let the plater know that the dragging finished, so a delayed
512 // refresh of the scene with the background processing data should
513 // be performed.
514 m_parent.post_event(SimpleEvent(EVT_GLCANVAS_MOUSE_DRAGGING_FINISHED));
515 // updates camera target constraints
516 m_parent.refresh_camera_scene_box();
517}
bool m_dragging
Definition GLGizmoBase.hpp:151
std::vector< Grabber > m_grabbers
Definition GLGizmoBase.hpp:152
virtual void on_stop_dragging()
Definition GLGizmoBase.hpp:254

References m_dragging, m_grabbers, m_parent, and on_stop_dragging().

Referenced by use_grabbers().

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

◆ format()

std::string Slic3r::GUI::GLGizmoBase::format ( float value,
unsigned int decimals ) const
protectedinherited

◆ format_double()

std::string Slic3r::GUI::GLGizmoMeasure::format_double ( double value)
protectedinherited
72{
73 char buf[1024];
74 sprintf(buf, "%.3f", value);
75 return std::string(buf);
76}

Referenced by render_dimensioning(), show_distance_xyz_ui(), and show_selection_ui().

Here is the caller graph for this function:

◆ format_vec3()

std::string Slic3r::GUI::GLGizmoMeasure::format_vec3 ( const Vec3d & v)
protectedinherited
79{
80 char buf[1024];
81 sprintf(buf, "X: %.3f, Y: %.3f, Z: %.3f", v.x(), v.y(), v.z());
82 return std::string(buf);
83}

Referenced by show_distance_xyz_ui().

Here is the caller graph for this function:

◆ get_action_snapshot_name()

std::string Slic3r::GUI::GLGizmoBase::get_action_snapshot_name ( ) const
virtualinherited

Reimplemented in Slic3r::GUI::GLGizmoCut3D, Slic3r::GUI::GLGizmoEmboss, Slic3r::GUI::GLGizmoFdmSupports, Slic3r::GUI::GLGizmoFuzzySkin, Slic3r::GUI::GLGizmoMmuSegmentation, Slic3r::GUI::GLGizmoSeam, Slic3r::GUI::GLGizmoSVG, and Slic3r::GUI::GLGizmoTextureDisplacement.

339{
340 return "Gizmo action";
341}

Referenced by Slic3r::GUI::Plater::priv::take_snapshot().

Here is the caller graph for this function:

◆ get_count()

int Slic3r::GUI::GLGizmoBase::get_count ( )
inlineinherited
224{ return ++count; }
int count
Definition GLGizmoBase.hpp:294

References count.

◆ get_feature_offset()

Vec3d Slic3r::GUI::GLGizmoMeasure::get_feature_offset ( const Measure::SurfaceFeature & feature)
protectedinherited
129{
130 Vec3d ret;
131 switch (feature.get_type())
132 {
134 {
135 const auto [center, radius, normal] = feature.get_circle();
136 ret = center;
137 break;
138 }
140 {
141 // Only polygon edges store an extra point (the polygon centre); plain edges have none.
142 const std::optional<Vec3d> extra = feature.get_extra_point();
143 if (extra.has_value())
144 ret = *extra;
145 else {
146 const auto [pt1, pt2] = feature.get_edge();
147 ret = 0.5 * (pt1 + pt2);
148 }
149 break;
150 }
152 {
153 ret = feature.get_point();
154 break;
155 }
156 default: { assert(false); }
157 }
158 return ret;
159}
@ Point
Definition Measure.hpp:25
Eigen::Matrix< double, 3, 1, Eigen::DontAlign > Vec3d
Definition Point.hpp:68
void center(ExPolygonsWithIds &e)
Definition Emboss.cpp:1382
Point normal(Point pt, double scale)
Definition TreeSupport.cpp:112

References Slic3r::center(), Slic3r::Measure::Circle, Slic3r::Measure::Edge, Slic3r::Measure::SurfaceFeature::get_circle(), Slic3r::Measure::SurfaceFeature::get_edge(), Slic3r::Measure::SurfaceFeature::get_extra_point(), Slic3r::Measure::SurfaceFeature::get_point(), Slic3r::Measure::SurfaceFeature::get_type(), Slic3r::normal(), and Slic3r::Measure::Point.

Referenced by on_mouse(), and on_render().

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

◆ get_gizmo_entering_text()

std::string Slic3r::GUI::GLGizmoAssembly::get_gizmo_entering_text ( ) const
inlineoverridevirtual

Reimplemented from Slic3r::GUI::GLGizmoBase.

26{ return _u8L("Entering Assembly gizmo"); }

References _u8L.

◆ get_gizmo_leaving_text()

std::string Slic3r::GUI::GLGizmoAssembly::get_gizmo_leaving_text ( ) const
inlineoverridevirtual

Reimplemented from Slic3r::GUI::GLGizmoBase.

27{ return _u8L("Leaving Assembly gizmo"); }

References _u8L.

◆ get_gizmo_name()

std::string Slic3r::GUI::GLGizmoBase::get_gizmo_name ( )
inlineinherited
225{ return on_get_name(); }
virtual std::string on_get_name() const =0

References on_get_name().

Here is the call graph for this function:

◆ get_hover_id()

int Slic3r::GUI::GLGizmoBase::get_hover_id ( ) const
inlineinherited
206{ return m_hover_id; }
int m_hover_id
Definition GLGizmoBase.hpp:150

References m_hover_id.

Referenced by Slic3r::GUI::GLCanvas3D::_scene_cache_key(), Slic3r::GUI::GLGizmosManager::grabber_contains_mouse(), Slic3r::GUI::GLGizmoBrimEars::on_mouse(), Slic3r::GUI::GLGizmoCut3D::on_mouse(), Slic3r::GUI::GLGizmoMeshBoolean::on_mouse(), and Slic3r::GUI::GLGizmoPainterBase::on_mouse().

Here is the caller graph for this function:

◆ get_icon_filename()

const std::string & Slic3r::GUI::GLGizmoBase::get_icon_filename ( ) const
inlineinherited
180{ return m_icon_filename; }
std::string m_icon_filename
Definition GLGizmoBase.hpp:148

References m_icon_filename.

◆ get_measuring_of_mesh()

Measure::Measuring * Slic3r::GUI::GLGizmoMeasure::get_measuring_of_mesh ( GLVolume * v,
Transform3d & tran )
protectedinherited
2468{
2469 for (auto glvolume:m_hit_order_volumes) {
2470 if (glvolume == v) {
2471 tran = m_mesh_raycaster_map[glvolume]->get_transform();
2472 return m_mesh_measure_map[glvolume].get();
2473 }
2474 }
2475 return nullptr;
2476}
std::map< GLVolume *, std::shared_ptr< PickRaycaster > > m_mesh_raycaster_map
Definition GLGizmoMeasure.hpp:207
std::map< GLVolume *, std::shared_ptr< Measure::Measuring > > m_mesh_measure_map
Definition GLGizmoMeasure.hpp:173
std::vector< GLVolume * > m_hit_order_volumes
Definition GLGizmoMeasure.hpp:210

References m_hit_order_volumes, m_mesh_measure_map, and m_mesh_raycaster_map.

Referenced by update_feature_by_tran().

Here is the caller graph for this function:

◆ get_name()

std::string Slic3r::GUI::GLGizmoBase::get_name ( bool include_shortcut = true) const
inherited
545{
546 const std::string name = on_get_name();
547 return include_shortcut && m_shortcut.has_value() ? wxGetApp().shortcuts().with_key(name, *m_shortcut) : name;
548}
std::optional< Shortcut > m_shortcut
Definition GLGizmoBase.hpp:147

References m_shortcut, and on_get_name().

Referenced by Slic3r::GUI::GLGizmoAssembly::on_render_input_window(), Slic3r::GUI::GLGizmoBrimEars::on_render_input_window(), Slic3r::GUI::GLGizmoCut3D::on_render_input_window(), Slic3r::GUI::GLGizmoEmboss::on_render_input_window(), Slic3r::GUI::GLGizmoFdmSupports::on_render_input_window(), Slic3r::GUI::GLGizmoFuzzySkin::on_render_input_window(), Slic3r::GUI::GLGizmoMeasure::on_render_input_window(), Slic3r::GUI::GLGizmoMmuSegmentation::on_render_input_window(), Slic3r::GUI::GLGizmoSeam::on_render_input_window(), Slic3r::GUI::GLGizmoTextureDisplacement::on_render_input_window(), and Slic3r::GUI::GLGizmosManager::update_hover_state().

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

◆ get_requirements()

CommonGizmosDataID Slic3r::GUI::GLGizmoBase::get_requirements ( ) const
inlineinherited
186{ return on_get_requirements(); }
virtual CommonGizmosDataID on_get_requirements() const
Definition GLGizmoBase.hpp:248

References on_get_requirements().

Here is the call graph for this function:

◆ get_sprite_id()

unsigned int Slic3r::GUI::GLGizmoBase::get_sprite_id ( ) const
inlineinherited
204{ return m_sprite_id; }
unsigned int m_sprite_id
Definition GLGizmoBase.hpp:149

References m_sprite_id.

Referenced by Slic3r::GUI::GLGizmosManager::do_render_overlay().

Here is the caller graph for this function:

◆ get_state()

EState Slic3r::GUI::GLGizmoBase::get_state ( ) const
inlineinherited

◆ get_tooltip()

virtual std::string Slic3r::GUI::GLGizmoBase::get_tooltip ( ) const
inlinevirtualinherited

Mouse tooltip text.

Returns
Text to be visible in mouse tooltip

Reimplemented in Slic3r::GUI::GLGizmoCut3D, Slic3r::GUI::GLGizmoMove3D, Slic3r::GUI::GLGizmoRotate3D, Slic3r::GUI::GLGizmoRotate, and Slic3r::GUI::GLGizmoScale3D.

222{ return ""; }

Referenced by Slic3r::GUI::GLGizmosManager::get_tooltip().

Here is the caller graph for this function:

◆ gizmo_event()

bool Slic3r::GUI::GLGizmoMeasure::gizmo_event ( SLAGizmoEventType action,
const Vec2d & mouse_position,
bool shift_down,
bool alt_down,
bool control_down )
virtualinherited
462{
463 if (action == SLAGizmoEventType::ShiftDown) {
464 if (m_shift_kar_filter.is_first()) {
467 }
468 m_shift_kar_filter.increase_count();
469 }
470 else if (action == SLAGizmoEventType::ShiftUp) {
471 m_shift_kar_filter.reset_count();
474 }
475 else if (action == SLAGizmoEventType::Delete) {
477 m_parent.request_extra_frame();
478 }
479 else if (action == SLAGizmoEventType::Escape) {
480 if (!m_selected_features.first.feature.has_value()) {
482 return false;
483 }
484 else {
485 if (m_selected_features.second.feature.has_value()) {
487 }
488 else {
490 }
491 }
492 }
493 return true;
494}
EMode m_mode
Definition GLGizmoMeasure.hpp:170
void reset_feature2()
Definition GLGizmoMeasure.cpp:2437
SelectedFeatures m_selected_features
Definition GLGizmoMeasure.hpp:233
void restore_scene_raycasters_state()
Definition GLGizmoMeasure.cpp:1208
void disable_scene_raycasters()
Definition GLGizmoMeasure.cpp:1200
@ FeatureSelection
Definition GLGizmoMeasure.hpp:110
@ PointSelection
Definition GLGizmoMeasure.hpp:111
KeyAutoRepeatFilter m_shift_kar_filter
Definition GLGizmoMeasure.hpp:231
void reset_feature1()
Definition GLGizmoMeasure.cpp:2406
@ Escape
Definition GLGizmosCommon.hpp:41
@ ShiftUp
Definition GLGizmosCommon.hpp:39
@ ShiftDown
Definition GLGizmosCommon.hpp:38
@ Delete
Definition GLGizmosCommon.hpp:34

References Slic3r::GUI::Delete, disable_scene_raycasters(), Slic3r::GUI::Escape, FeatureSelection, m_mode, Slic3r::GUI::GLGizmoBase::m_parent, m_selected_features, m_shift_kar_filter, PointSelection, reset_all_feature(), reset_feature1(), reset_feature2(), restore_scene_raycasters_state(), Slic3r::GUI::ShiftDown, Slic3r::GUI::ShiftUp, and update_measurement_result().

Referenced by Slic3r::GUI::GLGizmosManager::gizmo_event().

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

◆ GizmoImguiBegin()

◆ GizmoImguiEnd()

◆ GizmoImguiSetNextWIndowPos() [1/2]

void Slic3r::GUI::GLGizmoBase::GizmoImguiSetNextWIndowPos ( float & x,
float y,
float w,
float h,
int flag,
float pivot_x = 0.0f,
float pivot_y = 0.0f )
protectedinherited
384{
385 if (abs(w) > 0.01f) {
386 if (x + w > m_parent.get_canvas_size().get_width()) {
387 if (w > m_parent.get_canvas_size().get_width()) {
388 x = 0;
389 } else {
390 x = m_parent.get_canvas_size().get_width() - w;
391 }
392 }
393 }
394
395 m_imgui->set_next_window_pos(x, y, flag, pivot_x, pivot_y);
396}

References m_imgui, and m_parent.

◆ GizmoImguiSetNextWIndowPos() [2/2]

void Slic3r::GUI::GLGizmoBase::GizmoImguiSetNextWIndowPos ( float & x,
float y,
int flag,
float pivot_x = 0.0f,
float pivot_y = 0.0f )
protectedinherited

◆ init()

bool Slic3r::GUI::GLGizmoBase::init ( )
inlineinherited
168{ return on_init(); }
virtual bool on_init()=0

References on_init().

Here is the call graph for this function:

◆ init_circle_glmodel()

void Slic3r::GUI::GLGizmoMeasure::init_circle_glmodel ( GripperType gripper_type,
const Measure::SurfaceFeature & feature,
CircleGLModel & circle_gl_model,
float inv_zoom )
protectedinherited
564{
565 const auto [center, radius, normal] = feature.get_circle();
566 auto cur_feature =const_cast<Measure::SurfaceFeature *>(&feature);
567 if (circle_gl_model.inv_zoom != inv_zoom) {
568 if (circle_gl_model.last_circle_feature) {
569 const auto [last_center, last_radius, last_normal] = circle_gl_model.last_circle_feature->get_circle();
570 float eps = 1e-2;
571 if ((last_center - center).norm() < eps && (last_normal - normal).norm() < eps && abs(last_radius - radius) < eps){
572 return;
573 }
574 }
575 reset_gripper_pick(gripper_type);
576 circle_gl_model.circle.reset();
577 GLModel::Geometry circle_geometry = init_torus_data(64, 16, center.cast<float>(), float(radius), 5.0f * inv_zoom, normal.cast<float>(), Transform3f::Identity());
578 circle_gl_model.circle.mesh_raycaster = std::make_unique<MeshRaycaster>(std::make_shared<const TriangleMesh>(circle_geometry.get_as_indexed_triangle_set()));
579 circle_gl_model.circle.model.init_from(std::move(circle_geometry));
580 if (circle_gl_model.circle.model.is_initialized()) {
581 m_gripper_id_raycast_map[gripper_type] = std::make_shared<PickRaycaster>(CIRCLE_ID, *m_curr_circle.circle.mesh_raycaster);
582 }
583 circle_gl_model.last_circle_feature = cur_feature;
584 circle_gl_model.inv_zoom = inv_zoom;
585 }
586}
void reset_gripper_pick(GripperType id, bool is_all=false)
Definition GLGizmoMeasure.cpp:2323
CircleGLModel m_curr_circle
Definition GLGizmoMeasure.hpp:185
static const int CIRCLE_ID
Definition GLGizmoMeasure.hpp:48
GLModel::Geometry init_torus_data(unsigned int primary_resolution, unsigned int secondary_resolution, const Vec3f &center, float radius, float thickness, const Vec3f &model_axis, const Transform3f &world_trafo)
Definition GLModel.cpp:1505

References Slic3r::center(), Slic3r::GUI::GLGizmoMeasure::CircleGLModel::circle, Slic3r::GUI::CIRCLE_ID, Slic3r::GUI::GLModel::Geometry::get_as_indexed_triangle_set(), Slic3r::Measure::SurfaceFeature::get_circle(), Slic3r::GUI::GLModel::init_from(), Slic3r::GUI::init_torus_data(), Slic3r::GUI::GLGizmoMeasure::CircleGLModel::inv_zoom, Slic3r::GUI::GLModel::is_initialized(), Slic3r::GUI::GLGizmoMeasure::CircleGLModel::last_circle_feature, m_curr_circle, m_gripper_id_raycast_map, Slic3r::GUI::PickingModel::mesh_raycaster, Slic3r::GUI::PickingModel::model, Slic3r::normal(), Slic3r::GUI::PickingModel::reset(), and reset_gripper_pick().

Referenced by on_render().

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

◆ init_plane_glmodel()

void Slic3r::GUI::GLGizmoMeasure::init_plane_glmodel ( GripperType gripper_type,
const Measure::SurfaceFeature & feature,
PlaneGLModel & plane_gl_model )
protectedinherited
589{
590 if (!feature.volume) { return; }
591 Selection& selection = m_parent.get_selection();
592 auto volume = static_cast<GLVolume *>(feature.volume);
593 const ModelObject* obj = selection.get_model()->objects[volume->object_idx()];
594 const ModelVolume* vol = obj->volumes[volume->volume_idx()];
595 auto mesh = vol->mesh_ptr();
596 const auto &[idx, normal, pt] = feature.get_plane();
597 if (plane_gl_model.plane_idx != idx) {
598 plane_gl_model.plane.reset();
599 }
600 if (!plane_gl_model.plane.model.is_initialized()) {
601 plane_gl_model.plane_idx = idx;
602 reset_gripper_pick(gripper_type);
603 GLModel::Geometry init_data = init_plane_data(mesh->its, *feature.plane_indices, MEASURE_PLNE_NORMAL_OFFSET);
604 plane_gl_model.plane.mesh_raycaster = std::make_unique<MeshRaycaster>(std::make_shared<const TriangleMesh>(init_data.get_as_indexed_triangle_set()));
605 plane_gl_model.plane.model.init_from(std::move(init_data));
606 if (plane_gl_model.plane.model.is_initialized()) {
607 m_gripper_id_raycast_map[gripper_type] = std::make_shared<PickRaycaster>(PLANE_ID, *plane_gl_model.plane.mesh_raycaster, feature.world_tran);
608 }
609 }
610}
@ Selection
Definition Shortcuts.hpp:72
static const int PLANE_ID
Definition GLGizmoMeasure.hpp:49
GLModel::Geometry init_plane_data(const indexed_triangle_set &its, const std::vector< int > &triangle_indices, float normal_offset)
Definition GLModel.cpp:1478
const float MEASURE_PLNE_NORMAL_OFFSET
Definition GLGizmoMeasure.cpp:587

References Slic3r::GUI::GLModel::Geometry::get_as_indexed_triangle_set(), Slic3r::GUI::Selection::get_model(), Slic3r::Measure::SurfaceFeature::get_plane(), Slic3r::GUI::GLModel::init_from(), Slic3r::GUI::init_plane_data(), Slic3r::GUI::GLModel::is_initialized(), m_gripper_id_raycast_map, Slic3r::GUI::GLGizmoBase::m_parent, Slic3r::GUI::MEASURE_PLNE_NORMAL_OFFSET, Slic3r::ModelVolume::mesh_ptr(), Slic3r::GUI::PickingModel::mesh_raycaster, Slic3r::GUI::PickingModel::model, Slic3r::normal(), Slic3r::Model::objects, Slic3r::GUI::GLGizmoMeasure::PlaneGLModel::plane, Slic3r::GUI::PLANE_ID, Slic3r::GUI::GLGizmoMeasure::PlaneGLModel::plane_idx, Slic3r::Measure::SurfaceFeature::plane_indices, Slic3r::GUI::PickingModel::reset(), reset_gripper_pick(), Slic3r::Measure::SurfaceFeature::volume, Slic3r::ModelObject::volumes, and Slic3r::Measure::SurfaceFeature::world_tran.

Referenced by on_render().

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

◆ init_render_input_window()

void Slic3r::GUI::GLGizmoMeasure::init_render_input_window ( )
protectedinherited
2200{
2201 m_use_inches = wxGetApp().app_config->get_bool("use_inches");
2202 m_units = " " + (m_use_inches ? _u8L_CONTEXT("in", "inches") : _u8L("mm"));
2203 m_space_size = ImGui::CalcTextSize(" ").x * 2;
2204 m_input_size_max = ImGui::CalcTextSize("-100.00").x * 1.2;
2206}
std::string m_units
Definition GLGizmoMeasure.hpp:337
float m_space_size
Definition GLGizmoMeasure.hpp:333
bool is_two_volume_in_same_model_object()
Definition GLGizmoMeasure.cpp:2457
bool m_same_model_object
Definition GLGizmoMeasure.hpp:338
bool m_use_inches
Definition GLGizmoMeasure.hpp:335
float m_input_size_max
Definition GLGizmoMeasure.hpp:334
#define _u8L_CONTEXT(s, ctx)
Definition I18N.hpp:16

References _u8L, _u8L_CONTEXT, is_two_volume_in_same_model_object(), m_input_size_max, m_same_model_object, m_space_size, m_units, and m_use_inches.

Referenced by Slic3r::GUI::GLGizmoAssembly::on_render_input_window(), and on_render_input_window().

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

◆ is_activable()

bool Slic3r::GUI::GLGizmoBase::is_activable ( ) const
inlineinherited
184{ return on_is_activable(); }
virtual bool on_is_activable() const
Definition GLGizmoBase.hpp:246

References on_is_activable().

Referenced by Slic3r::GUI::GLGizmosManager::activate_gizmo(), Slic3r::GUI::GLGizmosManager::do_render_overlay(), Slic3r::GUI::GLGizmoEmboss::init_create(), and Slic3r::GUI::GLGizmosManager::update_hover_state().

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

◆ is_dragging()

bool Slic3r::GUI::GLGizmoBase::is_dragging ( ) const
inlineinherited
209{ return m_dragging; }

References m_dragging.

Referenced by Slic3r::GUI::GLGizmoCut3D::gizmo_event(), Slic3r::GUI::GLGizmoEmboss::on_mouse_for_translate(), and Slic3r::GUI::GLGizmoSVG::on_mouse_for_translate().

Here is the caller graph for this function:

◆ is_feature_with_center()

bool Slic3r::GUI::GLGizmoMeasure::is_feature_with_center ( const Measure::SurfaceFeature & feature)
protectedinherited
123{
124 const Measure::SurfaceFeatureType type = feature.get_type();
125 return (type == Measure::SurfaceFeatureType::Circle || (type == Measure::SurfaceFeatureType::Edge && feature.get_extra_point().has_value()));
126}
SurfaceFeatureType
Definition Measure.hpp:23

References Slic3r::Measure::Circle, Slic3r::Measure::Edge, Slic3r::Measure::SurfaceFeature::get_extra_point(), and Slic3r::Measure::SurfaceFeature::get_type().

Referenced by on_mouse(), and on_render().

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

◆ is_in_editing_mode()

virtual bool Slic3r::GUI::GLGizmoBase::is_in_editing_mode ( ) const
inlinevirtualinherited

Reimplemented in Slic3r::GUI::GLGizmoCut3D.

235{ return false; }

Referenced by Slic3r::GUI::GLGizmosManager::on_key().

Here is the caller graph for this function:

◆ is_pick_meet_assembly_mode()

bool Slic3r::GUI::GLGizmoMeasure::is_pick_meet_assembly_mode ( const SelectedFeatures::Item & item)
protectedinherited
2736 {
2738 if (m_assembly_mode == AssemblyMode::FACE_FACE && item.feature->get_type() == Measure::SurfaceFeatureType::Plane) {
2739 return true;
2740 }
2742 (item.feature->get_type() == Measure::SurfaceFeatureType::Point||
2743 item.feature->get_type() == Measure::SurfaceFeatureType::Circle)) {
2744 return true;
2745 }
2746 return false;
2747 }
2748 else {
2749 return true;
2750 }
2751}
AssemblyMode m_assembly_mode
Definition GLGizmoMeasure.hpp:331
@ FACE_FACE
Definition GLGizmoMeasure.hpp:38
@ POINT_POINT
Definition GLGizmoMeasure.hpp:39
@ Plane
Definition Measure.hpp:28

References Slic3r::Measure::Circle, Slic3r::GUI::FACE_FACE, Slic3r::GUI::GLGizmoMeasure::SelectedFeatures::Item::feature, m_assembly_mode, m_measure_mode, Slic3r::GUI::ONLY_ASSEMBLY, Slic3r::Measure::Plane, Slic3r::Measure::Point, and Slic3r::GUI::POINT_POINT.

Referenced by on_mouse().

Here is the caller graph for this function:

◆ is_selectable()

bool Slic3r::GUI::GLGizmoBase::is_selectable ( ) const
inlineinherited
185{ return on_is_selectable(); }
virtual bool on_is_selectable() const
Definition GLGizmoBase.hpp:247

References on_is_selectable().

Here is the call graph for this function:

◆ is_selection_rectangle_dragging()

virtual bool Slic3r::GUI::GLGizmoBase::is_selection_rectangle_dragging ( ) const
inlinevirtualinherited

Reimplemented in Slic3r::GUI::GLGizmoBrimEars, and Slic3r::GUI::GLGizmoCut3D.

236{ return false; }

◆ is_two_volume_in_same_model_object()

bool Slic3r::GUI::GLGizmoMeasure::is_two_volume_in_same_model_object ( )
protectedinherited
2458{
2459 if (m_hit_different_volumes.size() == 2) {
2460 if (m_hit_different_volumes[0]->composite_id.object_id == m_hit_different_volumes[1]->composite_id.object_id) {
2461 return true;
2462 }
2463 }
2464 return false;
2465}
std::vector< GLVolume * > m_hit_different_volumes
Definition GLGizmoMeasure.hpp:209

References m_hit_different_volumes.

Referenced by init_render_input_window().

Here is the caller graph for this function:

◆ load()

void Slic3r::GUI::GLGizmoBase::load ( cereal::BinaryInputArchive & ar)
inlineinherited
170{ m_state = On; on_load(ar); }
virtual void on_load(cereal::BinaryInputArchive &ar)
Definition GLGizmoBase.hpp:241

References m_state, On, and on_load().

Here is the call graph for this function:

◆ load_render_colors()

void Slic3r::GUI::GLGizmoBase::load_render_colors ( )
staticinherited
93{
99}
@ RenderCol_Grabber_Y
Definition GUI_Colors.hpp:27
@ RenderCol_Flatten_Plane
Definition GUI_Colors.hpp:29
@ RenderCol_Grabber_X
Definition GUI_Colors.hpp:26
@ RenderCol_Grabber_Z
Definition GUI_Colors.hpp:28
@ RenderCol_Flatten_Plane_Hover
Definition GUI_Colors.hpp:30
static ColorRGBA FLATTEN_COLOR
Definition GLGizmoBase.hpp:63
static std::array< ColorRGBA, 3 > AXES_COLOR
Definition GLGizmoBase.hpp:60
static ColorRGBA FLATTEN_HOVER_COLOR
Definition GLGizmoBase.hpp:64
static ImVec4 to_ImVec4(const ColorRGB &color)
Definition ImGuiWrapper.cpp:1053
static ImVec4 colors[RenderCol_Count]
Definition GUI_Colors.hpp:40

References AXES_COLOR, Slic3r::RenderColor::colors, FLATTEN_COLOR, FLATTEN_HOVER_COLOR, RenderCol_Flatten_Plane, RenderCol_Flatten_Plane_Hover, RenderCol_Grabber_X, RenderCol_Grabber_Y, RenderCol_Grabber_Z, and Slic3r::GUI::ImGuiWrapper::to_ImVec4().

Referenced by Slic3r::GUI::GLCanvas3D::init().

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

◆ on_change_color_mode()

virtual void Slic3r::GUI::GLGizmoBase::on_change_color_mode ( bool is_dark)
inlinevirtualinherited
static bool is_dark()
Definition TextureImportDialog.cpp:85
bool m_is_dark_mode
Definition GLGizmoBase.hpp:157

References is_dark(), and m_is_dark_mode.

Here is the call graph for this function:

◆ on_disable_grabber()

virtual void Slic3r::GUI::GLGizmoBase::on_disable_grabber ( unsigned int id)
inlineprotectedvirtualinherited

◆ on_dragging()

virtual void Slic3r::GUI::GLGizmoBase::on_dragging ( const UpdateData & data)
inlineprotectedvirtualinherited

Reimplemented in Slic3r::GUI::GLGizmoBrimEars, Slic3r::GUI::GLGizmoCut3D, Slic3r::GUI::GLGizmoEmboss, Slic3r::GUI::GLGizmoMove3D, Slic3r::GUI::GLGizmoRotate3D, Slic3r::GUI::GLGizmoRotate, Slic3r::GUI::GLGizmoScale3D, and Slic3r::GUI::GLGizmoSVG.

255{}

Referenced by use_grabbers().

Here is the caller graph for this function:

◆ on_enable_grabber()

virtual void Slic3r::GUI::GLGizmoBase::on_enable_grabber ( unsigned int id)
inlineprotectedvirtualinherited

◆ on_get_name()

std::string Slic3r::GUI::GLGizmoAssembly::on_get_name ( ) const
overrideprotectedvirtual

Implements Slic3r::GUI::GLGizmoBase.

41{
42 if (!on_is_activable() && m_state == EState::Off) {
43 if (wxGetApp().plater()->canvas3D()->get_canvas_type() == GLCanvas3D::ECanvasType::CanvasAssembleView) {
44 return _u8L_CONTEXT("Assemble", "Assembly tool") + ":\n" + _u8L("Please confirm explosion ratio = 1 and select at least two volumes.");
45 }
46 else {
47 return _u8L_CONTEXT("Assemble", "Assembly tool") + ":\n" + _u8L("Please select at least two volumes.");
48 }
49 } else {
50 return _u8L_CONTEXT("Assemble", "Assembly tool");
51 }
52}
@ CanvasAssembleView
Definition GLCanvas3D.hpp:628
bool on_is_activable() const override
Definition GLGizmoAssembly.cpp:62
static Plater * plater()
Definition GUI_Factories.cpp:400

References _u8L, _u8L_CONTEXT, Slic3r::GUI::GLCanvas3D::CanvasAssembleView, Slic3r::GUI::GLGizmoBase::m_state, Slic3r::GUI::GLGizmoBase::Off, on_is_activable(), and Slic3r::GUI::plater().

Here is the call graph for this function:

◆ on_get_requirements()

virtual CommonGizmosDataID Slic3r::GUI::GLGizmoBase::on_get_requirements ( ) const
inlineprotectedvirtualinherited

Reimplemented in Slic3r::GUI::GLGizmoBrimEars, Slic3r::GUI::GLGizmoCut3D, Slic3r::GUI::GLGizmoFlatten, Slic3r::GUI::GLGizmoMeshBoolean, Slic3r::GUI::GLGizmoPainterBase, and Slic3r::GUI::GLGizmoSimplify.

248{ return CommonGizmosDataID(0); }
CommonGizmosDataID
Definition GLGizmosCommon.hpp:72

Referenced by get_requirements().

Here is the caller graph for this function:

◆ on_init()

bool Slic3r::GUI::GLGizmoAssembly::on_init ( )
overrideprotectedvirtual

Implements Slic3r::GUI::GLGizmoBase.

55{
57
59 return true;
60}
bool on_init() override
Definition GLGizmoMeasure.cpp:496
@ GizmoAssembly
Definition Shortcuts.hpp:41

References Slic3r::GUI::GizmoAssembly, Slic3r::GUI::GLGizmoBase::m_shortcut, and Slic3r::GUI::GLGizmoMeasure::on_init().

Here is the call graph for this function:

◆ on_is_activable()

bool Slic3r::GUI::GLGizmoAssembly::on_is_activable ( ) const
overrideprotectedvirtual

Reimplemented from Slic3r::GUI::GLGizmoBase.

63{
64 const Selection& selection = m_parent.get_selection();
65 if (selection.is_wipe_tower()) {
66 return false;
67 }
68 const int selection_volumes_count = 2;
69 if (wxGetApp().plater()->canvas3D()->get_canvas_type() == GLCanvas3D::ECanvasType::CanvasAssembleView) {
70 if (abs(m_parent.get_explosion_ratio() - 1.0f) < 1e-2 && selection.volumes_count() >= selection_volumes_count) {
71 return true;
72 }
73 return false;
74 } else {
75 return selection.volumes_count() >= selection_volumes_count;
76 }
77}

References Slic3r::GUI::GLCanvas3D::CanvasAssembleView, Slic3r::GUI::Selection::is_wipe_tower(), Slic3r::GUI::GLGizmoBase::m_parent, Slic3r::GUI::plater(), and Slic3r::GUI::Selection::volumes_count().

Referenced by on_get_name().

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

◆ on_is_selectable()

virtual bool Slic3r::GUI::GLGizmoBase::on_is_selectable ( ) const
inlineprotectedvirtualinherited

Reimplemented in Slic3r::GUI::GLGizmoCut3D, Slic3r::GUI::GLGizmoMmuSegmentation, Slic3r::GUI::GLGizmoPainterBase, Slic3r::GUI::GLGizmoSimplify, and Slic3r::GUI::GLGizmoSVG.

247{ return true; }

Referenced by is_selectable().

Here is the caller graph for this function:

◆ on_load()

virtual void Slic3r::GUI::GLGizmoBase::on_load ( cereal::BinaryInputArchive & ar)
inlineprotectedvirtualinherited

Reimplemented in Slic3r::GUI::GLGizmoBrimEars, Slic3r::GUI::GLGizmoCut3D, Slic3r::GUI::GLGizmoMeshBoolean, and Slic3r::GUI::GLGizmoPainterBase.

241{}

Referenced by load().

Here is the caller graph for this function:

◆ on_mouse()

bool Slic3r::GUI::GLGizmoMeasure::on_mouse ( const wxMouseEvent & mouse_event)
overridevirtualinherited

Apply rotation on select plane.

Parameters
mouse_eventKeep information about mouse click
Returns
Return True when use the information otherwise False.

Reimplemented from Slic3r::GUI::GLGizmoBase.

246{
247 if (mouse_event.Moving()) {
248 // only for sure
249 m_mouse_left_down = false;
250 return false;
251 }
252 else if (mouse_event.Dragging()) {
253 // Enable/Disable panning/rotating the 3D scene
254 // Ctrl is pressed or the mouse is not hovering a selected volume
255 bool unlock_dragging = mouse_event.CmdDown() || (m_hover_id == -1 && !m_parent.get_selection().contains_volume(m_parent.get_first_hover_volume_idx()));
256 // mode is not center selection or mouse is not hovering a center
257 unlock_dragging &= !mouse_event.ShiftDown() || (m_hover_id != SEL_SPHERE_1_ID && m_hover_id != SEL_SPHERE_2_ID && m_hover_id != POINT_ID);
258 return !unlock_dragging;
259 }
260 else if (mouse_event.LeftDown()) {
261 // let the event pass through to allow panning/rotating the 3D scene
262 if (mouse_event.CmdDown())
263 return false;
264
265 if (m_hover_id != -1) {
266 m_mouse_left_down = true;
268 auto detect_current_item = [this]() {
271 if (m_selected_features.first.is_center)
272 // mouse is hovering over a selected center
273 item = { true, m_selected_features.first.source, { Measure::SurfaceFeature(get_feature_offset(*m_selected_features.first.source)) } };
274 else if (is_feature_with_center(*m_selected_features.first.feature))
275 // mouse is hovering over a unselected center
276 item = { true, m_selected_features.first.feature, { Measure::SurfaceFeature(get_feature_offset(*m_selected_features.first.feature)) } };
277 else
278 // mouse is hovering over a point
279 item = m_selected_features.first;
280 }
281 else if (m_hover_id == SEL_SPHERE_2_ID) {
282 if (m_selected_features.second.is_center)
283 // mouse is hovering over a selected center
284 item = { true, m_selected_features.second.source, { Measure::SurfaceFeature(get_feature_offset(*m_selected_features.second.source)) } };
285 else if (is_feature_with_center(*m_selected_features.second.feature))
286 // mouse is hovering over a center
287 item = { true, m_selected_features.second.feature, { Measure::SurfaceFeature(get_feature_offset(*m_selected_features.second.feature)) } };
288 else
289 // mouse is hovering over a point
290 item = m_selected_features.second;
291 }
292 else {
293 switch (m_mode)
294 {
295 case EMode::FeatureSelection: { item = { false, m_curr_feature, m_curr_feature }; break; }
297 item = { false, m_curr_feature, Measure::SurfaceFeature(*m_curr_point_on_feature_position)};
298 auto local_pt = m_curr_feature->world_tran.inverse() * (*m_curr_point_on_feature_position);
299 item.feature->origin_surface_feature = std::make_shared<Measure::SurfaceFeature>(local_pt);
300 item.feature->world_tran = m_curr_feature->world_tran;
301 item.feature->volume = m_curr_feature->volume;
302 break; }
303 }
304 }
305 return item;
306 };
307
308 auto requires_sphere_raycaster_for_picking = [this](const SelectedFeatures::Item& item) {
309 if (m_mode == EMode::PointSelection || item.feature->get_type() == Measure::SurfaceFeatureType::Point)
310 return true;
311 else if (m_mode == EMode::FeatureSelection) {
312 if (is_feature_with_center(*item.feature))
313 return true;
314 }
315 return false;
316 };
317
318 if (m_selected_features.first.feature.has_value()) {
320 const SelectedFeatures::Item item = detect_current_item();
321 if (!is_pick_meet_assembly_mode(item)) { // assembly deal
323 return true;
324 }
326 if (m_selected_features.first != item) {
327 bool processed = false;
328 if (item.is_center) {
329 if (item.source == m_selected_features.first.feature) {
330 // switch 1st selection from feature to its center
331 m_selected_features.first = item;
332 processed = true;
333 }
334 else if (item.source == m_selected_features.second.feature) {
335 // switch 2nd selection from feature to its center
336 m_selected_features.second = item;
337 processed = true;
338 }
339 }
340 else if (is_feature_with_center(*item.feature)) {
341 if (m_selected_features.first.is_center && m_selected_features.first.source == item.feature) {
342 // switch 1st selection from center to its feature
343 m_selected_features.first = item;
344 processed = true;
345 }
346 else if (m_selected_features.second.is_center && m_selected_features.second.source == item.feature) {
347 // switch 2nd selection from center to its feature
348 m_selected_features.second = item;
349 processed = true;
350 }
351 }
352
353 if (!processed) {
355 if (m_selected_features.second == item) {
356 // 2nd feature deselection
357 // m_selected_features.second.reset();
359 }
360 else {
361 // 2nd feature selection
362 m_selected_features.second = item;
363 if (requires_sphere_raycaster_for_picking(item)) {
364 auto pick = std::make_shared<PickRaycaster>(SEL_SPHERE_2_ID, *m_sphere.mesh_raycaster);
366 }
367 }
368 }
369 }
370 else {
372 if (m_selected_features.second.feature.has_value()) {
373 // promote 2nd feature to 1st feature
375 if (requires_sphere_raycaster_for_picking(m_selected_features.first)) {
376 auto pick = std::make_shared<PickRaycaster>(SEL_SPHERE_1_ID, *m_sphere.mesh_raycaster);
378 }
379 } else {
380 // 1st feature deselection
382 }
383 }
384 }
385 else {
386 // 1st feature selection
388 const SelectedFeatures::Item item = detect_current_item();
389 if (!is_pick_meet_assembly_mode(item)) {//assembly deal
391 return true;
392 }
394 m_selected_features.first = item;
395 if (requires_sphere_raycaster_for_picking(item)) {
396 auto pick = std::make_shared<PickRaycaster>(SEL_SPHERE_1_ID, *m_sphere.mesh_raycaster);
398 }
399 }
400
402
403 m_imgui->set_requires_extra_frame();
404 return true;
405 }
406 else
407 // if the mouse pointer is on any volume, filter out the event to prevent the user to move it
408 // equivalent tp: return (m_parent.get_first_hover_volume_idx() != -1);
409 return m_curr_feature.has_value();
410
411 // fix: prevent restart gizmo when reselect object
412 // take responsibility for left up
413 if (m_parent.get_first_hover_volume_idx() >= 0)
414 m_mouse_left_down = true;
415 }
416 else if (mouse_event.LeftUp()) {
417 if (m_mouse_left_down) {
418 // responsible for mouse left up after selecting plane
419 m_mouse_left_down = false;
420 return true;
421 }
422 if (m_hover_id == -1 && !m_parent.is_mouse_dragging())
423 // avoid closing the gizmo if the user clicks outside of any volume
424 return true;
425 }
426 else if (mouse_event.RightDown()) {
427 // let the event pass through to allow panning/rotating the 3D scene
428 if (mouse_event.CmdDown())
429 return false;
430 }
431 else if (mouse_event.Leaving())
432 m_mouse_left_down = false;
433
434 return false;
435}
std::optional< Measure::SurfaceFeature > m_curr_feature
Definition GLGizmoMeasure.hpp:220
std::optional< Vec3d > m_curr_point_on_feature_position
Definition GLGizmoMeasure.hpp:221
void reset_feature2_render()
Definition GLGizmoMeasure.cpp:2393
bool m_selected_wrong_feature_waring_tip
Definition GLGizmoMeasure.hpp:329
bool is_feature_with_center(const Measure::SurfaceFeature &feature)
Definition GLGizmoMeasure.cpp:122
bool is_pick_meet_assembly_mode(const SelectedFeatures::Item &item)
Definition GLGizmoMeasure.cpp:2736
bool m_mouse_left_down_mesh_deal
Definition GLGizmoMeasure.hpp:229
bool m_mouse_left_down
Definition GLGizmoMeasure.hpp:228
Vec3d get_feature_offset(const Measure::SurfaceFeature &feature)
Definition GLGizmoMeasure.cpp:128
void remove_selected_sphere_raycaster(int id)
Definition GLGizmoMeasure.cpp:2282
PickingModel m_sphere
Definition GLGizmoMeasure.hpp:177
void reset_feature1_render()
Definition GLGizmoMeasure.cpp:2380
static const int SEL_SPHERE_1_ID
Definition GLGizmoMeasure.hpp:50
static const int SEL_SPHERE_2_ID
Definition GLGizmoMeasure.hpp:51
static const int POINT_ID
Definition GLGizmoMeasure.hpp:46

References Slic3r::GUI::GLGizmoMeasure::SelectedFeatures::Item::feature, FeatureSelection, get_feature_offset(), Slic3r::GUI::GLGizmoMeasure::SelectedFeatures::Item::is_center, is_feature_with_center(), is_pick_meet_assembly_mode(), m_curr_feature, m_curr_point_on_feature_position, m_gripper_id_raycast_map, Slic3r::GUI::GLGizmoBase::m_hover_id, Slic3r::GUI::GLGizmoBase::m_imgui, m_mode, m_mouse_left_down, m_mouse_left_down_mesh_deal, Slic3r::GUI::GLGizmoBase::m_parent, m_selected_features, m_selected_wrong_feature_waring_tip, m_sphere, Slic3r::Measure::Point, Slic3r::GUI::POINT_ID, PointSelection, remove_selected_sphere_raycaster(), reset_feature1(), reset_feature1_render(), reset_feature2(), reset_feature2_render(), Slic3r::GUI::SEL_SPHERE_1_ID, Slic3r::GUI::SEL_SPHERE_2_ID, Slic3r::GUI::GLGizmoMeasure::SelectedFeatures::Item::source, SPHERE_1, SPHERE_2, update_measurement_result(), and Slic3r::GUI::wxMouseEvent.

Here is the call graph for this function:

◆ on_register_raycasters_for_picking()

virtual void Slic3r::GUI::GLGizmoBase::on_register_raycasters_for_picking ( )
inlineprotectedvirtualinherited

Reimplemented in Slic3r::GUI::GLGizmoBrimEars, Slic3r::GUI::GLGizmoCut3D, Slic3r::GUI::GLGizmoEmboss, Slic3r::GUI::GLGizmoFlatten, Slic3r::GUI::GLGizmoMove3D, Slic3r::GUI::GLGizmoRotate3D, Slic3r::GUI::GLGizmoScale3D, and Slic3r::GUI::GLGizmoSVG.

267{}

Referenced by register_raycasters_for_picking().

Here is the caller graph for this function:

◆ on_render()

void Slic3r::GUI::GLGizmoMeasure::on_render ( )
overrideprotectedvirtualinherited

Implements Slic3r::GUI::GLGizmoBase.

634{
636#if ENABLE_MEASURE_GIZMO_DEBUG
637 render_debug_dialog();
638#endif // ENABLE_MEASURE_GIZMO_DEBUG
639
640 Vec2d mouse_position = m_parent.get_local_mouse_position();
642
643 const Camera& camera = wxGetApp().plater()->get_camera();
644 const float inv_zoom = (float)camera.get_inv_zoom();
645 bool mouse_on_gripper = false;
646 bool mouse_on_object =false;
647 {
648 if (!m_editing_distance) {
649 Vec3f hit = Vec3f::Zero();
650 double closest_hit_squared_distance = std::numeric_limits<double>::max();
651 for (auto item : m_gripper_id_raycast_map) {
652
653 auto world_tran = item.second->get_transform();
654 Vec3f normal_on_gripper;
655 if (item.second->get_raycaster()->closest_hit(mouse_position, item.second->get_transform(), camera, hit, normal_on_gripper)) {
656 double hit_squared_distance = (camera.get_position() - world_tran * hit.cast<double>()).squaredNorm();
657 if (hit_squared_distance < closest_hit_squared_distance) {
658 closest_hit_squared_distance = hit_squared_distance;
659 if (item.second->get_id() > 0) {
660 m_hover_id = item.second->get_id();
661 mouse_on_gripper = true;
662 }
663 }
664 }
665 }
666 }
667 }
668 Vec3d position_on_model;
669 size_t model_facet_idx = -1;
670 double closest_hit_distance = std::numeric_limits<double>::max();
671 {
672 if (!m_editing_distance) {
673 for (auto item : m_mesh_raycaster_map) {
674 auto raycaster = item.second->get_raycaster();
675 auto world_tran = item.second->get_transform();
676 Vec3f normal = Vec3f::Zero();
677 Vec3f hit = Vec3f::Zero();
678 size_t facet = 0;
679 if (raycaster->unproject_on_mesh(mouse_position, world_tran, camera, hit, normal, nullptr, &facet)) {
680 // Is this hit the closest to the camera so far?
681 double hit_squared_distance = (camera.get_position() - world_tran * hit.cast<double>()).norm();
682 if (hit_squared_distance < closest_hit_distance) {
683 closest_hit_distance = hit_squared_distance;
684 mouse_on_object = true;
685 model_facet_idx = facet;
686 position_on_model = hit.cast<double>();
687 m_last_hit_volume = item.first;
689 }
690 }
691 }
692 }
693
694 if (!(mouse_on_gripper || mouse_on_object)) {
695 m_hover_id = -1;
696 m_last_plane_idx = -1;
699 }
702 if (m_selected_features.second.feature.has_value()) {
703 if (m_hit_order_volumes.size() == 1) {
705 } else {
707 }
708 // deal hit_different_volumes
709 if (m_hit_different_volumes.size() >= 1) {
711 if (m_hit_different_volumes.size() == 2) {//hit same volume
713 }
714 } else {
715 if (m_hit_different_volumes.size() == 2) {
717 } else {
719 }
720 }
721 }
722 }
723 else if (m_selected_features.first.feature.has_value()) {
724 if (m_hit_order_volumes.size() == 0) {
726 } else {
728 }
729 //deal hit_different_volumes
730 if (m_hit_different_volumes.size() == 0) {
732 }
733 }
734 }
735 }
736 //const bool mouse_on_object = m_raycaster->unproject_on_mesh(mouse_position, Transform3d::Identity(), camera, position_on_model, normal_on_model, nullptr, &model_facet_idx);
737 const bool is_hovering_on_feature = m_mode == EMode::PointSelection && m_hover_id != -1;
738
741 // Skip feature detection if hovering on a selected point/center
742 //reset_gripper_pick(GripperType::UNDEFINE, true);
743 m_curr_feature.reset();
745 }
746 else {
747 std::optional<Measure::SurfaceFeature> curr_feature = std::nullopt;
748 if (m_curr_measuring) {
749 curr_feature = wxGetMouseState().LeftIsDown() ? m_curr_feature :
750 mouse_on_object ? m_curr_measuring->get_feature(model_facet_idx, position_on_model,
752 std::nullopt;
753 }
754 if (m_measure_mode == EMeasureMode::ONLY_ASSEMBLY && curr_feature.has_value()) {
756 if (curr_feature->get_type() != Measure::SurfaceFeatureType::Plane) {
757 curr_feature.reset();
758 }
760 if (!(curr_feature->get_type() == Measure::SurfaceFeatureType::Point ||
761 curr_feature->get_type() == Measure::SurfaceFeatureType::Circle ||
762 (m_mode == EMode::PointSelection && (curr_feature->get_type() == Measure::SurfaceFeatureType::Plane || curr_feature->get_type() == Measure::SurfaceFeatureType::Edge)))) {
763 curr_feature.reset();
764 }
765 }
766 }
767 if (m_curr_feature != curr_feature ||
768 (curr_feature.has_value() && curr_feature->get_type() == Measure::SurfaceFeatureType::Circle && (m_curr_feature != curr_feature || m_last_inv_zoom != inv_zoom))) {
770
771 m_curr_feature = curr_feature;
772 // The selected features are drawn below whether or not one is hovered.
773 if (m_curr_feature.has_value()) {
775 m_curr_feature->world_tran = m_mesh_raycaster_map[m_last_hit_volume]->get_transform();
776
777 switch (m_curr_feature->get_type()) {
778 default: { assert(false); break; }
780 {
781 m_gripper_id_raycast_map[GripperType::POINT] = std::make_shared<PickRaycaster>(POINT_ID, *m_sphere.mesh_raycaster);
782 break;
783 }
785 {
786 m_gripper_id_raycast_map[GripperType::EDGE] = std::make_shared<PickRaycaster>(EDGE_ID, *m_cylinder.mesh_raycaster);
787 break;
788 }
790 m_curr_circle.last_circle_feature = nullptr;
791 m_curr_circle.inv_zoom = 0;
793 break;
794 }
797 m_curr_plane.plane_idx = -1;
799 break;
800 }
801 }
802 }
803 }
804 }
805 }
806
809 }
810 else if (is_hovering_on_feature) {
811 auto position_on_feature = [this, &mouse_position](int feature_type_id, const Camera &camera, std::function<Vec3f(const Vec3f &)> callback = nullptr) -> Vec3d {
812 auto it = m_gripper_id_raycast_map.find((GripperType) feature_type_id); // m_raycasters.find(feature_type_id);
813 if (it != m_gripper_id_raycast_map.end() && it->second != nullptr) {
814 Vec3f p;
815 Vec3f n;
816 const Transform3d& trafo = it->second->get_transform();
817 bool res = it->second->get_raycaster()->closest_hit(mouse_position, trafo, camera, p, n);
818 if (res) {
819 if (callback)
820 p = callback(p);
821 return trafo * p.cast<double>();
822 }
823 }
824 return Vec3d(DBL_MAX, DBL_MAX, DBL_MAX);
825 };
826 if (m_curr_feature.has_value()) {
827 switch (m_curr_feature->get_type())
828 {
829 default: { assert(false); break; }
831 {
833 break;
834 }
836 {
837 const std::optional<Vec3d> extra = m_curr_feature->get_extra_point();
838 if (extra.has_value() && m_hover_id == GripperType::POINT)
840 else {
841 const Vec3d pos = position_on_feature(GripperType::EDGE, camera, [](const Vec3f &v) { return Vec3f(0.0f, 0.0f, v.z()); });
842 if (!pos.isApprox(Vec3d(DBL_MAX, DBL_MAX, DBL_MAX)))
844 }
845 break;
846 }
848 {
849 m_curr_point_on_feature_position = position_on_feature(GripperType::PLANE, camera);
850 break;
851 }
853 {
854 const auto [center, radius, normal] = m_curr_feature->get_circle();
855 if (m_hover_id == POINT_ID)
857 else {
858 const Vec3d world_pof = position_on_feature(GripperType::CIRCLE, camera, [](const Vec3f &v) { return v; });
859 const Eigen::Hyperplane<double, 3> plane(normal, center);
860 const Transform3d local_to_model_matrix = Geometry::translation_transform(center) * Eigen::Quaternion<double>::FromTwoVectors(Vec3d::UnitZ(), normal);
861 const Vec3d local_proj = local_to_model_matrix.inverse() * plane.projection(world_pof);
862 double angle = std::atan2(local_proj.y(), local_proj.x());
863 if (angle < 0.0)
864 angle += 2.0 * double(M_PI);
865
866 const Vec3d local_pos = radius * Vec3d(std::cos(angle), std::sin(angle), 0.0);
867 m_curr_point_on_feature_position = local_to_model_matrix * local_pos;
868 }
869 break;
870 }
871 }
872 }
873 }
874 else {
876 }
877
878 if (!m_curr_feature.has_value() && !m_selected_features.first.feature.has_value()) {
879 return;
880 }
881
882 GLShaderProgram* shader = wxGetApp().get_shader("gouraud_light");
883 if (shader == nullptr)
884 return;
885
886 shader->start_using();
887 shader->set_uniform("projection_matrix", camera.get_projection_matrix());
888
891 const bool old_cullface = ::glIsEnabled(GL_CULL_FACE);
893
894 const Transform3d& view_matrix = camera.get_view_matrix();
895
896 auto set_matrix_uniforms = [shader, &view_matrix](const Transform3d& model_matrix) {
897 const Transform3d view_model_matrix = view_matrix * model_matrix;
898 shader->set_uniform("view_model_matrix", view_model_matrix);
899 const Matrix3d view_normal_matrix = view_matrix.matrix().block(0, 0, 3, 3) * model_matrix.matrix().block(0, 0, 3, 3).inverse().transpose();
900 shader->set_uniform("view_normal_matrix", view_normal_matrix);
901 };
902
903 auto set_emission_uniform = [shader](const ColorRGBA& color, bool hover) {
904 shader->set_uniform("emission_factor", /*(color == GLVolume::SELECTED_COLOR) ? 0.0f :*/
905 hover ? 0.5f : 0.25f);
906 };
907
908 auto render_glmodel = [set_matrix_uniforms, set_emission_uniform](PickingModel& model, const ColorRGBA& color, const Transform3d& model_matrix, bool hover) {
909 set_matrix_uniforms(model_matrix);
910 set_emission_uniform(color, hover);
911 model.model.set_color(color);
912 model.model.render();
913 };
914
915 auto render_feature =
916 [this, render_glmodel](const Measure::SurfaceFeature& feature, const std::vector<ColorRGBA>& colors,
917 float inv_zoom, bool hover, bool update_raycasters_transform,int featura_index = -1) {
918 switch (feature.get_type())
919 {
920 default: { assert(false); break; }
922 {
923 const Transform3d feature_matrix = Geometry::translation_transform(feature.get_point()) * Geometry::scale_transform(inv_zoom);
924 Geometry::Transformation tran(feature_matrix);
925 render_glmodel(m_sphere, colors.front(), tran.get_matrix(), hover);
926 if (update_raycasters_transform) {
928 if (it != m_gripper_id_raycast_map.end() && it->second != nullptr)
929 it->second->set_transform(feature_matrix);
930 }
931 break;
932 }
934 {
935 const auto& [center, radius, normal] = feature.get_circle();
936 // render circle
937 const Transform3d circle_matrix = Transform3d::Identity();
938 //set_matrix_uniforms(circle_matrix);
939 Geometry::Transformation tran(circle_matrix);
940 if (featura_index == -1) {
942 render_glmodel(m_curr_circle.circle, colors.front(), tran.get_matrix(), hover);
943 }
944 // render plane feature1 or feature2
945 if (featura_index == 0) { // feature1
947 render_glmodel(m_feature_circle_first.circle, colors.front(), tran.get_matrix(), hover);
948 } else if (featura_index == 1) { // feature2
950 render_glmodel(m_feature_circle_second.circle, colors.front(), tran.get_matrix(), hover);
951 }
952 // render center
953 if (colors.size() > 1) {
955 render_glmodel(m_sphere, colors.back(), center_matrix, hover);
956
957 Geometry::Transformation tran(center_matrix);
959 if (it != m_gripper_id_raycast_map.end() && it->second != nullptr)
960 it->second->set_transform(center_matrix);
961 }
962 break;
963 }
965 {
966 const auto& [from, to] = feature.get_edge();
967 // render edge
968 const Transform3d edge_matrix = Geometry::translation_transform(from) *
969 Eigen::Quaternion<double>::FromTwoVectors(Vec3d::UnitZ(), to - from) *
970 Geometry::scale_transform({ (double)inv_zoom, (double)inv_zoom, (to - from).norm() });
971
972 Geometry::Transformation tran(edge_matrix);
973 render_glmodel(m_cylinder, colors.front(), tran.get_matrix(), hover);
974 if (update_raycasters_transform) {
976 if (it != m_gripper_id_raycast_map.end() && it->second != nullptr){
977 it->second->set_transform(edge_matrix);
978 }
979 }
980 // render extra point
981 if (colors.size() > 1) {
982 const std::optional<Vec3d> extra = feature.get_extra_point();
983 if (extra.has_value()) {
984 const Transform3d point_matrix = Geometry::translation_transform(*extra) * Geometry::scale_transform(inv_zoom);
985 Geometry::Transformation tran(point_matrix);
986 render_glmodel(m_sphere, colors.back(), tran.get_matrix(), hover);
987
989 if (it != m_gripper_id_raycast_map.end() && it->second != nullptr) {
990 it->second->set_transform(point_matrix);
991 }
992 }
993 }
994 break;
995 }
997 if (featura_index == -1) {
998 render_glmodel(m_curr_plane.plane, colors.back(), feature.world_tran, hover);
999 break;
1000 }
1001 //render plane feature1 or feature2
1002 if (featura_index == 0) {//feature1
1004 render_glmodel(m_feature_plane_first.plane, colors.back(), feature.world_tran, hover);
1005 } else if (featura_index == 1) {//feature2
1007 render_glmodel(m_feature_plane_second.plane, colors.back(), feature.world_tran, hover);
1008 }
1009 break;
1010 }
1011 }
1012 };
1013
1014 auto hover_selection_color = [this]() {
1015 return ((m_mode == EMode::PointSelection && !m_selected_features.first.feature.has_value()) ||
1016 (m_mode != EMode::PointSelection && (!m_selected_features.first.feature.has_value() || *m_curr_feature == *m_selected_features.first.feature))) ?
1018 };
1019
1020 auto hovering_color = [this, hover_selection_color]() {
1021 return (m_mode == EMode::PointSelection) ? HOVER_COLOR : hover_selection_color();
1022 };
1023
1024 if (m_curr_feature.has_value()) {
1025 // render hovered feature
1026 std::vector<ColorRGBA> colors;
1027 if (m_selected_features.first.feature.has_value() && *m_curr_feature == *m_selected_features.first.feature) {
1028 // hovering over the 1st selected feature
1029 if (m_selected_features.first.is_center)
1030 // hovering over a center
1031 colors = { NEUTRAL_COLOR, hovering_color() };
1032 else if (is_feature_with_center(*m_selected_features.first.feature))
1033 // hovering over a feature with center
1034 colors = { hovering_color(), NEUTRAL_COLOR };
1035 else
1036 colors = { hovering_color() };
1037 }
1038 else if (m_selected_features.second.feature.has_value() && *m_curr_feature == *m_selected_features.second.feature) {
1039 // hovering over the 2nd selected feature
1040 if (m_selected_features.second.is_center)
1041 // hovering over a center
1042 colors = { NEUTRAL_COLOR, hovering_color() };
1043 else if (is_feature_with_center(*m_selected_features.second.feature))
1044 // hovering over a feature with center
1045 colors = { hovering_color(), NEUTRAL_COLOR };
1046 else
1047 colors = { hovering_color() };
1048 }
1049 else {
1050 switch (m_curr_feature->get_type())
1051 {
1052 default: { assert(false); break; }
1054 {
1055 colors.emplace_back(hover_selection_color());
1056 break;
1057 }
1060 {
1061 if (m_selected_features.first.is_center && m_curr_feature == m_selected_features.first.source)
1062 colors = { SELECTED_1ST_COLOR, NEUTRAL_COLOR };
1063 else if (m_selected_features.second.is_center && m_curr_feature == m_selected_features.second.source)
1064 colors = { SELECTED_2ND_COLOR, NEUTRAL_COLOR };
1065 else
1066 colors = { hovering_color(), hovering_color() };
1067 break;
1068 }
1070 {
1071 colors.emplace_back(hovering_color());
1072 break;
1073 }
1074 }
1075 }
1076
1077 render_feature(*m_curr_feature, colors, inv_zoom, true, true);
1078 }
1079
1080 if (m_selected_features.first.feature.has_value() && (!m_curr_feature.has_value() || *m_curr_feature != *m_selected_features.first.feature)) {
1081 // render 1st selected feature
1082
1083 std::optional<Measure::SurfaceFeature> feature_to_render;
1084 std::vector<ColorRGBA> colors;
1085 bool requires_raycaster_update = false;
1086 if (m_hover_id == SEL_SPHERE_1_ID && (m_selected_features.first.is_center || is_feature_with_center(*m_selected_features.first.feature))) {
1087 // hovering over a center
1088 feature_to_render = m_selected_features.first.source;
1089 colors = { NEUTRAL_COLOR, SELECTED_1ST_COLOR };
1090 requires_raycaster_update = true;
1091 }
1092 else if (is_feature_with_center(*m_selected_features.first.feature)) {
1093 // hovering over a feature with center
1094 feature_to_render = m_selected_features.first.feature;
1095 colors = { SELECTED_1ST_COLOR, NEUTRAL_COLOR };
1096 requires_raycaster_update = true;
1097 }
1098 else {
1099 feature_to_render = m_selected_features.first.feature;
1100 colors = { SELECTED_1ST_COLOR };
1101 requires_raycaster_update = m_selected_features.first.feature->get_type() == Measure::SurfaceFeatureType::Point;
1102 }
1103
1104 render_feature(*feature_to_render, colors, inv_zoom, m_hover_id == SEL_SPHERE_1_ID, false, 0);
1105
1106 if (requires_raycaster_update) {
1109 Geometry::scale_transform(inv_zoom));
1110 }
1111 }
1112 }
1113
1114 if (m_selected_features.second.feature.has_value() && (!m_curr_feature.has_value() || *m_curr_feature != *m_selected_features.second.feature)) {
1115 // render 2nd selected feature
1116
1117 std::optional<Measure::SurfaceFeature> feature_to_render;
1118 std::vector<ColorRGBA> colors;
1119 bool requires_raycaster_update = false;
1120 if (m_hover_id == SEL_SPHERE_2_ID && (m_selected_features.second.is_center || is_feature_with_center(*m_selected_features.second.feature))) {
1121 // hovering over a center
1122 feature_to_render = m_selected_features.second.source;
1123 colors = { NEUTRAL_COLOR, SELECTED_2ND_COLOR };
1124 requires_raycaster_update = true;
1125 }
1126 else if (is_feature_with_center(*m_selected_features.second.feature)) {
1127 // hovering over a feature with center
1128 feature_to_render = m_selected_features.second.feature;
1129 colors = { SELECTED_2ND_COLOR, NEUTRAL_COLOR };
1130 requires_raycaster_update = true;
1131 }
1132 else {
1133 feature_to_render = m_selected_features.second.feature;
1134 colors = { SELECTED_2ND_COLOR };
1135 requires_raycaster_update = m_selected_features.second.feature->get_type() == Measure::SurfaceFeatureType::Point;
1136 }
1137
1138 render_feature(*feature_to_render, colors, inv_zoom, m_hover_id == SEL_SPHERE_2_ID, false, 1);
1139
1140 if (requires_raycaster_update) {
1143 Geometry::scale_transform(inv_zoom));
1144 }
1145 }
1146 }
1147
1148 if (is_hovering_on_feature && m_curr_point_on_feature_position.has_value()) {
1149 if (m_hover_id != POINT_ID) {
1150 // render point on feature while SHIFT is pressed
1152 const ColorRGBA color = hover_selection_color();
1153
1154 Geometry::Transformation tran(matrix);
1155 render_glmodel(m_sphere, color, tran.get_matrix(), true);
1156 }
1157 }
1158
1159 shader->stop_using();
1160
1161 if (old_cullface)
1163
1165}
#define M_PI
Definition ExtrusionSimulator.cpp:31
#define glsafe(cmd)
Definition OpenGLUtils.hpp:25
std::shared_ptr< Measure::Measuring > m_curr_measuring
Definition GLGizmoMeasure.hpp:174
void init_plane_glmodel(GripperType gripper_type, const Measure::SurfaceFeature &feature, PlaneGLModel &plane_gl_model)
Definition GLGizmoMeasure.cpp:588
GripperType
Definition GLGizmoMeasure.hpp:94
CircleGLModel m_feature_circle_second
Definition GLGizmoMeasure.hpp:187
bool m_only_select_plane
Definition GLGizmoMeasure.hpp:336
PlaneGLModel m_feature_plane_second
Definition GLGizmoMeasure.hpp:196
void render_dimensioning()
Definition GLGizmoMeasure.cpp:1217
CircleGLModel m_feature_circle_first
Definition GLGizmoMeasure.hpp:186
void update_world_plane_features(Measure::Measuring *cur_measuring, Measure::SurfaceFeature &feautre)
Definition GLGizmoMeasure.cpp:2478
PickingModel m_cylinder
Definition GLGizmoMeasure.hpp:178
PlaneGLModel m_feature_plane_first
Definition GLGizmoMeasure.hpp:195
GLVolume * m_last_hit_volume
Definition GLGizmoMeasure.hpp:211
PlaneGLModel m_curr_plane
Definition GLGizmoMeasure.hpp:194
void init_circle_glmodel(GripperType gripper_type, const Measure::SurfaceFeature &feature, CircleGLModel &circle_gl_model, float inv_zoom)
Definition GLGizmoMeasure.cpp:563
bool m_rendered_this_frame
Definition GLGizmoMeasure.hpp:247
#define glEnable
Definition gl.h:3667
#define GL_DEPTH_TEST
Definition gl.h:574
#define GL_CULL_FACE
Definition gl.h:500
#define glIsEnabled
Definition gl.h:4165
#define glDisable
Definition gl.h:3607
#define GL_DEPTH_BUFFER_BIT
Definition gl.h:558
#define glClear
Definition gl.h:3357
@ Camera
Definition Shortcuts.hpp:72
static const Slic3r::ColorRGBA NEUTRAL_COLOR
Definition GLGizmoMeasure.hpp:43
static const ColorRGBA HOVER_COLOR
Definition GLGizmoBrimEars.cpp:62
static const Slic3r::ColorRGBA SELECTED_1ST_COLOR
Definition GLGizmoMeasure.hpp:41
static const int EDGE_ID
Definition GLGizmoMeasure.hpp:47
static const Slic3r::ColorRGBA SELECTED_2ND_COLOR
Definition GLGizmoMeasure.hpp:42
void translation_transform(Transform3d &transform, const Vec3d &translation)
Definition Geometry.cpp:346
void scale_transform(Transform3d &transform, double scale)
Definition Geometry.cpp:372
Transform3f get_transform(const CSGPartT &part)
Definition CSGMesh.hpp:66
Vec3d pos(const Pt &p)
Definition ReprojectPointsOnMesh.hpp:16
Eigen::Transform< double, 3, Eigen::Affine, Eigen::DontAlign > Transform3d
Definition Point.hpp:96
Eigen::Matrix< float, 3, 1, Eigen::DontAlign > Vec3f
Definition Point.hpp:65
double angle(const Eigen::MatrixBase< Derived > &v1, const Eigen::MatrixBase< Derived2 > &v2)
Definition Point.hpp:138
Eigen::Matrix< double, 2, 1, Eigen::DontAlign > Vec2d
Definition Point.hpp:67
Eigen::Matrix< double, 3, 3, Eigen::DontAlign > Matrix3d
Definition Point.hpp:86
Vec2d mouse_position(const wxMouseEvent &mouse_event)
Extract position of mouse from mouse event.
Definition SurfaceDrag.cpp:502

References Slic3r::angle(), Slic3r::center(), CIRCLE, Slic3r::Measure::Circle, CIRCLE_1, CIRCLE_2, EDGE, Slic3r::Measure::Edge, Slic3r::GUI::EDGE_ID, Slic3r::GUI::FACE_FACE, FeatureSelection, Slic3r::Measure::SurfaceFeature::get_circle(), Slic3r::Measure::SurfaceFeature::get_edge(), Slic3r::Measure::SurfaceFeature::get_extra_point(), get_feature_offset(), Slic3r::GUI::Camera::get_inv_zoom(), Slic3r::Geometry::Transformation::get_matrix(), Slic3r::Measure::SurfaceFeature::get_point(), Slic3r::GUI::Camera::get_position(), Slic3r::GUI::Camera::get_projection_matrix(), Slic3r::Measure::SurfaceFeature::get_type(), Slic3r::GUI::Camera::get_view_matrix(), GL_CULL_FACE, GL_DEPTH_BUFFER_BIT, GL_DEPTH_TEST, glClear, glDisable, glEnable, glIsEnabled, glsafe, Slic3r::GUI::HOVER_COLOR, init_circle_glmodel(), init_plane_glmodel(), is_feature_with_center(), m_assembly_mode, m_curr_circle, m_curr_feature, m_curr_measuring, m_curr_plane, m_curr_point_on_feature_position, m_cylinder, m_editing_distance, m_feature_circle_first, m_feature_circle_second, m_feature_plane_first, m_feature_plane_second, m_gripper_id_raycast_map, m_hit_different_volumes, m_hit_order_volumes, Slic3r::GUI::GLGizmoBase::m_hover_id, m_last_hit_volume, m_last_inv_zoom, m_last_plane_idx, m_measure_mode, m_mesh_measure_map, m_mesh_raycaster_map, m_mode, m_mouse_left_down_mesh_deal, m_only_select_plane, Slic3r::GUI::GLGizmoBase::m_parent, M_PI, m_rendered_this_frame, m_selected_features, m_sphere, Slic3r::GUI::NEUTRAL_COLOR, Slic3r::normal(), Slic3r::GUI::ONLY_ASSEMBLY, PLANE, Slic3r::Measure::Plane, PLANE_1, PLANE_2, POINT, Slic3r::Measure::Point, Slic3r::GUI::POINT_ID, Slic3r::GUI::POINT_POINT, PointSelection, render_dimensioning(), reset_gripper_pick(), Slic3r::Geometry::scale_transform(), Slic3r::GUI::SEL_SPHERE_1_ID, Slic3r::GUI::SEL_SPHERE_2_ID, Slic3r::GUI::SELECTED_1ST_COLOR, Slic3r::GUI::SELECTED_2ND_COLOR, Slic3r::GLShaderProgram::set_uniform(), SPHERE_1, SPHERE_2, Slic3r::GLShaderProgram::start_using(), Slic3r::GLShaderProgram::stop_using(), Slic3r::Geometry::translation_transform(), UNDEFINE, update_if_needed(), update_world_plane_features(), and Slic3r::Measure::SurfaceFeature::world_tran.

Here is the call graph for this function:

◆ on_render_input_window()

void Slic3r::GUI::GLGizmoAssembly::on_render_input_window ( float x,
float y,
float bottom_limit )
overrideprotectedvirtual

Reimplemented from Slic3r::GUI::GLGizmoMeasure.

80{
82 static std::optional<Measure::SurfaceFeature> last_feature;
83 static EMode last_mode = EMode::FeatureSelection;
84 static SelectedFeatures last_selected_features;
85
86 static float last_y = 0.0f;
87 static float last_h = 0.0f;
88
90 return;
91 m_current_active_imgui_id = ImGui::GetActiveID();
92 // adjust window position to avoid overlap the view toolbar
93 const float win_h = ImGui::GetWindowHeight();
94 y = std::min(y, bottom_limit - win_h);
95 GizmoImguiSetNextWIndowPos(x, y, ImGuiCond_Always, 0.0f, 0.0f);
96 if (last_h != win_h || last_y != y) {
97 // ask canvas for another frame to render the window in the correct position
98 m_imgui->set_requires_extra_frame();
99 if (last_h != win_h)
100 last_h = win_h;
101 if (last_y != y)
102 last_y = y;
103 }
104 // Orca
106 GizmoImguiBegin(get_name(), ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar);
108
109 float moving_size = m_imgui->calc_text_size(_L("(Moving)")).x;
110 float combox_content_size = m_imgui->calc_text_size(_L("Point and point assembly")).x*1.1 + ImGui::GetStyle().FramePadding.x * 18.0f;
111 float caption_size = moving_size + 2 * m_space_size;
112 if (render_assembly_mode_combo(caption_size + 0.5 * m_space_size, combox_content_size)) {
113 ;
114 }
117
118 ImGui::Separator();
121
122 ImGui::Separator();
123 float f_scale =m_parent.get_gizmos_manager().get_layout_scale();
124 ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(6.0f, 4.0f * f_scale));
125
127
128 ImGui::SameLine();
130 if (m_imgui->button(_L("Done"))) {
131 m_parent.reset_all_gizmos();
132 }
133
135
136 if (last_feature != m_curr_feature || last_mode != m_mode || last_selected_features != m_selected_features) {
137 // the dialog may have changed its size, ask for an extra frame to render it properly
138 last_feature = m_curr_feature;
139 last_mode = m_mode;
140 last_selected_features = m_selected_features;
141 m_imgui->set_requires_extra_frame();
142 }
144
146 // Orca
147 ImGui::PopStyleVar(1); // ImGuiStyleVar_FramePadding
149}
#define _L(s)
Definition OBJ.cpp:34
void render_input_window_warning(bool same_model_object) override
Definition GLGizmoAssembly.cpp:151
bool render_assembly_mode_combo(double label_width, float item_width)
Definition GLGizmoAssembly.cpp:180
std::string get_name(bool include_shortcut=true) const
Definition GLGizmoBase.cpp:544
void GizmoImguiEnd()
Definition GLGizmoBase.cpp:372
bool GizmoImguiBegin(const std::string &name, int flags)
Definition GLGizmoBase.cpp:367
void show_distance_xyz_ui()
Definition GLGizmoMeasure.cpp:1996
std::vector< std::pair< wxString, wxString > > m_shortcuts
Definition GLGizmoMeasure.hpp:326
void render_dimensioning_if_scene_reused()
Definition GLGizmoMeasure.cpp:2208
void show_face_face_assembly_common()
Definition GLGizmoMeasure.cpp:2129
void show_selection_ui()
Definition GLGizmoMeasure.cpp:1884
unsigned int m_current_active_imgui_id
Definition GLGizmoMeasure.hpp:339
void init_render_input_window()
Definition GLGizmoMeasure.cpp:2199
EMode
Definition GLGizmoMeasure.hpp:109
void show_face_face_assembly_senior()
Definition GLGizmoMeasure.cpp:2160
unsigned int m_last_active_item_imgui
Definition GLGizmoMeasure.hpp:213
static void push_toolbar_style(const float scale)
Definition ImGuiWrapper.cpp:2705
static void pop_toolbar_style()
Definition ImGuiWrapper.cpp:2757
void begin_right_aligned_buttons(const std::vector< wxString > &labels)
Definition GLGizmoUtils.cpp:135
void render_tooltip_button(ImGuiWrapper *imgui_wrapper, const GLCanvas3D &canvas, const std::vector< std::pair< wxString, wxString > > &shortcuts, float x, float y)
Definition GLGizmoUtils.cpp:48
Definition GLGizmoMeasure.hpp:115

References _L, Slic3r::GUI::GLGizmoUtils::begin_right_aligned_buttons(), Slic3r::GUI::GLGizmoMeasure::FeatureSelection, Slic3r::GUI::GLGizmoBase::get_name(), Slic3r::GUI::GLGizmoBase::GizmoImguiBegin(), Slic3r::GUI::GLGizmoBase::GizmoImguiEnd(), Slic3r::GUI::GLGizmoBase::GizmoImguiSetNextWIndowPos(), Slic3r::GUI::GLGizmoMeasure::init_render_input_window(), Slic3r::GUI::GLGizmoMeasure::m_curr_feature, Slic3r::GUI::GLGizmoMeasure::m_current_active_imgui_id, Slic3r::GUI::GLGizmoMeasure::m_editing_distance, Slic3r::GUI::GLGizmoBase::m_imgui, Slic3r::GUI::GLGizmoMeasure::m_last_active_item_imgui, Slic3r::GUI::GLGizmoMeasure::m_mode, Slic3r::GUI::GLGizmoBase::m_parent, Slic3r::GUI::GLGizmoMeasure::m_same_model_object, Slic3r::GUI::GLGizmoMeasure::m_selected_features, Slic3r::GUI::GLGizmoMeasure::m_shortcuts, Slic3r::GUI::GLGizmoMeasure::m_space_size, Slic3r::GUI::ImGuiWrapper::pop_toolbar_style(), Slic3r::GUI::ImGuiWrapper::push_toolbar_style(), render_assembly_mode_combo(), Slic3r::GUI::GLGizmoMeasure::render_dimensioning_if_scene_reused(), render_input_window_warning(), Slic3r::GUI::GLGizmoUtils::render_tooltip_button(), Slic3r::GUI::GLGizmoMeasure::show_distance_xyz_ui(), Slic3r::GUI::GLGizmoMeasure::show_face_face_assembly_common(), Slic3r::GUI::GLGizmoMeasure::show_face_face_assembly_senior(), and Slic3r::GUI::GLGizmoMeasure::show_selection_ui().

Here is the call graph for this function:

◆ on_save()

virtual void Slic3r::GUI::GLGizmoBase::on_save ( cereal::BinaryOutputArchive & ar) const
inlineprotectedvirtualinherited

Reimplemented in Slic3r::GUI::GLGizmoBrimEars, Slic3r::GUI::GLGizmoCut3D, Slic3r::GUI::GLGizmoMeshBoolean, and Slic3r::GUI::GLGizmoPainterBase.

242{}

Referenced by save().

Here is the caller graph for this function:

◆ on_set_hover_id()

virtual void Slic3r::GUI::GLGizmoBase::on_set_hover_id ( )
inlineprotectedvirtualinherited

Reimplemented in Slic3r::GUI::GLGizmoBrimEars, Slic3r::GUI::GLGizmoCut3D, Slic3r::GUI::GLGizmoEmboss, Slic3r::GUI::GLGizmoRotate3D, and Slic3r::GUI::GLGizmoSVG.

245{}

Referenced by set_hover_id().

Here is the caller graph for this function:

◆ on_set_state()

void Slic3r::GUI::GLGizmoMeasure::on_set_state ( )
overrideprotectedvirtualinherited

Reimplemented from Slic3r::GUI::GLGizmoBase.

513{
514 if (m_state == Off) {
515 m_parent.toggle_selected_volume_visibility(false);
516 m_shift_kar_filter.reset_count();
517 m_curr_feature.reset();
520 m_editing_distance = false;
522 std::map<GLVolume *, std::shared_ptr<Measure::Measuring>>().swap(m_mesh_measure_map);
523 }
524 else {
526 m_hover_id = -1;
528 m_only_select_plane = false;
529 m_distance = Vec3d::Zero();
530 }
531}
Vec3d m_distance
Definition GLGizmoMeasure.hpp:215
bool m_show_reset_first_tip
Definition GLGizmoMeasure.hpp:328

References FeatureSelection, m_curr_feature, m_curr_point_on_feature_position, m_distance, m_editing_distance, Slic3r::GUI::GLGizmoBase::m_hover_id, m_is_editing_distance_first_frame, m_mesh_measure_map, m_mode, m_only_select_plane, Slic3r::GUI::GLGizmoBase::m_parent, m_shift_kar_filter, m_show_reset_first_tip, Slic3r::GUI::GLGizmoBase::m_state, Slic3r::GUI::GLGizmoBase::Off, and restore_scene_raycasters_state().

Here is the call graph for this function:

◆ on_start_dragging()

virtual void Slic3r::GUI::GLGizmoBase::on_start_dragging ( )
inlineprotectedvirtualinherited

Reimplemented in Slic3r::GUI::GLGizmoBrimEars, Slic3r::GUI::GLGizmoCut3D, Slic3r::GUI::GLGizmoEmboss, Slic3r::GUI::GLGizmoMove3D, Slic3r::GUI::GLGizmoRotate3D, Slic3r::GUI::GLGizmoRotate, Slic3r::GUI::GLGizmoScale3D, and Slic3r::GUI::GLGizmoSVG.

253{}

Referenced by use_grabbers().

Here is the caller graph for this function:

◆ on_stop_dragging()

virtual void Slic3r::GUI::GLGizmoBase::on_stop_dragging ( )
inlineprotectedvirtualinherited

Reimplemented in Slic3r::GUI::GLGizmoBrimEars, Slic3r::GUI::GLGizmoCut3D, Slic3r::GUI::GLGizmoEmboss, Slic3r::GUI::GLGizmoMove3D, Slic3r::GUI::GLGizmoRotate3D, Slic3r::GUI::GLGizmoScale3D, and Slic3r::GUI::GLGizmoSVG.

254{}

Referenced by do_stop_dragging(), and Slic3r::GUI::GLGizmoRotate::stop_dragging().

Here is the caller graph for this function:

◆ on_unregister_raycasters_for_picking()

virtual void Slic3r::GUI::GLGizmoBase::on_unregister_raycasters_for_picking ( )
inlineprotectedvirtualinherited

Reimplemented in Slic3r::GUI::GLGizmoBrimEars, Slic3r::GUI::GLGizmoCut3D, Slic3r::GUI::GLGizmoEmboss, Slic3r::GUI::GLGizmoFlatten, Slic3r::GUI::GLGizmoMove3D, Slic3r::GUI::GLGizmoRotate3D, Slic3r::GUI::GLGizmoScale3D, and Slic3r::GUI::GLGizmoSVG.

268{}

Referenced by unregister_raycasters_for_picking().

Here is the caller graph for this function:

◆ point_on_feature_type_as_string()

std::string Slic3r::GUI::GLGizmoMeasure::point_on_feature_type_as_string ( Measure::SurfaceFeatureType type,
int hover_id )
protectedinherited
99{
100 std::string ret;
101 switch (type) {
102 case Measure::SurfaceFeatureType::Point: { ret = _u8L("Vertex"); break; }
103 case Measure::SurfaceFeatureType::Edge: { ret = _u8L("Point on edge"); break; }
104 case Measure::SurfaceFeatureType::Circle: { ret = _u8L("Point on circle"); break; }
105 case Measure::SurfaceFeatureType::Plane: { ret = _u8L("Point on plane"); break; }
106 default: { assert(false); break; }
107 }
108 return ret;
109}

References _u8L, Slic3r::Measure::Circle, Slic3r::Measure::Edge, Slic3r::Measure::Plane, and Slic3r::Measure::Point.

Referenced by show_selection_ui().

Here is the caller graph for this function:

◆ register_grabbers_for_picking()

void Slic3r::GUI::GLGizmoBase::register_grabbers_for_picking ( )
protectedinherited
399{
400 for (size_t i = 0; i < m_grabbers.size(); ++i) {
401 m_grabbers[i].register_raycasters_for_picking((m_group_id >= 0) ? m_group_id : i);
402 }
403}
int m_group_id
Definition GLGizmoBase.hpp:145

References m_grabbers, and m_group_id.

Referenced by register_raycasters_for_picking().

Here is the caller graph for this function:

◆ register_raycasters_for_picking()

void Slic3r::GUI::GLGizmoBase::register_raycasters_for_picking ( )
inlineinherited
void register_grabbers_for_picking()
Definition GLGizmoBase.cpp:398
virtual void on_register_raycasters_for_picking()
Definition GLGizmoBase.hpp:267

References on_register_raycasters_for_picking(), and register_grabbers_for_picking().

Referenced by Slic3r::GUI::GLGizmosManager::activate_gizmo(), and Slic3r::GUI::GLCanvas3D::reload_scene().

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

◆ register_single_mesh_pick()

void Slic3r::GUI::GLGizmoMeasure::register_single_mesh_pick ( )
protectedinherited
2342{
2343 Selection& selection = m_parent.get_selection();
2344 const Selection::IndicesList &idxs = selection.get_volume_idxs();
2345 if (idxs.size() > 0) {
2346 for (unsigned int idx : idxs) {
2347 GLVolume *v = const_cast<GLVolume *>(selection.get_volume(idx));
2348 auto world_tran = v->get_instance_transformation() * v->get_volume_transformation();
2349 if (m_mesh_raycaster_map.find(v) != m_mesh_raycaster_map.end()) {
2350 m_mesh_raycaster_map[v]->set_transform(world_tran.get_matrix());
2351 } else {
2352 const ModelObject* obj = selection.get_model()->objects[v->object_idx()];
2353 const ModelVolume* vol = obj->volumes[v->volume_idx()];
2354 auto mesh = vol->mesh_ptr();
2355 m_mesh_raycaster_map[v] = std::make_shared<PickRaycaster>(-1, *v->mesh_raycaster, world_tran.get_matrix());
2356 m_mesh_raycaster_map[v]->set_transform(world_tran.get_matrix());
2357 m_mesh_measure_map[v] = std::make_shared<Measure::Measuring>(mesh->its);
2358 }
2359 }
2360 }
2361}
std::set< unsigned int > IndicesList
Definition Selection.hpp:49

References Slic3r::GLVolume::get_instance_transformation(), Slic3r::GUI::Selection::get_model(), Slic3r::GUI::Selection::get_volume(), Slic3r::GUI::Selection::get_volume_idxs(), Slic3r::GLVolume::get_volume_transformation(), m_mesh_measure_map, m_mesh_raycaster_map, Slic3r::GUI::GLGizmoBase::m_parent, Slic3r::ModelVolume::mesh_ptr(), Slic3r::GLVolume::mesh_raycaster, Slic3r::GLVolume::object_idx(), Slic3r::Model::objects, Slic3r::GLVolume::volume_idx(), and Slic3r::ModelObject::volumes.

Referenced by data_changed(), render_dimensioning(), set_distance(), set_parallel_distance(), set_to_around_center_of_faces(), set_to_parallel(), and set_to_reverse_rotation().

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

◆ remove_selected_sphere_raycaster()

void Slic3r::GUI::GLGizmoMeasure::remove_selected_sphere_raycaster ( int id)
protectedinherited

References reset_gripper_pick(), Slic3r::GUI::SEL_SPHERE_1_ID, SPHERE_1, and SPHERE_2.

Referenced by on_mouse(), reset_feature1(), and reset_feature2().

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

◆ render()

void Slic3r::GUI::GLGizmoBase::render ( )
inlineinherited
214{ on_render(); }
virtual void on_render()=0

References on_render().

Here is the call graph for this function:

◆ render_assembly_mode_combo()

bool Slic3r::GUI::GLGizmoAssembly::render_assembly_mode_combo ( double label_width,
float item_width )
protected
181{
182 ImGui::AlignTextToFramePadding();
183 int selection_idx = int(m_assembly_mode);
184 std::vector<std::string> modes = {_u8L("Face and face assembly"), _u8L("Point and point assembly")};
185 bool is_changed = false;
186
188 if (render_combo(_u8L("Mode"), modes, selection_idx, label_width, item_width)) {
189 is_changed = true;
190 switch_to_mode((AssemblyMode) selection_idx);
191 }
193 return is_changed;
194}
void switch_to_mode(AssemblyMode new_mode)
Definition GLGizmoAssembly.cpp:196
bool render_combo(const std::string &label, const std::vector< std::string > &lines, int &selection_idx, float label_width, float item_width)
Definition GLGizmoBase.cpp:226
static void pop_combo_style()
Definition ImGuiWrapper.cpp:2932
static void push_combo_style(const float scale)
Definition ImGuiWrapper.cpp:2907
AssemblyMode
Definition GLGizmoMeasure.hpp:37

References _u8L, Slic3r::GUI::GLGizmoMeasure::m_assembly_mode, Slic3r::GUI::GLGizmoBase::m_parent, Slic3r::GUI::ImGuiWrapper::pop_combo_style(), Slic3r::GUI::ImGuiWrapper::push_combo_style(), Slic3r::GUI::GLGizmoBase::render_combo(), and switch_to_mode().

Referenced by on_render_input_window().

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

◆ render_combo()

bool Slic3r::GUI::GLGizmoBase::render_combo ( const std::string & label,
const std::vector< std::string > & lines,
int & selection_idx,
float label_width,
float item_width )
protectedinherited
227{
229 ImGui::AlignTextToFramePadding();
230 m_imgui->text(label);
231 ImGui::SameLine(label_width);
232 ImGui::PushItemWidth(item_width);
233
234 size_t selection_out = selection_idx;
235
236 const char *selected_str = (selection_idx >= 0 && selection_idx < int(lines.size())) ? lines[selection_idx].c_str() : "";
237 if (ImGui::BBLBeginCombo(("##" + label).c_str(), selected_str, 0)) {
238 for (size_t line_idx = 0; line_idx < lines.size(); ++line_idx) {
239 ImGui::PushID(int(line_idx));
240 if (ImGui::Selectable("", line_idx == selection_idx)) selection_out = line_idx;
241
242 ImGui::SameLine();
243 ImGui::Text("%s", lines[line_idx].c_str());
244 ImGui::PopID();
245 }
246
247 ImGui::EndCombo();
248 }
249
250 bool is_changed = selection_idx != selection_out;
251 selection_idx = selection_out;
252
253 //if (is_changed) update_connector_shape();
255
256 return is_changed;
257}

References m_imgui, m_parent, Slic3r::GUI::ImGuiWrapper::pop_combo_style(), and Slic3r::GUI::ImGuiWrapper::push_combo_style().

Referenced by Slic3r::GUI::GLGizmoAssembly::render_assembly_mode_combo(), and Slic3r::GUI::GLGizmoCut3D::render_connectors_input_window().

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

◆ render_cross_mark()

void Slic3r::GUI::GLGizmoBase::render_cross_mark ( const Vec3f & target,
bool is_single = false )
protectedinherited
260{
261 const float half_length = 4.0f;
262
263 // ORCA: OpenGL Core Profile
264#if !SLIC3R_OPENGL_ES
265 if (!OpenGLManager::get_gl_info().is_core_profile())
266 glsafe(::glLineWidth(2.0f));
267#endif // !SLIC3R_OPENGL_ES
268
269 auto render_line = [](const Vec3f& p1, const Vec3f& p2, const ColorRGBA& color) {
270 GLModel::Geometry init_data;
272 init_data.color = color;
273 init_data.reserve_vertices(2);
274 init_data.reserve_indices(2);
275
276 // vertices
277 init_data.add_vertex(p1);
278 init_data.add_vertex(p2);
279
280 // indices
281 init_data.add_line(0, 1);
282
283 GLModel model;
284 model.init_from(std::move(init_data));
285 model.render();
286 };
287
288 // draw line for x axis
289 if (!is_single) {
290 render_line(
291 {target(0) - half_length, target(1), target(2)},
292 {target(0) + half_length, target(1), target(2)},
293 ColorRGBA::X()); // ORCA match axis colors
294 }
295 else {
296 render_line(
297 {target(0), target(1), target(2)},
298 {target(0) + half_length, target(1), target(2)},
299 ColorRGBA::X()); // ORCA match axis colors
300 }
301 // draw line for y axis
302 if (!is_single) {
303 render_line(
304 {target(0), target(1) - half_length, target(2)},
305 {target(0), target(1) + half_length, target(2)},
306 ColorRGBA::Y()); // ORCA match axis colors
307 } else {
308 render_line(
309 {target(0), target(1), target(2)},
310 {target(0), target(1) + half_length, target(2)},
311 ColorRGBA::Y()); // ORCA match axis colors
312 }
313 // draw line for z axis
314 if (!is_single) {
315 render_line(
316 {target(0), target(1), target(2) - half_length},
317 {target(0), target(1), target(2) + half_length},
318 ColorRGBA::Z()); // ORCA match axis colors
319 } else {
320 render_line(
321 {target(0), target(1), target(2)},
322 {target(0), target(1), target(2) + half_length},
323 ColorRGBA::Z()); // ORCA match axis colors
324 }
325}
static const ColorRGBA Y()
Definition Color.hpp:146
static const ColorRGBA X()
Definition Color.hpp:145
static const ColorRGBA Z()
Definition Color.hpp:147
static const GLInfo & get_gl_info()
Definition OpenGLManager.hpp:106
#define glLineWidth
Definition gl.h:4215

References Slic3r::GUI::GLModel::Geometry::add_line(), Slic3r::GUI::GLModel::Geometry::add_vertex(), Slic3r::GUI::GLModel::Geometry::color, Slic3r::GUI::GLModel::Geometry::format, Slic3r::GUI::OpenGLManager::get_gl_info(), glLineWidth, glsafe, Slic3r::GUI::GLModel::init_from(), Slic3r::GUI::GLModel::Geometry::Lines, Slic3r::GUI::GLModel::Geometry::P3, Slic3r::GUI::GLModel::render(), Slic3r::GUI::GLModel::Geometry::reserve_indices(), Slic3r::GUI::GLModel::Geometry::reserve_vertices(), Slic3r::ColorRGBA::X(), Slic3r::ColorRGBA::Y(), and Slic3r::ColorRGBA::Z().

Referenced by Slic3r::GUI::GLGizmoMove3D::on_render().

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

◆ render_dimensioning()

void Slic3r::GUI::GLGizmoMeasure::render_dimensioning ( )
protectedinherited
1218{
1219 static SelectedFeatures last_selected_features;
1220
1221 if (!m_selected_features.first.feature.has_value())
1222 return;
1223
1224 if (!m_selected_features.second.feature.has_value() && m_selected_features.first.feature->get_type() != Measure::SurfaceFeatureType::Circle)
1225 return;
1226
1227 GLShaderProgram* shader = wxGetApp().get_shader("flat");
1228 if (shader == nullptr)
1229 return;
1230
1231 auto point_point = [this, &shader](const Vec3d &v1, const Vec3d &v2, float distance, const ColorRGBA &color, bool show_label = true, bool show_first_tri = true) {
1232 if ((v2 - v1).squaredNorm() < 0.000001 || abs(distance) < 0.001f)
1233 return;
1234
1235 const Camera& camera = wxGetApp().plater()->get_camera();
1236 const Matrix4d projection_view_matrix = camera.get_projection_matrix().matrix() * camera.get_view_matrix().matrix();
1237 const std::array<int, 4>& viewport = camera.get_viewport();
1238
1239 // screen coordinates
1240 const Vec2d v1ss = TransformHelper::world_to_ss(v1, projection_view_matrix, viewport);
1241 const Vec2d v2ss = TransformHelper::world_to_ss(v2, projection_view_matrix, viewport);
1242
1243 if (v1ss.isApprox(v2ss))
1244 return;
1245
1246 const Vec2d v12ss = v2ss - v1ss;
1247 const double v12ss_len = v12ss.norm();
1248
1249 const bool overlap = v12ss_len - 2.0 * TRIANGLE_HEIGHT < 0.0;
1250
1251 const auto q12ss = Eigen::Quaternion<double>::FromTwoVectors(Vec3d::UnitX(), Vec3d(v12ss.x(), v12ss.y(), 0.0));
1252 const auto q21ss = Eigen::Quaternion<double>::FromTwoVectors(Vec3d::UnitX(), Vec3d(-v12ss.x(), -v12ss.y(), 0.0));
1253
1254 shader->set_uniform("projection_matrix", Transform3d::Identity());
1255
1256 const Vec3d v1ss_3 = { v1ss.x(), v1ss.y(), 0.0 };
1257 const Vec3d v2ss_3 = { v2ss.x(), v2ss.y(), 0.0 };
1258
1259 const Transform3d ss_to_ndc_matrix = TransformHelper::ndc_to_ss_matrix_inverse(viewport);
1260
1261#if !SLIC3R_OPENGL_ES
1262 if (OpenGLManager::get_gl_info().is_core_profile()) {
1263#endif // !SLIC3R_OPENGL_ES
1264 shader->stop_using();
1265
1266#if SLIC3R_OPENGL_ES
1267 shader = wxGetApp().get_shader("dashed_lines");
1268#else
1269 shader = wxGetApp().get_shader("dashed_thick_lines");
1270#endif // SLIC3R_OPENGL_ES
1271 if (shader == nullptr)
1272 return;
1273
1274 shader->start_using();
1275 shader->set_uniform("projection_matrix", Transform3d::Identity());
1276 shader->set_uniform("viewport_size", Vec2d(double(viewport[2]), double(viewport[3])));
1277 shader->set_uniform("width", 1.0f);
1278 shader->set_uniform("gap_size", 0.0f);
1279#if !SLIC3R_OPENGL_ES
1280 }
1281 else
1282 glsafe(::glLineWidth(2.0f));
1283#endif // !SLIC3R_OPENGL_ES
1284
1285 // stem
1286 shader->set_uniform("view_model_matrix", overlap ?
1287 ss_to_ndc_matrix * Geometry::translation_transform(v1ss_3) * q12ss * Geometry::translation_transform(-2.0 * TRIANGLE_HEIGHT * Vec3d::UnitX()) * Geometry::scale_transform({ v12ss_len + 4.0 * TRIANGLE_HEIGHT, 1.0f, 1.0f }) :
1288 ss_to_ndc_matrix * Geometry::translation_transform(v1ss_3) * q12ss * Geometry::scale_transform({ v12ss_len, 1.0f, 1.0f }));
1289 m_dimensioning.line.set_color(color);
1290 m_dimensioning.line.render();
1291
1292#if !SLIC3R_OPENGL_ES
1293 if (OpenGLManager::get_gl_info().is_core_profile()) {
1294#endif // !SLIC3R_OPENGL_ES
1295 shader->stop_using();
1296
1297 shader = wxGetApp().get_shader("flat");
1298 if (shader == nullptr)
1299 return;
1300
1301 shader->start_using();
1302#if !SLIC3R_OPENGL_ES
1303 }
1304 else
1305 glsafe(::glLineWidth(1.0f));
1306#endif // !SLIC3R_OPENGL_ES
1307
1308 // arrow 1
1309 if (show_first_tri) {
1310 shader->set_uniform("view_model_matrix", overlap ?
1311 ss_to_ndc_matrix * Geometry::translation_transform(v1ss_3) * q12ss :
1312 ss_to_ndc_matrix * Geometry::translation_transform(v1ss_3) * q21ss);
1313 m_dimensioning.triangle.render();
1314 }
1315 // arrow 2
1316 shader->set_uniform("view_model_matrix", overlap ?
1317 ss_to_ndc_matrix * Geometry::translation_transform(v2ss_3) * q21ss :
1318 ss_to_ndc_matrix * Geometry::translation_transform(v2ss_3) * q12ss);
1319 m_dimensioning.triangle.render();
1320
1321 const bool use_inches = wxGetApp().app_config->get_bool("use_inches");
1322 const double curr_value = use_inches ? GizmoObjectManipulation::mm_to_in * distance : distance;
1323 const std::string curr_value_str = format_double(curr_value);
1324 const std::string units = use_inches ? _u8L_CONTEXT("in", "inches") : _u8L("mm");
1325 const float value_str_width = 20.0f + ImGui::CalcTextSize(curr_value_str.c_str()).x;
1326 static double edit_value = 0.0;
1327
1329 const Vec2d label_position = 0.5 * (v1ss + v2ss);
1330 m_imgui->set_next_window_pos(label_position.x(), viewport[3] - label_position.y(), ImGuiCond_Always, 0.0f, 1.0f);
1331 m_imgui->set_next_window_bg_alpha(0.0f);
1332
1333 if (!m_editing_distance && show_label) {
1334 ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
1335 ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
1336 ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, { 1.0f, 1.0f });
1337 m_imgui->begin(std::string("distance"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoDecoration);
1338 ImGui::BringWindowToDisplayFront(ImGui::GetCurrentWindow());
1339 ImGui::AlignTextToFramePadding();
1340 ImDrawList* draw_list = ImGui::GetWindowDrawList();
1341 const ImVec2 pos = ImGui::GetCursorScreenPos();
1342 const std::string txt = curr_value_str + " " + units;
1343 ImVec2 txt_size = ImGui::CalcTextSize(txt.c_str());
1344 const ImGuiStyle& style = ImGui::GetStyle();
1345 draw_list->AddRectFilled({pos.x - style.FramePadding.x, pos.y + style.FramePadding.y},
1346 {pos.x + txt_size.x + 2.0f * style.FramePadding.x, pos.y + txt_size.y + 2.0f * style.FramePadding.y},
1347 ImGuiWrapper::to_ImU32({1.0f, 1.0f, 1.0f, 0.5f}));
1348 ImGui::SetCursorScreenPos({ pos.x + style.FramePadding.x, pos.y });
1349 m_imgui->text(txt);
1350 if (m_hit_different_volumes.size() < 2 && wxGetApp().plater()->canvas3D()->get_canvas_type() == GLCanvas3D::ECanvasType::CanvasView3D) {
1351 ImGui::SameLine();
1352 if (m_imgui->image_button(ImGui::SliderFloatEditBtnIcon, _L("Edit to scale"))) {
1353 m_editing_distance = true;
1354 edit_value = curr_value;
1355 m_imgui->requires_extra_frame();
1356 }
1357 }
1358 m_imgui->end();
1359 ImGui::PopStyleVar(3);
1360 }
1361
1362 if (m_editing_distance && !ImGui::IsPopupOpen("distance_popup"))
1363 ImGui::OpenPopup("distance_popup");
1364
1365 ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
1366 ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
1367 ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, { 1.0f, 1.0f });
1368 ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, { 4.0f, 0.0f });
1369 if (show_label && ImGui::BeginPopupModal("distance_popup", nullptr, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoDecoration)) {
1370 auto perform_scale = [this](double new_value, double old_value,bool scale_single_volume) {
1371 if (new_value == old_value || new_value <= 0.0)
1372 return;
1373
1374 const double ratio = new_value / old_value;
1375 wxGetApp().plater()->take_snapshot(_u8L_CONTEXT("Scale", "Verb"), UndoRedo::SnapshotType::GizmoAction);
1376 // apply scale
1377 TransformationType type;
1378 type.set_world();
1379 type.set_relative();
1380 type.set_joint();
1381
1382 // scale selection
1383 Selection& selection = m_parent.get_selection();
1384 selection.setup_cache();
1385 if (scale_single_volume && m_hit_different_volumes.size()==1) {
1386 //todo//update_single_mesh_pick(m_hit_different_volumes[0])
1387 } else {
1388 selection.scale(ratio * Vec3d::Ones(), type);
1389 wxGetApp().plater()->canvas3D()->do_scale(""); // avoid storing another snapshot
1391 }
1392 wxGetApp().obj_manipul()->set_dirty();
1393 // scale dimensioning
1395 if (m_selected_features.second.feature.has_value())
1397 // update measure on next call to data_changed()
1398 m_pending_scale = 1;
1399
1400 };
1401 auto action_exit = [this]() {
1402 m_editing_distance = false;
1404 ImGui::CloseCurrentPopup();
1405 };
1406 auto action_scale = [perform_scale, action_exit](double new_value, double old_value, bool scale_single_volume) {
1407 perform_scale(new_value, old_value, scale_single_volume);
1408 action_exit();
1409 };
1410
1411 m_imgui->disable_background_fadeout_animation();
1412 ImGui::PushItemWidth(value_str_width);
1413 if (ImGui::InputDouble("##distance", &edit_value, 0.0f, 0.0f, "%.3f")) {
1414 }
1415
1416 // trick to auto-select text in the input widgets on 1st frame
1418 ImGui::SetKeyboardFocusHere(0);
1420 m_imgui->set_requires_extra_frame();
1421 }
1422
1423 // handle keys input
1424 if (ImGui::IsKeyPressedMap(ImGuiKey_Enter) || ImGui::IsKeyPressedMap(ImGuiKey_KeyPadEnter))
1425 action_scale(edit_value, curr_value, false);
1426 else if (ImGui::IsKeyPressedMap(ImGuiKey_Escape))
1427 action_exit();
1428
1429 ImGui::SameLine();
1431 //if (m_imgui->button(_L_CONTEXT(L_CONTEXT("Scale part", "Verb"), "Verb")))
1432 //action_scale(edit_value, curr_value, true);
1433 //ImGui::SameLine();
1434 if (m_imgui->button(_L_CONTEXT(L_CONTEXT("Scale all", "Verb"), "Verb")))
1435 action_scale(edit_value, curr_value, false);
1437 ImGui::SameLine();
1439 if (m_imgui->button(_L("Cancel")))
1440 action_exit();
1442 ImGui::EndPopup();
1443 }
1444 ImGui::PopStyleVar(4);
1446 };
1447
1448 auto point_edge = [this, shader](const Measure::SurfaceFeature& f1, const Measure::SurfaceFeature& f2) {
1449 assert(f1.get_type() == Measure::SurfaceFeatureType::Point && f2.get_type() == Measure::SurfaceFeatureType::Edge);
1450 std::pair<Vec3d, Vec3d> e = f2.get_edge();
1451 const Vec3d v_proj = m_measurement_result.distance_infinite->to;
1452 const Vec3d e1e2 = e.second - e.first;
1453 const Vec3d v_proje1 = v_proj - e.first;
1454 const bool on_e1_side = v_proje1.dot(e1e2) < -EPSILON;
1455 const bool on_e2_side = !on_e1_side && v_proje1.norm() > e1e2.norm();
1456 if (on_e1_side || on_e2_side) {
1457 const Camera& camera = wxGetApp().plater()->get_camera();
1458 const Matrix4d projection_view_matrix = camera.get_projection_matrix().matrix() * camera.get_view_matrix().matrix();
1459 const std::array<int, 4>& viewport = camera.get_viewport();
1460 const Transform3d ss_to_ndc_matrix = TransformHelper::ndc_to_ss_matrix_inverse(viewport);
1461
1462 const Vec2d v_projss = TransformHelper::world_to_ss(v_proj, projection_view_matrix, viewport);
1463 auto render_extension = [this, &v_projss, &projection_view_matrix, &viewport, &ss_to_ndc_matrix, shader](const Vec3d& p) {
1464 const Vec2d pss = TransformHelper::world_to_ss(p, projection_view_matrix, viewport);
1465 if (!pss.isApprox(v_projss)) {
1466 const Vec2d pv_projss = v_projss - pss;
1467 const double pv_projss_len = pv_projss.norm();
1468
1469 const auto q = Eigen::Quaternion<double>::FromTwoVectors(Vec3d::UnitX(), Vec3d(pv_projss.x(), pv_projss.y(), 0.0));
1470
1471 shader->set_uniform("projection_matrix", Transform3d::Identity());
1472 shader->set_uniform("view_model_matrix", ss_to_ndc_matrix * Geometry::translation_transform({ pss.x(), pss.y(), 0.0 }) * q *
1473 Geometry::scale_transform({ pv_projss_len, 1.0f, 1.0f }));
1474 m_dimensioning.line.set_color(ColorRGBA::LIGHT_GRAY());
1475 m_dimensioning.line.render();
1476 }
1477 };
1478
1479 render_extension(on_e1_side ? e.first : e.second);
1480 }
1481 };
1482
1483 auto arc_edge_edge = [this, &shader](const Measure::SurfaceFeature& f1, const Measure::SurfaceFeature& f2, double radius = 0.0) {
1484 assert(f1.get_type() == Measure::SurfaceFeatureType::Edge && f2.get_type() == Measure::SurfaceFeatureType::Edge);
1485 if (!m_measurement_result.angle.has_value())
1486 return;
1487
1488 const double angle = m_measurement_result.angle->angle;
1489 const Vec3d center = m_measurement_result.angle->center;
1490 const std::pair<Vec3d, Vec3d> e1 = m_measurement_result.angle->e1;
1491 const std::pair<Vec3d, Vec3d> e2 = m_measurement_result.angle->e2;
1492 const double calc_radius = m_measurement_result.angle->radius;
1493 const bool coplanar = m_measurement_result.angle->coplanar;
1494
1495 if (std::abs(angle) < EPSILON || std::abs(calc_radius) < EPSILON)
1496 return;
1497
1498 const double draw_radius = (radius > 0.0) ? radius : calc_radius;
1499
1500 const Vec3d e1_unit = Measure::edge_direction(e1);
1501 const Vec3d e2_unit = Measure::edge_direction(e2);
1502
1503 const unsigned int resolution = std::max<unsigned int>(2, 64 * angle / double(PI));
1504 const double step = angle / double(resolution);
1505 const Vec3d normal = e1_unit.cross(e2_unit).normalized();
1506
1507 if (!m_dimensioning.arc.is_initialized()) {
1508 GLModel::Geometry init_data;
1510 init_data.color = ColorRGBA::WHITE();
1511 init_data.reserve_vertices(resolution + 1);
1512 init_data.reserve_indices(resolution + 1);
1513
1514 // vertices + indices
1515 for (unsigned int i = 0; i <= resolution; ++i) {
1516 const double a = step * double(i);
1517 const Vec3d v = draw_radius * (Eigen::Quaternion<double>(Eigen::AngleAxisd(a, normal)) * e1_unit);
1518 init_data.add_vertex((Vec3f) v.cast<float>());
1519 init_data.add_index(i);
1520 }
1521
1522 m_dimensioning.arc.init_from(std::move(init_data));
1523 }
1524
1525 const Camera& camera = wxGetApp().plater()->get_camera();
1526#if !SLIC3R_OPENGL_ES
1527 if (OpenGLManager::get_gl_info().is_core_profile()) {
1528#endif // !SLIC3R_OPENGL_ES
1529 shader->stop_using();
1530
1531#if SLIC3R_OPENGL_ES
1532 shader = wxGetApp().get_shader("dashed_lines");
1533#else
1534 shader = wxGetApp().get_shader("dashed_thick_lines");
1535#endif // SLIC3R_OPENGL_ES
1536 if (shader == nullptr)
1537 return;
1538
1539 shader->start_using();
1540 shader->set_uniform("projection_matrix", Transform3d::Identity());
1541 const std::array<int, 4>& viewport = camera.get_viewport();
1542 shader->set_uniform("viewport_size", Vec2d(double(viewport[2]), double(viewport[3])));
1543 shader->set_uniform("width", 1.0f);
1544 shader->set_uniform("gap_size", 0.0f);
1545#if !SLIC3R_OPENGL_ES
1546 }
1547 else
1548 glsafe(::glLineWidth(2.0f));
1549#endif // !SLIC3R_OPENGL_ES
1550
1551 // arc
1552 shader->set_uniform("projection_matrix", camera.get_projection_matrix());
1553 shader->set_uniform("view_model_matrix", camera.get_view_matrix() * Geometry::translation_transform(center));
1554 m_dimensioning.arc.render();
1555
1556#if !SLIC3R_OPENGL_ES
1557 if (OpenGLManager::get_gl_info().is_core_profile()) {
1558#endif // !SLIC3R_OPENGL_ES
1559 shader->stop_using();
1560
1561 shader = wxGetApp().get_shader("flat");
1562 if (shader == nullptr)
1563 return;
1564
1565 shader->start_using();
1566#if !SLIC3R_OPENGL_ES
1567 }
1568 else
1569 glsafe(::glLineWidth(1.0f));
1570#endif // !SLIC3R_OPENGL_ES
1571
1572 // arrows
1573 auto render_arrow = [this, shader, &camera, &normal, &center, &e1_unit, draw_radius, step, resolution](unsigned int endpoint_id) {
1574 const double angle = (endpoint_id == 1) ? 0.0 : step * double(resolution);
1575 const Vec3d position_model = Geometry::translation_transform(center) * (draw_radius * (Eigen::Quaternion<double>(Eigen::AngleAxisd(angle, normal)) * e1_unit));
1576 const Vec3d direction_model = (endpoint_id == 1) ? -normal.cross(position_model - center).normalized() : normal.cross(position_model - center).normalized();
1577 const auto qz = Eigen::Quaternion<double>::FromTwoVectors(Vec3d::UnitZ(), (endpoint_id == 1) ? normal : -normal);
1578 const auto qx = Eigen::Quaternion<double>::FromTwoVectors(qz * Vec3d::UnitX(), direction_model);
1579 const Transform3d view_model_matrix = camera.get_view_matrix() * Geometry::translation_transform(position_model) *
1580 qx * qz * Geometry::scale_transform(camera.get_inv_zoom());
1581 shader->set_uniform("view_model_matrix", view_model_matrix);
1582 m_dimensioning.triangle.render();
1583 };
1584
1586 render_arrow(1);
1587 render_arrow(2);
1589
1590 // edge 1 extension
1591 const Vec3d e11e12 = e1.second - e1.first;
1592 const Vec3d e11center = center - e1.first;
1593 const double e11center_len = e11center.norm();
1594
1595 if (e11center_len > EPSILON && e11center.dot(e11e12) < 0.0) {
1596 shader->set_uniform("view_model_matrix", camera.get_view_matrix() * Geometry::translation_transform(center) *
1597 Eigen::Quaternion<double>::FromTwoVectors(Vec3d::UnitX(), Measure::edge_direction(e1.first, e1.second)) *
1598 Geometry::scale_transform({ e11center_len, 1.0f, 1.0f }));
1599 m_dimensioning.line.set_color(ColorRGBA::LIGHT_GRAY());
1600 m_dimensioning.line.render();
1601 }
1602
1603 // edge 2 extension
1604 const Vec3d e21center = center - e2.first;
1605 const double e21center_len = e21center.norm();
1606 if (e21center_len > EPSILON) {
1607 shader->set_uniform("view_model_matrix", camera.get_view_matrix() * Geometry::translation_transform(center) *
1608 Eigen::Quaternion<double>::FromTwoVectors(Vec3d::UnitX(), Measure::edge_direction(e2.first, e2.second)) *
1609 Geometry::scale_transform({ (coplanar && radius > 0.0) ? e21center_len : draw_radius, 1.0f, 1.0f }));
1610 m_dimensioning.line.set_color(ColorRGBA::LIGHT_GRAY());
1611 m_dimensioning.line.render();
1612 }
1613
1614 // label
1615 // label world coordinates
1616 const Vec3d label_position_world = Geometry::translation_transform(center) * (draw_radius * (Eigen::Quaternion<double>(Eigen::AngleAxisd(step * 0.5 * double(resolution), normal)) * e1_unit));
1617
1618 // label screen coordinates
1619 const std::array<int, 4>& viewport = camera.get_viewport();
1620 const Vec2d label_position_ss = TransformHelper::world_to_ss(label_position_world,
1621 camera.get_projection_matrix().matrix() * camera.get_view_matrix().matrix(), viewport);
1622
1624 m_imgui->set_next_window_pos(label_position_ss.x(), viewport[3] - label_position_ss.y(), ImGuiCond_Always, 0.0f, 1.0f);
1625 m_imgui->set_next_window_bg_alpha(0.0f);
1626 ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
1627 m_imgui->begin(wxString("##angle"), ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoMove);
1628 ImGui::BringWindowToDisplayFront(ImGui::GetCurrentWindow());
1629 ImGui::AlignTextToFramePadding();
1630 ImDrawList* draw_list = ImGui::GetWindowDrawList();
1631 const ImVec2 pos = ImGui::GetCursorScreenPos();
1632 const std::string txt = format_double(Geometry::rad2deg(angle)) + "°";
1633 ImVec2 txt_size = ImGui::CalcTextSize(txt.c_str());
1634 const ImGuiStyle& style = ImGui::GetStyle();
1635 ColorRGBA color{1.0f, 1.0f, 1.0f, 0.5f};
1636 draw_list->AddRectFilled({ pos.x - style.FramePadding.x, pos.y + style.FramePadding.y }, { pos.x + txt_size.x + 2.0f * style.FramePadding.x,
1637 pos.y + txt_size.y + 2.0f * style.FramePadding.y}, ImGuiWrapper::to_ImU32(color));
1638 ImGui::SetCursorScreenPos({ pos.x + style.FramePadding.x, pos.y });
1639 m_imgui->text(txt);
1640 m_imgui->end();
1641 ImGui::PopStyleVar();
1643 };
1644
1645 auto arc_edge_plane = [this, arc_edge_edge](const Measure::SurfaceFeature& f1, const Measure::SurfaceFeature& f2) {
1646 assert(f1.get_type() == Measure::SurfaceFeatureType::Edge && f2.get_type() == Measure::SurfaceFeatureType::Plane);
1647 if (!m_measurement_result.angle.has_value())
1648 return;
1649
1650 const std::pair<Vec3d, Vec3d> e1 = m_measurement_result.angle->e1;
1651 const std::pair<Vec3d, Vec3d> e2 = m_measurement_result.angle->e2;
1652 const double calc_radius = m_measurement_result.angle->radius;
1653
1654 if (calc_radius == 0.0)
1655 return;
1656
1657 arc_edge_edge(Measure::SurfaceFeature(Measure::SurfaceFeatureType::Edge, e1.first, e1.second),
1658 Measure::SurfaceFeature(Measure::SurfaceFeatureType::Edge, e2.first, e2.second), calc_radius);
1659 };
1660
1661 auto arc_plane_plane = [this, arc_edge_edge](const Measure::SurfaceFeature& f1, const Measure::SurfaceFeature& f2) {
1662 assert(f1.get_type() == Measure::SurfaceFeatureType::Plane && f2.get_type() == Measure::SurfaceFeatureType::Plane);
1663 if (!m_measurement_result.angle.has_value())
1664 return;
1665
1666 const std::pair<Vec3d, Vec3d> e1 = m_measurement_result.angle->e1;
1667 const std::pair<Vec3d, Vec3d> e2 = m_measurement_result.angle->e2;
1668 const double calc_radius = m_measurement_result.angle->radius;
1669
1670 if (calc_radius == 0.0)
1671 return;
1672
1673 arc_edge_edge(Measure::SurfaceFeature(Measure::SurfaceFeatureType::Edge, e1.first, e1.second),
1674 Measure::SurfaceFeature(Measure::SurfaceFeatureType::Edge, e2.first, e2.second), calc_radius);
1675 };
1676
1677 shader->start_using();
1678
1679 if (!m_dimensioning.line.is_initialized()) {
1680 GLModel::Geometry init_data;
1682 init_data.color = ColorRGBA::WHITE();
1683 init_data.reserve_vertices(2);
1684 init_data.reserve_indices(2);
1685
1686 // vertices
1687 init_data.add_vertex(Vec3f(0.0f, 0.0f, 0.0f));
1688 init_data.add_vertex(Vec3f(1.0f, 0.0f, 0.0f));
1689
1690 // indices
1691 init_data.add_line(0, 1);
1692
1693 m_dimensioning.line.init_from(std::move(init_data));
1694 }
1695
1696 if (!m_dimensioning.triangle.is_initialized()) {
1697 GLModel::Geometry init_data;
1699 init_data.color = ColorRGBA::WHITE();
1700 init_data.reserve_vertices(3);
1701 init_data.reserve_indices(3);
1702
1703 // vertices
1704 init_data.add_vertex(Vec3f(0.0f, 0.0f, 0.0f));
1705 init_data.add_vertex(Vec3f(-TRIANGLE_HEIGHT, 0.5f * TRIANGLE_BASE, 0.0f));
1706 init_data.add_vertex(Vec3f(-TRIANGLE_HEIGHT, -0.5f * TRIANGLE_BASE, 0.0f));
1707
1708 // indices
1709 init_data.add_triangle(0, 1, 2);
1710
1711 m_dimensioning.triangle.init_from(std::move(init_data));
1712 }
1713
1714 if (last_selected_features != m_selected_features)
1715 m_dimensioning.arc.reset();
1716
1718
1719 const bool has_distance = m_measurement_result.has_distance_data();
1720
1721 const Measure::SurfaceFeature* f1 = &(*m_selected_features.first.feature);
1722 const Measure::SurfaceFeature* f2 = nullptr;
1723 std::unique_ptr<Measure::SurfaceFeature> temp_feature;
1724 if (m_selected_features.second.feature.has_value())
1725 f2 = &(*m_selected_features.second.feature);
1726 else {
1727 assert(m_selected_features.first.feature->get_type() == Measure::SurfaceFeatureType::Circle);
1728 temp_feature = std::make_unique<Measure::SurfaceFeature>(std::get<0>(m_selected_features.first.feature->get_circle()));
1729 f2 = temp_feature.get();
1730 }
1731
1732 if (!m_selected_features.second.feature.has_value() && m_selected_features.first.feature->get_type() != Measure::SurfaceFeatureType::Circle)
1733 return;
1734
1735 Measure::SurfaceFeatureType ft1 = f1->get_type();
1736 Measure::SurfaceFeatureType ft2 = f2->get_type();
1737
1738 // Order features by type so following conditions are simple.
1739 if (ft1 > ft2) {
1740 std::swap(ft1, ft2);
1741 std::swap(f1, f2);
1742 }
1743
1744 // If there is an angle to show, draw the arc:
1746 arc_edge_edge(*f1, *f2);
1748 arc_edge_plane(*f1, *f2);
1750 arc_plane_plane(*f1, *f2);
1751
1752 if (has_distance){
1753 // Where needed, draw the extension of the edge to where the dist is measured:
1755 point_edge(*f1, *f2);
1756
1757 // Render the arrow between the points that the backend passed:
1758 const Measure::DistAndPoints& dap = m_measurement_result.distance_infinite.has_value()
1759 ? *m_measurement_result.distance_infinite
1760 : *m_measurement_result.distance_strict;
1761 if (m_selected_features.second.feature.has_value() &&
1763 auto x_to = dap.from;
1764 x_to[0] = dap.to[0];
1765 point_point(dap.from, x_to, x_to[0] - dap.from[0], ColorRGBA::RED(), false, false);
1766 auto y_to = x_to;
1767 y_to[1] = dap.to[1];
1768 point_point(x_to, y_to, y_to[1] - x_to[1], ColorRGBA::GREEN(), false, false);
1769 point_point(y_to, dap.to, dap.to[2] - y_to[2], ColorRGBA::BLUE(), false, false);
1770 }
1771
1772 point_point(dap.from, dap.to, dap.dist, ColorRGBA::WHITE());
1773 }
1774
1776
1777 shader->stop_using();
1778}
#define EPSILON
Definition ColorUtils.cpp:64
#define L_CONTEXT(s, context)
Definition DesignOffer.hpp:17
#define style
Definition WipeTowerDialog.cpp:101
static const ColorRGBA RED()
Definition Color.hpp:139
static const ColorRGBA BLUE()
Definition Color.hpp:128
static const ColorRGBA LIGHT_GRAY()
Definition Color.hpp:136
static const ColorRGBA GREEN()
Definition Color.hpp:134
static const ColorRGBA WHITE()
Definition Color.hpp:142
@ CanvasView3D
Definition GLCanvas3D.hpp:626
std::string format_double(double value)
Definition GLGizmoMeasure.cpp:71
void update_feature_by_tran(Measure::SurfaceFeature &feature)
Definition GLGizmoMeasure.cpp:2498
Dimensioning m_dimensioning
Definition GLGizmoMeasure.hpp:205
Measure::MeasurementResult m_measurement_result
Definition GLGizmoMeasure.hpp:171
static const double mm_to_in
Definition GizmoObjectManipulation.hpp:31
static void pop_confirm_button_style()
Definition ImGuiWrapper.cpp:2863
static ImU32 to_ImU32(const ColorRGBA &color)
Definition ImGuiWrapper.cpp:2239
static void pop_common_window_style()
Definition ImGuiWrapper.cpp:2839
static void push_confirm_button_style()
Definition ImGuiWrapper.cpp:2844
static void push_cancel_button_style()
Definition ImGuiWrapper.cpp:2867
static void pop_cancel_button_style()
Definition ImGuiWrapper.cpp:2886
static void push_common_window_style(const float scale)
Definition ImGuiWrapper.cpp:2794
static const Transform3d ndc_to_ss_matrix_inverse(const std::array< int, 4 > &viewport)
Definition GLGizmoMeasure.cpp:207
static Vec2d world_to_ss(const Vec3d &world, const Matrix4d &projection_view_matrix, const std::array< int, 4 > &viewport)
Definition GLGizmoMeasure.cpp:196
static constexpr double PI
Definition libslic3r.h:81
static const float TRIANGLE_HEIGHT
Definition GLGizmoMeasure.hpp:54
static const float TRIANGLE_BASE
Definition GLGizmoMeasure.hpp:53
T rad2deg(T angle)
Definition Geometry.hpp:310
Vec3d edge_direction(const Vec3d &from, const Vec3d &to)
Definition Measure.hpp:200
float distance(SpiralVase::SpiralPoint a, SpiralVase::SpiralPoint b)
Definition SpiralVase.cpp:19
@ GizmoAction
Definition UndoRedo.hpp:36
zaa_minimize_perimeter_height resolution((ConfigOptionFloats, retraction_minimum_travel))((ConfigOptionBools
Eigen::Matrix< double, 4, 4, Eigen::DontAlign > Matrix4d
Definition Point.hpp:88
void step(Coord &crd, const Dir d, const long n=1)
Definition MarchingSquares.hpp:213
#define _L_CONTEXT(s, ctx)
Definition I18N.hpp:15

References _L, _L_CONTEXT, _u8L, _u8L_CONTEXT, Slic3r::GUI::GLModel::Geometry::add_index(), Slic3r::GUI::GLModel::Geometry::add_line(), Slic3r::GUI::GLModel::Geometry::add_triangle(), Slic3r::GUI::GLModel::Geometry::add_vertex(), Slic3r::angle(), Slic3r::ColorRGBA::BLUE(), Slic3r::GUI::GLCanvas3D::CanvasView3D, Slic3r::center(), Slic3r::Measure::Circle, Slic3r::GUI::GLModel::Geometry::color, Slic3r::Measure::DistAndPoints::dist, Slic3r::Measure::Edge, Slic3r::Measure::edge_direction(), EPSILON, Slic3r::GUI::FACE_FACE, Slic3r::GUI::GLModel::Geometry::format, format_double(), Slic3r::Measure::DistAndPoints::from, Slic3r::GUI::OpenGLManager::get_gl_info(), Slic3r::GUI::Camera::get_inv_zoom(), Slic3r::GUI::Camera::get_projection_matrix(), Slic3r::Measure::SurfaceFeature::get_type(), Slic3r::GUI::Camera::get_view_matrix(), Slic3r::GUI::Camera::get_viewport(), Slic3r::UndoRedo::GizmoAction, GL_CULL_FACE, GL_DEPTH_TEST, glDisable, glEnable, glLineWidth, glsafe, Slic3r::ColorRGBA::GREEN(), L_CONTEXT, Slic3r::ColorRGBA::LIGHT_GRAY(), Slic3r::GUI::GLModel::Geometry::Lines, Slic3r::GUI::GLModel::Geometry::LineStrip, m_assembly_mode, m_dimensioning, m_editing_distance, m_hit_different_volumes, Slic3r::GUI::GLGizmoBase::m_imgui, m_is_editing_distance_first_frame, m_measure_mode, m_measurement_result, Slic3r::GUI::GLGizmoBase::m_parent, m_pending_scale, m_selected_features, Slic3r::GUI::GizmoObjectManipulation::mm_to_in, Slic3r::GUI::TransformHelper::ndc_to_ss_matrix_inverse(), Slic3r::normal(), Slic3r::GUI::ONLY_ASSEMBLY, Slic3r::GUI::GLModel::Geometry::P3, PI, Slic3r::Measure::Plane, Slic3r::GUI::plater(), Slic3r::Measure::Point, Slic3r::GUI::ImGuiWrapper::pop_cancel_button_style(), Slic3r::GUI::ImGuiWrapper::pop_common_window_style(), Slic3r::GUI::ImGuiWrapper::pop_confirm_button_style(), Slic3r::GUI::ImGuiWrapper::push_cancel_button_style(), Slic3r::GUI::ImGuiWrapper::push_common_window_style(), Slic3r::GUI::ImGuiWrapper::push_confirm_button_style(), Slic3r::Geometry::rad2deg(), Slic3r::ColorRGBA::RED(), register_single_mesh_pick(), Slic3r::GUI::GLModel::Geometry::reserve_indices(), Slic3r::GUI::GLModel::Geometry::reserve_vertices(), Slic3r::resolution(), Slic3r::GUI::Selection::scale(), Slic3r::Geometry::scale_transform(), Slic3r::GUI::TransformationType::set_joint(), Slic3r::GUI::TransformationType::set_relative(), Slic3r::GLShaderProgram::set_uniform(), Slic3r::GUI::TransformationType::set_world(), Slic3r::GUI::Selection::setup_cache(), Slic3r::GLShaderProgram::start_using(), Slic3r::GLShaderProgram::stop_using(), style, Slic3r::Measure::DistAndPoints::to, Slic3r::GUI::ImGuiWrapper::to_ImU32(), Slic3r::Geometry::translation_transform(), Slic3r::GUI::TRIANGLE_BASE, Slic3r::GUI::TRIANGLE_HEIGHT, Slic3r::GUI::GLModel::Geometry::Triangles, update_feature_by_tran(), Slic3r::ColorRGBA::WHITE(), and Slic3r::GUI::TransformHelper::world_to_ss().

Referenced by on_render(), and render_dimensioning_if_scene_reused().

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

◆ render_dimensioning_if_scene_reused()

void Slic3r::GUI::GLGizmoMeasure::render_dimensioning_if_scene_reused ( )
protectedinherited
2209{
2210 // The labels are ImGui and live one frame; the lines drawn with them land under the cached
2211 // scene, which is drawn after the overlay is built.
2214 m_rendered_this_frame = false;
2215}

References m_rendered_this_frame, and render_dimensioning().

Referenced by Slic3r::GUI::GLGizmoAssembly::on_render_input_window(), and on_render_input_window().

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

◆ render_follows_cursor()

bool Slic3r::GUI::GLGizmoMeasure::render_follows_cursor ( ) const
overrideprotectedvirtualinherited

Reimplemented from Slic3r::GUI::GLGizmoBase.

613{
614 // The two raycasts on_render() starts with, without their side effects.
616 return false;
617
618 const Vec2d mouse_position = m_parent.get_local_mouse_position();
619 const Camera& camera = wxGetApp().plater()->get_camera();
620 Vec3f hit = Vec3f::Zero();
621 Vec3f normal = Vec3f::Zero();
622 for (const auto& item : m_gripper_id_raycast_map) {
623 if (item.second->get_id() > 0 && item.second->get_raycaster()->closest_hit(mouse_position, item.second->get_transform(), camera, hit, normal))
624 return true;
625 }
626 for (const auto& item : m_mesh_raycaster_map) {
627 if (item.second->get_raycaster()->unproject_on_mesh(mouse_position, item.second->get_transform(), camera, hit, normal))
628 return true;
629 }
630 return false;
631}

References m_editing_distance, m_gripper_id_raycast_map, m_mesh_raycaster_map, Slic3r::GUI::GLGizmoBase::m_parent, and Slic3r::normal().

Here is the call graph for this function:

◆ render_grabbers() [1/3]

void Slic3r::GUI::GLGizmoBase::render_grabbers ( const BoundingBoxf3 & box) const
protectedinherited
413{
414#if ENABLE_FIXED_GRABBER
416#else
417 render_grabbers((float)((box.size().x() + box.size().y() + box.size().z()) / 3.0));
418#endif
419}
void render_grabbers(const BoundingBoxf3 &box) const
Definition GLGizmoBase.cpp:412
static const float FixedGrabberSize
Definition GLGizmoBase.hpp:90

References Slic3r::GUI::GLGizmoBase::Grabber::FixedGrabberSize, render_grabbers(), and Slic3r::BoundingBox3Base< PointType >::size().

Referenced by Slic3r::GUI::GLGizmoMove3D::on_render(), Slic3r::GUI::GLGizmoScale3D::on_render(), Slic3r::GUI::GLGizmoRotate::render_grabber(), render_grabbers(), and render_grabbers().

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

◆ render_grabbers() [2/3]

void Slic3r::GUI::GLGizmoBase::render_grabbers ( float size) const
protectedinherited
422{
423 render_grabbers(0, m_grabbers.size() - 1, size, false);
424}

References m_grabbers, and render_grabbers().

Here is the call graph for this function:

◆ render_grabbers() [3/3]

void Slic3r::GUI::GLGizmoBase::render_grabbers ( size_t first,
size_t last,
float size,
bool force_hover ) const
protectedinherited
427{
428 GLShaderProgram* shader = wxGetApp().get_shader("gouraud_light");
429 if (shader == nullptr)
430 return;
431 shader->start_using();
432 shader->set_uniform("emission_factor", 0.1f);
434 for (size_t i = first; i <= last; ++i) {
435 if (m_grabbers[i].enabled)
436 m_grabbers[i].render(force_hover ? true : m_hover_id == (int)i, size);
437 }
439 shader->stop_using();
440}

References GL_CULL_FACE, glDisable, glEnable, glsafe, m_grabbers, m_hover_id, Slic3r::GLShaderProgram::set_uniform(), Slic3r::GLShaderProgram::start_using(), and Slic3r::GLShaderProgram::stop_using().

Here is the call graph for this function:

◆ render_input_window()

void Slic3r::GUI::GLGizmoBase::render_input_window ( float x,
float y,
float bottom_limit )
inherited
529{
530 on_render_input_window(x, y, bottom_limit);
532 // imgui windows that don't have an initial size needs to be processed once to get one
533 // and are not rendered in the first frame
534 // so, we forces to render another frame the first time the imgui window is shown
535 // https://github.com/ocornut/imgui/issues/2949
536 m_parent.set_as_dirty();
537 m_parent.request_extra_frame();
539 }
540}
virtual void on_render_input_window(float x, float y, float bottom_limit)
Definition GLGizmoBase.hpp:258
bool m_first_input_window_render
Definition GLGizmoBase.hpp:154

References m_first_input_window_render, m_parent, and on_render_input_window().

Here is the call graph for this function:

◆ render_input_window_warning()

void Slic3r::GUI::GLGizmoAssembly::render_input_window_warning ( bool same_model_object)
overrideprotectedvirtual

Reimplemented from Slic3r::GUI::GLGizmoMeasure.

152{
153 const bool same_mesh_warning = m_hit_different_volumes.size() == 1;
154 const bool wrong_feature_warning = m_selected_wrong_feature_waring_tip;
155 const bool not_assembled_warning = m_hit_different_volumes.size() == 2 && same_model_object == false &&
156 wxGetApp().plater()->canvas3D()->get_canvas_type() == GLCanvas3D::ECanvasType::CanvasView3D;
157
158 if (same_mesh_warning || not_assembled_warning || wrong_feature_warning) {
159 ImGui::Separator();
160 }
161
162 if (same_mesh_warning) {
163 m_imgui->warning_text(_L("Warning: please select two different meshes."));
164 }
165 if (wrong_feature_warning) {
167 m_imgui->warning_text(_L("Warning: please select Plane's feature."));
169 m_imgui->warning_text(_L("Warning: please select Point's or Circle's feature."));
170 }
171 }
172 if (not_assembled_warning) {
173 m_imgui->warning_text(
174 _L("Warning") + ": " +
175 _L("It is recommended to assemble objects first,\nbecause they are restricted to the bed \nand only parts can be lifted.")
176 );
177 }
178}

References _L, Slic3r::GUI::GLCanvas3D::CanvasView3D, Slic3r::GUI::FACE_FACE, Slic3r::GUI::GLGizmoMeasure::m_assembly_mode, Slic3r::GUI::GLGizmoMeasure::m_hit_different_volumes, Slic3r::GUI::GLGizmoBase::m_imgui, Slic3r::GUI::GLGizmoMeasure::m_selected_wrong_feature_waring_tip, and Slic3r::GUI::POINT_POINT.

Referenced by on_render_input_window().

Here is the caller graph for this function:

◆ reset_all_feature()

void Slic3r::GUI::GLGizmoMeasure::reset_all_feature ( )
protectedinherited
2371 {
2374 m_show_reset_first_tip = false;
2376 m_hit_order_volumes.clear();
2377 m_last_hit_volume = nullptr;
2378 }

References m_hit_different_volumes, m_hit_order_volumes, m_last_hit_volume, m_show_reset_first_tip, reset_feature1(), and reset_feature2().

Referenced by data_changed(), gizmo_event(), and Slic3r::GUI::GLGizmoAssembly::switch_to_mode().

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

◆ reset_all_pick()

void Slic3r::GUI::GLGizmoMeasure::reset_all_pick ( )
protectedinherited
2318{
2319 std::map<GLVolume*, std::shared_ptr<PickRaycaster>>().swap(m_mesh_raycaster_map);
2321}

References m_mesh_raycaster_map, reset_gripper_pick(), and UNDEFINE.

Referenced by data_changed().

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

◆ reset_feature1()

void Slic3r::GUI::GLGizmoMeasure::reset_feature1 ( )
protectedinherited
2407{
2410 if (m_selected_features.second.feature.has_value()) {
2411 if (m_hit_different_volumes.size() == 2) {
2413 }
2414 if (m_hit_order_volumes.size() == 2) {
2416 }
2420 } else {
2422 m_selected_features.first.feature.reset();
2423 m_show_reset_first_tip = false;
2424 if (m_hit_different_volumes.size() == 1) {
2426 }
2427 if (m_hit_order_volumes.size() == 1) {
2428 m_hit_order_volumes.clear();
2429 }
2433 }
2435 }

References CIRCLE_1, m_hit_different_volumes, m_hit_order_volumes, m_selected_features, m_selected_wrong_feature_waring_tip, m_show_reset_first_tip, PLANE_1, remove_selected_sphere_raycaster(), reset_feature1_render(), reset_feature2(), reset_gripper_pick(), Slic3r::GUI::SEL_SPHERE_1_ID, SPHERE_1, and update_measurement_result().

Referenced by gizmo_event(), on_mouse(), reset_all_feature(), and show_selection_ui().

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

◆ reset_feature1_render()

void Slic3r::GUI::GLGizmoMeasure::reset_feature1_render ( )
protectedinherited
2381{
2382 if (m_feature_plane_first.plane.model.is_initialized()) {
2383 m_feature_plane_first.plane.model.reset();
2384 m_feature_plane_first.plane_idx = -1;
2385 }
2386 if (m_feature_circle_first.circle.model.is_initialized()) {
2387 m_feature_circle_first.circle.model.reset();
2388 m_feature_circle_first.last_circle_feature = nullptr;
2389 m_feature_circle_first.inv_zoom = 0;
2390 }
2391}

References m_feature_circle_first, and m_feature_plane_first.

Referenced by on_mouse(), and reset_feature1().

Here is the caller graph for this function:

◆ reset_feature2()

void Slic3r::GUI::GLGizmoMeasure::reset_feature2 ( )
protectedinherited

References CIRCLE_2, m_hit_different_volumes, m_hit_order_volumes, m_selected_features, m_selected_wrong_feature_waring_tip, m_show_reset_first_tip, PLANE_2, remove_selected_sphere_raycaster(), reset_feature2_render(), reset_gripper_pick(), Slic3r::GUI::SEL_SPHERE_2_ID, SPHERE_2, and update_measurement_result().

Referenced by gizmo_event(), on_mouse(), reset_all_feature(), reset_feature1(), and show_selection_ui().

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

◆ reset_feature2_render()

void Slic3r::GUI::GLGizmoMeasure::reset_feature2_render ( )
protectedinherited
2394{
2395 if (m_feature_plane_second.plane.model.is_initialized()) {
2396 m_feature_plane_second.plane.model.reset();
2397 m_feature_plane_second.plane_idx = -1;
2398 }
2399 if (m_feature_circle_second.circle.model.is_initialized()) {
2400 m_feature_circle_second.circle.model.reset();
2401 m_feature_circle_second.last_circle_feature = nullptr;
2402 m_feature_circle_second.inv_zoom = 0;
2403 }
2404}

References m_feature_circle_second, and m_feature_plane_second.

Referenced by on_mouse(), and reset_feature2().

Here is the caller graph for this function:

◆ reset_gripper_pick()

void Slic3r::GUI::GLGizmoMeasure::reset_gripper_pick ( GripperType id,
bool is_all = false )
protectedinherited

References CIRCLE, CIRCLE_1, CIRCLE_2, EDGE, m_gripper_id_raycast_map, PLANE, PLANE_1, PLANE_2, POINT, and reset_gripper_pick().

Referenced by init_circle_glmodel(), init_plane_glmodel(), on_render(), remove_selected_sphere_raycaster(), reset_all_pick(), reset_feature1(), reset_feature2(), and reset_gripper_pick().

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

◆ restore_scene_raycasters_state()

void Slic3r::GUI::GLGizmoMeasure::restore_scene_raycasters_state ( )
protectedinherited
1209{
1210 for(auto iter:m_gripper_id_raycast_map)
1211 {
1212 iter.second->set_active(true);
1213 }
1214}

References m_gripper_id_raycast_map.

Referenced by gizmo_event(), and on_set_state().

Here is the caller graph for this function:

◆ save()

void Slic3r::GUI::GLGizmoBase::save ( cereal::BinaryOutputArchive & ar) const
inlineinherited
171{ on_save(ar); }
virtual void on_save(cereal::BinaryOutputArchive &ar) const
Definition GLGizmoBase.hpp:242

References on_save().

Here is the call graph for this function:

◆ set_common_data_pool()

void Slic3r::GUI::GLGizmoBase::set_common_data_pool ( CommonGizmosDataPool * ptr)
inlineinherited
193{ m_c = ptr; }
CommonGizmosDataPool * m_c
Definition GLGizmoBase.hpp:155

References m_c.

◆ set_dirty()

void Slic3r::GUI::GLGizmoBase::set_dirty ( )
protectedinherited
524 {
525 m_dirty = true;
526}
bool m_dirty
Definition GLGizmoBase.hpp:293

References m_dirty.

Referenced by Slic3r::GUI::GLGizmoCut3D::process_cut_line(), and Slic3r::GUI::GLGizmoSimplify::request_rerender().

Here is the caller graph for this function:

◆ set_distance()

void Slic3r::GUI::GLGizmoMeasure::set_distance ( bool same_model_object,
const Vec3d & displacement,
bool take_shot = true )
protectedinherited
2530{
2531 if (m_hit_different_volumes.size() == 2 && displacement.norm() > 0.0f) {
2532 auto v = m_hit_different_volumes[1];
2533 auto selection = const_cast<Selection *>(&m_parent.get_selection());
2534 selection->setup_cache();
2535 if (take_shot) {
2536 wxGetApp().plater()->take_snapshot("MoveInMeasure", UndoRedo::SnapshotType::GizmoAction); // avoid storing another snapshot
2537 }
2538 selection->set_mode(same_model_object ? Selection::Volume : Selection::Instance);
2539 m_pending_scale ++;
2540 if (same_model_object == false) {
2541 Vec3d object_displacement = v->get_instance_transformation().get_matrix_no_offset().inverse() * displacement;
2542 v->set_instance_transformation(v->get_instance_transformation().get_matrix() * Geometry::translation_transform(object_displacement));
2543 } else {
2544 Geometry::Transformation tran(v->world_matrix());
2545 Vec3d local_displacement = tran.get_matrix_no_offset().inverse() * displacement;
2546 v->set_volume_transformation(v->get_volume_transformation().get_matrix() * Geometry::translation_transform(local_displacement));
2547 }
2548 wxGetApp().plater()->canvas3D()->do_move("");
2550 if (same_model_object ) {
2552 }
2554 }
2555}
@ Instance
Definition Selection.hpp:54
@ Volume
Definition Selection.hpp:53

References Slic3r::Geometry::Transformation::get_matrix_no_offset(), Slic3r::UndoRedo::GizmoAction, Slic3r::GUI::Selection::Instance, m_hit_different_volumes, Slic3r::GUI::GLGizmoBase::m_parent, m_pending_scale, m_selected_features, register_single_mesh_pick(), Slic3r::GUI::Selection::setup_cache(), Slic3r::Geometry::translation_transform(), update_feature_by_tran(), and Slic3r::GUI::Selection::Volume.

Referenced by set_to_center_coincidence(), and show_distance_xyz_ui().

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

◆ set_hover_id()

void Slic3r::GUI::GLGizmoBase::set_hover_id ( int id)
inherited
348{
349 // do not change hover id during dragging
350 assert(!m_dragging);
351
352 // allow empty grabbers when not using grabbers but use hover_id - flatten, rotate
353// if (!m_grabbers.empty() && id >= (int) m_grabbers.size())
354// return;
355
356 m_hover_id = id;
358}
virtual void on_set_hover_id()
Definition GLGizmoBase.hpp:245

References m_dragging, m_hover_id, and on_set_hover_id().

Referenced by Slic3r::GUI::GLGizmoRotate3D::on_set_hover_id().

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

◆ set_icon_filename()

void Slic3r::GUI::GLGizmoBase::set_icon_filename ( const std::string & filename)
inherited
343 {
344 m_icon_filename = filename;
345}

References m_icon_filename.

◆ set_parallel_distance()

void Slic3r::GUI::GLGizmoMeasure::set_parallel_distance ( bool same_model_object,
float dist )
protectedinherited
2703{
2704 if (m_hit_different_volumes.size() == 2 && abs(dist) >= 0.0f) {
2705 auto v = m_hit_different_volumes[1];
2706 auto selection = const_cast<Selection *>(&m_parent.get_selection());
2707 selection->setup_cache();
2708
2709 wxGetApp().plater()->take_snapshot("SetParallelDistanceInMeasure", UndoRedo::SnapshotType::GizmoAction); // avoid storing another snapshot
2710
2711 selection->set_mode(same_model_object ? Selection::Volume : Selection::Instance);
2712 m_pending_scale = 1;
2713
2714 const auto [idx1, normal1, pt1] = m_selected_features.first.feature->get_plane();
2715 const auto [idx2, normal2, pt2] = m_selected_features.second.feature->get_plane();
2716 Vec3d proj_pt2;
2717 Measure::get_point_projection_to_plane(pt2, pt1, normal1, proj_pt2);
2718 Vec3d new_pt2 = proj_pt2 + normal1 * dist;
2719
2720 Vec3d displacement = new_pt2 - pt2;
2721
2722 if (same_model_object == false) {
2723 selection->translate(v->object_idx(), v->instance_idx(), displacement);
2724 } else {
2725 selection->translate(v->object_idx(), v->instance_idx(), v->volume_idx(), displacement);
2726 }
2727 wxGetApp().plater()->canvas3D()->do_move("");
2729 if (same_model_object) {
2731 }
2733 }
2734}
T dist(const boost::polygon::point_data< T > &p1, const boost::polygon::point_data< T > &p2)
Definition Geometry.cpp:298
bool get_point_projection_to_plane(const Vec3d &pt, const Vec3d &plane_origin, const Vec3d &plane_normal, Vec3d &intersection_pt)
Definition Measure.cpp:40

References Slic3r::Geometry::dist(), Slic3r::Measure::get_point_projection_to_plane(), Slic3r::UndoRedo::GizmoAction, Slic3r::GUI::Selection::Instance, m_hit_different_volumes, Slic3r::GUI::GLGizmoBase::m_parent, m_pending_scale, m_selected_features, register_single_mesh_pick(), Slic3r::GUI::Selection::setup_cache(), update_feature_by_tran(), and Slic3r::GUI::Selection::Volume.

Referenced by show_face_face_assembly_senior().

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

◆ set_state()

void Slic3r::GUI::GLGizmoBase::set_state ( EState state)
inlineinherited
176{ m_state = state; on_set_state(); }
virtual void on_set_state()
Definition GLGizmoBase.hpp:244

References m_state, and on_set_state().

Referenced by Slic3r::GUI::GLGizmosManager::activate_gizmo().

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

◆ set_to_around_center_of_faces()

void Slic3r::GUI::GLGizmoMeasure::set_to_around_center_of_faces ( bool same_model_object,
float rotate_degree )
protectedinherited
2655{
2656 if (m_hit_different_volumes.size() == 2 ) {
2657 auto &action = m_assembly_action;
2658 auto v = m_hit_different_volumes[1];
2659 auto selection = const_cast<Selection *>(&m_parent.get_selection());
2660 selection->setup_cache();
2661 wxGetApp().plater()->take_snapshot("ReverseRotateInMeasure", UndoRedo::SnapshotType::GizmoAction); // avoid storing another snapshot
2662
2663 selection->set_mode(same_model_object ? Selection::Volume : Selection::Instance);
2664 m_pending_scale = 1;
2665
2666 auto radian = Geometry::deg2rad(rotate_degree);
2667 Vec3d plane_normal, plane_center;
2668 const auto [idx2, normal2, pt2] = m_selected_features.second.feature->get_plane();
2669 plane_normal = normal2;
2670 plane_center = pt2;
2671
2672 if (same_model_object == false) {
2673 Geometry::Transformation inMat(v->get_instance_transformation());
2674 Geometry::Transformation outMat = Geometry::mat_around_a_point_rotate(inMat, plane_center, plane_normal, radian);
2675 selection->rotate(v->object_idx(), v->instance_idx(), outMat.get_matrix());
2676 } else {
2677 Geometry::Transformation inMat(v->world_matrix());
2678 Geometry::Transformation outMat = Geometry::mat_around_a_point_rotate(inMat, plane_center, plane_normal, radian);
2679 Transform3d volume_tran = v->get_instance_transformation().get_matrix().inverse() * outMat.get_matrix();
2680 selection->rotate(v->object_idx(), v->instance_idx(), v->volume_idx(), volume_tran);
2681 }
2682 wxGetApp().plater()->canvas3D()->do_rotate("");
2684 if (same_model_object) {
2686 }
2688 }
2689}
Measure::AssemblyAction m_assembly_action
Definition GLGizmoMeasure.hpp:172
constexpr T deg2rad(const T angle)
Definition Geometry.hpp:312
Transformation mat_around_a_point_rotate(const Transformation &InMat, const Vec3d &pt, const Vec3d &axis, float rotate_theta_radian)
Definition Geometry.cpp:826
Vec3d plane_normal(const SurfaceFeature &plane)
Definition Measure.hpp:207

References Slic3r::Geometry::deg2rad(), Slic3r::Geometry::Transformation::get_matrix(), Slic3r::UndoRedo::GizmoAction, Slic3r::GUI::Selection::Instance, m_assembly_action, m_hit_different_volumes, Slic3r::GUI::GLGizmoBase::m_parent, m_pending_scale, m_selected_features, Slic3r::Geometry::mat_around_a_point_rotate(), register_single_mesh_pick(), Slic3r::GUI::Selection::setup_cache(), update_feature_by_tran(), and Slic3r::GUI::Selection::Volume.

Referenced by show_face_face_assembly_senior().

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

◆ set_to_center_coincidence()

void Slic3r::GUI::GLGizmoMeasure::set_to_center_coincidence ( bool same_model_object)
protectedinherited
2691 {
2692 auto v = m_hit_different_volumes[1];
2693 wxGetApp().plater()->take_snapshot("RotateThenMoveInMeasure", UndoRedo::SnapshotType::GizmoAction);
2694 set_to_parallel(same_model_object, false,true);
2695
2696 const auto [idx1, normal1, pt1] = m_selected_features.first.feature->get_plane();
2697 const auto [idx2, normal2, pt2] = m_selected_features.second.feature->get_plane();
2698 set_distance(same_model_object, pt1 - pt2, false);
2700}
void set_to_parallel(bool same_model_object, bool take_shot=true, bool is_anti_parallel=false)
Definition GLGizmoMeasure.cpp:2557
bool m_set_center_coincidence
Definition GLGizmoMeasure.hpp:235
void set_distance(bool same_model_object, const Vec3d &displacement, bool take_shot=true)
Definition GLGizmoMeasure.cpp:2529

References Slic3r::UndoRedo::GizmoAction, m_hit_different_volumes, m_selected_features, m_set_center_coincidence, set_distance(), and set_to_parallel().

Referenced by show_face_face_assembly_common().

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

◆ set_to_parallel()

void Slic3r::GUI::GLGizmoMeasure::set_to_parallel ( bool same_model_object,
bool take_shot = true,
bool is_anti_parallel = false )
protectedinherited
2558{
2559 if (m_hit_different_volumes.size() == 2) {
2560 auto &action = m_assembly_action;
2561 auto v = m_hit_different_volumes[1];
2562 auto selection = const_cast<Selection *>(&m_parent.get_selection());
2563 selection->setup_cache();
2564 if (take_shot) {
2565 wxGetApp().plater()->take_snapshot("RotateInMeasure", UndoRedo::SnapshotType::GizmoAction); // avoid storing another snapshot
2566 }
2567 selection->set_mode(same_model_object ? Selection::Volume : Selection::Instance);
2568 const auto [idx1, normal1, pt1] = m_selected_features.first.feature->get_plane();
2569 const auto [idx2, normal2, pt2] = m_selected_features.second.feature->get_plane();
2570 if ((is_anti_parallel && normal1.dot(normal2) > -1 + 1e-3) ||
2571 (is_anti_parallel == false && (normal1.dot(normal2) < 1 - 1e-3))) {
2572 m_pending_scale ++;
2573 Vec3d axis;
2574 double angle;
2575 Matrix3d rotation_matrix;
2576 Geometry::rotation_from_two_vectors(normal2, -normal1, axis, angle, &rotation_matrix);
2577 Transform3d r_m = (Transform3d) rotation_matrix;
2578 if (same_model_object == false) {
2579 auto new_rotation_tran = r_m * v->get_instance_transformation().get_rotation_matrix();
2580 Vec3d rotation = Geometry::extract_euler_angles(new_rotation_tran);
2581 v->set_instance_rotation(rotation);
2582 selection->rotate(v->object_idx(), v->instance_idx(), v->get_instance_transformation().get_matrix());
2583 } else {
2584 Geometry::Transformation world_tran(v->world_matrix());
2585 auto new_tran = r_m * world_tran.get_rotation_matrix();
2586 Transform3d volume_rotation_tran = v->get_instance_transformation().get_rotation_matrix().inverse() * new_tran;
2587 Vec3d rotation = Geometry::extract_euler_angles(volume_rotation_tran);
2588 v->set_volume_rotation(rotation);
2589 selection->rotate(v->object_idx(), v->instance_idx(), v->volume_idx(), v->get_volume_transformation().get_matrix());
2590 }
2591 wxGetApp().plater()->canvas3D()->do_rotate("");
2593 if (same_model_object) {
2595 }
2597 }
2598 }
2599}
void rotation_from_two_vectors(Vec3d from, Vec3d to, Vec3d &rotation_axis, double &phi, Matrix3d *rotation_matrix)
Definition Geometry.cpp:416
Vec3d extract_euler_angles(const Eigen::Matrix< double, 3, 3, Eigen::DontAlign > &rotation_matrix)
Definition Geometry.cpp:395

References Slic3r::angle(), Slic3r::Geometry::extract_euler_angles(), Slic3r::Geometry::Transformation::get_rotation_matrix(), Slic3r::UndoRedo::GizmoAction, Slic3r::GUI::Selection::Instance, m_assembly_action, m_hit_different_volumes, Slic3r::GUI::GLGizmoBase::m_parent, m_pending_scale, m_selected_features, register_single_mesh_pick(), Slic3r::Geometry::rotation_from_two_vectors(), Slic3r::GUI::Selection::setup_cache(), update_feature_by_tran(), and Slic3r::GUI::Selection::Volume.

Referenced by set_to_center_coincidence(), and show_face_face_assembly_common().

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

◆ set_to_reverse_rotation()

void Slic3r::GUI::GLGizmoMeasure::set_to_reverse_rotation ( bool same_model_object,
int feature_index )
protectedinherited
2602{
2603 if (m_hit_different_volumes.size() == 2 && feature_index < 2) {
2604 auto &action = m_assembly_action;
2605 auto v = m_hit_different_volumes[feature_index];
2606 auto selection = const_cast<Selection *>(&m_parent.get_selection());
2607 selection->setup_cache();
2608 wxGetApp().plater()->take_snapshot("ReverseRotateInMeasure", UndoRedo::SnapshotType::GizmoAction); // avoid storing another snapshot
2609
2610 selection->set_mode(same_model_object ? Selection::Volume : Selection::Instance);
2611 m_pending_scale = 1;
2612 Vec3d plane_normal,plane_center;
2613 if (feature_index ==0) {//feature 1
2614 const auto [idx1, normal1, pt1] = m_selected_features.first.feature->get_plane();
2615 plane_normal = normal1;
2616 plane_center = pt1;
2617 }
2618 else { // feature 2
2619 const auto [idx2, normal2, pt2] = m_selected_features.second.feature->get_plane();
2620 plane_normal = normal2;
2621 plane_center = pt2;
2622 }
2623 auto new_pt = Measure::get_one_point_in_plane(plane_center, plane_normal);
2624 Vec3d axis = (new_pt - plane_center).normalized();
2625 if (axis.norm() < 0.1) {
2626 throw;
2627 }
2628 if (same_model_object == false) {
2629 Geometry::Transformation inMat(v->get_instance_transformation());
2630 Geometry::Transformation outMat = Geometry::mat_around_a_point_rotate(inMat, plane_center, axis, PI);
2631 selection->rotate(v->object_idx(), v->instance_idx(), outMat.get_matrix());
2632 } else {
2633 Geometry::Transformation inMat(v->world_matrix());
2634 Geometry::Transformation outMat = Geometry::mat_around_a_point_rotate(inMat, plane_center, axis, PI);
2635 Transform3d volume_tran = v->get_instance_transformation().get_matrix().inverse() * outMat.get_matrix();
2636 selection->rotate(v->object_idx(), v->instance_idx(), v->volume_idx(), volume_tran);
2637 }
2638 wxGetApp().plater()->canvas3D()->do_rotate("");
2640 if (same_model_object == false) {
2641 if (feature_index == 0) { // feature 1
2643 } else { // feature 2
2645 }
2646 }
2647 else {
2650 }
2651 }
2652}
Vec3d get_one_point_in_plane(const Vec3d &plane_origin, const Vec3d &plane_normal)
Definition Measure.cpp:49

References Slic3r::Geometry::Transformation::get_matrix(), Slic3r::Measure::get_one_point_in_plane(), Slic3r::UndoRedo::GizmoAction, Slic3r::GUI::Selection::Instance, m_assembly_action, m_hit_different_volumes, Slic3r::GUI::GLGizmoBase::m_parent, m_pending_scale, m_selected_features, Slic3r::Geometry::mat_around_a_point_rotate(), PI, register_single_mesh_pick(), Slic3r::GUI::Selection::setup_cache(), update_feature_by_tran(), and Slic3r::GUI::Selection::Volume.

Referenced by show_face_face_assembly_senior().

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

◆ shortcut()

std::optional< Shortcut > Slic3r::GUI::GLGizmoBase::shortcut ( ) const
inlineinherited
178{ return m_shortcut; }

References m_shortcut.

Referenced by Slic3r::GUI::GLGizmoFdmSupports::on_tool_shortcut(), Slic3r::GUI::GLGizmoMmuSegmentation::on_tool_shortcut(), Slic3r::GUI::GLGizmoPainterBase::on_tool_shortcut(), and Slic3r::GUI::GLGizmoSeam::on_tool_shortcut().

Here is the caller graph for this function:

◆ show_distance_xyz_ui()

void Slic3r::GUI::GLGizmoMeasure::show_distance_xyz_ui ( )
protectedinherited
1997{
1999 m_imgui->text(_u8L("Measure"));
2000 }
2001 auto add_measure_row_to_table = [this](const std::string &col_1, const ImVec4 &col_1_color, const std::string &col_2, const ImVec4 &col_2_color) {
2002 ImGui::TableNextRow();
2003 ImGui::TableSetColumnIndex(0);
2004 m_imgui->text_colored(col_1_color, col_1);
2005 ImGui::TableSetColumnIndex(1);
2006 m_imgui->text_colored(col_2_color, col_2);
2007 ImGui::TableSetColumnIndex(2);
2008 if (m_imgui->image_button(m_is_dark_mode ? ImGui::ClipboardBtnDarkIcon : ImGui::ClipboardBtnIcon, _L("Copy to clipboard"))) {
2009 wxTheClipboard->Open();
2010 wxTheClipboard->SetData(new wxTextDataObject(wxString((col_1 + ": " + col_2).c_str(), wxConvUTF8)));
2011 wxTheClipboard->Close();
2012 }
2013 };
2014 auto add_edit_distance_xyz_box = [this](Vec3d &distance) {
2015 //m_imgui->disabled_begin(m_hit_different_volumes.size() == 1);
2016 //{
2018 m_can_set_xyz_distance = false;
2019 }
2020 bool volume = m_hit_different_volumes.size() == 1;
2021 ImGui::TableNextRow();
2022 ImGui::TableSetColumnIndex(0);
2023 m_imgui->text_colored(ImGuiWrapper::to_ImVec4(ColorRGBA::X()), "X:"); // ORCA match axis color
2024 ImGui::TableSetColumnIndex(1);
2025 ImGui::PushItemWidth(m_input_size_max);
2026 m_imgui->disabled_begin(volume || !m_can_set_xyz_distance); // ORCA disable only input box othervise axis colors rendered dimmed
2027 ImGui::BBLInputDouble("##measure_distance_x", &m_buffered_distance[0], 0.0f, 0.0f, "%.2f");
2028 m_imgui->disabled_end();
2029
2030 ImGui::TableNextRow();
2031 ImGui::TableSetColumnIndex(0);
2032 m_imgui->text_colored(ImGuiWrapper::to_ImVec4(ColorRGBA::Y()), "Y:"); // ORCA match axis color
2033 ImGui::TableSetColumnIndex(1);
2034 m_imgui->disabled_begin(volume || !m_can_set_xyz_distance); // ORCA disable only input box othervise axis colors rendered dimmed
2035 ImGui::BBLInputDouble("##measure_distance_y", &m_buffered_distance[1], 0.0f, 0.0f, "%.2f");
2036 m_imgui->disabled_end();
2037
2038 ImGui::TableNextRow();
2039 ImGui::TableSetColumnIndex(0);
2040 m_imgui->text_colored(ImGuiWrapper::to_ImVec4(ColorRGBA::Z()), "Z:"); // ORCA match axis color
2041 ImGui::TableSetColumnIndex(1);
2042 m_imgui->disabled_begin(volume || !(m_same_model_object && m_can_set_xyz_distance)); // ORCA disable only input box othervise axis colors rendered dimmed
2043 ImGui::BBLInputDouble("##measure_distance_z", &m_buffered_distance[2], 0.0f, 0.0f, "%.2f");
2044 m_imgui->disabled_end();
2045 //}
2046 //m_imgui->disabled_end();
2048 Vec3d displacement = Vec3d::Zero();
2049 if (std::abs(m_buffered_distance[0] - distance[0]) > EPSILON) {
2050 displacement[0] = m_buffered_distance[0] - distance[0];
2052 } else if (std::abs(m_buffered_distance[1] - distance[1]) > EPSILON) {
2053 displacement[1] = m_buffered_distance[1] - distance[1];
2055 } else if (std::abs(m_buffered_distance[2] - distance[2]) > EPSILON) {
2056 displacement[2] = m_buffered_distance[2] - distance[2];
2058 }
2059 if (displacement.norm() > 0.0f) { set_distance(m_same_model_object, displacement); }
2060 }
2061 };
2062 const unsigned int max_measure_row_count = 2;
2063 unsigned int measure_row_count = 0;
2064 if (ImGui::BeginTable("Measure", 4)) {
2065 if (m_selected_features.second.feature.has_value()) {
2066 const Measure::MeasurementResult &measure = m_measurement_result;
2067 if (measure.angle.has_value() && m_measure_mode == EMeasureMode::ONLY_MEASURE)
2068 {
2069 ImGui::PushID("ClipboardAngle");
2070 add_measure_row_to_table(_u8L("Angle"), ImGuiWrapper::COL_ORCA, format_double(Geometry::rad2deg(measure.angle->angle)) + "°",
2071 ImGui::GetStyleColorVec4(ImGuiCol_Text));
2072 ++measure_row_count;
2073 ImGui::PopID();
2074 }
2075
2076 const bool show_strict = measure.distance_strict.has_value() &&
2077 (!measure.distance_infinite.has_value() || std::abs(measure.distance_strict->dist - measure.distance_infinite->dist) > EPSILON);
2078
2079 if (measure.distance_infinite.has_value() && m_measure_mode == EMeasureMode::ONLY_MEASURE) {
2080 double distance = measure.distance_infinite->dist;
2082 ImGui::PushID("ClipboardDistanceInfinite");
2083 add_measure_row_to_table(show_strict ? _u8L("Perpendicular distance") : _u8L("Distance"), ImGuiWrapper::COL_ORCA, format_double(distance) + m_units,
2084 ImGui::GetStyleColorVec4(ImGuiCol_Text));
2085 ++measure_row_count;
2086 ImGui::PopID();
2087 }
2088 if (show_strict &&
2091 {
2092 double distance = measure.distance_strict->dist;
2093 if (m_use_inches)
2095 ImGui::PushID("ClipboardDistanceStrict");
2096 add_measure_row_to_table(_u8L("Direct distance"), ImGuiWrapper::COL_ORCA, format_double(distance) + m_units, ImGui::GetStyleColorVec4(ImGuiCol_Text));
2097 ++measure_row_count;
2098 ImGui::PopID();
2099 }
2100 if (measure.distance_xyz.has_value() && m_measure_mode == EMeasureMode::ONLY_MEASURE) {
2101 Vec3d distance = *measure.distance_xyz;
2103 if (measure.distance_xyz->norm() > EPSILON) {
2104 ImGui::PushID("ClipboardDistanceXYZ");
2105 add_measure_row_to_table(_u8L("Distance XYZ"), ImGuiWrapper::COL_ORCA, format_vec3(distance), ImGui::GetStyleColorVec4(ImGuiCol_Text));
2106 ++measure_row_count;
2107 ImGui::PopID();
2108 }
2109 }
2110
2111 if (m_distance.norm() > 0.01) {
2113 add_edit_distance_xyz_box(m_distance);
2114 }
2115 }
2116 }
2117 // add dummy rows to keep dialog size fixed
2118 /*for (unsigned int i = measure_row_count; i < max_measure_row_count; ++i) {
2119 add_strings_row_to_table(*m_imgui, " ", ImGuiWrapper::COL_ORCA, " ", ImGui::GetStyleColorVec4(ImGuiCol_Text));
2120 }*/
2121 ImGui::EndTable();
2122 }
2123}
std::string format_vec3(const Vec3d &v)
Definition GLGizmoMeasure.cpp:78
Vec3d m_buffered_distance
Definition GLGizmoMeasure.hpp:214
bool m_can_set_xyz_distance
Definition GLGizmoMeasure.hpp:238
static const ImVec4 COL_ORCA
Definition ImGuiWrapper.hpp:408
json measure(DesignPanel *panel, const json &params)
Definition McpControl.cpp:555
@ ONLY_MEASURE
Definition GLGizmoMeasure.hpp:34

References _L, _u8L, Slic3r::GUI::ImGuiWrapper::COL_ORCA, EPSILON, Slic3r::GUI::FACE_FACE, format_double(), format_vec3(), m_assembly_mode, m_buffered_distance, m_can_set_xyz_distance, m_current_active_imgui_id, m_distance, m_hit_different_volumes, Slic3r::GUI::GLGizmoBase::m_imgui, m_input_size_max, Slic3r::GUI::GLGizmoBase::m_is_dark_mode, m_last_active_item_imgui, m_measure_mode, m_measurement_result, m_same_model_object, m_selected_features, m_units, m_use_inches, Slic3r::GUI::GizmoObjectManipulation::mm_to_in, Slic3r::GUI::ONLY_ASSEMBLY, Slic3r::GUI::ONLY_MEASURE, Slic3r::GUI::POINT_POINT, Slic3r::Geometry::rad2deg(), set_distance(), Slic3r::GUI::ImGuiWrapper::to_ImVec4(), Slic3r::ColorRGBA::X(), Slic3r::ColorRGBA::Y(), and Slic3r::ColorRGBA::Z().

Referenced by Slic3r::GUI::GLGizmoAssembly::on_render_input_window(), and on_render_input_window().

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

◆ show_face_face_assembly_common()

void Slic3r::GUI::GLGizmoMeasure::show_face_face_assembly_common ( )
protectedinherited
2129 {
2131 m_selected_features.first.feature->get_type() == Measure::SurfaceFeatureType::Plane &&
2132 m_selected_features.second.feature->get_type() == Measure::SurfaceFeatureType::Plane) {
2133 auto &action = m_assembly_action;
2134 auto set_to_parallel_size = m_imgui->calc_button_size(_L("Parallel")).x;
2135 auto set_to_center_coincidence_size = m_imgui->calc_button_size(_L("Center coincidence")).x;
2136
2137 m_imgui->disabled_begin(!(action.can_set_to_center_coincidence));
2138 {
2139 ImGui::PushItemWidth(set_to_center_coincidence_size);
2140 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0 / 255.0, 150 / 255.0, 136 / 255.0, 1.0));
2141 ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(38 / 255.0f, 166 / 255.0f, 154 / 255.0f, 1.00f));
2142 ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0 / 255.0f, 137 / 255.0f, 123 / 255.0f, 1.00f));
2143 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(254 / 255.0f, 254 / 255.0f, 254 / 255.0f, 1.00f));
2144 if (m_imgui->button(_L("Center coincidence"))) {
2146 }
2147 ImGui::PopStyleColor(4);
2148 ImGui::SameLine(set_to_center_coincidence_size + m_space_size * 2);
2149 }
2150 m_imgui->disabled_end();
2151
2152 m_imgui->disabled_begin(!action.can_set_to_parallel);
2153 {
2154 if (m_imgui->button(_L("Parallel"))) { set_to_parallel(m_same_model_object); }
2155 }
2156 m_imgui->disabled_end();
2157 }
2158}
void set_to_center_coincidence(bool same_model_object)
Definition GLGizmoMeasure.cpp:2691

References _L, m_assembly_action, m_hit_different_volumes, Slic3r::GUI::GLGizmoBase::m_imgui, m_measure_mode, m_same_model_object, m_selected_features, m_space_size, Slic3r::GUI::ONLY_ASSEMBLY, Slic3r::Measure::Plane, set_to_center_coincidence(), and set_to_parallel().

Referenced by Slic3r::GUI::GLGizmoAssembly::on_render_input_window().

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

◆ show_face_face_assembly_senior()

void Slic3r::GUI::GLGizmoMeasure::show_face_face_assembly_senior ( )
protectedinherited
2161{
2163 m_selected_features.first.feature->get_type() == Measure::SurfaceFeatureType::Plane &&
2164 m_selected_features.second.feature->get_type() == Measure::SurfaceFeatureType::Plane) {
2165 auto &action = m_assembly_action;
2166 auto feature_text_size = m_imgui->calc_button_size(_L("Feature 1")).x + m_imgui->calc_button_size(":").x;
2167 auto set_to_reverse_rotation_size = m_imgui->calc_button_size(_L("Reverse rotation")).x;
2168 auto rotate_around_center_size = m_imgui->calc_button_size(_L("Rotate around center:")).x;
2169 auto parallel_distance_size = m_imgui->calc_button_size(_L("Parallel distance:")).x;
2170
2171 if (m_imgui->bbl_checkbox(_L("Flip by Face 2"), m_flip_volume_2)) {
2173 }
2174
2175 if (action.has_parallel_distance) {
2176 m_imgui->text(_u8L("Parallel distance:"));
2177 ImGui::SameLine(parallel_distance_size + m_space_size);
2178 ImGui::PushItemWidth(m_input_size_max);
2179 ImGui::BBLInputDouble("##parallel_distance_z", &m_buffered_parallel_distance, 0.0f, 0.0f, "%.2f");
2180 if (m_last_active_item_imgui != m_current_active_imgui_id && std::abs(m_buffered_parallel_distance - action.parallel_distance) > EPSILON) {
2182 }
2183 }
2184 if (action.can_around_center_of_faces) {
2185 m_imgui->text(_u8L("Rotate around center:"));
2186 ImGui::SameLine(rotate_around_center_size + m_space_size);
2187 ImGui::PushItemWidth(m_input_size_max);
2188 ImGui::BBLInputDouble("##rotate_around_center", &m_buffered_around_center, 0.0f, 0.0f, "%.2f");
2192 }
2193 ImGui::SameLine(rotate_around_center_size + m_space_size + m_input_size_max + m_space_size / 2.0f);
2194 m_imgui->text("°");
2195 }
2196 }
2197}
bool m_flip_volume_2
Definition GLGizmoMeasure.hpp:332
void set_to_around_center_of_faces(bool same_model_object, float rotate_degree)
Definition GLGizmoMeasure.cpp:2654
double m_buffered_around_center
Definition GLGizmoMeasure.hpp:217
void set_parallel_distance(bool same_model_object, float dist)
Definition GLGizmoMeasure.cpp:2702
void set_to_reverse_rotation(bool same_model_object, int feature_index)
Definition GLGizmoMeasure.cpp:2601
double m_buffered_parallel_distance
Definition GLGizmoMeasure.hpp:216

References _L, _u8L, EPSILON, m_assembly_action, m_buffered_around_center, m_buffered_parallel_distance, m_current_active_imgui_id, m_flip_volume_2, m_hit_different_volumes, Slic3r::GUI::GLGizmoBase::m_imgui, m_input_size_max, m_last_active_item_imgui, m_measure_mode, m_same_model_object, m_selected_features, m_space_size, Slic3r::GUI::ONLY_ASSEMBLY, Slic3r::Measure::Plane, set_parallel_distance(), set_to_around_center_of_faces(), and set_to_reverse_rotation().

Referenced by Slic3r::GUI::GLGizmoAssembly::on_render_input_window().

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

◆ show_selection_ui()

void Slic3r::GUI::GLGizmoMeasure::show_selection_ui ( )
protectedinherited
1885{
1886 auto space_size = m_space_size;
1887 // Show selection
1888 {
1889 auto format_item_text = [this](const SelectedFeatures::Item &item) {
1890 if (!item.feature.has_value()) return _u8L("None");
1891
1892 std::string text = (item.source == item.feature) ? surface_feature_type_as_string(item.feature->get_type()) :
1893 item.is_center ? center_on_feature_type_as_string(item.source->get_type()) :
1895 if (item.feature.has_value() && item.feature->get_type() == Measure::SurfaceFeatureType::Circle) {
1896 auto [center, radius, normal] = item.feature->get_circle();
1897 const Vec3d on_circle = center + radius * Measure::get_orthogonal(normal, true);
1898 radius = (on_circle - center).norm();
1899 if (m_use_inches)
1900 radius = GizmoObjectManipulation::mm_to_in * radius;
1901 text += " (" + _u8L("Diameter") + ": " + format_double(2.0 * radius) + m_units + ")";
1902 } else if (item.feature.has_value() && item.feature->get_type() == Measure::SurfaceFeatureType::Edge) {
1903 auto [start, end] = item.feature->get_edge();
1904 double length = (end - start).norm();
1905 if (m_use_inches)
1906 length = GizmoObjectManipulation::mm_to_in * length;
1907 text += " (" + _u8L("Length") + ": " + format_double(length) + m_units + ")";
1908 }
1909 return text;
1910 };
1911
1912 float selection_cap_length = 0;
1915 selection_cap_length = std::max(ImGui::CalcTextSize(_u8L("Face 1 (Fixed)").c_str()).x, ImGui::CalcTextSize(_u8L("Face 2 (Moving)").c_str()).x) * 1.2;
1917 selection_cap_length = std::max(ImGui::CalcTextSize(_u8L("Point 1 (Fixed)").c_str()).x, ImGui::CalcTextSize(_u8L("Point 2 (Moving)").c_str()).x) * 1.2;
1918 }
1919 }
1920 else {
1921 selection_cap_length = ImGui::CalcTextSize(_u8L("Selection 1").c_str()).x * 1.2;
1922 }
1923 auto feature_first_text = format_item_text(m_selected_features.first);
1924 const float feature_first_text_length = ImGui::CalcTextSize((_u8L(feature_first_text)).c_str()).x;
1925 ImGui::AlignTextToFramePadding();
1929 m_imgui->text(_u8L("Select 2 faces on objects and \n make objects assemble together.")); // tip
1931 m_imgui->text(_u8L("Select 2 points or circles on objects and \n specify distance between them.")); // tip
1932 }
1933 }
1934 ImGui::PushStyleColor(ImGuiCol_Text, ImGuiWrapper::to_ImVec4(SELECTED_1ST_COLOR));
1937 m_imgui->text(_u8L("Face 1 (Fixed)"));
1939 m_imgui->text(_u8L("Point 1 (Fixed)"));
1940 }
1941 }
1942 else {
1943 m_imgui->text(_u8L("Selection 1"));
1944 }
1945 ImGui::SameLine(selection_cap_length + space_size);
1946 ImGui::PushItemWidth(feature_first_text_length);
1947 m_imgui->text(feature_first_text);
1948 if (m_selected_features.first.feature.has_value()) {
1949 ImGui::SameLine(selection_cap_length + feature_first_text_length + space_size * 2);
1950 ImGui::PushItemWidth(space_size * 2);
1951 ImGui::PushID("Reset1"); // for image_button
1952 if (m_imgui->image_button(m_is_dark_mode ? ImGui::RevertBtn : ImGui::RevertBtn, _L("Reset"))) { reset_feature1(); }
1953 ImGui::PopID();
1954 }
1955 ImGui::PopStyleColor();
1956
1957 auto feature_second_text = format_item_text(m_selected_features.second);
1958 const float feature_second_text_length = ImGui::CalcTextSize((_u8L(feature_second_text)).c_str()).x;
1959 ImGui::AlignTextToFramePadding();
1960 ImGui::PushStyleColor(ImGuiCol_Text, ImGuiWrapper::to_ImVec4(SELECTED_2ND_COLOR));
1963 m_imgui->text(_u8L("Face 2 (Moving)"));
1965 m_imgui->text(_u8L("Point 2 (Moving)"));
1966 }
1967 } else {
1968 m_imgui->text(_u8L("Selection 2"));
1969 }
1970 ImGui::SameLine(selection_cap_length + space_size);
1971 ImGui::PushItemWidth(feature_second_text_length);
1972 m_imgui->text(feature_second_text);
1973 if (m_selected_features.first.feature.has_value() && m_selected_features.second.feature.has_value()) {
1974 m_show_reset_first_tip = false;
1975 ImGui::SameLine(selection_cap_length + feature_second_text_length + space_size * 2);
1976 ImGui::PushItemWidth(space_size * 2);
1977 ImGui::PushID("Reset2");
1978 if (m_imgui->image_button(m_is_dark_mode ? ImGui::RevertBtn : ImGui::RevertBtn, _L("Reset"))) { reset_feature2(); }
1979 ImGui::PopID();
1980 }
1981 ImGui::PopStyleColor();
1982 }
1983
1984 /*m_imgui->disabled_begin(!m_selected_features.first.feature.has_value());
1985 if (m_imgui->button(_L("Restart selection"))) {
1986 reset_all_feature();
1987 m_imgui->set_requires_extra_frame();
1988 }
1989 m_imgui->disabled_end();*/
1990
1992 m_imgui->text(_L("Feature 1 has been reset, \nfeature 2 has been feature 1"));
1993 }
1994}
std::string center_on_feature_type_as_string(Measure::SurfaceFeatureType type)
Definition GLGizmoMeasure.cpp:111
std::string surface_feature_type_as_string(Measure::SurfaceFeatureType type)
Definition GLGizmoMeasure.cpp:85
std::string point_on_feature_type_as_string(Measure::SurfaceFeatureType type, int hover_id)
Definition GLGizmoMeasure.cpp:98
static ParamType get_type(const std::string &opt_key, const ConfigOptionDef &opt_def)
Definition EditGCodeDialog.cpp:173

References _L, _u8L, Slic3r::center(), center_on_feature_type_as_string(), Slic3r::Measure::Circle, Slic3r::Measure::Edge, Slic3r::GUI::FACE_FACE, format_double(), Slic3r::Measure::get_orthogonal(), Slic3r::length(), m_assembly_mode, Slic3r::GUI::GLGizmoBase::m_hover_id, Slic3r::GUI::GLGizmoBase::m_imgui, Slic3r::GUI::GLGizmoBase::m_is_dark_mode, m_measure_mode, m_only_select_plane, m_selected_features, m_show_reset_first_tip, m_space_size, m_units, m_use_inches, Slic3r::GUI::GizmoObjectManipulation::mm_to_in, Slic3r::normal(), Slic3r::GUI::ONLY_ASSEMBLY, point_on_feature_type_as_string(), Slic3r::GUI::POINT_POINT, reset_feature1(), reset_feature2(), Slic3r::GUI::SELECTED_1ST_COLOR, Slic3r::GUI::SELECTED_2ND_COLOR, surface_feature_type_as_string(), and Slic3r::GUI::ImGuiWrapper::to_ImVec4().

Referenced by Slic3r::GUI::GLGizmoAssembly::on_render_input_window(), and on_render_input_window().

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

◆ surface_feature_type_as_string()

std::string Slic3r::GUI::GLGizmoMeasure::surface_feature_type_as_string ( Measure::SurfaceFeatureType type)
protectedinherited
86{
87 switch (type)
88 {
89 default:
90 case Measure::SurfaceFeatureType::Undef: { return _u8L("No feature"); }
91 case Measure::SurfaceFeatureType::Point: { return _u8L("Vertex"); }
92 case Measure::SurfaceFeatureType::Edge: { return _u8L("Edge"); }
93 case Measure::SurfaceFeatureType::Circle: { return _u8L("Circle"); }
94 case Measure::SurfaceFeatureType::Plane: { return _u8L("Plane"); }
95 }
96}
@ Undef
Definition Measure.hpp:24

References _u8L, Slic3r::Measure::Circle, Slic3r::Measure::Edge, Slic3r::Measure::Plane, Slic3r::Measure::Point, and Slic3r::Measure::Undef.

Referenced by show_selection_ui().

Here is the caller graph for this function:

◆ switch_to_mode()

void Slic3r::GUI::GLGizmoAssembly::switch_to_mode ( AssemblyMode new_mode)
protected
197{
198 m_assembly_mode = new_mode;
200}

References Slic3r::GUI::GLGizmoMeasure::m_assembly_mode, and Slic3r::GUI::GLGizmoMeasure::reset_all_feature().

Referenced by render_assembly_mode_combo().

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

◆ unregister_grabbers_for_picking()

void Slic3r::GUI::GLGizmoBase::unregister_grabbers_for_picking ( )
protectedinherited
406{
407 for (size_t i = 0; i < m_grabbers.size(); ++i) {
408 m_grabbers[i].unregister_raycasters_for_picking();
409 }
410}

References m_grabbers.

Referenced by unregister_raycasters_for_picking().

Here is the caller graph for this function:

◆ unregister_raycasters_for_picking()

void Slic3r::GUI::GLGizmoBase::unregister_raycasters_for_picking ( )
inlineinherited
virtual void on_unregister_raycasters_for_picking()
Definition GLGizmoBase.hpp:268
void unregister_grabbers_for_picking()
Definition GLGizmoBase.cpp:405

References on_unregister_raycasters_for_picking(), and unregister_grabbers_for_picking().

Referenced by Slic3r::GUI::GLGizmosManager::activate_gizmo(), and Slic3r::GUI::GLCanvas3D::reload_scene().

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

◆ update_feature_by_tran()

void Slic3r::GUI::GLGizmoMeasure::update_feature_by_tran ( Measure::SurfaceFeature & feature)
protectedinherited
2499{
2500 if (!feature.volume) { return; }
2501 auto volume = static_cast<GLVolume *>(feature.volume);
2502 Measure::Measuring *cur_measuring = get_measuring_of_mesh(volume, feature.world_tran);
2503 switch (feature.get_type()) {
2508 feature.clone(*feature.origin_surface_feature);
2509 feature.translate(feature.world_tran);
2510 if (feature.get_type() == Measure::SurfaceFeatureType::Circle) {
2511 m_feature_circle_first.last_circle_feature = nullptr;
2512 m_feature_circle_first.inv_zoom = 0;
2513 m_feature_circle_second.last_circle_feature = nullptr;
2514 m_feature_circle_second.inv_zoom = 0;
2515 }
2516 if (feature.get_type() == Measure::SurfaceFeatureType::Plane) {
2517 if (cur_measuring) {
2518 update_world_plane_features(cur_measuring, feature);
2519 }
2520 }
2521 break;
2522 }
2523 default: {
2524 break;
2525 }
2526 }
2527}
Measure::Measuring * get_measuring_of_mesh(GLVolume *v, Transform3d &tran)
Definition GLGizmoMeasure.cpp:2467

References Slic3r::Measure::Circle, Slic3r::Measure::SurfaceFeature::clone(), Slic3r::Measure::Edge, get_measuring_of_mesh(), Slic3r::Measure::SurfaceFeature::get_type(), m_feature_circle_first, m_feature_circle_second, Slic3r::Measure::SurfaceFeature::origin_surface_feature, Slic3r::Measure::Plane, Slic3r::Measure::Point, Slic3r::Measure::SurfaceFeature::translate(), update_world_plane_features(), Slic3r::Measure::SurfaceFeature::volume, and Slic3r::Measure::SurfaceFeature::world_tran.

Referenced by render_dimensioning(), set_distance(), set_parallel_distance(), set_to_around_center_of_faces(), set_to_parallel(), and set_to_reverse_rotation().

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

◆ update_if_needed()

void Slic3r::GUI::GLGizmoMeasure::update_if_needed ( )
protectedinherited
1168{
1169 //const Selection& selection = m_parent.get_selection();
1170 //if (selection.is_empty())
1171 // return;
1172
1173 //const Selection::IndicesList& idxs = selection.get_volume_idxs();
1174 //std::vector<VolumeCacheItem> volumes_cache;
1175 //volumes_cache.reserve(idxs.size());
1176 //for (unsigned int idx : idxs) {
1177 // const GLVolume* v = selection.get_volume(idx);
1178 // const int volume_idx = v->volume_idx();
1179 // if (volume_idx < 0)
1180 // continue;
1181
1182 // const ModelObject* obj = selection.get_model()->objects[v->object_idx()];
1183 // const ModelInstance* inst = obj->instances[v->instance_idx()];
1184 // const ModelVolume* vol = obj->volumes[volume_idx];
1185 // const VolumeCacheItem item = {
1186 // obj, inst, vol,
1187 // Geometry::translation_transform(selection.get_first_volume()->get_sla_shift_z() * Vec3d::UnitZ()) * inst->get_matrix() * vol->get_matrix()
1188 // };
1189 // volumes_cache.emplace_back(item);
1190 //}
1191
1192 //if (m_state != On || volumes_cache.empty())
1193 // return;
1194
1195 //if (m_volumes_cache != volumes_cache) {
1196 // m_volumes_cache = volumes_cache;
1197 //}
1198}

Referenced by data_changed(), and on_render().

Here is the caller graph for this function:

◆ update_items_state()

bool Slic3r::GUI::GLGizmoBase::update_items_state ( )
inherited
361{
362 bool res = m_dirty;
363 m_dirty = false;
364 return res;
365}

References m_dirty.

◆ update_measurement_result()

void Slic3r::GUI::GLGizmoMeasure::update_measurement_result ( )
protectedinherited
2288{
2289 if (!m_selected_features.first.feature.has_value()) {
2290 m_measurement_result = Measure::MeasurementResult();
2291 m_assembly_action = Measure::AssemblyAction();
2292 }
2293 else if (m_selected_features.second.feature.has_value()) {
2297 //update buffer
2298 const Measure::MeasurementResult &measure = m_measurement_result;
2299 m_distance = Vec3d::Zero();
2300 if (measure.distance_xyz.has_value() && measure.distance_xyz->norm() > EPSILON) {
2301 m_distance = *measure.distance_xyz;
2302 } else if (measure.distance_infinite.has_value()) {
2303 m_distance = measure.distance_infinite->to - measure.distance_infinite->from;
2304 } else if (measure.distance_strict.has_value()) {
2305 m_distance = measure.distance_strict->to - measure.distance_strict->from;
2306 }
2307 if (wxGetApp().app_config->get_bool("use_inches")) m_distance = GizmoObjectManipulation::mm_to_in * m_distance;
2309 if (m_assembly_action.has_parallel_distance) {
2311 }
2312 }
2313 else if (!m_selected_features.second.feature.has_value() && m_selected_features.first.feature->get_type() == Measure::SurfaceFeatureType::Circle)
2314 m_measurement_result = Measure::get_measurement(*m_selected_features.first.feature, Measure::SurfaceFeature(std::get<0>(m_selected_features.first.feature->get_circle())));
2315}
bool can_set_xyz_distance(const SurfaceFeature &a, const SurfaceFeature &b)
Definition Measure.cpp:1322
MeasurementResult get_measurement(const SurfaceFeature &a, const SurfaceFeature &b, bool deal_circle_result)
Definition Measure.cpp:856
AssemblyAction get_assembly_action(const SurfaceFeature &a, const SurfaceFeature &b)
Definition Measure.cpp:1339

References Slic3r::Measure::can_set_xyz_distance(), Slic3r::Measure::Circle, EPSILON, Slic3r::Measure::get_assembly_action(), Slic3r::Measure::get_measurement(), m_assembly_action, m_buffered_distance, m_buffered_parallel_distance, m_can_set_xyz_distance, m_distance, m_measurement_result, m_selected_features, and Slic3r::GUI::GizmoObjectManipulation::mm_to_in.

Referenced by data_changed(), gizmo_event(), on_mouse(), reset_feature1(), and reset_feature2().

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

◆ update_render_colors()

void Slic3r::GUI::GLGizmoBase::update_render_colors ( )
staticinherited

References AXES_COLOR, Slic3r::RenderColor::colors, FLATTEN_COLOR, FLATTEN_HOVER_COLOR, Slic3r::GUI::ImGuiWrapper::from_ImVec4(), RenderCol_Flatten_Plane, RenderCol_Flatten_Plane_Hover, RenderCol_Grabber_X, RenderCol_Grabber_Y, and RenderCol_Grabber_Z.

Referenced by Slic3r::GUI::GLCanvas3D::_render_style_editor().

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

◆ update_world_plane_features()

void Slic3r::GUI::GLGizmoMeasure::update_world_plane_features ( Measure::Measuring * cur_measuring,
Measure::SurfaceFeature & feautre )
protectedinherited
2479{
2480 if (cur_measuring) {
2481 const auto &[idx, normal, pt] = feautre.get_plane();
2482 feautre.plane_indices = const_cast<std::vector<int> *>(&cur_measuring->get_plane_triangle_indices(idx));
2483 auto cur_plane_features = const_cast<std::vector<Measure::SurfaceFeature> *>(&cur_measuring->get_plane_features(idx));
2484 if (cur_plane_features) {
2485 if (!feautre.world_plane_features) {
2486 feautre.world_plane_features = std::make_shared<std::vector<Measure::SurfaceFeature>>();
2487 }
2488 feautre.world_plane_features->clear(); // resize(cur_plane_features->size());
2489 for (size_t i = 0; i < cur_plane_features->size(); i++) {
2490 Measure::SurfaceFeature temp(cur_plane_features->at(i));
2491 temp.translate(feautre.world_tran);
2492 feautre.world_plane_features->push_back(std::move(temp));
2493 }
2494 }
2495 }
2496}

References Slic3r::Measure::SurfaceFeature::get_plane(), Slic3r::Measure::Measuring::get_plane_features(), Slic3r::Measure::Measuring::get_plane_triangle_indices(), Slic3r::normal(), Slic3r::Measure::SurfaceFeature::plane_indices, Slic3r::Measure::SurfaceFeature::translate(), Slic3r::Measure::SurfaceFeature::world_plane_features, and Slic3r::Measure::SurfaceFeature::world_tran.

Referenced by on_render(), and update_feature_by_tran().

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

◆ use_grabbers()

bool Slic3r::GUI::GLGizmoBase::use_grabbers ( const wxMouseEvent & mouse_event)
protectedinherited

function which Set up m_dragging and call functions on_start_dragging / on_dragging / on_stop_dragging

Parameters
mouse_eventKeep information about mouse click
Returns
same as on_mouse
444 {
445 bool is_dragging_finished = false;
446 if (mouse_event.Moving()) {
447 // it should not happen but for sure
448 assert(!m_dragging);
449 if (m_dragging) is_dragging_finished = true;
450 else return false;
451 }
452
453 if (mouse_event.LeftDown()) {
454 Selection &selection = m_parent.get_selection();
455 if (!selection.is_empty() && m_hover_id != -1 /* &&
456 (m_grabbers.empty() || m_hover_id < static_cast<int>(m_grabbers.size()))*/) {
457 selection.setup_cache();
458
459 m_dragging = true;
460 for (auto &grabber : m_grabbers) grabber.dragging = false;
461// if (!m_grabbers.empty() && m_hover_id < int(m_grabbers.size()))
462// m_grabbers[m_hover_id].dragging = true;
463
465
466 // Let the plater know that the dragging started
467 m_parent.post_event(SimpleEvent(EVT_GLCANVAS_MOUSE_DRAGGING_STARTED));
468 m_parent.set_as_dirty();
469 return true;
470 }
471 } else if (m_dragging) {
472 // when mouse cursor leave window than finish actual dragging operation
473 bool is_leaving = mouse_event.Leaving() && !m_parent.has_mouse_capture(); // ORCA keep tracking mouse position while drag active and cursor not in window bounds
474 if (mouse_event.Dragging()) {
475 Point mouse_coord(mouse_event.GetX(), mouse_event.GetY());
476 auto ray = m_parent.mouse_ray(mouse_coord);
477 UpdateData data(ray, mouse_coord);
478
479 on_dragging(data);
480
481 wxGetApp().obj_manipul()->set_dirty();
482 m_parent.set_as_dirty();
483 return true;
484 }
485 else if (mouse_event.LeftUp() || is_leaving || is_dragging_finished) {
486 do_stop_dragging(is_leaving);
487 return true;
488 }
489 }
490 return false;
491}
virtual void on_dragging(const UpdateData &data)
Definition GLGizmoBase.hpp:255
virtual void on_start_dragging()
Definition GLGizmoBase.hpp:253
void do_stop_dragging(bool perform_mouse_cleanup)
Definition GLGizmoBase.cpp:493
Kernel::Point_3 Point
Definition MeshRepair.cpp:81
Definition GLGizmoBase.hpp:133

References do_stop_dragging(), Slic3r::GUI::Selection::is_empty(), m_dragging, m_grabbers, m_hover_id, m_parent, on_dragging(), on_start_dragging(), Slic3r::GUI::Selection::setup_cache(), and Slic3r::GUI::wxMouseEvent.

Referenced by Slic3r::GUI::GLGizmoBrimEars::on_mouse(), Slic3r::GUI::GLGizmoCut3D::on_mouse(), Slic3r::GUI::GLGizmoMove3D::on_mouse(), Slic3r::GUI::GLGizmoRotate3D::on_mouse(), Slic3r::GUI::GLGizmoRotate::on_mouse(), Slic3r::GUI::GLGizmoScale3D::on_mouse(), Slic3r::GUI::GLGizmoEmboss::on_mouse_for_rotation(), and Slic3r::GUI::GLGizmoSVG::on_mouse_for_rotation().

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

◆ wants_enter_leave_snapshots()

bool Slic3r::GUI::GLGizmoAssembly::wants_enter_leave_snapshots ( ) const
inlineoverridevirtual

Apply rotation on select plane.

Parameters
mouse_eventKeep information about mouse click
Returns
Return True when use the information otherwise False.

Reimplemented from Slic3r::GUI::GLGizmoBase.

25{ return true; }

Member Data Documentation

◆ AXES_COLOR

◆ AXES_HOVER_COLOR

std::array< ColorRGBA, 3 > Slic3r::GUI::GLGizmoBase::AXES_HOVER_COLOR
staticinherited
Initial value:
= {{
{ColorRGBA::X().r() * 1.2f, ColorRGBA::X().g() * 1.4f, ColorRGBA::X().b() * 1.4f, 1.0f},
{ColorRGBA::Y().r() * 1.2f, ColorRGBA::Y().g() * 1.2f, ColorRGBA::Y().b() * 1.2f, 1.0f},
{ColorRGBA::Z().r() * 1.2f, ColorRGBA::Z().g() * 1.2f, ColorRGBA::Z().b() * 1.2f, 1.0f},
}}
float b() const
Definition Color.hpp:107
float r() const
Definition Color.hpp:105
float g() const
Definition Color.hpp:106

Referenced by Slic3r::GUI::GLGizmoMove3D::on_render(), Slic3r::GUI::GLGizmoRotate::on_render(), and Slic3r::GUI::GLGizmoScale3D::update_grabbers_data().

◆ BASE_ID

const unsigned int Slic3r::GUI::GLGizmoBase::BASE_ID = 255 * 255 * 254
staticinherited

◆ CONSTRAINED_COLOR

ColorRGBA Slic3r::GUI::GLGizmoBase::CONSTRAINED_COLOR = {0.5f, 0.5f, 0.5f, 1.0f}
staticinherited

◆ count

◆ DEFAULT_BASE_COLOR

ColorRGBA Slic3r::GUI::GLGizmoBase::DEFAULT_BASE_COLOR = { 0.625f, 0.625f, 0.625f, 1.0f }
staticinherited

◆ DEFAULT_DRAG_COLOR

ColorRGBA Slic3r::GUI::GLGizmoBase::DEFAULT_DRAG_COLOR = { 1.0f, 1.0f, 1.0f, 1.0f }
staticinherited

◆ DEFAULT_HIGHLIGHT_COLOR

ColorRGBA Slic3r::GUI::GLGizmoBase::DEFAULT_HIGHLIGHT_COLOR = {1.0f, 0.38f, 0.0f, 1.0f}
staticinherited

◆ FLATTEN_COLOR

ColorRGBA Slic3r::GUI::GLGizmoBase::FLATTEN_COLOR = {0.96f, 0.93f, 0.93f, 0.5f}
staticinherited

◆ FLATTEN_HOVER_COLOR

ColorRGBA Slic3r::GUI::GLGizmoBase::FLATTEN_HOVER_COLOR = {1.0f, 1.0f, 1.0f, 0.75f}
staticinherited

◆ GRABBER_ELEMENTS_MAX_COUNT

const unsigned int Slic3r::GUI::GLGizmoBase::GRABBER_ELEMENTS_MAX_COUNT = 7
staticinherited

◆ GRABBER_HOVER_COL

ColorRGBA Slic3r::GUI::GLGizmoBase::GRABBER_HOVER_COL = {0.863f, 0.125f, 0.063f, 1.0f}
staticinherited

◆ GRABBER_NORMAL_COL

ColorRGBA Slic3r::GUI::GLGizmoBase::GRABBER_NORMAL_COL = {1.0f, 1.0f, 1.0f, 1.0f}
staticinherited

◆ GRABBER_UNIFORM_COL

ColorRGBA Slic3r::GUI::GLGizmoBase::GRABBER_UNIFORM_COL = {0, 1.0, 1.0, 1.0f}
staticinherited

◆ GRABBER_UNIFORM_HOVER_COL

ColorRGBA Slic3r::GUI::GLGizmoBase::GRABBER_UNIFORM_HOVER_COL = {0, 0.7, 0.7, 1.0f}
staticinherited

◆ INV_ZOOM

◆ last_input_window_width

float Slic3r::GUI::GLGizmoBase::last_input_window_width = 0
protectedinherited

◆ m_assembly_action

◆ m_assembly_mode

◆ m_buffered_around_center

double Slic3r::GUI::GLGizmoMeasure::m_buffered_around_center {0}
protectedinherited
217{0};

Referenced by show_face_face_assembly_senior().

◆ m_buffered_distance

Vec3d Slic3r::GUI::GLGizmoMeasure::m_buffered_distance
protectedinherited

◆ m_buffered_parallel_distance

double Slic3r::GUI::GLGizmoMeasure::m_buffered_parallel_distance {0}
protectedinherited

◆ m_c

CommonGizmosDataPool* Slic3r::GUI::GLGizmoBase::m_c { nullptr }
protectedinherited
155{ nullptr };

Referenced by Slic3r::GUI::GLGizmoTextureDisplacement::apply_projection_frame(), Slic3r::GUI::GLGizmoTextureDisplacement::bake(), Slic3r::GUI::GLGizmoTextureDisplacement::capture_view_projection(), Slic3r::GUI::GLGizmoCut3D::check_and_update_connectors_state(), Slic3r::GUI::GLGizmoBrimEars::data_changed(), Slic3r::GUI::GLGizmoCut3D::data_changed(), Slic3r::GUI::GLGizmoMmuSegmentation::data_changed(), Slic3r::GUI::GLGizmoPainterBase::data_changed(), Slic3r::GUI::GLGizmoCut3D::dragging_connector(), Slic3r::GUI::GLGizmoMeshBoolean::generate_new_volume(), Slic3r::GUI::GLGizmoPainterBase::get_clipping_plane_data(), Slic3r::GUI::GLGizmoPainterBase::get_clipping_plane_in_volume_coordinates(), Slic3r::GUI::GLGizmoBrimEars::get_config_options(), Slic3r::GUI::GLGizmoPainterBase::get_projected_height_range(), Slic3r::GUI::GLGizmoPainterBase::get_projected_mouse_positions(), Slic3r::GUI::GLGizmoFdmSupports::get_selection_support_threshold_angle(), Slic3r::GUI::GLGizmoBrimEars::gizmo_event(), Slic3r::GUI::GLGizmoCut3D::gizmo_event(), Slic3r::GUI::GLGizmoMeshBoolean::gizmo_event(), Slic3r::GUI::GLGizmoPainterBase::gizmo_event(), Slic3r::GUI::GLGizmoCut3D::has_valid_contour(), Slic3r::GUI::GLGizmoSimplify::init_model(), Slic3r::GUI::GLGizmoMmuSegmentation::init_model_triangle_selectors(), Slic3r::GUI::GLGizmoFdmSupports::init_print_instance(), Slic3r::GUI::GLGizmoBrimEars::is_mesh_point_clipped(), Slic3r::GUI::GLGizmoPainterBase::is_mesh_point_clipped(), Slic3r::GUI::GLGizmoCut3D::is_outside_of_cut_contour(), Slic3r::GUI::GLGizmoFlatten::is_plane_update_necessary(), Slic3r::GUI::GLGizmoPainterBase::mesh_trafo_matrices(), Slic3r::GUI::GLGizmoFdmSupports::need_regenerate_support_volumes(), Slic3r::GUI::GLGizmoMeshBoolean::on_get_requirements(), Slic3r::GUI::GLGizmoMeshBoolean::on_load(), Slic3r::GUI::GLGizmoTextureDisplacement::on_mouse_adjust_texture(), Slic3r::GUI::GLGizmoCut3D::on_register_raycasters_for_picking(), Slic3r::GUI::GLGizmoBrimEars::on_render(), Slic3r::GUI::GLGizmoMeshBoolean::on_render(), Slic3r::GUI::GLGizmoBrimEars::on_render_input_window(), Slic3r::GUI::GLGizmoCut3D::on_render_input_window(), Slic3r::GUI::GLGizmoFdmSupports::on_render_input_window(), Slic3r::GUI::GLGizmoFuzzySkin::on_render_input_window(), Slic3r::GUI::GLGizmoMmuSegmentation::on_render_input_window(), Slic3r::GUI::GLGizmoSeam::on_render_input_window(), Slic3r::GUI::GLGizmoTextureDisplacement::on_render_input_window(), Slic3r::GUI::GLGizmoCut3D::on_set_state(), Slic3r::GUI::GLGizmoFdmSupports::on_set_state(), Slic3r::GUI::GLGizmoMmuSegmentation::on_set_state(), Slic3r::GUI::GLGizmoSeam::on_set_state(), Slic3r::GUI::GLGizmoTextureDisplacement::preview_part(), Slic3r::GUI::GLGizmoCut3D::process_contours(), Slic3r::GUI::GLGizmoCut3D::process_selection_rectangle(), Slic3r::GUI::GLGizmoCut3D::put_connectors_on_cut_plane(), Slic3r::GUI::GLGizmoTextureDisplacement::queue_prepare(), Slic3r::GUI::GLGizmoBrimEars::reload_cache(), Slic3r::GUI::GLGizmoMmuSegmentation::remap_filament_assignments(), Slic3r::GUI::GLGizmoTextureDisplacement::render_adjust_texture_gizmo(), Slic3r::GUI::GLGizmoCut3D::render_clipper_cut(), Slic3r::GUI::GLGizmoCut3D::render_connectors(), Slic3r::GUI::GLGizmoCut3D::render_debug_input_window(), Slic3r::GUI::GLGizmoPainterBase::render_follows_cursor(), Slic3r::GUI::GLGizmoTextureDisplacement::render_island_overlay(), Slic3r::GUI::GLGizmoTextureDisplacement::render_paint_overlay(), Slic3r::GUI::GLGizmoTextureDisplacement::render_painted_colors(), Slic3r::GUI::GLGizmoFdmSupports::render_painter_gizmo(), Slic3r::GUI::GLGizmoFuzzySkin::render_painter_gizmo(), Slic3r::GUI::GLGizmoMmuSegmentation::render_painter_gizmo(), Slic3r::GUI::GLGizmoSeam::render_painter_gizmo(), Slic3r::GUI::GLGizmoTextureDisplacement::render_painter_gizmo(), Slic3r::GUI::GLGizmoBrimEars::render_points(), Slic3r::GUI::GLGizmoTextureDisplacement::render_preview_mesh(), Slic3r::GUI::GLGizmoTextureDisplacement::render_seam_overlay(), Slic3r::GUI::GLGizmoTextureDisplacement::render_shaded_preview_mesh(), Slic3r::GUI::GLGizmoTextureDisplacement::render_subdivide_preview(), Slic3r::GUI::GLGizmoPainterBase::render_triangles(), Slic3r::GUI::GLGizmoTextureDisplacement::render_uvcheck_mesh(), Slic3r::GUI::GLGizmoTextureDisplacement::render_wireframe_overlay(), Slic3r::GUI::GLGizmoCut3D::reset_connectors(), Slic3r::GUI::GLGizmoFdmSupports::run_thread(), Slic3r::GUI::GLGizmoTextureDisplacement::seam_edge_at(), Slic3r::GUI::GLGizmoTextureDisplacement::seam_vertex_at(), Slic3r::GUI::GLGizmoFdmSupports::select_facets_by_angle(), Slic3r::GUI::GLGizmoTextureDisplacement::select_visible_faces(), Slic3r::GUI::GLGizmoTextureDisplacement::select_whole_model(), Slic3r::GUI::GLGizmoBrimEars::set_brim_data(), set_common_data_pool(), Slic3r::GUI::GLGizmoCut3D::set_connectors_editing(), Slic3r::GUI::GLGizmoTextureDisplacement::shaded_preview_ready(), Slic3r::GUI::GLGizmoTextureDisplacement::smooth_model(), Slic3r::GUI::GLGizmoTextureDisplacement::subdivide_model(), Slic3r::GUI::GLGizmoTextureDisplacement::swap_layer_slots(), Slic3r::GUI::GLGizmoCut3D::switch_to_mode(), Slic3r::GUI::GLGizmoTextureDisplacement::texture_parts(), Slic3r::GUI::GLGizmoTextureDisplacement::texture_volume(), Slic3r::GUI::GLGizmoTextureDisplacement::texture_volume_raycaster_index(), Slic3r::GUI::GLGizmoCut3D::unproject_on_cut_plane(), Slic3r::GUI::GLGizmoBrimEars::unproject_on_mesh(), Slic3r::GUI::GLGizmoBrimEars::unproject_on_mesh2(), Slic3r::GUI::GLGizmoCut3D::update_bb(), Slic3r::GUI::GLGizmoCut3D::update_clipper(), Slic3r::GUI::GLGizmoFdmSupports::update_from_model_object(), Slic3r::GUI::GLGizmoFuzzySkin::update_from_model_object(), Slic3r::GUI::GLGizmoSeam::update_from_model_object(), Slic3r::GUI::GLGizmoTextureDisplacement::update_from_model_object(), Slic3r::GUI::GLGizmoBrimEars::update_model_object(), Slic3r::GUI::GLGizmoFdmSupports::update_model_object(), Slic3r::GUI::GLGizmoFuzzySkin::update_model_object(), Slic3r::GUI::GLGizmoMmuSegmentation::update_model_object(), Slic3r::GUI::GLGizmoSeam::update_model_object(), Slic3r::GUI::GLGizmoTextureDisplacement::update_model_object(), Slic3r::GUI::GLGizmoFlatten::update_planes(), Slic3r::GUI::GLGizmoPainterBase::update_raycast_cache(), and Slic3r::GUI::GLGizmoCut3D::update_raycasters_for_picking_transform().

◆ m_can_set_xyz_distance

bool Slic3r::GUI::GLGizmoMeasure::m_can_set_xyz_distance {false}
protectedinherited
238{false};

Referenced by show_distance_xyz_ui(), and update_measurement_result().

◆ m_curr_circle

CircleGLModel Slic3r::GUI::GLGizmoMeasure::m_curr_circle
protectedinherited

Referenced by init_circle_glmodel(), and on_render().

◆ m_curr_feature

std::optional<Measure::SurfaceFeature> Slic3r::GUI::GLGizmoMeasure::m_curr_feature
protectedinherited

◆ m_curr_measuring

std::shared_ptr<Measure::Measuring> Slic3r::GUI::GLGizmoMeasure::m_curr_measuring {nullptr}
protectedinherited
174{nullptr};

Referenced by on_render().

◆ m_curr_plane

PlaneGLModel Slic3r::GUI::GLGizmoMeasure::m_curr_plane
protectedinherited

Referenced by on_render().

◆ m_curr_point_on_feature_position

std::optional<Vec3d> Slic3r::GUI::GLGizmoMeasure::m_curr_point_on_feature_position
protectedinherited

Referenced by on_mouse(), on_render(), and on_set_state().

◆ m_current_active_imgui_id

unsigned int Slic3r::GUI::GLGizmoMeasure::m_current_active_imgui_id
mutableprotectedinherited

◆ m_cylinder

PickingModel Slic3r::GUI::GLGizmoMeasure::m_cylinder
protectedinherited

Referenced by GLGizmoMeasure(), and on_render().

◆ m_dimensioning

Dimensioning Slic3r::GUI::GLGizmoMeasure::m_dimensioning
protectedinherited

Referenced by render_dimensioning().

◆ m_dirty

bool Slic3r::GUI::GLGizmoBase::m_dirty { false }
privateinherited
293{ false };

Referenced by set_dirty(), and update_items_state().

◆ m_distance

Vec3d Slic3r::GUI::GLGizmoMeasure::m_distance
protectedinherited

◆ m_dragging

◆ m_editing_distance

bool Slic3r::GUI::GLGizmoMeasure::m_editing_distance { false }
protectedinherited

◆ m_feature_circle_first

CircleGLModel Slic3r::GUI::GLGizmoMeasure::m_feature_circle_first
protectedinherited

◆ m_feature_circle_second

CircleGLModel Slic3r::GUI::GLGizmoMeasure::m_feature_circle_second
protectedinherited

◆ m_feature_plane_first

PlaneGLModel Slic3r::GUI::GLGizmoMeasure::m_feature_plane_first
protectedinherited

Referenced by on_render(), and reset_feature1_render().

◆ m_feature_plane_second

PlaneGLModel Slic3r::GUI::GLGizmoMeasure::m_feature_plane_second
protectedinherited

Referenced by on_render(), and reset_feature2_render().

◆ m_first_input_window_render

bool Slic3r::GUI::GLGizmoBase::m_first_input_window_render { true }
protectedinherited
154{ true };

Referenced by render_input_window().

◆ m_flip_volume_2

bool Slic3r::GUI::GLGizmoMeasure::m_flip_volume_2 {false}
protectedinherited
332{false};

Referenced by show_face_face_assembly_senior().

◆ m_grabbers

◆ m_gripper_id_raycast_map

std::map<GripperType, std::shared_ptr<PickRaycaster> > Slic3r::GUI::GLGizmoMeasure::m_gripper_id_raycast_map
protectedinherited

◆ m_group_id

int Slic3r::GUI::GLGizmoBase::m_group_id
protectedinherited

◆ m_hit_different_volumes

◆ m_hit_order_volumes

std::vector<GLVolume*> Slic3r::GUI::GLGizmoMeasure::m_hit_order_volumes
protectedinherited

◆ m_hover_id

int Slic3r::GUI::GLGizmoBase::m_hover_id { -1 }
protectedinherited
150{ -1 };

Referenced by Slic3r::GUI::GLGizmoScale3D::calc_ratio(), Slic3r::GUI::GLGizmoScale3D::do_scale_along_axis(), Slic3r::GUI::GLGizmoScale3D::do_scale_uniform(), Slic3r::GUI::GLGizmoCut3D::dragging_connector(), Slic3r::GUI::GLGizmoCut3D::dragging_grabber_move(), Slic3r::GUI::GLGizmoCut3D::dragging_grabber_rotation(), get_hover_id(), Slic3r::GUI::GLGizmoCut3D::get_tooltip(), Slic3r::GUI::GLGizmoMove3D::get_tooltip(), Slic3r::GUI::GLGizmoRotate::get_tooltip(), Slic3r::GUI::GLGizmoScale3D::get_tooltip(), Slic3r::GUI::GLGizmoBrimEars::gizmo_event(), Slic3r::GUI::GLGizmoCut3D::gizmo_event(), Slic3r::GUI::GLGizmoCut3D::is_selection_changed(), Slic3r::GUI::GLGizmoBrimEars::on_dragging(), Slic3r::GUI::GLGizmoCut3D::on_dragging(), Slic3r::GUI::GLGizmoMove3D::on_dragging(), Slic3r::GUI::GLGizmoRotate3D::on_dragging(), Slic3r::GUI::GLGizmoScale3D::on_dragging(), Slic3r::GUI::GLGizmoCut3D::on_mouse(), Slic3r::GUI::GLGizmoFlatten::on_mouse(), Slic3r::GUI::GLGizmoMeasure::on_mouse(), Slic3r::GUI::GLGizmoFlatten::on_render(), Slic3r::GUI::GLGizmoMeasure::on_render(), Slic3r::GUI::GLGizmoMove3D::on_render(), Slic3r::GUI::GLGizmoRotate3D::on_render(), Slic3r::GUI::GLGizmoRotate::on_render(), Slic3r::GUI::GLGizmoScale3D::on_render(), Slic3r::GUI::GLGizmoBrimEars::on_set_hover_id(), Slic3r::GUI::GLGizmoEmboss::on_set_hover_id(), Slic3r::GUI::GLGizmoRotate3D::on_set_hover_id(), Slic3r::GUI::GLGizmoSVG::on_set_hover_id(), Slic3r::GUI::GLGizmoMeasure::on_set_state(), Slic3r::GUI::GLGizmoBrimEars::on_start_dragging(), Slic3r::GUI::GLGizmoCut3D::on_start_dragging(), Slic3r::GUI::GLGizmoMove3D::on_start_dragging(), Slic3r::GUI::GLGizmoRotate3D::on_start_dragging(), Slic3r::GUI::GLGizmoScale3D::on_start_dragging(), Slic3r::GUI::GLGizmoBrimEars::on_stop_dragging(), Slic3r::GUI::GLGizmoCut3D::on_stop_dragging(), Slic3r::GUI::GLGizmoRotate3D::on_stop_dragging(), Slic3r::GUI::GLGizmoCut3D::render_connectors(), Slic3r::GUI::GLGizmoCut3D::render_cut_plane_grabbers(), Slic3r::GUI::GLGizmoCut3D::render_flip_plane_button(), render_grabbers(), Slic3r::GUI::GLGizmoBrimEars::render_points(), set_hover_id(), Slic3r::GUI::GLGizmoMeasure::show_selection_ui(), Slic3r::GUI::GLGizmoScale3D::update_grabbers_data(), and use_grabbers().

◆ m_icon_filename

std::string Slic3r::GUI::GLGizmoBase::m_icon_filename
protectedinherited

◆ m_imgui

ImGuiWrapper* Slic3r::GUI::GLGizmoBase::m_imgui
protectedinherited

Referenced by GLGizmoBase(), Slic3r::GUI::GLGizmoEmboss::GLGizmoEmboss(), Slic3r::GUI::GLGizmoCut3D::add_horizontal_scaled_interval(), Slic3r::GUI::GLGizmoCut3D::add_vertical_scaled_interval(), Slic3r::GUI::GLGizmoSimplify::create_gui_cfg(), Slic3r::GUI::GLGizmoEmboss::draw_advanced(), Slic3r::GUI::GLGizmoEmboss::draw_bold_button(), Slic3r::GUI::GLGizmoEmboss::draw_delete_style_button(), Slic3r::GUI::GLGizmoSVG::draw_depth(), Slic3r::GUI::GLGizmoSVG::draw_distance(), Slic3r::GUI::GLGizmoSVG::draw_filename(), Slic3r::GUI::GLGizmoEmboss::draw_font_list(), Slic3r::GUI::GLGizmoEmboss::draw_font_list_line(), Slic3r::GUI::GLGizmoEmboss::draw_italic_button(), Slic3r::GUI::GLGizmoSVG::draw_mirroring(), Slic3r::GUI::GLGizmoEmboss::draw_model_type(), Slic3r::GUI::GLGizmoSVG::draw_model_type(), Slic3r::GUI::GLGizmoSVG::draw_rotation(), Slic3r::GUI::GLGizmoSVG::draw_size(), Slic3r::GUI::GLGizmoEmboss::draw_style_add_button(), Slic3r::GUI::GLGizmoEmboss::draw_style_list(), Slic3r::GUI::GLGizmoEmboss::draw_style_rename_button(), Slic3r::GUI::GLGizmoEmboss::draw_style_rename_popup(), Slic3r::GUI::GLGizmoEmboss::draw_style_save_as_popup(), Slic3r::GUI::GLGizmoEmboss::draw_style_save_button(), Slic3r::GUI::GLGizmoEmboss::draw_text_input(), Slic3r::GUI::GLGizmoSVG::draw_use_surface(), Slic3r::GUI::GLGizmoEmboss::draw_window(), GizmoImguiBegin(), GizmoImguiEnd(), GizmoImguiSetNextWIndowPos(), Slic3r::GUI::GLGizmoCut3D::init_input_window_data(), Slic3r::GUI::GLGizmoMeasure::on_mouse(), Slic3r::GUI::GLGizmoAssembly::on_render_input_window(), Slic3r::GUI::GLGizmoBrimEars::on_render_input_window(), Slic3r::GUI::GLGizmoEmboss::on_render_input_window(), Slic3r::GUI::GLGizmoFdmSupports::on_render_input_window(), Slic3r::GUI::GLGizmoFuzzySkin::on_render_input_window(), Slic3r::GUI::GLGizmoMeasure::on_render_input_window(), Slic3r::GUI::GLGizmoMeshBoolean::on_render_input_window(), Slic3r::GUI::GLGizmoMmuSegmentation::on_render_input_window(), Slic3r::GUI::GLGizmoMove3D::on_render_input_window(), Slic3r::GUI::GLGizmoRotate3D::on_render_input_window(), Slic3r::GUI::GLGizmoScale3D::on_render_input_window(), Slic3r::GUI::GLGizmoSeam::on_render_input_window(), Slic3r::GUI::GLGizmoSimplify::on_render_input_window(), Slic3r::GUI::GLGizmoSVG::on_render_input_window(), Slic3r::GUI::GLGizmoTextureDisplacement::on_render_input_window(), Slic3r::GUI::GLGizmoTextureDisplacement::panel_tooltip(), Slic3r::GUI::GLGizmoCut3D::render_angle_input(), Slic3r::GUI::GLGizmoCut3D::render_build_size(), Slic3r::GUI::GLGizmoCut3D::render_color_marker(), render_combo(), Slic3r::GUI::GLGizmoCut3D::render_connectors_input_window(), Slic3r::GUI::GLGizmoCut3D::render_cut_mode_combo(), Slic3r::GUI::GLGizmoCut3D::render_cut_plane_input_window(), Slic3r::GUI::GLGizmoCut3D::render_debug_input_window(), Slic3r::GUI::GLGizmoTextureDisplacement::render_debug_stage_panel(), Slic3r::GUI::GLGizmoMeasure::render_dimensioning(), Slic3r::GUI::GLGizmoCut3D::render_double_input(), Slic3r::GUI::GLGizmoMmuSegmentation::render_filament_remap_ui(), Slic3r::GUI::GLGizmoCut3D::render_flip_plane_button(), Slic3r::GUI::GLGizmoCut3D::render_groove_float_input(), Slic3r::GUI::GLGizmoCut3D::render_groove_int_input(), Slic3r::GUI::GLGizmoCut3D::render_groove_two_float_input(), Slic3r::GUI::GLGizmoTextureDisplacement::render_image_adjust_window(), Slic3r::GUI::GLGizmoAssembly::render_input_window_warning(), Slic3r::GUI::GLGizmoCut3D::render_input_window_warning(), Slic3r::GUI::GLGizmoCut3D::render_move_center_input(), Slic3r::GUI::GLGizmoCut3D::render_reset_button(), Slic3r::GUI::GLGizmoCut3D::render_slider_input(), Slic3r::GUI::GLGizmoCut3D::render_slider_two_input(), Slic3r::GUI::GLGizmoCut3D::render_snap_specific_input(), Slic3r::GUI::GLGizmoTextureDisplacement::render_texture_library_popup(), Slic3r::GUI::GLGizmoTextureDisplacement::render_tip_media(), Slic3r::GUI::GLGizmoCut3D::render_tooltip_button(), Slic3r::GUI::GLGizmoFdmSupports::render_tooltip_button(), Slic3r::GUI::GLGizmoFuzzySkin::render_tooltip_button(), Slic3r::GUI::GLGizmoMmuSegmentation::render_tooltip_button(), Slic3r::GUI::GLGizmoPainterBase::render_triangles(), Slic3r::GUI::GLGizmoEmboss::rev_checkbox(), Slic3r::GUI::GLGizmoEmboss::rev_input(), Slic3r::GUI::GLGizmoEmboss::rev_slider(), Slic3r::GUI::GLGizmoEmboss::rev_slider(), Slic3r::GUI::GLGizmoEmboss::rev_slider(), Slic3r::GUI::GLGizmoEmboss::revertible(), Slic3r::GUI::GLGizmoMeasure::show_distance_xyz_ui(), Slic3r::GUI::GLGizmoMeasure::show_face_face_assembly_common(), Slic3r::GUI::GLGizmoMeasure::show_face_face_assembly_senior(), and Slic3r::GUI::GLGizmoMeasure::show_selection_ui().

◆ m_input_size_max

float Slic3r::GUI::GLGizmoMeasure::m_input_size_max
protectedinherited

◆ m_is_dark_mode

◆ m_is_editing_distance_first_frame

bool Slic3r::GUI::GLGizmoMeasure::m_is_editing_distance_first_frame { true }
protectedinherited
237{ true };

Referenced by data_changed(), on_set_state(), and render_dimensioning().

◆ m_last_active_item_imgui

unsigned int Slic3r::GUI::GLGizmoMeasure::m_last_active_item_imgui {0}
protectedinherited

◆ m_last_circle_feature

std::optional<Measure::SurfaceFeature> Slic3r::GUI::GLGizmoMeasure::m_last_circle_feature
protectedinherited

◆ m_last_hit_volume

GLVolume* Slic3r::GUI::GLGizmoMeasure::m_last_hit_volume
protectedinherited

Referenced by on_render(), and reset_all_feature().

◆ m_last_inv_zoom

float Slic3r::GUI::GLGizmoMeasure::m_last_inv_zoom { 0.0f }
protectedinherited
224{ 0.0f };

Referenced by data_changed(), and on_render().

◆ m_last_plane_idx

int Slic3r::GUI::GLGizmoMeasure::m_last_plane_idx { -1 }
protectedinherited
226{ -1 };

Referenced by data_changed(), and on_render().

◆ m_measure_mode

◆ m_measurement_result

Measure::MeasurementResult Slic3r::GUI::GLGizmoMeasure::m_measurement_result
protectedinherited

◆ m_mesh_measure_map

std::map<GLVolume*, std::shared_ptr<Measure::Measuring> > Slic3r::GUI::GLGizmoMeasure::m_mesh_measure_map
protectedinherited

◆ m_mesh_raycaster_map

std::map<GLVolume*, std::shared_ptr<PickRaycaster> > Slic3r::GUI::GLGizmoMeasure::m_mesh_raycaster_map
protectedinherited

◆ m_mode

◆ m_mouse_left_down

bool Slic3r::GUI::GLGizmoMeasure::m_mouse_left_down { false }
protectedinherited
228{ false }; // for detection left_up of this gizmo

Referenced by on_mouse().

◆ m_mouse_left_down_mesh_deal

bool Slic3r::GUI::GLGizmoMeasure::m_mouse_left_down_mesh_deal {false}
protectedinherited
229{false};//for pick mesh

Referenced by on_mouse(), and on_render().

◆ m_only_select_plane

bool Slic3r::GUI::GLGizmoMeasure::m_only_select_plane {false}
protectedinherited
336{false};

Referenced by on_render(), on_set_state(), and show_selection_ui().

◆ m_parent

GLCanvas3D& Slic3r::GUI::GLGizmoBase::m_parent
protectedinherited

Referenced by GLGizmoBase(), Slic3r::GUI::GLGizmoCut3D::add_connector(), Slic3r::GUI::GLGizmoTextureDisplacement::add_texture_layer(), Slic3r::GUI::GLGizmoCut3D::apply_color_clip_plane_colors(), Slic3r::GUI::GLGizmoTextureDisplacement::apply_projection_frame(), Slic3r::GUI::GLGizmoSimplify::apply_simplify(), Slic3r::GUI::GLGizmoTextureDisplacement::apply_view_mode(), Slic3r::GUI::GLGizmoBrimEars::auto_generate(), Slic3r::GUI::GLGizmoTextureDisplacement::bake(), Slic3r::GUI::GLGizmoCut3D::bounding_box(), Slic3r::GUI::GLGizmoPainterBase::bounding_box(), Slic3r::GUI::GLGizmoEmboss::calculate_scale(), Slic3r::GUI::GLGizmoSVG::calculate_scale(), Slic3r::GUI::GLGizmoTextureDisplacement::capture_view_projection(), Slic3r::GUI::GLGizmoMove3D::change_cs_by_selection(), Slic3r::GUI::GLGizmoScale3D::change_cs_by_selection(), Slic3r::GUI::GLGizmoEmboss::close(), Slic3r::GUI::GLGizmoSimplify::close(), Slic3r::GUI::GLGizmoSVG::close(), Slic3r::GUI::GLGizmoTextureDisplacement::close_image_adjust(), Slic3r::GUI::GLGizmoEmboss::create_volume(), Slic3r::GUI::GLGizmoEmboss::create_volume(), Slic3r::GUI::GLGizmoSVG::create_volume(), Slic3r::GUI::GLGizmoSVG::create_volume(), Slic3r::GUI::GLGizmoSVG::create_volume(), Slic3r::GUI::GLGizmoSVG::create_volume(), Slic3r::GUI::GLGizmoFlatten::data_changed(), Slic3r::GUI::GLGizmoMeasure::data_changed(), Slic3r::GUI::GLGizmoMove3D::data_changed(), Slic3r::GUI::GLGizmoPainterBase::data_changed(), Slic3r::GUI::GLGizmoRotate3D::data_changed(), Slic3r::GUI::GLGizmoScale3D::data_changed(), Slic3r::GUI::GLGizmoCut3D::delete_selected_connectors(), Slic3r::GUI::GLGizmoEmboss::do_mirror(), do_stop_dragging(), Slic3r::GUI::GLGizmoEmboss::draw_advanced(), Slic3r::GUI::GLGizmoSVG::draw_distance(), Slic3r::GUI::GLGizmoSVG::draw_face_the_camera(), Slic3r::GUI::GLGizmoSVG::draw_filename(), Slic3r::GUI::GLGizmoSVG::draw_mirroring(), Slic3r::GUI::GLGizmoEmboss::draw_model_type(), Slic3r::GUI::GLGizmoSVG::draw_model_type(), Slic3r::GUI::GLGizmoSVG::draw_rotation(), Slic3r::GUI::GLGizmoSVG::draw_size(), Slic3r::GUI::GLGizmoEmboss::draw_style_list(), Slic3r::GUI::GLGizmoEmboss::draw_window(), Slic3r::GUI::GLGizmoTextureDisplacement::ease_wheel_scroll(), Slic3r::GUI::GLGizmoBrimEars::find_single(), Slic3r::GUI::GLGizmoBrimEars::first_layer_slicer(), Slic3r::GUI::GLGizmoMeshBoolean::generate_new_volume(), Slic3r::GUI::GLGizmoPainterBase::get_projected_height_range(), Slic3r::GUI::GLGizmoMove3D::get_tooltip(), Slic3r::GUI::GLGizmoScale3D::get_tooltip(), Slic3r::GUI::GLGizmoBrimEars::gizmo_event(), Slic3r::GUI::GLGizmoMeasure::gizmo_event(), Slic3r::GUI::GLGizmoMeshBoolean::gizmo_event(), Slic3r::GUI::GLGizmoPainterBase::gizmo_event(), GizmoImguiSetNextWIndowPos(), Slic3r::GUI::GLGizmoCut3D::has_valid_groove(), Slic3r::GUI::GLGizmoSimplify::init_model(), Slic3r::GUI::GLGizmoMeasure::init_plane_glmodel(), Slic3r::GUI::GLGizmoFdmSupports::init_print_instance(), Slic3r::GUI::GLGizmoPainterBase::mesh_trafo_matrices(), Slic3r::GUI::GLGizmoTextureDisplacement::move_texture_layer(), Slic3r::GUI::GLGizmoMove3D::on_dragging(), Slic3r::GUI::GLGizmoAssembly::on_is_activable(), Slic3r::GUI::GLGizmoBrimEars::on_is_activable(), Slic3r::GUI::GLGizmoCut3D::on_is_activable(), Slic3r::GUI::GLGizmoFlatten::on_is_activable(), Slic3r::GUI::GLGizmoMeasure::on_is_activable(), Slic3r::GUI::GLGizmoMeshBoolean::on_is_activable(), Slic3r::GUI::GLGizmoMmuSegmentation::on_is_activable(), Slic3r::GUI::GLGizmoMove3D::on_is_activable(), Slic3r::GUI::GLGizmoPainterBase::on_is_activable(), Slic3r::GUI::GLGizmoRotate3D::on_is_activable(), Slic3r::GUI::GLGizmoScale3D::on_is_activable(), Slic3r::GUI::GLGizmoSimplify::on_is_activable(), Slic3r::GUI::GLGizmoTextureDisplacement::on_is_activable(), Slic3r::GUI::GLGizmoTextureDisplacement::on_island_edited(), Slic3r::GUI::GLGizmoCut3D::on_load(), Slic3r::GUI::GLGizmoBrimEars::on_mouse(), Slic3r::GUI::GLGizmoCut3D::on_mouse(), Slic3r::GUI::GLGizmoEmboss::on_mouse(), Slic3r::GUI::GLGizmoFlatten::on_mouse(), Slic3r::GUI::GLGizmoMeasure::on_mouse(), Slic3r::GUI::GLGizmoPainterBase::on_mouse(), Slic3r::GUI::GLGizmoRotate3D::on_mouse(), Slic3r::GUI::GLGizmoScale3D::on_mouse(), Slic3r::GUI::GLGizmoSVG::on_mouse(), Slic3r::GUI::GLGizmoTextureDisplacement::on_mouse_adjust_texture(), Slic3r::GUI::GLGizmoEmboss::on_mouse_change_selection(), Slic3r::GUI::GLGizmoEmboss::on_mouse_for_rotation(), Slic3r::GUI::GLGizmoSVG::on_mouse_for_rotation(), Slic3r::GUI::GLGizmoEmboss::on_mouse_for_translate(), Slic3r::GUI::GLGizmoSVG::on_mouse_for_translate(), Slic3r::GUI::GLGizmoTextureDisplacement::on_mouse_seam(), Slic3r::GUI::GLGizmoFdmSupports::on_opening(), Slic3r::GUI::GLGizmoCut3D::on_register_raycasters_for_picking(), Slic3r::GUI::GLGizmoFlatten::on_register_raycasters_for_picking(), Slic3r::GUI::GLGizmoMove3D::on_register_raycasters_for_picking(), Slic3r::GUI::GLGizmoRotate3D::on_register_raycasters_for_picking(), Slic3r::GUI::GLGizmoScale3D::on_register_raycasters_for_picking(), Slic3r::GUI::GLGizmoBrimEars::on_render(), Slic3r::GUI::GLGizmoCut3D::on_render(), Slic3r::GUI::GLGizmoEmboss::on_render(), Slic3r::GUI::GLGizmoFlatten::on_render(), Slic3r::GUI::GLGizmoMeasure::on_render(), Slic3r::GUI::GLGizmoMeshBoolean::on_render(), Slic3r::GUI::GLGizmoMove3D::on_render(), Slic3r::GUI::GLGizmoRotate::on_render(), Slic3r::GUI::GLGizmoSimplify::on_render(), Slic3r::GUI::GLGizmoSVG::on_render(), Slic3r::GUI::GLGizmoAssembly::on_render_input_window(), Slic3r::GUI::GLGizmoBrimEars::on_render_input_window(), Slic3r::GUI::GLGizmoCut3D::on_render_input_window(), Slic3r::GUI::GLGizmoEmboss::on_render_input_window(), Slic3r::GUI::GLGizmoFdmSupports::on_render_input_window(), Slic3r::GUI::GLGizmoFuzzySkin::on_render_input_window(), Slic3r::GUI::GLGizmoMeasure::on_render_input_window(), Slic3r::GUI::GLGizmoMeshBoolean::on_render_input_window(), Slic3r::GUI::GLGizmoMmuSegmentation::on_render_input_window(), Slic3r::GUI::GLGizmoSeam::on_render_input_window(), Slic3r::GUI::GLGizmoSimplify::on_render_input_window(), Slic3r::GUI::GLGizmoSVG::on_render_input_window(), Slic3r::GUI::GLGizmoTextureDisplacement::on_render_input_window(), Slic3r::GUI::GLGizmoCut3D::on_set_state(), Slic3r::GUI::GLGizmoEmboss::on_set_state(), Slic3r::GUI::GLGizmoMeasure::on_set_state(), Slic3r::GUI::GLGizmoMmuSegmentation::on_set_state(), Slic3r::GUI::GLGizmoPainterBase::on_set_state(), Slic3r::GUI::GLGizmoSimplify::on_set_state(), Slic3r::GUI::GLGizmoSVG::on_set_state(), Slic3r::GUI::GLGizmoEmboss::on_shortcut_key(), Slic3r::GUI::GLGizmoFdmSupports::on_shutdown(), Slic3r::GUI::GLGizmoFuzzySkin::on_shutdown(), Slic3r::GUI::GLGizmoMmuSegmentation::on_shutdown(), Slic3r::GUI::GLGizmoSeam::on_shutdown(), Slic3r::GUI::GLGizmoTextureDisplacement::on_shutdown(), Slic3r::GUI::GLGizmoMove3D::on_start_dragging(), Slic3r::GUI::GLGizmoRotate::on_start_dragging(), Slic3r::GUI::GLGizmoEmboss::on_stop_dragging(), Slic3r::GUI::GLGizmoMove3D::on_stop_dragging(), Slic3r::GUI::GLGizmoRotate3D::on_stop_dragging(), Slic3r::GUI::GLGizmoScale3D::on_stop_dragging(), Slic3r::GUI::GLGizmoSVG::on_stop_dragging(), Slic3r::GUI::GLGizmoBrimEars::on_unregister_raycasters_for_picking(), Slic3r::GUI::GLGizmoCut3D::on_unregister_raycasters_for_picking(), Slic3r::GUI::GLGizmoFlatten::on_unregister_raycasters_for_picking(), Slic3r::GUI::GLGizmoMove3D::on_unregister_raycasters_for_picking(), Slic3r::GUI::GLGizmoRotate3D::on_unregister_raycasters_for_picking(), Slic3r::GUI::GLGizmoScale3D::on_unregister_raycasters_for_picking(), Slic3r::GUI::GLGizmoTextureDisplacement::on_uv_command(), Slic3r::GUI::GLGizmoTextureDisplacement::panel_tooltip(), Slic3r::GUI::GLGizmoCut3D::perform_cut(), Slic3r::GUI::GLGizmoEmboss::process(), Slic3r::GUI::GLGizmoSVG::process(), Slic3r::GUI::GLGizmoCut3D::process_contours(), Slic3r::GUI::GLGizmoCut3D::process_cut_line(), Slic3r::GUI::GLGizmoTextureDisplacement::queue_prepare(), Slic3r::GUI::GLGizmoTextureDisplacement::queue_preview_job(), Slic3r::GUI::GLGizmoBrimEars::register_single_mesh_pick(), Slic3r::GUI::GLGizmoMeasure::register_single_mesh_pick(), Slic3r::GUI::GLGizmoEmboss::reinit_text_lines(), Slic3r::GUI::GLGizmoMmuSegmentation::remap_filament_assignments(), Slic3r::GUI::GLGizmoTextureDisplacement::remove_texture_layer(), Slic3r::GUI::GLGizmoTextureDisplacement::render_adjust_texture_gizmo(), Slic3r::GUI::GLGizmoMove3D::render_align_preview(), Slic3r::GUI::GLGizmoAssembly::render_assembly_mode_combo(), render_combo(), Slic3r::GUI::GLGizmoCut3D::render_connectors_input_window(), Slic3r::GUI::GLGizmoPainterBase::render_cursor(), Slic3r::GUI::GLGizmoPainterBase::render_cursor_circle(), Slic3r::GUI::GLGizmoPainterBase::render_cursor_height_range(), Slic3r::GUI::GLGizmoCut3D::render_cut_mode_combo(), Slic3r::GUI::GLGizmoCut3D::render_cut_plane_input_window(), Slic3r::GUI::GLGizmoMeasure::render_dimensioning(), Slic3r::GUI::GLGizmoMeasure::render_follows_cursor(), Slic3r::GUI::GLGizmoPainterBase::render_follows_cursor(), Slic3r::GUI::GLGizmoTextureDisplacement::render_image_adjust_window(), render_input_window(), Slic3r::GUI::GLGizmoTextureDisplacement::render_island_overlay(), Slic3r::GUI::GLGizmoTextureDisplacement::render_paint_overlay(), Slic3r::GUI::GLGizmoTextureDisplacement::render_painted_colors(), Slic3r::GUI::GLGizmoFdmSupports::render_painter_gizmo(), Slic3r::GUI::GLGizmoFuzzySkin::render_painter_gizmo(), Slic3r::GUI::GLGizmoMmuSegmentation::render_painter_gizmo(), Slic3r::GUI::GLGizmoSeam::render_painter_gizmo(), Slic3r::GUI::GLGizmoTextureDisplacement::render_painter_gizmo(), Slic3r::GUI::GLGizmoTextureDisplacement::render_preview_mesh(), Slic3r::GUI::GLGizmoTextureDisplacement::render_seam_overlay(), Slic3r::GUI::GLGizmoTextureDisplacement::render_shaded_preview_mesh(), Slic3r::GUI::GLGizmoTextureDisplacement::render_subdivide_preview(), Slic3r::GUI::GLGizmoTextureDisplacement::render_texture_library_popup(), Slic3r::GUI::GLGizmoTextureDisplacement::render_tip_media(), Slic3r::GUI::GLGizmoCut3D::render_tooltip_button(), Slic3r::GUI::GLGizmoFdmSupports::render_tooltip_button(), Slic3r::GUI::GLGizmoFuzzySkin::render_tooltip_button(), Slic3r::GUI::GLGizmoMmuSegmentation::render_tooltip_button(), Slic3r::GUI::GLGizmoPainterBase::render_triangles(), Slic3r::GUI::GLGizmoTextureDisplacement::render_uvcheck_mesh(), Slic3r::GUI::GLGizmoTextureDisplacement::render_wireframe_overlay(), Slic3r::GUI::GLGizmoSimplify::request_rerender(), Slic3r::GUI::GLGizmoCut3D::reset_cut_plane(), Slic3r::GUI::GLGizmoEmboss::reset_to_default_style(), Slic3r::GUI::GLGizmoTextureDisplacement::run_stage_debug(), Slic3r::GUI::GLGizmoFdmSupports::run_thread(), Slic3r::GUI::GLGizmoTextureDisplacement::run_uv_command(), Slic3r::GUI::GLGizmoTextureDisplacement::seam_edge_at(), Slic3r::GUI::GLGizmoTextureDisplacement::seam_vertex_at(), Slic3r::GUI::GLGizmoFdmSupports::select_facets_by_angle(), Slic3r::GUI::GLGizmoTextureDisplacement::select_visible_faces(), Slic3r::GUI::GLGizmoTextureDisplacement::select_whole_model(), Slic3r::GUI::GLGizmoCut3D::set_connectors_editing(), Slic3r::GUI::GLGizmoMeasure::set_distance(), Slic3r::GUI::GLGizmoTextureDisplacement::set_layer_texture(), Slic3r::GUI::GLGizmoMeasure::set_parallel_distance(), Slic3r::GUI::GLGizmoMeasure::set_to_around_center_of_faces(), Slic3r::GUI::GLGizmoMeasure::set_to_parallel(), Slic3r::GUI::GLGizmoMeasure::set_to_reverse_rotation(), Slic3r::GUI::GLGizmoEmboss::set_volume_by_selection(), Slic3r::GUI::GLGizmoSVG::set_volume_by_selection(), Slic3r::GUI::GLGizmoCut3D::set_volumes_picking_state(), Slic3r::GUI::GLGizmoTextureDisplacement::show_debug_stage(), Slic3r::GUI::GLGizmoTextureDisplacement::show_projector(), Slic3r::GUI::GLGizmoTextureDisplacement::smooth_model(), Slic3r::GUI::GLGizmoTextureDisplacement::subdivide_model(), Slic3r::GUI::GLGizmoCut3D::toggle_model_objects_visibility(), Slic3r::GUI::GLGizmoCut3D::transformed_bounding_box(), Slic3r::GUI::GLGizmoBrimEars::unproject_on_mesh(), Slic3r::GUI::GLGizmoCut3D::update_bb(), Slic3r::GUI::GLGizmoBrimEars::update_cache_radius(), Slic3r::GUI::GLGizmoCut3D::update_clipper(), Slic3r::GUI::GLGizmoPainterBase::update_contours(), Slic3r::GUI::GLGizmoScale3D::update_grabbers_data(), Slic3r::GUI::GLGizmoTextureDisplacement::update_image_adjust_preview(), Slic3r::GUI::GLGizmoBrimEars::update_model_object(), Slic3r::GUI::GLGizmoFdmSupports::update_model_object(), Slic3r::GUI::GLGizmoFuzzySkin::update_model_object(), Slic3r::GUI::GLGizmoMmuSegmentation::update_model_object(), Slic3r::GUI::GLGizmoSeam::update_model_object(), Slic3r::GUI::GLGizmoTextureDisplacement::update_model_object(), Slic3r::GUI::GLGizmoPainterBase::update_raycast_cache(), Slic3r::GUI::GLGizmoBrimEars::update_raycasters(), use_grabbers(), Slic3r::GUI::GLGizmoEmboss::volume_transformation_changed(), Slic3r::GUI::GLGizmoSVG::volume_transformation_changed(), and Slic3r::GUI::GLGizmoEmboss::volume_transformation_changing().

◆ m_pending_scale

int Slic3r::GUI::GLGizmoMeasure::m_pending_scale { 0 }
protectedinherited

◆ m_rendered_this_frame

bool Slic3r::GUI::GLGizmoMeasure::m_rendered_this_frame { false }
protectedinherited
247{ false };

Referenced by on_render(), and render_dimensioning_if_scene_reused().

◆ m_same_model_object

◆ m_selected_features

◆ m_selected_wrong_feature_waring_tip

bool Slic3r::GUI::GLGizmoMeasure::m_selected_wrong_feature_waring_tip {false}
protectedinherited

◆ m_set_center_coincidence

bool Slic3r::GUI::GLGizmoMeasure::m_set_center_coincidence {false}
protectedinherited
235{false};

Referenced by set_to_center_coincidence().

◆ m_shift_kar_filter

KeyAutoRepeatFilter Slic3r::GUI::GLGizmoMeasure::m_shift_kar_filter
protectedinherited

Referenced by gizmo_event(), and on_set_state().

◆ m_shortcut

◆ m_shortcuts

std::vector<std::pair<wxString, wxString> > Slic3r::GUI::GLGizmoMeasure::m_shortcuts
protectedinherited

◆ m_show_reset_first_tip

bool Slic3r::GUI::GLGizmoMeasure::m_show_reset_first_tip {false}
protectedinherited

◆ m_space_size

◆ m_sphere

PickingModel Slic3r::GUI::GLGizmoMeasure::m_sphere
protectedinherited

Referenced by GLGizmoMeasure(), on_mouse(), and on_render().

◆ m_sprite_id

unsigned int Slic3r::GUI::GLGizmoBase::m_sprite_id
protectedinherited

Referenced by GLGizmoBase(), and get_sprite_id().

◆ m_state

◆ m_units

std::string Slic3r::GUI::GLGizmoMeasure::m_units
protectedinherited

◆ m_use_inches

bool Slic3r::GUI::GLGizmoMeasure::m_use_inches
protectedinherited

The documentation for this class was generated from the following files: