mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-15 18:25:55 +08:00
remove unnecessary getting of raw pointer from unique pointer
This commit is contained in:
parent
76ffecd897
commit
209eda75a0
@ -1219,31 +1219,38 @@ bool GLGizmosManager::activate_gizmo(EType type)
|
|||||||
if (m_gizmos.empty() || m_current == type)
|
if (m_gizmos.empty() || m_current == type)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
GLGizmoBase* old_gizmo = m_current == Undefined ? nullptr : m_gizmos[m_current].get();
|
if (m_current != Undefined) {
|
||||||
GLGizmoBase* new_gizmo = type == Undefined ? nullptr : m_gizmos[type].get();
|
// clean up previous gizmo
|
||||||
|
GLGizmoBase &old_gizmo = *m_gizmos[m_current];
|
||||||
if (old_gizmo) {
|
old_gizmo.set_state(GLGizmoBase::Off);
|
||||||
old_gizmo->set_state(GLGizmoBase::Off);
|
if (old_gizmo.get_state() != GLGizmoBase::Off)
|
||||||
if (old_gizmo->get_state() != GLGizmoBase::Off)
|
|
||||||
return false; // gizmo refused to be turned off, do nothing.
|
return false; // gizmo refused to be turned off, do nothing.
|
||||||
|
|
||||||
if (! m_parent.get_gizmos_manager().is_serializing()
|
if (!m_serializing
|
||||||
&& old_gizmo->wants_enter_leave_snapshots())
|
&& old_gizmo.wants_enter_leave_snapshots())
|
||||||
Plater::TakeSnapshot snapshot(wxGetApp().plater(),
|
Plater::TakeSnapshot snapshot(wxGetApp().plater(),
|
||||||
old_gizmo->get_gizmo_leaving_text(),
|
old_gizmo.get_gizmo_leaving_text(),
|
||||||
UndoRedo::SnapshotType::LeavingGizmoWithAction);
|
UndoRedo::SnapshotType::LeavingGizmoWithAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new_gizmo && ! m_parent.get_gizmos_manager().is_serializing()
|
// check deactivation of gizmo
|
||||||
&& new_gizmo->wants_enter_leave_snapshots())
|
if (type == Undefined) {
|
||||||
|
m_current = type;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// set up new gizmo
|
||||||
|
GLGizmoBase& new_gizmo = *m_gizmos[type];
|
||||||
|
if (!m_serializing && new_gizmo.wants_enter_leave_snapshots())
|
||||||
Plater::TakeSnapshot snapshot(wxGetApp().plater(),
|
Plater::TakeSnapshot snapshot(wxGetApp().plater(),
|
||||||
new_gizmo->get_gizmo_entering_text(),
|
new_gizmo.get_gizmo_entering_text(),
|
||||||
UndoRedo::SnapshotType::EnteringGizmo);
|
UndoRedo::SnapshotType::EnteringGizmo);
|
||||||
|
|
||||||
m_current = type;
|
m_current = type;
|
||||||
|
new_gizmo.set_state(GLGizmoBase::On);
|
||||||
|
if (new_gizmo.get_state() != GLGizmoBase::On)
|
||||||
|
return false; // gizmo refused to be turned on.
|
||||||
|
|
||||||
if (new_gizmo)
|
|
||||||
new_gizmo->set_state(GLGizmoBase::On);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,7 +174,6 @@ public:
|
|||||||
|
|
||||||
void refresh_on_off_state();
|
void refresh_on_off_state();
|
||||||
void reset_all_states();
|
void reset_all_states();
|
||||||
bool is_serializing() const { return m_serializing; }
|
|
||||||
bool open_gizmo(EType type);
|
bool open_gizmo(EType type);
|
||||||
bool check_gizmos_closed_except(EType) const;
|
bool check_gizmos_closed_except(EType) const;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user