FIX: fix the assemble view display issue when enter firstly

Change-Id: Idf432df9d3bb8eef1d57b08b6d345bc1867fe955
This commit is contained in:
lane.wei 2022-12-08 18:36:21 +08:00 committed by Lane.Wei
parent 41b1ad6f2f
commit f2aaddebb8
5 changed files with 13 additions and 6 deletions

View File

@ -6478,7 +6478,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
stream << "\" ";
stream << OFFSET_ATTR << "=\"";
Vec3d ofs2ass = obj->instances[instance_idx]->get_offset_to_assembly();
const Vec3d ofs2ass = obj->instances[instance_idx]->get_offset_to_assembly();
stream << ofs2ass(0) << " " << ofs2ass(1) << " " << ofs2ass(2);
stream << "\" />\n";
}

View File

@ -1050,7 +1050,7 @@ public:
// BBS
void set_offset_to_assembly(const Vec3d& offset) { m_offset_to_assembly = offset; }
Vec3d get_offset_to_assembly() { return m_offset_to_assembly; }
Vec3d get_offset_to_assembly() const { return m_offset_to_assembly; }
const Vec3d& get_offset() const { return m_transformation.get_offset(); }
double get_offset(Axis axis) const { return m_transformation.get_offset(axis); }

View File

@ -1050,7 +1050,8 @@ int GLVolumeCollection::load_object_volume(
int volume_idx,
int instance_idx,
const std::string &color_by,
bool opengl_initialized)
bool opengl_initialized,
bool in_assemble_view)
{
const ModelVolume *model_volume = model_object->volumes[volume_idx];
const int extruder_id = model_volume->extruder_id();
@ -1078,7 +1079,12 @@ int GLVolumeCollection::load_object_volume(
}
v.is_modifier = !model_volume->is_model_part();
v.shader_outside_printer_detection_enabled = model_volume->is_model_part();
v.set_instance_transformation(instance->get_transformation());
if (in_assemble_view) {
v.set_instance_transformation(instance->get_assemble_transformation());
v.set_offset_to_assembly(instance->get_offset_to_assembly());
}
else
v.set_instance_transformation(instance->get_transformation());
v.set_volume_transformation(model_volume->get_transformation());
return int(this->volumes.size() - 1);

View File

@ -632,7 +632,8 @@ public:
int volume_idx,
int instance_idx,
const std::string &color_by,
bool opengl_initialized);
bool opengl_initialized,
bool in_assemble_view = false);
// Load SLA auxiliary GLVolumes (for support trees or pad).
void load_object_auxiliary(

View File

@ -2396,7 +2396,7 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
// Note the index of the loaded volume, so that we can reload the main model GLVolume with the hollowed mesh
// later in this function.
it->volume_idx = m_volumes.volumes.size();
m_volumes.load_object_volume(&model_object, obj_idx, volume_idx, instance_idx, m_color_by, m_initialized);
m_volumes.load_object_volume(&model_object, obj_idx, volume_idx, instance_idx, m_color_by, m_initialized, m_canvas_type == ECanvasType::CanvasAssembleView);
m_volumes.volumes.back()->geometry_id = key.geometry_id;
update_object_list = true;
} else {