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

@ -860,7 +860,7 @@ void CurveEdit::_redraw() {
const Color selected_point_color = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
// Draw tangents if not dragging a point, or if holding a point without having moved it yet.
if (grabbing == GRAB_NONE || (grabbing != GRAB_NONE && (initial_grab_pos == point_pos || selected_tangent_index != TANGENT_NONE))) {
if (grabbing == GRAB_NONE || initial_grab_pos == point_pos || selected_tangent_index != TANGENT_NONE) {
const Color selected_tangent_color = get_theme_color(SNAME("accent_color"), SNAME("Editor")).darkened(0.25);
const Color tangent_color = get_theme_color(SNAME("font_color"), SNAME("Editor")).darkened(0.25);