FIX:update custom_texture when new_shape=false

Jira: STUDIO-5287
Change-Id: I3add95f9f9345c14a48cc7467513d1b3ce95f4c9
This commit is contained in:
zhou.xu 2023-11-22 11:31:39 +08:00 committed by Lane.Wei
parent 85ac3617d2
commit 9ce7de10f4
3 changed files with 18 additions and 9 deletions

View File

@ -4752,19 +4752,23 @@ bool PartPlateList::set_shapes(const Pointfs& shape, const Pointfs& exclude_area
is_load_bedtype_textures = false;//reload textures
calc_bounding_boxes();
auto check_texture = [](const std::string& texture) {
boost::system::error_code ec; // so the exists call does not throw (e.g. after a permission problem)
return !texture.empty() && (boost::algorithm::iends_with(texture, ".png") || boost::algorithm::iends_with(texture, ".svg")) && boost::filesystem::exists(texture, ec);
};
if (! texture_filename.empty() && ! check_texture(texture_filename)) {
BOOST_LOG_TRIVIAL(error) << "Unable to load bed texture: " << texture_filename;
}
else
m_logo_texture_filename = texture_filename;
update_logo_texture_filename(texture_filename);
return true;
}
void PartPlateList::update_logo_texture_filename(const std::string &texture_filename)
{
auto check_texture = [](const std::string &texture) {
boost::system::error_code ec; // so the exists call does not throw (e.g. after a permission problem)
return !texture.empty() && (boost::algorithm::iends_with(texture, ".png") || boost::algorithm::iends_with(texture, ".svg")) && boost::filesystem::exists(texture, ec);
};
if (!texture_filename.empty() && !check_texture(texture_filename)) {
BOOST_LOG_TRIVIAL(error) << "Unable to load bed texture: " << texture_filename;
} else
m_logo_texture_filename = texture_filename;
}
/*slice related functions*/
//update current slice context into backgroud slicing process
void PartPlateList::update_slice_context_to_current_plate(BackgroundSlicingProcess& process)

View File

@ -785,6 +785,8 @@ public:
bool intersects(const BoundingBoxf3 &bb);
bool contains(const BoundingBoxf3 &bb);
const std::string &get_logo_texture_filename() { return m_logo_texture_filename; }
void update_logo_texture_filename(const std::string &texture_filename);
/*slice related functions*/
//update current slice context into backgroud slicing process
void update_slice_context_to_current_plate(BackgroundSlicingProcess& process);

View File

@ -7399,6 +7399,9 @@ void Plater::priv::set_bed_shape(const Pointfs& shape, const Pointfs& exclude_ar
Pointfs prev_exclude_areas = partplate_list.get_exclude_area();
new_shape |= (height_to_lid != prev_height_lid) || (height_to_rod != prev_height_rod) || (prev_exclude_areas != exclude_areas);
if (!new_shape && partplate_list.get_logo_texture_filename() != custom_texture) {
partplate_list.update_logo_texture_filename(custom_texture);
}
if (new_shape) {
if (view3D) view3D->bed_shape_changed();
if (preview) preview->bed_shape_changed();