diff options
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | editor/animation_track_editor.cpp | 21 | ||||
-rw-r--r-- | editor/editor_node.cpp | 37 | ||||
-rw-r--r-- | editor/editor_node.h | 5 | ||||
-rw-r--r-- | editor/editor_properties.cpp | 5 | ||||
-rw-r--r-- | editor/plugins/cpu_particles_2d_editor_plugin.cpp | 1 | ||||
-rw-r--r-- | editor/plugins/cpu_particles_editor_plugin.cpp | 1 | ||||
-rw-r--r-- | editor/plugins/mesh_instance_editor_plugin.cpp | 1 | ||||
-rw-r--r-- | editor/plugins/multimesh_editor_plugin.cpp | 1 | ||||
-rw-r--r-- | editor/plugins/particles_2d_editor_plugin.cpp | 1 | ||||
-rw-r--r-- | editor/plugins/particles_editor_plugin.cpp | 1 | ||||
-rw-r--r-- | editor/plugins/theme_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | platform/x11/detect.py | 15 | ||||
-rw-r--r-- | scene/gui/color_picker.cpp | 4 | ||||
-rw-r--r-- | scene/gui/menu_button.cpp | 8 | ||||
-rw-r--r-- | scene/gui/option_button.cpp | 2 | ||||
-rw-r--r-- | scene/main/viewport.cpp | 4 |
17 files changed, 95 insertions, 18 deletions
diff --git a/.gitignore b/.gitignore index 2697507adb..cd6785a8ec 100644 --- a/.gitignore +++ b/.gitignore @@ -40,12 +40,14 @@ gmon.out *.swo *.swp -# QT project files +# Qt project files *.config *.creator *.creator.* *.files *.includes +*.cflags +*.cxxflags # Eclipse CDT files .cproject diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index a34ced7328..2376d08077 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -1022,8 +1022,14 @@ void AnimationTimelineEdit::update_values() { editing = true; if (use_fps && animation->get_step() > 0) { length->set_value(animation->get_length() / animation->get_step()); + length->set_step(1); + length->set_tooltip(TTR("Animation length (frames)")); + time_icon->set_tooltip(TTR("Animation length (frames)")); } else { length->set_value(animation->get_length()); + length->set_step(0.01); + length->set_tooltip(TTR("Animation length (seconds)")); + time_icon->set_tooltip(TTR("Animation length (seconds)")); } loop->set_pressed(animation->has_loop()); editing = false; @@ -1168,7 +1174,7 @@ AnimationTimelineEdit::AnimationTimelineEdit() { len_hb->add_child(expander); time_icon = memnew(TextureRect); time_icon->set_v_size_flags(SIZE_SHRINK_CENTER); - time_icon->set_tooltip(TTR("Animation Length Time (seconds)")); + time_icon->set_tooltip(TTR("Animation length (seconds)")); len_hb->add_child(time_icon); length = memnew(EditorSpinSlider); length->set_min(0.001); @@ -1177,7 +1183,7 @@ AnimationTimelineEdit::AnimationTimelineEdit() { length->set_allow_greater(true); length->set_custom_minimum_size(Vector2(70 * EDSCALE, 0)); length->set_hide_slider(true); - length->set_tooltip(TTR("Animation Length Time (seconds)")); + length->set_tooltip(TTR("Animation length (seconds)")); length->connect("value_changed", this, "_anim_length_changed"); len_hb->add_child(length); loop = memnew(ToolButton); @@ -3857,7 +3863,7 @@ void AnimationTrackEditor::_insert_key_from_track(float p_ofs, int p_track) { ERR_FAIL_INDEX(p_track, animation->get_track_count()); if (snap->is_pressed() && step->get_value() != 0) { - p_ofs = Math::stepify(p_ofs, step->get_value()); + p_ofs = snap_time(p_ofs); } while (animation->track_find_key(p_track, p_ofs, true) != -1) { //make sure insertion point is valid p_ofs += 0.001; @@ -4889,7 +4895,14 @@ void AnimationTrackEditor::_selection_changed() { float AnimationTrackEditor::snap_time(float p_value) { if (snap->is_pressed()) { - p_value = Math::stepify(p_value, step->get_value()); + + double snap_increment; + if (timeline->is_using_fps() && step->get_value() > 0) + snap_increment = 1.0 / step->get_value(); + else + snap_increment = step->get_value(); + + p_value = Math::stepify(p_value, snap_increment); } return p_value; diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index fe52e7eb7e..cbb7994635 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -1937,6 +1937,21 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { open_request(previous_scenes.back()->get()); } break; + case FILE_CLOSE_OTHERS: + case FILE_CLOSE_RIGHT: + case FILE_CLOSE_ALL: { + if (editor_data.get_edited_scene_count() > 1 && (current_option != FILE_CLOSE_RIGHT || editor_data.get_edited_scene() < editor_data.get_edited_scene_count() - 1)) { + int next_tab = editor_data.get_edited_scene() + 1; + next_tab %= editor_data.get_edited_scene_count(); + _scene_tab_closed(next_tab, current_option); + } else { + if (current_option != FILE_CLOSE_ALL) + current_option = -1; + else + _scene_tab_closed(editor_data.get_edited_scene()); + } + + } break; case FILE_CLOSE_ALL_AND_QUIT: case FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER: case FILE_CLOSE: { @@ -2553,6 +2568,9 @@ void EditorNode::_discard_changes(const String &p_str) { case FILE_CLOSE_ALL_AND_QUIT: case FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER: case FILE_CLOSE: + case FILE_CLOSE_OTHERS: + case FILE_CLOSE_RIGHT: + case FILE_CLOSE_ALL: case SCENE_TAB_CLOSE: { _remove_scene(tab_closing); @@ -2565,6 +2583,15 @@ void EditorNode::_discard_changes(const String &p_str) { } else { _menu_option_confirm(current_option, false); } + } else if (current_option == FILE_CLOSE_OTHERS || current_option == FILE_CLOSE_RIGHT) { + if (editor_data.get_edited_scene_count() == 1 || (current_option == FILE_CLOSE_RIGHT && editor_data.get_edited_scene_count() <= editor_data.get_edited_scene() + 1)) { + current_option = -1; + save_confirmation->hide(); + } else { + _menu_option_confirm(current_option, false); + } + } else if (current_option == FILE_CLOSE_ALL && editor_data.get_edited_scene_count() > 0) { + _menu_option_confirm(current_option, false); } else { current_option = -1; save_confirmation->hide(); @@ -4192,8 +4219,8 @@ void EditorNode::_scene_tab_script_edited(int p_tab) { inspector_dock->edit_resource(script); } -void EditorNode::_scene_tab_closed(int p_tab) { - current_option = SCENE_TAB_CLOSE; +void EditorNode::_scene_tab_closed(int p_tab, int option) { + current_option = option; tab_closing = p_tab; Node *scene = editor_data.get_edited_scene_root(p_tab); if (!scene) { @@ -4266,7 +4293,11 @@ void EditorNode::_scene_tab_input(const Ref<InputEvent> &p_input) { scene_tabs_context_menu->add_separator(); scene_tabs_context_menu->add_item(TTR("Show in FileSystem"), FILE_SHOW_IN_FILESYSTEM); scene_tabs_context_menu->add_item(TTR("Play This Scene"), RUN_PLAY_SCENE); + scene_tabs_context_menu->add_separator(); scene_tabs_context_menu->add_item(TTR("Close Tab"), FILE_CLOSE); + scene_tabs_context_menu->add_item(TTR("Close Other Tabs"), FILE_CLOSE_OTHERS); + scene_tabs_context_menu->add_item(TTR("Close Tabs to the Right"), FILE_CLOSE_RIGHT); + scene_tabs_context_menu->add_item(TTR("Close All Tabs"), FILE_CLOSE_ALL); } scene_tabs_context_menu->set_position(mb->get_global_position()); scene_tabs_context_menu->popup(); @@ -5523,7 +5554,7 @@ EditorNode::EditorNode() { scene_tabs->set_drag_to_rearrange_enabled(true); scene_tabs->connect("tab_changed", this, "_scene_tab_changed"); scene_tabs->connect("right_button_pressed", this, "_scene_tab_script_edited"); - scene_tabs->connect("tab_close", this, "_scene_tab_closed"); + scene_tabs->connect("tab_close", this, "_scene_tab_closed", varray(SCENE_TAB_CLOSE)); scene_tabs->connect("tab_hover", this, "_scene_tab_hover"); scene_tabs->connect("mouse_exited", this, "_scene_tab_exit"); scene_tabs->connect("gui_input", this, "_scene_tab_input"); diff --git a/editor/editor_node.h b/editor/editor_node.h index a06708eb54..0084d421f9 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -150,6 +150,9 @@ private: FILE_QUICK_OPEN_SCRIPT, FILE_OPEN_PREV, FILE_CLOSE, + FILE_CLOSE_OTHERS, + FILE_CLOSE_RIGHT, + FILE_CLOSE_ALL, FILE_CLOSE_ALL_AND_QUIT, FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER, FILE_QUIT, @@ -563,7 +566,7 @@ private: void _dock_split_dragged(int ofs); void _dock_popup_exit(); void _scene_tab_changed(int p_tab); - void _scene_tab_closed(int p_tab); + void _scene_tab_closed(int p_tab, int option = SCENE_TAB_CLOSE); void _scene_tab_hover(int p_tab); void _scene_tab_exit(); void _scene_tab_input(const Ref<InputEvent> &p_input); diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 9d936d9b99..45acd1b6d4 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -786,6 +786,7 @@ EditorPropertyLayers::EditorPropertyLayers() { grid->set_h_size_flags(SIZE_EXPAND_FILL); hb->add_child(grid); button = memnew(Button); + button->set_toggle_mode(true); button->set_text(".."); button->connect("pressed", this, "_button_pressed"); hb->add_child(button); @@ -794,6 +795,7 @@ EditorPropertyLayers::EditorPropertyLayers() { add_child(layers); layers->set_hide_on_checkable_item_selection(false); layers->connect("id_pressed", this, "_menu_pressed"); + layers->connect("popup_hide", button, "set_pressed", varray(false)); } ///////////////////// INT ///////////////////////// @@ -2598,6 +2600,7 @@ void EditorPropertyResource::_resource_selected() { RES res = get_edited_object()->get(get_edited_property()); if (res.is_null()) { + edit->set_pressed(true); _update_menu(); return; } @@ -2818,7 +2821,9 @@ EditorPropertyResource::EditorPropertyResource() { add_child(menu); edit = memnew(Button); edit->set_flat(true); + edit->set_toggle_mode(true); menu->connect("id_pressed", this, "_menu_option"); + menu->connect("popup_hide", edit, "set_pressed", varray(false)); edit->connect("pressed", this, "_update_menu"); hbc->add_child(edit); edit->connect("gui_input", this, "_button_input"); diff --git a/editor/plugins/cpu_particles_2d_editor_plugin.cpp b/editor/plugins/cpu_particles_2d_editor_plugin.cpp index 559558cdb8..1622ce17b2 100644 --- a/editor/plugins/cpu_particles_2d_editor_plugin.cpp +++ b/editor/plugins/cpu_particles_2d_editor_plugin.cpp @@ -267,6 +267,7 @@ CPUParticles2DEditorPlugin::CPUParticles2DEditorPlugin(EditorNode *p_node) { menu->get_popup()->add_item(TTR("Load Emission Mask"), MENU_LOAD_EMISSION_MASK); // menu->get_popup()->add_item(TTR("Clear Emission Mask"), MENU_CLEAR_EMISSION_MASK); menu->set_text(TTR("Particles")); + menu->set_switch_on_hover(true); toolbar->add_child(menu); file = memnew(EditorFileDialog); diff --git a/editor/plugins/cpu_particles_editor_plugin.cpp b/editor/plugins/cpu_particles_editor_plugin.cpp index 7222525dd7..70be9b95bb 100644 --- a/editor/plugins/cpu_particles_editor_plugin.cpp +++ b/editor/plugins/cpu_particles_editor_plugin.cpp @@ -101,6 +101,7 @@ CPUParticlesEditor::CPUParticlesEditor() { particles_editor_hb = memnew(HBoxContainer); SpatialEditor::get_singleton()->add_control_to_menu_panel(particles_editor_hb); options = memnew(MenuButton); + options->set_switch_on_hover(true); particles_editor_hb->add_child(options); particles_editor_hb->hide(); diff --git a/editor/plugins/mesh_instance_editor_plugin.cpp b/editor/plugins/mesh_instance_editor_plugin.cpp index cf111dc4ce..635b934333 100644 --- a/editor/plugins/mesh_instance_editor_plugin.cpp +++ b/editor/plugins/mesh_instance_editor_plugin.cpp @@ -412,6 +412,7 @@ void MeshInstanceEditor::_bind_methods() { MeshInstanceEditor::MeshInstanceEditor() { options = memnew(MenuButton); + options->set_switch_on_hover(true); SpatialEditor::get_singleton()->add_control_to_menu_panel(options); options->set_text(TTR("Mesh")); diff --git a/editor/plugins/multimesh_editor_plugin.cpp b/editor/plugins/multimesh_editor_plugin.cpp index 8ff6080443..fc0a425bfc 100644 --- a/editor/plugins/multimesh_editor_plugin.cpp +++ b/editor/plugins/multimesh_editor_plugin.cpp @@ -293,6 +293,7 @@ void MultiMeshEditor::_bind_methods() { MultiMeshEditor::MultiMeshEditor() { options = memnew(MenuButton); + options->set_switch_on_hover(true); SpatialEditor::get_singleton()->add_control_to_menu_panel(options); options->set_text("MultiMesh"); diff --git a/editor/plugins/particles_2d_editor_plugin.cpp b/editor/plugins/particles_2d_editor_plugin.cpp index 70d4919e9f..50bdf4512b 100644 --- a/editor/plugins/particles_2d_editor_plugin.cpp +++ b/editor/plugins/particles_2d_editor_plugin.cpp @@ -375,6 +375,7 @@ Particles2DEditorPlugin::Particles2DEditorPlugin(EditorNode *p_node) { menu->get_popup()->add_separator(); menu->get_popup()->add_item(TTR("Convert to CPUParticles"), MENU_OPTION_CONVERT_TO_CPU_PARTICLES); menu->set_text(TTR("Particles")); + menu->set_switch_on_hover(true); toolbar->add_child(menu); file = memnew(EditorFileDialog); diff --git a/editor/plugins/particles_editor_plugin.cpp b/editor/plugins/particles_editor_plugin.cpp index 0032850535..09180edf2a 100644 --- a/editor/plugins/particles_editor_plugin.cpp +++ b/editor/plugins/particles_editor_plugin.cpp @@ -454,6 +454,7 @@ ParticlesEditor::ParticlesEditor() { particles_editor_hb = memnew(HBoxContainer); SpatialEditor::get_singleton()->add_control_to_menu_panel(particles_editor_hb); options = memnew(MenuButton); + options->set_switch_on_hover(true); particles_editor_hb->add_child(options); particles_editor_hb->hide(); diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp index 7c8e69ae70..80e2e99685 100644 --- a/editor/plugins/theme_editor_plugin.cpp +++ b/editor/plugins/theme_editor_plugin.cpp @@ -831,6 +831,7 @@ ThemeEditor::ThemeEditor() { type_edit->set_h_size_flags(SIZE_EXPAND_FILL); type_hbc->add_child(type_edit); type_menu = memnew(MenuButton); + type_menu->set_flat(false); type_menu->set_text(".."); type_hbc->add_child(type_menu); @@ -848,6 +849,7 @@ ThemeEditor::ThemeEditor() { name_edit->set_h_size_flags(SIZE_EXPAND_FILL); name_hbc->add_child(name_edit); name_menu = memnew(MenuButton); + type_menu->set_flat(false); name_menu->set_text(".."); name_hbc->add_child(name_menu); diff --git a/platform/x11/detect.py b/platform/x11/detect.py index 1905b035e6..91639a0db2 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -59,6 +59,7 @@ def get_opts(): return [ BoolVariable('use_llvm', 'Use the LLVM compiler', False), BoolVariable('use_lld', 'Use the LLD linker', False), + BoolVariable('use_thinlto', 'Use ThinLTO', False), BoolVariable('use_static_cpp', 'Link libgcc and libstdc++ statically for better portability', False), BoolVariable('use_ubsan', 'Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)', False), BoolVariable('use_asan', 'Use LLVM/GCC compiler address sanitizer (ASAN))', False), @@ -136,6 +137,9 @@ def configure(env): if env['use_lld']: if env['use_llvm']: env.Append(LINKFLAGS=['-fuse-ld=lld']) + if env['use_thinlto']: + # A convenience so you don't need to write use_lto too when using SCons + env['use_lto'] = True else: print("Using LLD with GCC is not supported yet, try compiling with 'use_llvm=yes'.") sys.exit(255) @@ -156,12 +160,17 @@ def configure(env): env.Append(LINKFLAGS=['-fsanitize=leak']) if env['use_lto']: - env.Append(CCFLAGS=['-flto']) - if not env['use_llvm'] and env.GetOption("num_jobs") > 1: + env.Append(CCFLAGS=['-flto']) env.Append(LINKFLAGS=['-flto=' + str(env.GetOption("num_jobs"))]) else: - env.Append(LINKFLAGS=['-flto']) + if env['use_lld'] and env['use_thinlto']: + env.Append(CCFLAGS=['-flto=thin']) + env.Append(LINKFLAGS=['-flto=thin']) + else: + env.Append(CCFLAGS=['-flto']) + env.Append(LINKFLAGS=['-flto']) + if not env['use_llvm']: env['RANLIB'] = 'gcc-ranlib' env['AR'] = 'gcc-ar' diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index 7aca6acd00..c78f29dd50 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -825,6 +825,8 @@ void ColorPickerButton::_update_picker() { add_child(popup); picker->connect("color_changed", this, "_color_changed"); popup->connect("modal_closed", this, "_modal_closed"); + popup->connect("about_to_show", this, "set_pressed", varray(true)); + popup->connect("popup_hide", this, "set_pressed", varray(false)); picker->set_pick_color(color); picker->set_edit_alpha(edit_alpha); } @@ -855,4 +857,6 @@ ColorPickerButton::ColorPickerButton() { picker = NULL; popup = NULL; edit_alpha = true; + + set_toggle_mode(true); } diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp index b67d8c00d6..a011b793de 100644 --- a/scene/gui/menu_button.cpp +++ b/scene/gui/menu_button.cpp @@ -116,15 +116,19 @@ MenuButton::MenuButton() { switch_on_hover = false; set_flat(true); + set_toggle_mode(true); set_disable_shortcuts(false); set_enabled_focus_mode(FOCUS_NONE); + set_process_unhandled_key_input(true); + set_action_mode(ACTION_MODE_BUTTON_PRESS); + popup = memnew(PopupMenu); popup->hide(); add_child(popup); popup->set_as_toplevel(true); popup->set_pass_on_modal_close_click(false); - set_process_unhandled_key_input(true); - set_action_mode(ACTION_MODE_BUTTON_PRESS); + popup->connect("about_to_show", this, "set_pressed", varray(true)); // For when switching from another MenuButton. + popup->connect("popup_hide", this, "set_pressed", varray(false)); } MenuButton::~MenuButton() { diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp index b9b270ce0c..cb5fb0263b 100644 --- a/scene/gui/option_button.cpp +++ b/scene/gui/option_button.cpp @@ -340,6 +340,7 @@ void OptionButton::_bind_methods() { OptionButton::OptionButton() { current = -1; + set_toggle_mode(true); set_text_align(ALIGN_LEFT); set_action_mode(ACTION_MODE_BUTTON_PRESS); @@ -350,6 +351,7 @@ OptionButton::OptionButton() { popup->set_pass_on_modal_close_click(false); popup->connect("id_pressed", this, "_selected"); popup->connect("id_focused", this, "_focused"); + popup->connect("popup_hide", this, "set_pressed", varray(false)); } OptionButton::~OptionButton() { diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 52f63ddc1d..ae2c571201 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -2482,11 +2482,7 @@ void Viewport::_gui_hid_control(Control *p_control) { if (gui.mouse_over == p_control) gui.mouse_over = NULL; if (gui.tooltip == p_control) - gui.tooltip = NULL; - if (gui.tooltip == p_control) { - gui.tooltip = NULL; _gui_cancel_tooltip(); - } } void Viewport::_gui_remove_control(Control *p_control) { |