ENH:use local cs for non_model_part better
jira: STUDIO-7234 Change-Id: I0f0e99429e5e0b7cc4932a661eceffcff4a495f6 (cherry picked from commit b4305a3bfc9e5ae05c1785a710238a70f2dfb44a)
This commit is contained in:
parent
4f5922f193
commit
b28ac4f812
|
@ -50,6 +50,11 @@ std::string GLGizmoMove3D::get_tooltip() const
|
|||
return "";
|
||||
}
|
||||
|
||||
void GLGizmoMove3D::data_changed(bool is_serializing)
|
||||
{
|
||||
change_cs_by_selection();
|
||||
}
|
||||
|
||||
bool GLGizmoMove3D::on_init()
|
||||
{
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
|
@ -78,8 +83,9 @@ bool GLGizmoMove3D::on_is_activable() const
|
|||
|
||||
void GLGizmoMove3D::on_set_state() {
|
||||
if (get_state() == On) {
|
||||
m_object_manipulation->set_coordinates_type(ECoordinatesType::World);
|
||||
m_object_manipulation->set_use_object_cs(false);
|
||||
m_last_selected_obejct_idx = -1;
|
||||
m_last_selected_volume_idx = -1;
|
||||
change_cs_by_selection();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -274,6 +280,28 @@ void GLGizmoMove3D::render_grabber_extension(Axis axis, const BoundingBoxf3& box
|
|||
shader->stop_using();
|
||||
}
|
||||
|
||||
void GLGizmoMove3D::change_cs_by_selection() {
|
||||
int obejct_idx, volume_idx;
|
||||
ModelVolume *model_volume = m_parent.get_selection().get_selected_single_volume(obejct_idx, volume_idx);
|
||||
if (m_last_selected_obejct_idx == obejct_idx && m_last_selected_volume_idx == volume_idx) {
|
||||
return;
|
||||
}
|
||||
m_last_selected_obejct_idx = obejct_idx;
|
||||
m_last_selected_volume_idx = volume_idx;
|
||||
if (m_parent.get_selection().is_multiple_full_instance() || m_parent.get_selection().is_single_full_instance()) {
|
||||
m_object_manipulation->set_use_object_cs(false);
|
||||
}
|
||||
else if (model_volume && model_volume->is_model_part()) {
|
||||
m_object_manipulation->set_use_object_cs(false);
|
||||
} else {
|
||||
m_object_manipulation->set_use_object_cs(true);
|
||||
}
|
||||
if (m_object_manipulation->get_use_object_cs()) {
|
||||
m_object_manipulation->set_coordinates_type(ECoordinatesType::Instance);
|
||||
} else {
|
||||
m_object_manipulation->set_coordinates_type(ECoordinatesType::World);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace GUI
|
||||
|
|
|
@ -43,6 +43,7 @@ public:
|
|||
const Vec3d& get_displacement() const { return m_displacement; }
|
||||
|
||||
std::string get_tooltip() const override;
|
||||
void data_changed(bool is_serializing) override;
|
||||
|
||||
protected:
|
||||
virtual bool on_init() override;
|
||||
|
@ -61,6 +62,9 @@ protected:
|
|||
private:
|
||||
double calc_projection(const UpdateData& data) const;
|
||||
void render_grabber_extension(Axis axis, const BoundingBoxf3& box, bool picking) const;
|
||||
void change_cs_by_selection(); //cs mean Coordinate System
|
||||
private:
|
||||
int m_last_selected_obejct_idx, m_last_selected_volume_idx;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -106,7 +106,8 @@ public:
|
|||
|
||||
void set_uniform_scaling(const bool uniform_scale);
|
||||
bool get_uniform_scaling() const { return m_uniform_scale; }
|
||||
void set_use_object_cs(bool flag) { m_use_object_cs = flag; }
|
||||
void set_use_object_cs(bool flag){ if (m_use_object_cs != flag) m_use_object_cs = flag; }
|
||||
bool get_use_object_cs() { return m_use_object_cs; }
|
||||
// Does the object manipulation panel work in World or Local coordinates?
|
||||
void set_coordinates_type(ECoordinatesType type);
|
||||
ECoordinatesType get_coordinates_type() const { return m_coordinates_type; }
|
||||
|
|
Loading…
Reference in New Issue