Object's properties updated while manipulating gizmos
This commit is contained in:
parent
42567e3af2
commit
677dad0669
@ -1182,10 +1182,6 @@ sub rotate {
|
|||||||
# $self->reset_thumbnail($obj_idx);
|
# $self->reset_thumbnail($obj_idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (defined $axis) {
|
|
||||||
Slic3r::GUI::update_rotation_value(deg2rad($angle), $axis == X ? "x" : ($axis == Y ? "y" : "z"));
|
|
||||||
}
|
|
||||||
|
|
||||||
# update print and start background processing
|
# update print and start background processing
|
||||||
$self->{print}->add_model_object($model_object, $obj_idx);
|
$self->{print}->add_model_object($model_object, $obj_idx);
|
||||||
|
|
||||||
|
@ -3130,6 +3130,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||||||
v->set_offset(v->get_offset() + Vec3d(vector(0), vector(1), 0.0));
|
v->set_offset(v->get_offset() + Vec3d(vector(0), vector(1), 0.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
update_position_values(volume->get_offset());
|
||||||
m_mouse.drag.start_position_3D = cur_pos;
|
m_mouse.drag.start_position_3D = cur_pos;
|
||||||
m_gizmos.refresh();
|
m_gizmos.refresh();
|
||||||
|
|
||||||
@ -3169,6 +3170,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||||||
for (GLVolume* v : volumes)
|
for (GLVolume* v : volumes)
|
||||||
{
|
{
|
||||||
v->set_scaling_factor((double)scale_factor);
|
v->set_scaling_factor((double)scale_factor);
|
||||||
|
update_scale_values((double)scale_factor);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -3179,6 +3181,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||||||
for (GLVolume* v : volumes)
|
for (GLVolume* v : volumes)
|
||||||
{
|
{
|
||||||
v->set_rotation((double)angle_z);
|
v->set_rotation((double)angle_z);
|
||||||
|
update_rotation_value((double)angle_z, Z);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -3195,8 +3198,6 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||||||
}
|
}
|
||||||
const Vec3d& size = bb.size();
|
const Vec3d& size = bb.size();
|
||||||
m_on_update_geometry_info_callback.call(size(0), size(1), size(2), m_gizmos.get_scale());
|
m_on_update_geometry_info_callback.call(size(0), size(1), size(2), m_gizmos.get_scale());
|
||||||
update_scale_values(size, m_gizmos.get_scale());
|
|
||||||
update_rotation_value(volumes[0]->get_rotation(), "z");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((m_gizmos.get_current_type() != Gizmos::Rotate) && (volumes.size() > 1))
|
if ((m_gizmos.get_current_type() != Gizmos::Rotate) && (volumes.size() > 1))
|
||||||
@ -3297,7 +3298,6 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||||||
case Gizmos::Scale:
|
case Gizmos::Scale:
|
||||||
{
|
{
|
||||||
m_on_gizmo_scale_uniformly_callback.call((double)m_gizmos.get_scale());
|
m_on_gizmo_scale_uniformly_callback.call((double)m_gizmos.get_scale());
|
||||||
Slic3r::GUI::update_settings_value();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Gizmos::Rotate:
|
case Gizmos::Rotate:
|
||||||
@ -3309,6 +3309,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
m_gizmos.stop_dragging();
|
m_gizmos.stop_dragging();
|
||||||
|
Slic3r::GUI::update_settings_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_mouse.drag.move_volume_idx = -1;
|
m_mouse.drag.move_volume_idx = -1;
|
||||||
|
@ -1547,7 +1547,7 @@ void update_scale_values()
|
|||||||
auto size = (*m_objects)[m_selected_object_id]->instance_bounding_box(0).size();
|
auto size = (*m_objects)[m_selected_object_id]->instance_bounding_box(0).size();
|
||||||
|
|
||||||
if (g_is_percent_scale) {
|
if (g_is_percent_scale) {
|
||||||
auto scale = instance->scaling_factor * 100;
|
auto scale = instance->scaling_factor * 100.0;
|
||||||
og->set_value("scale_x", int(scale));
|
og->set_value("scale_x", int(scale));
|
||||||
og->set_value("scale_y", int(scale));
|
og->set_value("scale_y", int(scale));
|
||||||
og->set_value("scale_z", int(scale));
|
og->set_value("scale_z", int(scale));
|
||||||
@ -1569,22 +1569,32 @@ void update_position_values()
|
|||||||
og->set_value("position_z", 0);
|
og->set_value("position_z", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_scale_values(const Vec3d& size, float scaling_factor)
|
void update_position_values(const Vec3d& position)
|
||||||
|
{
|
||||||
|
auto og = get_optgroup(ogFrequentlyObjectSettings);
|
||||||
|
auto instance = (*m_objects)[m_selected_object_id]->instances.front();
|
||||||
|
|
||||||
|
og->set_value("position_x", int(position(0)));
|
||||||
|
og->set_value("position_y", int(position(1)));
|
||||||
|
og->set_value("position_z", int(position(2)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void update_scale_values(double scaling_factor)
|
||||||
{
|
{
|
||||||
auto og = get_optgroup(ogFrequentlyObjectSettings);
|
auto og = get_optgroup(ogFrequentlyObjectSettings);
|
||||||
|
|
||||||
if (g_is_percent_scale) {
|
// this is temporary
|
||||||
auto scale = scaling_factor * 100;
|
// to be able to update the values as size
|
||||||
|
// we need to store somewhere the original size
|
||||||
|
// or have it passed as parameter
|
||||||
|
if (!g_is_percent_scale)
|
||||||
|
og->set_value("scale_unit", _("%"));
|
||||||
|
|
||||||
|
auto scale = scaling_factor * 100.0;
|
||||||
og->set_value("scale_x", int(scale));
|
og->set_value("scale_x", int(scale));
|
||||||
og->set_value("scale_y", int(scale));
|
og->set_value("scale_y", int(scale));
|
||||||
og->set_value("scale_z", int(scale));
|
og->set_value("scale_z", int(scale));
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
og->set_value("scale_x", int(size(0) + 0.5));
|
|
||||||
og->set_value("scale_y", int(size(1) + 0.5));
|
|
||||||
og->set_value("scale_z", int(size(2) + 0.5));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void update_rotation_values()
|
void update_rotation_values()
|
||||||
{
|
{
|
||||||
@ -1595,14 +1605,31 @@ void update_rotation_values()
|
|||||||
og->set_value("rotation_z", int(Geometry::rad2deg(instance->rotation)));
|
og->set_value("rotation_z", int(Geometry::rad2deg(instance->rotation)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_rotation_value(const double angle, const std::string& axis)
|
void update_rotation_value(double angle, Axis axis)
|
||||||
{
|
{
|
||||||
auto og = get_optgroup(ogFrequentlyObjectSettings);
|
auto og = get_optgroup(ogFrequentlyObjectSettings);
|
||||||
|
|
||||||
int deg = int(Geometry::rad2deg(angle));
|
std::string axis_str;
|
||||||
// if (deg>180) deg -= 360;
|
switch (axis)
|
||||||
|
{
|
||||||
|
case X:
|
||||||
|
{
|
||||||
|
axis_str = "rotation_x";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Y:
|
||||||
|
{
|
||||||
|
axis_str = "rotation_y";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Z:
|
||||||
|
{
|
||||||
|
axis_str = "rotation_z";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
og->set_value("rotation_"+axis, deg);
|
og->set_value(axis_str, int(Geometry::rad2deg(angle)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_uniform_scaling(const bool uniform_scale)
|
void set_uniform_scaling(const bool uniform_scale)
|
||||||
|
@ -107,14 +107,16 @@ void update_settings_value();
|
|||||||
void set_extruder_column_hidden(bool hide);
|
void set_extruder_column_hidden(bool hide);
|
||||||
// update extruder in current config
|
// update extruder in current config
|
||||||
void update_extruder_in_config(const wxString& selection);
|
void update_extruder_in_config(const wxString& selection);
|
||||||
|
// update position values displacements or "gizmos"
|
||||||
void update_position_values();
|
void update_position_values();
|
||||||
|
void update_position_values(const Vec3d& position);
|
||||||
// update scale values after scale unit changing or "gizmos"
|
// update scale values after scale unit changing or "gizmos"
|
||||||
void update_scale_values();
|
void update_scale_values();
|
||||||
void update_scale_values(const Vec3d& size, float scale);
|
void update_scale_values(double scaling_factor);
|
||||||
// update rotation values object selection changing
|
// update rotation values object selection changing
|
||||||
void update_rotation_values();
|
void update_rotation_values();
|
||||||
// update rotation value after "gizmos"
|
// update rotation value after "gizmos"
|
||||||
void update_rotation_value(const double angle, const std::string& axis);
|
void update_rotation_value(double angle, Axis axis);
|
||||||
void set_uniform_scaling(const bool uniform_scale);
|
void set_uniform_scaling(const bool uniform_scale);
|
||||||
|
|
||||||
void on_begin_drag(wxDataViewEvent &event);
|
void on_begin_drag(wxDataViewEvent &event);
|
||||||
|
@ -155,9 +155,6 @@ void select_current_object(int idx)
|
|||||||
void remove_obj()
|
void remove_obj()
|
||||||
%code%{ Slic3r::GUI::remove(); %};
|
%code%{ Slic3r::GUI::remove(); %};
|
||||||
|
|
||||||
void update_rotation_value(double angle, const char *axis)
|
|
||||||
%code%{ Slic3r::GUI::update_rotation_value(angle, axis); %};
|
|
||||||
|
|
||||||
std::string fold_utf8_to_ascii(const char *src)
|
std::string fold_utf8_to_ascii(const char *src)
|
||||||
%code%{ RETVAL = Slic3r::fold_utf8_to_ascii(src); %};
|
%code%{ RETVAL = Slic3r::fold_utf8_to_ascii(src); %};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user