mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-15 21:15:52 +08:00
Tech ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES - Volumes translation in all reference systems using Move gizmo and part manipulator fields
Fixed conflicts during rebase with master
This commit is contained in:
parent
4f1df27309
commit
5e5fdc4844
@ -85,6 +85,8 @@ set(SLIC3R_GUI_SOURCES
|
|||||||
GUI/GUI_App.hpp
|
GUI/GUI_App.hpp
|
||||||
GUI/GUI_Utils.cpp
|
GUI/GUI_Utils.cpp
|
||||||
GUI/GUI_Utils.hpp
|
GUI/GUI_Utils.hpp
|
||||||
|
GUI/GUI_Geometry.cpp
|
||||||
|
GUI/GUI_Geometry.hpp
|
||||||
GUI/I18N.cpp
|
GUI/I18N.cpp
|
||||||
GUI/I18N.hpp
|
GUI/I18N.hpp
|
||||||
GUI/MainFrame.cpp
|
GUI/MainFrame.cpp
|
||||||
|
9
src/slic3r/GUI/GUI_Geometry.cpp
Normal file
9
src/slic3r/GUI/GUI_Geometry.cpp
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#include "libslic3r/libslic3r.h"
|
||||||
|
#include "GUI_Geometry.hpp"
|
||||||
|
|
||||||
|
namespace Slic3r {
|
||||||
|
namespace GUI {
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Slic3r
|
||||||
|
} // namespace GUI
|
72
src/slic3r/GUI/GUI_Geometry.hpp
Normal file
72
src/slic3r/GUI/GUI_Geometry.hpp
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
#ifndef slic3r_GUI_Geometry_hpp_
|
||||||
|
#define slic3r_GUI_Geometry_hpp_
|
||||||
|
|
||||||
|
namespace Slic3r {
|
||||||
|
namespace GUI {
|
||||||
|
|
||||||
|
#if ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
|
enum class ECoordinatesType : unsigned char
|
||||||
|
{
|
||||||
|
World,
|
||||||
|
Instance,
|
||||||
|
Local
|
||||||
|
};
|
||||||
|
|
||||||
|
class TransformationType
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum Enum {
|
||||||
|
// Transforming in a world coordinate system
|
||||||
|
World = 0,
|
||||||
|
// Transforming in a local coordinate system
|
||||||
|
Local = 1,
|
||||||
|
// Absolute transformations, allowed in local coordinate system only.
|
||||||
|
Absolute = 0,
|
||||||
|
// Relative transformations, allowed in both local and world coordinate system.
|
||||||
|
Relative = 2,
|
||||||
|
// For group selection, the transformation is performed as if the group made a single solid body.
|
||||||
|
Joint = 0,
|
||||||
|
// For group selection, the transformation is performed on each object independently.
|
||||||
|
Independent = 4,
|
||||||
|
|
||||||
|
World_Relative_Joint = World | Relative | Joint,
|
||||||
|
World_Relative_Independent = World | Relative | Independent,
|
||||||
|
Local_Absolute_Joint = Local | Absolute | Joint,
|
||||||
|
Local_Absolute_Independent = Local | Absolute | Independent,
|
||||||
|
Local_Relative_Joint = Local | Relative | Joint,
|
||||||
|
Local_Relative_Independent = Local | Relative | Independent,
|
||||||
|
};
|
||||||
|
|
||||||
|
TransformationType() : m_value(World) {}
|
||||||
|
TransformationType(Enum value) : m_value(value) {}
|
||||||
|
TransformationType& operator=(Enum value) { m_value = value; return *this; }
|
||||||
|
|
||||||
|
Enum operator()() const { return m_value; }
|
||||||
|
bool has(Enum v) const { return ((unsigned int)m_value & (unsigned int)v) != 0; }
|
||||||
|
|
||||||
|
void set_world() { this->remove(Local); }
|
||||||
|
void set_local() { this->add(Local); }
|
||||||
|
void set_absolute() { this->remove(Relative); }
|
||||||
|
void set_relative() { this->add(Relative); }
|
||||||
|
void set_joint() { this->remove(Independent); }
|
||||||
|
void set_independent() { this->add(Independent); }
|
||||||
|
|
||||||
|
bool world() const { return !this->has(Local); }
|
||||||
|
bool local() const { return this->has(Local); }
|
||||||
|
bool absolute() const { return !this->has(Relative); }
|
||||||
|
bool relative() const { return this->has(Relative); }
|
||||||
|
bool joint() const { return !this->has(Independent); }
|
||||||
|
bool independent() const { return this->has(Independent); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
void add(Enum v) { m_value = Enum((unsigned int)m_value | (unsigned int)v); }
|
||||||
|
void remove(Enum v) { m_value = Enum((unsigned int)m_value & (~(unsigned int)v)); }
|
||||||
|
|
||||||
|
Enum m_value;
|
||||||
|
};
|
||||||
|
#endif // ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
|
|
||||||
|
} // namespace Slic3r
|
||||||
|
} // namespace GUI
|
||||||
|
|
||||||
|
#endif // slic3r_GUI_Geometry_hpp_
|
@ -53,10 +53,10 @@ static choice_ctrl* create_word_local_combo(wxWindow *parent)
|
|||||||
if (!wxOSX) temp->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
if (!wxOSX) temp->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||||
|
|
||||||
#if ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
#if ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
temp->Append(ObjectManipulation::coordinate_type_str(ObjectManipulation::ECoordinatesType::World));
|
temp->Append(ObjectManipulation::coordinate_type_str(ECoordinatesType::World));
|
||||||
temp->Append(ObjectManipulation::coordinate_type_str(ObjectManipulation::ECoordinatesType::Instance));
|
temp->Append(ObjectManipulation::coordinate_type_str(ECoordinatesType::Instance));
|
||||||
temp->Append(ObjectManipulation::coordinate_type_str(ObjectManipulation::ECoordinatesType::Local));
|
temp->Append(ObjectManipulation::coordinate_type_str(ECoordinatesType::Local));
|
||||||
temp->Select((int)ObjectManipulation::ECoordinatesType::World);
|
temp->Select((int)ECoordinatesType::World);
|
||||||
#else
|
#else
|
||||||
temp->Append(_L("World coordinates"));
|
temp->Append(_L("World coordinates"));
|
||||||
temp->Append(_L("Local coordinates"));
|
temp->Append(_L("Local coordinates"));
|
||||||
@ -974,7 +974,7 @@ wxString ObjectManipulation::coordinate_type_str(ECoordinatesType type)
|
|||||||
case ECoordinatesType::World: { return _L("World coordinates"); }
|
case ECoordinatesType::World: { return _L("World coordinates"); }
|
||||||
case ECoordinatesType::Instance: { return _L("Instance coordinates"); }
|
case ECoordinatesType::Instance: { return _L("Instance coordinates"); }
|
||||||
case ECoordinatesType::Local: { return _L("Local coordinates"); }
|
case ECoordinatesType::Local: { return _L("Local coordinates"); }
|
||||||
default: { assert(false); break; }
|
default: { assert(false); return _L("Unknown"); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
#endif // ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
@ -1004,7 +1004,7 @@ void ObjectManipulation::change_position_value(int axis, double value)
|
|||||||
selection.setup_cache();
|
selection.setup_cache();
|
||||||
#if ENABLE_WORLD_COORDINATE
|
#if ENABLE_WORLD_COORDINATE
|
||||||
#if ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
#if ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
selection.translate(position - m_cache.position, !is_world_coordinates());
|
selection.translate(position - m_cache.position, get_coordinates_type());
|
||||||
#else
|
#else
|
||||||
selection.translate(position - m_cache.position, !m_world_coordinates);
|
selection.translate(position - m_cache.position, !m_world_coordinates);
|
||||||
#endif // ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
#endif // ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
|
@ -5,6 +5,9 @@
|
|||||||
|
|
||||||
#include "GUI_ObjectSettings.hpp"
|
#include "GUI_ObjectSettings.hpp"
|
||||||
#include "GUI_ObjectList.hpp"
|
#include "GUI_ObjectList.hpp"
|
||||||
|
#if ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
|
#include "GUI_Geometry.hpp"
|
||||||
|
#endif // ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
#include "libslic3r/Point.hpp"
|
#include "libslic3r/Point.hpp"
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
|
|
||||||
@ -72,15 +75,6 @@ public:
|
|||||||
static const double in_to_mm;
|
static const double in_to_mm;
|
||||||
static const double mm_to_in;
|
static const double mm_to_in;
|
||||||
|
|
||||||
#if ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
|
||||||
enum class ECoordinatesType : unsigned char
|
|
||||||
{
|
|
||||||
World,
|
|
||||||
Instance,
|
|
||||||
Local
|
|
||||||
};
|
|
||||||
#endif // ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct Cache
|
struct Cache
|
||||||
{
|
{
|
||||||
|
@ -94,13 +94,20 @@ void GLGizmoMove3D::on_start_dragging()
|
|||||||
m_displacement = Vec3d::Zero();
|
m_displacement = Vec3d::Zero();
|
||||||
#if ENABLE_WORLD_COORDINATE
|
#if ENABLE_WORLD_COORDINATE
|
||||||
#if ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
#if ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
if (wxGetApp().obj_manipul()->is_world_coordinates())
|
const ECoordinatesType coordinates_type = wxGetApp().obj_manipul()->get_coordinates_type();
|
||||||
|
const Selection& selection = m_parent.get_selection();
|
||||||
|
if (coordinates_type == ECoordinatesType::World)
|
||||||
#else
|
#else
|
||||||
if (wxGetApp().obj_manipul()->get_world_coordinates())
|
if (wxGetApp().obj_manipul()->get_world_coordinates())
|
||||||
#endif // ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
#endif // ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
m_starting_drag_position = m_center + m_grabbers[m_hover_id].center;
|
m_starting_drag_position = m_center + m_grabbers[m_hover_id].center;
|
||||||
|
#if ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
|
else if (coordinates_type == ECoordinatesType::Local && selection.is_single_volume_or_modifier()) {
|
||||||
|
const GLVolume& v = *selection.get_volume(*selection.get_volume_idxs().begin());
|
||||||
|
m_starting_drag_position = m_center + Geometry::assemble_transform(Vec3d::Zero(), v.get_instance_rotation()) * Geometry::assemble_transform(Vec3d::Zero(), v.get_volume_rotation()) * m_grabbers[m_hover_id].center;
|
||||||
|
}
|
||||||
|
#endif // ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
else {
|
else {
|
||||||
const Selection& selection = m_parent.get_selection();
|
|
||||||
const GLVolume& v = *selection.get_volume(*selection.get_volume_idxs().begin());
|
const GLVolume& v = *selection.get_volume(*selection.get_volume_idxs().begin());
|
||||||
m_starting_drag_position = m_center + Geometry::assemble_transform(Vec3d::Zero(), v.get_instance_rotation()) * m_grabbers[m_hover_id].center;
|
m_starting_drag_position = m_center + Geometry::assemble_transform(Vec3d::Zero(), v.get_instance_rotation()) * m_grabbers[m_hover_id].center;
|
||||||
}
|
}
|
||||||
@ -461,25 +468,39 @@ void GLGizmoMove3D::transform_to_local(const Selection& selection) const
|
|||||||
|
|
||||||
#if ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
#if ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
if (!wxGetApp().obj_manipul()->is_world_coordinates()) {
|
if (!wxGetApp().obj_manipul()->is_world_coordinates()) {
|
||||||
|
const GLVolume& v = *selection.get_volume(*selection.get_volume_idxs().begin());
|
||||||
|
Transform3d orient_matrix = v.get_instance_transformation().get_matrix(true, false, true, true);
|
||||||
|
if (selection.is_single_volume_or_modifier() && wxGetApp().obj_manipul()->is_local_coordinates())
|
||||||
|
orient_matrix = orient_matrix * v.get_volume_transformation().get_matrix(true, false, true, true);
|
||||||
|
glsafe(::glMultMatrixd(orient_matrix.data()));
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
if (!wxGetApp().obj_manipul()->get_world_coordinates()) {
|
if (!wxGetApp().obj_manipul()->get_world_coordinates()) {
|
||||||
#endif // ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
|
||||||
const Transform3d orient_matrix = selection.get_volume(*selection.get_volume_idxs().begin())->get_instance_transformation().get_matrix(true, false, true, true);
|
const Transform3d orient_matrix = selection.get_volume(*selection.get_volume_idxs().begin())->get_instance_transformation().get_matrix(true, false, true, true);
|
||||||
glsafe(::glMultMatrixd(orient_matrix.data()));
|
glsafe(::glMultMatrixd(orient_matrix.data()));
|
||||||
}
|
}
|
||||||
|
#endif // ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLGizmoMove3D::calc_selection_box_and_center()
|
void GLGizmoMove3D::calc_selection_box_and_center()
|
||||||
{
|
{
|
||||||
const Selection& selection = m_parent.get_selection();
|
const Selection& selection = m_parent.get_selection();
|
||||||
#if ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
#if ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
if (wxGetApp().obj_manipul()->is_world_coordinates()) {
|
const ECoordinatesType coordinates_type = wxGetApp().obj_manipul()->get_coordinates_type();
|
||||||
|
if (coordinates_type == ECoordinatesType::World) {
|
||||||
#else
|
#else
|
||||||
if (wxGetApp().obj_manipul()->get_world_coordinates()) {
|
if (wxGetApp().obj_manipul()->get_world_coordinates()) {
|
||||||
#endif // ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
#endif // ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
m_bounding_box = selection.get_bounding_box();
|
m_bounding_box = selection.get_bounding_box();
|
||||||
m_center = m_bounding_box.center();
|
m_center = m_bounding_box.center();
|
||||||
}
|
}
|
||||||
|
#if ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
|
else if (coordinates_type == ECoordinatesType::Local && selection.is_single_volume_or_modifier()) {
|
||||||
|
const GLVolume& v = *selection.get_volume(*selection.get_volume_idxs().begin());
|
||||||
|
m_bounding_box = v.transformed_convex_hull_bounding_box(v.get_instance_transformation().get_matrix(true, true, false, true) * v.get_volume_transformation().get_matrix(true, true, false, true));
|
||||||
|
m_center = v.world_matrix() * m_bounding_box.center();
|
||||||
|
}
|
||||||
|
#endif // ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
else {
|
else {
|
||||||
m_bounding_box.reset();
|
m_bounding_box.reset();
|
||||||
const Selection::IndicesList& ids = selection.get_volume_idxs();
|
const Selection::IndicesList& ids = selection.get_volume_idxs();
|
||||||
@ -490,7 +511,7 @@ void GLGizmoMove3D::calc_selection_box_and_center()
|
|||||||
m_bounding_box = m_bounding_box.transformed(selection.get_volume(*ids.begin())->get_instance_transformation().get_matrix(true, true, false, true));
|
m_bounding_box = m_bounding_box.transformed(selection.get_volume(*ids.begin())->get_instance_transformation().get_matrix(true, true, false, true));
|
||||||
m_center = selection.get_volume(*ids.begin())->get_instance_transformation().get_matrix(false, false, true, false) * m_bounding_box.center();
|
m_center = selection.get_volume(*ids.begin())->get_instance_transformation().get_matrix(false, false, true, false) * m_bounding_box.center();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // ENABLE_WORLD_COORDINATE
|
#endif // ENABLE_WORLD_COORDINATE
|
||||||
|
|
||||||
} // namespace GUI
|
} // namespace GUI
|
||||||
|
@ -81,7 +81,7 @@ bool GLGizmoScale3D::on_mouse(const wxMouseEvent &mouse_event)
|
|||||||
|
|
||||||
Selection &selection = m_parent.get_selection();
|
Selection &selection = m_parent.get_selection();
|
||||||
selection.scale(get_scale(), transformation_type);
|
selection.scale(get_scale(), transformation_type);
|
||||||
if (mouse_event.CmdDown()) selection.translate(m_offset, true);
|
if (mouse_event.CmdDown()) selection.translate(m_offset, ECoordinatesType::Local);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return use_grabbers(mouse_event);
|
return use_grabbers(mouse_event);
|
||||||
|
@ -57,6 +57,9 @@
|
|||||||
#include "GUI_ObjectManipulation.hpp"
|
#include "GUI_ObjectManipulation.hpp"
|
||||||
#include "GUI_ObjectLayers.hpp"
|
#include "GUI_ObjectLayers.hpp"
|
||||||
#include "GUI_Utils.hpp"
|
#include "GUI_Utils.hpp"
|
||||||
|
#if ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
|
#include "GUI_Geometry.hpp"
|
||||||
|
#endif // ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
#include "GUI_Factories.hpp"
|
#include "GUI_Factories.hpp"
|
||||||
#include "wxExtensions.hpp"
|
#include "wxExtensions.hpp"
|
||||||
#include "MainFrame.hpp"
|
#include "MainFrame.hpp"
|
||||||
@ -1516,7 +1519,7 @@ void Sidebar::update_mode()
|
|||||||
|
|
||||||
#if ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
#if ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
if (m_mode == comSimple)
|
if (m_mode == comSimple)
|
||||||
p->object_manipulation->set_coordinates_type(ObjectManipulation::ECoordinatesType::World);
|
p->object_manipulation->set_coordinates_type(ECoordinatesType::World);
|
||||||
#endif // ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
#endif // ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
|
|
||||||
p->object_list->get_sizer()->Show(m_mode > comSimple);
|
p->object_list->get_sizer()->Show(m_mode > comSimple);
|
||||||
|
@ -700,7 +700,11 @@ void Selection::setup_cache()
|
|||||||
set_caches();
|
set_caches();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
|
void Selection::translate(const Vec3d& displacement, ECoordinatesType type)
|
||||||
|
#else
|
||||||
void Selection::translate(const Vec3d& displacement, bool local)
|
void Selection::translate(const Vec3d& displacement, bool local)
|
||||||
|
#endif // ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
{
|
{
|
||||||
if (!m_valid)
|
if (!m_valid)
|
||||||
return;
|
return;
|
||||||
@ -710,8 +714,19 @@ void Selection::translate(const Vec3d& displacement, bool local)
|
|||||||
for (unsigned int i : m_list) {
|
for (unsigned int i : m_list) {
|
||||||
GLVolume& v = *(*m_volumes)[i];
|
GLVolume& v = *(*m_volumes)[i];
|
||||||
if (m_mode == Volume || v.is_wipe_tower) {
|
if (m_mode == Volume || v.is_wipe_tower) {
|
||||||
|
#if ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
|
if (type == ECoordinatesType::Instance)
|
||||||
|
#else
|
||||||
if (local)
|
if (local)
|
||||||
|
#endif // ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
v.set_volume_offset(m_cache.volumes_data[i].get_volume_position() + displacement);
|
v.set_volume_offset(m_cache.volumes_data[i].get_volume_position() + displacement);
|
||||||
|
#if ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
|
else if (type == ECoordinatesType::Local) {
|
||||||
|
const VolumeCache& volume_data = m_cache.volumes_data[i];
|
||||||
|
const Vec3d local_displacement = (volume_data.get_volume_rotation_matrix() * volume_data.get_volume_scale_matrix() * volume_data.get_volume_mirror_matrix()) * displacement;
|
||||||
|
v.set_volume_offset(volume_data.get_volume_position() + local_displacement);
|
||||||
|
}
|
||||||
|
#endif // ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
else {
|
else {
|
||||||
#if ENABLE_WORLD_COORDINATE
|
#if ENABLE_WORLD_COORDINATE
|
||||||
const VolumeCache& volume_data = m_cache.volumes_data[i];
|
const VolumeCache& volume_data = m_cache.volumes_data[i];
|
||||||
@ -726,7 +741,11 @@ void Selection::translate(const Vec3d& displacement, bool local)
|
|||||||
else if (m_mode == Instance) {
|
else if (m_mode == Instance) {
|
||||||
#if ENABLE_WORLD_COORDINATE
|
#if ENABLE_WORLD_COORDINATE
|
||||||
if (is_from_fully_selected_instance(i)) {
|
if (is_from_fully_selected_instance(i)) {
|
||||||
|
#if ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
|
if (type == ECoordinatesType::Local) {
|
||||||
|
#else
|
||||||
if (local) {
|
if (local) {
|
||||||
|
#endif // ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
const VolumeCache& volume_data = m_cache.volumes_data[i];
|
const VolumeCache& volume_data = m_cache.volumes_data[i];
|
||||||
const Vec3d world_displacement = (volume_data.get_instance_rotation_matrix() * volume_data.get_instance_mirror_matrix()) * displacement;
|
const Vec3d world_displacement = (volume_data.get_instance_rotation_matrix() * volume_data.get_instance_mirror_matrix()) * displacement;
|
||||||
v.set_instance_offset(volume_data.get_instance_position() + world_displacement);
|
v.set_instance_offset(volume_data.get_instance_position() + world_displacement);
|
||||||
|
@ -2,6 +2,9 @@
|
|||||||
#define slic3r_GUI_Selection_hpp_
|
#define slic3r_GUI_Selection_hpp_
|
||||||
|
|
||||||
#include "libslic3r/Geometry.hpp"
|
#include "libslic3r/Geometry.hpp"
|
||||||
|
#if ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
|
#include "slic3r/GUI/GUI_Geometry.hpp"
|
||||||
|
#endif // ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
#include "GLModel.hpp"
|
#include "GLModel.hpp"
|
||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
@ -24,6 +27,7 @@ using ModelObjectPtrs = std::vector<ModelObject*>;
|
|||||||
|
|
||||||
|
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
#if !ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
class TransformationType
|
class TransformationType
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -76,6 +80,7 @@ private:
|
|||||||
|
|
||||||
Enum m_value;
|
Enum m_value;
|
||||||
};
|
};
|
||||||
|
#endif // !ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
|
|
||||||
class Selection
|
class Selection
|
||||||
{
|
{
|
||||||
@ -326,7 +331,11 @@ public:
|
|||||||
|
|
||||||
void setup_cache();
|
void setup_cache();
|
||||||
|
|
||||||
|
#if ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
|
void translate(const Vec3d& displacement, ECoordinatesType type = ECoordinatesType::World);
|
||||||
|
#else
|
||||||
void translate(const Vec3d& displacement, bool local = false);
|
void translate(const Vec3d& displacement, bool local = false);
|
||||||
|
#endif // ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
void rotate(const Vec3d& rotation, TransformationType transformation_type);
|
void rotate(const Vec3d& rotation, TransformationType transformation_type);
|
||||||
void flattening_rotate(const Vec3d& normal);
|
void flattening_rotate(const Vec3d& normal);
|
||||||
void scale(const Vec3d& scale, TransformationType transformation_type);
|
void scale(const Vec3d& scale, TransformationType transformation_type);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user