Merge branch 'master' into sender

This commit is contained in:
Alessandro Ranellucci 2014-12-31 16:25:26 +01:00
commit 29d64107de
27 changed files with 372 additions and 104 deletions

View file

@ -13,7 +13,7 @@ Model::Model(const Model &other)
// copy objects
this->objects.reserve(other.objects.size());
for (ModelObjectPtrs::const_iterator i = other.objects.begin(); i != other.objects.end(); ++i)
this->add_object(**i);
this->add_object(**i, true);
}
Model& Model::operator= (Model other)
@ -618,6 +618,7 @@ ModelObject::split(ModelObjectPtrs* new_objects)
new_volume->material_id(volume->material_id());
new_objects->push_back(new_object);
delete *mesh;
}
return;

View file

@ -116,6 +116,16 @@ Print::reload_object(size_t idx)
}
}
bool
Print::reload_model_instances()
{
bool invalidated = false;
FOREACH_OBJECT(this, object) {
if ((*object)->reload_model_instances()) invalidated = true;
}
return invalidated;
}
void
Print::clear_regions()
{

View file

@ -174,6 +174,7 @@ class Print
PrintObject* get_object(size_t idx);
void delete_object(size_t idx);
void reload_object(size_t idx);
bool reload_model_instances();
// methods for handling regions
PrintRegion* get_region(size_t idx);

View file

@ -498,6 +498,16 @@ PrintConfigDef::build_def() {
Options["nozzle_diameter"].sidetext = "mm";
Options["nozzle_diameter"].cli = "nozzle-diameter=f@";
Options["octoprint_apikey"].type = coString;
Options["octoprint_apikey"].label = "API Key";
Options["octoprint_apikey"].tooltip = "Slic3r can upload G-code files to OctoPrint. This field should contain the API Key required for authentication.";
Options["octoprint_apikey"].cli = "octoprint-apikey=s";
Options["octoprint_host"].type = coString;
Options["octoprint_host"].label = "Host or IP";
Options["octoprint_host"].tooltip = "Slic3r can upload G-code files to OctoPrint. This field should contain the hostname or IP address of the OctoPrint instance.";
Options["octoprint_host"].cli = "octoprint-host=s";
Options["only_retract_when_crossing_perimeters"].type = coBool;
Options["only_retract_when_crossing_perimeters"].label = "Only retract when crossing perimeters";
Options["only_retract_when_crossing_perimeters"].tooltip = "Disables retraction when the travel path does not exceed the upper layer's perimeters (and thus any ooze will be probably invisible).";

View file

@ -582,7 +582,27 @@ class PrintConfig : public GCodeConfig
};
};
class FullPrintConfig : public PrintObjectConfig, public PrintRegionConfig, public PrintConfig
class HostConfig : public virtual StaticPrintConfig
{
public:
ConfigOptionString octoprint_host;
ConfigOptionString octoprint_apikey;
HostConfig() : StaticPrintConfig() {
this->octoprint_host.value = "";
this->octoprint_apikey.value = "";
};
ConfigOption* option(const t_config_option_key opt_key, bool create = false) {
if (opt_key == "octoprint_host") return &this->octoprint_host;
if (opt_key == "octoprint_apikey") return &this->octoprint_apikey;
return NULL;
};
};
class FullPrintConfig
: public PrintObjectConfig, public PrintRegionConfig, public PrintConfig, public HostConfig
{
public:
ConfigOption* option(const t_config_option_key opt_key, bool create = false) {
@ -590,6 +610,7 @@ class FullPrintConfig : public PrintObjectConfig, public PrintRegionConfig, publ
if ((opt = PrintObjectConfig::option(opt_key, create)) != NULL) return opt;
if ((opt = PrintRegionConfig::option(opt_key, create)) != NULL) return opt;
if ((opt = PrintConfig::option(opt_key, create)) != NULL) return opt;
if ((opt = HostConfig::option(opt_key, create)) != NULL) return opt;
return NULL;
};
};

View file

@ -6,7 +6,7 @@
#include <iostream>
#include <sstream>
#define SLIC3R_VERSION "1.2.2"
#define SLIC3R_VERSION "1.2.4"
#define EPSILON 1e-4
#define SCALING_FACTOR 0.000001

View file

@ -42,9 +42,9 @@ template <class T>
class Ref {
T* val;
public:
Ref() {}
Ref() : val(NULL) {}
Ref(T* t) : val(t) {}
operator T*() const {return val; }
operator T*() const { return val; }
static const char* CLASS() { return ClassTraits<T>::name_ref; }
};
@ -52,10 +52,10 @@ template <class T>
class Clone {
T* val;
public:
Clone() : val() {}
Clone() : val(NULL) {}
Clone(T* t) : val(new T(*t)) {}
Clone(const T& t) : val(new T(t)) {}
operator T*() const {return val; }
operator T*() const { return val; }
static const char* CLASS() { return ClassTraits<T>::name; }
};
};

View file

@ -143,6 +143,7 @@ _constant()
Ref<PrintObject> get_object(int idx);
void delete_object(int idx);
void reload_object(int idx);
bool reload_model_instances();
size_t object_count()
%code%{ RETVAL = THIS->objects.size(); %};