Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/xs
diff options
context:
space:
mode:
authorbubnikv <bubnikv@gmail.com>2017-02-09 16:56:13 +0300
committerbubnikv <bubnikv@gmail.com>2017-02-09 16:56:13 +0300
commit88e34ff5de846302f0a726478b4a164322a33727 (patch)
treec55fb1b421cd5bf4aacd8391b212f9f57add010b /xs
parent61c0ae4e9484cb6e3c60a804b1c08409d3e870f6 (diff)
Store / retrieve layer height profile from the AMF file.
Reset the layer height profile when changing a print profile to an incompatible one. Reset button on the layer height bar. Fixed an update issue on zooming by a scroll wheel. Fixed an issue when loading an AMF file: Object names are now retained.
Diffstat (limited to 'xs')
-rw-r--r--xs/src/libslic3r/Model.cpp12
-rw-r--r--xs/src/libslic3r/Model.hpp4
-rw-r--r--xs/src/libslic3r/Print.cpp20
-rw-r--r--xs/src/libslic3r/Print.hpp12
-rw-r--r--xs/src/libslic3r/PrintObject.cpp56
-rw-r--r--xs/src/libslic3r/Slicing.cpp100
-rw-r--r--xs/src/libslic3r/Slicing.hpp10
-rw-r--r--xs/xsp/Model.xsp4
-rw-r--r--xs/xsp/Print.xsp38
9 files changed, 200 insertions, 56 deletions
diff --git a/xs/src/libslic3r/Model.cpp b/xs/src/libslic3r/Model.cpp
index e4a4c48a8..92b667a5f 100644
--- a/xs/src/libslic3r/Model.cpp
+++ b/xs/src/libslic3r/Model.cpp
@@ -329,8 +329,10 @@ ModelMaterial::apply(const t_model_material_attributes &attributes)
}
-ModelObject::ModelObject(Model *model)
- : model(model), _bounding_box_valid(false)
+ModelObject::ModelObject(Model *model) :
+ model(model),
+ _bounding_box_valid(false),
+ layer_height_profile_valid(false)
{}
ModelObject::ModelObject(Model *model, const ModelObject &other, bool copy_volumes)
@@ -340,6 +342,8 @@ ModelObject::ModelObject(Model *model, const ModelObject &other, bool copy_volum
volumes(),
config(other.config),
layer_height_ranges(other.layer_height_ranges),
+ layer_height_profile(other.layer_height_profile),
+ layer_height_profile_valid(other.layer_height_profile_valid),
origin_translation(other.origin_translation),
_bounding_box(other._bounding_box),
_bounding_box_valid(other._bounding_box_valid),
@@ -356,7 +360,7 @@ ModelObject::ModelObject(Model *model, const ModelObject &other, bool copy_volum
this->add_instance(**i);
}
-ModelObject& ModelObject::operator= (ModelObject other)
+ModelObject& ModelObject::operator=(ModelObject other)
{
this->swap(other);
return *this;
@@ -370,6 +374,8 @@ ModelObject::swap(ModelObject &other)
std::swap(this->volumes, other.volumes);
std::swap(this->config, other.config);
std::swap(this->layer_height_ranges, other.layer_height_ranges);
+ std::swap(this->layer_height_profile, other.layer_height_profile);
+ std::swap(this->layer_height_profile_valid, other.layer_height_profile_valid);
std::swap(this->origin_translation, other.origin_translation);
std::swap(this->_bounding_box, other._bounding_box);
std::swap(this->_bounding_box_valid, other._bounding_box_valid);
diff --git a/xs/src/libslic3r/Model.hpp b/xs/src/libslic3r/Model.hpp
index e6e98bc01..5e1e29cd5 100644
--- a/xs/src/libslic3r/Model.hpp
+++ b/xs/src/libslic3r/Model.hpp
@@ -117,6 +117,10 @@ public:
// Profile of increasing z to a layer height, to be linearly interpolated when calculating the layers.
// The pairs of <z, layer_height> are packed into a 1D array to simplify handling by the Perl XS.
std::vector<coordf_t> layer_height_profile;
+ // layer_height_profile is initialized when the layer editing mode is entered.
+ // Only if the user really modified the layer height, layer_height_profile_valid is set
+ // and used subsequently by the PrintObject.
+ bool layer_height_profile_valid;
/* This vector accumulates the total translation applied to the object by the
center_around_origin() method. Callers might want to apply the same translation
diff --git a/xs/src/libslic3r/Print.cpp b/xs/src/libslic3r/Print.cpp
index 539562a16..132eb560d 100644
--- a/xs/src/libslic3r/Print.cpp
+++ b/xs/src/libslic3r/Print.cpp
@@ -371,7 +371,7 @@ Print::add_model_object(ModelObject* model_object, int idx)
this->objects[idx] = o = new PrintObject(this, model_object, bb);
} else {
o = new PrintObject(this, model_object, bb);
- objects.push_back(o);
+ this->objects.push_back(o);
// invalidate steps
this->invalidate_step(psSkirt);
@@ -528,8 +528,26 @@ Print::apply_config(DynamicPrintConfig config)
this->clear_objects();
for (ModelObjectPtrs::iterator it = model_objects.begin(); it != model_objects.end(); ++it) {
this->add_model_object(*it);
+ // Update layer_height_profile from the main thread as it may pull the data from the associated ModelObject.
+ this->objects.back()->update_layer_height_profile();
}
invalidated = true;
+ } else {
+ // Check validity of the layer height profiles.
+ FOREACH_OBJECT(this, o) {
+ if (! (*o)->layer_height_profile_valid) {
+ // The layer_height_profile is not valid for some reason (updated by the user or invalidated due to some option change).
+ // Start slicing of this object from scratch.
+ (*o)->invalidate_all_steps();
+ // Following line sets the layer_height_profile_valid flag.
+ (*o)->update_layer_height_profile();
+ invalidated = true;
+ } else if (! step_done(posSlice)) {
+ // Update layer_height_profile from the main thread as it may pull the data from the associated ModelObject.
+ // Only update if the slicing was not finished yet.
+ (*o)->update_layer_height_profile();
+ }
+ }
}
return invalidated;
diff --git a/xs/src/libslic3r/Print.hpp b/xs/src/libslic3r/Print.hpp
index 02b2ea363..30d49b236 100644
--- a/xs/src/libslic3r/Print.hpp
+++ b/xs/src/libslic3r/Print.hpp
@@ -85,7 +85,13 @@ public:
// Profile of increasing z to a layer height, to be linearly interpolated when calculating the layers.
// The pairs of <z, layer_height> are packed into a 1D array to simplify handling by the Perl XS.
+ // layer_height_profile must not be set by the background thread.
std::vector<coordf_t> layer_height_profile;
+ // There is a layer_height_profile at both PrintObject and ModelObject. The layer_height_profile at the ModelObject
+ // is used for interactive editing and for loading / storing into a project file (AMF file as of today).
+ // This flag indicates that the layer_height_profile at the UI has been updated, therefore the backend needs to get it.
+ // This flag is necessary as we cannot safely clear the layer_height_profile if the background calculation is running.
+ bool layer_height_profile_valid;
// this is set to true when LayerRegion->slices is split in top/internal/bottom
// so that next call to make_perimeters() performs a union() before computing loops
@@ -145,10 +151,16 @@ public:
bool invalidate_step(PrintObjectStep step);
bool invalidate_all_steps();
+ // To be used over the layer_height_profile of both the PrintObject and ModelObject
+ // to initialize the height profile with the height ranges.
+ bool update_layer_height_profile(std::vector<coordf_t> &layer_height_profile) const;
+
// Process layer_height_ranges, the raft layers and first layer thickness into layer_height_profile.
// The layer_height_profile may be later modified interactively by the user to refine layers at sloping surfaces.
bool update_layer_height_profile();
+ void reset_layer_height_profile();
+
// Collect the slicing parameters, to be used by variable layer thickness algorithm,
// by the interactive layer height editor and by the printing process itself.
// The slicing parameters are dependent on various configuration values
diff --git a/xs/src/libslic3r/PrintObject.cpp b/xs/src/libslic3r/PrintObject.cpp
index 8091db973..0f426005d 100644
--- a/xs/src/libslic3r/PrintObject.cpp
+++ b/xs/src/libslic3r/PrintObject.cpp
@@ -29,7 +29,8 @@ namespace Slic3r {
PrintObject::PrintObject(Print* print, ModelObject* model_object, const BoundingBoxf3 &modobj_bbox)
: typed_slices(false),
_print(print),
- _model_object(model_object)
+ _model_object(model_object),
+ layer_height_profile_valid(false)
{
// Compute the translation to be applied to our meshes so that we work with smaller coordinates
{
@@ -216,9 +217,12 @@ PrintObject::invalidate_state_by_config_options(const std::vector<t_config_optio
steps.insert(posPerimeters);
} else if (*opt_key == "layer_height"
|| *opt_key == "first_layer_height"
- || *opt_key == "xy_size_compensation"
|| *opt_key == "raft_layers") {
steps.insert(posSlice);
+ this->reset_layer_height_profile();
+ }
+ else if (*opt_key == "xy_size_compensation") {
+ steps.insert(posSlice);
} else if (*opt_key == "support_material"
|| *opt_key == "support_material_angle"
|| *opt_key == "support_material_extruder"
@@ -283,7 +287,8 @@ PrintObject::invalidate_state_by_config_options(const std::vector<t_config_optio
// these options only affect G-code export, so nothing to invalidate
} else {
// for legacy, if we can't handle this option let's invalidate all steps
- return this->invalidate_all_steps();
+ this->reset_layer_height_profile();
+ return this->invalidate_all_steps();
}
}
@@ -950,21 +955,49 @@ SlicingParameters PrintObject::slicing_parameters() const
unscale(this->size.z), this->print()->object_extruders());
}
-bool PrintObject::update_layer_height_profile()
+bool PrintObject::update_layer_height_profile(std::vector<coordf_t> &layer_height_profile) const
{
bool updated = false;
- if (this->layer_height_profile.empty()) {
+
+ // If the layer height profile is not set, try to use the one stored at the ModelObject.
+ if (layer_height_profile.empty() && layer_height_profile.data() != this->model_object()->layer_height_profile.data()) {
+ layer_height_profile = this->model_object()->layer_height_profile;
+ updated = true;
+ }
+
+ // Verify the layer_height_profile.
+ SlicingParameters slicing_params = this->slicing_parameters();
+ if (! layer_height_profile.empty() &&
+ // Must not be of even length.
+ ((layer_height_profile.size() & 1) != 0 ||
+ // Last entry must be at the top of the object.
+ std::abs(layer_height_profile[layer_height_profile.size() - 2] - slicing_params.object_print_z_height()) > 1e-3))
+ layer_height_profile.clear();
+
+ if (layer_height_profile.empty()) {
if (0)
// if (this->layer_height_profile.empty())
- this->layer_height_profile = layer_height_profile_adaptive(this->slicing_parameters(), this->layer_height_ranges,
+ layer_height_profile = layer_height_profile_adaptive(slicing_params, this->layer_height_ranges,
this->model_object()->volumes);
else
- this->layer_height_profile = layer_height_profile_from_ranges(this->slicing_parameters(), this->layer_height_ranges);
+ layer_height_profile = layer_height_profile_from_ranges(slicing_params, this->layer_height_ranges);
updated = true;
}
return updated;
}
+// This must be called from the main thread as it modifies the layer_height_profile.
+bool PrintObject::update_layer_height_profile()
+{
+ // If the layer height profile has been marked as invalid for some reason (modified at the UI level
+ // or invalidated due to the slicing parameters), clear it now.
+ if (! this->layer_height_profile_valid) {
+ this->layer_height_profile.clear();
+ this->layer_height_profile_valid = true;
+ }
+ return this->update_layer_height_profile(this->layer_height_profile);
+}
+
// 1) Decides Z positions of the layers,
// 2) Initializes layers and their regions
// 3) Slices the object meshes
@@ -1267,4 +1300,13 @@ void PrintObject::_generate_support_material()
support_material.generate(*this);
}
+void PrintObject::reset_layer_height_profile()
+{
+ // Reset the layer_heigth_profile.
+ this->layer_height_profile.clear();
+ // Reset the source layer_height_profile if it exists at the ModelObject.
+ this->model_object()->layer_height_profile.clear();
+ this->model_object()->layer_height_profile_valid = false;
+}
+
} // namespace Slic3r
diff --git a/xs/src/libslic3r/Slicing.cpp b/xs/src/libslic3r/Slicing.cpp
index 2a070438b..6fb487ace 100644
--- a/xs/src/libslic3r/Slicing.cpp
+++ b/xs/src/libslic3r/Slicing.cpp
@@ -18,6 +18,26 @@
namespace Slic3r
{
+static const coordf_t MIN_LAYER_HEIGHT = 0.01;
+static const coordf_t MIN_LAYER_HEIGHT_DEFAULT = 0.05;
+
+// Minimum layer height for the variable layer height algorithm.
+inline coordf_t min_layer_height_from_nozzle(const PrintConfig &print_config, int idx_nozzle)
+{
+ coordf_t min_layer_height = print_config.min_layer_height.get_at(idx_nozzle - 1);
+ return (min_layer_height == 0.) ? MIN_LAYER_HEIGHT_DEFAULT : std::max(MIN_LAYER_HEIGHT, min_layer_height);
+}
+
+// Maximum layer height for the variable layer height algorithm, 3/4 of a nozzle dimaeter by default,
+// it should not be smaller than the minimum layer height.
+inline coordf_t max_layer_height_from_nozzle(const PrintConfig &print_config, int idx_nozzle)
+{
+ coordf_t min_layer_height = min_layer_height_from_nozzle(print_config, idx_nozzle);
+ coordf_t max_layer_height = print_config.max_layer_height.get_at(idx_nozzle - 1);
+ coordf_t nozzle_dmr = print_config.nozzle_diameter.get_at(idx_nozzle - 1);
+ return std::max(min_layer_height, (max_layer_height == 0.) ? (0.75 * nozzle_dmr) : max_layer_height);
+}
+
SlicingParameters SlicingParameters::create_from_config(
const PrintConfig &print_config,
const PrintObjectConfig &object_config,
@@ -45,6 +65,31 @@ SlicingParameters SlicingParameters::create_from_config(
params.base_raft_layers = object_config.raft_layers.value;
params.soluble_interface = soluble_interface;
+ // Miniumum/maximum of the minimum layer height over all extruders.
+ params.min_layer_height = MIN_LAYER_HEIGHT;
+ params.max_layer_height = FLT_MAX;
+ if (object_config.support_material.value || params.base_raft_layers > 0) {
+ // Has some form of support. Add the support layers to the minimum / maximum layer height limits.
+ params.min_layer_height = std::max(
+ min_layer_height_from_nozzle(print_config, object_config.support_material_extruder),
+ min_layer_height_from_nozzle(print_config, object_config.support_material_interface_extruder));
+ params.max_layer_height = std::min(
+ max_layer_height_from_nozzle(print_config, object_config.support_material_extruder),
+ max_layer_height_from_nozzle(print_config, object_config.support_material_interface_extruder));
+ params.max_suport_layer_height = params.max_layer_height;
+ }
+ if (object_extruders.empty()) {
+ params.min_layer_height = std::max(params.min_layer_height, min_layer_height_from_nozzle(print_config, 0));
+ params.max_layer_height = std::min(params.max_layer_height, max_layer_height_from_nozzle(print_config, 0));
+ } else {
+ for (std::set<size_t>::const_iterator it_extruder = object_extruders.begin(); it_extruder != object_extruders.end(); ++ it_extruder) {
+ params.min_layer_height = std::max(params.min_layer_height, min_layer_height_from_nozzle(print_config, *it_extruder));
+ params.max_layer_height = std::min(params.max_layer_height, max_layer_height_from_nozzle(print_config, *it_extruder));
+ }
+ }
+ params.min_layer_height = std::min(params.min_layer_height, params.layer_height);
+ params.max_layer_height = std::max(params.max_layer_height, params.layer_height);
+
if (! soluble_interface) {
params.gap_raft_object = object_config.support_material_contact_distance.value;
params.gap_object_support = object_config.support_material_contact_distance.value;
@@ -101,12 +146,6 @@ SlicingParameters SlicingParameters::create_from_config(
params.object_print_z_max += print_z;
}
- params.min_layer_height = std::min(params.layer_height, first_layer_height);
- params.max_layer_height = std::max(params.layer_height, first_layer_height);
-
- //FIXME add it to the print configuration
- params.min_layer_height = 0.05;
-
// Calculate the maximum layer height as 0.75 from the minimum nozzle diameter.
if (! object_extruders.empty()) {
coordf_t min_object_extruder_dmr = 1000000.;
@@ -306,6 +345,7 @@ void adjust_layer_height_profile(
return;
assert(layer_height_profile.size() >= 2);
+ assert(std::abs(layer_height_profile[layer_height_profile.size() - 2] - slicing_params.object_print_z_height()) < EPSILON);
// 1) Get the current layer thickness at z.
coordf_t current_layer_height = slicing_params.layer_height;
@@ -355,21 +395,21 @@ void adjust_layer_height_profile(
coordf_t lo = std::max(z_span_variable.first, z - 0.5 * band_width);
coordf_t hi = std::min(z_span_variable.second, z + 0.5 * band_width);
coordf_t z_step = 0.1;
- size_t i = 0;
- while (i < layer_height_profile.size() && layer_height_profile[i] < lo)
- i += 2;
- i -= 2;
+ size_t idx = 0;
+ while (idx < layer_height_profile.size() && layer_height_profile[idx] < lo)
+ idx += 2;
+ idx -= 2;
std::vector<double> profile_new;
profile_new.reserve(layer_height_profile.size());
- assert(i >= 0 && i + 1 < layer_height_profile.size());
- profile_new.insert(profile_new.end(), layer_height_profile.begin(), layer_height_profile.begin() + i + 2);
+ assert(idx >= 0 && idx + 1 < layer_height_profile.size());
+ profile_new.insert(profile_new.end(), layer_height_profile.begin(), layer_height_profile.begin() + idx + 2);
coordf_t zz = lo;
size_t i_resampled_start = profile_new.size();
while (zz < hi) {
- size_t next = i + 2;
- coordf_t z1 = layer_height_profile[i];
- coordf_t h1 = layer_height_profile[i + 1];
+ size_t next = idx + 2;
+ coordf_t z1 = layer_height_profile[idx];
+ coordf_t h1 = layer_height_profile[idx + 1];
coordf_t height = h1;
if (next < layer_height_profile.size()) {
coordf_t z2 = layer_height_profile[next];
@@ -409,22 +449,23 @@ void adjust_layer_height_profile(
profile_new.push_back(clamp(slicing_params.min_layer_height, slicing_params.max_layer_height, height));
}
zz += z_step;
- i = next;
- while (i < layer_height_profile.size() && layer_height_profile[i] < zz)
- i += 2;
- i -= 2;
+ idx = next;
+ while (idx < layer_height_profile.size() && layer_height_profile[idx] < zz)
+ idx += 2;
+ idx -= 2;
}
- i += 2;
- assert(i > 0);
+ idx += 2;
+ assert(idx > 0);
size_t i_resampled_end = profile_new.size();
- if (i < layer_height_profile.size()) {
- assert(zz >= layer_height_profile[i - 2]);
- assert(zz <= layer_height_profile[i]);
-// profile_new.push_back(zz);
-// profile_new.push_back(layer_height_profile[i + 1]);
- profile_new.insert(profile_new.end(), layer_height_profile.begin() + i, layer_height_profile.end());
- }
+ if (idx < layer_height_profile.size()) {
+ assert(zz >= layer_height_profile[idx - 2]);
+ assert(zz <= layer_height_profile[idx]);
+ profile_new.insert(profile_new.end(), layer_height_profile.begin() + idx, layer_height_profile.end());
+ }
+ else if (profile_new[profile_new.size() - 2] + 0.5 * EPSILON < slicing_params.object_print_z_height()) {
+ profile_new.insert(profile_new.end(), layer_height_profile.end() - 2, layer_height_profile.end());
+ }
layer_height_profile = std::move(profile_new);
if (action == LAYER_HEIGHT_EDIT_ACTION_SMOOTH) {
@@ -448,6 +489,7 @@ void adjust_layer_height_profile(
assert(layer_height_profile.size() > 2);
assert(layer_height_profile.size() % 2 == 0);
assert(layer_height_profile[0] == 0.);
+ assert(std::abs(layer_height_profile[layer_height_profile.size() - 2] - slicing_params.object_print_z_height()) < EPSILON);
#ifdef _DEBUG
for (size_t i = 2; i < layer_height_profile.size(); i += 2)
assert(layer_height_profile[i - 2] <= layer_height_profile[i]);
@@ -601,7 +643,7 @@ int generate_layer_height_texture(
const Point3 &color2 = palette_raw[idx2];
coordf_t z = cell_to_z1 * coordf_t(cell);
- assert(z >= lo && z <= hi);
+ assert(z >= lo - EPSILON && z <= hi + EPSILON);
// Color mapping from layer height to RGB.
Pointf3 color(
diff --git a/xs/src/libslic3r/Slicing.hpp b/xs/src/libslic3r/Slicing.hpp
index 5105b9518..0b48443b6 100644
--- a/xs/src/libslic3r/Slicing.hpp
+++ b/xs/src/libslic3r/Slicing.hpp
@@ -52,6 +52,11 @@ struct SlicingParameters
// The regular layer height, applied for all but the first layer, if not overridden by layer ranges
// or by the variable layer thickness table.
coordf_t layer_height;
+ // Minimum / maximum layer height, to be used for the automatic adaptive layer height algorithm,
+ // or by an interactive layer height editor.
+ coordf_t min_layer_height;
+ coordf_t max_layer_height;
+ coordf_t max_suport_layer_height;
// First layer height of the print, this may be used for the first layer of the raft
// or for the first layer of the print.
@@ -75,11 +80,6 @@ struct SlicingParameters
// Gap when placing object over support.
coordf_t gap_support_object;
- // Minimum / maximum layer height, to be used for the automatic adaptive layer height algorithm,
- // or by an interactive layer height editor.
- coordf_t min_layer_height;
- coordf_t max_layer_height;
-
// Bottom and top of the printed object.
// If printed without a raft, object_print_z_min = 0 and object_print_z_max = object height.
// Otherwise object_print_z_min is equal to the raft height.
diff --git a/xs/xsp/Model.xsp b/xs/xsp/Model.xsp
index 1859779b9..db6773cb3 100644
--- a/xs/xsp/Model.xsp
+++ b/xs/xsp/Model.xsp
@@ -170,6 +170,10 @@ ModelMaterial::attributes()
void set_layer_height_ranges(t_layer_height_ranges ranges)
%code%{ THIS->layer_height_ranges = ranges; %};
+ std::vector<double> layer_height_profile()
+ %code%{ RETVAL = THIS->layer_height_profile_valid ? THIS->layer_height_profile : std::vector<double>(); %};
+ void set_layer_height_profile(std::vector<double> profile)
+ %code%{ THIS->layer_height_profile = profile; THIS->layer_height_profile_valid = true; %};
Ref<Pointf3> origin_translation()
%code%{ RETVAL = &THIS->origin_translation; %};
diff --git a/xs/xsp/Print.xsp b/xs/xsp/Print.xsp
index 5166aa96b..b70ff9c70 100644
--- a/xs/xsp/Print.xsp
+++ b/xs/xsp/Print.xsp
@@ -120,23 +120,39 @@ _constant()
void _infill();
void _generate_support_material();
- bool update_layer_height_profile();
+ std::vector<double> get_layer_height_min_max()
+ %code%{
+ SlicingParameters slicing_params = THIS->slicing_parameters();
+ RETVAL.push_back(slicing_params.min_layer_height);
+ RETVAL.push_back(slicing_params.max_layer_height);
+ RETVAL.push_back(slicing_params.first_print_layer_height);
+ RETVAL.push_back(slicing_params.first_object_layer_height);
+ RETVAL.push_back(slicing_params.layer_height);
+ %};
void adjust_layer_height_profile(coordf_t z, coordf_t layer_thickness_delta, coordf_t band_width, int action)
- %code%{
- THIS->update_layer_height_profile();
+ %code%{
+ THIS->update_layer_height_profile(THIS->model_object()->layer_height_profile);
adjust_layer_height_profile(
- THIS->slicing_parameters(), THIS->layer_height_profile, z, layer_thickness_delta, band_width, LayerHeightEditActionType(action));
+ THIS->slicing_parameters(), THIS->model_object()->layer_height_profile, z, layer_thickness_delta, band_width, LayerHeightEditActionType(action));
+ THIS->model_object()->layer_height_profile_valid = true;
+ THIS->layer_height_profile_valid = false;
%};
+
+ void reset_layer_height_profile();
- int generate_layer_height_texture(void *data, int rows, int cols, bool level_of_detail_2nd_level = true)
+ int generate_layer_height_texture(void *data, int rows, int cols, bool force = true)
%code%{
- THIS->update_layer_height_profile();
- SlicingParameters slicing_params = THIS->slicing_parameters();
- RETVAL = generate_layer_height_texture(
- slicing_params,
- generate_object_layers(slicing_params, THIS->layer_height_profile),
- data, rows, cols, level_of_detail_2nd_level);
+ force |= THIS->update_layer_height_profile(THIS->model_object()->layer_height_profile);
+ if (force) {
+ SlicingParameters slicing_params = THIS->slicing_parameters();
+ bool level_of_detail_2nd_level = true;
+ RETVAL = generate_layer_height_texture(
+ slicing_params,
+ generate_object_layers(slicing_params, THIS->model_object()->layer_height_profile),
+ data, rows, cols, level_of_detail_2nd_level);
+ } else
+ RETVAL = 0;
%};
int ptr()