Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
debian build committed May 21, 2024
2 parents 95db3c3 + aaa4560 commit 3db5a43
Show file tree
Hide file tree
Showing 214 changed files with 3,831 additions and 2,006 deletions.
4 changes: 2 additions & 2 deletions .github/actions/godot-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ inputs:
sconsflags:
default: ""
scons-cache:
description: The scons cache path.
description: The SCons cache path.
default: "${{ github.workspace }}/.scons-cache/"
scons-cache-limit:
description: The scons cache size limit.
description: The SCons cache size limit.
# actions/cache has 10 GiB limit, and GitHub runners have a 14 GiB disk.
# Limit to 7 GiB to avoid having the extracted cache fill the disk.
default: 7168
Expand Down
6 changes: 3 additions & 3 deletions .github/actions/godot-cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ inputs:
description: The cache base name (job name by default).
default: "${{github.job}}"
scons-cache:
description: The scons cache path.
description: The SCons cache path.
default: "${{github.workspace}}/.scons-cache/"
runs:
using: "composite"
steps:
# Upload cache on completion and check it out now
- name: Load .scons_cache directory
# Upload cache on completion and check it out now.
- name: Load SCons cache directory
uses: actions/cache@v4
with:
path: ${{inputs.scons-cache}}
Expand Down
21 changes: 12 additions & 9 deletions .github/actions/godot-deps/action.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
name: Setup python and scons
description: Setup python, install the pip version of scons.
name: Setup Python and SCons
description: Setup Python, install the pip version of SCons.
inputs:
python-version:
description: The python version to use.
description: The Python version to use.
default: "3.x"
python-arch:
description: The python architecture.
description: The Python architecture.
default: "x64"
scons-version:
description: The SCons version to use.
default: "4.7.0"
runs:
using: "composite"
steps:
# Use python 3.x release (works cross platform)
- name: Set up Python 3.x
uses: actions/setup-python@v5
with:
# Semantic version range syntax or exact version of a Python version
# Semantic version range syntax or exact version of a Python version.
python-version: ${{ inputs.python-version }}
# Optional - x64 or x86 architecture, defaults to x64
# Optional - x64 or x86 architecture, defaults to x64.
architecture: ${{ inputs.python-arch }}

- name: Setup scons
- name: Setup SCons
shell: bash
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons==4.7.0
python -m pip install wheel
python -m pip install scons==${{ inputs.scons-version }}
scons --version
2 changes: 1 addition & 1 deletion .github/workflows/android_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
uses: ./.github/actions/godot-cache
continue-on-error: true

- name: Setup python and scons
- name: Setup Python and SCons
uses: ./.github/actions/godot-deps

- name: Compilation (arm32)
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/godot_cpp_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
with:
submodules: recursive

- name: Setup python and scons
- name: Setup Python and SCons
uses: ./.github/actions/godot-deps

# Checkout godot-cpp
Expand All @@ -47,7 +47,7 @@ jobs:
cp -f godot-api/gdextension_interface.h godot-cpp/gdextension/
cp -f godot-api/extension_api.json godot-cpp/gdextension/
# TODO: Add caching to the scons build and store it for CI via the godot-cache
# TODO: Add caching to the SCons build and store it for CI via the godot-cache
# action.

# Build godot-cpp test extension
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ios_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
uses: ./.github/actions/godot-cache
continue-on-error: true

- name: Setup python and scons
- name: Setup Python and SCons
uses: ./.github/actions/godot-deps

- name: Compilation (arm64)
Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/linux_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ jobs:
tests: true
# Skip 2GiB artifact speeding up action.
artifact: false
# Test our oldest supported SCons/Python versions on one arbitrary editor build.
legacy-scons: true

- name: Editor with ThreadSanitizer (target=editor, tests=yes, dev_build=yes, use_tsan=yes, use_llvm=yes, linker=lld)
cache-name: linux-editor-thread-sanitizer
Expand Down Expand Up @@ -115,9 +117,18 @@ jobs:
cache-name: ${{ matrix.cache-name }}
continue-on-error: true

- name: Setup python and scons
- name: Setup Python and SCons
if: ${{ ! matrix.legacy-scons }}
uses: ./.github/actions/godot-deps

- name: Setup Python and SCons (legacy versions)
if: ${{ matrix.legacy-scons }}
uses: ./.github/actions/godot-deps
with:
# Sync with Ensure*Version in SConstruct.
python-version: 3.6
scons-version: 3.1.2

- name: Setup GCC problem matcher
uses: ammaraskar/gcc-problem-matcher@master

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
cache-name: ${{ matrix.cache-name }}
continue-on-error: true

- name: Setup python and scons
- name: Setup Python and SCons
uses: ./.github/actions/godot-deps

- name: Setup Vulkan SDK
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/web_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
cache-name: ${{ matrix.cache-name }}
continue-on-error: true

- name: Setup python and scons
- name: Setup Python and SCons
uses: ./.github/actions/godot-deps

- name: Compilation
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
cache-name: ${{ matrix.cache-name }}
continue-on-error: true

- name: Setup python and scons
- name: Setup Python and SCons
uses: ./.github/actions/godot-deps

- name: Download Direct3D 12 SDK components
Expand Down
14 changes: 12 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,18 @@ repos:
language: node
entry: jsdoc
files: ^platform/web/js/engine/(engine|config|features)\.js$
args: [--template, platform/web/js/jsdoc2rst/, --destination, '', -d, dry-run]
additional_dependencies: ["jsdoc@4.0.2"]
args:
- --template
- platform/web/js/jsdoc2rst/
- platform/web/js/engine/engine.js
- platform/web/js/engine/config.js
- platform/web/js/engine/features.js
- --destination
- ''
- -d
- dry-run
pass_filenames: false
additional_dependencies: ['jsdoc@^4.0.3']

- id: copyright-headers
name: copyright-headers
Expand Down
34 changes: 21 additions & 13 deletions SConstruct
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python

EnsureSConsVersion(3, 0, 0)
EnsureSConsVersion(3, 1, 2)
EnsurePythonVersion(3, 6)

# System
Expand All @@ -15,16 +15,6 @@ from collections import OrderedDict
from importlib.util import spec_from_file_location, module_from_spec
from SCons import __version__ as scons_raw_version

# Enable ANSI escape code support on Windows 10 and later (for colored console output).
# <https://github.com/python/cpython/issues/73245>
if sys.platform == "win32":
from ctypes import windll, c_int, byref

stdout_handle = windll.kernel32.GetStdHandle(c_int(-11))
mode = c_int(0)
windll.kernel32.GetConsoleMode(c_int(stdout_handle), byref(mode))
mode = c_int(mode.value | 4)
windll.kernel32.SetConsoleMode(c_int(stdout_handle), mode)

# Explicitly resolve the helper modules, this is done to avoid clash with
# modules of the same name that might be randomly added (e.g. someone adding
Expand Down Expand Up @@ -75,6 +65,24 @@ if ARGUMENTS.get("target", "editor") == "editor":
_helper_module("editor.editor_builders", "editor/editor_builders.py")
_helper_module("editor.template_builders", "editor/template_builders.py")

# Enable ANSI escape code support on Windows 10 and later (for colored console output).
# <https://github.com/python/cpython/issues/73245>
if sys.stdout.isatty() and sys.platform == "win32":
try:
from ctypes import windll, byref, WinError # type: ignore
from ctypes.wintypes import DWORD # type: ignore

stdout_handle = windll.kernel32.GetStdHandle(DWORD(-11))
mode = DWORD(0)
if not windll.kernel32.GetConsoleMode(stdout_handle, byref(mode)):
raise WinError()
mode = DWORD(mode.value | 4)
if not windll.kernel32.SetConsoleMode(stdout_handle, mode):
raise WinError()
except Exception as e:
methods._colorize = False
print_error(f"Failed to enable ANSI escape code support, disabling color output.\n{e}")

# Scan possible build platforms

platform_list = [] # list of platforms
Expand Down Expand Up @@ -367,7 +375,7 @@ if env["platform"] in platform_opts:
opts.Add(opt)

# Update the environment to take platform-specific options into account.
opts.Update(env, {**ARGUMENTS, **env})
opts.Update(env, {**ARGUMENTS, **env.Dictionary()})

# Detect modules.
modules_detected = OrderedDict()
Expand Down Expand Up @@ -427,7 +435,7 @@ for name, path in modules_detected.items():
methods.write_modules(modules_detected)

# Update the environment again after all the module options are added.
opts.Update(env, {**ARGUMENTS, **env})
opts.Update(env, {**ARGUMENTS, **env.Dictionary()})
Help(opts.GenerateHelpText(env))

# add default include paths
Expand Down
15 changes: 11 additions & 4 deletions core/io/resource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -569,11 +569,18 @@ Resource::Resource() :
remapped_list(this) {}

Resource::~Resource() {
if (!path_cache.is_empty()) {
ResourceCache::lock.lock();
ResourceCache::resources.erase(path_cache);
ResourceCache::lock.unlock();
if (unlikely(path_cache.is_empty())) {
return;
}

ResourceCache::lock.lock();
// Only unregister from the cache if this is the actual resource listed there.
// (Other resources can have the same value in `path_cache` if loaded with `CACHE_IGNORE`.)
HashMap<String, Resource *>::Iterator E = ResourceCache::resources.find(path_cache);
if (likely(E && E->value == this)) {
ResourceCache::resources.remove(E);
}
ResourceCache::lock.unlock();
}

HashMap<String, Resource *> ResourceCache::resources;
Expand Down
2 changes: 2 additions & 0 deletions core/math/geometry_2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,8 @@ class Geometry2D {
return triangles;
}

// Assumes cartesian coordinate system with +x to the right, +y up.
// If using screen coordinates (+x to the right, +y down) the result will need to be flipped.
static bool is_polygon_clockwise(const Vector<Vector2> &p_polygon) {
int c = p_polygon.size();
if (c < 3) {
Expand Down
3 changes: 0 additions & 3 deletions doc/classes/@GlobalScope.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1570,9 +1570,6 @@
<member name="Geometry3D" type="Geometry3D" setter="" getter="">
The [Geometry3D] singleton.
</member>
<member name="GodotSharp" type="GodotSharp" setter="" getter="">
The [GodotSharp] singleton.
</member>
<member name="IP" type="IP" setter="" getter="">
The [IP] singleton.
</member>
Expand Down
2 changes: 1 addition & 1 deletion doc/classes/Button.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
The horizontal space between [Button]'s icon and text. Negative values will be treated as [code]0[/code] when used.
</theme_item>
<theme_item name="icon_max_width" data_type="constant" type="int" default="0">
The maximum allowed width of the [Button]'s icon. This limit is applied on top of the default size of the icon, or its expanded size if [member expand_icon] is [code]true[/code]. The height is adjusted according to the icon's ratio.
The maximum allowed width of the [Button]'s icon. This limit is applied on top of the default size of the icon, or its expanded size if [member expand_icon] is [code]true[/code]. The height is adjusted according to the icon's ratio. If the button has additional icons (e.g. [CheckBox]), they will also be limited.
</theme_item>
<theme_item name="outline_size" data_type="constant" type="int" default="0">
The size of the text outline.
Expand Down
1 change: 0 additions & 1 deletion doc/classes/EditorInspector.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
</method>
</methods>
<members>
<member name="follow_focus" type="bool" setter="set_follow_focus" getter="is_following_focus" overrides="ScrollContainer" default="true" />
<member name="horizontal_scroll_mode" type="int" setter="set_horizontal_scroll_mode" getter="get_horizontal_scroll_mode" overrides="ScrollContainer" enum="ScrollContainer.ScrollMode" default="0" />
</members>
<signals>
Expand Down
1 change: 1 addition & 0 deletions doc/classes/Geometry2D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
<param index="0" name="polygon" type="PackedVector2Array" />
<description>
Returns [code]true[/code] if [param polygon]'s vertices are ordered in clockwise order, otherwise returns [code]false[/code].
[b]Note:[/b] Assumes a Cartesian coordinate system where [code]+x[/code] is right and [code]+y[/code] is up. If using screen coordinates ([code]+y[/code] is down), the result will need to be flipped (i.e. a [code]true[/code] result will indicate counter-clockwise).
</description>
</method>
<method name="line_intersects_line">
Expand Down
4 changes: 2 additions & 2 deletions doc/classes/ProjectSettings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -554,10 +554,10 @@
When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when defining a local or subclass member variable that would shadow a variable that is inherited from a parent class.
</member>
<member name="debug/gdscript/warnings/standalone_expression" type="int" setter="" getter="" default="1">
When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when calling an expression that has no effect on the surrounding code, such as writing [code]2 + 2[/code] as a statement.
When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when calling an expression that may have no effect on the surrounding code, such as writing [code]2 + 2[/code] as a statement.
</member>
<member name="debug/gdscript/warnings/standalone_ternary" type="int" setter="" getter="" default="1">
When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when calling a ternary expression that has no effect on the surrounding code, such as writing [code]42 if active else 0[/code] as a statement.
When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when calling a ternary expression that may have no effect on the surrounding code, such as writing [code]42 if active else 0[/code] as a statement.
</member>
<member name="debug/gdscript/warnings/static_called_on_instance" type="int" setter="" getter="" default="1">
When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when calling a static method from an instance of a class instead of from the class directly.
Expand Down
2 changes: 1 addition & 1 deletion doc/classes/TextEdit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1314,7 +1314,7 @@
[b]Note:[/b] This method is only implemented on Linux.
</member>
<member name="minimap_draw" type="bool" setter="set_draw_minimap" getter="is_drawing_minimap" default="false">
If [code]true[/code], a minimap is shown, providing an outline of your source code.
If [code]true[/code], a minimap is shown, providing an outline of your source code. The minimap uses a fixed-width text size.
</member>
<member name="minimap_width" type="int" setter="set_minimap_width" getter="get_minimap_width" default="80">
The width, in pixels, of the minimap.
Expand Down
6 changes: 3 additions & 3 deletions doc/classes/Tree.xml
Original file line number Diff line number Diff line change
Expand Up @@ -655,13 +655,13 @@
[StyleBox] used for the cursor, when the [Tree] is not being focused.
</theme_item>
<theme_item name="custom_button" data_type="style" type="StyleBox">
Default [StyleBox] for a [constant TreeItem.CELL_MODE_CUSTOM] mode cell.
Default [StyleBox] for a [constant TreeItem.CELL_MODE_CUSTOM] mode cell when button is enabled with [method TreeItem.set_custom_as_button].
</theme_item>
<theme_item name="custom_button_hover" data_type="style" type="StyleBox">
[StyleBox] for a [constant TreeItem.CELL_MODE_CUSTOM] mode cell when it's hovered.
[StyleBox] for a [constant TreeItem.CELL_MODE_CUSTOM] mode button cell when it's hovered.
</theme_item>
<theme_item name="custom_button_pressed" data_type="style" type="StyleBox">
[StyleBox] for a [constant TreeItem.CELL_MODE_CUSTOM] mode cell when it's pressed.
[StyleBox] for a [constant TreeItem.CELL_MODE_CUSTOM] mode button cell when it's pressed.
</theme_item>
<theme_item name="focus" data_type="style" type="StyleBox">
The focused style for the [Tree], drawn on top of everything.
Expand Down
Loading

0 comments on commit 3db5a43

Please sign in to comment.