diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/create_dialog.cpp | 19 | ||||
-rw-r--r-- | editor/editor_properties.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/particles_2d_editor_plugin.cpp | 15 | ||||
-rw-r--r-- | editor/plugins/particles_editor_plugin.cpp | 1 | ||||
-rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 29 | ||||
-rw-r--r-- | editor/plugins/script_editor_plugin.h | 1 | ||||
-rw-r--r-- | editor/script_editor_debugger.cpp | 27 | ||||
-rw-r--r-- | editor/script_editor_debugger.h | 2 |
8 files changed, 76 insertions, 20 deletions
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index ab7a7054eb..8433f4ff7b 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -158,12 +158,15 @@ Ref<Texture> CreateDialog::_get_editor_icon(const String &p_type) const { } if (ScriptServer::is_global_class(p_type)) { - RES icon = ResourceLoader::load(EditorNode::get_editor_data().script_class_get_icon_path(p_type)); - if (icon.is_valid()) - return icon; - icon = get_icon(ScriptServer::get_global_class_base(p_type), "EditorIcons"); - if (icon.is_valid()) - return icon; + String icon_path = EditorNode::get_editor_data().script_class_get_icon_path(p_type); + RES icon; + if (FileAccess::exists(icon_path)) { + icon = ResourceLoader::load(icon_path); + } + if (!icon.is_valid()) { + icon = get_icon(ScriptServer::get_global_class_base(p_type), "EditorIcons"); + } + return icon; } const Map<String, Vector<EditorData::CustomType> > &p_map = EditorNode::get_editor_data().get_custom_types(); @@ -582,7 +585,7 @@ void CreateDialog::_history_selected() { if (!item) return; - search_box->set_text(item->get_text(0)); + search_box->set_text(item->get_text(0).get_slicec(' ', 0)); _update_search(); } @@ -592,7 +595,7 @@ void CreateDialog::_favorite_selected() { if (!item) return; - search_box->set_text(item->get_text(0)); + search_box->set_text(item->get_text(0).get_slicec(' ', 0)); _update_search(); } diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 59798bfab3..0cbd5f0bff 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -2052,7 +2052,7 @@ void EditorPropertyResource::_menu_option(int p_which) { ERR_BREAK(!resp); if (get_edited_object() && base_type != String() && base_type == "Script") { //make visual script the right type - res->call("set_instance_base_type", get_edited_object()->get_class()); + resp->call("set_instance_base_type", get_edited_object()->get_class()); } res = Ref<Resource>(resp); diff --git a/editor/plugins/particles_2d_editor_plugin.cpp b/editor/plugins/particles_2d_editor_plugin.cpp index c2b17189ef..b50e0dfe88 100644 --- a/editor/plugins/particles_2d_editor_plugin.cpp +++ b/editor/plugins/particles_2d_editor_plugin.cpp @@ -68,6 +68,11 @@ void Particles2DEditorPlugin::_menu_callback(int p_idx) { switch (p_idx) { case MENU_GENERATE_VISIBILITY_RECT: { + float gen_time = particles->get_lifetime(); + if (gen_time < 1.0) + generate_seconds->set_value(1.0); + else + generate_seconds->set_value(trunc(gen_time) + 1.0); generate_aabb->popup_centered_minsize(); } break; case MENU_LOAD_EMISSION_MASK: { @@ -90,6 +95,12 @@ void Particles2DEditorPlugin::_generate_visibility_rect() { EditorProgress ep("gen_aabb", TTR("Generating AABB"), int(time)); + bool was_emitting = particles->is_emitting(); + if (!was_emitting) { + particles->set_emitting(true); + OS::get_singleton()->delay_usec(1000); + } + Rect2 rect; while (running < time) { @@ -106,6 +117,10 @@ void Particles2DEditorPlugin::_generate_visibility_rect() { running += (OS::get_singleton()->get_ticks_usec() - ticks) / 1000000.0; } + if (!was_emitting) { + particles->set_emitting(false); + } + particles->set_visibility_rect(rect); } diff --git a/editor/plugins/particles_editor_plugin.cpp b/editor/plugins/particles_editor_plugin.cpp index 7732103220..6a99dcb9a5 100644 --- a/editor/plugins/particles_editor_plugin.cpp +++ b/editor/plugins/particles_editor_plugin.cpp @@ -335,7 +335,6 @@ void ParticlesEditor::_generate_aabb() { OS::get_singleton()->delay_usec(1000); } - running = 0.0; AABB rect; while (running < time) { diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index b90cfb479d..1bb7c98114 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -842,6 +842,19 @@ bool ScriptEditor::_test_script_times_on_disk(RES p_for_script) { void ScriptEditor::_file_dialog_action(String p_file) { switch (file_dialog_option) { + case FILE_NEW_TEXTFILE: { + Error err; + FileAccess *file = FileAccess::open(p_file, FileAccess::WRITE, &err); + if (err) { + memdelete(file); + editor->show_warning(TTR("Error writing TextFile:") + "\n" + p_file, TTR("Error!")); + break; + } + file->close(); + memdelete(file); + + // fallthrough to open the file. + } case FILE_OPEN: { List<String> extensions; @@ -870,7 +883,7 @@ void ScriptEditor::_file_dialog_action(String p_file) { file_dialog_option = -1; return; } - } + } break; case FILE_SAVE_AS: { ScriptEditorBase *current = _get_current_editor(); @@ -929,6 +942,15 @@ void ScriptEditor::_menu_option(int p_option) { script_create_dialog->config("Node", ".gd"); script_create_dialog->popup_centered(Size2(300, 300) * EDSCALE); } break; + case FILE_NEW_TEXTFILE: { + file_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE); + file_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM); + file_dialog_option = FILE_NEW_TEXTFILE; + + file_dialog->clear_filters(); + file_dialog->popup_centered_ratio(); + file_dialog->set_title(TTR("New TextFile...")); + } break; case FILE_OPEN: { file_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILE); file_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM); @@ -1937,7 +1959,7 @@ bool ScriptEditor::edit(const RES &p_resource, int p_line, int p_col, bool p_gra if (!se) continue; - if (se->get_edited_resource() == p_resource) { + if ((script != NULL && se->get_edited_resource() == p_resource) || se->get_edited_resource()->get_path() == p_resource->get_path()) { if (should_open) { if (tab_container->get_current_tab() != i) { @@ -2974,7 +2996,8 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { menu_hb->add_child(file_menu); file_menu->set_text(TTR("File")); file_menu->get_popup()->set_hide_on_window_lose_focus(true); - file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/new", TTR("New")), FILE_NEW); + file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/new", TTR("New Script")), FILE_NEW); + file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/new_textfile", TTR("New TextFile")), FILE_NEW_TEXTFILE); file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/open", TTR("Open")), FILE_OPEN); file_menu->get_popup()->add_submenu_item(TTR("Open Recent"), "RecentScripts", FILE_OPEN_RECENT); diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h index 186c80a5f9..737f17358b 100644 --- a/editor/plugins/script_editor_plugin.h +++ b/editor/plugins/script_editor_plugin.h @@ -130,6 +130,7 @@ class ScriptEditor : public PanelContainer { EditorNode *editor; enum { FILE_NEW, + FILE_NEW_TEXTFILE, FILE_OPEN, FILE_OPEN_RECENT, FILE_SAVE, diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp index bd661ade53..97147535c0 100644 --- a/editor/script_editor_debugger.cpp +++ b/editor/script_editor_debugger.cpp @@ -734,7 +734,10 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da error_list->set_item_metadata(error_list->get_item_count() - 1, stack); - error_count++; + if (warning) + warning_count++; + else + error_count++; } else if (p_msg == "profile_sig") { //cache a signature @@ -1011,20 +1014,26 @@ void ScriptEditorDebugger::_notification(int p_what) { } } - if (error_count != last_error_count) { + if (error_count != last_error_count || warning_count != last_warning_count) { - if (error_count == 0) { + if (error_count == 0 && warning_count == 0) { error_split->set_name(TTR("Errors")); debugger_button->set_text(TTR("Debugger")); debugger_button->set_icon(Ref<Texture>()); tabs->set_tab_icon(error_split->get_index(), Ref<Texture>()); } else { - error_split->set_name(TTR("Errors") + " (" + itos(error_count) + ")"); - debugger_button->set_text(TTR("Debugger") + " (" + itos(error_count) + ")"); - debugger_button->set_icon(get_icon("Error", "EditorIcons")); - tabs->set_tab_icon(error_split->get_index(), get_icon("Error", "EditorIcons")); + error_split->set_name(TTR("Errors") + " (" + itos(error_count + warning_count) + ")"); + debugger_button->set_text(TTR("Debugger") + " (" + itos(error_count + warning_count) + ")"); + if (error_count == 0) { + debugger_button->set_icon(get_icon("Warning", "EditorIcons")); + tabs->set_tab_icon(error_split->get_index(), get_icon("Warning", "EditorIcons")); + } else { + debugger_button->set_icon(get_icon("Error", "EditorIcons")); + tabs->set_tab_icon(error_split->get_index(), get_icon("Error", "EditorIcons")); + } } last_error_count = error_count; + last_warning_count = warning_count; } if (connection.is_null()) { @@ -1054,6 +1063,7 @@ void ScriptEditorDebugger::_notification(int p_what) { error_list->clear(); error_stack->clear(); error_count = 0; + warning_count = 0; profiler_signature.clear(); //live_edit_root->set_text("/root"); @@ -1750,6 +1760,7 @@ void ScriptEditorDebugger::_clear_errors_list() { error_list->clear(); error_count = 0; + warning_count = 0; _notification(NOTIFICATION_PROCESS); } @@ -2162,9 +2173,11 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { live_debug = false; last_path_id = false; error_count = 0; + warning_count = 0; hide_on_stop = true; enable_external_editor = false; last_error_count = 0; + last_warning_count = 0; EditorNode::get_singleton()->get_pause_button()->connect("pressed", this, "_paused"); } diff --git a/editor/script_editor_debugger.h b/editor/script_editor_debugger.h index f7fe348b65..ce705aa35b 100644 --- a/editor/script_editor_debugger.h +++ b/editor/script_editor_debugger.h @@ -96,7 +96,9 @@ class ScriptEditorDebugger : public Control { EditorFileDialog *file_dialog; int error_count; + int warning_count; int last_error_count; + int last_warning_count; bool hide_on_stop; bool enable_external_editor; |