Merge pull request #1757 from Repiteo/ci/version-bumps

CI: Various version bumps; sync with main repo
This commit is contained in:
David Snopek
2025-06-07 14:13:14 -05:00
committed by GitHub
13 changed files with 272 additions and 231 deletions

View File

@@ -1,80 +1,105 @@
# Commented out parameters are those with the same value as base LLVM style. # Commented out parameters are those with the same value as base LLVM style.
# We can uncomment them if we want to change their value, or enforce the # We can uncomment them if we want to change their value, or enforce the
# chosen value in case the base style changes (last sync: Clang 14.0). # chosen value in case the base style changes (last sync: Clang 17.0.6).
--- BasedOnStyle: LLVM
### General config, applies to all languages ###
BasedOnStyle: LLVM
AccessModifierOffset: -4 AccessModifierOffset: -4
AlignAfterOpenBracket: DontAlign AlignAfterOpenBracket: DontAlign
# AlignArrayOfStructures: None # AlignArrayOfStructures: None
# AlignConsecutiveMacros: None # AlignConsecutiveAssignments:
# AlignConsecutiveAssignments: None # Enabled: false
# AlignConsecutiveBitFields: None # AcrossEmptyLines: false
# AlignConsecutiveDeclarations: None # AcrossComments: false
# AlignCompound: false
# PadOperators: true
# AlignConsecutiveBitFields:
# Enabled: false
# AcrossEmptyLines: false
# AcrossComments: false
# AlignCompound: false
# PadOperators: false
# AlignConsecutiveDeclarations:
# Enabled: false
# AcrossEmptyLines: false
# AcrossComments: false
# AlignCompound: false
# PadOperators: false
# AlignConsecutiveMacros:
# Enabled: false
# AcrossEmptyLines: false
# AcrossComments: false
# AlignCompound: false
# PadOperators: false
# AlignConsecutiveShortCaseStatements:
# Enabled: false
# AcrossEmptyLines: false
# AcrossComments: false
# AlignCaseColons: false
# AlignEscapedNewlines: Right # AlignEscapedNewlines: Right
AlignOperands: DontAlign AlignOperands: DontAlign
AlignTrailingComments: false AlignTrailingComments:
Kind: Never
OverEmptyLines: 0
# AllowAllArgumentsOnNextLine: true # AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: false AllowAllParametersOfDeclarationOnNextLine: false
# AllowShortEnumsOnASingleLine: true
# AllowShortBlocksOnASingleLine: Never # AllowShortBlocksOnASingleLine: Never
# AllowShortCaseLabelsOnASingleLine: false # AllowShortCaseLabelsOnASingleLine: false
# AllowShortFunctionsOnASingleLine: All # AllowShortEnumsOnASingleLine: true
# AllowShortLambdasOnASingleLine: All AllowShortFunctionsOnASingleLine: Inline
# AllowShortIfStatementsOnASingleLine: Never # AllowShortIfStatementsOnASingleLine: Never
# AllowShortLambdasOnASingleLine: All
# AllowShortLoopsOnASingleLine: false # AllowShortLoopsOnASingleLine: false
# AlwaysBreakAfterDefinitionReturnType: None # AlwaysBreakAfterDefinitionReturnType: None
# AlwaysBreakAfterReturnType: None # AlwaysBreakAfterReturnType: None
# AlwaysBreakBeforeMultilineStrings: false # AlwaysBreakBeforeMultilineStrings: false
# AlwaysBreakTemplateDeclarations: MultiLine # AlwaysBreakTemplateDeclarations: MultiLine
# AttributeMacros: AttributeMacros:
# - __capability - _ALWAYS_INLINE_
- _FORCE_INLINE_
- _NO_INLINE_
# BinPackArguments: true # BinPackArguments: true
# BinPackParameters: true # BinPackParameters: true
# BitFieldColonSpacing: Both
# BraceWrapping: # BraceWrapping:
# AfterCaseLabel: false # AfterCaseLabel: false
# AfterClass: false # AfterClass: false
# AfterControlStatement: Never # AfterControlStatement: Never
# AfterEnum: false # AfterEnum: false
# AfterFunction: false # AfterFunction: false
# AfterNamespace: false # AfterNamespace: false
# AfterObjCDeclaration: false # AfterObjCDeclaration: false
# AfterStruct: false # AfterStruct: false
# AfterUnion: false # AfterUnion: false
# AfterExternBlock: false # AfterExternBlock: false
# BeforeCatch: false # BeforeCatch: false
# BeforeElse: false # BeforeElse: false
# BeforeLambdaBody: false # BeforeLambdaBody: false
# BeforeWhile: false # BeforeWhile: false
# IndentBraces: false # IndentBraces: false
# SplitEmptyFunction: true # SplitEmptyFunction: true
# SplitEmptyRecord: true # SplitEmptyRecord: true
# SplitEmptyNamespace: true # SplitEmptyNamespace: true
# BreakAfterAttributes: Never
# BreakAfterJavaFieldAnnotations: false
# BreakArrays: true
# BreakBeforeBinaryOperators: None # BreakBeforeBinaryOperators: None
# BreakBeforeConceptDeclarations: true
# BreakBeforeBraces: Attach # BreakBeforeBraces: Attach
# BreakBeforeInheritanceComma: false # BreakBeforeConceptDeclarations: Always
# BreakInheritanceList: BeforeColon # BreakBeforeInlineASMColon: OnlyMultiline
# BreakBeforeTernaryOperators: true # BreakBeforeTernaryOperators: true
# BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: AfterColon BreakConstructorInitializers: AfterColon
# BreakInheritanceList: BeforeColon
# BreakStringLiterals: true # BreakStringLiterals: true
ColumnLimit: 0 ColumnLimit: 0
# CommentPragmas: '^ IWYU pragma:' # CommentPragmas: "^ IWYU pragma:"
# QualifierAlignment: Leave
# CompactNamespaces: false # CompactNamespaces: false
ConstructorInitializerIndentWidth: 8 ConstructorInitializerIndentWidth: 8
ContinuationIndentWidth: 8 ContinuationIndentWidth: 8
Cpp11BracedListStyle: false Cpp11BracedListStyle: false
# DeriveLineEnding: true
# DerivePointerAlignment: false # DerivePointerAlignment: false
# DisableFormat: false # DisableFormat: false
# EmptyLineAfterAccessModifier: Never # EmptyLineAfterAccessModifier: Never
# EmptyLineBeforeAccessModifier: LogicalBlock # EmptyLineBeforeAccessModifier: LogicalBlock
# ExperimentalAutoDetectBinPacking: false # ExperimentalAutoDetectBinPacking: false
# PackConstructorInitializers: BinPack
ConstructorInitializerAllOnOneLineOrOnePerLine: true
# AllowAllConstructorInitializersOnNextLine: true
# FixNamespaceComments: true # FixNamespaceComments: true
# ForEachMacros: # ForEachMacros:
# - foreach # - foreach
@@ -82,34 +107,61 @@ ConstructorInitializerAllOnOneLineOrOnePerLine: true
# - BOOST_FOREACH # - BOOST_FOREACH
# IfMacros: # IfMacros:
# - KJ_IF_MAYBE # - KJ_IF_MAYBE
# IncludeBlocks: Preserve # IncludeBlocks: Preserve
IncludeCategories: IncludeCategories:
- Regex: '".*"' - Regex: ^".*"$
Priority: 1 Priority: 1
- Regex: '^<.*\.h>' - Regex: ^<.*\.h>$
Priority: 2 Priority: 2
- Regex: '^<.*' - Regex: ^<.*>$
Priority: 3 Priority: 3
# IncludeIsMainRegex: '(Test)?$' # IncludeIsMainRegex: (Test)?$
# IncludeIsMainSourceRegex: '' # IncludeIsMainSourceRegex: ""
# IndentAccessModifiers: false # IndentAccessModifiers: false
IndentCaseLabels: true
# IndentCaseBlocks: false # IndentCaseBlocks: false
IndentCaseLabels: true
# IndentExternBlock: AfterExternBlock
# IndentGotoLabels: true # IndentGotoLabels: true
# IndentPPDirectives: None # IndentPPDirectives: None
# IndentExternBlock: AfterExternBlock # IndentRequiresClause: true
# IndentRequires: false IndentWidth: 4
IndentWidth: 4
# IndentWrappedFunctionNames: false # IndentWrappedFunctionNames: false
InsertBraces: true
# InsertNewlineAtEOF: false
# InsertTrailingCommas: None # InsertTrailingCommas: None
# IntegerLiteralSeparator:
# Binary: 0
# BinaryMinDigits: 0
# Decimal: 0
# DecimalMinDigits: 0
# Hex: 0
# HexMinDigits: 0
JavaImportGroups:
- org.godotengine
- android
- androidx
- com.android
- com.google
- java
- javax
# JavaScriptQuotes: Leave # JavaScriptQuotes: Leave
# JavaScriptWrapImports: true # JavaScriptWrapImports: true
# KeepEmptyLinesAtEOF: false
KeepEmptyLinesAtTheStartOfBlocks: false KeepEmptyLinesAtTheStartOfBlocks: false
# LambdaBodyIndentation: Signature # LambdaBodyIndentation: Signature
# MacroBlockBegin: '' # Language: Cpp
# MacroBlockEnd: '' # LineEnding: DeriveLF
# MacroBlockBegin: ""
# MacroBlockEnd: ""
# MaxEmptyLinesToKeep: 1 # MaxEmptyLinesToKeep: 1
# NamespaceIndentation: None # NamespaceIndentation: None
# ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 4
# ObjCBreakBeforeNestedBlockParam: true
# ObjCSpaceAfterProperty: false
# ObjCSpaceBeforeProtocolList: true
# PPIndentWidth: -1
PackConstructorInitializers: NextLine
# PenaltyBreakAssignment: 2 # PenaltyBreakAssignment: 2
# PenaltyBreakBeforeFirstCallParameter: 19 # PenaltyBreakBeforeFirstCallParameter: 19
# PenaltyBreakComment: 300 # PenaltyBreakComment: 300
@@ -118,82 +170,71 @@ KeepEmptyLinesAtTheStartOfBlocks: false
# PenaltyBreakString: 1000 # PenaltyBreakString: 1000
# PenaltyBreakTemplateDeclaration: 10 # PenaltyBreakTemplateDeclaration: 10
# PenaltyExcessCharacter: 1000000 # PenaltyExcessCharacter: 1000000
# PenaltyReturnTypeOnItsOwnLine: 60
# PenaltyIndentedWhitespace: 0 # PenaltyIndentedWhitespace: 0
# PenaltyReturnTypeOnItsOwnLine: 60
# PointerAlignment: Right # PointerAlignment: Right
# PPIndentWidth: -1 # QualifierAlignment: Leave
# ReferenceAlignment: Pointer # ReferenceAlignment: Pointer
# ReflowComments: true # ReflowComments: true
# RemoveBracesLLVM: false # RemoveBracesLLVM: false
# RemoveParentheses: Leave
RemoveSemicolon: true
# RequiresClausePosition: OwnLine
# RequiresExpressionIndentation: OuterScope
# SeparateDefinitionBlocks: Leave # SeparateDefinitionBlocks: Leave
# ShortNamespaceLines: 1 # ShortNamespaceLines: 1
# SortIncludes: CaseSensitive # SortIncludes: CaseSensitive
# SortJavaStaticImport: Before # SortJavaStaticImport: Before
# SortUsingDeclarations: true # SortUsingDeclarations: LexicographicNumeric
# SpaceAfterCStyleCast: false # SpaceAfterCStyleCast: false
# SpaceAfterLogicalNot: false # SpaceAfterLogicalNot: false
# SpaceAfterTemplateKeyword: true # SpaceAfterTemplateKeyword: true
# SpaceAroundPointerQualifiers: Default
# SpaceBeforeAssignmentOperators: true # SpaceBeforeAssignmentOperators: true
# SpaceBeforeCaseColon: false # SpaceBeforeCaseColon: false
# SpaceBeforeCpp11BracedList: false # SpaceBeforeCpp11BracedList: false
# SpaceBeforeCtorInitializerColon: true # SpaceBeforeCtorInitializerColon: true
# SpaceBeforeInheritanceColon: true # SpaceBeforeInheritanceColon: true
# SpaceBeforeJsonColon: false
# SpaceBeforeParens: ControlStatements # SpaceBeforeParens: ControlStatements
# SpaceBeforeParensOptions: # SpaceBeforeParensOptions:
# AfterControlStatements: true # AfterControlStatements: true
# AfterForeachMacros: true # AfterForeachMacros: true
# AfterFunctionDefinitionName: false
# AfterFunctionDeclarationName: false # AfterFunctionDeclarationName: false
# AfterIfMacros: true # AfterFunctionDefinitionName: false
# AfterIfMacros: true
# AfterOverloadedOperator: false # AfterOverloadedOperator: false
# AfterRequiresInClause: false
# AfterRequiresInExpression: false
# BeforeNonEmptyParentheses: false # BeforeNonEmptyParentheses: false
# SpaceAroundPointerQualifiers: Default
# SpaceBeforeRangeBasedForLoopColon: true # SpaceBeforeRangeBasedForLoopColon: true
# SpaceInEmptyBlock: false
# SpaceInEmptyParentheses: false
# SpacesBeforeTrailingComments: 1
# SpacesInAngles: Never
# SpacesInConditionalStatement: false
# SpacesInContainerLiterals: true
# SpacesInCStyleCastParentheses: false
## Godot TODO: We'll want to use a min of 1, but we need to see how to fix
## our comment capitalization at the same time.
SpacesInLineCommentPrefix:
Minimum: 0
Maximum: -1
# SpacesInParentheses: false
# SpacesInSquareBrackets: false
# SpaceBeforeSquareBrackets: false # SpaceBeforeSquareBrackets: false
# BitFieldColonSpacing: Both # SpaceInEmptyBlock: false
# SpacesBeforeTrailingComments: 1
# SpacesInAngles: Never
# SpacesInContainerLiterals: true
SpacesInLineCommentPrefix:
Minimum: 0 # We want a minimum of 1 for comments, but allow 0 for disabled code.
Maximum: -1
# SpacesInParens: Never
# SpacesInParensOptions:
# InConditionalStatements: false
# InCStyleCasts: false
# InEmptyParentheses: false
# Other: false
# SpacesInSquareBrackets: false
Standard: c++20
# StatementAttributeLikeMacros: # StatementAttributeLikeMacros:
# - Q_EMIT # - Q_EMIT
# StatementMacros: # StatementMacros:
# - Q_UNUSED # - Q_UNUSED
# - QT_REQUIRE_VERSION # - QT_REQUIRE_VERSION
TabWidth: 4 TabWidth: 4
# UseCRLF: false UseTab: Always
UseTab: Always # VerilogBreakBetweenInstancePorts: true
# WhitespaceSensitiveMacros: # WhitespaceSensitiveMacros:
# - STRINGIZE
# - PP_STRINGIZE
# - BOOST_PP_STRINGIZE # - BOOST_PP_STRINGIZE
# - NS_SWIFT_NAME
# - CF_SWIFT_NAME # - CF_SWIFT_NAME
--- # - NS_SWIFT_NAME
### C++ specific config ### # - PP_STRINGIZE
Language: Cpp # - STRINGIZE
Standard: c++17
---
### ObjC specific config ###
Language: ObjC
# ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 4
# ObjCBreakBeforeNestedBlockParam: true
# ObjCSpaceAfterProperty: false
# ObjCSpaceBeforeProtocolList: true
---
### Java specific config ###
Language: Java
# BreakAfterJavaFieldAnnotations: false
JavaImportGroups: ['org.godotengine', 'android', 'androidx', 'com.android', 'com.google', 'java', 'javax']
...

View File

@@ -6,11 +6,12 @@ end_of_line = lf
indent_size = 4 indent_size = 4
indent_style = tab indent_style = tab
insert_final_newline = true insert_final_newline = true
max_line_length = 120
trim_trailing_whitespace = true trim_trailing_whitespace = true
[{*.py,SConstruct}] [{*.py,SConstruct}]
indent_style = space indent_style = space
[*.{yml,yaml}] [{*.{yml,yaml},.clang-format}]
indent_size = 2 indent_size = 2
indent_style = space indent_style = space

View File

@@ -9,32 +9,36 @@ exclude: |
repos: repos:
- repo: https://github.com/pre-commit/mirrors-clang-format - repo: https://github.com/pre-commit/mirrors-clang-format
rev: v17.0.6 rev: v20.1.0
hooks: hooks:
- id: clang-format - id: clang-format
- repo: https://github.com/astral-sh/ruff-pre-commit - repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.4 rev: v0.11.4
hooks: hooks:
- id: ruff - id: ruff
args: [--fix] args: [--fix]
files: (\.py|SConstruct)$
types_or: [text]
- id: ruff-format - id: ruff-format
files: (\.py|SConstruct)$
types_or: [text]
- repo: https://github.com/pre-commit/mirrors-mypy - repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.971 rev: v1.14.1 # Latest version that supports Python 3.8
hooks: hooks:
- id: mypy - id: mypy
files: \.py$ files: \.py$
types_or: [text] types_or: [text]
- repo: https://github.com/codespell-project/codespell - repo: https://github.com/codespell-project/codespell
rev: v2.3.0 rev: v2.4.1
hooks: hooks:
- id: codespell - id: codespell
additional_dependencies: [tomli] additional_dependencies: [tomli]
- repo: https://github.com/BlankSpruce/gersemi - repo: https://github.com/BlankSpruce/gersemi
rev: 0.18.2 rev: 0.19.2
hooks: hooks:
- id: gersemi - id: gersemi
args: ["-i", "--no-warn-about-unknown-commands", "-l", "120"] args: ["-i", "--no-warn-about-unknown-commands", "-l", "120"]

View File

@@ -3,7 +3,7 @@
import os import os
EnsureSConsVersion(4, 0) EnsureSConsVersion(4, 0)
EnsurePythonVersion(3, 8)
try: try:
Import("env") Import("env")

View File

@@ -356,7 +356,7 @@ def generate_builtin_bindings(api, output_dir, build_config):
add_header("variant_size.hpp", variant_size_source) add_header("variant_size.hpp", variant_size_source)
variant_size_source.append("#pragma once") variant_size_source.append("#pragma once")
variant_size_source.append(f'#define GODOT_CPP_VARIANT_SIZE {builtin_sizes["Variant"]}') variant_size_source.append(f"#define GODOT_CPP_VARIANT_SIZE {builtin_sizes['Variant']}")
variant_size_file.write("\n".join(variant_size_source)) variant_size_file.write("\n".join(variant_size_source))
@@ -601,19 +601,19 @@ def generate_builtin_class_header(builtin_api, size, used_classes, fully_used_cl
if "constructors" in builtin_api: if "constructors" in builtin_api:
for constructor in builtin_api["constructors"]: for constructor in builtin_api["constructors"]:
result.append(f'\t\tGDExtensionPtrConstructor constructor_{constructor["index"]};') result.append(f"\t\tGDExtensionPtrConstructor constructor_{constructor['index']};")
if builtin_api["has_destructor"]: if builtin_api["has_destructor"]:
result.append("\t\tGDExtensionPtrDestructor destructor;") result.append("\t\tGDExtensionPtrDestructor destructor;")
if "methods" in builtin_api: if "methods" in builtin_api:
for method in builtin_api["methods"]: for method in builtin_api["methods"]:
result.append(f'\t\tGDExtensionPtrBuiltInMethod method_{method["name"]};') result.append(f"\t\tGDExtensionPtrBuiltInMethod method_{method['name']};")
if "members" in builtin_api: if "members" in builtin_api:
for member in builtin_api["members"]: for member in builtin_api["members"]:
result.append(f'\t\tGDExtensionPtrSetter member_{member["name"]}_setter;') result.append(f"\t\tGDExtensionPtrSetter member_{member['name']}_setter;")
result.append(f'\t\tGDExtensionPtrGetter member_{member["name"]}_getter;') result.append(f"\t\tGDExtensionPtrGetter member_{member['name']}_getter;")
if "indexing_return_type" in builtin_api: if "indexing_return_type" in builtin_api:
result.append("\t\tGDExtensionPtrIndexedSetter indexed_setter;") result.append("\t\tGDExtensionPtrIndexedSetter indexed_setter;")
@@ -628,10 +628,10 @@ def generate_builtin_class_header(builtin_api, size, used_classes, fully_used_cl
for operator in builtin_api["operators"]: for operator in builtin_api["operators"]:
if "right_type" in operator: if "right_type" in operator:
result.append( result.append(
f'\t\tGDExtensionPtrOperatorEvaluator operator_{get_operator_id_name(operator["name"])}_{operator["right_type"]};' f"\t\tGDExtensionPtrOperatorEvaluator operator_{get_operator_id_name(operator['name'])}_{operator['right_type']};"
) )
else: else:
result.append(f'\t\tGDExtensionPtrOperatorEvaluator operator_{get_operator_id_name(operator["name"])};') result.append(f"\t\tGDExtensionPtrOperatorEvaluator operator_{get_operator_id_name(operator['name'])};")
result.append("\t} _method_bindings;") result.append("\t} _method_bindings;")
@@ -693,12 +693,12 @@ def generate_builtin_class_header(builtin_api, size, used_classes, fully_used_cl
if class_name == "Vector3" and constant["name"].startswith("AXIS"): if class_name == "Vector3" and constant["name"].startswith("AXIS"):
if axis_constants_count == 0: if axis_constants_count == 0:
result.append("\tenum Axis {") result.append("\tenum Axis {")
result.append(f'\t\t{constant["name"]} = {constant["value"]},') result.append(f"\t\t{constant['name']} = {constant['value']},")
axis_constants_count += 1 axis_constants_count += 1
if axis_constants_count == 3: if axis_constants_count == 3:
result.append("\t};") result.append("\t};")
else: else:
result.append(f'\tstatic const {correct_type(constant["type"])} {constant["name"]};') result.append(f"\tstatic const {correct_type(constant['type'])} {constant['name']};")
if builtin_api["has_destructor"]: if builtin_api["has_destructor"]:
result.append(f"\t~{class_name}();") result.append(f"\t~{class_name}();")
@@ -718,13 +718,13 @@ def generate_builtin_class_header(builtin_api, size, used_classes, fully_used_cl
method_signature += "static " method_signature += "static "
if "return_type" in method: if "return_type" in method:
method_signature += f'{correct_type(method["return_type"])}' method_signature += f"{correct_type(method['return_type'])}"
if not method_signature.endswith("*"): if not method_signature.endswith("*"):
method_signature += " " method_signature += " "
else: else:
method_signature += "void " method_signature += "void "
method_signature += f'{method["name"]}(' method_signature += f"{method['name']}("
method_arguments = [] method_arguments = []
if "arguments" in method: if "arguments" in method:
@@ -759,21 +759,21 @@ def generate_builtin_class_header(builtin_api, size, used_classes, fully_used_cl
if "members" in builtin_api: if "members" in builtin_api:
for member in builtin_api["members"]: for member in builtin_api["members"]:
if f'get_{member["name"]}' not in method_list: if f"get_{member['name']}" not in method_list:
result.append(f'\t{correct_type(member["type"])} get_{member["name"]}() const;') result.append(f"\t{correct_type(member['type'])} get_{member['name']}() const;")
if f'set_{member["name"]}' not in method_list: if f"set_{member['name']}" not in method_list:
result.append(f'\tvoid set_{member["name"]}({type_for_parameter(member["type"])}value);') result.append(f"\tvoid set_{member['name']}({type_for_parameter(member['type'])}value);")
if "operators" in builtin_api: if "operators" in builtin_api:
for operator in builtin_api["operators"]: for operator in builtin_api["operators"]:
if is_valid_cpp_operator(operator["name"]): if is_valid_cpp_operator(operator["name"]):
if "right_type" in operator: if "right_type" in operator:
result.append( result.append(
f'\t{correct_type(operator["return_type"])} operator{get_operator_cpp_name(operator["name"])}({type_for_parameter(operator["right_type"])}p_other) const;' f"\t{correct_type(operator['return_type'])} operator{get_operator_cpp_name(operator['name'])}({type_for_parameter(operator['right_type'])}p_other) const;"
) )
else: else:
result.append( result.append(
f'\t{correct_type(operator["return_type"])} operator{get_operator_cpp_name(operator["name"])}() const;' f"\t{correct_type(operator['return_type'])} operator{get_operator_cpp_name(operator['name'])}() const;"
) )
# Copy assignment. # Copy assignment.
@@ -1041,7 +1041,7 @@ def generate_builtin_class_source(builtin_api, size, used_classes, fully_used_cl
if "constructors" in builtin_api: if "constructors" in builtin_api:
for constructor in builtin_api["constructors"]: for constructor in builtin_api["constructors"]:
result.append( result.append(
f'\t_method_bindings.constructor_{constructor["index"]} = internal::gdextension_interface_variant_get_ptr_constructor({enum_type_name}, {constructor["index"]});' f"\t_method_bindings.constructor_{constructor['index']} = internal::gdextension_interface_variant_get_ptr_constructor({enum_type_name}, {constructor['index']});"
) )
if builtin_api["has_destructor"]: if builtin_api["has_destructor"]:
@@ -1065,17 +1065,17 @@ def generate_builtin_class_source(builtin_api, size, used_classes, fully_used_cl
# TODO: Add error check for hash mismatch. # TODO: Add error check for hash mismatch.
result.append(f'\t_gde_name = StringName("{method["name"]}");') result.append(f'\t_gde_name = StringName("{method["name"]}");')
result.append( result.append(
f'\t_method_bindings.method_{method["name"]} = internal::gdextension_interface_variant_get_ptr_builtin_method({enum_type_name}, _gde_name._native_ptr(), {method["hash"]});' f"\t_method_bindings.method_{method['name']} = internal::gdextension_interface_variant_get_ptr_builtin_method({enum_type_name}, _gde_name._native_ptr(), {method['hash']});"
) )
if "members" in builtin_api: if "members" in builtin_api:
for member in builtin_api["members"]: for member in builtin_api["members"]:
result.append(f'\t_gde_name = StringName("{member["name"]}");') result.append(f'\t_gde_name = StringName("{member["name"]}");')
result.append( result.append(
f'\t_method_bindings.member_{member["name"]}_setter = internal::gdextension_interface_variant_get_ptr_setter({enum_type_name}, _gde_name._native_ptr());' f"\t_method_bindings.member_{member['name']}_setter = internal::gdextension_interface_variant_get_ptr_setter({enum_type_name}, _gde_name._native_ptr());"
) )
result.append( result.append(
f'\t_method_bindings.member_{member["name"]}_getter = internal::gdextension_interface_variant_get_ptr_getter({enum_type_name}, _gde_name._native_ptr());' f"\t_method_bindings.member_{member['name']}_getter = internal::gdextension_interface_variant_get_ptr_getter({enum_type_name}, _gde_name._native_ptr());"
) )
if "indexing_return_type" in builtin_api: if "indexing_return_type" in builtin_api:
@@ -1107,11 +1107,11 @@ def generate_builtin_class_source(builtin_api, size, used_classes, fully_used_cl
f"GDEXTENSION_VARIANT_TYPE_{camel_to_snake(operator['right_type']).upper()}" f"GDEXTENSION_VARIANT_TYPE_{camel_to_snake(operator['right_type']).upper()}"
) )
result.append( result.append(
f'\t_method_bindings.operator_{get_operator_id_name(operator["name"])}_{operator["right_type"]} = internal::gdextension_interface_variant_get_ptr_operator_evaluator(GDEXTENSION_VARIANT_OP_{get_operator_id_name(operator["name"]).upper()}, {enum_type_name}, {right_type_variant_type});' f"\t_method_bindings.operator_{get_operator_id_name(operator['name'])}_{operator['right_type']} = internal::gdextension_interface_variant_get_ptr_operator_evaluator(GDEXTENSION_VARIANT_OP_{get_operator_id_name(operator['name']).upper()}, {enum_type_name}, {right_type_variant_type});"
) )
else: else:
result.append( result.append(
f'\t_method_bindings.operator_{get_operator_id_name(operator["name"])} = internal::gdextension_interface_variant_get_ptr_operator_evaluator(GDEXTENSION_VARIANT_OP_{get_operator_id_name(operator["name"]).upper()}, {enum_type_name}, GDEXTENSION_VARIANT_TYPE_NIL);' f"\t_method_bindings.operator_{get_operator_id_name(operator['name'])} = internal::gdextension_interface_variant_get_ptr_operator_evaluator(GDEXTENSION_VARIANT_OP_{get_operator_id_name(operator['name']).upper()}, {enum_type_name}, GDEXTENSION_VARIANT_TYPE_NIL);"
) )
result.append("}") result.append("}")
@@ -1136,7 +1136,7 @@ def generate_builtin_class_source(builtin_api, size, used_classes, fully_used_cl
result.append(method_signature) result.append(method_signature)
method_call = ( method_call = (
f'\tinternal::_call_builtin_constructor(_method_bindings.constructor_{constructor["index"]}, &opaque' f"\tinternal::_call_builtin_constructor(_method_bindings.constructor_{constructor['index']}, &opaque"
) )
if "arguments" in constructor: if "arguments" in constructor:
if len(constructor["arguments"]) == 1 and constructor["arguments"][0]["type"] == class_name: if len(constructor["arguments"]) == 1 and constructor["arguments"][0]["type"] == class_name:
@@ -1204,7 +1204,7 @@ def generate_builtin_class_source(builtin_api, size, used_classes, fully_used_cl
method_call += f"return internal::_call_builtin_method_ptr_ret_obj<{return_type}>(" method_call += f"return internal::_call_builtin_method_ptr_ret_obj<{return_type}>("
else: else:
method_call += "internal::_call_builtin_method_ptr_no_ret(" method_call += "internal::_call_builtin_method_ptr_no_ret("
method_call += f'_method_bindings.method_{method["name"]}, ' method_call += f"_method_bindings.method_{method['name']}, "
if "is_static" in method and method["is_static"]: if "is_static" in method and method["is_static"]:
method_call += "nullptr" method_call += "nullptr"
else: else:
@@ -1233,19 +1233,19 @@ def generate_builtin_class_source(builtin_api, size, used_classes, fully_used_cl
if "members" in builtin_api: if "members" in builtin_api:
for member in builtin_api["members"]: for member in builtin_api["members"]:
if f'get_{member["name"]}' not in method_list: if f"get_{member['name']}" not in method_list:
result.append(f'{correct_type(member["type"])} {class_name}::get_{member["name"]}() const {{') result.append(f"{correct_type(member['type'])} {class_name}::get_{member['name']}() const {{")
result.append( result.append(
f'\treturn internal::_call_builtin_ptr_getter<{correct_type(member["type"])}>(_method_bindings.member_{member["name"]}_getter, (GDExtensionConstTypePtr)&opaque);' f"\treturn internal::_call_builtin_ptr_getter<{correct_type(member['type'])}>(_method_bindings.member_{member['name']}_getter, (GDExtensionConstTypePtr)&opaque);"
) )
result.append("}") result.append("}")
if f'set_{member["name"]}' not in method_list: if f"set_{member['name']}" not in method_list:
result.append(f'void {class_name}::set_{member["name"]}({type_for_parameter(member["type"])}value) {{') result.append(f"void {class_name}::set_{member['name']}({type_for_parameter(member['type'])}value) {{")
(encode, arg_name) = get_encoded_arg("value", member["type"], None) (encode, arg_name) = get_encoded_arg("value", member["type"], None)
result += encode result += encode
result.append( result.append(
f'\t_method_bindings.member_{member["name"]}_setter((GDExtensionConstTypePtr)&opaque, (GDExtensionConstTypePtr){arg_name});' f"\t_method_bindings.member_{member['name']}_setter((GDExtensionConstTypePtr)&opaque, (GDExtensionConstTypePtr){arg_name});"
) )
result.append("}") result.append("}")
@@ -1256,20 +1256,20 @@ def generate_builtin_class_source(builtin_api, size, used_classes, fully_used_cl
if is_valid_cpp_operator(operator["name"]): if is_valid_cpp_operator(operator["name"]):
if "right_type" in operator: if "right_type" in operator:
result.append( result.append(
f'{correct_type(operator["return_type"])} {class_name}::operator{get_operator_cpp_name(operator["name"])}({type_for_parameter(operator["right_type"])}p_other) const {{' f"{correct_type(operator['return_type'])} {class_name}::operator{get_operator_cpp_name(operator['name'])}({type_for_parameter(operator['right_type'])}p_other) const {{"
) )
(encode, arg_name) = get_encoded_arg("other", operator["right_type"], None) (encode, arg_name) = get_encoded_arg("other", operator["right_type"], None)
result += encode result += encode
result.append( result.append(
f'\treturn internal::_call_builtin_operator_ptr<{get_gdextension_type(correct_type(operator["return_type"]))}>(_method_bindings.operator_{get_operator_id_name(operator["name"])}_{operator["right_type"]}, (GDExtensionConstTypePtr)&opaque, (GDExtensionConstTypePtr){arg_name});' f"\treturn internal::_call_builtin_operator_ptr<{get_gdextension_type(correct_type(operator['return_type']))}>(_method_bindings.operator_{get_operator_id_name(operator['name'])}_{operator['right_type']}, (GDExtensionConstTypePtr)&opaque, (GDExtensionConstTypePtr){arg_name});"
) )
result.append("}") result.append("}")
else: else:
result.append( result.append(
f'{correct_type(operator["return_type"])} {class_name}::operator{get_operator_cpp_name(operator["name"])}() const {{' f"{correct_type(operator['return_type'])} {class_name}::operator{get_operator_cpp_name(operator['name'])}() const {{"
) )
result.append( result.append(
f'\treturn internal::_call_builtin_operator_ptr<{get_gdextension_type(correct_type(operator["return_type"]))}>(_method_bindings.operator_{get_operator_id_name(operator["name"])}, (GDExtensionConstTypePtr)&opaque, (GDExtensionConstTypePtr) nullptr);' f"\treturn internal::_call_builtin_operator_ptr<{get_gdextension_type(correct_type(operator['return_type']))}>(_method_bindings.operator_{get_operator_id_name(operator['name'])}, (GDExtensionConstTypePtr)&opaque, (GDExtensionConstTypePtr) nullptr);"
) )
result.append("}") result.append("}")
result.append("") result.append("")
@@ -1638,12 +1638,12 @@ def generate_engine_class_header(class_api, used_classes, fully_used_classes, us
if "enums" in class_api: if "enums" in class_api:
for enum_api in class_api["enums"]: for enum_api in class_api["enums"]:
if enum_api["is_bitfield"]: if enum_api["is_bitfield"]:
result.append(f'\tenum {enum_api["name"]} : uint64_t {{') result.append(f"\tenum {enum_api['name']} : uint64_t {{")
else: else:
result.append(f'\tenum {enum_api["name"]} {{') result.append(f"\tenum {enum_api['name']} {{")
for value in enum_api["values"]: for value in enum_api["values"]:
result.append(f'\t\t{value["name"]} = {value["value"]},') result.append(f"\t\t{value['name']} = {value['value']},")
result.append("\t};") result.append("\t};")
result.append("") result.append("")
@@ -1651,7 +1651,7 @@ def generate_engine_class_header(class_api, used_classes, fully_used_classes, us
for value in class_api["constants"]: for value in class_api["constants"]:
if "type" not in value: if "type" not in value:
value["type"] = "int" value["type"] = "int"
result.append(f'\tstatic const {value["type"]} {value["name"]} = {value["value"]};') result.append(f"\tstatic const {value['type']} {value['name']} = {value['value']};")
result.append("") result.append("")
if is_singleton: if is_singleton:
@@ -1784,9 +1784,9 @@ def generate_engine_class_header(class_api, used_classes, fully_used_classes, us
if "enums" in class_api and class_name != "Object": if "enums" in class_api and class_name != "Object":
for enum_api in class_api["enums"]: for enum_api in class_api["enums"]:
if enum_api["is_bitfield"]: if enum_api["is_bitfield"]:
result.append(f'VARIANT_BITFIELD_CAST({class_name}::{enum_api["name"]});') result.append(f"VARIANT_BITFIELD_CAST({class_name}::{enum_api['name']});")
else: else:
result.append(f'VARIANT_ENUM_CAST({class_name}::{enum_api["name"]});') result.append(f"VARIANT_ENUM_CAST({class_name}::{enum_api['name']});")
result.append("") result.append("")
if class_name == "ClassDBSingleton": if class_name == "ClassDBSingleton":
@@ -1795,12 +1795,12 @@ def generate_engine_class_header(class_api, used_classes, fully_used_classes, us
if "enums" in class_api: if "enums" in class_api:
for enum_api in class_api["enums"]: for enum_api in class_api["enums"]:
if enum_api["is_bitfield"]: if enum_api["is_bitfield"]:
result.append(f'\tenum {enum_api["name"]} : uint64_t {{ \\') result.append(f"\tenum {enum_api['name']} : uint64_t {{ \\")
else: else:
result.append(f'\tenum {enum_api["name"]} {{ \\') result.append(f"\tenum {enum_api['name']} {{ \\")
for value in enum_api["values"]: for value in enum_api["values"]:
result.append(f'\t\t{value["name"]} = {value["value"]}, \\') result.append(f"\t\t{value['name']} = {value['value']}, \\")
result.append("\t}; \\") result.append("\t}; \\")
result.append("\t \\") result.append("\t \\")
@@ -1831,7 +1831,7 @@ def generate_engine_class_header(class_api, used_classes, fully_used_classes, us
else: else:
method_signature += "void " method_signature += "void "
method_signature += f'{method["name"]}(' method_signature += f"{method['name']}("
method_arguments = [] method_arguments = []
if "arguments" in method: if "arguments" in method:
@@ -1850,7 +1850,7 @@ def generate_engine_class_header(class_api, used_classes, fully_used_classes, us
method_body += "return " method_body += "return "
if "alias_for" in class_api and return_type.startswith(class_api["alias_for"] + "::"): if "alias_for" in class_api and return_type.startswith(class_api["alias_for"] + "::"):
method_body += f"({return_type})" method_body += f"({return_type})"
method_body += f'ClassDBSingleton::get_singleton()->{method["name"]}(' method_body += f"ClassDBSingleton::get_singleton()->{method['name']}("
method_body += ", ".join(map(lambda x: escape_argument(x["name"]), method_arguments)) method_body += ", ".join(map(lambda x: escape_argument(x["name"]), method_arguments))
if vararg: if vararg:
method_body += ", p_args..." method_body += ", p_args..."
@@ -1866,9 +1866,9 @@ def generate_engine_class_header(class_api, used_classes, fully_used_classes, us
if "enums" in class_api: if "enums" in class_api:
for enum_api in class_api["enums"]: for enum_api in class_api["enums"]:
if enum_api["is_bitfield"]: if enum_api["is_bitfield"]:
result.append(f'\tVARIANT_BITFIELD_CAST({class_api["alias_for"]}::{enum_api["name"]}); \\') result.append(f"\tVARIANT_BITFIELD_CAST({class_api['alias_for']}::{enum_api['name']}); \\")
else: else:
result.append(f'\tVARIANT_ENUM_CAST({class_api["alias_for"]}::{enum_api["name"]}); \\') result.append(f"\tVARIANT_ENUM_CAST({class_api['alias_for']}::{enum_api['name']}); \\")
result.append("\t") result.append("\t")
result.append("") result.append("")
@@ -1965,7 +1965,7 @@ def generate_engine_class_source(class_api, used_classes, fully_used_classes, us
if has_return: if has_return:
result.append( result.append(
f'\tCHECK_METHOD_BIND_RET(_gde_method_bind, ({get_default_value_for_type(method["return_value"]["type"])}));' f"\tCHECK_METHOD_BIND_RET(_gde_method_bind, ({get_default_value_for_type(method['return_value']['type'])}));"
) )
else: else:
result.append("\tCHECK_METHOD_BIND(_gde_method_bind);") result.append("\tCHECK_METHOD_BIND(_gde_method_bind);")
@@ -2047,7 +2047,7 @@ def generate_engine_class_source(class_api, used_classes, fully_used_classes, us
method_signature += " {" method_signature += " {"
if "return_value" in method and correct_type(method["return_value"]["type"]) != "void": if "return_value" in method and correct_type(method["return_value"]["type"]) != "void":
result.append(method_signature) result.append(method_signature)
result.append(f'\treturn {get_default_value_for_type(method["return_value"]["type"])};') result.append(f"\treturn {get_default_value_for_type(method['return_value']['type'])};")
result.append("}") result.append("}")
else: else:
method_signature += "}" method_signature += "}"
@@ -2083,7 +2083,7 @@ def generate_global_constants(api, output_dir):
if len(api["global_constants"]) > 0: if len(api["global_constants"]) > 0:
for constant in api["global_constants"]: for constant in api["global_constants"]:
header.append(f'const int64_t {escape_identifier(constant["name"])} = {constant["value"]};') header.append(f"const int64_t {escape_identifier(constant['name'])} = {constant['value']};")
header.append("") header.append("")
@@ -2092,12 +2092,12 @@ def generate_global_constants(api, output_dir):
continue continue
if enum_def["is_bitfield"]: if enum_def["is_bitfield"]:
header.append(f'enum {enum_def["name"]} : uint64_t {{') header.append(f"enum {enum_def['name']} : uint64_t {{")
else: else:
header.append(f'enum {enum_def["name"]} {{') header.append(f"enum {enum_def['name']} {{")
for value in enum_def["values"]: for value in enum_def["values"]:
header.append(f'\t{value["name"]} = {value["value"]},') header.append(f"\t{value['name']} = {value['value']},")
header.append("};") header.append("};")
header.append("") header.append("")
@@ -2125,8 +2125,8 @@ def generate_version_header(api, output_dir):
header.append(f"#define GODOT_VERSION_MAJOR {api['header']['version_major']}") header.append(f"#define GODOT_VERSION_MAJOR {api['header']['version_major']}")
header.append(f"#define GODOT_VERSION_MINOR {api['header']['version_minor']}") header.append(f"#define GODOT_VERSION_MINOR {api['header']['version_minor']}")
header.append(f"#define GODOT_VERSION_PATCH {api['header']['version_patch']}") header.append(f"#define GODOT_VERSION_PATCH {api['header']['version_patch']}")
header.append(f"#define GODOT_VERSION_STATUS \"{api['header']['version_status']}\"") header.append(f'#define GODOT_VERSION_STATUS "{api["header"]["version_status"]}"')
header.append(f"#define GODOT_VERSION_BUILD \"{api['header']['version_build']}\"") header.append(f'#define GODOT_VERSION_BUILD "{api["header"]["version_build"]}"')
header.append("") header.append("")
@@ -2158,9 +2158,9 @@ def generate_global_constant_binds(api, output_dir):
continue continue
if enum_def["is_bitfield"]: if enum_def["is_bitfield"]:
header.append(f'VARIANT_BITFIELD_CAST({enum_def["name"]});') header.append(f"VARIANT_BITFIELD_CAST({enum_def['name']});")
else: else:
header.append(f'VARIANT_ENUM_CAST({enum_def["name"]});') header.append(f"VARIANT_ENUM_CAST({enum_def['name']});")
# Variant::Type is not a global enum, but only one line, it is worth to place in this file instead of creating new file. # Variant::Type is not a global enum, but only one line, it is worth to place in this file instead of creating new file.
header.append("VARIANT_ENUM_CAST(godot::Variant::Type);") header.append("VARIANT_ENUM_CAST(godot::Variant::Type);")
@@ -2259,7 +2259,7 @@ def generate_utility_functions(api, output_dir):
has_return = "return_type" in function and function["return_type"] != "void" has_return = "return_type" in function and function["return_type"] != "void"
if has_return: if has_return:
source.append( source.append(
f'\tCHECK_METHOD_BIND_RET(_gde_function, ({get_default_value_for_type(function["return_type"])}));' f"\tCHECK_METHOD_BIND_RET(_gde_function, ({get_default_value_for_type(function['return_type'])}));"
) )
else: else:
source.append("\tCHECK_METHOD_BIND(_gde_function);") source.append("\tCHECK_METHOD_BIND(_gde_function);")
@@ -2271,7 +2271,7 @@ def generate_utility_functions(api, output_dir):
if function["return_type"] == "Object": if function["return_type"] == "Object":
function_call += "internal::_call_utility_ret_obj(_gde_function" function_call += "internal::_call_utility_ret_obj(_gde_function"
else: else:
function_call += f'internal::_call_utility_ret<{get_gdextension_type(correct_type(function["return_type"]))}>(_gde_function' function_call += f"internal::_call_utility_ret<{get_gdextension_type(correct_type(function['return_type']))}>(_gde_function"
else: else:
function_call += "internal::_call_utility_no_ret(_gde_function" function_call += "internal::_call_utility_no_ret(_gde_function"
@@ -2289,7 +2289,7 @@ def generate_utility_functions(api, output_dir):
function_call += ", ".join(arguments) function_call += ", ".join(arguments)
else: else:
if has_return: if has_return:
source.append(f'\t{get_gdextension_type(correct_type(function["return_type"]))} ret;') source.append(f"\t{get_gdextension_type(correct_type(function['return_type']))} ret;")
else: else:
source.append("\tVariant ret;") source.append("\tVariant ret;")
function_call += "_gde_function(&ret, reinterpret_cast<GDExtensionConstVariantPtr *>(p_args), p_arg_count" function_call += "_gde_function(&ret, reinterpret_cast<GDExtensionConstVariantPtr *>(p_args), p_arg_count"
@@ -2483,7 +2483,7 @@ def make_varargs_template(
if len(class_befor_signature) > 0: if len(class_befor_signature) > 0:
function_signature += class_befor_signature + "::" function_signature += class_befor_signature + "::"
function_signature += f'{escape_identifier(function_data["name"])}' function_signature += f"{escape_identifier(function_data['name'])}"
method_arguments = [] method_arguments = []
if "arguments" in function_data: if "arguments" in function_data:
@@ -2508,7 +2508,7 @@ def make_varargs_template(
if argument["type"] == "Variant": if argument["type"] == "Variant":
args_array += escape_argument(argument["name"]) args_array += escape_argument(argument["name"])
else: else:
args_array += f'Variant({escape_argument(argument["name"])})' args_array += f"Variant({escape_argument(argument['name'])})"
args_array += ", " args_array += ", "
args_array += "Variant(p_args)... }};" args_array += "Variant(p_args)... }};"
@@ -2524,7 +2524,7 @@ def make_varargs_template(
if return_type != "void": if return_type != "void":
call_line += "return " call_line += "return "
call_line += f'{escape_identifier(function_data["name"])}_internal(call_args.data(), variant_args.size());' call_line += f"{escape_identifier(function_data['name'])}_internal(call_args.data(), variant_args.size());"
result.append(call_line) result.append(call_line)
else: else:
base = "(GDExtensionTypePtr)&opaque" base = "(GDExtensionTypePtr)&opaque"
@@ -2534,7 +2534,7 @@ def make_varargs_template(
ret = "nullptr" ret = "nullptr"
if return_type != "void": if return_type != "void":
ret = "&ret" ret = "&ret"
result.append(f'\t{correct_type(function_data["return_type"])} ret;') result.append(f"\t{correct_type(function_data['return_type'])} ret;")
function_name = function_data["name"] function_name = function_data["name"]
result.append( result.append(

View File

@@ -188,7 +188,9 @@ private:
friend class ::godot::Wrapped; \ friend class ::godot::Wrapped; \
\ \
protected: \ protected: \
virtual bool _is_extension_class() const override { return true; } \ virtual bool _is_extension_class() const override { \
return true; \
} \
\ \
static const ::godot::StringName *_get_extension_class_name() { \ static const ::godot::StringName *_get_extension_class_name() { \
const ::godot::StringName &string_name = get_class_static(); \ const ::godot::StringName &string_name = get_class_static(); \
@@ -200,35 +202,35 @@ protected:
} \ } \
\ \
static void (::godot::Wrapped::*_get_notification())(int) { \ static void (::godot::Wrapped::*_get_notification())(int) { \
return (void(::godot::Wrapped::*)(int)) & m_class::_notification; \ return (void (::godot::Wrapped::*)(int)) & m_class::_notification; \
} \ } \
\ \
static bool (::godot::Wrapped::*_get_set())(const ::godot::StringName &p_name, const ::godot::Variant &p_property) { \ static bool (::godot::Wrapped::*_get_set())(const ::godot::StringName &p_name, const ::godot::Variant &p_property) { \
return (bool(::godot::Wrapped::*)(const ::godot::StringName &p_name, const ::godot::Variant &p_property)) & m_class::_set; \ return (bool (::godot::Wrapped::*)(const ::godot::StringName &p_name, const ::godot::Variant &p_property)) & m_class::_set; \
} \ } \
\ \
static bool (::godot::Wrapped::*_get_get())(const ::godot::StringName &p_name, ::godot::Variant &r_ret) const { \ static bool (::godot::Wrapped::*_get_get())(const ::godot::StringName &p_name, ::godot::Variant &r_ret) const { \
return (bool(::godot::Wrapped::*)(const ::godot::StringName &p_name, ::godot::Variant &r_ret) const) & m_class::_get; \ return (bool (::godot::Wrapped::*)(const ::godot::StringName &p_name, ::godot::Variant &r_ret) const) & m_class::_get; \
} \ } \
\ \
static void (::godot::Wrapped::*_get_get_property_list())(::godot::List<::godot::PropertyInfo> * p_list) const { \ static void (::godot::Wrapped::*_get_get_property_list())(::godot::List<::godot::PropertyInfo> * p_list) const { \
return (void(::godot::Wrapped::*)(::godot::List<::godot::PropertyInfo> * p_list) const) & m_class::_get_property_list; \ return (void (::godot::Wrapped::*)(::godot::List<::godot::PropertyInfo> * p_list) const) & m_class::_get_property_list; \
} \ } \
\ \
static bool (::godot::Wrapped::*_get_property_can_revert())(const ::godot::StringName &p_name) const { \ static bool (::godot::Wrapped::*_get_property_can_revert())(const ::godot::StringName &p_name) const { \
return (bool(::godot::Wrapped::*)(const ::godot::StringName &p_name) const) & m_class::_property_can_revert; \ return (bool (::godot::Wrapped::*)(const ::godot::StringName &p_name) const) & m_class::_property_can_revert; \
} \ } \
\ \
static bool (::godot::Wrapped::*_get_property_get_revert())(const ::godot::StringName &p_name, ::godot::Variant &) const { \ static bool (::godot::Wrapped::*_get_property_get_revert())(const ::godot::StringName &p_name, ::godot::Variant &) const { \
return (bool(::godot::Wrapped::*)(const ::godot::StringName &p_name, ::godot::Variant &) const) & m_class::_property_get_revert; \ return (bool (::godot::Wrapped::*)(const ::godot::StringName &p_name, ::godot::Variant &) const) & m_class::_property_get_revert; \
} \ } \
\ \
static void (::godot::Wrapped::*_get_validate_property())(::godot::PropertyInfo & p_property) const { \ static void (::godot::Wrapped::*_get_validate_property())(::godot::PropertyInfo & p_property) const { \
return (void(::godot::Wrapped::*)(::godot::PropertyInfo & p_property) const) & m_class::_validate_property; \ return (void (::godot::Wrapped::*)(::godot::PropertyInfo & p_property) const) & m_class::_validate_property; \
} \ } \
\ \
static ::godot::String (::godot::Wrapped::*_get_to_string())() const { \ static ::godot::String (::godot::Wrapped::*_get_to_string())() const { \
return (::godot::String(::godot::Wrapped::*)() const) & m_class::_to_string; \ return (::godot::String (::godot::Wrapped::*)() const) & m_class::_to_string; \
} \ } \
\ \
template <typename T, typename B> \ template <typename T, typename B> \

View File

@@ -149,8 +149,7 @@ public:
template <typename Derived, typename T, typename R, bool should_returns> template <typename Derived, typename T, typename R, bool should_returns>
class MethodBindVarArgBase : public MethodBind { class MethodBindVarArgBase : public MethodBind {
protected: protected:
R(T::*method) R (T::*method)(const Variant **, GDExtensionInt, GDExtensionCallError &);
(const Variant **, GDExtensionInt, GDExtensionCallError &);
std::vector<PropertyInfo> arguments; std::vector<PropertyInfo> arguments;
public: public:
@@ -434,8 +433,7 @@ template <typename T, typename R, typename... P>
template <typename R, typename... P> template <typename R, typename... P>
#endif // TYPED_METHOD_BIND #endif // TYPED_METHOD_BIND
class MethodBindTR : public MethodBind { class MethodBindTR : public MethodBind {
R(MB_T::*method) R (MB_T::*method)(P...);
(P...);
protected: protected:
// GCC raises warnings in the case P = {} as the comparison is always false... // GCC raises warnings in the case P = {} as the comparison is always false...
@@ -517,8 +515,7 @@ template <typename T, typename R, typename... P>
template <typename R, typename... P> template <typename R, typename... P>
#endif // TYPED_METHOD_BIND #endif // TYPED_METHOD_BIND
class MethodBindTRC : public MethodBind { class MethodBindTRC : public MethodBind {
R(MB_T::*method) R (MB_T::*method)(P...) const;
(P...) const;
protected: protected:
// GCC raises warnings in the case P = {} as the comparison is always false... // GCC raises warnings in the case P = {} as the comparison is always false...
@@ -663,8 +660,7 @@ MethodBind *create_static_method_bind(void (*p_method)(P...)) {
template <typename R, typename... P> template <typename R, typename... P>
class MethodBindTRS : public MethodBind { class MethodBindTRS : public MethodBind {
R(*function) R (*function)(P...);
(P...);
protected: protected:
// GCC raises warnings in the case P = {} as the comparison is always false... // GCC raises warnings in the case P = {} as the comparison is always false...

View File

@@ -104,8 +104,7 @@ template <typename T, typename R, typename... P>
class CallableCustomMethodPointerRet : public CallableCustomMethodPointerBase { class CallableCustomMethodPointerRet : public CallableCustomMethodPointerBase {
struct Data { struct Data {
T *instance; T *instance;
R(T::*method) R (T::*method)(P...);
(P...);
} data; } data;
static_assert(sizeof(Data) % 4 == 0); static_assert(sizeof(Data) % 4 == 0);
@@ -146,8 +145,7 @@ template <typename T, typename R, typename... P>
class CallableCustomMethodPointerRetC : public CallableCustomMethodPointerBase { class CallableCustomMethodPointerRetC : public CallableCustomMethodPointerBase {
struct Data { struct Data {
T *instance; T *instance;
R(T::*method) R (T::*method)(P...) const;
(P...) const;
} data; } data;
static_assert(sizeof(Data) % 4 == 0); static_assert(sizeof(Data) % 4 == 0);
@@ -227,8 +225,7 @@ Callable create_custom_callable_static_function_pointer(void (*p_method)(P...))
template <typename R, typename... P> template <typename R, typename... P>
class CallableCustomStaticMethodPointerRet : public CallableCustomMethodPointerBase { class CallableCustomStaticMethodPointerRet : public CallableCustomMethodPointerBase {
struct Data { struct Data {
R(*method) R (*method)(P...);
(P...);
} data; } data;
static_assert(sizeof(Data) % 4 == 0); static_assert(sizeof(Data) % 4 == 0);

View File

@@ -113,7 +113,7 @@ public:
CharStringT<T> &operator+=(T p_char); CharStringT<T> &operator+=(T p_char);
int64_t length() const { return size() ? size() - 1 : 0; } int64_t length() const { return size() ? size() - 1 : 0; }
const T *get_data() const; const T *get_data() const;
operator const T *() const { return get_data(); }; operator const T *() const { return get_data(); }
protected: protected:
void copy_from(const T *p_cstr); void copy_from(const T *p_cstr);

View File

@@ -145,7 +145,7 @@ private:
static GDExtensionTypeFromVariantConstructorFunc to_type_constructor[VARIANT_MAX]; static GDExtensionTypeFromVariantConstructorFunc to_type_constructor[VARIANT_MAX];
public: public:
_FORCE_INLINE_ GDExtensionVariantPtr _native_ptr() const { return const_cast<uint8_t(*)[GODOT_CPP_VARIANT_SIZE]>(&opaque); } _FORCE_INLINE_ GDExtensionVariantPtr _native_ptr() const { return const_cast<uint8_t (*)[GODOT_CPP_VARIANT_SIZE]>(&opaque); }
Variant(); Variant();
Variant(std::nullptr_t n) : Variant(std::nullptr_t n) :
Variant() {} Variant() {}

View File

@@ -5,16 +5,16 @@ ignore_missing_imports = true
namespace_packages = true namespace_packages = true
no_implicit_optional = true no_implicit_optional = true
pretty = true pretty = true
scripts_are_modules = true
show_column_numbers = true show_column_numbers = true
warn_redundant_casts = true warn_redundant_casts = true
warn_return_any = true warn_return_any = true
warn_unreachable = true warn_unreachable = true
python_version = "3.8"
[tool.ruff] [tool.ruff]
extend-include = ["SConstruct"] extend-include = ["*SConstruct"]
line-length = 120 line-length = 120
target-version = "py37" target-version = "py38"
[tool.ruff.lint] [tool.ruff.lint]
extend-select = [ extend-select = [
@@ -27,32 +27,32 @@ extend-select = [
] ]
[tool.codespell] [tool.codespell]
enable-colors = "" enable-colors = true
write-changes = "" write-changes = true
check-hidden = "" check-hidden = true
quiet-level = 3 quiet-level = 3
builtin = "clear,rare,en-GB_to_en-US" builtin = ["clear", "rare", "en-GB_to_en-US"]
ignore-words-list = """\ ignore-words-list = [
breaked, "breaked",
cancelled, "cancelled",
checkin, "checkin",
curvelinear, "curvelinear",
doubleclick, "doubleclick",
expct, "expct",
findn, "findn",
gird, "gird",
hel, "hel",
inout, "inout",
labelin, "labelin",
lod, "lod",
mis, "mis",
nd, "nd",
numer, "numer",
ot, "ot",
outin, "outin",
requestor, "requestor",
te, "te",
textin, "textin",
thirdparty, "thirdparty",
vai "vai",
""" ]

View File

@@ -161,7 +161,7 @@ bool Example::_property_can_revert(const StringName &p_name) const {
} else { } else {
return false; return false;
} }
}; }
bool Example::_property_get_revert(const StringName &p_name, Variant &r_property) const { bool Example::_property_get_revert(const StringName &p_name, Variant &r_property) const {
if (p_name == StringName("property_from_list")) { if (p_name == StringName("property_from_list")) {
@@ -170,7 +170,7 @@ bool Example::_property_get_revert(const StringName &p_name, Variant &r_property
} else { } else {
return false; return false;
} }
}; }
void Example::_validate_property(PropertyInfo &p_property) const { void Example::_validate_property(PropertyInfo &p_property) const {
String name = p_property.name; String name = p_property.name;

View File

@@ -58,7 +58,7 @@ class ExampleMin : public Control {
GDCLASS(ExampleMin, Control); GDCLASS(ExampleMin, Control);
protected: protected:
static void _bind_methods(){}; static void _bind_methods() {}
}; };
class Example : public Control { class Example : public Control {