diff options
author | Michael Alexsander Silva Dias <michaelalexsander@protonmail.com> | 2019-04-30 16:18:08 -0300 |
---|---|---|
committer | Michael Alexsander Silva Dias <michaelalexsander@protonmail.com> | 2019-05-02 13:42:21 -0300 |
commit | 3eb5d1b52587b5608f7b3f73a30cb86ec592fdbe (patch) | |
tree | c02db05db96036b81540fae4a9202ae487a14263 /editor | |
parent | acadfe0a4960f3ac6f32c6488d3545d2baea9ddd (diff) |
Hide "Built-in Script" option in the script creation dialog when not possible
Diffstat (limited to 'editor')
-rw-r--r-- | editor/script_create_dialog.cpp | 21 | ||||
-rw-r--r-- | editor/script_create_dialog.h | 1 |
2 files changed, 11 insertions, 11 deletions
diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index fac5bccd17..751ae4fcf7 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -567,23 +567,22 @@ void ScriptCreateDialog::_update_dialog() { } } - if (!_can_be_built_in()) - internal->set_pressed(false); - /* Is Script created or loaded from existing file */ if (is_built_in) { get_ok()->set_text(TTR("Create")); parent_name->set_editable(true); parent_browse_button->set_disabled(false); - internal->set_disabled(!_can_be_built_in()); + internal->set_visible(_can_be_built_in()); + internal_label->set_visible(_can_be_built_in()); _msg_path_valid(true, TTR("Built-in script (into scene file).")); } else if (is_new_script_created) { // New Script Created get_ok()->set_text(TTR("Create")); parent_name->set_editable(true); parent_browse_button->set_disabled(false); - internal->set_disabled(!_can_be_built_in()); + internal->set_visible(_can_be_built_in()); + internal_label->set_visible(_can_be_built_in()); if (is_path_valid) { _msg_path_valid(true, TTR("Will create a new script file.")); } @@ -753,13 +752,13 @@ ScriptCreateDialog::ScriptCreateDialog() { /* Built-in Script */ internal = memnew(CheckButton); + internal->set_h_size_flags(0); internal->connect("pressed", this, "_built_in_pressed"); - hb = memnew(HBoxContainer); - hb->add_child(internal); - l = memnew(Label(TTR("Built-in Script"))); - l->set_align(Label::ALIGN_RIGHT); - gc->add_child(l); - gc->add_child(hb); + internal_label = memnew(Label(TTR("Built-in Script"))); + internal_label->set_text(TTR("Built-in Script")); + internal_label->set_align(Label::ALIGN_RIGHT); + gc->add_child(internal_label); + gc->add_child(internal); /* Path */ diff --git a/editor/script_create_dialog.h b/editor/script_create_dialog.h index 1a3ba3d371..c6dba78f56 100644 --- a/editor/script_create_dialog.h +++ b/editor/script_create_dialog.h @@ -58,6 +58,7 @@ class ScriptCreateDialog : public ConfirmationDialog { Button *path_button; EditorFileDialog *file_browse; CheckButton *internal; + Label *internal_label; VBoxContainer *path_vb; AcceptDialog *alert; CreateDialog *select_class; |