Merge pull request #70357 from MarcusElg/audioimporthide

Disable properties that don't have an effect in the advanced audio im…
This commit is contained in:
Rémi Verschelde 2022-12-21 09:18:33 +01:00
commit c08736fae0
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 21 additions and 17 deletions

View File

@ -465,12 +465,17 @@ void AudioStreamImportSettings::_settings_changed() {
updating_settings = true; updating_settings = true;
stream->call("set_loop", loop->is_pressed()); stream->call("set_loop", loop->is_pressed());
stream->call("set_loop_offset", loop_offset->get_value()); stream->call("set_loop_offset", loop_offset->get_value());
if (loop->is_pressed()) {
loop_offset->set_editable(true);
} else {
loop_offset->set_editable(false);
}
if (bpm_enabled->is_pressed()) { if (bpm_enabled->is_pressed()) {
stream->call("set_bpm", bpm_edit->get_value()); stream->call("set_bpm", bpm_edit->get_value());
beats_enabled->show(); beats_enabled->set_disabled(false);
beats_edit->show(); beats_edit->set_editable(true);
bar_beats_label->show(); bar_beats_edit->set_editable(true);
bar_beats_edit->show();
double bpm = bpm_edit->get_value(); double bpm = bpm_edit->get_value();
if (bpm > 0) { if (bpm > 0) {
float beat_size = 60 / float(bpm); float beat_size = 60 / float(bpm);
@ -486,10 +491,9 @@ void AudioStreamImportSettings::_settings_changed() {
} else { } else {
stream->call("set_bpm", 0); stream->call("set_bpm", 0);
stream->call("set_bar_beats", 4); stream->call("set_bar_beats", 4);
beats_enabled->hide(); beats_enabled->set_disabled(true);
beats_edit->hide(); beats_edit->set_editable(false);
bar_beats_label->hide(); bar_beats_edit->set_editable(false);
bar_beats_edit->hide();
} }
if (bpm_enabled->is_pressed() && beats_enabled->is_pressed()) { if (bpm_enabled->is_pressed() && beats_enabled->is_pressed()) {
stream->call("set_beat_count", beats_edit->get_value()); stream->call("set_beat_count", beats_edit->get_value());
@ -552,15 +556,6 @@ AudioStreamImportSettings::AudioStreamImportSettings() {
bpm_edit->connect("value_changed", callable_mp(this, &AudioStreamImportSettings::_settings_changed).unbind(1)); bpm_edit->connect("value_changed", callable_mp(this, &AudioStreamImportSettings::_settings_changed).unbind(1));
interactive_hb->add_child(bpm_edit); interactive_hb->add_child(bpm_edit);
interactive_hb->add_spacer(); interactive_hb->add_spacer();
bar_beats_label = memnew(Label(TTR("Bar Beats:")));
interactive_hb->add_child(bar_beats_label);
bar_beats_edit = memnew(SpinBox);
bar_beats_edit->set_tooltip_text(TTR("Configure the Beats Per Bar. This used for music-aware transitions between AudioStreams."));
bar_beats_edit->set_min(2);
bar_beats_edit->set_max(32);
bar_beats_edit->connect("value_changed", callable_mp(this, &AudioStreamImportSettings::_settings_changed).unbind(1));
interactive_hb->add_child(bar_beats_edit);
interactive_hb->add_spacer();
beats_enabled = memnew(CheckBox); beats_enabled = memnew(CheckBox);
beats_enabled->set_text(TTR("Beat Count:")); beats_enabled->set_text(TTR("Beat Count:"));
beats_enabled->connect("toggled", callable_mp(this, &AudioStreamImportSettings::_settings_changed).unbind(1)); beats_enabled->connect("toggled", callable_mp(this, &AudioStreamImportSettings::_settings_changed).unbind(1));
@ -570,6 +565,15 @@ AudioStreamImportSettings::AudioStreamImportSettings() {
beats_edit->set_max(99999); beats_edit->set_max(99999);
beats_edit->connect("value_changed", callable_mp(this, &AudioStreamImportSettings::_settings_changed).unbind(1)); beats_edit->connect("value_changed", callable_mp(this, &AudioStreamImportSettings::_settings_changed).unbind(1));
interactive_hb->add_child(beats_edit); interactive_hb->add_child(beats_edit);
bar_beats_label = memnew(Label(TTR("Bar Beats:")));
interactive_hb->add_child(bar_beats_label);
bar_beats_edit = memnew(SpinBox);
bar_beats_edit->set_tooltip_text(TTR("Configure the Beats Per Bar. This used for music-aware transitions between AudioStreams."));
bar_beats_edit->set_min(2);
bar_beats_edit->set_max(32);
bar_beats_edit->connect("value_changed", callable_mp(this, &AudioStreamImportSettings::_settings_changed).unbind(1));
interactive_hb->add_child(bar_beats_edit);
interactive_hb->add_spacer();
main_vbox->add_margin_child(TTR("Music Playback:"), interactive_hb); main_vbox->add_margin_child(TTR("Music Playback:"), interactive_hb);
color_rect = memnew(ColorRect); color_rect = memnew(ColorRect);