diff options
64 files changed, 519 insertions, 417 deletions
diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index 0173657e80..0000000000 --- a/.appveyor.yml +++ /dev/null @@ -1,55 +0,0 @@ -image: Visual Studio 2019 - -platform: x64 - -environment: - HOME: "%HOMEDRIVE%%HOMEPATH%" - PYTHON: C:\Python38 - SCONS_CACHE_ROOT: "%HOME%\\scons_cache" - SCONS_CACHE_LIMIT: 1024 - OPTIONS: "debug_symbols=no verbose=yes progress=no" - EXTRA_ARGS: "warnings=all werror=yes" - matrix: - - GD_PLATFORM: windows - TARGET: release_debug - TOOLS: yes -# Disabled for performance reasons until master is more stable. -# - GD_PLATFORM: windows -# TARGET: release -# TOOLS: no - -matrix: - fast_finish: true - -init: - - ps: if ($env:APPVEYOR_REPO_BRANCH -ne "master") { $env:APPVEYOR_CACHE_SKIP_SAVE = "true" } - -cache: - - "%SCONS_CACHE_ROOT%" - -install: - - SET "PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" - - pip install -U wheel # needed for pip install scons to work, otherwise a flag is missing - - pip install scons # use stable scons - - if defined VS call "%VS%" %ARCH% # if defined - so we can also use mingw - -before_build: - - echo %GD_PLATFORM% - - python --version - - scons --version - - set "SCONS_CACHE=%SCONS_CACHE_ROOT%\%APPVEYOR_REPO_BRANCH%" - -build_script: - - scons platform=%GD_PLATFORM% target=%TARGET% tools=%TOOLS% %OPTIONS% %EXTRA_ARGS% - -after_build: - - git rev-parse --short=9 HEAD > VERSION_HASH.txt - - set /P VERSION_HASH= < VERSION_HASH.txt - - cd bin - - mv godot.windows.opt.tools.64.exe godot_%APPVEYOR_REPO_BRANCH%-%VERSION_HASH%_win64.exe - - 7z a -mx9 godot_%APPVEYOR_REPO_BRANCH%-%VERSION_HASH%_win64.zip *.exe - -artifacts: - - path: bin/godot_${APPVEYOR_REPO_BRANCH}-${VERSION_HASH}_win64.zip - name: Win64 release_debug editor build - type: zip diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3b5d39bb12..77554ea0ef 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,13 +1,6 @@ -# Engine build CI -name: Godot CI - -on: - # will build EVERY pull request - pull_request: - - # will only build explicit branches - push: - branches: [ master, 3.2, 3.1, 3.0 ] +name: Godot +# events to run the build steps +on: [push, pull_request] # Global Cache Settings # SCONS_CACHE for windows must be set in the build environment @@ -94,7 +87,7 @@ jobs: ${{runner.os}}-template ${{runner.os}} - # Use python 3.x release (works cross platform) + # Use python 3.x release (works cross platform) - name: Set up Python 3.x uses: actions/setup-python@v2 with: @@ -124,3 +117,206 @@ jobs: # with: # name: windows-template (x64) # path: bin/godot.windows.opt.64.exe + + macos-editor: + runs-on: "macos-latest" + + name: MacOS Editor (target=release_debug, tools=yes) + + steps: + - uses: actions/checkout@v2 + + # Upload cache on completion and check it out now + # Editing this is pretty dangerous for windows since it can break and needs properly tested with a fresh cache. + # Linux with this will work reliably, so not as bad to edit for Linux. + - name: Load .scons_cache directory + id: macos-editor-cache + uses: actions/cache@v2 + with: + path: ${{github.workspace}}/.scons_cache/ + key: ${{runner.os}}-editor-${{github.sha}} + restore-keys: | + ${{runner.os}}-editor-${{github.sha}} + ${{runner.os}}-editor + ${{runner.os}} + + # Use python 3.x release (works cross platform; best to keep self contained in it's own step) + - name: Set up Python 3.x + uses: actions/setup-python@v2 + with: + # Semantic version range syntax or exact version of a Python version + python-version: '3.x' + # Optional - x64 or x86 architecture, defaults to x64 + architecture: 'x64' + + # Setup scons, print python version and scons version info, so if anything is broken it won't run the build. + - name: Configuring Python packages + run: | + python -c "import sys; print(sys.version)" + python -m pip install scons + python --version + scons --version + + # We should always be explicit with our flags usage here since it's gonna be sure to always set those flags + - name: Compilation + env: + SCONS_CACHE: ${{github.workspace}}/.scons_cache/ + run: | + scons -j2 verbose=yes warnings=all werror=yes platform=osx tools=yes target=release_debug + + macos-template: + runs-on: "macos-latest" + name: MacOS Template (target=release, tools=no) + + steps: + - uses: actions/checkout@v2 + + # Upload cache on completion and check it out now + # Editing this is pretty dangerous for windows since it can break and needs properly tested with a fresh cache. + # Linux with this will work reliably, so not as bad to edit for Linux. + - name: Load .scons_cache directory + id: macos-template-cache + uses: actions/cache@v2 + with: + path: ${{github.workspace}}/.scons_cache/ + key: ${{runner.os}}-template-${{github.sha}} + restore-keys: | + ${{runner.os}}-template-${{github.sha}} + ${{runner.os}}-template + ${{runner.os}} + + # Use python 3.x release (works cross platform) + - name: Set up Python 3.x + uses: actions/setup-python@v2 + with: + # Semantic version range syntax or exact version of a Python version + python-version: '3.x' + # Optional - x64 or x86 architecture, defaults to x64 + architecture: 'x64' + + # You can test your matrix by printing the current Python version + - name: Configuring Python packages + run: | + python -c "import sys; print(sys.version)" + python -m pip install scons + python --version + scons --version + - name: Compilation + env: + SCONS_CACHE: ${{github.workspace}}/.scons_cache/ + run: | + scons -j2 verbose=yes warnings=all werror=yes platform=osx target=release tools=no + + linux-editor: + runs-on: "ubuntu-20.04" + + # Windows Editor - checkout with the plugin + name: Linux Editor (target=release_debug, tools=yes) + + steps: + - uses: actions/checkout@v2 + + # Azure repositories are not reliable, we need to prevent azure giving us packages. + - name: Make apt sources.list use the default Ubuntu repositories + run: | + sudo cp -f misc/ci/sources.list /etc/apt/sources.list + sudo apt-get update + + # Install all packages (except scons) + - name: Configure dependencies + run: | + sudo apt-get install build-essential pkg-config libx11-dev libxcursor-dev \ + libxinerama-dev libgl1-mesa-dev libglu-dev libasound2-dev libpulse-dev libudev-dev libxi-dev libxrandr-dev yasm + + # Upload cache on completion and check it out now + # Editing this is pretty dangerous for windows since it can break and needs properly tested with a fresh cache. + # Linux with this will work reliably, so not as bad to edit for Linux. + - name: Load .scons_cache directory + id: linux-editor-cache + uses: actions/cache@v2 + with: + path: ${{github.workspace}}/.scons_cache/ + key: ${{runner.os}}-editor-${{github.sha}} + restore-keys: | + ${{runner.os}}-editor-${{github.sha}} + ${{runner.os}}-editor + ${{runner.os}} + + # Use python 3.x release (works cross platform; best to keep self contained in it's own step) + - name: Set up Python 3.x + uses: actions/setup-python@v2 + with: + # Semantic version range syntax or exact version of a Python version + python-version: '3.x' + # Optional - x64 or x86 architecture, defaults to x64 + architecture: 'x64' + + # Setup scons, print python version and scons version info, so if anything is broken it won't run the build. + - name: Configuring Python packages + run: | + python -c "import sys; print(sys.version)" + python -m pip install scons + python --version + scons --version + + # We should always be explicit with our flags usage here since it's gonna be sure to always set those flags + - name: Compilation + env: + SCONS_CACHE: ${{github.workspace}}/.scons_cache/ + run: | + scons -j2 verbose=yes warnings=all werror=yes platform=linuxbsd tools=yes target=release_debug + + linux-template: + runs-on: "ubuntu-20.04" + name: Linux Template (target=release, tools=no) + + steps: + - uses: actions/checkout@v2 + + # Azure repositories are not reliable, we need to prevent azure giving us packages. + - name: Make apt sources.list use the default Ubuntu repositories + run: | + sudo cp -f misc/ci/sources.list /etc/apt/sources.list + sudo apt-get update + + # Install all packages (except scons) + - name: Configure dependencies + run: | + sudo apt-get install build-essential pkg-config libx11-dev libxcursor-dev \ + libxinerama-dev libgl1-mesa-dev libglu-dev libasound2-dev libpulse-dev libudev-dev libxi-dev libxrandr-dev yasm + + # Upload cache on completion and check it out now + # Editing this is pretty dangerous for windows since it can break and needs properly tested with a fresh cache. + # Linux with this will work reliably, so not as bad to edit for Linux. + - name: Load .scons_cache directory + id: linux-template-cache + uses: actions/cache@v2 + with: + path: ${{github.workspace}}/.scons_cache/ + key: ${{runner.os}}-template-${{github.sha}} + restore-keys: | + ${{runner.os}}-template-${{github.sha}} + ${{runner.os}}-template + ${{runner.os}} + + # Use python 3.x release (works cross platform) + - name: Set up Python 3.x + uses: actions/setup-python@v2 + with: + # Semantic version range syntax or exact version of a Python version + python-version: '3.x' + # Optional - x64 or x86 architecture, defaults to x64 + architecture: 'x64' + + # You can test your matrix by printing the current Python version + - name: Configuring Python packages + run: | + python -c "import sys; print(sys.version)" + python -m pip install scons + python --version + scons --version + - name: Compilation + env: + SCONS_CACHE: ${{github.workspace}}/.scons_cache/ + run: | + scons -j2 verbose=yes warnings=all werror=yes platform=linuxbsd target=release tools=no diff --git a/.github/workflows/static_checks.yml b/.github/workflows/static-checks.yml index 587f5a6ba6..095bf32e1f 100644 --- a/.github/workflows/static_checks.yml +++ b/.github/workflows/static-checks.yml @@ -1,8 +1,9 @@ -name: Static checks +name: Godot on: [push, pull_request] jobs: - build: + static-checks: + name: Static Checks (clang-format, black format, file format, documentation checks) runs-on: ubuntu-20.04 steps: - name: Checkout diff --git a/.travis.yml b/.travis.yml index 9c085d4ce0..2ade6a1a12 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,6 @@ env: - SCONS_CACHE=$HOME/.scons_cache/$TRAVIS_BRANCH - SCONS_CACHE_LIMIT=1024 - OPTIONS="debug_symbols=no verbose=yes progress=no" - - secure: "uch9QszCgsl1qVbuzY41P7S2hWL2IiNFV4SbAYRCdi0oJ9MIu+pVyrQdpf3+jG4rH6j4Rffl+sN17Zz4dIDDioFL1JwqyCqyCyswR8uACC0Rr8gr4Mi3+HIRbv+2s2P4cIQq41JM8FJe84k9jLEMGCGh69w+ibCWoWs74CokYVA=" cache: directories: @@ -19,32 +18,6 @@ cache: matrix: include: - - name: Linux editor (debug, GCC 9, with Mono) - stage: build - env: PLATFORM=linuxbsd TOOLS=yes TARGET=debug CACHE_NAME=${PLATFORM}-tools-mono-gcc-9 MATRIX_EVAL="CC=gcc-9 && CXX=g++-9" EXTRA_ARGS="module_mono_enabled=yes mono_glue=no warnings=extra werror=yes" - os: linux - compiler: gcc-9 - addons: - apt: - sources: - - sourceline: "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" - key_url: "https://raw.githubusercontent.com/travis-ci/apt-source-safelist/master/keys/mono.asc" - - sourceline: "ppa:ubuntu-toolchain-r/test" - packages: - - &gcc9_deps [gcc-9, g++-9] - - &linux_deps [libasound2-dev, libgl1-mesa-dev, libglu1-mesa-dev, libx11-dev, libxcursor-dev, libxi-dev, libxinerama-dev, libxrandr-dev] - - &linux_mono_deps [mono-devel, msbuild, nuget] - - - name: Linux export template (release, Clang 7) - stage: build - env: PLATFORM=linuxbsd TOOLS=no TARGET=release CACHE_NAME=${PLATFORM}-clang EXTRA_ARGS="warnings=extra werror=yes" - os: linux - compiler: clang - addons: - apt: - packages: - - *linux_deps - - name: Android export template (release_debug, Clang) stage: build env: PLATFORM=android TOOLS=no TARGET=release_debug CACHE_NAME=${PLATFORM}-clang EXTRA_ARGS="warnings=extra werror=yes" @@ -55,18 +28,6 @@ matrix: packages: - openjdk-8-jdk - - name: macOS editor (debug, Clang) - stage: build - env: PLATFORM=osx TOOLS=yes TARGET=debug CACHE_NAME=${PLATFORM}-tools-clang EXTRA_ARGS="warnings=extra werror=yes" - os: osx - osx_image: xcode11.5 - compiler: clang - addons: - homebrew: - packages: - - scons - update: true - # TODO: iOS MoltenVK support # - name: iOS export template (debug, Clang) @@ -80,16 +41,6 @@ matrix: # packages: # - scons - - name: Linux export template (release_debug, GCC 7, without 3D support) - stage: build - env: PLATFORM=linuxbsd TOOLS=no TARGET=release_debug CACHE_NAME=${PLATFORM}-gcc-7 EXTRA_ARGS="disable_3d=yes" - os: linux - compiler: gcc - addons: - apt: - packages: - - *linux_deps - - name: JavaScript export template (release, emscripten latest) stage: build env: PLATFORM=javascript TOOLS=no TARGET=release CACHE_NAME=${PLATFORM}-emcc-latest EXTRA_ARGS="use_closure_compiler=yes" @@ -113,7 +64,7 @@ install: export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64; export PATH=/usr/lib/jvm/java-8-openjdk-amd64/jre/bin:${PATH}; java -version; - misc/travis/android-tools-linux.sh; + misc/ci/android-tools-linux.sh; fi - if [ "$PLATFORM" = "javascript" ]; then git clone --depth 1 "https://github.com/emscripten-core/emsdk.git"; @@ -128,9 +79,4 @@ before_script: fi script: - - scons -j2 CC=$CC CXX=$CXX platform=$PLATFORM tools=$TOOLS target=$TARGET $OPTIONS $EXTRA_ARGS && - if [ "$TEST_PROJECT" = "yes" ]; then - git clone --depth 1 "https://github.com/godotengine/godot-tests.git"; - sed -i "s:custom_template/release=\"\":custom_template/release=\"$(readlink -e bin/godot_server.linuxbsd.opt.tools.64)\":" godot-tests/tests/project_export/export_presets.cfg; - godot-tests/tests/project_export/test_project.sh "bin/godot_server.linuxbsd.opt.tools.64"; - fi + - scons -j2 CC=$CC CXX=$CXX platform=$PLATFORM tools=$TOOLS target=$TARGET $OPTIONS $EXTRA_ARGS diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 94da74cbda..2f8b11652b 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -1690,7 +1690,7 @@ String _Directory::get_current_dir() { } Error _Directory::make_dir(String p_dir) { - ERR_FAIL_COND_V_MSG(!is_open(), ERR_UNCONFIGURED, "Directory must be opened before use."); + ERR_FAIL_COND_V_MSG(!d, ERR_UNCONFIGURED, "Directory is not configured properly."); if (!p_dir.is_rel_path()) { DirAccess *d = DirAccess::create_for_path(p_dir); Error err = d->make_dir(p_dir); @@ -1701,7 +1701,7 @@ Error _Directory::make_dir(String p_dir) { } Error _Directory::make_dir_recursive(String p_dir) { - ERR_FAIL_COND_V_MSG(!is_open(), ERR_UNCONFIGURED, "Directory must be opened before use."); + ERR_FAIL_COND_V_MSG(!d, ERR_UNCONFIGURED, "Directory is not configured properly."); if (!p_dir.is_rel_path()) { DirAccess *d = DirAccess::create_for_path(p_dir); Error err = d->make_dir_recursive(p_dir); diff --git a/doc/classes/File.xml b/doc/classes/File.xml index b90039e496..20bc39ef1f 100644 --- a/doc/classes/File.xml +++ b/doc/classes/File.xml @@ -20,6 +20,7 @@ file.close() return content [/codeblock] + In the example above, the file will be saved in the user data folder as specified in the [url=https://docs.godotengine.org/en/latest/tutorials/io/data_paths.html]Data paths[/url] documentation. </description> <tutorials> <link>https://docs.godotengine.org/en/latest/getting_started/step_by_step/filesystem.html</link> diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml index 105def21ca..238bc970ef 100644 --- a/doc/classes/OS.xml +++ b/doc/classes/OS.xml @@ -112,7 +112,18 @@ <return type="PackedStringArray"> </return> <description> - Returns the command line arguments passed to the engine. + Returns the command-line arguments passed to the engine. + Command-line arguments can be written in any form, including both [code]--key value[/code] and [code]--key=value[/code] forms so they can be properly parsed, as long as custom command-line arguments do not conflict with engine arguments. + You can also incorporate environment variables using the [method get_environment] method. + You can set [code]editor/main_run_args[/code] in the Project Settings to define command-line arguments to be passed by the editor when running the project. + Here's a minimal example on how to parse command-line arguments into a dictionary using the [code]--key=value[/code] form for arguments: + [codeblock] + var arguments = {} + for argument in OS.get_cmdline_args(): + if argument.find("=") > -1: + var key_value = argument.split("=") + arguments[key_value[0].lstrip("--")] = key_value[1] + [/codeblock] </description> </method> <method name="get_connected_midi_inputs"> diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml index 8d08688b41..3d8c2c5eb0 100644 --- a/doc/classes/Object.xml +++ b/doc/classes/Object.xml @@ -97,6 +97,7 @@ [codeblock] call("set", "position", Vector2(42.0, 0.0)) [/codeblock] + [b]Note:[/b] In C#, the method name must be specified as snake_case if it is defined by a built-in Godot node. This doesn't apply to user-defined methods where you should use the same convention as in the C# source (typically PascalCase). </description> </method> <method name="call_deferred" qualifiers="vararg"> @@ -109,6 +110,7 @@ [codeblock] call_deferred("set", "position", Vector2(42.0, 0.0)) [/codeblock] + [b]Note:[/b] In C#, the method name must be specified as snake_case if it is defined by a built-in Godot node. This doesn't apply to user-defined methods where you should use the same convention as in the C# source (typically PascalCase). </description> </method> <method name="callv"> @@ -203,6 +205,7 @@ </argument> <description> Returns the [Variant] value of the given [code]property[/code]. If the [code]property[/code] doesn't exist, this will return [code]null[/code]. + [b]Note:[/b] In C#, the property name must be specified as snake_case if it is defined by a built-in Godot node. This doesn't apply to user-defined properties where you should use the same convention as in the C# source (typically PascalCase). </description> </method> <method name="get_class" qualifiers="const"> @@ -402,6 +405,7 @@ </argument> <description> Assigns a new value to the given property. If the [code]property[/code] does not exist, nothing will happen. + [b]Note:[/b] In C#, the property name must be specified as snake_case if it is defined by a built-in Godot node. This doesn't apply to user-defined properties where you should use the same convention as in the C# source (typically PascalCase). </description> </method> <method name="set_block_signals"> @@ -422,6 +426,7 @@ </argument> <description> Assigns a new value to the given property, after the current frame's physics step. This is equivalent to calling [method set] via [method call_deferred], i.e. [code]call_deferred("set", property, value)[/code]. + [b]Note:[/b] In C#, the property name must be specified as snake_case if it is defined by a built-in Godot node. This doesn't apply to user-defined properties where you should use the same convention as in the C# source (typically PascalCase). </description> </method> <method name="set_indexed"> diff --git a/doc/classes/PrimitiveMesh.xml b/doc/classes/PrimitiveMesh.xml index 77915bc538..9e7f26ed4f 100644 --- a/doc/classes/PrimitiveMesh.xml +++ b/doc/classes/PrimitiveMesh.xml @@ -13,7 +13,12 @@ <return type="Array"> </return> <description> - Returns mesh arrays used to constitute surface of [Mesh]. Mesh arrays can be used with [ArrayMesh] to create new surfaces. + Returns mesh arrays used to constitute surface of [Mesh]. The result can be passed to [method ArrayMesh.add_surface_from_arrays] to create a new surface. For example: + [codeblock] + var c := CylinderMesh.new() + var arr_mesh := ArrayMesh.new() + arr_mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, c.get_mesh_arrays()) + [/codeblock] </description> </method> </methods> diff --git a/doc/classes/String.xml b/doc/classes/String.xml index 78168562f1..71db03e84f 100644 --- a/doc/classes/String.xml +++ b/doc/classes/String.xml @@ -325,7 +325,8 @@ <return type="String"> </return> <description> - Returns a copy of the string with escaped characters replaced by their meanings according to the C language standard. + Returns a copy of the string with escaped characters replaced by their meanings. Supported escape sequences are [code]\'[/code], [code]\"[/code], [code]\?[/code], [code]\\[/code], [code]\a[/code], [code]\b[/code], [code]\f[/code], [code]\n[/code], [code]\r[/code], [code]\t[/code], [code]\v[/code]. + [b]Note:[/b] Unlike the GDScript parser, this method doesn't support the [code]\uXXXX[/code] escape sequence. </description> </method> <method name="capitalize"> @@ -413,7 +414,6 @@ </argument> <description> Returns the index of the [b]first[/b] case-sensitive occurrence of the specified string in this instance, or [code]-1[/code]. Optionally, the starting search index can be specified, continuing to the end of the string. - [b]Note:[/b] If you just want to know whether a string contains a substring, use the [code]in[/code] operator as follows: [codeblock] # Will evaluate to `false`. diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 1d6770a32e..f3561dc03e 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -4370,7 +4370,7 @@ void AnimationTrackEditor::_add_track(int p_type) { return; } adding_track_type = p_type; - pick_track->popup_centered_ratio(); + pick_track->popup_scenetree_dialog(); } void AnimationTrackEditor::_new_track_property_selected(String p_name) { @@ -5731,7 +5731,7 @@ AnimationTrackEditor::AnimationTrackEditor() { pick_track = memnew(SceneTreeDialog); add_child(pick_track); - pick_track->set_title(TTR("Pick the node that will be animated:")); + pick_track->set_title(TTR("Pick a node to animate:")); pick_track->connect("selected", callable_mp(this, &AnimationTrackEditor::_new_track_node_selected)); prop_selector = memnew(PropertySelector); add_child(prop_selector); diff --git a/editor/debugger/editor_debugger_tree.cpp b/editor/debugger/editor_debugger_tree.cpp index 0b5f865a98..ebac9b3482 100644 --- a/editor/debugger/editor_debugger_tree.cpp +++ b/editor/debugger/editor_debugger_tree.cpp @@ -238,7 +238,7 @@ void EditorDebuggerTree::_item_menu_id_pressed(int p_option) { file_dialog->add_filter("*." + extensions[i] + " ; " + extensions[i].to_upper()); } - file_dialog->popup_centered_ratio(); + file_dialog->popup_file_dialog(); } break; case ITEM_MENU_COPY_NODE_PATH: { String text = get_selected_path(); diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index a828e29558..49bf068be7 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -282,7 +282,7 @@ void ScriptEditorDebugger::_video_mem_export() { file_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM); file_dialog->clear_filters(); file_dialog_purpose = SAVE_VRAM_CSV; - file_dialog->popup_centered_ratio(); + file_dialog->popup_file_dialog(); } Size2 ScriptEditorDebugger::get_minimum_size() const { @@ -944,7 +944,7 @@ void ScriptEditorDebugger::_export_csv() { file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE); file_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM); file_dialog_purpose = SAVE_MONITORS_CSV; - file_dialog->popup_centered_ratio(); + file_dialog->popup_file_dialog(); } String ScriptEditorDebugger::get_var_value(const String &p_var) const { diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp index c6977779bd..cbf39c209a 100644 --- a/editor/dependency_editor.cpp +++ b/editor/dependency_editor.cpp @@ -58,7 +58,7 @@ void DependencyEditor::_load_pressed(Object *p_item, int p_cell, int p_button) { for (List<String>::Element *E = ext.front(); E; E = E->next()) { search->add_filter("*" + E->get()); } - search->popup_centered_ratio(0.65); // So it doesn't completely cover the dialog below it. + search->popup_file_dialog(); } void DependencyEditor::_fix_and_find(EditorFileSystemDirectory *efsd, Map<String, Map<String, String>> &candidates) { @@ -205,7 +205,7 @@ void DependencyEditor::edit(const String &p_path) { set_title(TTR("Dependencies For:") + " " + p_path.get_file()); _update_list(); - popup_centered_ratio(0.7); // So it doesn't completely cover the dialog below it. + popup_centered_ratio(0.4); if (EditorNode::get_singleton()->is_scene_open(p_path)) { EditorNode::get_singleton()->show_warning(vformat(TTR("Scene '%s' is currently being edited.\nChanges will only take effect when reloaded."), p_path.get_file())); @@ -323,7 +323,7 @@ void DependencyEditorOwners::show(const String &p_path) { editing = p_path; owners->clear(); _fill_owners(EditorFileSystem::get_singleton()->get_filesystem()); - popup_centered_ratio(); + popup_centered_ratio(0.3); set_title(TTR("Owners Of:") + " " + p_path.get_file()); } @@ -714,7 +714,7 @@ void OrphanResourcesDialog::refresh() { void OrphanResourcesDialog::show() { refresh(); - popup_centered_ratio(); + popup_centered_ratio(0.4); } void OrphanResourcesDialog::_find_to_delete(TreeItem *p_item, List<String> &paths) { diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp index 669868c632..adb09532eb 100644 --- a/editor/editor_audio_buses.cpp +++ b/editor/editor_audio_buses.cpp @@ -1176,7 +1176,7 @@ void EditorAudioBuses::_save_as_layout() { file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE); file_dialog->set_title(TTR("Save Audio Bus Layout As...")); file_dialog->set_current_path(edited_path); - file_dialog->popup_centered_ratio(); + file_dialog->popup_file_dialog(); new_layout = false; } @@ -1184,7 +1184,7 @@ void EditorAudioBuses::_new_layout() { file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE); file_dialog->set_title(TTR("Location for New Layout...")); file_dialog->set_current_path(edited_path); - file_dialog->popup_centered_ratio(); + file_dialog->popup_file_dialog(); new_layout = true; } @@ -1192,7 +1192,7 @@ void EditorAudioBuses::_load_layout() { file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); file_dialog->set_title(TTR("Open Audio Bus Layout")); file_dialog->set_current_path(edited_path); - file_dialog->popup_centered_ratio(); + file_dialog->popup_file_dialog(); new_layout = false; } diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp index 4cd4f68fa2..94887fb848 100644 --- a/editor/editor_autoload_settings.cpp +++ b/editor/editor_autoload_settings.cpp @@ -919,5 +919,5 @@ void EditorAutoloadSettings::_set_autoload_add_path(const String &p_text) { } void EditorAutoloadSettings::_browse_autoload_add_path() { - file_dialog->popup_centered_ratio(); + file_dialog->popup_file_dialog(); } diff --git a/editor/editor_feature_profile.cpp b/editor/editor_feature_profile.cpp index 0d349eb247..f68cc3b323 100644 --- a/editor/editor_feature_profile.cpp +++ b/editor/editor_feature_profile.cpp @@ -403,10 +403,10 @@ void EditorFeatureProfileManager::_profile_action(int p_action) { _emit_current_profile_changed(); } break; case PROFILE_IMPORT: { - import_profiles->popup_centered_ratio(); + import_profiles->popup_file_dialog(); } break; case PROFILE_EXPORT: { - export_profile->popup_centered_ratio(); + export_profile->popup_file_dialog(); export_profile->set_current_file(_get_selected_profile() + ".profile"); } break; case PROFILE_NEW: { diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp index 50be291c91..85151c6d0a 100644 --- a/editor/editor_file_dialog.cpp +++ b/editor/editor_file_dialog.cpp @@ -50,6 +50,10 @@ EditorFileDialog::GetIconFunc EditorFileDialog::get_large_icon_func = nullptr; EditorFileDialog::RegisterFunc EditorFileDialog::register_func = nullptr; EditorFileDialog::RegisterFunc EditorFileDialog::unregister_func = nullptr; +void EditorFileDialog::popup_file_dialog() { + popup_centered_clamped(Size2(1050, 700) * EDSCALE, 0.8); +} + VBoxContainer *EditorFileDialog::get_vbox() { return vbox; } diff --git a/editor/editor_file_dialog.h b/editor/editor_file_dialog.h index 40906ab42b..df5b41ae1d 100644 --- a/editor/editor_file_dialog.h +++ b/editor/editor_file_dialog.h @@ -203,6 +203,7 @@ protected: static void _bind_methods(); //bind helpers public: + void popup_file_dialog(); void clear_filters(); void add_filter(const String &p_filter); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 3c53eab94e..9c0efd0881 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -994,8 +994,8 @@ void EditorNode::save_resource_as(const Ref<Resource> &p_resource, const String } file->set_current_path(existing); } - file->popup_centered_ratio(); file->set_title(TTR("Save Resource As...")); + file->popup_file_dialog(); } void EditorNode::_menu_option(int p_option) { @@ -2182,7 +2182,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { file->set_current_path(scene->get_filename()); }; file->set_title(p_option == FILE_OPEN_SCENE ? TTR("Open Scene") : TTR("Open Base Scene")); - file->popup_centered_ratio(); + file->popup_file_dialog(); } break; case FILE_QUICK_OPEN: { @@ -2318,7 +2318,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { } file->set_current_path(existing); } - file->popup_centered_ratio(); + file->popup_file_dialog(); file->set_title(TTR("Save Scene As...")); } break; @@ -2357,7 +2357,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { file_export_lib->add_filter("*." + E->get()); } - file_export_lib->popup_centered_ratio(); + file_export_lib->popup_file_dialog(); file_export_lib->set_title(TTR("Export Mesh Library")); } break; @@ -2376,7 +2376,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { file_export_lib->add_filter("*." + E->get()); } - file_export_lib->popup_centered_ratio(); + file_export_lib->popup_file_dialog(); file_export_lib->set_title(TTR("Export Tile Set")); } break; @@ -2642,7 +2642,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { file->set_current_path(scene->get_filename()); }; file->set_title(TTR("Pick a Main Scene")); - file->popup_centered_ratio(); + file->popup_file_dialog(); } break; case HELP_SEARCH: { diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 48f1a1f134..c3f0d1b712 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -253,7 +253,7 @@ void EditorPropertyPath::_path_pressed() { dialog->set_current_path(full_path); } - dialog->popup_centered_ratio(); + dialog->popup_file_dialog(); } void EditorPropertyPath::update_property() { @@ -2207,7 +2207,7 @@ void EditorPropertyNodePath::_node_assign() { add_child(scene_tree); scene_tree->connect("selected", callable_mp(this, &EditorPropertyNodePath::_node_selected)); } - scene_tree->popup_centered_ratio(); + scene_tree->popup_scenetree_dialog(); } void EditorPropertyNodePath::_node_clear() { @@ -2343,7 +2343,7 @@ void EditorPropertyResource::_file_selected(const String &p_path) { } void EditorPropertyResource::_menu_option(int p_which) { - // scene_tree->popup_centered_ratio(); + //scene_tree->popup_scenetree_dialog(); switch (p_which) { case OBJ_MENU_LOAD: { if (!file) { @@ -2369,7 +2369,7 @@ void EditorPropertyResource::_menu_option(int p_which) { file->add_filter("*." + E->get() + " ; " + E->get().to_upper()); } - file->popup_centered_ratio(); + file->popup_file_dialog(); } break; case OBJ_MENU_EDIT: { @@ -2507,7 +2507,7 @@ void EditorPropertyResource::_menu_option(int p_which) { scene_tree->connect("selected", callable_mp(this, &EditorPropertyResource::_viewport_selected)); scene_tree->set_title(TTR("Pick a Viewport")); } - scene_tree->popup_centered_ratio(); + scene_tree->popup_scenetree_dialog(); return; } diff --git a/editor/editor_sub_scene.cpp b/editor/editor_sub_scene.cpp index a9b1a28092..f794babc24 100644 --- a/editor/editor_sub_scene.cpp +++ b/editor/editor_sub_scene.cpp @@ -66,7 +66,7 @@ void EditorSubScene::_path_changed(const String &p_path) { } void EditorSubScene::_path_browse() { - file_dialog->popup_centered_ratio(); + file_dialog->popup_file_dialog(); } void EditorSubScene::_notification(int p_what) { diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp index fb12c15913..84517f36ea 100644 --- a/editor/export_template_manager.cpp +++ b/editor/export_template_manager.cpp @@ -334,7 +334,7 @@ void ExportTemplateManager::popup_manager() { } void ExportTemplateManager::ok_pressed() { - template_open->popup_centered_ratio(); + template_open->popup_file_dialog(); } void ExportTemplateManager::_http_download_mirror_completed(int p_status, int p_code, const PackedStringArray &headers, const PackedByteArray &p_data) { diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp index 53c52b94cc..bd4bb57dcf 100644 --- a/editor/find_in_files.cpp +++ b/editor/find_in_files.cpp @@ -483,7 +483,7 @@ void FindInFilesDialog::_notification(int p_what) { } void FindInFilesDialog::_on_folder_button_pressed() { - _folder_dialog->popup_centered_ratio(); + _folder_dialog->popup_file_dialog(); } void FindInFilesDialog::custom_action(const String &p_action) { diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp index 903d9a2d31..8f1b8838d8 100644 --- a/editor/inspector_dock.cpp +++ b/editor/inspector_dock.cpp @@ -150,7 +150,7 @@ void InspectorDock::_load_resource(const String &p_type) { load_resource_dialog->add_filter("*." + extensions[i] + " ; " + extensions[i].to_upper()); } - load_resource_dialog->popup_centered_ratio(); + load_resource_dialog->popup_file_dialog(); } void InspectorDock::_resource_file_selected(String p_file) { diff --git a/editor/localization_editor.cpp b/editor/localization_editor.cpp index 98b6d32ae3..6764f70d9b 100644 --- a/editor/localization_editor.cpp +++ b/editor/localization_editor.cpp @@ -82,7 +82,7 @@ void LocalizationEditor::_translation_add(const String &p_path) { } void LocalizationEditor::_translation_file_open() { - translation_file_open->popup_centered_ratio(); + translation_file_open->popup_file_dialog(); } void LocalizationEditor::_translation_delete(Object *p_item, int p_column, int p_button) { @@ -108,7 +108,7 @@ void LocalizationEditor::_translation_delete(Object *p_item, int p_column, int p } void LocalizationEditor::_translation_res_file_open() { - translation_res_file_open_dialog->popup_centered_ratio(); + translation_res_file_open_dialog->popup_file_dialog(); } void LocalizationEditor::_translation_res_add(const String &p_path) { @@ -137,7 +137,7 @@ void LocalizationEditor::_translation_res_add(const String &p_path) { } void LocalizationEditor::_translation_res_option_file_open() { - translation_res_option_file_open_dialog->popup_centered_ratio(); + translation_res_option_file_open_dialog->popup_file_dialog(); } void LocalizationEditor::_translation_res_option_add(const String &p_path) { @@ -406,11 +406,11 @@ void LocalizationEditor::_pot_delete(Object *p_item, int p_column, int p_button) } void LocalizationEditor::_pot_file_open() { - pot_file_open_dialog->popup_centered_ratio(); + pot_file_open_dialog->popup_file_dialog(); } void LocalizationEditor::_pot_generate_open() { - pot_generate_dialog->popup_centered_ratio(); + pot_generate_dialog->popup_file_dialog(); } void LocalizationEditor::_pot_generate(const String &p_file) { diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp index 959301907c..d335b29c2f 100644 --- a/editor/plugins/animation_blend_space_1d_editor.cpp +++ b/editor/plugins/animation_blend_space_1d_editor.cpp @@ -375,7 +375,7 @@ void AnimationNodeBlendSpace1DEditor::_add_menu_type(int p_index) { for (List<String>::Element *E = filters.front(); E; E = E->next()) { open_file->add_filter("*." + E->get()); } - open_file->popup_centered_ratio(); + open_file->popup_file_dialog(); return; } else if (p_index == MENU_LOAD_FILE_CONFIRM) { node = file_loaded; diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp index 1ab114fc01..805df0cbb9 100644 --- a/editor/plugins/animation_blend_space_2d_editor.cpp +++ b/editor/plugins/animation_blend_space_2d_editor.cpp @@ -298,7 +298,7 @@ void AnimationNodeBlendSpace2DEditor::_add_menu_type(int p_index) { for (List<String>::Element *E = filters.front(); E; E = E->next()) { open_file->add_filter("*." + E->get()); } - open_file->popup_centered_ratio(); + open_file->popup_file_dialog(); return; } else if (p_index == MENU_LOAD_FILE_CONFIRM) { node = file_loaded; diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp index 82d942821f..6419f62343 100644 --- a/editor/plugins/animation_blend_tree_editor_plugin.cpp +++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp @@ -276,7 +276,7 @@ void AnimationNodeBlendTreeEditor::_add_node(int p_idx) { for (List<String>::Element *E = filters.front(); E; E = E->next()) { open_file->add_filter("*." + E->get()); } - open_file->popup_centered_ratio(); + open_file->popup_file_dialog(); return; } else if (p_idx == MENU_LOAD_FILE_CONFIRM) { anode = file_loaded; diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index be220fb30c..e2f35e29d8 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -340,7 +340,7 @@ void AnimationPlayerEditor::_animation_load() { file->add_filter("*." + E->get() + " ; " + E->get().to_upper()); } - file->popup_centered_ratio(); + file->popup_file_dialog(); current_option = RESOURCE_LOAD; } @@ -399,8 +399,8 @@ void AnimationPlayerEditor::_animation_save_as(const Ref<Resource> &p_resource) } } file->set_current_path(path); - file->popup_centered_ratio(); file->set_title(TTR("Save Resource As...")); + file->popup_file_dialog(); current_option = RESOURCE_SAVE; } diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp index 0970608853..26006d85c9 100644 --- a/editor/plugins/animation_state_machine_editor.cpp +++ b/editor/plugins/animation_state_machine_editor.cpp @@ -406,7 +406,7 @@ void AnimationNodeStateMachineEditor::_add_menu_type(int p_index) { for (List<String>::Element *E = filters.front(); E; E = E->next()) { open_file->add_filter("*." + E->get()); } - open_file->popup_centered_ratio(); + open_file->popup_file_dialog(); return; } else if (p_index == MENU_LOAD_FILE_CONFIRM) { node = file_loaded; diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index da170cd498..28ac85457b 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -1260,7 +1260,7 @@ void EditorAssetLibrary::_asset_file_selected(const String &p_file) { } void EditorAssetLibrary::_asset_open() { - asset_open->popup_centered_ratio(); + asset_open->popup_file_dialog(); } void EditorAssetLibrary::_manage_plugins() { diff --git a/editor/plugins/baked_lightmap_editor_plugin.cpp b/editor/plugins/baked_lightmap_editor_plugin.cpp index ee9feb7f74..e5d4e4a761 100644 --- a/editor/plugins/baked_lightmap_editor_plugin.cpp +++ b/editor/plugins/baked_lightmap_editor_plugin.cpp @@ -54,7 +54,7 @@ void BakedLightmapEditorPlugin::_bake_select_file(const String &p_file) { scene_path = scene_path.get_basename() + ".lmbake"; file_dialog->set_current_path(scene_path); - file_dialog->popup_centered_ratio(); + file_dialog->popup_file_dialog(); } break; case BakedLightmap::BAKE_ERROR_NO_MESHES: diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 44913abe8b..3c6556a310 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -2045,10 +2045,10 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) { if ((b->get_alt() && !b->get_control()) || tool == TOOL_MOVE) { List<CanvasItem *> selection = _get_edited_canvas_items(); - // Remove not movable nodes + drag_selection.clear(); for (int i = 0; i < selection.size(); i++) { - if (!_is_node_movable(selection[i], true)) { - selection.erase(selection[i]); + if (_is_node_movable(selection[i], true)) { + drag_selection.push_back(selection[i]); } } @@ -2073,7 +2073,6 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) { } drag_from = transform.affine_inverse().xform(b->get_position()); - drag_selection = selection; _save_canvas_item_state(drag_selection); } return true; @@ -2395,16 +2394,15 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) { // Drag the node(s) if requested List<CanvasItem *> selection2 = _get_edited_canvas_items(); - // Remove not movable nodes + drag_selection.clear(); for (int i = 0; i < selection2.size(); i++) { - if (!_is_node_movable(selection2[i], true)) { - selection2.erase(selection2[i]); + if (_is_node_movable(selection2[i], true)) { + drag_selection.push_back(selection2[i]); } } if (selection2.size() > 0) { drag_type = DRAG_MOVE; - drag_selection = selection2; drag_from = click; _save_canvas_item_state(drag_selection); } diff --git a/editor/plugins/cpu_particles_2d_editor_plugin.cpp b/editor/plugins/cpu_particles_2d_editor_plugin.cpp index 008de7cfb4..32f7d02af2 100644 --- a/editor/plugins/cpu_particles_2d_editor_plugin.cpp +++ b/editor/plugins/cpu_particles_2d_editor_plugin.cpp @@ -60,7 +60,7 @@ void CPUParticles2DEditorPlugin::_file_selected(const String &p_file) { void CPUParticles2DEditorPlugin::_menu_callback(int p_idx) { switch (p_idx) { case MENU_LOAD_EMISSION_MASK: { - file->popup_centered_ratio(); + file->popup_file_dialog(); } break; case MENU_CLEAR_EMISSION_MASK: { diff --git a/editor/plugins/cpu_particles_3d_editor_plugin.cpp b/editor/plugins/cpu_particles_3d_editor_plugin.cpp index ef26ecd767..d44e487ae4 100644 --- a/editor/plugins/cpu_particles_3d_editor_plugin.cpp +++ b/editor/plugins/cpu_particles_3d_editor_plugin.cpp @@ -48,7 +48,7 @@ void CPUParticles3DEditor::_notification(int p_notification) { void CPUParticles3DEditor::_menu_option(int p_option) { switch (p_option) { case MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_NODE: { - emission_tree_dialog->popup_centered_ratio(); + emission_tree_dialog->popup_scenetree_dialog(); } break; diff --git a/editor/plugins/gi_probe_editor_plugin.cpp b/editor/plugins/gi_probe_editor_plugin.cpp index 1b48e17772..2f5dd36ef1 100644 --- a/editor/plugins/gi_probe_editor_plugin.cpp +++ b/editor/plugins/gi_probe_editor_plugin.cpp @@ -41,7 +41,7 @@ void GIProbeEditorPlugin::_bake() { path = path.get_basename() + "." + gi_probe->get_name() + "_data.res"; } probe_file->set_current_path(path); - probe_file->popup_centered_ratio(); + probe_file->popup_file_dialog(); return; } gi_probe->bake(); diff --git a/editor/plugins/gpu_particles_2d_editor_plugin.cpp b/editor/plugins/gpu_particles_2d_editor_plugin.cpp index 01420dac3e..d27df1d063 100644 --- a/editor/plugins/gpu_particles_2d_editor_plugin.cpp +++ b/editor/plugins/gpu_particles_2d_editor_plugin.cpp @@ -69,7 +69,7 @@ void GPUParticles2DEditorPlugin::_menu_callback(int p_idx) { generate_visibility_rect->popup_centered(); } break; case MENU_LOAD_EMISSION_MASK: { - file->popup_centered_ratio(); + file->popup_file_dialog(); } break; case MENU_CLEAR_EMISSION_MASK: { diff --git a/editor/plugins/gpu_particles_3d_editor_plugin.cpp b/editor/plugins/gpu_particles_3d_editor_plugin.cpp index fa507dd3d7..c98ba25db5 100644 --- a/editor/plugins/gpu_particles_3d_editor_plugin.cpp +++ b/editor/plugins/gpu_particles_3d_editor_plugin.cpp @@ -254,7 +254,7 @@ void GPUParticles3DEditor::_menu_option(int p_option) { return; } - emission_tree_dialog->popup_centered_ratio(); + emission_tree_dialog->popup_scenetree_dialog(); } break; case MENU_OPTION_CONVERT_TO_CPU_PARTICLES: { diff --git a/editor/plugins/mesh_library_editor_plugin.cpp b/editor/plugins/mesh_library_editor_plugin.cpp index 7690beeee8..374a8c8290 100644 --- a/editor/plugins/mesh_library_editor_plugin.cpp +++ b/editor/plugins/mesh_library_editor_plugin.cpp @@ -224,7 +224,7 @@ void MeshLibraryEditor::_menu_cbk(int p_option) { } } break; case MENU_OPTION_IMPORT_FROM_SCENE: { - file->popup_centered_ratio(); + file->popup_file_dialog(); } break; case MENU_OPTION_UPDATE_FROM_SCENE: { cd->set_text(vformat(TTR("Update from existing scene?:\n%s"), String(mesh_library->get_meta("_editor_source_scene")))); diff --git a/editor/plugins/multimesh_editor_plugin.cpp b/editor/plugins/multimesh_editor_plugin.cpp index 3904389e09..bd1384967f 100644 --- a/editor/plugins/multimesh_editor_plugin.cpp +++ b/editor/plugins/multimesh_editor_plugin.cpp @@ -251,7 +251,7 @@ void MultiMeshEditor::edit(MultiMeshInstance3D *p_multimesh) { void MultiMeshEditor::_browse(bool p_source) { browsing_source = p_source; std->get_scene_tree()->set_marked(node, false); - std->popup_centered_ratio(); + std->popup_scenetree_dialog(); if (p_source) { std->set_title(TTR("Select a Source Mesh:")); } else { diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp index 75cb93ee76..9ab5bfd8a3 100644 --- a/editor/plugins/resource_preloader_editor_plugin.cpp +++ b/editor/plugins/resource_preloader_editor_plugin.cpp @@ -95,8 +95,7 @@ void ResourcePreloaderEditor::_load_pressed() { } file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILES); - - file->popup_centered_ratio(); + file->popup_file_dialog(); } void ResourcePreloaderEditor::_item_edited() { diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 2d92638cda..4f783f4e27 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -1107,7 +1107,7 @@ void ScriptEditor::_menu_option(int p_option) { file_dialog_option = FILE_NEW_TEXTFILE; file_dialog->clear_filters(); - file_dialog->popup_centered_ratio(); + file_dialog->popup_file_dialog(); file_dialog->set_title(TTR("New Text File...")); } break; case FILE_OPEN: { @@ -1122,7 +1122,7 @@ void ScriptEditor::_menu_option(int p_option) { file_dialog->add_filter("*." + extensions[i] + " ; " + extensions[i].to_upper()); } - file_dialog->popup_centered_ratio(); + file_dialog->popup_file_dialog(); file_dialog->set_title(TTR("Open File")); return; } break; @@ -1275,7 +1275,7 @@ void ScriptEditor::_menu_option(int p_option) { file_dialog->clear_filters(); file_dialog->set_current_dir(text_file->get_path().get_base_dir()); file_dialog->set_current_file(text_file->get_path().get_file()); - file_dialog->popup_centered_ratio(); + file_dialog->popup_file_dialog(); file_dialog->set_title(TTR("Save File As...")); break; } @@ -1425,7 +1425,7 @@ void ScriptEditor::_theme_option(int p_option) { file_dialog_option = THEME_IMPORT; file_dialog->clear_filters(); file_dialog->add_filter("*.tet"); - file_dialog->popup_centered_ratio(); + file_dialog->popup_file_dialog(); file_dialog->set_title(TTR("Import Theme")); } break; case THEME_RELOAD: { @@ -1451,7 +1451,7 @@ void ScriptEditor::_show_save_theme_as_dialog() { file_dialog->clear_filters(); file_dialog->add_filter("*.tet"); file_dialog->set_current_path(EditorSettings::get_singleton()->get_text_editor_themes_dir().plus_file(EditorSettings::get_singleton()->get("text_editor/theme/color_theme"))); - file_dialog->popup_centered_ratio(); + file_dialog->popup_file_dialog(); file_dialog->set_title(TTR("Save Theme As...")); } diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index 7102faf58a..516c14329c 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -48,7 +48,7 @@ void SpriteFramesEditor::_open_sprite_sheet() { file_split_sheet->add_filter("*." + extensions[i]); } - file_split_sheet->popup_centered_ratio(); + file_split_sheet->popup_file_dialog(); } void SpriteFramesEditor::_sheet_preview_draw() { @@ -298,8 +298,7 @@ void SpriteFramesEditor::_load_pressed() { } file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILES); - - file->popup_centered_ratio(); + file->popup_file_dialog(); } void SpriteFramesEditor::_paste_pressed() { diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index a37cf7e426..b121a7ae3e 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -646,7 +646,7 @@ void TileSetEditor::_on_tileset_toolbar_button_pressed(int p_index) { option = p_index; switch (option) { case TOOL_TILESET_ADD_TEXTURE: { - texture_dialog->popup_centered_ratio(); + texture_dialog->popup_file_dialog(); } break; case TOOL_TILESET_REMOVE_TEXTURE: { if (get_current_texture().is_valid()) { diff --git a/editor/project_export.cpp b/editor/project_export.cpp index a7be81414f..f45161d87b 100644 --- a/editor/project_export.cpp +++ b/editor/project_export.cpp @@ -397,7 +397,7 @@ void ProjectExportDialog::_patch_button_pressed(Object *p_item, int p_column, in patch_erase->set_text(vformat(TTR("Delete patch '%s' from list?"), patches[patch_index].get_file())); patch_erase->popup_centered(); } else { - patch_dialog->popup_centered_ratio(); + patch_dialog->popup_file_dialog(); } } @@ -876,7 +876,7 @@ void ProjectExportDialog::_tree_changed() { } void ProjectExportDialog::_export_pck_zip() { - export_pck_zip->popup_centered_ratio(); + export_pck_zip->popup_file_dialog(); } void ProjectExportDialog::_export_pck_zip_selected(const String &p_path) { @@ -952,7 +952,7 @@ void ProjectExportDialog::_export_project() { } export_project->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE); - export_project->popup_centered_ratio(); + export_project->popup_file_dialog(); } void ProjectExportDialog::_export_project_to_path(const String &p_path) { diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index cd85817622..a68742a985 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -365,13 +365,13 @@ private: } else { fdialog->set_file_mode(FileDialog::FILE_MODE_OPEN_DIR); } - fdialog->popup_centered_ratio(); + fdialog->popup_file_dialog(); } void _browse_install_path() { fdialog_install->set_current_dir(install_path->get_text()); fdialog_install->set_file_mode(FileDialog::FILE_MODE_OPEN_DIR); - fdialog_install->popup_centered_ratio(); + fdialog_install->popup_file_dialog(); } void _create_folder() { @@ -2159,7 +2159,7 @@ void ProjectManager::_scan_begin(const String &p_base) { } void ProjectManager::_scan_projects() { - scan_dir->popup_centered_ratio(); + scan_dir->popup_file_dialog(); } void ProjectManager::_new_project() { diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp index f4838d336f..c9115fb870 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -152,7 +152,7 @@ void CustomPropertyEditor::_menu_option(int p_which) { file->add_filter("*." + E->get() + " ; " + E->get().to_upper()); } - file->popup_centered_ratio(); + file->popup_file_dialog(); } break; case OBJ_MENU_EDIT: { @@ -257,7 +257,7 @@ void CustomPropertyEditor::_menu_option(int p_which) { if (intype == "ViewportTexture") { scene_tree->set_title(TTR("Pick a Viewport")); - scene_tree->popup_centered_ratio(); + scene_tree->popup_scenetree_dialog(); picking_viewport = true; return; } @@ -1198,7 +1198,7 @@ void CustomPropertyEditor::_action_pressed(int p_which) { file->add_filter(filter + " ; " + extensions[i].to_upper()); } } - file->popup_centered_ratio(); + file->popup_file_dialog(); } else { v = ""; emit_signal("variant_changed"); @@ -1214,7 +1214,7 @@ void CustomPropertyEditor::_action_pressed(int p_which) { } file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_DIR); file->clear_filters(); - file->popup_centered_ratio(); + file->popup_file_dialog(); } else { v = ""; emit_signal("variant_changed"); @@ -1227,7 +1227,7 @@ void CustomPropertyEditor::_action_pressed(int p_which) { if (p_which == 0) { picking_viewport = false; scene_tree->set_title(TTR("Pick a Node")); - scene_tree->popup_centered_ratio(); + scene_tree->popup_scenetree_dialog(); } else if (p_which == 1) { v = NodePath(); @@ -1281,7 +1281,7 @@ void CustomPropertyEditor::_action_pressed(int p_which) { file->add_filter("*." + E->get() + " ; " + E->get().to_upper()); } - file->popup_centered_ratio(); + file->popup_file_dialog(); } else if (p_which == 2) { RES r = v; diff --git a/editor/quick_open.cpp b/editor/quick_open.cpp index 4af6fb2053..e1308b4895 100644 --- a/editor/quick_open.cpp +++ b/editor/quick_open.cpp @@ -34,183 +34,184 @@ void EditorQuickOpen::popup_dialog(const StringName &p_base, bool p_enable_multi, bool p_dontclear) { base_type = p_base; - search_options->set_select_mode(p_enable_multi ? Tree::SELECT_MULTI : Tree::SELECT_SINGLE); - popup_centered_ratio(0.4); + allow_multi_select = p_enable_multi; + search_options->set_select_mode(allow_multi_select ? Tree::SELECT_MULTI : Tree::SELECT_SINGLE); + popup_centered_clamped(Size2i(600, 440), 0.8f); + + EditorFileSystemDirectory *efsd = EditorFileSystem::get_singleton()->get_filesystem(); + _build_search_cache(efsd); if (p_dontclear) { search_box->select_all(); + _update_search(); } else { - search_box->clear(); + search_box->clear(); // This will emit text_changed. } - search_box->grab_focus(); - _update_search(); } -String EditorQuickOpen::get_selected() const { - TreeItem *ti = search_options->get_selected(); - if (!ti) { - return String(); +void EditorQuickOpen::_build_search_cache(EditorFileSystemDirectory *p_efsd) { + for (int i = 0; i < p_efsd->get_subdir_count(); i++) { + _build_search_cache(p_efsd->get_subdir(i)); } - return "res://" + ti->get_text(0); -} + for (int i = 0; i < p_efsd->get_file_count(); i++) { + String file_type = p_efsd->get_file_type(i); + if (ClassDB::is_parent_class(file_type, base_type)) { + String file = p_efsd->get_file_path(i); + files.push_back(file.substr(6, file.length())); -Vector<String> EditorQuickOpen::get_selected_files() const { - Vector<String> files; + // Store refs to used icons. + String ext = file.get_extension(); + if (!icons.has(ext)) { + icons.insert(ext, get_theme_icon((has_theme_icon(file_type, "EditorIcons") ? file_type : "Object"), "EditorIcons")); + } + } + } +} - TreeItem *item = search_options->get_next_selected(search_options->get_root()); - while (item) { - files.push_back("res://" + item->get_text(0)); - item = search_options->get_next_selected(item); +void EditorQuickOpen::_update_search() { + const String search_text = search_box->get_text(); + const bool empty_search = search_text == ""; + + // Filter possible candidates. + Vector<Entry> entries; + for (int i = 0; i < files.size(); i++) { + if (empty_search || search_text.is_subsequence_ofi(files[i])) { + Entry r; + r.path = files[i]; + r.score = empty_search ? 0 : _score_path(search_text, files[i].to_lower()); + entries.push_back(r); + } } - return files; -} + // Display results + TreeItem *root = search_options->get_root(); + root->clear_children(); -void EditorQuickOpen::_text_changed(const String &p_newtext) { - _update_search(); -} + if (entries.size() > 0) { + if (!empty_search) { + SortArray<Entry, EntryComparator> sorter; + sorter.sort(entries.ptrw(), entries.size()); + } -void EditorQuickOpen::_sbox_input(const Ref<InputEvent> &p_ie) { - Ref<InputEventKey> k = p_ie; - if (k.is_valid()) { - switch (k->get_keycode()) { - case KEY_UP: - case KEY_DOWN: - case KEY_PAGEUP: - case KEY_PAGEDOWN: { - search_options->call("_gui_input", k); - search_box->accept_event(); + const int entry_limit = MIN(entries.size(), 300); + for (int i = 0; i < entry_limit; i++) { + TreeItem *ti = search_options->create_item(root); + ti->set_text(0, entries[i].path); + ti->set_icon(0, *icons.lookup_ptr(entries[i].path.get_extension())); + } - TreeItem *root = search_options->get_root(); - if (!root->get_children()) { - break; - } + TreeItem *to_select = root->get_children(); + to_select->select(0); + to_select->set_as_cursor(0); + search_options->scroll_to_item(to_select); - TreeItem *current = search_options->get_selected(); - TreeItem *item = search_options->get_next_selected(root); - while (item) { - item->deselect(0); - item = search_options->get_next_selected(item); - } + get_ok()->set_disabled(false); + } else { + search_options->deselect_all(); - current->select(0); - current->set_as_cursor(0); - } break; - } + get_ok()->set_disabled(true); } } -float EditorQuickOpen::_score_path(String search, String path) const { - // Positive bias for matches close to the _beginning of the file name_. - String file = path.get_file(); - int pos = file.findn(search); +float EditorQuickOpen::_score_path(const String &p_search, const String &p_path) { + float score = 0.9f + .1f * (p_search.length() / (float)p_path.length()); + + // Positive bias for matches close to the beginning of the file name. + String file = p_path.get_file(); + int pos = file.findn(p_search); if (pos != -1) { - return 1.0f - 0.1f * (float(pos) / file.length()); + return score * (1.0f - 0.1f * (float(pos) / file.length())); } - // Positive bias for matches close to the _end of the path_. - String base = path.get_base_dir(); - pos = base.rfindn(search); + // Positive bias for matches close to the end of the path. + pos = p_path.rfindn(p_search); if (pos != -1) { - return 0.9f - 0.1f * (float(base.length() - pos) / base.length()); + return score * (0.8f - 0.1f * (float(p_path.length() - pos) / p_path.length())); } - // Results that contain all characters but not the string. - return path.similarity(search) * 0.8f; + // Remaining results belong to the same class of results. + return score * 0.69f; } -void EditorQuickOpen::_parse_fs(EditorFileSystemDirectory *efsd, Vector<Pair<String, Ref<Texture2D>>> &list) { - for (int i = 0; i < efsd->get_subdir_count(); i++) { - _parse_fs(efsd->get_subdir(i), list); - } - - for (int i = 0; i < efsd->get_file_count(); i++) { - StringName file_type = efsd->get_file_type(i); - - if (ClassDB::is_parent_class(file_type, base_type)) { - String file = efsd->get_file_path(i); - file = file.substr(6, file.length()); - - if (search_box->get_text().is_subsequence_ofi(file)) { - Pair<String, Ref<Texture2D>> pair; - pair.first = file; - pair.second = search_options->get_theme_icon(search_options->has_theme_icon(file_type, ei) ? file_type : ot, ei); - list.push_back(pair); - } - } +void EditorQuickOpen::_confirmed() { + if (!search_options->get_selected()) { + return; } + _cleanup(); + emit_signal("quick_open"); + hide(); } -Vector<Pair<String, Ref<Texture2D>>> EditorQuickOpen::_sort_fs(Vector<Pair<String, Ref<Texture2D>>> &list) { - String search_text = search_box->get_text().to_lower(); - Vector<Pair<String, Ref<Texture2D>>> sorted_list; +void EditorQuickOpen::cancel_pressed() { + _cleanup(); +} - if (search_text == String() || list.size() == 0) { - return list; - } +void EditorQuickOpen::_cleanup() { + files.clear(); + icons.clear(); +} - Vector<float> scores; - scores.resize(list.size()); - for (int i = 0; i < list.size(); i++) { - scores.write[i] = _score_path(search_text, list[i].first.to_lower()); - } +void EditorQuickOpen::_text_changed(const String &p_newtext) { + _update_search(); +} - while (list.size() > 0) { - float best_score = 0.0f; - int best_idx = 0; +void EditorQuickOpen::_sbox_input(const Ref<InputEvent> &p_ie) { + Ref<InputEventKey> k = p_ie; + if (k.is_valid()) { + switch (k->get_keycode()) { + case KEY_UP: + case KEY_DOWN: + case KEY_PAGEUP: + case KEY_PAGEDOWN: { + search_options->call("_gui_input", k); + search_box->accept_event(); - for (int i = 0; i < list.size(); i++) { - float current_score = scores[i]; - if (current_score > best_score) { - best_score = current_score; - best_idx = i; - } + if (allow_multi_select) { + TreeItem *root = search_options->get_root(); + if (!root->get_children()) { + break; + } + + TreeItem *current = search_options->get_selected(); + TreeItem *item = search_options->get_next_selected(root); + while (item) { + item->deselect(0); + item = search_options->get_next_selected(item); + } + + current->select(0); + current->set_as_cursor(0); + } + } break; } - - sorted_list.push_back(list[best_idx]); - list.remove(best_idx); - scores.remove(best_idx); } - - return sorted_list; } -void EditorQuickOpen::_update_search() { - search_options->clear(); - TreeItem *root = search_options->create_item(); - EditorFileSystemDirectory *efsd = EditorFileSystem::get_singleton()->get_filesystem(); - Vector<Pair<String, Ref<Texture2D>>> list; - - _parse_fs(efsd, list); - list = _sort_fs(list); - - for (int i = 0; i < list.size(); i++) { - TreeItem *ti = search_options->create_item(root); - ti->set_text(0, list[i].first); - ti->set_icon(0, list[i].second); - } - - TreeItem *result = root->get_children(); - if (result) { - result->select(0); - result->set_as_cursor(0); +String EditorQuickOpen::get_selected() const { + TreeItem *ti = search_options->get_selected(); + if (!ti) { + return String(); } - get_ok()->set_disabled(!result); + return "res://" + ti->get_text(0); } -void EditorQuickOpen::_confirmed() { - if (!search_options->get_selected()) { - return; +Vector<String> EditorQuickOpen::get_selected_files() const { + Vector<String> selected_files; + + TreeItem *item = search_options->get_next_selected(search_options->get_root()); + while (item) { + selected_files.push_back("res://" + item->get_text(0)); + item = search_options->get_next_selected(item); } - emit_signal("quick_open"); - hide(); + + return selected_files; } -void EditorQuickOpen::_theme_changed() { - search_box->set_right_icon(search_options->get_theme_icon("Search", ei)); +StringName EditorQuickOpen::get_base_type() const { + return base_type; } void EditorQuickOpen::_notification(int p_what) { @@ -226,8 +227,8 @@ void EditorQuickOpen::_notification(int p_what) { } } -StringName EditorQuickOpen::get_base_type() const { - return base_type; +void EditorQuickOpen::_theme_changed() { + search_box->set_right_icon(search_options->get_theme_icon("Search", "EditorIcons")); } void EditorQuickOpen::_bind_methods() { @@ -235,6 +236,8 @@ void EditorQuickOpen::_bind_methods() { } EditorQuickOpen::EditorQuickOpen() { + allow_multi_select = false; + VBoxContainer *vbc = memnew(VBoxContainer); vbc->connect("theme_changed", callable_mp(this, &EditorQuickOpen::_theme_changed)); add_child(vbc); @@ -243,18 +246,16 @@ EditorQuickOpen::EditorQuickOpen() { search_box->connect("text_changed", callable_mp(this, &EditorQuickOpen::_text_changed)); search_box->connect("gui_input", callable_mp(this, &EditorQuickOpen::_sbox_input)); vbc->add_margin_child(TTR("Search:"), search_box); + register_text_enter(search_box); search_options = memnew(Tree); search_options->connect("item_activated", callable_mp(this, &EditorQuickOpen::_confirmed)); + search_options->create_item(); search_options->set_hide_root(true); search_options->set_hide_folding(true); search_options->add_theme_constant_override("draw_guides", 1); vbc->add_margin_child(TTR("Matches:"), search_options, true); get_ok()->set_text(TTR("Open")); - register_text_enter(search_box); set_hide_on_ok(false); - - ei = "EditorIcons"; - ot = "Object"; } diff --git a/editor/quick_open.h b/editor/quick_open.h index 5bcdfc7bf2..6486ee0221 100644 --- a/editor/quick_open.h +++ b/editor/quick_open.h @@ -31,7 +31,7 @@ #ifndef EDITOR_QUICK_OPEN_H #define EDITOR_QUICK_OPEN_H -#include "core/pair.h" +#include "core/oa_hash_map.h" #include "editor_file_system.h" #include "scene/gui/dialogs.h" #include "scene/gui/tree.h" @@ -41,19 +41,32 @@ class EditorQuickOpen : public ConfirmationDialog { LineEdit *search_box; Tree *search_options; - StringName base_type; - StringName ei; - StringName ot; + bool allow_multi_select; - void _update_search(); + Vector<String> files; + OAHashMap<String, Ref<Texture2D>> icons; - void _sbox_input(const Ref<InputEvent> &p_ie); - void _parse_fs(EditorFileSystemDirectory *efsd, Vector<Pair<String, Ref<Texture2D>>> &list); - Vector<Pair<String, Ref<Texture2D>>> _sort_fs(Vector<Pair<String, Ref<Texture2D>>> &list); - float _score_path(String search, String path) const; + struct Entry { + String path; + float score; + }; + + struct EntryComparator { + _FORCE_INLINE_ bool operator()(const Entry &A, const Entry &B) const { + return A.score > B.score; + } + }; + + void _update_search(); + void _build_search_cache(EditorFileSystemDirectory *p_efsd); + float _score_path(const String &p_search, const String &p_path); void _confirmed(); + virtual void cancel_pressed() override; + void _cleanup(); + + void _sbox_input(const Ref<InputEvent> &p_ie); void _text_changed(const String &p_newtext); void _theme_changed(); diff --git a/editor/reparent_dialog.cpp b/editor/reparent_dialog.cpp index e5ae09f5ff..1615336a4b 100644 --- a/editor/reparent_dialog.cpp +++ b/editor/reparent_dialog.cpp @@ -75,14 +75,8 @@ ReparentDialog::ReparentDialog() { tree = memnew(SceneTreeEditor(false)); tree->set_show_enabled_subscene(true); - - vbc->add_margin_child(TTR("Reparent Location (Select new Parent):"), tree, true); - tree->get_scene_tree()->connect("item_activated", callable_mp(this, &ReparentDialog::_reparent)); - - //Label *label = memnew( Label ); - //label->set_position( Point2( 15,8) ); - //label->set_text("Reparent Location (Select new Parent):"); + vbc->add_margin_child(TTR("Select new parent:"), tree, true); keep_transform = memnew(CheckBox); keep_transform->set_text(TTR("Keep Global Transform")); diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 41b8baeb2f..90747e45e4 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -645,9 +645,8 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { for (List<Node *>::Element *E = nodes.front(); E; E = E->next()) { nodeset.insert(E->get()); } - reparent_dialog->popup_centered_ratio(); reparent_dialog->set_current(nodeset); - + reparent_dialog->popup_centered_clamped(Size2(350, 700) * EDSCALE); } break; case TOOL_MAKE_ROOT: { if (!profile_allow_editing) { @@ -834,8 +833,8 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { } new_scene_from_dialog->set_current_path(existing); - new_scene_from_dialog->popup_centered_ratio(); new_scene_from_dialog->set_title(TTR("Save New Scene As...")); + new_scene_from_dialog->popup_file_dialog(); } break; case TOOL_COPY_NODE_PATH: { List<Node *> selection = editor_selection->get_selected_node_list(); diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index f30e57579f..7404c9779b 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -33,6 +33,7 @@ #include "core/message_queue.h" #include "core/print_string.h" #include "editor/editor_node.h" +#include "editor/editor_scale.h" #include "editor/node_dock.h" #include "editor/plugins/animation_player_editor_plugin.h" #include "editor/plugins/canvas_item_editor_plugin.h" @@ -1194,6 +1195,10 @@ SceneTreeEditor::~SceneTreeEditor() { /******** DIALOG *********/ +void SceneTreeDialog::popup_scenetree_dialog() { + popup_centered_clamped(Size2(350, 700) * EDSCALE); +} + void SceneTreeDialog::_notification(int p_what) { switch (p_what) { case NOTIFICATION_VISIBILITY_CHANGED: { diff --git a/editor/scene_tree_editor.h b/editor/scene_tree_editor.h index 106837f69a..21bb0ec062 100644 --- a/editor/scene_tree_editor.h +++ b/editor/scene_tree_editor.h @@ -179,6 +179,7 @@ protected: static void _bind_methods(); public: + void popup_scenetree_dialog(); SceneTreeEditor *get_scene_tree() { return tree; } SceneTreeDialog(); ~SceneTreeDialog(); diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index 40e0582046..ffdf8208b8 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -540,7 +540,7 @@ void ScriptCreateDialog::_browse_path(bool browse_parent, bool p_save) { } file_browse->set_current_path(file_path->get_text()); - file_browse->popup_centered_ratio(); + file_browse->popup_file_dialog(); } void ScriptCreateDialog::_file_selected(const String &p_file) { diff --git a/misc/travis/android-tools-linux.sh b/misc/ci/android-tools-linux.sh index 6114551861..6114551861 100755 --- a/misc/travis/android-tools-linux.sh +++ b/misc/ci/android-tools-linux.sh diff --git a/misc/ci/sources.list b/misc/ci/sources.list new file mode 100644 index 0000000000..4d8f94f35c --- /dev/null +++ b/misc/ci/sources.list @@ -0,0 +1,4 @@ +deb http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse +deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse +deb http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse +deb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse diff --git a/misc/travis/ccache-osx.sh b/misc/travis/ccache-osx.sh deleted file mode 100755 index 5ce7a80cbc..0000000000 --- a/misc/travis/ccache-osx.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -echo -echo "Download and install ccache ..." -echo - -echo "Downloading sources ..." -curl -L -O https://www.samba.org/ftp/ccache/ccache-3.3.4.tar.gz # latest version available here: https://ccache.samba.org/download.html - -echo "Extracting to build directory ..." -tar xzf ccache-3.3.4.tar.gz -cd ccache-3.3.4 - -echo "Compiling sources ..." -./configure --prefix=/usr/local --with-bundled-zlib > /dev/null -make - -echo "Installing ..." - -mkdir /usr/local/opt/ccache - -mkdir /usr/local/opt/ccache/bin -cp ccache /usr/local/opt/ccache/bin -ln -s /usr/local/opt/ccache/bin/ccache /usr/local/bin/ccache - -mkdir /usr/local/opt/ccache/libexec -links=( - clang - clang++ - cc - gcc gcc2 gcc3 gcc-3.3 gcc-4.0 gcc-4.2 gcc-4.3 gcc-4.4 gcc-4.5 gcc-4.6 gcc-4.7 gcc-4.8 gcc-4.9 gcc-5 gcc-6 gcc-7 - c++ c++3 c++-3.3 c++-4.0 c++-4.2 c++-4.3 c++-4.4 c++-4.5 c++-4.6 c++-4.7 c++-4.8 c++-4.9 c++-5 c++-6 c++-7 - g++ g++2 g++3 g++-3.3 g++-4.0 g++-4.2 g++-4.3 g++-4.4 g++-4.5 g++-4.6 g++-4.7 g++-4.8 g++-4.9 g++-5 g++-6 g++-7 -) -for link in "${links[@]}"; do - ln -s ../bin/ccache /usr/local/opt/ccache/libexec/$link -done -#/usr/local/bin/ccache -M 2G -cd $TRAVIS_BUILD_DIR - -echo -echo "Done!" -echo diff --git a/modules/gdnative/gdnative_library_editor_plugin.cpp b/modules/gdnative/gdnative_library_editor_plugin.cpp index 1d4d188f23..fdd755845f 100644 --- a/modules/gdnative/gdnative_library_editor_plugin.cpp +++ b/modules/gdnative/gdnative_library_editor_plugin.cpp @@ -146,7 +146,7 @@ void GDNativeLibraryEditor::_on_item_button(Object *item, int column, int id) { } file_dialog->set_file_mode(mode); - file_dialog->popup_centered_ratio(); + file_dialog->popup_file_dialog(); } else if (id == BUTTON_CLEAR_LIBRARY) { _set_target_value(section, target, ""); diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index 1e0d3d9f7b..21eb3d558c 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -40,6 +40,10 @@ FileDialog::GetIconFunc FileDialog::get_large_icon_func = nullptr; FileDialog::RegisterFunc FileDialog::register_func = nullptr; FileDialog::RegisterFunc FileDialog::unregister_func = nullptr; +void FileDialog::popup_file_dialog() { + popup_centered_clamped(Size2i(700, 500), 0.8f); +} + VBoxContainer *FileDialog::get_vbox() { return vbox; } diff --git a/scene/gui/file_dialog.h b/scene/gui/file_dialog.h index c5272af233..8003650668 100644 --- a/scene/gui/file_dialog.h +++ b/scene/gui/file_dialog.h @@ -135,6 +135,7 @@ protected: static void _bind_methods(); //bind helpers public: + void popup_file_dialog(); void clear_filters(); void add_filter(const String &p_filter); void set_filters(const Vector<String> &p_filters); diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 47761d724e..eeb7f9430d 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -3419,6 +3419,8 @@ void Tree::scroll_to_item(TreeItem *p_item) { TreeItem *Tree::_search_item_text(TreeItem *p_at, const String &p_find, int *r_col, bool p_selectable, bool p_backwards) { TreeItem *from = p_at; + TreeItem *loop = nullptr; // Safe-guard against infinite loop. + while (p_at) { for (int i = 0; i < columns.size(); i++) { if (p_at->get_text(i).findn(p_find) == 0 && (!p_selectable || p_at->is_selectable(i))) { @@ -3438,6 +3440,12 @@ TreeItem *Tree::_search_item_text(TreeItem *p_at, const String &p_find, int *r_c if ((p_at) == from) { break; } + + if (!loop) { + loop = p_at; + } else if (loop == p_at) { + break; + } } return nullptr; diff --git a/thirdparty/README.md b/thirdparty/README.md index 43cd448a00..392abea85e 100644 --- a/thirdparty/README.md +++ b/thirdparty/README.md @@ -426,9 +426,8 @@ Collection of single-file libraries used in Godot components. * License: zlib - `stb_vorbis.c` * Upstream: https://github.com/nothings/stb - * Version: 1.19 + * Version: 1.20 * License: Public Domain (Unlicense) or MIT - * Modifications: `f->temp_offset += (sz+3)&~3;` changed to `f->temp_offset += (sz+7)&~7;` (needed until fixed upstream) ## nanosvg diff --git a/thirdparty/misc/stb_vorbis.c b/thirdparty/misc/stb_vorbis.c index 52c9c666a2..a8cbfa6c23 100644 --- a/thirdparty/misc/stb_vorbis.c +++ b/thirdparty/misc/stb_vorbis.c @@ -1,4 +1,4 @@ -// Ogg Vorbis audio decoder - v1.19 - public domain +// Ogg Vorbis audio decoder - v1.20 - public domain // http://nothings.org/stb_vorbis/ // // Original version written by Sean Barrett in 2007. @@ -31,9 +31,11 @@ // Phillip Bennefall Rohit Thiago Goulart // github:manxorist saga musix github:infatum // Timur Gagiev Maxwell Koo Peter Waller -// github:audinowho Dougall Johnson +// github:audinowho Dougall Johnson David Reid +// github:Clownacy Pedro J. Estebanez Remi Verschelde // // Partial history: +// 1.20 - 2020-07-11 - several small fixes // 1.19 - 2020-02-05 - warnings // 1.18 - 2020-02-02 - fix seek bugs; parse header comments; misc warnings etc. // 1.17 - 2019-07-08 - fix CVE-2019-13217..CVE-2019-13223 (by ForAllSecure) @@ -577,7 +579,7 @@ enum STBVorbisError #if defined(_MSC_VER) || defined(__MINGW32__) #include <malloc.h> #endif - #if defined(__linux__) || defined(__linux) || defined(__EMSCRIPTEN__) + #if defined(__linux__) || defined(__linux) || defined(__EMSCRIPTEN__) || defined(__NEWLIB__) #include <alloca.h> #endif #else // STB_VORBIS_NO_CRT @@ -599,7 +601,9 @@ enum STBVorbisError #undef __forceinline #endif #define __forceinline + #ifndef alloca #define alloca __builtin_alloca + #endif #elif !defined(_MSC_VER) #if __GNUC__ #define __forceinline inline @@ -1600,7 +1604,8 @@ static uint32 get_bits(vorb *f, int n) f->valid_bits += 8; } } - if (f->valid_bits < 0) return 0; + + assert(f->valid_bits >= n); z = f->acc & ((1 << n)-1); f->acc >>= n; f->valid_bits -= n; @@ -4256,7 +4261,7 @@ static void vorbis_init(stb_vorbis *p, const stb_vorbis_alloc *z) memset(p, 0, sizeof(*p)); // NULL out all malloc'd pointers to start if (z) { p->alloc = *z; - p->alloc.alloc_buffer_length_in_bytes = (p->alloc.alloc_buffer_length_in_bytes+3) & ~3; + p->alloc.alloc_buffer_length_in_bytes &= ~7; p->temp_offset = p->alloc.alloc_buffer_length_in_bytes; } p->eof = 0; |