Merge pull request #92473 from passivestar/animation-disabled-controls
Fix animation player controls being enabled when no player is selected
This commit is contained in:
commit
6c7ca019d7
2 changed files with 19 additions and 15 deletions
|
@ -881,6 +881,7 @@ void AnimationPlayerEditor::_update_player() {
|
||||||
|
|
||||||
tool_anim->set_disabled(player == nullptr);
|
tool_anim->set_disabled(player == nullptr);
|
||||||
pin->set_disabled(player == nullptr);
|
pin->set_disabled(player == nullptr);
|
||||||
|
_set_controls_disabled(player == nullptr);
|
||||||
|
|
||||||
if (!player) {
|
if (!player) {
|
||||||
AnimationPlayerEditor::get_singleton()->get_track_editor()->update_keying();
|
AnimationPlayerEditor::get_singleton()->get_track_editor()->update_keying();
|
||||||
|
@ -931,17 +932,6 @@ void AnimationPlayerEditor::_update_player() {
|
||||||
ITEM_CHECK_DISABLED(TOOL_NEW_ANIM);
|
ITEM_CHECK_DISABLED(TOOL_NEW_ANIM);
|
||||||
#undef ITEM_CHECK_DISABLED
|
#undef ITEM_CHECK_DISABLED
|
||||||
|
|
||||||
stop->set_disabled(no_anims_found);
|
|
||||||
play->set_disabled(no_anims_found);
|
|
||||||
play_bw->set_disabled(no_anims_found);
|
|
||||||
play_bw_from->set_disabled(no_anims_found);
|
|
||||||
play_from->set_disabled(no_anims_found);
|
|
||||||
frame->set_editable(!no_anims_found);
|
|
||||||
animation->set_disabled(no_anims_found);
|
|
||||||
autoplay->set_disabled(no_anims_found);
|
|
||||||
onion_toggle->set_disabled(no_anims_found);
|
|
||||||
onion_skinning->set_disabled(no_anims_found);
|
|
||||||
|
|
||||||
_update_animation_list_icons();
|
_update_animation_list_icons();
|
||||||
|
|
||||||
updating = false;
|
updating = false;
|
||||||
|
@ -958,7 +948,9 @@ void AnimationPlayerEditor::_update_player() {
|
||||||
_animation_selected(0);
|
_animation_selected(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!no_anims_found) {
|
if (no_anims_found) {
|
||||||
|
_set_controls_disabled(true);
|
||||||
|
} else {
|
||||||
String current = animation->get_item_text(animation->get_selected());
|
String current = animation->get_item_text(animation->get_selected());
|
||||||
Ref<Animation> anim = player->get_animation(current);
|
Ref<Animation> anim = player->get_animation(current);
|
||||||
|
|
||||||
|
@ -974,6 +966,20 @@ void AnimationPlayerEditor::_update_player() {
|
||||||
_update_animation();
|
_update_animation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AnimationPlayerEditor::_set_controls_disabled(bool p_disabled) {
|
||||||
|
frame->set_editable(!p_disabled);
|
||||||
|
|
||||||
|
stop->set_disabled(p_disabled);
|
||||||
|
play->set_disabled(p_disabled);
|
||||||
|
play_bw->set_disabled(p_disabled);
|
||||||
|
play_bw_from->set_disabled(p_disabled);
|
||||||
|
play_from->set_disabled(p_disabled);
|
||||||
|
animation->set_disabled(p_disabled);
|
||||||
|
autoplay->set_disabled(p_disabled);
|
||||||
|
onion_toggle->set_disabled(p_disabled);
|
||||||
|
onion_skinning->set_disabled(p_disabled);
|
||||||
|
}
|
||||||
|
|
||||||
void AnimationPlayerEditor::_update_animation_list_icons() {
|
void AnimationPlayerEditor::_update_animation_list_icons() {
|
||||||
for (int i = 0; i < animation->get_item_count(); i++) {
|
for (int i = 0; i < animation->get_item_count(); i++) {
|
||||||
String anim_name = animation->get_item_text(i);
|
String anim_name = animation->get_item_text(i);
|
||||||
|
@ -1076,9 +1082,6 @@ void AnimationPlayerEditor::_ensure_dummy_player() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make some options disabled.
|
|
||||||
onion_toggle->set_disabled(dummy_exists);
|
|
||||||
onion_skinning->set_disabled(dummy_exists);
|
|
||||||
int selected = animation->get_selected();
|
int selected = animation->get_selected();
|
||||||
autoplay->set_disabled(selected != -1 ? (animation->get_item_text(selected).is_empty() ? true : dummy_exists) : true);
|
autoplay->set_disabled(selected != -1 ? (animation->get_item_text(selected).is_empty() ? true : dummy_exists) : true);
|
||||||
|
|
||||||
|
|
|
@ -206,6 +206,7 @@ class AnimationPlayerEditor : public VBoxContainer {
|
||||||
void _current_animation_changed(const String &p_name);
|
void _current_animation_changed(const String &p_name);
|
||||||
void _update_animation();
|
void _update_animation();
|
||||||
void _update_player();
|
void _update_player();
|
||||||
|
void _set_controls_disabled(bool p_disabled);
|
||||||
void _update_animation_list_icons();
|
void _update_animation_list_icons();
|
||||||
void _update_name_dialog_library_dropdown();
|
void _update_name_dialog_library_dropdown();
|
||||||
void _blend_edited();
|
void _blend_edited();
|
||||||
|
|
Loading…
Add table
Reference in a new issue