diff options
Diffstat (limited to 'editor/plugins')
-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 |
4 files changed, 42 insertions, 4 deletions
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, |