ENABLE_GIZMO_ICONS_NON_ACTIVABLE_STATE set as default

This commit is contained in:
Enrico Turri 2020-01-17 10:34:32 +01:00
parent 67655743b9
commit dad09c737c
8 changed files with 4 additions and 29 deletions

View file

@ -44,9 +44,6 @@
// Enable adaptive layer height profile
#define ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE (1 && ENABLE_2_2_0_ALPHA1)
// Enable grayed variant for gizmos icons in non activable state
#define ENABLE_GIZMO_ICONS_NON_ACTIVABLE_STATE (1 && ENABLE_2_2_0_ALPHA1)
// Enable fix for view toolbar background not showing up on Mac with dark mode
#define ENABLE_VIEW_TOOLBAR_BACKGROUND_FIX (1 && ENABLE_2_2_0_ALPHA1)

View file

@ -276,12 +276,12 @@ bool GLTexture::load_from_svg_files_as_sprites_array(const std::vector<std::stri
#if ENABLE_MODIFIED_TOOLBAR_TEXTURES
float inv_255 = 1.0f / 255.0f;
// offset by 1 to leave the first pixel empty (both in x and y)
for (int r = 1; r <= sprite_size_px; ++r)
for (unsigned int r = 1; r <= sprite_size_px; ++r)
{
int offset_r = r * sprite_size_px_ex;
for (int c = 1; c <= sprite_size_px; ++c)
unsigned int offset_r = r * sprite_size_px_ex;
for (unsigned int c = 1; c <= sprite_size_px; ++c)
{
int offset = (offset_r + c) * 4;
unsigned int offset = (offset_r + c) * 4;
float alpha = (float)output_data.data()[offset + 3] * inv_255;
output_data.data()[offset + 0] = (unsigned char)(output_data.data()[offset + 0] * alpha);
output_data.data()[offset + 1] = (unsigned char)(output_data.data()[offset + 1] * alpha);

View file

@ -48,12 +48,10 @@ std::string GLGizmoMove3D::on_get_name() const
return (_(L("Move")) + " [M]").ToUTF8().data();
}
#if ENABLE_GIZMO_ICONS_NON_ACTIVABLE_STATE
bool GLGizmoMove3D::on_is_activable() const
{
return !m_parent.get_selection().is_empty();
}
#endif // ENABLE_GIZMO_ICONS_NON_ACTIVABLE_STATE
void GLGizmoMove3D::on_start_dragging()
{

View file

@ -33,9 +33,7 @@ public:
protected:
virtual bool on_init();
virtual std::string on_get_name() const;
#if ENABLE_GIZMO_ICONS_NON_ACTIVABLE_STATE
virtual bool on_is_activable() const;
#endif // ENABLE_GIZMO_ICONS_NON_ACTIVABLE_STATE
virtual void on_start_dragging();
virtual void on_stop_dragging();
virtual void on_update(const UpdateData& data);

View file

@ -449,12 +449,10 @@ std::string GLGizmoRotate3D::on_get_name() const
return (_(L("Rotate")) + " [R]").ToUTF8().data();
}
#if ENABLE_GIZMO_ICONS_NON_ACTIVABLE_STATE
bool GLGizmoRotate3D::on_is_activable() const
{
return !m_parent.get_selection().is_empty();
}
#endif // ENABLE_GIZMO_ICONS_NON_ACTIVABLE_STATE
void GLGizmoRotate3D::on_start_dragging()
{

View file

@ -104,9 +104,7 @@ protected:
if (id < 3)
m_gizmos[id].disable_grabber(0);
}
#if ENABLE_GIZMO_ICONS_NON_ACTIVABLE_STATE
virtual bool on_is_activable() const;
#endif // ENABLE_GIZMO_ICONS_NON_ACTIVABLE_STATE
virtual void on_start_dragging();
virtual void on_stop_dragging();
virtual void on_update(const UpdateData& data)

View file

@ -49,12 +49,8 @@ std::string GLGizmoScale3D::on_get_name() const
bool GLGizmoScale3D::on_is_activable() const
{
#if ENABLE_GIZMO_ICONS_NON_ACTIVABLE_STATE
const Selection& selection = m_parent.get_selection();
return !selection.is_empty() && !selection.is_wipe_tower();
#else
return !m_parent.get_selection().is_wipe_tower();
#endif // ENABLE_GIZMO_ICONS_NON_ACTIVABLE_STATE
}
void GLGizmoScale3D::on_start_dragging()

View file

@ -881,11 +881,7 @@ void GLGizmosManager::do_render_overlay() const
if ((icons_texture_id == 0) || (tex_width <= 1) || (tex_height <= 1))
return;
#if ENABLE_GIZMO_ICONS_NON_ACTIVABLE_STATE
float du = (float)(tex_width - 1) / (4.0f * (float)tex_width); // 4 is the number of possible states if the icons
#else
float du = (float)(tex_width - 1) / (3.0f * (float)tex_width); // 3 is the number of possible states if the icons
#endif // ENABLE_GIZMO_ICONS_NON_ACTIVABLE_STATE
float dv = (float)(tex_height - 1) / (float)(m_gizmos.size() * tex_height);
// tiles in the texture are spaced by 1 pixel
@ -908,11 +904,7 @@ void GLGizmosManager::do_render_overlay() const
GLGizmoBase* gizmo = m_gizmos[idx].get();
unsigned int sprite_id = gizmo->get_sprite_id();
#if ENABLE_GIZMO_ICONS_NON_ACTIVABLE_STATE
int icon_idx = (m_current == idx) ? 2 : ((m_hover == idx) ? 1 : (gizmo->is_activable()? 0 : 3));
#else
int icon_idx = m_current == idx ? 2 : (m_hover == idx ? 1 : 0);
#endif // ENABLE_GIZMO_ICONS_NON_ACTIVABLE_STATE
#if ENABLE_MODIFIED_TOOLBAR_TEXTURES
float v_top = v_offset + sprite_id * dv;
@ -971,9 +963,7 @@ bool GLGizmosManager::generate_icons_texture() const
states.push_back(std::make_pair(1, false)); // Activable
states.push_back(std::make_pair(0, false)); // Hovered
states.push_back(std::make_pair(0, true)); // Selected
#if ENABLE_GIZMO_ICONS_NON_ACTIVABLE_STATE
states.push_back(std::make_pair(2, false)); // Disabled
#endif // ENABLE_GIZMO_ICONS_NON_ACTIVABLE_STATE
unsigned int sprite_size_px = (unsigned int)m_layout.scaled_icons_size();
// // force even size