diff --git a/src/slic3r/GUI/WebGuideDialog.cpp b/src/slic3r/GUI/WebGuideDialog.cpp index ee07b06ce0..a162c2e55d 100644 --- a/src/slic3r/GUI/WebGuideDialog.cpp +++ b/src/slic3r/GUI/WebGuideDialog.cpp @@ -919,16 +919,13 @@ bool GuideFrame::run() return false; } -int GuideFrame::GetFilamentInfo( std::string VendorDirectory, json & pFilaList, std::string filepath, std::string &sVendor, std::string &sType) +int GuideFrame::GetFilamentInfo( std::string VendorDirectory, json & pFilaList, const std::string& filepath, const json& content, std::string &sVendor, std::string &sType) { //GetStardardFilePath(filepath); BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " GetFilamentInfo:VendorDirectory - " << VendorDirectory << ", Filepath - "< renamed_from; + if (unescape_strings_cstyle(temp_filament["renamed_from"], renamed_from)) { + if (std::any_of(renamed_from.begin(), renamed_from.end(), [&enabled_filaments](const std::string& n) { + return enabled_filaments.find(n) != enabled_filaments.end(); + })) { + m_ProfileJson["filament"][filament_name]["selected"] = 1; + } + } + } + } } //----region @@ -1318,7 +1336,7 @@ int GuideFrame::LoadProfileFamily(std::string strVendor, std::string strFilePath std::string sV; std::string sT; - int nRet = GetFilamentInfo(vendor_dir.string(),tFilaList, sub_file, sV, sT); + int nRet = GetFilamentInfo(vendor_dir.string(),tFilaList, sub_file, pm, sV, sT); if (nRet != 0) { BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "Load Filament:" << s1 << ",GetFilamentInfo Failed, Vendor:" << sV << ",Type:"<< sT; continue; @@ -1345,6 +1363,11 @@ int GuideFrame::LoadProfileFamily(std::string strVendor, std::string strFilePath } } + OneFF["name"] = pm["name"]; + if (pm.contains("renamed_from")) { + OneFF["renamed_from"] = pm["renamed_from"]; + } + OneFF["models"] = ModelList; OneFF["selected"] = 0; diff --git a/src/slic3r/GUI/WebGuideDialog.hpp b/src/slic3r/GUI/WebGuideDialog.hpp index d2ab468fcc..097a34117b 100644 --- a/src/slic3r/GUI/WebGuideDialog.hpp +++ b/src/slic3r/GUI/WebGuideDialog.hpp @@ -77,7 +77,7 @@ public: int SaveProfileData(); int LoadProfileFamily(std::string strVendor, std::string strFilePath); int SaveProfile(); - int GetFilamentInfo( std::string VendorDirectory,json & pFilaList, std::string filepath, std::string &sVendor, std::string &sType); + int GetFilamentInfo( std::string VendorDirectory,json & pFilaList, const std::string& filepath, const json& content, std::string &sVendor, std::string &sType); bool apply_config(AppConfig *app_config, PresetBundle *preset_bundle, const PresetUpdater *updater, bool& apply_keeped_changes);