Some code simplifications

AnimationNodeBlendSpace2DEditor:
- `!tree` is always false, because it is checked a few lines above

CurveEdit:
- grabbing != GRAB_NONE is redundant

GradientTexture2DEdit:
- grabbed != HANDLE_FROM is redundant
- grabbed != HANDLE_TO is redundant

Viewport:
- index is not used afterwards
- In these cases `gui.mouse_focus` is always valid. Move check to a DEV_ASSERT
- simplify `stopped` calculation
This commit is contained in:
Markus Sauermann 2023-02-08 18:39:05 +01:00
parent 2985a9ac34
commit 5ddab1f363
4 changed files with 9 additions and 22 deletions

View file

@ -213,8 +213,8 @@ void GradientTexture2DEdit::_draw() {
// Draw handles.
const Color focus_modulate = Color(0.5, 1, 2);
bool modulate_handle_from = grabbed == HANDLE_FROM || (grabbed != HANDLE_FROM && hovered == HANDLE_FROM);
bool modulate_handle_to = grabbed == HANDLE_TO || (grabbed != HANDLE_TO && hovered == HANDLE_TO);
bool modulate_handle_from = grabbed == HANDLE_FROM || hovered == HANDLE_FROM;
bool modulate_handle_to = grabbed == HANDLE_TO || hovered == HANDLE_TO;
draw_texture(fill_from_icon, (_get_handle_pos(HANDLE_FROM) - handle_size / 2).round(), modulate_handle_from ? focus_modulate : Color(1, 1, 1));
draw_texture(fill_to_icon, (_get_handle_pos(HANDLE_TO) - handle_size / 2).round(), modulate_handle_to ? focus_modulate : Color(1, 1, 1));
}