Merge pull request #92870 from KoBeWi/maybe_RESET_a_bit_less
Don't allow creating invalid RESET keys
This commit is contained in:
commit
e988c1a682
|
@ -2934,7 +2934,7 @@ void AnimationTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
|
|||
}
|
||||
if (selected || editor->is_selection_active()) {
|
||||
AnimationPlayer *player = AnimationPlayerEditor::get_singleton()->get_player();
|
||||
if (!player->has_animation(SceneStringName(RESET)) || animation != player->get_animation(SceneStringName(RESET))) {
|
||||
if ((!player->has_animation(SceneStringName(RESET)) || animation != player->get_animation(SceneStringName(RESET))) && editor->can_add_reset_key()) {
|
||||
menu->add_icon_item(get_editor_theme_icon(SNAME("Reload")), TTR("Add RESET Value(s)"), MENU_KEY_ADD_RESET);
|
||||
}
|
||||
|
||||
|
@ -4529,6 +4529,16 @@ bool AnimationTrackEditor::is_snap_enabled() const {
|
|||
return snap->is_pressed() ^ Input::get_singleton()->is_key_pressed(Key::CMD_OR_CTRL);
|
||||
}
|
||||
|
||||
bool AnimationTrackEditor::can_add_reset_key() const {
|
||||
for (const KeyValue<SelectedKey, KeyInfo> &E : selection) {
|
||||
const Animation::TrackType track_type = animation->track_get_type(E.key.track);
|
||||
if (track_type != Animation::TYPE_ANIMATION && track_type != Animation::TYPE_AUDIO && track_type != Animation::TYPE_METHOD) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void AnimationTrackEditor::_update_tracks() {
|
||||
int selected = _get_track_selected();
|
||||
|
||||
|
@ -6621,6 +6631,11 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
|
|||
for (const KeyValue<SelectedKey, KeyInfo> &E : selection) {
|
||||
const SelectedKey &sk = E.key;
|
||||
|
||||
const Animation::TrackType track_type = animation->track_get_type(E.key.track);
|
||||
if (track_type == Animation::TYPE_ANIMATION || track_type == Animation::TYPE_AUDIO || track_type == Animation::TYPE_METHOD) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Only add one key per track.
|
||||
if (tracks_added.has(sk.track)) {
|
||||
continue;
|
||||
|
|
|
@ -727,6 +727,7 @@ public:
|
|||
bool is_key_clipboard_active() const;
|
||||
bool is_moving_selection() const;
|
||||
bool is_snap_enabled() const;
|
||||
bool can_add_reset_key() const;
|
||||
float get_moving_selection_offset() const;
|
||||
float snap_time(float p_value, bool p_relative = false);
|
||||
bool is_grouping_tracks();
|
||||
|
|
Loading…
Reference in New Issue