FIX:add "visible" for GLModel

jira: STUDIO-10126
Change-Id: I95c7882db09e3a86012c0f1a184e505bfd0bdd87
This commit is contained in:
zhou.xu 2025-01-23 15:56:17 +08:00 committed by lane.wei
parent 968dc86710
commit 2676c47259
3 changed files with 19 additions and 1 deletions

View File

@ -1143,6 +1143,12 @@ void GLModel::render_instanced(unsigned int instances_vbo, unsigned int instance
glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0));
}
void GLModel::set_visible(bool flag) {
if (m_visible != flag) {
m_visible = flag;
}
}
bool GLModel::send_to_gpu(Geometry &geometry)
{
if (m_render_data.size() != 1) { return false; }

View File

@ -165,7 +165,7 @@ namespace GUI {
BoundingBoxf3 m_bounding_box;
std::string m_filename;
bool m_visible = true;
public:
GLModel() = default;
virtual ~GLModel();
@ -204,6 +204,8 @@ namespace GUI {
const BoundingBoxf3& get_bounding_box() const { return m_bounding_box; }
const std::string& get_filename() const { return m_filename; }
void set_visible(bool flag);
bool get_visible() const { return m_visible; }
private:
bool send_to_gpu(Geometry& geometry);
bool send_to_gpu(RenderData &data, const std::vector<float> &vertices, const std::vector<unsigned int> &indices) const;

View File

@ -748,6 +748,9 @@ void PartPlate::render_icons(bool bottom, bool only_body, int hover_id)
render_icon_texture(m_partplate_list->m_plate_filament_map_icon, m_partplate_list->m_plate_set_filament_map_hovered_texture);
else
render_icon_texture(m_partplate_list->m_plate_filament_map_icon, m_partplate_list->m_plate_set_filament_map_texture);
m_partplate_list->m_plate_filament_map_icon.set_visible(true);
} else {
m_partplate_list->m_plate_filament_map_icon.set_visible(false);
}
if (hover_id == PLATE_NAME_ID)
@ -769,6 +772,10 @@ void PartPlate::render_icons(bool bottom, bool only_body, int hover_id)
else
render_icon_texture(m_partplate_list->m_plate_settings_icon, m_partplate_list->m_plate_settings_changed_texture);
}
m_partplate_list->m_plate_settings_icon.set_visible(true);
}
else {
m_partplate_list->m_plate_settings_icon.set_visible(false);
}
}
render_plate_name_texture();
@ -1013,6 +1020,9 @@ void PartPlate::on_render_for_picking() {
&m_partplate_list->m_lock_icon, &m_partplate_list->m_plate_settings_icon,
&m_partplate_list->m_plate_filament_map_icon, &m_plate_name_edit_icon};
for (size_t i = 0; i < gl_models.size(); i++) {
if (!gl_models[i]->get_visible()) {
continue;
}
int hover_id = i;
std::array<float, 4> color = picking_color_component(hover_id);
gl_models[i]->set_color(-1, color);