diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-09-30 23:52:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-30 23:52:46 +0200 |
commit | 77721b35ba21f2e7e8bb42cf415fccb018517843 (patch) | |
tree | 96b8f7532ae5d923b75bfbac8d6763015b6646bb /editor/animation_bezier_editor.cpp | |
parent | 3e1b6304613855cad56938e8a58848f09363a298 (diff) | |
parent | c63b18507d21b8a213c073bced9057b571cdcd7a (diff) |
Merge pull request #51409 from LightningAA/use-map-iterators
Use range iterators for `Map` in most cases
Diffstat (limited to 'editor/animation_bezier_editor.cpp')
-rw-r--r-- | editor/animation_bezier_editor.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp index 28642f1bb4..02b4a12b92 100644 --- a/editor/animation_bezier_editor.cpp +++ b/editor/animation_bezier_editor.cpp @@ -398,17 +398,17 @@ void AnimationBezierTrackEdit::_notification(int p_what) { float scale = timeline->get_zoom_scale(); Ref<Texture2D> point = get_theme_icon(SNAME("KeyValue"), SNAME("EditorIcons")); - for (Map<int, Color>::Element *E = subtrack_colors.front(); E; E = E->next()) { - _draw_track(E->key(), E->get()); + for (const KeyValue<int, Color> &E : subtrack_colors) { + _draw_track(E.key, E.value); - for (int i = 0; i < animation->track_get_key_count(E->key()); i++) { - float offset = animation->track_get_key_time(E->key(), i); - float value = animation->bezier_track_get_key_value(E->key(), i); + for (int i = 0; i < animation->track_get_key_count(E.key); i++) { + float offset = animation->track_get_key_time(E.key, i); + float value = animation->bezier_track_get_key_value(E.key, i); Vector2 pos((offset - timeline->get_value()) * scale + limit, _bezier_h_to_pixel(value)); if (pos.x >= limit && pos.x <= right_limit) { - draw_texture(point, pos - point->get_size() / 2, E->get()); + draw_texture(point, pos - point->get_size() / 2, E.value); } } } @@ -680,9 +680,9 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) { emit_signal(SNAME("close_request")); return; } - for (Map<int, Rect2>::Element *E = subtracks.front(); E; E = E->next()) { - if (E->get().has_point(mb->get_position())) { - set_animation_and_track(animation, E->key()); + for (const KeyValue<int, Rect2> &E : subtracks) { + if (E.value.has_point(mb->get_position())) { + set_animation_and_track(animation, E.key); _clear_selection(); return; } |