Mirror component of transformations set as default
This commit is contained in:
parent
da37094a09
commit
00222226ed
15 changed files with 10 additions and 246 deletions
|
@ -1333,7 +1333,6 @@ namespace Slic3r {
|
|||
Vec3d offset = transform.matrix().block(0, 3, 3, 1);
|
||||
|
||||
Eigen::Matrix<double, 3, 3, Eigen::DontAlign> m3x3 = transform.matrix().block(0, 0, 3, 3);
|
||||
#if ENABLE_MIRROR
|
||||
// mirror
|
||||
// it is impossible to reconstruct the original mirroring factors from a matrix,
|
||||
// we can only detect if the matrix contains a left handed reference system
|
||||
|
@ -1347,7 +1346,6 @@ namespace Slic3r {
|
|||
}
|
||||
|
||||
// scale
|
||||
#endif // ENABLE_MIRROR
|
||||
Vec3d scale(m3x3.col(0).norm(), m3x3.col(1).norm(), m3x3.col(2).norm());
|
||||
|
||||
// invalid scale value, return
|
||||
|
@ -1364,9 +1362,7 @@ namespace Slic3r {
|
|||
instance.set_offset(offset);
|
||||
instance.set_scaling_factor(scale);
|
||||
instance.set_rotation(rotation);
|
||||
#if ENABLE_MIRROR
|
||||
instance.set_mirror(mirror);
|
||||
#endif // ENABLE_MIRROR
|
||||
}
|
||||
|
||||
bool _3MF_Importer::_handle_start_config(const char** attributes, unsigned int num_attributes)
|
||||
|
|
|
@ -32,9 +32,7 @@
|
|||
// 2 : Added z component of offset
|
||||
// Added x and y components of rotation
|
||||
// Added x, y and z components of scale
|
||||
#if ENABLE_MIRROR
|
||||
// Added x, y and z components of mirror
|
||||
#endif // ENABLE_MIRROR
|
||||
const unsigned int VERSION_AMF = 2;
|
||||
const char* SLIC3RPE_AMF_VERSION = "slic3rpe_amf_version";
|
||||
|
||||
|
@ -132,24 +130,18 @@ struct AMFParserContext
|
|||
NODE_TYPE_SCALEX, // amf/constellation/instance/scalex
|
||||
NODE_TYPE_SCALEY, // amf/constellation/instance/scaley
|
||||
NODE_TYPE_SCALEZ, // amf/constellation/instance/scalez
|
||||
#if ENABLE_MIRROR
|
||||
NODE_TYPE_MIRRORX, // amf/constellation/instance/mirrorx
|
||||
NODE_TYPE_MIRRORY, // amf/constellation/instance/mirrory
|
||||
NODE_TYPE_MIRRORZ, // amf/constellation/instance/mirrorz
|
||||
#endif // ENABLE_MIRROR
|
||||
NODE_TYPE_METADATA, // anywhere under amf/*/metadata
|
||||
};
|
||||
|
||||
struct Instance {
|
||||
#if ENABLE_MIRROR
|
||||
Instance()
|
||||
: deltax_set(false), deltay_set(false), deltaz_set(false)
|
||||
, rx_set(false), ry_set(false), rz_set(false)
|
||||
, scalex_set(false), scaley_set(false), scalez_set(false)
|
||||
, mirrorx_set(false), mirrory_set(false), mirrorz_set(false) {}
|
||||
#else
|
||||
Instance() : deltax_set(false), deltay_set(false), deltaz_set(false), rx_set(false), ry_set(false), rz_set(false), scalex_set(false), scaley_set(false), scalez_set(false) {}
|
||||
#endif // ENABLE_MIRROR
|
||||
// Shift in the X axis.
|
||||
float deltax;
|
||||
bool deltax_set;
|
||||
|
@ -175,7 +167,6 @@ struct AMFParserContext
|
|||
bool scaley_set;
|
||||
float scalez;
|
||||
bool scalez_set;
|
||||
#if ENABLE_MIRROR
|
||||
// Mirroring factors
|
||||
float mirrorx;
|
||||
bool mirrorx_set;
|
||||
|
@ -183,7 +174,6 @@ struct AMFParserContext
|
|||
bool mirrory_set;
|
||||
float mirrorz;
|
||||
bool mirrorz_set;
|
||||
#endif // ENABLE_MIRROR
|
||||
};
|
||||
|
||||
struct Object {
|
||||
|
@ -314,14 +304,12 @@ void AMFParserContext::startElement(const char *name, const char **atts)
|
|||
node_type_new = NODE_TYPE_SCALEZ;
|
||||
else if (strcmp(name, "scale") == 0)
|
||||
node_type_new = NODE_TYPE_SCALE;
|
||||
#if ENABLE_MIRROR
|
||||
else if (strcmp(name, "mirrorx") == 0)
|
||||
node_type_new = NODE_TYPE_MIRRORX;
|
||||
else if (strcmp(name, "mirrory") == 0)
|
||||
node_type_new = NODE_TYPE_MIRRORY;
|
||||
else if (strcmp(name, "mirrorz") == 0)
|
||||
node_type_new = NODE_TYPE_MIRRORZ;
|
||||
#endif // ENABLE_MIRROR
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
|
@ -387,14 +375,10 @@ void AMFParserContext::characters(const XML_Char *s, int len)
|
|||
m_path.back() == NODE_TYPE_SCALEX ||
|
||||
m_path.back() == NODE_TYPE_SCALEY ||
|
||||
m_path.back() == NODE_TYPE_SCALEZ ||
|
||||
#if ENABLE_MIRROR
|
||||
m_path.back() == NODE_TYPE_SCALE ||
|
||||
m_path.back() == NODE_TYPE_MIRRORX ||
|
||||
m_path.back() == NODE_TYPE_MIRRORY ||
|
||||
m_path.back() == NODE_TYPE_MIRRORZ)
|
||||
#else
|
||||
m_path.back() == NODE_TYPE_SCALE)
|
||||
#endif // ENABLE_MIRROR
|
||||
m_value[0].append(s, len);
|
||||
break;
|
||||
case 6:
|
||||
|
@ -486,7 +470,6 @@ void AMFParserContext::endElement(const char * /* name */)
|
|||
m_instance->scalez_set = true;
|
||||
m_value[0].clear();
|
||||
break;
|
||||
#if ENABLE_MIRROR
|
||||
case NODE_TYPE_MIRRORX:
|
||||
assert(m_instance);
|
||||
m_instance->mirrorx = float(atof(m_value[0].c_str()));
|
||||
|
@ -505,7 +488,6 @@ void AMFParserContext::endElement(const char * /* name */)
|
|||
m_instance->mirrorz_set = true;
|
||||
m_value[0].clear();
|
||||
break;
|
||||
#endif // ENABLE_MIRROR
|
||||
|
||||
// Object vertices:
|
||||
case NODE_TYPE_VERTEX:
|
||||
|
@ -665,9 +647,7 @@ void AMFParserContext::endDocument()
|
|||
mi->set_offset(Vec3d(instance.deltax_set ? (double)instance.deltax : 0.0, instance.deltay_set ? (double)instance.deltay : 0.0, instance.deltaz_set ? (double)instance.deltaz : 0.0));
|
||||
mi->set_rotation(Vec3d(instance.rx_set ? (double)instance.rx : 0.0, instance.ry_set ? (double)instance.ry : 0.0, instance.rz_set ? (double)instance.rz : 0.0));
|
||||
mi->set_scaling_factor(Vec3d(instance.scalex_set ? (double)instance.scalex : 1.0, instance.scaley_set ? (double)instance.scaley : 1.0, instance.scalez_set ? (double)instance.scalez : 1.0));
|
||||
#if ENABLE_MIRROR
|
||||
mi->set_mirror(Vec3d(instance.mirrorx_set ? (double)instance.mirrorx : 1.0, instance.mirrory_set ? (double)instance.mirrory : 1.0, instance.mirrorz_set ? (double)instance.mirrorz : 1.0));
|
||||
#endif // ENABLE_MIRROR
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -987,11 +967,9 @@ bool store_amf(const char *path, Model *model, Print* print, bool export_print_c
|
|||
" <scalex>%lf</scalex>\n"
|
||||
" <scaley>%lf</scaley>\n"
|
||||
" <scalez>%lf</scalez>\n"
|
||||
#if ENABLE_MIRROR
|
||||
" <mirrorx>%lf</mirrorx>\n"
|
||||
" <mirrory>%lf</mirrory>\n"
|
||||
" <mirrorz>%lf</mirrorz>\n"
|
||||
#endif // ENABLE_MIRROR
|
||||
" </instance>\n",
|
||||
object_id,
|
||||
instance->get_offset(X),
|
||||
|
@ -1002,14 +980,10 @@ bool store_amf(const char *path, Model *model, Print* print, bool export_print_c
|
|||
instance->get_rotation(Z),
|
||||
instance->get_scaling_factor(X),
|
||||
instance->get_scaling_factor(Y),
|
||||
#if ENABLE_MIRROR
|
||||
instance->get_scaling_factor(Z),
|
||||
instance->get_mirror(X),
|
||||
instance->get_mirror(Y),
|
||||
instance->get_mirror(Z));
|
||||
#else
|
||||
instance->get_scaling_factor(Z));
|
||||
#endif // ENABLE_MIRROR
|
||||
|
||||
//FIXME missing instance->scaling_factor
|
||||
instances.append(buf);
|
||||
|
|
|
@ -1161,11 +1161,7 @@ MedialAxis::retrieve_endpoint(const VD::cell_type* cell) const
|
|||
}
|
||||
}
|
||||
|
||||
#if ENABLE_MIRROR
|
||||
void assemble_transform(Transform3d& transform, const Vec3d& translation, const Vec3d& rotation, const Vec3d& scale, const Vec3d& mirror)
|
||||
#else
|
||||
void assemble_transform(Transform3d& transform, const Vec3d& translation, const Vec3d& rotation, const Vec3d& scale)
|
||||
#endif // ENABLE_MIRROR
|
||||
{
|
||||
transform = Transform3d::Identity();
|
||||
transform.translate(translation);
|
||||
|
@ -1173,23 +1169,13 @@ void assemble_transform(Transform3d& transform, const Vec3d& translation, const
|
|||
transform.rotate(Eigen::AngleAxisd(rotation(1), Vec3d::UnitY()));
|
||||
transform.rotate(Eigen::AngleAxisd(rotation(0), Vec3d::UnitX()));
|
||||
transform.scale(scale);
|
||||
#if ENABLE_MIRROR
|
||||
transform.scale(mirror);
|
||||
#endif // ENABLE_MIRROR
|
||||
}
|
||||
|
||||
#if ENABLE_MIRROR
|
||||
Transform3d assemble_transform(const Vec3d& translation, const Vec3d& rotation, const Vec3d& scale, const Vec3d& mirror)
|
||||
#else
|
||||
Transform3d assemble_transform(const Vec3d& translation, const Vec3d& rotation, const Vec3d& scale)
|
||||
#endif // ENABLE_MIRROR
|
||||
{
|
||||
Transform3d transform;
|
||||
#if ENABLE_MIRROR
|
||||
assemble_transform(transform, translation, rotation, scale, mirror);
|
||||
#else
|
||||
assemble_transform(transform, translation, rotation, scale);
|
||||
#endif // ENABLE_MIRROR
|
||||
return transform;
|
||||
}
|
||||
|
||||
|
@ -1232,13 +1218,10 @@ Transformation::Flags::Flags()
|
|||
: dont_translate(true)
|
||||
, dont_rotate(true)
|
||||
, dont_scale(true)
|
||||
#if ENABLE_MIRROR
|
||||
, dont_mirror(true)
|
||||
#endif // ENABLE_MIRROR
|
||||
{
|
||||
}
|
||||
|
||||
#if ENABLE_MIRROR
|
||||
bool Transformation::Flags::needs_update(bool dont_translate, bool dont_rotate, bool dont_scale, bool dont_mirror) const
|
||||
{
|
||||
return (this->dont_translate != dont_translate) || (this->dont_rotate != dont_rotate) || (this->dont_scale != dont_scale) || (this->dont_mirror != dont_mirror);
|
||||
|
@ -1251,27 +1234,12 @@ void Transformation::Flags::set(bool dont_translate, bool dont_rotate, bool dont
|
|||
this->dont_scale = dont_scale;
|
||||
this->dont_mirror = dont_mirror;
|
||||
}
|
||||
#else
|
||||
bool Transformation::Flags::needs_update(bool dont_translate, bool dont_rotate, bool dont_scale) const
|
||||
{
|
||||
return (this->dont_translate != dont_translate) || (this->dont_rotate != dont_rotate) || (this->dont_scale != dont_scale);
|
||||
}
|
||||
|
||||
void Transformation::Flags::set(bool dont_translate, bool dont_rotate, bool dont_scale)
|
||||
{
|
||||
this->dont_translate = dont_translate;
|
||||
this->dont_rotate = dont_rotate;
|
||||
this->dont_scale = dont_scale;
|
||||
}
|
||||
#endif // ENABLE_MIRROR
|
||||
|
||||
Transformation::Transformation()
|
||||
: m_offset(Vec3d::Zero())
|
||||
, m_rotation(Vec3d::Zero())
|
||||
, m_scaling_factor(Vec3d::Ones())
|
||||
#if ENABLE_MIRROR
|
||||
, m_mirror(Vec3d::Ones())
|
||||
#endif // ENABLE_MIRROR
|
||||
, m_matrix(Transform3d::Identity())
|
||||
, m_dirty(false)
|
||||
{
|
||||
|
@ -1349,33 +1317,18 @@ void Transformation::set_mirror(Axis axis, double mirror)
|
|||
}
|
||||
}
|
||||
|
||||
#if ENABLE_MIRROR
|
||||
const Transform3d& Transformation::world_matrix(bool dont_translate, bool dont_rotate, bool dont_scale, bool dont_mirror) const
|
||||
#else
|
||||
const Transform3d& Transformation::world_matrix(bool dont_translate, bool dont_rotate, bool dont_scale) const
|
||||
#endif // ENABLE_MIRROR
|
||||
const Transform3d& Transformation::get_matrix(bool dont_translate, bool dont_rotate, bool dont_scale, bool dont_mirror) const
|
||||
{
|
||||
#if ENABLE_MIRROR
|
||||
if (m_dirty || m_flags.needs_update(dont_translate, dont_rotate, dont_scale, dont_mirror))
|
||||
#else
|
||||
if (m_dirty || m_flags.needs_update(dont_translate, dont_rotate, dont_scale))
|
||||
#endif // ENABLE_MIRROR
|
||||
{
|
||||
Vec3d translation = dont_translate ? Vec3d::Zero() : m_offset;
|
||||
Vec3d rotation = dont_rotate ? Vec3d::Zero() : m_rotation;
|
||||
Vec3d scale = dont_scale ? Vec3d::Ones() : m_scaling_factor;
|
||||
#if ENABLE_MIRROR
|
||||
Vec3d mirror = dont_mirror ? Vec3d::Ones() : m_mirror;
|
||||
m_matrix = Geometry::assemble_transform(translation, rotation, scale, mirror);
|
||||
#else
|
||||
m_matrix = Geometry::assemble_transform(translation, rotation, scale);
|
||||
#endif // ENABLE_MIRROR
|
||||
m_matrix = Geometry::assemble_transform(
|
||||
dont_translate ? Vec3d::Zero() : m_offset,
|
||||
dont_rotate ? Vec3d::Zero() : m_rotation,
|
||||
dont_scale ? Vec3d::Ones() : m_scaling_factor,
|
||||
dont_mirror ? Vec3d::Ones() : m_mirror
|
||||
);
|
||||
|
||||
#if ENABLE_MIRROR
|
||||
m_flags.set(dont_translate, dont_rotate, dont_scale, dont_mirror);
|
||||
#else
|
||||
m_flags.set(dont_translate, dont_rotate, dont_scale);
|
||||
#endif // ENABLE_MIRROR
|
||||
m_dirty = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -172,7 +172,6 @@ class MedialAxis {
|
|||
};
|
||||
|
||||
// Sets the given transform by assembling the given transformations in the following order:
|
||||
#if ENABLE_MIRROR
|
||||
// 1) mirror
|
||||
// 2) scale
|
||||
// 3) rotate X
|
||||
|
@ -180,17 +179,8 @@ class MedialAxis {
|
|||
// 5) rotate Z
|
||||
// 6) translate
|
||||
void assemble_transform(Transform3d& transform, const Vec3d& translation = Vec3d::Zero(), const Vec3d& rotation = Vec3d::Zero(), const Vec3d& scale = Vec3d::Ones(), const Vec3d& mirror = Vec3d::Ones());
|
||||
#else
|
||||
// 1) scale
|
||||
// 2) rotate X
|
||||
// 3) rotate Y
|
||||
// 4) rotate Z
|
||||
// 5) translate
|
||||
void assemble_transform(Transform3d& transform, const Vec3d& translation = Vec3d::Zero(), const Vec3d& rotation = Vec3d::Zero(), const Vec3d& scale = Vec3d::Ones());
|
||||
#endif // ENABLE_MIRROR
|
||||
|
||||
// Returns the transform obtained by assembling the given transformations in the following order:
|
||||
#if ENABLE_MIRROR
|
||||
// 1) mirror
|
||||
// 2) scale
|
||||
// 3) rotate X
|
||||
|
@ -198,14 +188,6 @@ void assemble_transform(Transform3d& transform, const Vec3d& translation = Vec3d
|
|||
// 5) rotate Z
|
||||
// 6) translate
|
||||
Transform3d assemble_transform(const Vec3d& translation = Vec3d::Zero(), const Vec3d& rotation = Vec3d::Zero(), const Vec3d& scale = Vec3d::Ones(), const Vec3d& mirror = Vec3d::Ones());
|
||||
#else
|
||||
// 1) scale
|
||||
// 2) rotate X
|
||||
// 3) rotate Y
|
||||
// 4) rotate Z
|
||||
// 5) translate
|
||||
Transform3d assemble_transform(const Vec3d& translation = Vec3d::Zero(), const Vec3d& rotation = Vec3d::Zero(), const Vec3d& scale = Vec3d::Ones());
|
||||
#endif // ENABLE_MIRROR
|
||||
|
||||
// Returns the euler angles extracted from the given rotation matrix
|
||||
// Warning -> The matrix should not contain any scale or shear !!!
|
||||
|
@ -223,27 +205,18 @@ class Transformation
|
|||
bool dont_translate;
|
||||
bool dont_rotate;
|
||||
bool dont_scale;
|
||||
#if ENABLE_MIRROR
|
||||
bool dont_mirror;
|
||||
#endif // ENABLE_MIRROR
|
||||
|
||||
Flags();
|
||||
|
||||
#if ENABLE_MIRROR
|
||||
bool needs_update(bool dont_translate, bool dont_rotate, bool dont_scale, bool dont_mirror) const;
|
||||
void set(bool dont_translate, bool dont_rotate, bool dont_scale, bool dont_mirror);
|
||||
#else
|
||||
bool needs_update(bool dont_translate, bool dont_rotate, bool dont_scale) const;
|
||||
void set(bool dont_translate, bool dont_rotate, bool dont_scale);
|
||||
#endif // ENABLE_MIRROR
|
||||
};
|
||||
|
||||
Vec3d m_offset; // In unscaled coordinates
|
||||
Vec3d m_rotation; // Rotation around the three axes, in radians around mesh center point
|
||||
Vec3d m_scaling_factor; // Scaling factors along the three axes
|
||||
#if ENABLE_MIRROR
|
||||
Vec3d m_mirror; // Mirroring along the three axes
|
||||
#endif // ENABLE_MIRROR
|
||||
mutable Transform3d m_matrix;
|
||||
|
||||
mutable Flags m_flags;
|
||||
|
@ -267,7 +240,6 @@ public:
|
|||
Vec3d get_scaling_factor() const { return m_scaling_factor; }
|
||||
double get_scaling_factor(Axis axis) const { return m_scaling_factor(axis); }
|
||||
|
||||
#if ENABLE_MIRROR
|
||||
void set_scaling_factor(const Vec3d& scaling_factor);
|
||||
void set_scaling_factor(Axis axis, double scaling_factor);
|
||||
|
||||
|
@ -277,13 +249,7 @@ public:
|
|||
void set_mirror(const Vec3d& mirror);
|
||||
void set_mirror(Axis axis, double mirror);
|
||||
|
||||
const Transform3d& world_matrix(bool dont_translate = false, bool dont_rotate = false, bool dont_scale = false, bool dont_mirror = false) const;
|
||||
#else
|
||||
void set_scaling_factor(const Vec3d& scaling_factor) { m_scaling_factor = scaling_factor; }
|
||||
void set_scaling_factor(Axis axis, double scaling_factor) { m_scaling_factor(axis) = scaling_factor; }
|
||||
|
||||
const Transform3d& world_matrix(bool dont_translate = false, bool dont_rotate = false, bool dont_scale = false) const;
|
||||
#endif // ENABLE_MIRROR
|
||||
const Transform3d& get_matrix(bool dont_translate = false, bool dont_rotate = false, bool dont_scale = false, bool dont_mirror = false) const;
|
||||
};
|
||||
#endif // ENABLE_MODELVOLUME_TRANSFORM
|
||||
|
||||
|
|
|
@ -1146,7 +1146,6 @@ void ModelInstance::set_rotation(Axis axis, double rotation)
|
|||
m_rotation(axis) = rotation;
|
||||
}
|
||||
|
||||
#if ENABLE_MIRROR
|
||||
void ModelInstance::set_scaling_factor(const Vec3d& scaling_factor)
|
||||
{
|
||||
set_scaling_factor(X, scaling_factor(0));
|
||||
|
@ -1176,7 +1175,6 @@ void ModelInstance::set_mirror(Axis axis, double mirror)
|
|||
|
||||
m_mirror(axis) = mirror;
|
||||
}
|
||||
#endif // ENABLE_MIRROR
|
||||
#endif // !ENABLE_MODELVOLUME_TRANSFORM
|
||||
|
||||
void ModelInstance::transform_mesh(TriangleMesh* mesh, bool dont_translate) const
|
||||
|
@ -1188,11 +1186,7 @@ BoundingBoxf3 ModelInstance::transform_mesh_bounding_box(const TriangleMesh* mes
|
|||
{
|
||||
// Rotate around mesh origin.
|
||||
TriangleMesh copy(*mesh);
|
||||
#if ENABLE_MIRROR
|
||||
copy.transform(world_matrix(true, false, true, true).cast<float>());
|
||||
#else
|
||||
copy.transform(world_matrix(true, false, true).cast<float>());
|
||||
#endif // ENABLE_MIRROR
|
||||
BoundingBoxf3 bbox = copy.bounding_box();
|
||||
|
||||
if (!empty(bbox)) {
|
||||
|
@ -1253,21 +1247,13 @@ void ModelInstance::transform_polygon(Polygon* polygon) const
|
|||
}
|
||||
|
||||
#if !ENABLE_MODELVOLUME_TRANSFORM
|
||||
#if ENABLE_MIRROR
|
||||
Transform3d ModelInstance::world_matrix(bool dont_translate, bool dont_rotate, bool dont_scale, bool dont_mirror) const
|
||||
#else
|
||||
Transform3d ModelInstance::world_matrix(bool dont_translate, bool dont_rotate, bool dont_scale) const
|
||||
#endif // ENABLE_MIRROR
|
||||
{
|
||||
Vec3d translation = dont_translate ? Vec3d::Zero() : m_offset;
|
||||
Vec3d rotation = dont_rotate ? Vec3d::Zero() : m_rotation;
|
||||
Vec3d scale = dont_scale ? Vec3d::Ones() : m_scaling_factor;
|
||||
#if ENABLE_MIRROR
|
||||
Vec3d mirror = dont_mirror ? Vec3d::Ones() : m_mirror;
|
||||
return Geometry::assemble_transform(translation, rotation, scale, mirror);
|
||||
#else
|
||||
return Geometry::assemble_transform(translation, rotation, scale);
|
||||
#endif // ENABLE_MIRROR
|
||||
}
|
||||
#endif // !ENABLE_MODELVOLUME_TRANSFORM
|
||||
|
||||
|
|
|
@ -283,13 +283,11 @@ public:
|
|||
void set_scaling_factor(const Vec3d& scaling_factor) { m_transformation.set_scaling_factor(scaling_factor); }
|
||||
void set_scaling_factor(Axis axis, double scaling_factor) { m_transformation.set_scaling_factor(axis, scaling_factor); }
|
||||
|
||||
#if ENABLE_MIRROR
|
||||
const Vec3d& get_mirror() const { return m_transformation.get_mirror(); }
|
||||
double get_mirror(Axis axis) const { return m_transformation.get_mirror(axis); }
|
||||
|
||||
void set_mirror(const Vec3d& mirror) { m_transformation.set_mirror(mirror); }
|
||||
void set_mirror(Axis axis, double mirror) { m_transformation.set_mirror(axis, mirror); }
|
||||
#endif // ENABLE_MIRROR
|
||||
#endif // ENABLE_MODELVOLUME_TRANSFORM
|
||||
|
||||
private:
|
||||
|
@ -347,9 +345,7 @@ private:
|
|||
Vec3d m_offset; // in unscaled coordinates
|
||||
Vec3d m_rotation; // Rotation around the three axes, in radians around mesh center point
|
||||
Vec3d m_scaling_factor; // Scaling factors along the three axes
|
||||
#if ENABLE_MIRROR
|
||||
Vec3d m_mirror; // Mirroring along the three axes
|
||||
#endif // ENABLE_MIRROR
|
||||
#endif // ENABLE_MODELVOLUME_TRANSFORM
|
||||
|
||||
public:
|
||||
|
@ -380,13 +376,11 @@ public:
|
|||
void set_scaling_factor(const Vec3d& scaling_factor) { m_transformation.set_scaling_factor(scaling_factor); }
|
||||
void set_scaling_factor(Axis axis, double scaling_factor) { m_transformation.set_scaling_factor(axis, scaling_factor); }
|
||||
|
||||
#if ENABLE_MIRROR
|
||||
const Vec3d& get_mirror() const { return m_transformation.get_mirror(); }
|
||||
double get_mirror(Axis axis) const { return m_transformation.get_mirror(axis); }
|
||||
|
||||
void set_mirror(const Vec3d& mirror) { m_transformation.set_mirror(mirror); }
|
||||
void set_mirror(Axis axis, double mirror) { m_transformation.set_mirror(axis, mirror); }
|
||||
#endif // ENABLE_MIRROR
|
||||
#else
|
||||
const Vec3d& get_offset() const { return m_offset; }
|
||||
double get_offset(Axis axis) const { return m_offset(axis); }
|
||||
|
@ -403,21 +397,14 @@ public:
|
|||
Vec3d get_scaling_factor() const { return m_scaling_factor; }
|
||||
double get_scaling_factor(Axis axis) const { return m_scaling_factor(axis); }
|
||||
|
||||
#if ENABLE_MIRROR
|
||||
void set_scaling_factor(const Vec3d& scaling_factor);
|
||||
void set_scaling_factor(Axis axis, double scaling_factor);
|
||||
#else
|
||||
void set_scaling_factor(const Vec3d& scaling_factor) { m_scaling_factor = scaling_factor; }
|
||||
void set_scaling_factor(Axis axis, double scaling_factor) { m_scaling_factor(axis) = scaling_factor; }
|
||||
#endif // ENABLE_MIRROR
|
||||
|
||||
#if ENABLE_MIRROR
|
||||
const Vec3d& get_mirror() const { return m_mirror; }
|
||||
double get_mirror(Axis axis) const { return m_mirror(axis); }
|
||||
|
||||
void set_mirror(const Vec3d& mirror);
|
||||
void set_mirror(Axis axis, double mirror);
|
||||
#endif // ENABLE_MIRROR
|
||||
#endif // ENABLE_MODELVOLUME_TRANSFORM
|
||||
|
||||
// To be called on an external mesh
|
||||
|
@ -432,17 +419,9 @@ public:
|
|||
void transform_polygon(Polygon* polygon) const;
|
||||
|
||||
#if ENABLE_MODELVOLUME_TRANSFORM
|
||||
#if ENABLE_MIRROR
|
||||
const Transform3d& world_matrix(bool dont_translate = false, bool dont_rotate = false, bool dont_scale = false, bool dont_mirror = false) const { return m_transformation.world_matrix(dont_translate, dont_rotate, dont_scale, dont_mirror); }
|
||||
const Transform3d& world_matrix(bool dont_translate = false, bool dont_rotate = false, bool dont_scale = false, bool dont_mirror = false) const { return m_transformation.get_matrix(dont_translate, dont_rotate, dont_scale, dont_mirror); }
|
||||
#else
|
||||
const Transform3d& world_matrix(bool dont_translate = false, bool dont_rotate = false, bool dont_scale = false) const { return m_transformation.world_matrix(dont_translate, dont_rotate, dont_scale); }
|
||||
#endif // ENABLE_MIRROR
|
||||
#else
|
||||
#if ENABLE_MIRROR
|
||||
Transform3d world_matrix(bool dont_translate = false, bool dont_rotate = false, bool dont_scale = false, bool dont_mirror = false) const;
|
||||
#else
|
||||
Transform3d world_matrix(bool dont_translate = false, bool dont_rotate = false, bool dont_scale = false) const;
|
||||
#endif // ENABLE_MIRROR
|
||||
#endif // ENABLE_MODELVOLUME_TRANSFORM
|
||||
|
||||
bool is_printable() const { return print_volume_state == PVS_Inside; }
|
||||
|
@ -456,15 +435,9 @@ private:
|
|||
ModelInstance(ModelObject *object, const ModelInstance &other) :
|
||||
m_transformation(other.m_transformation), object(object), print_volume_state(PVS_Inside) {}
|
||||
#else
|
||||
#if ENABLE_MIRROR
|
||||
ModelInstance(ModelObject *object) : m_offset(Vec3d::Zero()), m_rotation(Vec3d::Zero()), m_scaling_factor(Vec3d::Ones()), m_mirror(Vec3d::Ones()), object(object), print_volume_state(PVS_Inside) {}
|
||||
ModelInstance(ModelObject *object, const ModelInstance &other) :
|
||||
m_offset(other.m_offset), m_rotation(other.m_rotation), m_scaling_factor(other.m_scaling_factor), m_mirror(other.m_mirror), object(object), print_volume_state(PVS_Inside) {}
|
||||
#else
|
||||
ModelInstance(ModelObject *object) : m_rotation(Vec3d::Zero()), m_scaling_factor(Vec3d::Ones()), m_offset(Vec3d::Zero()), object(object), print_volume_state(PVS_Inside) {}
|
||||
ModelInstance(ModelObject *object, const ModelInstance &other) :
|
||||
m_rotation(other.m_rotation), m_scaling_factor(other.m_scaling_factor), m_offset(other.m_offset), object(object), print_volume_state(PVS_Inside) {}
|
||||
#endif // ENABLE_MIRROR
|
||||
#endif // ENABLE_MODELVOLUME_TRANSFORM
|
||||
|
||||
explicit ModelInstance(ModelInstance &rhs) = delete;
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
// New selections
|
||||
#define ENABLE_EXTENDED_SELECTION (1 && ENABLE_1_42_0)
|
||||
#define DISABLE_INSTANCES_SYNCH (1 && ENABLE_EXTENDED_SELECTION)
|
||||
// Add mirror components along the three axes in ModelInstance and GLVolume
|
||||
#define ENABLE_MIRROR (1 && ENABLE_1_42_0)
|
||||
// Modified camera target behavior
|
||||
#define ENABLE_MODIFIED_CAMERA_TARGET (1 && ENABLE_1_42_0)
|
||||
// Add Geometry::Transformation class and use it into ModelInstance, ModelVolume and GLVolume
|
||||
|
|
|
@ -201,9 +201,7 @@ GLVolume::GLVolume(float r, float g, float b, float a)
|
|||
: m_offset(Vec3d::Zero())
|
||||
, m_rotation(Vec3d::Zero())
|
||||
, m_scaling_factor(Vec3d::Ones())
|
||||
#if ENABLE_MIRROR
|
||||
, m_mirror(Vec3d::Ones())
|
||||
#endif // ENABLE_MIRROR
|
||||
, m_world_matrix(Transform3f::Identity())
|
||||
, m_world_matrix_dirty(true)
|
||||
, m_transformed_bounding_box_dirty(true)
|
||||
|
@ -332,7 +330,6 @@ void GLVolume::set_scaling_factor(const Vec3d& scaling_factor)
|
|||
}
|
||||
}
|
||||
|
||||
#if ENABLE_MIRROR
|
||||
const Vec3d& GLVolume::get_mirror() const
|
||||
{
|
||||
return m_mirror;
|
||||
|
@ -364,7 +361,6 @@ void GLVolume::set_mirror(Axis axis, double mirror)
|
|||
m_transformed_convex_hull_bounding_box_dirty = true;
|
||||
}
|
||||
}
|
||||
#endif // ENABLE_MIRROR
|
||||
#endif // !ENABLE_MODELVOLUME_TRANSFORM
|
||||
|
||||
void GLVolume::set_convex_hull(const TriangleMesh& convex_hull)
|
||||
|
@ -397,11 +393,7 @@ const Transform3f& GLVolume::world_matrix() const
|
|||
{
|
||||
if (m_world_matrix_dirty)
|
||||
{
|
||||
#if ENABLE_MIRROR
|
||||
m_world_matrix = Geometry::assemble_transform(m_offset, m_rotation, m_scaling_factor, m_mirror).cast<float>();
|
||||
#else
|
||||
m_world_matrix = Geometry::assemble_transform(m_offset, m_rotation, m_scaling_factor).cast<float>();
|
||||
#endif // ENABLE_MIRROR
|
||||
m_world_matrix_dirty = false;
|
||||
}
|
||||
return m_world_matrix;
|
||||
|
@ -816,9 +808,7 @@ std::vector<int> GLVolumeCollection::load_object(
|
|||
v.set_offset(instance->get_offset());
|
||||
v.set_rotation(instance->get_rotation());
|
||||
v.set_scaling_factor(instance->get_scaling_factor());
|
||||
#if ENABLE_MIRROR
|
||||
v.set_mirror(instance->get_mirror());
|
||||
#endif // ENABLE_MIRROR
|
||||
#endif // ENABLE_MODELVOLUME_TRANSFORM
|
||||
}
|
||||
}
|
||||
|
@ -2167,14 +2157,12 @@ int _3DScene::get_in_object_volume_id(wxGLCanvas* canvas, int scene_vol_idx)
|
|||
return s_canvas_mgr.get_in_object_volume_id(canvas, scene_vol_idx);
|
||||
}
|
||||
|
||||
#if ENABLE_MIRROR
|
||||
#if ENABLE_EXTENDED_SELECTION
|
||||
void _3DScene::mirror_selection(wxGLCanvas* canvas, Axis axis)
|
||||
{
|
||||
s_canvas_mgr.mirror_selection(canvas, axis);
|
||||
}
|
||||
#endif // ENABLE_EXTENDED_SELECTION
|
||||
#endif // ENABLE_MIRROR
|
||||
|
||||
void _3DScene::reload_scene(wxGLCanvas* canvas, bool force)
|
||||
{
|
||||
|
|
|
@ -263,10 +263,8 @@ private:
|
|||
Vec3d m_rotation;
|
||||
// Scale factor along the three axes of the volume to be rendered.
|
||||
Vec3d m_scaling_factor;
|
||||
#if ENABLE_MIRROR
|
||||
// Mirroring along the three axes of the volume to be rendered.
|
||||
Vec3d m_mirror;
|
||||
#endif // ENABLE_MIRROR
|
||||
// World matrix of the volume to be rendered.
|
||||
mutable Transform3f m_world_matrix;
|
||||
// Whether or not is needed to recalculate the world matrix.
|
||||
|
@ -358,13 +356,11 @@ public:
|
|||
void set_scaling_factor(const Vec3d& scaling_factor) { m_transformation.set_scaling_factor(scaling_factor); set_bounding_boxes_as_dirty(); }
|
||||
void set_scaling_factor(Axis axis, double scaling_factor) { m_transformation.set_scaling_factor(axis, scaling_factor); set_bounding_boxes_as_dirty(); }
|
||||
|
||||
#if ENABLE_MIRROR
|
||||
const Vec3d& get_mirror() const { return m_transformation.get_mirror(); }
|
||||
double get_mirror(Axis axis) const { return m_transformation.get_mirror(axis); }
|
||||
|
||||
void set_mirror(const Vec3d& mirror) { m_transformation.set_mirror(mirror); set_bounding_boxes_as_dirty(); }
|
||||
void set_mirror(Axis axis, double mirror) { m_transformation.set_mirror(axis, mirror); set_bounding_boxes_as_dirty(); }
|
||||
#endif // ENABLE_MIRROR
|
||||
#else
|
||||
const Vec3d& get_rotation() const;
|
||||
void set_rotation(const Vec3d& rotation);
|
||||
|
@ -374,12 +370,10 @@ public:
|
|||
#endif // ENABLE_EXTENDED_SELECTION
|
||||
void set_scaling_factor(const Vec3d& scaling_factor);
|
||||
|
||||
#if ENABLE_MIRROR
|
||||
const Vec3d& get_mirror() const;
|
||||
double get_mirror(Axis axis) const;
|
||||
void set_mirror(const Vec3d& mirror);
|
||||
void set_mirror(Axis axis, double mirror);
|
||||
#endif // ENABLE_MIRROR
|
||||
|
||||
const Vec3d& get_offset() const;
|
||||
void set_offset(const Vec3d& offset);
|
||||
|
@ -397,7 +391,7 @@ public:
|
|||
int instance_idx() const { return this->composite_id % 1000; }
|
||||
|
||||
#if ENABLE_MODELVOLUME_TRANSFORM
|
||||
const Transform3d& world_matrix() const { return m_transformation.world_matrix(); }
|
||||
const Transform3d& world_matrix() const { return m_transformation.get_matrix(); }
|
||||
#else
|
||||
const Transform3f& world_matrix() const;
|
||||
#endif // ENABLE_MODELVOLUME_TRANSFORM
|
||||
|
@ -634,11 +628,9 @@ public:
|
|||
static int get_first_volume_id(wxGLCanvas* canvas, int obj_idx);
|
||||
static int get_in_object_volume_id(wxGLCanvas* canvas, int scene_vol_idx);
|
||||
|
||||
#if ENABLE_MIRROR
|
||||
#if ENABLE_EXTENDED_SELECTION
|
||||
static void mirror_selection(wxGLCanvas* canvas, Axis axis);
|
||||
#endif // ENABLE_EXTENDED_SELECTION
|
||||
#endif // ENABLE_MIRROR
|
||||
|
||||
static void reload_scene(wxGLCanvas* canvas, bool force);
|
||||
|
||||
|
|
|
@ -1463,7 +1463,6 @@ void GLCanvas3D::Selection::scale(const Vec3d& scale)
|
|||
m_bounding_box_dirty = true;
|
||||
}
|
||||
|
||||
#if ENABLE_MIRROR
|
||||
void GLCanvas3D::Selection::mirror(Axis axis)
|
||||
{
|
||||
if (!m_valid)
|
||||
|
@ -1482,7 +1481,6 @@ void GLCanvas3D::Selection::mirror(Axis axis)
|
|||
|
||||
m_bounding_box_dirty = true;
|
||||
}
|
||||
#endif // ENABLE_MIRROR
|
||||
|
||||
void GLCanvas3D::Selection::translate(unsigned int object_idx, const Vec3d& displacement)
|
||||
{
|
||||
|
@ -1897,9 +1895,7 @@ void GLCanvas3D::Selection::_synchronize_unselected_instances()
|
|||
int instance_idx = volume->instance_idx();
|
||||
const Vec3d& rotation = volume->get_rotation();
|
||||
const Vec3d& scaling_factor = volume->get_scaling_factor();
|
||||
#if ENABLE_MIRROR
|
||||
const Vec3d& mirror = volume->get_mirror();
|
||||
#endif // ENABLE_MIRROR
|
||||
|
||||
// Process unselected instances.
|
||||
for (unsigned int j = 0; j < (unsigned int)m_volumes->size(); ++j)
|
||||
|
@ -1916,9 +1912,7 @@ void GLCanvas3D::Selection::_synchronize_unselected_instances()
|
|||
|
||||
v->set_rotation(rotation);
|
||||
v->set_scaling_factor(scaling_factor);
|
||||
#if ENABLE_MIRROR
|
||||
v->set_mirror(mirror);
|
||||
#endif // ENABLE_MIRROR
|
||||
|
||||
done.insert(j);
|
||||
}
|
||||
|
@ -3608,7 +3602,6 @@ int GLCanvas3D::get_in_object_volume_id(int scene_vol_idx) const
|
|||
return ((0 <= scene_vol_idx) && (scene_vol_idx < (int)m_volumes.volumes.size())) ? m_volumes.volumes[scene_vol_idx]->volume_idx() : -1;
|
||||
}
|
||||
|
||||
#if ENABLE_MIRROR
|
||||
#if ENABLE_EXTENDED_SELECTION
|
||||
void GLCanvas3D::mirror_selection(Axis axis)
|
||||
{
|
||||
|
@ -3617,7 +3610,6 @@ void GLCanvas3D::mirror_selection(Axis axis)
|
|||
wxGetApp().obj_manipul()->update_settings_value(m_selection);
|
||||
}
|
||||
#endif // ENABLE_EXTENDED_SELECTION
|
||||
#endif // ENABLE_MIRROR
|
||||
|
||||
void GLCanvas3D::reload_scene(bool force)
|
||||
{
|
||||
|
@ -6868,7 +6860,6 @@ void GLCanvas3D::_on_flatten()
|
|||
_on_rotate();
|
||||
}
|
||||
|
||||
#if ENABLE_MIRROR
|
||||
void GLCanvas3D::_on_mirror()
|
||||
{
|
||||
if (m_model == nullptr)
|
||||
|
@ -6902,7 +6893,6 @@ void GLCanvas3D::_on_mirror()
|
|||
|
||||
post_event(SimpleEvent(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS));
|
||||
}
|
||||
#endif // ENABLE_MIRROR
|
||||
#else
|
||||
void GLCanvas3D::_on_move(const std::vector<int>& volume_idxs)
|
||||
{
|
||||
|
|
|
@ -504,9 +504,7 @@ public:
|
|||
void translate(const Vec3d& displacement);
|
||||
void rotate(const Vec3d& rotation);
|
||||
void scale(const Vec3d& scale);
|
||||
#if ENABLE_MIRROR
|
||||
void mirror(Axis axis);
|
||||
#endif // ENABLE_MIRROR
|
||||
|
||||
void translate(unsigned int object_idx, const Vec3d& displacement);
|
||||
void translate(unsigned int object_idx, unsigned int instance_idx, const Vec3d& displacement);
|
||||
|
@ -855,11 +853,9 @@ public:
|
|||
int get_first_volume_id(int obj_idx) const;
|
||||
int get_in_object_volume_id(int scene_vol_idx) const;
|
||||
|
||||
#if ENABLE_MIRROR
|
||||
#if ENABLE_EXTENDED_SELECTION
|
||||
void mirror_selection(Axis axis);
|
||||
#endif // ENABLE_EXTENDED_SELECTION
|
||||
#endif // ENABLE_MIRROR
|
||||
|
||||
void reload_scene(bool force);
|
||||
|
||||
|
@ -986,9 +982,7 @@ private:
|
|||
void _on_rotate();
|
||||
void _on_scale();
|
||||
void _on_flatten();
|
||||
#if ENABLE_MIRROR
|
||||
void _on_mirror();
|
||||
#endif // ENABLE_MIRROR
|
||||
#else
|
||||
void _on_move(const std::vector<int>& volume_idxs);
|
||||
#endif // ENABLE_EXTENDED_SELECTION
|
||||
|
|
|
@ -596,7 +596,6 @@ int GLCanvas3DManager::get_in_object_volume_id(wxGLCanvas* canvas, int scene_vol
|
|||
return (it != m_canvases.end()) ? it->second->get_in_object_volume_id(scene_vol_idx) : -1;
|
||||
}
|
||||
|
||||
#if ENABLE_MIRROR
|
||||
#if ENABLE_EXTENDED_SELECTION
|
||||
void GLCanvas3DManager::mirror_selection(wxGLCanvas* canvas, Axis axis)
|
||||
{
|
||||
|
@ -605,7 +604,6 @@ void GLCanvas3DManager::mirror_selection(wxGLCanvas* canvas, Axis axis)
|
|||
it->second->mirror_selection(axis);
|
||||
}
|
||||
#endif // ENABLE_EXTENDED_SELECTION
|
||||
#endif // ENABLE_MIRROR
|
||||
|
||||
void GLCanvas3DManager::reload_scene(wxGLCanvas* canvas, bool force)
|
||||
{
|
||||
|
|
|
@ -163,11 +163,9 @@ public:
|
|||
int get_first_volume_id(wxGLCanvas* canvas, int obj_idx) const;
|
||||
int get_in_object_volume_id(wxGLCanvas* canvas, int scene_vol_idx) const;
|
||||
|
||||
#if ENABLE_MIRROR
|
||||
#if ENABLE_EXTENDED_SELECTION
|
||||
void mirror_selection(wxGLCanvas* canvas, Axis axis);
|
||||
#endif // ENABLE_EXTENDED_SELECTION
|
||||
#endif // ENABLE_MIRROR
|
||||
|
||||
void reload_scene(wxGLCanvas* canvas, bool force);
|
||||
|
||||
|
|
|
@ -935,13 +935,8 @@ void GLGizmoScale3D::on_render(const BoundingBoxf3& box) const
|
|||
// gets angles from first selected volume
|
||||
angles = v->get_rotation();
|
||||
|
||||
#if ENABLE_MIRROR
|
||||
// consider rotation+mirror only components of the transform for offsets
|
||||
offsets_transform = Geometry::assemble_transform(Vec3d::Zero(), angles, Vec3d::Ones(), v->get_mirror());
|
||||
#else
|
||||
// set rotation-only component of transform
|
||||
offsets_transform = Geometry::assemble_transform(Vec3d::Zero(), angles);
|
||||
#endif // ENABLE_MIRROR
|
||||
}
|
||||
else
|
||||
box = selection.get_bounding_box();
|
||||
|
|
|
@ -932,9 +932,7 @@ private:
|
|||
bool layers_height_allowed() const;
|
||||
bool can_delete_all() const;
|
||||
bool can_arrange() const;
|
||||
#if ENABLE_MIRROR
|
||||
bool can_mirror() const;
|
||||
#endif // ENABLE_MIRROR
|
||||
#endif // ENABLE_EXTENDED_SELECTION
|
||||
};
|
||||
|
||||
|
@ -1617,38 +1615,9 @@ void Plater::priv::rotate()
|
|||
|
||||
void Plater::priv::mirror(Axis axis)
|
||||
{
|
||||
#if ENABLE_MIRROR
|
||||
#if ENABLE_EXTENDED_SELECTION
|
||||
_3DScene::mirror_selection(canvas3D, axis);
|
||||
#endif // ENABLE_EXTENDED_SELECTION
|
||||
#else
|
||||
#if ENABLE_EXTENDED_SELECTION
|
||||
int obj_idx = get_selected_object_idx();
|
||||
if (obj_idx == -1)
|
||||
return;
|
||||
|
||||
ModelObject* model_object = model.objects[obj_idx];
|
||||
ModelInstance* model_instance = model_object->instances.front();
|
||||
#else
|
||||
const auto obj_idx = selected_object();
|
||||
if (! obj_idx) { return; }
|
||||
|
||||
auto *model_object = model.objects[*obj_idx];
|
||||
auto *model_instance = model_object->instances[0];
|
||||
#endif // ENABLE_EXTENDED_SELECTION
|
||||
|
||||
// XXX: ?
|
||||
// # apply Z rotation before mirroring
|
||||
// if ($model_instance->rotation != 0) {
|
||||
// $model_object->rotate($model_instance->rotation, Slic3r::Pointf3->new(0, 0, 1));
|
||||
// $_->set_rotation(0) for @{ $model_object->instances };
|
||||
// }
|
||||
|
||||
model_object->mirror(axis);
|
||||
|
||||
selection_changed();
|
||||
update();
|
||||
#endif // ENABLE_MIRROR
|
||||
}
|
||||
|
||||
#if !ENABLE_EXTENDED_SELECTION
|
||||
|
@ -2109,7 +2078,6 @@ bool Plater::priv::init_object_menu()
|
|||
|
||||
object_menu.AppendSeparator();
|
||||
|
||||
#if ENABLE_MIRROR
|
||||
wxMenu* mirror_menu = new wxMenu();
|
||||
if (mirror_menu == nullptr)
|
||||
return false;
|
||||
|
@ -2122,7 +2090,6 @@ bool Plater::priv::init_object_menu()
|
|||
[this](wxCommandEvent&) { mirror(Z); }, "bullet_blue.png", &object_menu);
|
||||
|
||||
wxMenuItem* item_mirror = append_submenu(&object_menu, mirror_menu, wxID_ANY, _(L("Mirror")), _(L("Mirror the selected object")));
|
||||
#endif // ENABLE_MIRROR
|
||||
|
||||
wxMenu* split_menu = new wxMenu();
|
||||
if (split_menu == nullptr)
|
||||
|
@ -2139,9 +2106,7 @@ bool Plater::priv::init_object_menu()
|
|||
// ui updates needs to be binded to the parent panel
|
||||
if (q != nullptr)
|
||||
{
|
||||
#if ENABLE_MIRROR
|
||||
q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_mirror()); }, item_mirror->GetId());
|
||||
#endif // ENABLE_MIRROR
|
||||
q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_delete_object()); }, item_delete->GetId());
|
||||
q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_increase_instances()); }, item_increase->GetId());
|
||||
q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_decrease_instances()); }, item_decrease->GetId());
|
||||
|
@ -2208,12 +2173,10 @@ bool Plater::priv::can_arrange() const
|
|||
return !model.objects.empty();
|
||||
}
|
||||
|
||||
#if ENABLE_MIRROR
|
||||
bool Plater::priv::can_mirror() const
|
||||
{
|
||||
return get_selection().is_from_single_instance();
|
||||
}
|
||||
#endif // ENABLE_MIRROR
|
||||
#endif // ENABLE_EXTENDED_SELECTION
|
||||
|
||||
// Plater / Public
|
||||
|
|
Loading…
Reference in a new issue