mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-11-02 20:51:23 -07:00 
			
		
		
		
	ENABLE_SHOW_SCENE_LABELS set as default
This commit is contained in:
		
							parent
							
								
									c4c2cf4ead
								
							
						
					
					
						commit
						4a59a45d51
					
				
					 10 changed files with 0 additions and 45 deletions
				
			
		| 
						 | 
				
			
			@ -1101,11 +1101,7 @@ static inline std::vector<const PrintInstance*> sort_object_instances_by_max_z(c
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
// Produce a vector of PrintObjects in the order of their respective ModelObjects in print.model().
 | 
			
		||||
#if ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
std::vector<const PrintInstance*> sort_object_instances_by_model_order(const Print& print)
 | 
			
		||||
#else
 | 
			
		||||
static inline std::vector<const PrintInstance*> sort_object_instances_by_model_order(const Print& print)
 | 
			
		||||
#endif // ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
{
 | 
			
		||||
    // Build up map from ModelInstance* to PrintInstance*
 | 
			
		||||
    std::vector<std::pair<const ModelInstance*, const PrintInstance*>> model_instance_to_print_instance;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -418,9 +418,7 @@ private:
 | 
			
		|||
    friend class WipeTowerIntegration;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#if ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
std::vector<const PrintInstance*> sort_object_instances_by_model_order(const Print& print);
 | 
			
		||||
#endif // ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -47,7 +47,5 @@
 | 
			
		|||
//==================
 | 
			
		||||
#define ENABLE_2_2_0_BETA1 1
 | 
			
		||||
 | 
			
		||||
// Enable showing object/instance info with labels into the 3D scene
 | 
			
		||||
#define ENABLE_SHOW_SCENE_LABELS (1 && ENABLE_2_2_0_BETA1)
 | 
			
		||||
 | 
			
		||||
#endif // _technologies_h_
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,9 +6,6 @@
 | 
			
		|||
#include "polypartition.h"
 | 
			
		||||
#include "libslic3r/ClipperUtils.hpp"
 | 
			
		||||
#include "libslic3r/PrintConfig.hpp"
 | 
			
		||||
#if ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
#include "libslic3r/GCode.hpp"
 | 
			
		||||
#endif // ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
#include "libslic3r/GCode/PreviewData.hpp"
 | 
			
		||||
#if ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
#include "libslic3r/GCode/ThumbnailData.hpp"
 | 
			
		||||
| 
						 | 
				
			
			@ -68,9 +65,7 @@
 | 
			
		|||
#include <chrono>
 | 
			
		||||
#endif // ENABLE_RENDER_STATISTICS
 | 
			
		||||
 | 
			
		||||
#if ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
#include <imgui/imgui_internal.h>
 | 
			
		||||
#endif // ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
 | 
			
		||||
static const float TRACKBALLSIZE = 0.8f;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1237,7 +1232,6 @@ void GLCanvas3D::LegendTexture::render(const GLCanvas3D& canvas) const
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#if ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
void GLCanvas3D::Labels::render(const std::vector<const ModelInstance*>& sorted_instances) const
 | 
			
		||||
{
 | 
			
		||||
    if (!m_enabled || !is_shown())
 | 
			
		||||
| 
						 | 
				
			
			@ -1370,7 +1364,6 @@ void GLCanvas3D::Labels::render(const std::vector<const ModelInstance*>& sorted_
 | 
			
		|||
        ImGui::PopStyleVar(2);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
#endif // ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
 | 
			
		||||
wxDEFINE_EVENT(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS, SimpleEvent);
 | 
			
		||||
wxDEFINE_EVENT(EVT_GLCANVAS_OBJECT_SELECT, SimpleEvent);
 | 
			
		||||
| 
						 | 
				
			
			@ -1441,9 +1434,7 @@ GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas, Bed3D& bed, Camera& camera, GLToolbar
 | 
			
		|||
    , m_show_picking_texture(false)
 | 
			
		||||
#endif // ENABLE_RENDER_PICKING_PASS
 | 
			
		||||
    , m_render_sla_auxiliaries(true)
 | 
			
		||||
#if ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
    , m_labels(*this)
 | 
			
		||||
#endif // ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
{
 | 
			
		||||
    if (m_canvas != nullptr) {
 | 
			
		||||
        m_timer.SetOwner(m_canvas);
 | 
			
		||||
| 
						 | 
				
			
			@ -2808,10 +2799,8 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
 | 
			
		|||
        case 'a': { post_event(SimpleEvent(EVT_GLCANVAS_ARRANGE)); break; }
 | 
			
		||||
        case 'B':
 | 
			
		||||
        case 'b': { zoom_to_bed(); break; }
 | 
			
		||||
#if ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
        case 'E':
 | 
			
		||||
        case 'e': { m_labels.show(!m_labels.is_shown()); m_dirty = true; break; }
 | 
			
		||||
#endif // ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
        case 'I':
 | 
			
		||||
        case 'i': { _update_camera_zoom(1.0); break; }
 | 
			
		||||
        case 'K':
 | 
			
		||||
| 
						 | 
				
			
			@ -5045,7 +5034,6 @@ void GLCanvas3D::_render_overlays() const
 | 
			
		|||
    if ((m_layers_editing.last_object_id >= 0) && (m_layers_editing.object_max_z() > 0.0f))
 | 
			
		||||
        m_layers_editing.render_overlay(*this);
 | 
			
		||||
 | 
			
		||||
#if ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
    const ConfigOptionBool* opt = dynamic_cast<const ConfigOptionBool*>(m_config->option("complete_objects"));
 | 
			
		||||
    bool sequential_print = opt != nullptr && opt->value;
 | 
			
		||||
    std::vector<const ModelInstance*> sorted_instances;
 | 
			
		||||
| 
						 | 
				
			
			@ -5056,7 +5044,6 @@ void GLCanvas3D::_render_overlays() const
 | 
			
		|||
            }
 | 
			
		||||
    }
 | 
			
		||||
    m_labels.render(sorted_instances);
 | 
			
		||||
#endif // ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
 | 
			
		||||
    glsafe(::glPopMatrix());
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -375,7 +375,6 @@ private:
 | 
			
		|||
    };
 | 
			
		||||
#endif // ENABLE_RENDER_STATISTICS
 | 
			
		||||
 | 
			
		||||
#if ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
    class Labels
 | 
			
		||||
    {
 | 
			
		||||
        bool m_enabled{ false };
 | 
			
		||||
| 
						 | 
				
			
			@ -389,7 +388,6 @@ private:
 | 
			
		|||
        bool is_shown() const { return m_shown; }
 | 
			
		||||
        void render(const std::vector<const ModelInstance*>& sorted_instances) const;
 | 
			
		||||
    };
 | 
			
		||||
#endif // ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
    enum ECursorType : unsigned char
 | 
			
		||||
| 
						 | 
				
			
			@ -468,9 +466,7 @@ private:
 | 
			
		|||
    mutable int m_imgui_undo_redo_hovered_pos{ -1 };
 | 
			
		||||
    int m_selected_extruder;
 | 
			
		||||
 | 
			
		||||
#if ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
    Labels m_labels;
 | 
			
		||||
#endif // ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
    GLCanvas3D(wxGLCanvas* canvas, Bed3D& bed, Camera& camera, GLToolbar& view_toolbar);
 | 
			
		||||
| 
						 | 
				
			
			@ -487,9 +483,7 @@ public:
 | 
			
		|||
    void set_as_dirty();
 | 
			
		||||
 | 
			
		||||
    unsigned int get_volumes_count() const;
 | 
			
		||||
#if ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
    const GLVolumeCollection& get_volumes() const { return m_volumes; }
 | 
			
		||||
#endif // ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
    void reset_volumes();
 | 
			
		||||
    int check_volumes_outside_state() const;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -501,9 +495,7 @@ public:
 | 
			
		|||
    void set_config(const DynamicPrintConfig* config);
 | 
			
		||||
    void set_process(BackgroundSlicingProcess* process);
 | 
			
		||||
    void set_model(Model* model);
 | 
			
		||||
#if ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
    const Model* get_model() const { return m_model; }
 | 
			
		||||
#endif // ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
 | 
			
		||||
    const Selection& get_selection() const { return m_selection; }
 | 
			
		||||
    Selection& get_selection() { return m_selection; }
 | 
			
		||||
| 
						 | 
				
			
			@ -551,9 +543,7 @@ public:
 | 
			
		|||
    void enable_main_toolbar(bool enable);
 | 
			
		||||
    void enable_undoredo_toolbar(bool enable);
 | 
			
		||||
    void enable_dynamic_background(bool enable);
 | 
			
		||||
#if ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
    void enable_labels(bool enable) { m_labels.enable(enable); }
 | 
			
		||||
#endif // ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
    void allow_multisample(bool allow);
 | 
			
		||||
 | 
			
		||||
    void zoom_to_bed();
 | 
			
		||||
| 
						 | 
				
			
			@ -675,10 +665,8 @@ public:
 | 
			
		|||
 | 
			
		||||
    void mouse_up_cleanup();
 | 
			
		||||
 | 
			
		||||
#if ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
    bool are_labels_shown() const { return m_labels.is_shown(); }
 | 
			
		||||
    void show_labels(bool show) { m_labels.show(show); }
 | 
			
		||||
#endif // ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    bool _is_shown_on_screen() const;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -65,9 +65,7 @@ bool View3D::init(wxWindow* parent, Bed3D& bed, Camera& camera, GLToolbar& view_
 | 
			
		|||
    m_canvas->enable_selection(true);
 | 
			
		||||
    m_canvas->enable_main_toolbar(true);
 | 
			
		||||
    m_canvas->enable_undoredo_toolbar(true);
 | 
			
		||||
#if ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
    m_canvas->enable_labels(true);
 | 
			
		||||
#endif // ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
 | 
			
		||||
    wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL);
 | 
			
		||||
    main_sizer->Add(m_canvas_widget, 1, wxALL | wxEXPAND, 0);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -157,9 +157,7 @@ void KBShortcutsDialog::fill_shortcuts()
 | 
			
		|||
    plater_shortcuts.push_back(Shortcut("Z",        L("Zoom to selected object")));
 | 
			
		||||
    plater_shortcuts.push_back(Shortcut("I",        L("Zoom in")));
 | 
			
		||||
    plater_shortcuts.push_back(Shortcut("O",        L("Zoom out")));
 | 
			
		||||
#if ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
    plater_shortcuts.push_back(Shortcut("E",        L("Show/Hide object/instance labels")));
 | 
			
		||||
#endif // ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
    plater_shortcuts.push_back(Shortcut(ctrl+"M",   L("Show/Hide 3Dconnexion devices settings dialog")));
 | 
			
		||||
    plater_shortcuts.push_back(Shortcut("ESC",      L("Unselect gizmo / Clear selection")));
 | 
			
		||||
#if ENABLE_RENDER_PICKING_PASS
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -672,12 +672,10 @@ void MainFrame::init_menubar()
 | 
			
		|||
            "", nullptr, [this](){return can_change_view(); }, this);
 | 
			
		||||
        append_menu_item(viewMenu, wxID_ANY, _(L("Right")) + sep + "&6", _(L("Right View")), [this](wxCommandEvent&) { select_view("right"); },
 | 
			
		||||
            "", nullptr, [this](){return can_change_view(); }, this);
 | 
			
		||||
#if ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
        viewMenu->AppendSeparator();
 | 
			
		||||
        append_menu_check_item(viewMenu, wxID_ANY, _(L("Show &labels")) + sep + "E", _(L("Show object/instance labels in 3D scene")),
 | 
			
		||||
            [this](wxCommandEvent&) { m_plater->show_view3D_labels(!m_plater->are_view3D_labels_shown()); }, this,
 | 
			
		||||
            [this]() { return m_plater->is_view3D_shown(); }, [this]() { return m_plater->are_view3D_labels_shown(); }, this);
 | 
			
		||||
#endif // ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Help menu
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1782,10 +1782,8 @@ struct Plater::priv
 | 
			
		|||
    bool is_preview_loaded() const { return preview->is_loaded(); }
 | 
			
		||||
    bool is_view3D_shown() const { return current_panel == view3D; }
 | 
			
		||||
 | 
			
		||||
#if ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
    bool are_view3D_labels_shown() const { return (current_panel == view3D) && view3D->get_canvas3d()->are_labels_shown(); }
 | 
			
		||||
    void show_view3D_labels(bool show) { if (current_panel == view3D) view3D->get_canvas3d()->show_labels(show); }
 | 
			
		||||
#endif // ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
 | 
			
		||||
    void set_current_canvas_as_dirty();
 | 
			
		||||
    GLCanvas3D* get_current_canvas3D();
 | 
			
		||||
| 
						 | 
				
			
			@ -4636,10 +4634,8 @@ bool Plater::is_preview_shown() const { return p->is_preview_shown(); }
 | 
			
		|||
bool Plater::is_preview_loaded() const { return p->is_preview_loaded(); }
 | 
			
		||||
bool Plater::is_view3D_shown() const { return p->is_view3D_shown(); }
 | 
			
		||||
 | 
			
		||||
#if ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
bool Plater::are_view3D_labels_shown() const { return p->are_view3D_labels_shown(); }
 | 
			
		||||
void Plater::show_view3D_labels(bool show) { p->show_view3D_labels(show); }
 | 
			
		||||
#endif // ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
 | 
			
		||||
void Plater::select_all() { p->select_all(); }
 | 
			
		||||
void Plater::deselect_all() { p->deselect_all(); }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -170,10 +170,8 @@ public:
 | 
			
		|||
    bool is_preview_loaded() const;
 | 
			
		||||
    bool is_view3D_shown() const;
 | 
			
		||||
 | 
			
		||||
#if ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
    bool are_view3D_labels_shown() const;
 | 
			
		||||
    void show_view3D_labels(bool show);
 | 
			
		||||
#endif // ENABLE_SHOW_SCENE_LABELS
 | 
			
		||||
 | 
			
		||||
    // Called after the Preferences dialog is closed and the program settings are saved.
 | 
			
		||||
    // Update the UI based on the current preferences.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue