Tweaks to update of object properties on gui
This commit is contained in:
parent
b9e6f8f3e3
commit
df594fc5b0
@ -1368,13 +1368,20 @@ void update_settings_value()
|
||||
{
|
||||
auto og = get_optgroup(ogFrequentlyObjectSettings);
|
||||
if (m_selected_object_id < 0 || m_objects->size() <= m_selected_object_id) {
|
||||
og->set_value("scale_x", 0);
|
||||
og->set_value("position_x", 0);
|
||||
og->set_value("position_y", 0);
|
||||
og->set_value("position_z", 0);
|
||||
og->set_value("scale_x", 0);
|
||||
og->set_value("scale_y", 0);
|
||||
og->set_value("scale_z", 0);
|
||||
og->set_value("rotation_x", 0);
|
||||
og->set_value("rotation_y", 0);
|
||||
og->set_value("rotation_z", 0);
|
||||
og->disable();
|
||||
return;
|
||||
}
|
||||
g_is_percent_scale = boost::any_cast<wxString>(og->get_value("scale_unit")) == _("%");
|
||||
update_position_values();
|
||||
update_scale_values();
|
||||
update_rotation_values();
|
||||
og->enable();
|
||||
@ -1535,8 +1542,31 @@ void update_extruder_in_config(const wxString& selection)
|
||||
|
||||
void update_scale_values()
|
||||
{
|
||||
update_scale_values((*m_objects)[m_selected_object_id]->instance_bounding_box(0).size(),
|
||||
(*m_objects)[m_selected_object_id]->instances[0]->scaling_factor);
|
||||
auto og = get_optgroup(ogFrequentlyObjectSettings);
|
||||
auto instance = (*m_objects)[m_selected_object_id]->instances.front();
|
||||
auto size = (*m_objects)[m_selected_object_id]->instance_bounding_box(0).size();
|
||||
|
||||
if (g_is_percent_scale) {
|
||||
auto scale = instance->scaling_factor * 100;
|
||||
og->set_value("scale_x", int(scale));
|
||||
og->set_value("scale_y", int(scale));
|
||||
og->set_value("scale_z", int(scale));
|
||||
}
|
||||
else {
|
||||
og->set_value("scale_x", int(instance->scaling_factor * size(0) + 0.5));
|
||||
og->set_value("scale_y", int(instance->scaling_factor * size(1) + 0.5));
|
||||
og->set_value("scale_z", int(instance->scaling_factor * size(2) + 0.5));
|
||||
}
|
||||
}
|
||||
|
||||
void update_position_values()
|
||||
{
|
||||
auto og = get_optgroup(ogFrequentlyObjectSettings);
|
||||
auto instance = (*m_objects)[m_selected_object_id]->instances.front();
|
||||
|
||||
og->set_value("position_x", int(instance->offset(0)));
|
||||
og->set_value("position_y", int(instance->offset(1)));
|
||||
og->set_value("position_z", 0);
|
||||
}
|
||||
|
||||
void update_scale_values(const Vec3d& size, float scaling_factor)
|
||||
@ -1559,15 +1589,10 @@ void update_scale_values(const Vec3d& size, float scaling_factor)
|
||||
void update_rotation_values()
|
||||
{
|
||||
auto og = get_optgroup(ogFrequentlyObjectSettings);
|
||||
|
||||
auto instance = (*m_objects)[m_selected_object_id]->instances.front();
|
||||
og->set_value("rotation_x", 0);
|
||||
og->set_value("rotation_y", 0);
|
||||
|
||||
auto rotation_z = (*m_objects)[m_selected_object_id]->instances[0]->rotation;
|
||||
auto deg = int(Geometry::rad2deg(rotation_z));
|
||||
// if (deg > 180) deg -= 360;
|
||||
|
||||
og->set_value("rotation_z", deg);
|
||||
og->set_value("rotation_z", int(Geometry::rad2deg(instance->rotation)));
|
||||
}
|
||||
|
||||
void update_rotation_value(const double angle, const std::string& axis)
|
||||
|
@ -107,6 +107,7 @@ void update_settings_value();
|
||||
void set_extruder_column_hidden(bool hide);
|
||||
// update extruder in current config
|
||||
void update_extruder_in_config(const wxString& selection);
|
||||
void update_position_values();
|
||||
// update scale values after scale unit changing or "gizmos"
|
||||
void update_scale_values();
|
||||
void update_scale_values(const Vec3d& size, float scale);
|
||||
|
Loading…
Reference in New Issue
Block a user