Added default values for expected params in CLI::run (dont_arrange, load)

This commit is contained in:
zdroyer 2019-04-12 15:45:52 +00:00 committed by Joseph Lenox
parent 14bae7fd21
commit c8cfe0d659

View File

@ -56,7 +56,7 @@ int CLI::run(int argc, char **argv) {
if (cli_transform_config_def.has(opt_key)) this->transforms.push_back(opt_key); if (cli_transform_config_def.has(opt_key)) this->transforms.push_back(opt_key);
} }
// load config files supplied via --load // load config files supplied via --load
for (auto const &file : config.getStrings("load")) { for (auto const &file : config.getStrings("load",{})) {
try{ try{
if (!boost::filesystem::exists(file)) { if (!boost::filesystem::exists(file)) {
if (config.getBool("ignore_nonexistent_file", false)) { if (config.getBool("ignore_nonexistent_file", false)) {
@ -314,10 +314,10 @@ int CLI::run(int argc, char **argv) {
boost::nowide::cout << msg << std::endl; boost::nowide::cout << msg << std::endl;
}; };
print.apply_config(this->print_config); print.apply_config(this->print_config);
print.arrange = !this->config.getBool("dont_arrange"); print.arrange = !this->config.getBool("dont_arrange",false);
print.center = !this->config.has("center") print.center = !this->config.has("center")
&& !this->config.has("align_xy") && !this->config.has("align_xy")
&& !this->config.getBool("dont_arrange"); && !this->config.getBool("dont_arrange",false);
Slic3r::Log::error("CLI") << "Arrange: " << print.arrange<< ", center: " << print.center << std::endl; Slic3r::Log::error("CLI") << "Arrange: " << print.arrange<< ", center: " << print.center << std::endl;
print.set_model(model); print.set_model(model);
@ -435,7 +435,7 @@ CLI::output_filepath(const Model &model, IO::ExportFormat format) const {
const std::string filename = pp.process(filename_format); const std::string filename = pp.process(filename_format);
// use --output when available // use --output when available
std::string outfile{ this->config.getString("output") }; std::string outfile{ this->config.getString("output","") };
if (!outfile.empty()) { if (!outfile.empty()) {
// if we were supplied a directory, use it and append our automatically generated filename // if we were supplied a directory, use it and append our automatically generated filename
const boost::filesystem::path out(outfile); const boost::filesystem::path out(outfile);