1
0
Fork 0

Fix: In dialog "Create New Project", select renderer will enable "next" button even if "Project Path" is unavailable

This commit is contained in:
illusory-dream 2025-12-26 11:54:04 +00:00
parent 63227bbc8a
commit d9df586bbb
2 changed files with 17 additions and 2 deletions

View File

@ -51,7 +51,12 @@
void ProjectDialog::_set_message(const String &p_msg, MessageType p_type, InputType p_input_type) {
msg->set_text(p_msg);
get_ok_button()->set_disabled(p_type == MESSAGE_ERROR);
if (p_type == MESSAGE_ERROR) {
invalid_flags.set_flag(ValidationFlags::INVALID_PATH_INPUT);
} else {
invalid_flags.clear_flag(ValidationFlags::INVALID_PATH_INPUT);
}
get_ok_button()->set_disabled(!invalid_flags.is_empty());
Ref<Texture2D> new_icon;
switch (p_type) {
@ -510,11 +515,14 @@ void ProjectDialog::_renderer_selected() {
}
rd_not_supported->set_visible(rd_error);
get_ok_button()->set_disabled(rd_error);
if (rd_error) {
// Needs to be set here since theme colors aren't available at startup.
rd_not_supported->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
invalid_flags.set_flag(ValidationFlags::INVALID_RENDERER_SELECT);
} else {
invalid_flags.clear_flag(ValidationFlags::INVALID_RENDERER_SELECT);
}
get_ok_button()->set_disabled(!invalid_flags.is_empty());
}
void ProjectDialog::_nonempty_confirmation_ok_pressed() {

View File

@ -64,6 +64,11 @@ private:
INSTALL_PATH,
};
enum ValidationFlags {
INVALID_PATH_INPUT = 1,
INVALID_RENDERER_SELECT = 2
};
Mode mode = MODE_NEW;
bool is_folder_empty = true;
ConfirmationDialog *nonempty_confirmation = nullptr;
@ -104,6 +109,8 @@ private:
String original_project_path;
bool duplicate_can_edit = false;
BitField<ValidationFlags> invalid_flags;
void _set_message(const String &p_msg, MessageType p_type, InputType input_type = PROJECT_PATH);
void _validate_path();