FIX:Fix the crash that occurred when importing G-code file

Jira:STUDIO-13408

(cherry picked from commit 3810f4edfe086b9500860e59baf35e5568b56977)
This commit is contained in:
weizhen.xie
2025-07-16 23:12:31 +08:00
committed by Noisyfox
parent 55e3bd1a4d
commit 04f0b96029
7 changed files with 27 additions and 1 deletions

View File

@@ -2316,6 +2316,16 @@ static inline const char* remove_eols(const char *begin, const char *end) {
return end;
}
DynamicConfig GCodeProcessor::export_config_for_render() const
{
DynamicConfig config;
config.set_key_value("filament_colour", new ConfigOptionStrings(m_parser.get_config().filament_colour.values));
config.set_key_value("filament_is_support", new ConfigOptionBools(m_parser.get_config().filament_is_support.values));
config.set_key_value("filament_type", new ConfigOptionStrings(m_parser.get_config().filament_type.values));
config.set_key_value("filament_map", new ConfigOptionInts(m_parser.get_config().filament_map.values));
return config;
}
// Load a G-code into a stand-alone G-code viewer.
// throws CanceledException through print->throw_if_canceled() (sent by the caller as callback).
void GCodeProcessor::process_file(const std::string& filename, std::function<void()> cancel_callback)