Trying to engage support creation when the gizmo gets disabled.

This commit is contained in:
tamasmeszaros 2018-11-06 18:01:18 +01:00
parent a49b506121
commit 22c9c5ae95
11 changed files with 76 additions and 33 deletions

View file

@ -78,7 +78,17 @@ public:
void set_group_id(int id) { m_group_id = id; }
EState get_state() const { return m_state; }
void set_state(EState state) { m_state = state; on_set_state(); }
void set_state(EState state) {
// FIXME: this is my workaround to react on the disabling event (Tamas)
bool call_deactivate = ((m_state == On || m_state == Hover) &&
state == Off);
m_state = state; on_set_state();
if(call_deactivate) {
on_deactivate();
}
}
bool is_activable(const GLCanvas3D::Selection& selection) const { return on_is_activable(selection); }
@ -110,6 +120,7 @@ protected:
virtual bool on_init() = 0;
virtual std::string on_get_name() const = 0;
virtual void on_set_state() {}
virtual void on_deactivate() {} // FIXME: how to react to disabling the Gizmo? (Tamas)
virtual void on_set_hover_id() {}
virtual bool on_is_activable(const GLCanvas3D::Selection& selection) const { return true; }
virtual void on_enable_grabber(unsigned int id) {}
@ -415,9 +426,13 @@ private:
protected:
void on_set_state() override {
if (m_state == On && is_mesh_update_necessary())
if (m_state == On && is_mesh_update_necessary()) {
update_mesh();
}
}
void on_deactivate() override;
std::string on_get_name() const override;
};