diff options
-rw-r--r-- | editor/project_manager.cpp | 62 | ||||
-rw-r--r-- | modules/gdnative/nativescript/nativescript.cpp | 43 |
2 files changed, 63 insertions, 42 deletions
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 20b94c823f..33b538fd48 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -80,7 +80,7 @@ private: Label *msg; LineEdit *project_path; LineEdit *project_name; - ToolButton *status_btn; + TextureRect *status_rect; FileDialog *fdialog; String zip_path; String zip_title; @@ -92,43 +92,36 @@ private: void set_message(const String &p_msg, MessageType p_type = MESSAGE_SUCCESS) { msg->set_text(p_msg); - Ref<Texture> current_icon = status_btn->get_icon(); + Ref<Texture> current_icon = status_rect->get_texture(); + Ref<Texture> new_icon; switch (p_type) { case MESSAGE_ERROR: { msg->add_color_override("font_color", get_color("error_color", "Editor")); - Ref<Texture> new_icon = get_icon("StatusError", "EditorIcons"); - if (current_icon != new_icon) { + msg->set_modulate(Color(1, 1, 1, 1)); + new_icon = get_icon("StatusError", "EditorIcons"); - status_btn->set_icon(new_icon); - msg->show(); - } } break; case MESSAGE_WARNING: { msg->add_color_override("font_color", get_color("warning_color", "Editor")); - Ref<Texture> new_icon = get_icon("StatusWarning", "EditorIcons"); - if (current_icon != new_icon) { + msg->set_modulate(Color(1, 1, 1, 1)); + new_icon = get_icon("StatusWarning", "EditorIcons"); - status_btn->set_icon(new_icon); - if (current_icon != get_icon("StatusSuccess", "EditorIcons")) - msg->hide(); - } } break; case MESSAGE_SUCCESS: { - msg->add_color_override("font_color", get_color("success_color", "Editor")); - Ref<Texture> new_icon = get_icon("StatusSuccess", "EditorIcons"); - if (current_icon != new_icon) { + msg->set_modulate(Color(1, 1, 1, 0)); + new_icon = get_icon("StatusSuccess", "EditorIcons"); - status_btn->set_icon(new_icon); - msg->hide(); - } } break; } + if (current_icon != new_icon) + status_rect->set_texture(new_icon); + set_size(Size2(500, 0) * EDSCALE); } @@ -176,10 +169,10 @@ private: if (!is_empty) { - set_message(TTR("Your project will be created in a non empty folder (you might want to create a new folder)."), MESSAGE_WARNING); + set_message(TTR("Please choose an empty folder."), MESSAGE_ERROR); memdelete(d); - get_ok()->set_disabled(false); - return valid_path; + get_ok()->set_disabled(true); + return ""; } } else if (d->file_exists("project.godot")) { @@ -190,7 +183,7 @@ private: return ""; } - set_message(TTR("That's a BINGO!")); + set_message(""); memdelete(d); get_ok()->set_disabled(false); return valid_path; @@ -481,13 +474,6 @@ private: } } - void _toggle_message() { - - msg->set_visible(!msg->is_visible()); - if (!msg->is_visible()) - set_size(Size2(500, 0) * EDSCALE); - } - void cancel_pressed() { _remove_created_folder(); @@ -495,7 +481,7 @@ private: project_path->clear(); project_name->clear(); - if (status_btn->get_icon() == get_icon("StatusError", "EditorIcons")) + if (status_rect->get_texture() == get_icon("StatusError", "EditorIcons")) msg->show(); } @@ -514,7 +500,6 @@ protected: ClassDB::bind_method("_path_text_changed", &ProjectDialog::_path_text_changed); ClassDB::bind_method("_path_selected", &ProjectDialog::_path_selected); ClassDB::bind_method("_file_selected", &ProjectDialog::_file_selected); - ClassDB::bind_method("_toggle_message", &ProjectDialog::_toggle_message); ADD_SIGNAL(MethodInfo("project_created")); ADD_SIGNAL(MethodInfo("project_renamed")); } @@ -558,7 +543,8 @@ public: project_name->call_deferred("grab_focus"); create_dir->hide(); - status_btn->hide(); + status_rect->hide(); + msg->hide(); } else { @@ -578,7 +564,8 @@ public: browse->set_disabled(false); browse->show(); create_dir->show(); - status_btn->show(); + status_rect->show(); + msg->show(); if (mode == MODE_IMPORT) { set_title(TTR("Import Existing Project")); @@ -646,9 +633,9 @@ public: pphb->add_child(project_path); // status button - status_btn = memnew(ToolButton); - status_btn->connect("pressed", this, "_toggle_message"); - pphb->add_child(status_btn); + status_rect = memnew(TextureRect); + status_rect->set_stretch_mode(TextureRect::STRETCH_KEEP_CENTERED); + pphb->add_child(status_rect); browse = memnew(Button); browse->set_text(TTR("Browse")); @@ -657,7 +644,6 @@ public: msg = memnew(Label); msg->set_align(Label::ALIGN_CENTER); - msg->hide(); vb->add_child(msg); fdialog = memnew(FileDialog); diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp index cff5d9c9bd..aaa7d634d1 100644 --- a/modules/gdnative/nativescript/nativescript.cpp +++ b/modules/gdnative/nativescript/nativescript.cpp @@ -798,11 +798,33 @@ NativeScriptLanguage *NativeScriptLanguage::singleton; void NativeScriptLanguage::_unload_stuff(bool p_reload) { for (Map<String, Map<StringName, NativeScriptDesc> >::Element *L = library_classes.front(); L; L = L->next()) { - if (p_reload && library_gdnatives[L->key()].is_valid() && !library_gdnatives[L->key()]->get_library()->is_reloadable()) { - continue; + String lib_path = L->key(); + Map<StringName, NativeScriptDesc> classes = L->get(); + + if (p_reload) { + + Map<String, Ref<GDNative> >::Element *E = library_gdnatives.find(lib_path); + Ref<GDNative> gdn; + + if (E) { + gdn = E->get(); + } + + bool should_reload = false; + + if (gdn.is_valid()) { + Ref<GDNativeLibrary> lib = gdn->get_library(); + if (lib.is_valid()) { + should_reload = lib->is_reloadable(); + } + } + + if (!should_reload) { + continue; + } } - for (Map<StringName, NativeScriptDesc>::Element *C = L->get().front(); C; C = C->next()) { + for (Map<StringName, NativeScriptDesc>::Element *C = classes.front(); C; C = C->next()) { // free property stuff first for (OrderedHashMap<StringName, NativeScriptDesc::Property>::Element P = C->get().properties.front(); P; P = P.next()) { @@ -909,7 +931,7 @@ Ref<Script> NativeScriptLanguage::get_template(const String &p_class_name, const return Ref<NativeScript>(s); } bool NativeScriptLanguage::validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path, List<String> *r_functions) const { - return false; + return true; } Script *NativeScriptLanguage::create_script() const { @@ -1063,6 +1085,11 @@ void NativeScriptLanguage::unregister_script(NativeScript *script) { void NativeScriptLanguage::call_libraries_cb(const StringName &name) { // library_gdnatives is modified only from the main thread, so it's safe not to use mutex here for (Map<String, Ref<GDNative> >::Element *L = library_gdnatives.front(); L; L = L->next()) { + + if (L->get().is_null()) { + continue; + } + if (L->get()->is_initialized()) { void *proc_ptr; @@ -1125,6 +1152,10 @@ void NativeReloadNode::_notification(int p_what) { Ref<GDNative> gdn = L->get(); + if (gdn.is_null()) { + continue; + } + if (!gdn->get_library()->is_reloadable()) { continue; } @@ -1149,6 +1180,10 @@ void NativeReloadNode::_notification(int p_what) { Ref<GDNative> gdn = L->get(); + if (gdn.is_null()) { + continue; + } + if (!gdn->get_library()->is_reloadable()) { continue; } |