mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-17 02:22:17 +00:00
Various Emboss improvements from PS (#4039)
* Fix: invalid distance from surface when load from 3mf Cherry-picked from prusa3d/PrusaSlicer@e1d9393e51 Co-authored-by: YFilip Sykala - NTB T15p <Filip.Sykala@Prusa3D.cz> * Apply rotation angle given by style for new text object Turn off feature 'use_surface' for new text object Cherry-picked from prusa3d/PrusaSlicer@1cb156c815 Co-authored-by: YFilip Sykala - NTB T15p <Filip.Sykala@Prusa3D.cz> * Store/Load align and per_glyph in Slicer.ini for text style Cherry-picked from prusa3d/PrusaSlicer@fe16f5bdd1 Co-authored-by: YFilip Sykala - NTB T15p <Filip.Sykala@Prusa3D.cz> * Store undo/redo snap after stop input-sliding Cherry-picked from prusa3d/PrusaSlicer@fb4e4710e7 Co-authored-by: YFilip Sykala - NTB T15p <Filip.Sykala@Prusa3D.cz> * Initialize SvgFile object in optional different way. Cherry-picked from prusa3d/PrusaSlicer@0ff255eadc Co-authored-by: YFilip Sykala - NTB T15p <Filip.Sykala@Prusa3D.cz> * SPE-2103 Make snap-shot to undo/redo stack only on release slider Connected with attributes: Text/advanced(char gap, line gap, boldness, skew ratio) SVG(size) Also change range for Boldness. VRT font-Ascent. (different font may have different slider value range) Fix line gap (it was denied when per glyph was false) Cherry-picked from prusa3d/PrusaSlicer@ee3546b186 Co-authored-by: YFilip Sykala - NTB T15p <Filip.Sykala@Prusa3D.cz> --------- Co-authored-by: YFilip Sykala - NTB T15p <Filip.Sykala@Prusa3D.cz> Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
@@ -198,15 +198,20 @@ std::optional<float> calc_distance(const GLVolume &gl_volume, RaycastManager &ra
|
||||
if (volume->is_the_only_one_part())
|
||||
return {};
|
||||
|
||||
if (!volume->emboss_shape.has_value())
|
||||
return {};
|
||||
|
||||
RaycastManager::AllowVolumes condition = create_condition(object->volumes, volume->id());
|
||||
RaycastManager::Meshes meshes = create_meshes(canvas, condition);
|
||||
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();
|
||||
if (fix.has_value())
|
||||
w = w * fix->inverse();
|
||||
Vec3d p = w.translation();
|
||||
Vec3d dir = -get_z_base(w);
|
||||
auto hit_opt = raycaster.closest_hit(p, dir, condition);
|
||||
@@ -322,11 +327,11 @@ bool face_selected_volume_to_camera(const Camera &camera, GLCanvas3D &canvas, co
|
||||
return false;
|
||||
ModelObject &object = *object_ptr;
|
||||
|
||||
ModelInstance *instance_ptr = get_model_instance(gl_volume, object);
|
||||
const ModelInstance *instance_ptr = get_model_instance(gl_volume, object);
|
||||
assert(instance_ptr != nullptr);
|
||||
if (instance_ptr == nullptr)
|
||||
return false;
|
||||
ModelInstance &instance = *instance_ptr;
|
||||
const ModelInstance &instance = *instance_ptr;
|
||||
|
||||
ModelVolume *volume_ptr = get_model_volume(gl_volume, object);
|
||||
assert(volume_ptr != nullptr);
|
||||
@@ -385,10 +390,7 @@ bool face_selected_volume_to_camera(const Camera &camera, GLCanvas3D &canvas, co
|
||||
return true;
|
||||
}
|
||||
|
||||
void do_local_z_rotate(GLCanvas3D &canvas, double relative_angle)
|
||||
{
|
||||
Selection &selection = canvas.get_selection();
|
||||
|
||||
void do_local_z_rotate(Selection &selection, double relative_angle) {
|
||||
assert(!selection.is_empty());
|
||||
if(selection.is_empty()) return;
|
||||
|
||||
@@ -418,17 +420,9 @@ void do_local_z_rotate(GLCanvas3D &canvas, double relative_angle)
|
||||
selection.rotate(Vec3d(0., 0., relative_angle), get_drag_transformation_type(selection));
|
||||
};
|
||||
selection_transform(selection, selection_rotate_fnc);
|
||||
|
||||
std::string snapshot_name; // empty meand no store undo / redo
|
||||
// NOTE: it use L instead of _L macro because prefix _ is appended
|
||||
// inside function do_move
|
||||
// snapshot_name = L("Set text rotation");
|
||||
canvas.do_rotate(snapshot_name);
|
||||
}
|
||||
|
||||
void do_local_z_move(GLCanvas3D &canvas, double relative_move) {
|
||||
|
||||
Selection &selection = canvas.get_selection();
|
||||
void do_local_z_move(Selection &selection, double relative_move) {
|
||||
assert(!selection.is_empty());
|
||||
if (selection.is_empty()) return;
|
||||
|
||||
@@ -438,12 +432,6 @@ void do_local_z_move(GLCanvas3D &canvas, double relative_move) {
|
||||
selection.translate(translate, TransformationType::Local);
|
||||
};
|
||||
selection_transform(selection, selection_translate_fnc);
|
||||
|
||||
std::string snapshot_name; // empty mean no store undo / redo
|
||||
// NOTE: it use L instead of _L macro because prefix _ is appended inside
|
||||
// function do_move
|
||||
// snapshot_name = L("Set surface distance");
|
||||
canvas.do_move(snapshot_name);
|
||||
}
|
||||
|
||||
TransformationType get_drag_transformation_type(const Selection &selection)
|
||||
@@ -589,7 +577,7 @@ bool start_dragging(const Vec2d &mouse_pos,
|
||||
|
||||
std::optional<float> start_distance;
|
||||
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,
|
||||
gl_volume_ptr, condition, start_angle,
|
||||
start_distance, true, mouse_offset_without_sla_shift};
|
||||
|
||||
Reference in New Issue
Block a user