Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into experimental-test
Browse files Browse the repository at this point in the history
  • Loading branch information
debian build committed May 22, 2024
2 parents a9cd5da + 8e2141e commit b2a8f32
Show file tree
Hide file tree
Showing 85 changed files with 612 additions and 426 deletions.
23 changes: 18 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ repos:
platform/android/java/lib/src/com/.*
)
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.2.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.4
hooks:
- id: black
files: (\.py$|SConstruct|SCsub)
types_or: [text]
- id: ruff
args: [--fix]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.971
Expand Down Expand Up @@ -146,6 +146,7 @@ repos:
exclude: |
(?x)^(
core/math/bvh_.*\.inc$|
platform/(?!android|ios|linuxbsd|macos|web|windows)\w+/.*|
platform/android/java/lib/src/com/.*|
platform/android/java/lib/src/org/godotengine/godot/gl/GLSurfaceView\.java$|
platform/android/java/lib/src/org/godotengine/godot/gl/EGLLogWrapper\.java$|
Expand Down Expand Up @@ -186,3 +187,15 @@ repos:
language: python
entry: python3 misc/scripts/dotnet_format.py
types_or: [c#]

# End of upstream Godot pre-commit hooks.
#
# Keep this separation to let downstream forks add their own hooks to this file,
# without running into merge conflicts when rebasing on latest upstream.
#
# Start of downstream pre-commit hooks.
#
# This is still the "repo: local" scope, so new local hooks can be defined directly at this indentation:
# - id: new-local-hook
# To add external repo hooks, bring the indentation back to:
# - repo: my-remote-hook
24 changes: 12 additions & 12 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import os
import pickle
import sys
import time
from types import ModuleType
from collections import OrderedDict
from importlib.util import spec_from_file_location, module_from_spec
from SCons import __version__ as scons_raw_version
from importlib.util import module_from_spec, spec_from_file_location
from types import ModuleType

from SCons import __version__ as scons_raw_version

# 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 @@ -54,12 +54,12 @@ _helper_module("main.main_builders", "main/main_builders.py")
_helper_module("modules.modules_builders", "modules/modules_builders.py")

# Local
import methods
import glsl_builders
import gles3_builders
import glsl_builders
import methods
import scu_builders
from methods import print_warning, print_error
from platform_methods import architectures, architecture_aliases, generate_export_icons
from methods import print_error, print_warning
from platform_methods import architecture_aliases, architectures

if ARGUMENTS.get("target", "editor") == "editor":
_helper_module("editor.editor_builders", "editor/editor_builders.py")
Expand All @@ -69,7 +69,7 @@ if ARGUMENTS.get("target", "editor") == "editor":
# <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 import WinError, byref, windll # type: ignore
from ctypes.wintypes import DWORD # type: ignore

stdout_handle = windll.kernel32.GetStdHandle(DWORD(-11))
Expand Down Expand Up @@ -583,7 +583,7 @@ if env["build_profile"] != "":
dbo = ft["disabled_build_options"]
for c in dbo:
env[c] = dbo[c]
except:
except json.JSONDecodeError:
print_error('Failed to open feature build profile: "{}"'.format(env["build_profile"]))
Exit(255)
methods.write_disabled_classes(disabled_classes)
Expand All @@ -592,7 +592,7 @@ methods.write_disabled_classes(disabled_classes)
# These can sometimes override default options.
flag_list = platform_flags[env["platform"]]
for f in flag_list:
if not (f[0] in ARGUMENTS) or ARGUMENTS[f[0]] == "auto": # Allow command line to override platform flags
if f[0] not in ARGUMENTS or ARGUMENTS[f[0]] == "auto": # Allow command line to override platform flags
env[f[0]] = f[1]

# 'dev_mode' and 'production' are aliases to set default options if they haven't been
Expand All @@ -613,7 +613,7 @@ if env["production"]:
# Run SCU file generation script if in a SCU build.
if env["scu_build"]:
max_includes_per_scu = 8
if env.dev_build == True:
if env.dev_build:
max_includes_per_scu = 1024

read_scu_limit = int(env["scu_limit"])
Expand Down Expand Up @@ -1006,7 +1006,7 @@ GLSL_BUILDERS = {
env.Append(BUILDERS=GLSL_BUILDERS)

scons_cache_path = os.environ.get("SCONS_CACHE")
if scons_cache_path != None:
if scons_cache_path is not None:
CacheDir(scons_cache_path)
print("Scons cache enabled... (path: '" + scons_cache_path + "')")

Expand Down
3 changes: 3 additions & 0 deletions core/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

Import("env")

import os

import core_builders

import methods

env.core_sources = []
Expand Down
12 changes: 6 additions & 6 deletions core/core_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def next_line(self):
return line

def next_tag(self):
if not ":" in self.current:
if ":" not in self.current:
return ("", [])
tag, line = self.current.split(":", 1)
lines = [line.strip()]
Expand All @@ -206,7 +206,7 @@ def next_tag(self):

if not tag or not reader.current:
# end of a paragraph start a new part
if "License" in part and not "Files" in part:
if "License" in part and "Files" not in part:
# no Files tag in this one, so assume standalone license
license_list.append(part["License"])
part = {}
Expand Down Expand Up @@ -298,13 +298,13 @@ def next_tag(self):
f.write("const int LICENSE_COUNT = " + str(len(license_list)) + ";\n")

f.write("const char *const LICENSE_NAMES[] = {\n")
for l in license_list:
f.write('\t"' + escape_string(l[0]) + '",\n')
for license in license_list:
f.write('\t"' + escape_string(license[0]) + '",\n')
f.write("};\n\n")

f.write("const char *const LICENSE_BODIES[] = {\n\n")
for l in license_list:
for line in l[1:]:
for license in license_list:
for line in license[1:]:
if line == ".":
f.write('\t"\\n"\n')
else:
Expand Down
2 changes: 1 addition & 1 deletion core/extension/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

Import("env")

import make_wrappers
import make_interface_dumper
import make_wrappers

env.CommandNoCache(["ext_wrappers.gen.inc"], "make_wrappers.py", env.Run(make_wrappers.run))
env.CommandNoCache(
Expand Down
2 changes: 0 additions & 2 deletions core/extension/make_wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
def generate_mod_version(argcount, const=False, returns=False):
s = proto_mod
sproto = str(argcount)
method_info = ""
if returns:
sproto += "R"
s = s.replace("$RETTYPE", "m_ret, ")
Expand Down Expand Up @@ -68,7 +67,6 @@ def generate_mod_version(argcount, const=False, returns=False):
def generate_ex_version(argcount, const=False, returns=False):
s = proto_ex
sproto = str(argcount)
method_info = ""
if returns:
sproto += "R"
s = s.replace("$RETTYPE", "m_ret, ")
Expand Down
1 change: 0 additions & 1 deletion core/input/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Import("env")

import input_builders


# Order matters here. Higher index controller database files write on top of lower index database files.
controller_databases = [
"gamecontrollerdb.txt",
Expand Down
2 changes: 1 addition & 1 deletion core/object/class_db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ Object *ClassDB::_instantiate_internal(const StringName &p_class, bool p_require
#ifdef TOOLS_ENABLED
if (!p_require_real_class && ti->is_runtime && Engine::get_singleton()->is_editor_hint()) {
if (!ti->inherits_ptr || !ti->inherits_ptr->creation_func) {
ERR_PRINT_ONCE(vformat("Cannot make a placeholder instance of runtime class %s because its parent cannot be constructed.", ti->name));
ERR_PRINT(vformat("Cannot make a placeholder instance of runtime class %s because its parent cannot be constructed.", ti->name));
} else {
ObjectGDExtension *extension = get_placeholder_extension(ti->name);
return (Object *)extension->create_instance(extension->class_userdata);
Expand Down
8 changes: 4 additions & 4 deletions doc/tools/doc_status.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/usr/bin/env python3

import fnmatch
import os
import sys
import re
import math
import os
import platform
import re
import sys
import xml.etree.ElementTree as ET
from typing import Dict, List, Set

Expand Down Expand Up @@ -286,7 +286,7 @@ def generate_for_class(c: ET.Element):
status.progresses[tag.tag].increment(is_deprecated or is_experimental or has_descr)
elif tag.tag in ["constants", "members", "theme_items"]:
for sub_tag in list(tag):
if not sub_tag.text is None:
if sub_tag.text is not None:
is_deprecated = "deprecated" in sub_tag.attrib
is_experimental = "experimental" in sub_tag.attrib
has_descr = len(sub_tag.text.strip()) > 0
Expand Down
11 changes: 5 additions & 6 deletions doc/tools/make_rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@

import argparse
import os
import platform
import re
import sys
import xml.etree.ElementTree as ET
from collections import OrderedDict
from typing import List, Dict, TextIO, Tuple, Optional, Any, Union
from typing import Any, Dict, List, Optional, TextIO, Tuple, Union

# Import hardcoded version information from version.py
root_directory = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../")
sys.path.append(root_directory) # Include the root directory
import version
import version # noqa: E402

# $DOCS_URL/path/to/page.html(#fragment-tag)
GODOT_DOCS_PATTERN = re.compile(r"^\$DOCS_URL/(.*)\.html(#.*)?$")
Expand Down Expand Up @@ -706,7 +705,7 @@ def main() -> None:
# <https://github.com/python/cpython/issues/73245>
if should_color and sys.stdout.isatty() and sys.platform == "win32":
try:
from ctypes import windll, byref, WinError # type: ignore
from ctypes import WinError, byref, windll # type: ignore
from ctypes.wintypes import DWORD # type: ignore

stdout_handle = windll.kernel32.GetStdHandle(DWORD(-11))
Expand Down Expand Up @@ -1413,7 +1412,7 @@ def make_rst_class(class_def: ClassDef, state: State, dry_run: bool, output_dir:
operator_anchor = f".. _class_{class_name}_operator_{sanitize_operator_name(m.name, state)}"
for parameter in m.parameters:
operator_anchor += f"_{parameter.type_name.type_name}"
operator_anchor += f":\n\n"
operator_anchor += ":\n\n"
f.write(operator_anchor)

f.write(".. rst-class:: classref-operator\n\n")
Expand Down Expand Up @@ -1553,7 +1552,7 @@ def make_method_signature(
out += f":ref:`{op_name}<class_{class_def.name}_{ref_type}_{sanitize_operator_name(definition.name, state)}"
for parameter in definition.parameters:
out += f"_{parameter.type_name.type_name}"
out += f">`"
out += ">`"
elif ref_type == "method":
ref_type_qualifier = ""
if definition.name.startswith("_"):
Expand Down
11 changes: 9 additions & 2 deletions drivers/gles3/rasterizer_scene_gles3.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,28 @@ enum SceneUniformLocation {
SCENE_GLOBALS_UNIFORM_LOCATION,
SCENE_DATA_UNIFORM_LOCATION,
SCENE_MATERIAL_UNIFORM_LOCATION,
SCENE_EMPTY, // Unused, put here to avoid conflicts with SKY_DIRECTIONAL_LIGHT_UNIFORM_LOCATION.
SCENE_EMPTY1, // Unused, put here to avoid conflicts with SKY_DIRECTIONAL_LIGHT_UNIFORM_LOCATION.
SCENE_OMNILIGHT_UNIFORM_LOCATION,
SCENE_SPOTLIGHT_UNIFORM_LOCATION,
SCENE_DIRECTIONAL_LIGHT_UNIFORM_LOCATION,
SCENE_MULTIVIEW_UNIFORM_LOCATION,
SCENE_POSITIONAL_SHADOW_UNIFORM_LOCATION,
SCENE_DIRECTIONAL_SHADOW_UNIFORM_LOCATION,
SCENE_EMPTY2, // Unused, put here to avoid conflicts with SKY_MULTIVIEW_UNIFORM_LOCATION.
};

enum SkyUniformLocation {
SKY_TONEMAP_UNIFORM_LOCATION,
SKY_GLOBALS_UNIFORM_LOCATION,
SKY_EMPTY, // Unused, put here to avoid conflicts with SCENE_DATA_UNIFORM_LOCATION.
SKY_EMPTY1, // Unused, put here to avoid conflicts with SCENE_DATA_UNIFORM_LOCATION.
SKY_MATERIAL_UNIFORM_LOCATION,
SKY_DIRECTIONAL_LIGHT_UNIFORM_LOCATION,
SKY_EMPTY2, // Unused, put here to avoid conflicts with SCENE_OMNILIGHT_UNIFORM_LOCATION.
SKY_EMPTY3, // Unused, put here to avoid conflicts with SCENE_SPOTLIGHT_UNIFORM_LOCATION.
SKY_EMPTY4, // Unused, put here to avoid conflicts with SCENE_DIRECTIONAL_LIGHT_UNIFORM_LOCATION.
SKY_EMPTY5, // Unused, put here to avoid conflicts with SCENE_MULTIVIEW_UNIFORM_LOCATION.
SKY_EMPTY6, // Unused, put here to avoid conflicts with SCENE_POSITIONAL_SHADOW_UNIFORM_LOCATION.
SKY_EMPTY7, // Unused, put here to avoid conflicts with SCENE_DIRECTIONAL_SHADOW_UNIFORM_LOCATION.
SKY_MULTIVIEW_UNIFORM_LOCATION,
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/gles3/shaders/sky.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ uniform float z_far;
uniform uint directional_light_count;

#ifdef USE_MULTIVIEW
layout(std140) uniform MultiviewData { // ubo:5
layout(std140) uniform MultiviewData { // ubo:11
highp mat4 projection_matrix_view[MAX_VIEWS];
highp mat4 inv_projection_matrix_view[MAX_VIEWS];
highp vec4 eye_offset[MAX_VIEWS];
Expand Down
5 changes: 3 additions & 2 deletions editor/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ Import("env")

env.editor_sources = []

import os
import glob
import os

import editor_builders
import methods

import methods

def _make_doc_data_class_path(to_path):
file_path = os.path.join(to_path, "doc_data_class_path.gen.h")
Expand Down
6 changes: 4 additions & 2 deletions editor/animation_track_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7335,17 +7335,19 @@ AnimationTrackEditor::AnimationTrackEditor() {
bottom_hb->add_child(zoom);
timeline->set_zoom(zoom);

ED_SHORTCUT("animation_editor/auto_fit", TTR("Fit to panel"), KeyModifierMask::ALT | Key::F);

auto_fit = memnew(Button);
auto_fit->set_flat(true);
auto_fit->connect(SceneStringName(pressed), callable_mp(this, &AnimationTrackEditor::_auto_fit));
auto_fit->set_shortcut(ED_SHORTCUT("animation_editor/auto_fit", TTR("Fit to panel"), KeyModifierMask::ALT | Key::F));
auto_fit->set_shortcut(ED_GET_SHORTCUT("animation_editor/auto_fit"));
bottom_hb->add_child(auto_fit);

auto_fit_bezier = memnew(Button);
auto_fit_bezier->set_flat(true);
auto_fit_bezier->set_visible(false);
auto_fit_bezier->connect(SceneStringName(pressed), callable_mp(this, &AnimationTrackEditor::_auto_fit_bezier));
auto_fit_bezier->set_shortcut(ED_SHORTCUT("animation_editor/auto_fit", TTR("Fit to panel"), KeyModifierMask::ALT | Key::F));
auto_fit_bezier->set_shortcut(ED_GET_SHORTCUT("animation_editor/auto_fit"));
bottom_hb->add_child(auto_fit_bezier);

edit = memnew(MenuButton);
Expand Down
1 change: 1 addition & 0 deletions editor/editor_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import tempfile
import uuid
import zlib

from methods import print_warning


Expand Down
5 changes: 5 additions & 0 deletions editor/editor_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6283,6 +6283,11 @@ EditorNode::EditorNode() {
EditorSettings::create();
}

ED_SHORTCUT("editor/lock_selected_nodes", TTR("Lock Selected Node(s)"), KeyModifierMask::CMD_OR_CTRL | Key::L);
ED_SHORTCUT("editor/unlock_selected_nodes", TTR("Unlock Selected Node(s)"), KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT | Key::L);
ED_SHORTCUT("editor/group_selected_nodes", TTR("Group Selected Node(s)"), KeyModifierMask::CMD_OR_CTRL | Key::G);
ED_SHORTCUT("editor/ungroup_selected_nodes", TTR("Ungroup Selected Node(s)"), KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT | Key::G);

FileAccess::set_backup_save(EDITOR_GET("filesystem/on_save/safe_save_on_backup_then_rename"));

_update_vsync_mode();
Expand Down
2 changes: 1 addition & 1 deletion editor/icons/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
Import("env")

import os
import editor_icons_builders

import editor_icons_builders

env["BUILDERS"]["MakeEditorIconsBuilder"] = Builder(
action=env.Run(editor_icons_builders.make_editor_icons_action),
Expand Down
Loading

0 comments on commit b2a8f32

Please sign in to comment.