Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::PresetUtils Namespace Reference

Functions

const VendorProfile::PrinterModelsystem_printer_model (const Preset &preset)
 
std::string system_printer_bed_model (const Preset &preset)
 
std::string system_printer_bed_texture (const Preset &preset)
 
bool vendor_profile_has_all_resources (const VendorProfile &vp)
 

Function Documentation

◆ system_printer_bed_model()

std::string Slic3r::PresetUtils::system_printer_bed_model ( const Preset preset)
2254 {
2255 std::string out;
2256 const VendorProfile::PrinterModel* pm = PresetUtils::system_printer_model(preset);
2257 if (pm != nullptr && !pm->bed_model.empty()) {
2258 out = Slic3r::data_dir() + "/vendor/" + preset.vendor->id + "/" + pm->bed_model;
2259 if (!boost::filesystem::exists(boost::filesystem::path(out)))
2260 out = Slic3r::resources_dir() + "/profiles/" + preset.vendor->id + "/" + pm->bed_model;
2261 }
2262 return out;
2263 }
const VendorProfile * vendor
Definition Preset.hpp:153
std::string id
Definition Preset.hpp:33
const std::string & data_dir()
Definition utils.cpp:206
const std::string & resources_dir()
Definition utils.cpp:167
Definition Preset.hpp:45
std::string bed_model
Definition Preset.hpp:54

References Slic3r::VendorProfile::PrinterModel::bed_model, Slic3r::data_dir(), Slic3r::VendorProfile::id, Slic3r::resources_dir(), system_printer_model(), and Slic3r::Preset::vendor.

Referenced by Slic3r::GUI::Bed3D::detect_type(), and Slic3r::GUI::GCodeViewer::load().

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

◆ system_printer_bed_texture()

std::string Slic3r::PresetUtils::system_printer_bed_texture ( const Preset preset)
2266 {
2267 std::string out;
2268 const VendorProfile::PrinterModel* pm = PresetUtils::system_printer_model(preset);
2269 if (pm != nullptr && !pm->bed_texture.empty()) {
2270 out = Slic3r::data_dir() + "/vendor/" + preset.vendor->id + "/" + pm->bed_texture;
2271 if (!boost::filesystem::exists(boost::filesystem::path(out)))
2272 out = Slic3r::resources_dir() + "/profiles/" + preset.vendor->id + "/" + pm->bed_texture;
2273 }
2274 return out;
2275 }
std::string bed_texture
Definition Preset.hpp:55

References Slic3r::VendorProfile::PrinterModel::bed_texture, Slic3r::data_dir(), Slic3r::VendorProfile::id, Slic3r::resources_dir(), system_printer_model(), and Slic3r::Preset::vendor.

Referenced by Slic3r::GUI::Bed3D::detect_type(), and Slic3r::GUI::GCodeViewer::load().

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

◆ system_printer_model()

const VendorProfile::PrinterModel * Slic3r::PresetUtils::system_printer_model ( const Preset preset)
2240 {
2241 const VendorProfile::PrinterModel *out = nullptr;
2242 if (preset.vendor != nullptr) {
2243 const auto *printer_model = preset.config.opt<ConfigOptionString>("printer_model");
2244 if (printer_model != nullptr && ! printer_model->value.empty()) {
2245 auto it = std::find_if(preset.vendor->models.begin(), preset.vendor->models.end(), [printer_model](const VendorProfile::PrinterModel &pm) { return pm.id == printer_model->value; });
2246 if (it != preset.vendor->models.end())
2247 out = &(*it);
2248 }
2249 }
2250 return out;
2251 }
T * opt(const t_config_option_key &opt_key, bool create=false)
Definition Config.hpp:2196
Definition Config.hpp:848
DynamicPrintConfig config
Definition Preset.hpp:159
std::vector< PrinterModel > models
Definition Preset.hpp:67

References Slic3r::Preset::config, Slic3r::VendorProfile::models, Slic3r::ConfigBase::opt(), and Slic3r::Preset::vendor.

Referenced by Slic3r::GUI::ConfigWizard::priv::check_and_install_missing_materials(), system_printer_bed_model(), and system_printer_bed_texture().

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

◆ vendor_profile_has_all_resources()

bool Slic3r::PresetUtils::vendor_profile_has_all_resources ( const VendorProfile vp)
2278 {
2279 namespace fs = boost::filesystem;
2280
2281 std::string vendor_folder = Slic3r::data_dir() + "/vendor/" + vp.id + "/";
2282 std::string rsrc_folder = Slic3r::resources_dir() + "/profiles/" + vp.id + "/";
2283 std::string cache_folder = Slic3r::data_dir() + "/cache/" + vp.id + "/";
2284 for (const VendorProfile::PrinterModel& model : vp.models) {
2285 for (const std::string& res : { model.bed_texture, model.bed_model, model.thumbnail } ) {
2286 if (! res.empty()
2287 && !fs::exists(fs::path(vendor_folder + res))
2288 && !fs::exists(fs::path(rsrc_folder + res))
2289 && !fs::exists(fs::path(cache_folder + res)))
2290 return false;
2291 }
2292 }
2293 return true;
2294 }
Definition Utils.hpp:15

References Slic3r::data_dir(), Slic3r::VendorProfile::id, Slic3r::VendorProfile::models, and Slic3r::resources_dir().

Referenced by Slic3r::PresetUpdater::priv::get_config_updates().

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