mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	Tech ENABLE_GCODE_WINDOW set as default
This commit is contained in:
		
							parent
							
								
									5faac3c105
								
							
						
					
					
						commit
						7817105abe
					
				
					 12 changed files with 0 additions and 67 deletions
				
			
		|  | @ -782,16 +782,11 @@ void GCode::do_export(Print* print, const char* path, GCodeProcessor::Result* re | |||
|     m_processor.process_file(path_tmp, true, [print]() { print->throw_if_canceled(); }); | ||||
| //    DoExport::update_print_estimated_times_stats(m_processor, print->m_print_statistics);
 | ||||
|     DoExport::update_print_estimated_stats(m_processor, m_writer.extruders(), print->m_print_statistics); | ||||
| #if ENABLE_GCODE_WINDOW | ||||
|     if (result != nullptr) { | ||||
|         *result = std::move(m_processor.extract_result()); | ||||
|         // set the filename to the correct value
 | ||||
|         result->filename = path; | ||||
|     } | ||||
| #else | ||||
|     if (result != nullptr) | ||||
|         *result = std::move(m_processor.extract_result()); | ||||
| #endif // ENABLE_GCODE_WINDOW
 | ||||
|     BOOST_LOG_TRIVIAL(debug) << "Finished processing gcode, " << log_memory_info(); | ||||
| 
 | ||||
|     if (rename_file(path_tmp, path)) | ||||
|  |  | |||
|  | @ -9,9 +9,7 @@ | |||
| #include <boost/algorithm/string/split.hpp> | ||||
| #include <boost/nowide/fstream.hpp> | ||||
| #include <boost/nowide/cstdio.hpp> | ||||
| #if ENABLE_GCODE_WINDOW | ||||
| #include <boost/filesystem/path.hpp> | ||||
| #endif // ENABLE_GCODE_WINDOW
 | ||||
| 
 | ||||
| #include <float.h> | ||||
| #include <assert.h> | ||||
|  | @ -1223,9 +1221,7 @@ void GCodeProcessor::process_file(const std::string& filename, bool apply_postpr | |||
|     } | ||||
| 
 | ||||
|     // process gcode
 | ||||
| #if ENABLE_GCODE_WINDOW | ||||
|     m_result.filename = filename; | ||||
| #endif // ENABLE_GCODE_WINDOW
 | ||||
|     m_result.id = ++s_result_id; | ||||
|     // 1st move must be a dummy move
 | ||||
|     m_result.moves.emplace_back(MoveVertex()); | ||||
|  |  | |||
|  | @ -350,9 +350,7 @@ namespace Slic3r { | |||
|                     printer = ""; | ||||
|                 } | ||||
|             }; | ||||
| #if ENABLE_GCODE_WINDOW | ||||
|             std::string filename; | ||||
| #endif // ENABLE_GCODE_WINDOW
 | ||||
|             unsigned int id; | ||||
|             std::vector<MoveVertex> moves; | ||||
|             Pointfs bed_shape; | ||||
|  |  | |||
|  | @ -41,8 +41,6 @@ | |||
| //====================
 | ||||
| #define ENABLE_2_4_0_ALPHA0 1 | ||||
| 
 | ||||
| // Enable showing a imgui window containing gcode in preview
 | ||||
| #define ENABLE_GCODE_WINDOW (1 && ENABLE_2_4_0_ALPHA0) | ||||
| // Enable exporting lines M73 for remaining time to next printer stop to gcode
 | ||||
| #define ENABLE_EXTENDED_M73_LINES (1 && ENABLE_2_4_0_ALPHA0) | ||||
| // Enable a modified version of automatic downscale on load of objects too big
 | ||||
|  |  | |||
|  | @ -155,19 +155,15 @@ void BackgroundSlicingProcess::process_fff() | |||
| 	    if (! m_export_path.empty()) { | ||||
| 			wxQueueEvent(GUI::wxGetApp().mainframe->m_plater, new wxCommandEvent(m_event_export_began_id)); | ||||
| 			 | ||||
| #if ENABLE_GCODE_WINDOW | ||||
| 			// let the gcode window to unmap the temporary .gcode file (m_temp_output_path)
 | ||||
| 			// because the scripts may want to modify it
 | ||||
| 			GUI::wxGetApp().plater()->stop_mapping_gcode_window(); | ||||
| #endif // ENABLE_GCODE_WINDOW
 | ||||
| 
 | ||||
| 			m_print->set_status(95, _utf8(L("Running post-processing scripts"))); | ||||
| 			run_post_process_scripts(m_temp_output_path, m_fff_print->full_print_config()); | ||||
| 
 | ||||
| #if ENABLE_GCODE_WINDOW | ||||
| 			// let the gcode window to reload and remap the temporary .gcode file (m_temp_output_path)
 | ||||
| 			GUI::wxGetApp().plater()->start_mapping_gcode_window(); | ||||
| #endif // ENABLE_GCODE_WINDOW
 | ||||
| 
 | ||||
| 			//FIXME localize the messages
 | ||||
| 			// Perform the final post-processing of the export path by applying the print statistics over the file name.
 | ||||
|  |  | |||
|  | @ -23,9 +23,7 @@ | |||
| 
 | ||||
| #include <GL/glew.h> | ||||
| #include <boost/log/trivial.hpp> | ||||
| #if ENABLE_GCODE_WINDOW | ||||
| #include <boost/algorithm/string/split.hpp> | ||||
| #endif // ENABLE_GCODE_WINDOW
 | ||||
| #include <boost/nowide/cstdio.hpp> | ||||
| #include <boost/nowide/fstream.hpp> | ||||
| #include <wx/progdlg.h> | ||||
|  | @ -269,7 +267,6 @@ void GCodeViewer::SequentialView::Marker::render() const | |||
|     ImGui::PopStyleVar(); | ||||
| } | ||||
| 
 | ||||
| #if ENABLE_GCODE_WINDOW | ||||
| void GCodeViewer::SequentialView::GCodeWindow::load_gcode() | ||||
| { | ||||
|     if (m_filename.empty()) | ||||
|  | @ -487,7 +484,6 @@ void GCodeViewer::SequentialView::render(float legend_height) const | |||
|         bottom -= wxGetApp().plater()->get_view_toolbar().get_height(); | ||||
|     gcode_window.render(legend_height, bottom, static_cast<uint64_t>(gcode_ids[current.last])); | ||||
| } | ||||
| #endif // ENABLE_GCODE_WINDOW
 | ||||
| 
 | ||||
| const std::vector<GCodeViewer::Color> GCodeViewer::Extrusion_Role_Colors {{ | ||||
|     { 0.75f, 0.75f, 0.75f },   // erNone
 | ||||
|  | @ -599,10 +595,8 @@ void GCodeViewer::load(const GCodeProcessor::Result& gcode_result, const Print& | |||
|     // release gpu memory, if used
 | ||||
|     reset();  | ||||
| 
 | ||||
| #if ENABLE_GCODE_WINDOW | ||||
|     m_sequential_view.gcode_window.set_filename(gcode_result.filename); | ||||
|     m_sequential_view.gcode_window.load_gcode(); | ||||
| #endif // ENABLE_GCODE_WINDOW
 | ||||
| 
 | ||||
|     load_toolpaths(gcode_result); | ||||
| 
 | ||||
|  | @ -761,9 +755,7 @@ void GCodeViewer::reset() | |||
|     m_layers_z_range = { 0, 0 }; | ||||
|     m_roles = std::vector<ExtrusionRole>(); | ||||
|     m_print_statistics.reset(); | ||||
| #if ENABLE_GCODE_WINDOW | ||||
|     m_sequential_view.gcode_window.reset(); | ||||
| #endif // ENABLE_GCODE_WINDOW
 | ||||
| #if ENABLE_GCODE_VIEWER_STATISTICS | ||||
|     m_statistics.reset_all(); | ||||
| #endif // ENABLE_GCODE_VIEWER_STATISTICS
 | ||||
|  | @ -832,20 +824,12 @@ void GCodeViewer::render() const | |||
|     glsafe(::glEnable(GL_DEPTH_TEST)); | ||||
|     render_toolpaths(); | ||||
|     render_shells(); | ||||
| #if ENABLE_GCODE_WINDOW | ||||
|     float legend_height = 0.0f; | ||||
|     render_legend(legend_height); | ||||
| #else | ||||
|     render_legend(); | ||||
| #endif // ENABLE_GCODE_WINDOW
 | ||||
|     SequentialView* sequential_view = const_cast<SequentialView*>(&m_sequential_view); | ||||
|     if (sequential_view->current.last != sequential_view->endpoints.last) { | ||||
|         sequential_view->marker.set_world_position(sequential_view->current_position); | ||||
| #if ENABLE_GCODE_WINDOW | ||||
|         sequential_view->render(legend_height); | ||||
| #else | ||||
|         sequential_view->marker.render(); | ||||
| #endif // ENABLE_GCODE_WINDOW
 | ||||
|     } | ||||
| #if ENABLE_GCODE_VIEWER_STATISTICS | ||||
|     render_statistics(); | ||||
|  | @ -1122,7 +1106,6 @@ void GCodeViewer::export_toolpaths_to_obj(const char* filename) const | |||
|     fclose(fp); | ||||
| } | ||||
| 
 | ||||
| #if ENABLE_GCODE_WINDOW | ||||
| void GCodeViewer::start_mapping_gcode_window() | ||||
| { | ||||
|     m_sequential_view.gcode_window.load_gcode(); | ||||
|  | @ -1132,7 +1115,6 @@ void GCodeViewer::stop_mapping_gcode_window() | |||
| { | ||||
|     m_sequential_view.gcode_window.stop_mapping_file(); | ||||
| } | ||||
| #endif // ENABLE_GCODE_WINDOW
 | ||||
| 
 | ||||
| void GCodeViewer::load_toolpaths(const GCodeProcessor::Result& gcode_result) | ||||
| { | ||||
|  | @ -2592,11 +2574,7 @@ void GCodeViewer::render_shells() const | |||
| //    glsafe(::glDepthMask(GL_TRUE));
 | ||||
| } | ||||
| 
 | ||||
| #if ENABLE_GCODE_WINDOW | ||||
| void GCodeViewer::render_legend(float& legend_height) const | ||||
| #else | ||||
| void GCodeViewer::render_legend() const | ||||
| #endif // ENABLE_GCODE_WINDOW
 | ||||
| { | ||||
|     if (!m_legend_enabled) | ||||
|         return; | ||||
|  | @ -3474,9 +3452,7 @@ void GCodeViewer::render_legend() const | |||
|         } | ||||
|     } | ||||
| 
 | ||||
| #if ENABLE_GCODE_WINDOW | ||||
|     legend_height = ImGui::GetCurrentWindow()->Size.y; | ||||
| #endif // ENABLE_GCODE_WINDOW
 | ||||
| 
 | ||||
|     imgui.end(); | ||||
|     ImGui::PopStyleVar(); | ||||
|  |  | |||
|  | @ -5,9 +5,7 @@ | |||
| #include "libslic3r/GCode/GCodeProcessor.hpp" | ||||
| #include "GLModel.hpp" | ||||
| 
 | ||||
| #if ENABLE_GCODE_WINDOW | ||||
| #include <boost/iostreams/device/mapped_file.hpp> | ||||
| #endif // ENABLE_GCODE_WINDOW
 | ||||
| 
 | ||||
| #include <cstdint> | ||||
| #include <float.h> | ||||
|  | @ -520,7 +518,6 @@ public: | |||
|             void render() const; | ||||
|         }; | ||||
| 
 | ||||
| #if ENABLE_GCODE_WINDOW | ||||
|         class GCodeWindow | ||||
|         { | ||||
|             struct Line | ||||
|  | @ -557,7 +554,6 @@ public: | |||
| 
 | ||||
|             void stop_mapping_file(); | ||||
|         }; | ||||
| #endif // ENABLE_GCODE_WINDOW
 | ||||
| 
 | ||||
|         struct Endpoints | ||||
|         { | ||||
|  | @ -571,14 +567,10 @@ public: | |||
|         Endpoints last_current; | ||||
|         Vec3f current_position{ Vec3f::Zero() }; | ||||
|         Marker marker; | ||||
| #if ENABLE_GCODE_WINDOW | ||||
|         GCodeWindow gcode_window; | ||||
| #endif // ENABLE_GCODE_WINDOW
 | ||||
|         std::vector<unsigned int> gcode_ids; | ||||
| 
 | ||||
| #if ENABLE_GCODE_WINDOW | ||||
|         void render(float legend_height) const; | ||||
| #endif // ENABLE_GCODE_WINDOW
 | ||||
|     }; | ||||
| 
 | ||||
|     enum class EViewType : unsigned char | ||||
|  | @ -671,11 +663,9 @@ public: | |||
| 
 | ||||
|     void export_toolpaths_to_obj(const char* filename) const; | ||||
| 
 | ||||
| #if ENABLE_GCODE_WINDOW | ||||
|     void start_mapping_gcode_window(); | ||||
|     void stop_mapping_gcode_window(); | ||||
|     void toggle_gcode_window_visibility() { m_sequential_view.gcode_window.toggle_visibility(); } | ||||
| #endif // ENABLE_GCODE_WINDOW
 | ||||
| 
 | ||||
| private: | ||||
|     void load_toolpaths(const GCodeProcessor::Result& gcode_result); | ||||
|  | @ -683,11 +673,7 @@ private: | |||
|     void refresh_render_paths(bool keep_sequential_current_first, bool keep_sequential_current_last) const; | ||||
|     void render_toolpaths() const; | ||||
|     void render_shells() const; | ||||
| #if ENABLE_GCODE_WINDOW | ||||
|     void render_legend(float& legend_height) const; | ||||
| #else | ||||
|     void render_legend() const; | ||||
| #endif // ENABLE_GCODE_WINDOW
 | ||||
| #if ENABLE_GCODE_VIEWER_STATISTICS | ||||
|     void render_statistics() const; | ||||
| #endif // ENABLE_GCODE_VIEWER_STATISTICS
 | ||||
|  |  | |||
|  | @ -1119,7 +1119,6 @@ int GLCanvas3D::check_volumes_outside_state() const | |||
|     return (int)state; | ||||
| } | ||||
| 
 | ||||
| #if ENABLE_GCODE_WINDOW | ||||
| void GLCanvas3D::start_mapping_gcode_window() | ||||
| { | ||||
|     m_gcode_viewer.start_mapping_gcode_window(); | ||||
|  | @ -1129,7 +1128,6 @@ void GLCanvas3D::stop_mapping_gcode_window() | |||
| { | ||||
|     m_gcode_viewer.stop_mapping_gcode_window(); | ||||
| } | ||||
| #endif // ENABLE_GCODE_WINDOW
 | ||||
| 
 | ||||
| void GLCanvas3D::toggle_sla_auxiliaries_visibility(bool visible, const ModelObject* mo, int instance_idx) | ||||
| { | ||||
|  | @ -2419,10 +2417,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_GCODE_WINDOW | ||||
|         case 'C': | ||||
|         case 'c': { m_gcode_viewer.toggle_gcode_window_visibility(); m_dirty = true; request_extra_frame(); break; } | ||||
| #endif // ENABLE_GCODE_WINDOW
 | ||||
|         case 'E': | ||||
|         case 'e': { m_labels.show(!m_labels.is_shown()); m_dirty = true; break; } | ||||
|         case 'G': | ||||
|  |  | |||
|  | @ -544,10 +544,8 @@ public: | |||
|     const GCodeViewer::SequentialView& get_gcode_sequential_view() const { return m_gcode_viewer.get_sequential_view(); } | ||||
|     void update_gcode_sequential_view_current(unsigned int first, unsigned int last) { m_gcode_viewer.update_sequential_view_current(first, last); } | ||||
| 
 | ||||
| #if ENABLE_GCODE_WINDOW | ||||
|     void start_mapping_gcode_window(); | ||||
|     void stop_mapping_gcode_window(); | ||||
| #endif // ENABLE_GCODE_WINDOW
 | ||||
| 
 | ||||
|     void toggle_sla_auxiliaries_visibility(bool visible, const ModelObject* mo = nullptr, int instance_idx = -1); | ||||
|     void toggle_model_objects_visibility(bool visible, const ModelObject* mo = nullptr, int instance_idx = -1); | ||||
|  |  | |||
|  | @ -221,9 +221,7 @@ void KBShortcutsDialog::fill_shortcuts() | |||
|         { "D", L("Horizontal slider - Move active thumb Right") }, | ||||
|         { "X", L("On/Off one layer mode of the vertical slider") }, | ||||
|         { "L", L("Show/Hide Legend and Estimated printing time") }, | ||||
| #if ENABLE_GCODE_WINDOW | ||||
|         { "C", L("Show/Hide G-code window") }, | ||||
| #endif // ENABLE_GCODE_WINDOW
 | ||||
|     }; | ||||
| 
 | ||||
|     m_full_shortcuts.push_back({ { _L("Preview"), "" }, preview_shortcuts }); | ||||
|  |  | |||
|  | @ -6176,7 +6176,6 @@ BoundingBoxf Plater::bed_shape_bb() const | |||
|     return p->bed_shape_bb(); | ||||
| } | ||||
| 
 | ||||
| #if ENABLE_GCODE_WINDOW | ||||
| void Plater::start_mapping_gcode_window() | ||||
| { | ||||
|     p->preview->get_canvas3d()->start_mapping_gcode_window(); | ||||
|  | @ -6186,7 +6185,6 @@ void Plater::stop_mapping_gcode_window() | |||
| { | ||||
|     p->preview->get_canvas3d()->stop_mapping_gcode_window(); | ||||
| } | ||||
| #endif // ENABLE_GCODE_WINDOW
 | ||||
| 
 | ||||
| void Plater::arrange() | ||||
| { | ||||
|  |  | |||
|  | @ -284,10 +284,8 @@ public: | |||
|     GLCanvas3D* get_current_canvas3D(); | ||||
|     BoundingBoxf bed_shape_bb() const; | ||||
|      | ||||
| #if ENABLE_GCODE_WINDOW | ||||
|     void start_mapping_gcode_window(); | ||||
|     void stop_mapping_gcode_window(); | ||||
| #endif // ENABLE_GCODE_WINDOW
 | ||||
| 
 | ||||
|     void arrange(); | ||||
|     void find_new_position(const ModelInstancePtrs  &instances); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 enricoturri1966
						enricoturri1966