mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-31 23:01:57 +08:00
Merge branch 'fs_fix_SPE-2082' into master_27x
This commit is contained in:
commit
b989fd714c
@ -105,7 +105,7 @@ struct EmbossShape
|
|||||||
// Note: image is only cache it is not neccessary to store
|
// Note: image is only cache it is not neccessary to store
|
||||||
|
|
||||||
// Store file data as plain string
|
// Store file data as plain string
|
||||||
assert(file_data != nullptr);
|
// For Embossed text file_data are nullptr
|
||||||
ar(path, path_in_3mf, (file_data != nullptr) ? *file_data : std::string(""));
|
ar(path, path_in_3mf, (file_data != nullptr) ? *file_data : std::string(""));
|
||||||
}
|
}
|
||||||
template<class Archive> void load(Archive &ar) {
|
template<class Archive> void load(Archive &ar) {
|
||||||
|
@ -198,15 +198,20 @@ std::optional<float> calc_distance(const GLVolume &gl_volume, RaycastManager &ra
|
|||||||
if (volume->is_the_only_one_part())
|
if (volume->is_the_only_one_part())
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
|
if (!volume->emboss_shape.has_value())
|
||||||
|
return {};
|
||||||
|
|
||||||
RaycastManager::AllowVolumes condition = create_condition(object->volumes, volume->id());
|
RaycastManager::AllowVolumes condition = create_condition(object->volumes, volume->id());
|
||||||
RaycastManager::Meshes meshes = create_meshes(canvas, condition);
|
RaycastManager::Meshes meshes = create_meshes(canvas, condition);
|
||||||
raycaster.actualize(*instance, &condition, &meshes);
|
raycaster.actualize(*instance, &condition, &meshes);
|
||||||
return calc_distance(gl_volume, raycaster, &condition);
|
return calc_distance(gl_volume, raycaster, &condition, volume->emboss_shape->fix_3mf_tr);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<float> calc_distance(const GLVolume &gl_volume, const RaycastManager &raycaster, const RaycastManager::ISkip *condition)
|
std::optional<float> calc_distance(const GLVolume &gl_volume, const RaycastManager &raycaster,
|
||||||
{
|
const RaycastManager::ISkip *condition, const std::optional<Slic3r::Transform3d>& fix) {
|
||||||
Transform3d w = gl_volume.world_matrix();
|
Transform3d w = gl_volume.world_matrix();
|
||||||
|
if (fix.has_value())
|
||||||
|
w = w * fix->inverse();
|
||||||
Vec3d p = w.translation();
|
Vec3d p = w.translation();
|
||||||
Vec3d dir = -get_z_base(w);
|
Vec3d dir = -get_z_base(w);
|
||||||
auto hit_opt = raycaster.closest_hit(p, dir, condition);
|
auto hit_opt = raycaster.closest_hit(p, dir, condition);
|
||||||
@ -572,7 +577,7 @@ bool start_dragging(const Vec2d &mouse_pos,
|
|||||||
|
|
||||||
std::optional<float> start_distance;
|
std::optional<float> start_distance;
|
||||||
if (!volume->emboss_shape->projection.use_surface)
|
if (!volume->emboss_shape->projection.use_surface)
|
||||||
start_distance = calc_distance(gl_volume, raycast_manager, &condition);
|
start_distance = calc_distance(gl_volume, raycast_manager, &condition, volume->emboss_shape->fix_3mf_tr);
|
||||||
surface_drag = SurfaceDrag{mouse_offset, world_tr, instance_tr_inv,
|
surface_drag = SurfaceDrag{mouse_offset, world_tr, instance_tr_inv,
|
||||||
gl_volume_ptr, condition, start_angle,
|
gl_volume_ptr, condition, start_angle,
|
||||||
start_distance, true, mouse_offset_without_sla_shift};
|
start_distance, true, mouse_offset_without_sla_shift};
|
||||||
|
@ -89,7 +89,8 @@ std::optional<Vec3d> calc_surface_offset(const Selection &selection, RaycastMana
|
|||||||
/// <param name="canvas">Contain model</param>
|
/// <param name="canvas">Contain model</param>
|
||||||
/// <returns>Calculated distance from surface</returns>
|
/// <returns>Calculated distance from surface</returns>
|
||||||
std::optional<float> calc_distance(const GLVolume &gl_volume, RaycastManager &raycaster, GLCanvas3D &canvas);
|
std::optional<float> calc_distance(const GLVolume &gl_volume, RaycastManager &raycaster, GLCanvas3D &canvas);
|
||||||
std::optional<float> calc_distance(const GLVolume &gl_volume, const RaycastManager &raycaster, const RaycastManager::ISkip *condition);
|
std::optional<float> calc_distance(const GLVolume &gl_volume, const RaycastManager &raycaster,
|
||||||
|
const RaycastManager::ISkip *condition, const std::optional<Slic3r::Transform3d>& fix);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Calculate up vector angle
|
/// Calculate up vector angle
|
||||||
|
Loading…
x
Reference in New Issue
Block a user