Merge branch 'main' into feature/h2c_support_clean

This commit is contained in:
SoftFever
2026-07-11 22:19:59 +08:00
committed by GitHub
5 changed files with 37 additions and 12 deletions

View File

@@ -946,7 +946,7 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, in
toggle_line("wipe_tower_extra_rib_length", have_rib_wall); toggle_line("wipe_tower_extra_rib_length", have_rib_wall);
toggle_line("wipe_tower_rib_width", have_rib_wall); toggle_line("wipe_tower_rib_width", have_rib_wall);
toggle_line("wipe_tower_fillet_wall", have_rib_wall); toggle_line("wipe_tower_fillet_wall", have_rib_wall);
toggle_field("prime_tower_width", have_prime_tower && (supports_wipe_tower_2 || have_rib_wall)); toggle_field("prime_tower_width", have_prime_tower && !have_rib_wall);
toggle_line("single_extruder_multi_material_priming", !bSEMM && have_prime_tower && supports_wipe_tower_2); toggle_line("single_extruder_multi_material_priming", !bSEMM && have_prime_tower && supports_wipe_tower_2);

View File

@@ -2781,6 +2781,11 @@ void ImGuiWrapper::init_font(bool compress)
builder.BuildRanges(&ranges); // Build the final result (ordered ranges with all the unique characters submitted) builder.BuildRanges(&ranges); // Build the final result (ordered ranges with all the unique characters submitted)
io.Fonts->Flags |= ImFontAtlasFlags_NoPowerOfTwoHeight; io.Fonts->Flags |= ImFontAtlasFlags_NoPowerOfTwoHeight;
// TexDesiredWidth will be increased adaptively below if the built height
// exceeds GL_MAX_TEXTURE_SIZE. Leave it at 0 so ImGui picks the minimum
// width for small glyph sets and we only widen when actually necessary.
io.Fonts->TexDesiredWidth = 0;
ImFontConfig cfg = ImFontConfig(); ImFontConfig cfg = ImFontConfig();
cfg.OversampleH = cfg.OversampleV = 1; cfg.OversampleH = cfg.OversampleV = 1;
//FIXME replace with io.Fonts->AddFontFromMemoryTTF(buf_decompressed_data, (int)buf_decompressed_size, m_font_size, nullptr, ranges.Data); //FIXME replace with io.Fonts->AddFontFromMemoryTTF(buf_decompressed_data, (int)buf_decompressed_size, m_font_size, nullptr, ranges.Data);
@@ -2852,7 +2857,23 @@ void ImGuiWrapper::init_font(bool compress)
io.Fonts->AddCustomRectFontGlyph(default_font, icon.first, icon_sz * 4, icon_sz * 4, 3.0 * font_scale + icon_sz * 4); io.Fonts->AddCustomRectFontGlyph(default_font, icon.first, icon_sz * 4, icon_sz * 4, 3.0 * font_scale + icon_sz * 4);
} }
// Build texture atlas // Build texture atlas, widening it if the height would exceed GL_MAX_TEXTURE_SIZE.
// Increasing the width allows the packing algorithm to grow more horizontally which reduces the height.
io.Fonts->Build();
GLint gl_max_tex_size = 0;
glsafe(::glGetIntegerv(GL_MAX_TEXTURE_SIZE, &gl_max_tex_size));
constexpr int max_retries = 6;
for (int attempt = 0; attempt < max_retries && io.Fonts->TexHeight > gl_max_tex_size; ++attempt) {
io.Fonts->TexDesiredWidth = (io.Fonts->TexDesiredWidth > 0 ? io.Fonts->TexDesiredWidth : io.Fonts->TexWidth) * 2;
io.Fonts->Build();
}
if (io.Fonts->TexHeight > gl_max_tex_size) {
// Shouldn't really happen
BOOST_LOG_TRIVIAL(error) << "Font atlas height " << io.Fonts->TexHeight
<< " still exceeds GL_MAX_TEXTURE_SIZE (" << gl_max_tex_size << ")"
<< " after " << max_retries << " attempts; rendering may be incomplete";
}
unsigned char* pixels; unsigned char* pixels;
int width, height; int width, height;
io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); // Load as RGBA 32-bits (75% of the memory is wasted, but default font is so small) because it is more likely to be compatible with user's existing shaders. If your ImTextureId represent a higher-level concept than just a GL texture id, consider calling GetTexDataAsAlpha8() instead to save on GPU memory. io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); // Load as RGBA 32-bits (75% of the memory is wasted, but default font is so small) because it is more likely to be compatible with user's existing shaders. If your ImTextureId represent a higher-level concept than just a GL texture id, consider calling GetTexDataAsAlpha8() instead to save on GPU memory.

View File

@@ -520,7 +520,7 @@ void MediaFilePanel::fetchUrl(boost::weak_ptr<PrinterFileSystem> wfs)
fs->SetUrl(res); fs->SetUrl(res);
} }
}); });
}); }, wxGetApp().get_printer_cloud_provider());
} }
} }

View File

@@ -401,7 +401,7 @@ void PartPlate::set_spiral_vase_mode(bool spiral_mode, bool as_global)
} }
} }
bool PartPlate::valid_instance(int obj_id, int instance_id) bool PartPlate::valid_instance(int obj_id, int instance_id) const
{ {
if ((obj_id >= 0) && (obj_id < m_model->objects.size())) if ((obj_id >= 0) && (obj_id < m_model->objects.size()))
{ {
@@ -1704,7 +1704,7 @@ std::vector<int> PartPlate::get_extruders_under_cli(bool conside_custom_gcode, D
int obj_id = it->first; int obj_id = it->first;
int instance_id = it->second; int instance_id = it->second;
if ((obj_id >= 0) && (obj_id < m_model->objects.size())) if (valid_instance(obj_id, instance_id))
{ {
ModelObject* object = m_model->objects[obj_id]; ModelObject* object = m_model->objects[obj_id];
ModelInstance* instance = object->instances[instance_id]; ModelInstance* instance = object->instances[instance_id];
@@ -2375,6 +2375,9 @@ void PartPlate::set_pos_and_size(Vec3d& origin, int width, int depth, int height
for (std::set<std::pair<int, int>>::iterator it = obj_to_instance_set.begin(); it != obj_to_instance_set.end(); ++it) { for (std::set<std::pair<int, int>>::iterator it = obj_to_instance_set.begin(); it != obj_to_instance_set.end(); ++it) {
int obj_id = it->first; int obj_id = it->first;
int instance_id = it->second; int instance_id = it->second;
if (!valid_instance(obj_id, instance_id))
continue;
ModelObject* object = m_model->objects[obj_id]; ModelObject* object = m_model->objects[obj_id];
ModelInstance* instance = object->instances[instance_id]; ModelInstance* instance = object->instances[instance_id];
@@ -2849,7 +2852,7 @@ void PartPlate::duplicate_all_instance(unsigned int dup_count, bool need_skip, s
int obj_id = it->first; int obj_id = it->first;
int instance_id = it->second; int instance_id = it->second;
if ((obj_id >= 0) && (obj_id < m_model->objects.size())) if (valid_instance(obj_id, instance_id))
{ {
ModelObject* object = m_model->objects[obj_id]; ModelObject* object = m_model->objects[obj_id];
ModelInstance* instance = object->instances[instance_id]; ModelInstance* instance = object->instances[instance_id];
@@ -2882,7 +2885,7 @@ void PartPlate::duplicate_all_instance(unsigned int dup_count, bool need_skip, s
int obj_id = it->first; int obj_id = it->first;
int instance_id = it->second; int instance_id = it->second;
if ((obj_id >= 0) && (obj_id < m_model->objects.size())) if (valid_instance(obj_id, instance_id))
{ {
ModelObject* object = m_model->objects[obj_id]; ModelObject* object = m_model->objects[obj_id];
ModelInstance* instance = object->instances[instance_id]; ModelInstance* instance = object->instances[instance_id];
@@ -2999,8 +3002,8 @@ int PartPlate::printable_instance_size()
int obj_id = it->first; int obj_id = it->first;
int instance_id = it->second; int instance_id = it->second;
if (obj_id >= m_model->objects.size()) if (!valid_instance(obj_id, instance_id))
continue; continue;
ModelObject * object = m_model->objects[obj_id]; ModelObject * object = m_model->objects[obj_id];
ModelInstance *instance = object->instances[instance_id]; ModelInstance *instance = object->instances[instance_id];
@@ -3022,7 +3025,7 @@ bool PartPlate::has_printable_instances()
int obj_id = it->first; int obj_id = it->first;
int instance_id = it->second; int instance_id = it->second;
if (obj_id >= m_model->objects.size()) if (!valid_instance(obj_id, instance_id))
continue; continue;
ModelObject* object = m_model->objects[obj_id]; ModelObject* object = m_model->objects[obj_id];
@@ -3046,7 +3049,8 @@ bool PartPlate::is_all_instances_unprintable()
int obj_id = it->first; int obj_id = it->first;
int instance_id = it->second; int instance_id = it->second;
if (obj_id >= m_model->objects.size()) continue; if (!valid_instance(obj_id, instance_id))
continue;
ModelObject * object = m_model->objects[obj_id]; ModelObject * object = m_model->objects[obj_id];
ModelInstance *instance = object->instances[instance_id]; ModelInstance *instance = object->instances[instance_id];

View File

@@ -167,7 +167,7 @@ private:
wxCoord m_name_texture_height; wxCoord m_name_texture_height;
void init(); void init();
bool valid_instance(int obj_id, int instance_id); bool valid_instance(int obj_id, int instance_id) const;
void generate_print_polygon(ExPolygon &print_polygon); void generate_print_polygon(ExPolygon &print_polygon);
void generate_exclude_polygon(ExPolygon &exclude_polygon); void generate_exclude_polygon(ExPolygon &exclude_polygon);
void generate_logo_polygon(ExPolygon &logo_polygon); void generate_logo_polygon(ExPolygon &logo_polygon);