Merge pull request #72447 from TokageItLab/fix-sprite-frames-edit-switching

Fix SpriteFramesEditor is spamming to switch bottom panel
This commit is contained in:
Rémi Verschelde 2023-01-31 13:18:13 +01:00
commit 5f90989c26
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

@ -1523,8 +1523,25 @@ SpriteFramesEditor::SpriteFramesEditor() {
delete_anim->set_disabled(true);
delete_anim->connect("pressed", callable_mp(this, &SpriteFramesEditor::_animation_remove));
autoplay_container = memnew(HBoxContainer);
hbc_animlist->add_child(autoplay_container);
autoplay_container->add_child(memnew(VSeparator));
autoplay = memnew(Button);
autoplay->set_flat(true);
autoplay->set_tooltip_text(TTR("Autoplay on Load"));
autoplay_container->add_child(autoplay);
hbc_animlist->add_child(memnew(VSeparator));
anim_loop = memnew(Button);
anim_loop->set_toggle_mode(true);
anim_loop->set_flat(true);
anim_loop->set_tooltip_text(TTR("Animation Looping"));
anim_loop->connect("pressed", callable_mp(this, &SpriteFramesEditor::_animation_loop_changed));
hbc_animlist->add_child(anim_loop);
anim_speed = memnew(SpinBox);
anim_speed->set_suffix(TTR("FPS"));
anim_speed->set_min(0);
@ -1535,23 +1552,6 @@ SpriteFramesEditor::SpriteFramesEditor() {
anim_speed->connect("value_changed", callable_mp(this, &SpriteFramesEditor::_animation_speed_changed));
hbc_animlist->add_child(anim_speed);
anim_loop = memnew(Button);
anim_loop->set_toggle_mode(true);
anim_loop->set_flat(true);
anim_loop->set_tooltip_text(TTR("Animation Looping"));
anim_loop->connect("pressed", callable_mp(this, &SpriteFramesEditor::_animation_loop_changed));
hbc_animlist->add_child(anim_loop);
autoplay_container = memnew(HBoxContainer);
hbc_animlist->add_child(autoplay_container);
autoplay_container->add_child(memnew(VSeparator));
autoplay = memnew(Button);
autoplay->set_flat(true);
autoplay->set_tooltip_text(TTR("Autoplay on Load"));
autoplay_container->add_child(autoplay);
anim_search_box = memnew(LineEdit);
sub_vb->add_child(anim_search_box);
anim_search_box->set_h_size_flags(SIZE_EXPAND_FILL);
@ -1953,9 +1953,7 @@ void SpriteFramesEditorPlugin::make_visible(bool p_visible) {
EditorNode::get_singleton()->make_bottom_panel_item_visible(frames_editor);
} else {
button->hide();
if (frames_editor->is_visible_in_tree()) {
EditorNode::get_singleton()->hide_bottom_panel();
}
frames_editor->edit(Ref<SpriteFrames>());
}
}